vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Ross Affiliate Posting Form To Be Converted

[F] Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 8:21pm
Can i get this code converted for vforum (board footer) please.
http://tropolis.virtualforums.co.uk/
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* affiliate posting form - ross - http://101support.proboards43.com
  4. NOT to be used or reposted without permission */
  5.  
  6. function requestIt() {
  7. for(r=0; r<td.length; r++) {
  8. if(td[r].width=='30%' && td[r].innerHTML.match(/(Add|Disable|Message)/)) {
  9. td[r].parentNode.style.display = 'none';
  10. }
  11. else if(td[r].width=='30%' && td[r].innerHTML.match(/>Subject:</)) {
  12. td[r].firstChild.innerHTML = 'Forum Name:'
  13. td[r].className = 'windowbg2'; td[r+1].className = 'windowbg2';
  14. }
  15. }
  16. }
  17. function checkAff() {
  18. if(document.getElementsByName('confirm')[0].checked == true) {
  19. url = document.getElementsByName('url')[0];
  20. image = document.getElementsByName('image')[0]
  21. document.postForm.message.value = '[b]Forum Name[/b]: '+ document.postForm.subject.value +'\n\n[b]Forum URL[/b]: '+ url.value +'\n\n[b]Image URL[/b]: '+ image.value +'\n\n\n[b]Code:[/b]\n[size=1]Affiliate("'+url.value +'", "'+image.value+'");[/size]';
  22. document.postForm.submit(true);
  23. }
  24. else
  25. alert('Please check the confirmation box to continue');
  26. }
  27. if(location.href.match(/ion=post$/)) {
  28. obj = document.postForm.message.parentNode.parentNode.parentNode;
  29. for(z=0; z<7; z++){
  30. document.postForm.nextaction.parentNode.removeChild(document.postForm.nextaction.nextSibling); }
  31. button = document.createElement('div');
  32. button.innerHTML = '<input type=button value=Affiliate onClick=checkAff(); />'
  33. document.postForm.nextaction.parentNode.appendChild(button);
  34.  
  35. requestIt()
  36. obj.parentNode.insertBefore(document.createElement('tr'), obj);
  37. obj.previousSibling.className = 'windowbg';
  38. obj.previousSibling.insertCell(0).innerHTML = '<font size=2>Forum URL:</font>';
  39. obj.previousSibling.insertCell(1).innerHTML = '<font size=1><input name=url size=35> The URL of your forum</font>';
  40. obj.parentNode.insertBefore(document.createElement('tr'), obj);
  41. obj.previousSibling.className = 'windowbg2';
  42. obj.previousSibling.insertCell(0).innerHTML = '<font size=2>Image URL:</font>';
  43. obj.previousSibling.insertCell(1).innerHTML = '<table width=100%><tr><td><input name=image size=35></td><td align=left><font size=1>The URL of your mini-banner.<br/>This banner must be 31*88px.</font></td></tr></table>';
  44. obj.parentNode.insertBefore(document.createElement('tr'), obj);
  45. obj.previousSibling.className = 'windowbg';
  46. obj.previousSibling.insertCell(0).innerHTML = '<font size=2>Confirmation:</font>';
  47. obj.previousSibling.insertCell(1).innerHTML = '<font size=1><input type=checkbox name=confirm> Check this box to confirm that our mini-banner has been added to your forum.</font>';
  48. }
  49. //-->
  50. </script>
 

Re: Ross Affiliate Posting Form To Be Converted - Posted By Michael (wrighty) on 18th Feb 08 at 8:23pm
Can you link me to the PB thread please? I want to see what it does.

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 8:29pm
http://bepcanadamaster.proboards105.com/index.cgi?board=aff&action=post



Re: Ross Affiliate Posting Form To Be Converted - Posted By Michael (wrighty) on 18th Feb 08 at 8:30pm
Can't you use the post template code in the index? {Unsure}

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 8:37pm
If i can have it work the same way as this code sure .

Re: Ross Affiliate Posting Form To Be Converted - Posted By Michael (wrighty) on 18th Feb 08 at 8:38pm
well it'll make the post etc... {Unsure}

try it and let me know if it doesn't work like you want it to, if that's the case, I'll recode this! {Smile}

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 8:41pm
Ok i'll give it a shot {Smile} , but it'll have to be abit later on and i'll let you know Wrighty . When i try it .

Re: Ross Affiliate Posting Form To Be Converted - Posted By Michael (wrighty) on 18th Feb 08 at 8:56pm
That's fine! {Smile}

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 10:54pm
I'm sorry to say that the post template code in the index isn't working at all Wrighty {Sad} .


Re: Ross Affiliate Posting Form To Be Converted - Posted By Ross (admin) on 18th Feb 08 at 11:11pm
 
I'm sorry to say that the post template code in the index isn't working at all Wrighty {Sad} .



Can you post the exact code you're trying to use? {Smile}

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 18th Feb 08 at 11:44pm
Its this one that i tried http://support.virtualforums.co.uk/board/database/topic/25/action/view_topic/predefined-posting-template-form//page/1/

well that's the one i think Wrighty was talking about.

But it didn't work at all, i really would like the one i posted if possible {Smile} .

Re: Ross Affiliate Posting Form To Be Converted - Posted By Marc (cr0w) on 19th Feb 08 at 12:58am
 
Its this one that i tried http://support.virtualforums.co.uk/board/database/topic/25/action/view_topic/predefined-posting-template-form//page/1/

well that's the one i think Wrighty was talking about.

But it didn't work at all, i really would like the one i posted if possible {Smile} .


Ross means post the edited code, so we can see if you made any editing mistakes. {Wink}

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 19th Feb 08 at 3:14am
To be honest i didn't edit the code because when i looked at it, i wasn't sure where to start. I did however put the code in the board footer to see how it works and nothing happened it only showed the thread page .

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 20th Feb 08 at 4:06am
Bump

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 22nd Feb 08 at 3:34am
Bump

Re: Ross Affiliate Posting Form To Be Converted - Posted By Marc (cr0w) on 22nd Feb 08 at 4:51pm
I'll see about getting this completed for you, but as I may be heading out of town later today, I may not be able to get this finished until tomorrow.

Re: Ross Affiliate Posting Form To Be Converted - Posted By CåñåÐå™ (canada) on 22nd Feb 08 at 5:36pm
That's fine my friend Marc {Smile} thank you.

Re: Ross Affiliate Posting Form To Be Converted - Posted By FreeUS (freeus) on 23rd Feb 08 at 2:24am
Hey Canada,heres the one I used on my site..The green is the type(textarea,input,etc.}Blue is the name of the field.Purple is a description.Yellow is the title of the form.Gray is a message you want at the top of the form.
Quote:
<script type="text/javascript">
<!--

/* Predefined Posting Template/Form
Created by Ross of vForums
http://virtualforums.co.uk
Please do not repost outside of
vForums support without permission */

var _title = 'New Code Request';

var _description = 'Please ensure you have a read of the <a href="http://capecoral.vforums.co.uk/board/general/topic/3/action/view_topic/page/1/rules/">Rules</a> before posting. If you break the rules, your thread will be locked and moved to a hidden board for dead codes. You are free to repost your code if you don't break the rules again. Repeatedly breaking the rules will result in a warning.';

var _fields = new Array(); var _f = 0;
_fields[_f++] = new Array('input', '*Code Type', ['size', 40, 'maxLength', 50], '', 'Type of Code/Code Name', true);

_fields[_f++] = new Array('input', 'Forum Link', ['size', 40, 'maxLength', 50], '', 'Link to Your Forum', false);
_fields[_f++] = new Array('input', 'Browser', ['size', 40, 'maxLength', 50], '', 'Browser that you use.', false);

_fields[_f++] = new Array('textarea', '*[Description', ['cols', 40, 'rows', 10], '', 'A short description of either what the problem is or what you want your code to do. You should include as much information as possible, links to other forums/sites and anything else that may be useful.', true);



var _widths = ['100%', '20%', '40%', '40%'];

var _posting_form = {

errors: new Array(),

init: function() {
this.create_form();
},

create_form: function() {
// Create new post layout
var _holder = document.createElement('table');
_holder.setAttribute('className', 'border');
_holder.setAttribute('class', 'border');
_holder.setAttribute('cellSpacing','1');
_holder.setAttribute('cellPadding', '4');
_holder.setAttribute('align', 'center');
_holder.setAttribute('width', _widths[0]);
_holder.setAttribute('id', 'post_form_holder');
_holder.appendChild(document.createElement('tbody'));
_holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
_holder.firstChild.lastChild.lastChild.className = 'title1';
_holder.firstChild.lastChild.lastChild.colSpan = '3';
_holder.firstChild.lastChild.lastChild.lastChild.size = '2';
_holder.firstChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(_title));
if(_description) {
_holder.firstChild.appendChild( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
_holder.firstChild.lastChild.lastChild.setAttribute('className', 'window1');
_holder.firstChild.lastChild.lastChild.setAttribute('class', 'window1');
_holder.firstChild.lastChild.lastChild.setAttribute('colSpan', '3');
_holder.firstChild.lastChild.lastChild.lastChild.setAttribute('size', '2');
_holder.firstChild.lastChild.lastChild.lastChild.innerHTML = _description;
}

for(_f=0; _f<_fields.length; _f++) {
switch(_fields[_f][0]) {
case 'textarea' :
var _tmp = document.createElement('textarea');
if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
_tmp.innerHTML= _fields[_f][3];
break;

case 'select' :
var _tmp = document.createElement('select');
for(_o=0; _o<_fields[_f][3].length; _o++) {
_tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
}
break;

default :
var _tmp = document.createElement('input');
_tmp.type = 'text';
if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
_tmp.setAttribute('value', _fields[_f][3]);
break;
}
_tmp.setAttribute('id', _f);
if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
for(_a=0; _a<_fields[_f][2].length; _a++) {
_tmp.setAttribute(_fields[_f][2][_a++], _fields[_f][2][_a]);
}
}
var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
var _row = document.createElement('tr');
_row.appendChild(document.createElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('vAlign', 'top');
_row.lastChild.setAttribute('width', _widths[1]);
_row.lastChild.appendChild(document.createElement('font'));
_row.lastChild.lastChild.setAttribute('size', '2');
_row.lastChild.lastChild.style.fontWeight = 'bold';
_row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][1] + ':'));
_row.appendChild(document.createElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('width', _widths[2]);
_row.lastChild.appendChild(document.createElement('font'));
_row.lastChild.lastChild.setAttribute('size', '2');
_row.lastChild.lastChild.appendChild(_tmp);
_row.appendChild(document.createElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('vAlign', 'top');
_row.lastChild.setAttribute('width', _widths[3]);
_row.lastChild.appendChild(document.createElement('font'));
_row.lastChild.lastChild.size = '1';
_row.lastChild.lastChild.appendChild(document.createTextNode(_fields[_f][4]));
_holder.firstChild.appendChild(_row);
}
var _submit = document.createElement('tr');
_submit.appendChild(document.createElement('td'));
_submit.lastChild.setAttribute('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
_submit.lastChild.setAttribute('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
_submit.lastChild.setAttribute('align', 'center');
_submit.lastChild.setAttribute('colSpan', 3);
var _button = document.createElement('input');
_button.setAttribute('type', 'button');
_button.setAttribute('value', 'Post Message');
_button.onclick = function() { _posting_form.post_it(); };
_submit.lastChild.appendChild(_button);
_holder.firstChild.appendChild(_submit);
document.post_form.style.display = 'none';
document.post_form.parentNode.insertBefore(_holder, document.post_form);
},

post_it: function() {
// create message and attempt to post it
this.errors = new Array();
document.post_form.message.value = document.post_form.subject.value = '';
var _sub = document.getElementById('0').value;
_fields[0][5] = true;
document.post_form.subject.value = _sub;
for(_f=0; _f<_fields.length; _f++) {
if(document.getElementById(_f)) {
_value = document.getElementById(_f).value;
if(!_value || _value.match(/^s*$/)) {
if(_f > 0 && _fields[_f][5])
this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
else
_value = 'None';
}
document.post_form.message.value += '' + _fields[_f][1] + ': ' + _value + '\n\n';
}
}
if(this.errors.length == 0)
document.post_form.post.click();
else
this.show_error();
},

show_error: function() {
if("undefined" != typeof arguments[0] && arguments[0]) {
this.errors.push(arguments[0]);
} else {
// Show Errors
if(document.getElementById('status_holder')) {
document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
document.getElementById('status_holder').style.display = 'block';
}
}
}
}


if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
_posting_form.init();
}

//-->
</script>