1 rizwank 1.1 <script language="JavaScript" type="text/javascript">
2 <!--
3 // bbCode control by
4 // subBlue design
5 // www.subBlue.com
6
7 // Startup variables
8 var imageTag = false;
9 var theSelection = false;
10
11 // Check for Browser & Platform for PC & IE specific bits
12 // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
13 var clientPC = navigator.userAgent.toLowerCase(); // Get client info
14 var clientVer = parseInt(navigator.appVersion); // Get browser version
15
16 var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
17 var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
18 && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
19 && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
20 var is_moz = 0;
21
22 rizwank 1.1 var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
23 var is_mac = (clientPC.indexOf("mac")!=-1);
24
25 // Helpline messages
26 b_help = "{L_BBCODE_B_HELP}";
27 i_help = "{L_BBCODE_I_HELP}";
28 u_help = "{L_BBCODE_U_HELP}";
29 q_help = "{L_BBCODE_Q_HELP}";
30 c_help = "{L_BBCODE_C_HELP}";
31 l_help = "{L_BBCODE_L_HELP}";
32 o_help = "{L_BBCODE_O_HELP}";
33 p_help = "{L_BBCODE_P_HELP}";
34 w_help = "{L_BBCODE_W_HELP}";
35 a_help = "{L_BBCODE_A_HELP}";
36 s_help = "{L_BBCODE_S_HELP}";
37 f_help = "{L_BBCODE_F_HELP}";
38
39 // Define the bbCode tags
40 bbcode = new Array();
41 bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
42 imageTag = false;
43 rizwank 1.1
44 // Shows the help messages in the helpline window
45 function helpline(help) {
46 document.post.helpbox.value = eval(help + "_help");
47 }
48
49
50 // Replacement for arrayname.length property
51 function getarraysize(thearray) {
52 for (i = 0; i < thearray.length; i++) {
53 if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
54 return i;
55 }
56 return thearray.length;
57 }
58
59 // Replacement for arrayname.push(value) not implemented in IE until version 5.5
60 // Appends element to the array
61 function arraypush(thearray,value) {
62 thearray[ getarraysize(thearray) ] = value;
63 }
64 rizwank 1.1
65 // Replacement for arrayname.pop() not implemented in IE until version 5.5
66 // Removes and returns the last element of an array
67 function arraypop(thearray) {
68 thearraysize = getarraysize(thearray);
69 retval = thearray[thearraysize - 1];
70 delete thearray[thearraysize - 1];
71 return retval;
72 }
73
74
75 function checkForm() {
76
77 formErrors = false;
78
79 if (document.post.message.value.length < 2) {
80 formErrors = "{L_EMPTY_MESSAGE}";
81 }
82
83 if (formErrors) {
84 alert(formErrors);
85 rizwank 1.1 return false;
86 } else {
87 bbstyle(-1);
88 //formObj.preview.disabled = true;
89 //formObj.submit.disabled = true;
90 return true;
91 }
92 }
93
94 function emoticon(text) {
95 var txtarea = document.post.message;
96 text = ' ' + text + ' ';
97 if (txtarea.createTextRange && txtarea.caretPos) {
98 var caretPos = txtarea.caretPos;
99 caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
100 txtarea.focus();
101 } else {
102 txtarea.value += text;
103 txtarea.focus();
104 }
105 }
106 rizwank 1.1
107 function bbfontstyle(bbopen, bbclose) {
108 var txtarea = document.post.message;
109
110 if ((clientVer >= 4) && is_ie && is_win) {
111 theSelection = document.selection.createRange().text;
112 if (!theSelection) {
113 txtarea.value += bbopen + bbclose;
114 txtarea.focus();
115 return;
116 }
117 document.selection.createRange().text = bbopen + theSelection + bbclose;
118 txtarea.focus();
119 return;
120 }
121 else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
122 {
123 mozWrap(txtarea, bbopen, bbclose);
124 return;
125 }
126 else
127 rizwank 1.1 {
128 txtarea.value += bbopen + bbclose;
129 txtarea.focus();
130 }
131 storeCaret(txtarea);
132 }
133
134
135 function bbstyle(bbnumber) {
136 var txtarea = document.post.message;
137
138 donotinsert = false;
139 theSelection = false;
140 bblast = 0;
141
142 if (bbnumber == -1) { // Close all open tags & default button names
143 while (bbcode[0]) {
144 butnumber = arraypop(bbcode) - 1;
145 txtarea.value += bbtags[butnumber + 1];
146 buttext = eval('document.post.addbbcode' + butnumber + '.value');
147 eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
148 rizwank 1.1 }
149 imageTag = false; // All tags are closed including image tags :D
150 txtarea.focus();
151 return;
152 }
153
154 if ((clientVer >= 4) && is_ie && is_win)
155 {
156 theSelection = document.selection.createRange().text; // Get text selection
157 if (theSelection) {
158 // Add tags around selection
159 document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
160 txtarea.focus();
161 theSelection = '';
162 return;
163 }
164 }
165 else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
166 {
167 mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
168 return;
169 rizwank 1.1 }
170
171 // Find last occurance of an open tag the same as the one just clicked
172 for (i = 0; i < bbcode.length; i++) {
173 if (bbcode[i] == bbnumber+1) {
174 bblast = i;
175 donotinsert = true;
176 }
177 }
178
179 if (donotinsert) { // Close all open tags up to the one just clicked & default button names
180 while (bbcode[bblast]) {
181 butnumber = arraypop(bbcode) - 1;
182 txtarea.value += bbtags[butnumber + 1];
183 buttext = eval('document.post.addbbcode' + butnumber + '.value');
184 eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
185 imageTag = false;
186 }
187 txtarea.focus();
188 return;
189 } else { // Open tags
190 rizwank 1.1
191 if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
192 txtarea.value += bbtags[15];
193 lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
194 document.post.addbbcode14.value = "Img"; // Return button back to normal state
195 imageTag = false;
196 }
197
198 // Open tag
199 txtarea.value += bbtags[bbnumber];
200 if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
201 arraypush(bbcode,bbnumber+1);
202 eval('document.post.addbbcode'+bbnumber+'.value += "*"');
203 txtarea.focus();
204 return;
205 }
206 storeCaret(txtarea);
207 }
208
209 // From http://www.massless.org/mozedit/
210 function mozWrap(txtarea, open, close)
211 rizwank 1.1 {
212 var selLength = txtarea.textLength;
213 var selStart = txtarea.selectionStart;
214 var selEnd = txtarea.selectionEnd;
215 if (selEnd == 1 || selEnd == 2)
216 selEnd = selLength;
217
218 var s1 = (txtarea.value).substring(0,selStart);
219 var s2 = (txtarea.value).substring(selStart, selEnd)
220 var s3 = (txtarea.value).substring(selEnd, selLength);
221 txtarea.value = s1 + open + s2 + close + s3;
222 return;
223 }
224
225 // Insert at Claret position. Code from
226 // http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
227 function storeCaret(textEl) {
228 if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
229 }
230
231 //-->
232 rizwank 1.1 </script>
233
234 <!-- BEGIN privmsg_extensions -->
235 <table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
236 <tr>
237 <td valign="top" align="center" width="100%">
238 <table height="40" cellspacing="2" cellpadding="2" border="0">
239 <tr valign="middle">
240 <td>{INBOX_IMG}</td>
241 <td><span class="cattitle">{INBOX_LINK} </span></td>
242 <td>{SENTBOX_IMG}</td>
243 <td><span class="cattitle">{SENTBOX_LINK} </span></td>
244 <td>{OUTBOX_IMG}</td>
245 <td><span class="cattitle">{OUTBOX_LINK} </span></td>
246 <td>{SAVEBOX_IMG}</td>
247 <td><span class="cattitle">{SAVEBOX_LINK} </span></td>
248 </tr>
249 </table>
250 </td>
251 </tr>
252 </table>
253 rizwank 1.1
254 <br clear="all" />
255 <!-- END privmsg_extensions -->
256
257 <form action="{S_POST_ACTION}" method="post" name="post" onsubmit="return checkForm(this)">
258
259 {POST_PREVIEW_BOX}
260 {ERROR_BOX}
261
262 <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
263 <tr>
264 <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>
265 <!-- BEGIN switch_not_privmsg -->
266 -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
267 <!-- END switch_not_privmsg -->
268 </tr>
269 </table>
270
271 <table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
272 <tr>
273 <th class="thHead" colspan="2" height="25"><b>{L_POST_A}</b></th>
274 rizwank 1.1 </tr>
275 <!-- BEGIN switch_username_select -->
276 <tr>
277 <td class="row1"><span class="gen"><b>{L_USERNAME}</b></span></td>
278 <td class="row2"><span class="genmed"><input type="text" class="post" tabindex="1" name="username" size="25" maxlength="25" value="{USERNAME}" /></span></td>
279 </tr>
280 <!-- END switch_username_select -->
281 <!-- BEGIN switch_privmsg -->
282 <tr>
283 <td class="row1"><span class="gen"><b>{L_USERNAME}</b></span></td>
284 <td class="row2"><span class="genmed"><input type="text" class="post" name="username" maxlength="25" size="25" tabindex="1" value="{USERNAME}" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></span></td>
285 </tr>
286 <!-- END switch_privmsg -->
287 <tr>
288 <td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td>
289 <td class="row2" width="78%"> <span class="gen">
290 <input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />
291 </span> </td>
292 </tr>
293 <tr>
294 <td class="row1" valign="top">
295 rizwank 1.1 <table width="100%" border="0" cellspacing="0" cellpadding="1">
296 <tr>
297 <td><span class="gen"><b>{L_MESSAGE_BODY}</b></span> </td>
298 </tr>
299 <tr>
300 <td valign="middle" align="center"> <br />
301 <table width="100" border="0" cellspacing="0" cellpadding="5">
302 <tr align="center">
303 <td colspan="{S_SMILIES_COLSPAN}" class="gensmall"><b>{L_EMOTICONS}</b></td>
304 </tr>
305 <!-- BEGIN smilies_row -->
306 <tr align="center" valign="middle">
307 <!-- BEGIN smilies_col -->
308 <td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>
309 <!-- END smilies_col -->
310 </tr>
311 <!-- END smilies_row -->
312 <!-- BEGIN switch_smilies_extra -->
313 <tr align="center">
314 <td colspan="{S_SMILIES_COLSPAN}"><span class="nav"><a href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=250');return false;" target="_phpbbsmilies" class="nav">{L_MORE_SMILIES}</a></span></td>
315 </tr>
316 rizwank 1.1 <!-- END switch_smilies_extra -->
317 </table>
318 </td>
319 </tr>
320 </table>
321 </td>
322 <td class="row2" valign="top"><span class="gen"> <span class="genmed"> </span>
323 <table width="450" border="0" cellspacing="0" cellpadding="2">
324 <tr align="center" valign="middle">
325 <td><span class="genmed">
326 <input type="button" class="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onClick="bbstyle(0)" onMouseOver="helpline('b')" />
327 </span></td>
328 <td><span class="genmed">
329 <input type="button" class="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onClick="bbstyle(2)" onMouseOver="helpline('i')" />
330 </span></td>
331 <td><span class="genmed">
332 <input type="button" class="button" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onClick="bbstyle(4)" onMouseOver="helpline('u')" />
333 </span></td>
334 <td><span class="genmed">
335 <input type="button" class="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onClick="bbstyle(6)" onMouseOver="helpline('q')" />
336 </span></td>
337 rizwank 1.1 <td><span class="genmed">
338 <input type="button" class="button" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onClick="bbstyle(8)" onMouseOver="helpline('c')" />
339 </span></td>
340 <td><span class="genmed">
341 <input type="button" class="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onClick="bbstyle(10)" onMouseOver="helpline('l')" />
342 </span></td>
343 <td><span class="genmed">
344 <input type="button" class="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onClick="bbstyle(12)" onMouseOver="helpline('o')" />
345 </span></td>
346 <td><span class="genmed">
347 <input type="button" class="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onClick="bbstyle(14)" onMouseOver="helpline('p')" />
348 </span></td>
349 <td><span class="genmed">
350 <input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
351 </span></td>
352 </tr>
353 <tr>
354 <td colspan="9">
355 <table width="100%" border="0" cellspacing="0" cellpadding="0">
356 <tr>
357 <td><span class="genmed"> {L_FONT_COLOR}:
358 rizwank 1.1 <select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">
359 <option style="color:black; background-color: {T_TD_COLOR1}" value="{T_FONTCOLOR1}" class="genmed">{L_COLOR_DEFAULT}</option>
360 <option style="color:darkred; background-color: {T_TD_COLOR1}" value="darkred" class="genmed">{L_COLOR_DARK_RED}</option>
361 <option style="color:red; background-color: {T_TD_COLOR1}" value="red" class="genmed">{L_COLOR_RED}</option>
362 <option style="color:orange; background-color: {T_TD_COLOR1}" value="orange" class="genmed">{L_COLOR_ORANGE}</option>
363 <option style="color:brown; background-color: {T_TD_COLOR1}" value="brown" class="genmed">{L_COLOR_BROWN}</option>
364 <option style="color:yellow; background-color: {T_TD_COLOR1}" value="yellow" class="genmed">{L_COLOR_YELLOW}</option>
365 <option style="color:green; background-color: {T_TD_COLOR1}" value="green" class="genmed">{L_COLOR_GREEN}</option>
366 <option style="color:olive; background-color: {T_TD_COLOR1}" value="olive" class="genmed">{L_COLOR_OLIVE}</option>
367 <option style="color:cyan; background-color: {T_TD_COLOR1}" value="cyan" class="genmed">{L_COLOR_CYAN}</option>
368 <option style="color:blue; background-color: {T_TD_COLOR1}" value="blue" class="genmed">{L_COLOR_BLUE}</option>
369 <option style="color:darkblue; background-color: {T_TD_COLOR1}" value="darkblue" class="genmed">{L_COLOR_DARK_BLUE}</option>
370 <option style="color:indigo; background-color: {T_TD_COLOR1}" value="indigo" class="genmed">{L_COLOR_INDIGO}</option>
371 <option style="color:violet; background-color: {T_TD_COLOR1}" value="violet" class="genmed">{L_COLOR_VIOLET}</option>
372 <option style="color:white; background-color: {T_TD_COLOR1}" value="white" class="genmed">{L_COLOR_WHITE}</option>
373 <option style="color:black; background-color: {T_TD_COLOR1}" value="black" class="genmed">{L_COLOR_BLACK}</option>
374 </select> {L_FONT_SIZE}:<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
375 <option value="7" class="genmed">{L_FONT_TINY}</option>
376 <option value="9" class="genmed">{L_FONT_SMALL}</option>
377 <option value="12" selected class="genmed">{L_FONT_NORMAL}</option>
378 <option value="18" class="genmed">{L_FONT_LARGE}</option>
379 rizwank 1.1 <option value="24" class="genmed">{L_FONT_HUGE}</option>
380 </select>
381 </span></td>
382 <td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onMouseOver="helpline('a')">{L_BBCODE_CLOSE_TAGS}</a></span></td>
383 </tr>
384 </table>
385 </td>
386 </tr>
387 <tr>
388 <td colspan="9"> <span class="gensmall">
389 <input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" />
390 </span></td>
391 </tr>
392 <tr>
393 <td colspan="9"><span class="gen">
394 <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>
395 </span></td>
396 </tr>
397 </table>
398 </span></td>
399 </tr>
400 rizwank 1.1 <tr>
401 <td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span><br /><span class="gensmall">{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
402 <td class="row2"><span class="gen"> </span>
403 <table cellspacing="0" cellpadding="1" border="0">
404 <!-- BEGIN switch_html_checkbox -->
405 <tr>
406 <td>
407 <input type="checkbox" name="disable_html" {S_HTML_CHECKED} />
408 </td>
409 <td><span class="gen">{L_DISABLE_HTML}</span></td>
410 </tr>
411 <!-- END switch_html_checkbox -->
412 <!-- BEGIN switch_bbcode_checkbox -->
413 <tr>
414 <td>
415 <input type="checkbox" name="disable_bbcode" {S_BBCODE_CHECKED} />
416 </td>
417 <td><span class="gen">{L_DISABLE_BBCODE}</span></td>
418 </tr>
419 <!-- END switch_bbcode_checkbox -->
420 <!-- BEGIN switch_smilies_checkbox -->
421 rizwank 1.1 <tr>
422 <td>
423 <input type="checkbox" name="disable_smilies" {S_SMILIES_CHECKED} />
424 </td>
425 <td><span class="gen">{L_DISABLE_SMILIES}</span></td>
426 </tr>
427 <!-- END switch_smilies_checkbox -->
428 <!-- BEGIN switch_signature_checkbox -->
429 <tr>
430 <td>
431 <input type="checkbox" name="attach_sig" {S_SIGNATURE_CHECKED} />
432 </td>
433 <td><span class="gen">{L_ATTACH_SIGNATURE}</span></td>
434 </tr>
435 <!-- END switch_signature_checkbox -->
436 <!-- BEGIN switch_notify_checkbox -->
437 <tr>
438 <td>
439 <input type="checkbox" name="notify" {S_NOTIFY_CHECKED} />
440 </td>
441 <td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td>
442 rizwank 1.1 </tr>
443 <!-- END switch_notify_checkbox -->
444 <!-- BEGIN switch_delete_checkbox -->
445 <tr>
446 <td>
447 <input type="checkbox" name="delete" />
448 </td>
449 <td><span class="gen">{L_DELETE_POST}</span></td>
450 </tr>
451 <!-- END switch_delete_checkbox -->
452 <!-- BEGIN switch_type_toggle -->
453 <tr>
454 <td></td>
455 <td><span class="gen">{S_TYPE_TOGGLE}</span></td>
456 </tr>
457 <!-- END switch_type_toggle -->
458 </table>
459 </td>
460 </tr>
461 {POLLBOX}
462 <tr>
463 rizwank 1.1 <td class="catBottom" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_PREVIEW}" /> <input type="submit" accesskey="s" tabindex="6" name="post" class="mainoption" value="{L_SUBMIT}" /></td>
464 </tr>
465 </table>
466
467 <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
468 <tr>
469 <td align="right" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>
470 </tr>
471 </table>
472 </form>
473
474 <table width="100%" cellspacing="2" border="0" align="center">
475 <tr>
476 <td valign="top" align="right">{JUMPBOX}</td>
477 </tr>
478 </table>
479
480 {TOPIC_REVIEW_BOX}
|