(file) Return to edit.iejs.tmpl CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / twiki / templates

  1 rizwank 1.1 %TMPL:INCLUDE{"twiki"}%
  2             %TMPL:DEF{"topicaction"}% <input type="submit" class="twikiSubmit" value=" &nbsp; Preview Changes &nbsp; " />
  3               %SEP% <a class="footerlink" href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%?unlock=on">Cancel</a> edit %TMPL:END%
  4               %TMPL:DEF{"footernote"}%
  5             <div class="TWikiFooterNote">
  6             <font color="#333333" size="-1">
  7             %INCLUDE{"%TWIKIWEB%.WikiSyntaxSummary"}%
  8             </font>
  9              </div>%TMPL:END%
 10             %TMPL:P{"htmldoctype"}%
 11             <head>
 12              <title> %TMPL:P{"titleaction"}%%TOPIC% &lt; %WEB% &lt; %WIKITOOLNAME%</title>
 13              <meta http-equiv="Content-Type" content="text/html; charset=%CHARSET%" />
 14              <base href="%SCRIPTURL%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%" /> <meta name="robots" content="noindex" /> %HTTP_EQUIV_ON_EDIT%
 15             <style>
 16             A.editButton:link {
 17               text-decoration:none;
 18               color:black;
 19               font-size:9pt
 20             }
 21             A.editButton:active {
 22 rizwank 1.1   text-decoration:none;
 23               color:blue
 24             }
 25             A.editButton:hover {
 26               text-decoration:none;
 27               color:blue
 28             }
 29             A.editButton:visited {
 30               text-decoration:none;
 31               color:black;
 32               font-size:9pt
 33             }
 34             .editDropdown {
 35               background-color:ivory;
 36               font-size:7pt
 37             }
 38             </style>
 39             <script type="text/javascript">
 40             <!--HIDE
 41             // =================
 42             function initForm()
 43 rizwank 1.1 {
 44               document.main.text.focus();
 45             }
 46             // =================
 47             function checkAll( theButton, theButtonOffset, theNum, theCheck )
 48             {
 49               // find button element index
 50               var j = 0
 51               for( var i = 0; i <= document.main.length; i++ ) {
 52                 if( theButton == document.main.elements[i] ) {
 53                   j = i
 54                   break
 55                 }
 56               }
 57               // set/clear all checkboxes
 58               var last = j+theButtonOffset+theNum
 59               for( i = last-theNum; i < last; i++ ) {
 60                 document.main.elements[i].checked = theCheck
 61               }
 62             }
 63             // =================
 64 rizwank 1.1 function launchWindow( theWeb, theTopic, theAnchor ) {
 65               if( ! theAnchor ) {
 66                 theAnchor = "";
 67               }
 68               win = open( "%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/" + theWeb + "/" + theTopic + "?skin=plain" + theAnchor,
 69                           theTopic, "titlebar=0,width=500,height=480,resizable,scrollbars");
 70               if( win ) {
 71                 win.focus();
 72               }
 73               return false;
 74             }
 75             // =================
 76             var fancyEdit = false;
 77             var fancyInit = false;
 78             // =================
 79             function doFancyEdit()
 80             {
 81               if( fancyInit ) {
 82                 return( fancyEdit );
 83               }
 84               var major = "";
 85 rizwank 1.1   var minor = "";
 86               for( var i = 0; navigator.appVersion.charAt(i) != "."; i++) {
 87                 major += navigator.appVersion.charAt(i);
 88               }
 89               for( i++; navigator.appVersion.charAt(i) != " "; i++) {
 90                 minor += navigator.appVersion.charAt(i);
 91               }
 92               if(  ( navigator.appName == "Microsoft Internet Explorer" )
 93                 && ( major >= 4 ) ) {
 94                 fancyEdit = true;
 95               }
 96               return( fancyEdit );
 97             }
 98             // =================
 99             function inTextarea() {
100               return( document.all.text.caretPos != null );
101             }
102             // =================
103             function surround( extra )
104             {
105               // Put extra text around selection
106 rizwank 1.1   if( extra == "" || ! inTextarea() ) {
107                 return;
108               }
109               var selection;
110               selection = document.selection.createRange();
111               if( selection != null && selection.text != "" ) {
112                 var selText;
113                 selText = selection.text;
114                 if( selText.charAt( selText.length - 1 ) == " " ) {
115                   selText = selText.substring( 0, ( selText.length - 1 ) );
116                   selection.text = extra + selText + extra + " ";
117                 } else {
118                   selection.text = extra + selText + extra;
119                 }
120                 selection.parentElement().focus();
121               }
122             }
123             // =================
124             function insertStartLine( text )
125             {
126               if( text == "" || ! inTextarea() ) {
127 rizwank 1.1     return;
128               }
129             
130               var range;
131               range = document.all.text.createTextRange();
132               if( range != null ) {
133                 range.moveToPoint( range.offsetLeft, document.all.text.caretPos.offsetTop );
134                 done              = sub( range, "   * ", text );
135                 if( ! done ) done = sub( range, "      * ", text );
136                 if( ! done ) done = sub( range, "         * ", text );
137                 if( ! done ) done = sub( range, "---+++ ", text );
138                 if( ! done ) done = sub( range, "---++ ", text );
139                 if( ! done ) done = sub( range, "---+ ", text );
140                 if( ! done ) {
141                    range.moveToPoint( range.offsetLeft, document.all.text.caretPos.offsetTop );
142                    sub( range, "", text );
143                 }
144                 /*range.text = text;
145                 range.parentElement().focus();*/
146               }
147             }
148 rizwank 1.1 // =================
149             function insert( text )
150             {
151               // insert at cursor
152               if (text == "" || ! inTextarea() ) {
153                 return( false );
154               }
155               document.all.text.caretPos.text = text;
156               document.all.text.caretPos.parentElement().focus();
157             }
158             // =================
159             function insertVariable( variable )
160             {
161               if( variable == "" || ! inTextarea() ) {
162                 return;
163               }
164               extra = "";
165               if( variable == "DRAWING" ) {
166                 name = prompt( "Name of drawing (optional)", "" );
167                 if( ! name ) return;
168                 if( name.length > 0 ) {
169 rizwank 1.1       extra = '{"' + name + '"}';
170                 }
171               } else if( variable == "INCLUDE" ) {
172                 // Could change to pop up window
173                 name = prompt( "Name of topic to include (leave blank to add later)", "" );
174                 if( ! name ) return;
175                 if( name.length == 0 ) {
176                   name = "topic";
177                 }
178                 extra = '{"' + name + '"}';
179               } else if( variable == "GMTIME" ) {
180                 format = prompt( "Current date/time, optional format using ($seconds, $minutes, $hours, $day, $month, $mo, $year, $ye)", "" );
181                 if( ! format ) return;
182                 if( format.length > 0 ) {
183                   extra = '{"' + format + '"}';
184                 }
185               } else if( variable == "SEARCH" ) {
186                 what = prompt( "Common options, delete/alter as required", 'search="searchterm" web="all or webname" nosearch="on" regex="on"' );
187                 if( ! what ) return;
188                 extra = '{' + what + '}';
189               }
190 rizwank 1.1   insert( "%" + variable + extra + "%" );
191             }
192             // =================
193             function sub( range, old, newt )
194             {
195               res = "";
196               var r = range;
197               len = old.length;
198               r.moveEnd( "character", len );
199               if( r.text.substr( 0, len ) == old ) {
200                 r.text = newt + r.text.substr( len );
201                 nlen = r.text.length - old.length;
202                 r.moveEnd( "character", -len ); // put cursor in correct place
203                 r.parentElement().focus();
204                 changedCaret( r );
205                 res = old;
206               }
207               return res;
208             }
209             // =================
210             function toRight()
211 rizwank 1.1 {
212               if( ! inTextarea() ) {
213                 return;
214               }
215               var range;
216               range = document.all.text.createTextRange();
217               text = "";
218               if( range != null ) {
219                 range.moveToPoint( range.offsetLeft, document.all.text.caretPos.offsetTop );
220                 done = sub( range, "   * ", "      * " );
221                 if( ! done ) done = sub( range, "      * ", "         * " );
222                 if( ! done ) done = sub( range, "---+ ", "---++ " );
223                 if( ! done ) done = sub( range, "---++ ", "---+++ " );
224               }
225             }
226             // =================
227             function toLeft()
228             {
229               // move bullet heading etc to left
230               if( ! inTextarea() ) {
231                 return;
232 rizwank 1.1   }
233               var range;
234               range = document.all.text.createTextRange();
235               text = "";
236               if( range != null ) {
237                 range.moveToPoint( range.offsetLeft, document.all.text.caretPos.offsetTop );
238                 done = sub( range, "   * ", "" );
239                 if( ! done ) done = sub( range, "      * ", "   * " );
240                 if( ! done ) done = sub( range, "         * ", "      * " );
241                 if( done ) done = sub( range, "---+++ ", "---++ " );
242                 if( done ) done = sub( range, "---++ ", "---+ " );
243                 if( done ) done = sub( range, "---+ ", "" );
244               }
245             }
246             // =================
247             function storeCaret( textarea )
248             {
249               // always need to know where cursor (caret) position is
250               if( ! doFancyEdit() ) {
251                 return;
252               }
253 rizwank 1.1   if( textarea.createTextRange ) {
254                 textarea.caretPos = document.selection.createRange().duplicate();
255               }
256             }
257             // =================
258             function changedCaret( range )
259             {
260               document.all.text.caretPos = range.duplicate();
261             }
262             // =================
263             function writeToolbar( thisToolbarType )
264             {
265               var configToolbarType = "%IEJS_TOOLBAR%";	// 'top', 'bottom' or 'both'
266               			// FIXME: security hole - anyone can insert arbitrary
267             			// Javascript code here - need Perl code to sanitise
268             			// variables for use by JavaScript, perhaps...
269             			// Actually, this applies almost anywhere in a TWiki
270             			// template that a %-variable is used, not just here.
271               if( ! doFancyEdit() ) {
272                 return;
273               }
274 rizwank 1.1   if( ! ( configToolbarType == "top" || 	// Check if set wrongly or unset
275                   configToolbarType == "bottom" ||     
276                   configToolbarType == "both" ) ) {    
277                 configToolbarType = "both";			// Default to current behaviour
278               }
279               if( thisToolbarType != configToolbarType &&
280               	configToolbarType != "both" ) {
281                 return;					// Display only if required here
282               }
283               var toolbar =
284               '<table border="1" cellpadding="1" bgcolor="gainsboro" style="border-color:black">\n' +
285               '<tr>\n' +
286               '<td title="Bold"><a href="javascript:surround(' + "'*'" + ');" class="editButton">&nbsp;&nbsp; <b>B</b> &nbsp;&nbsp;</a></td>\n' +
287               '<td title="Italic"><a href="javascript:surround(' + "'_'" + ');" class="editButton">&nbsp;&nbsp; <i>I</i> &nbsp;&nbsp;</a></td>\n' +
288               '<td title="Format as code"><a href="javascript:surround(' + "'='" + ');"  class="editButton">&nbsp;&nbsp; <code>C</code> &nbsp;&nbsp;</a></td>\n' +
289               '<td title="Bullet"><a href="javascript:insertStartLine(' + "'   * '" + ');" class="editButton">&nbsp;&nbsp;&bull;&nbsp;&nbsp;</a></td>\n' +
290               '<td title="Bullet to left or heading down one"><a href="javascript:toLeft();" class="editButton">&nbsp;&nbsp;<b>&lt;</b>&nbsp;&nbsp;</a></td>\n' +
291               '<td title="Bullet to right or heading up one"><a href="javascript:toRight();" class="editButton">&nbsp;&nbsp;<b>&gt;</b>&nbsp;&nbsp;</a></td>\n' +
292               '<td title="Insert short signature"><a href="javascript:insert(' + "'[ %WIKIUSERNAME% %DATE% ]'" + ');" class="editButton">&nbsp;&nbsp;<i>Sig</i>&nbsp;&nbsp;</a></td>\n' +
293               '<td title="Insert signature"><a href="javascript:insert(' + "'-- %WIKIUSERNAME% - %DATE%'" + ');" class="editButton"><i>&nbsp;&nbsp;Signature&nbsp;&nbsp;</i></a></td>\n' +
294               '<td><select name="variables" onchange="javascript:insertVariable(this.options [this.selectedIndex].value);this.options [0].selected = true;" class="editDropdown">\n' +
295 rizwank 1.1   '<option value="">Variables ...</option>\n' +
296               '<option value="DRAWING">%<nop>DRAWING%</option>\n' +
297               '<option value="INCLUDE">%<nop>INCLUDE%</option>\n' +
298               '<option value="GMTIME">%<nop>GMTIME%</option>\n' +
299               '<option value="TOC">%<nop>TOC%</option>\n' +
300               '<option value="SEARCH">%<nop>SEARCH%</option>\n' +
301               '</select></td>\n' +
302               '<td title="Headings, horizontal rule, ...">\n' +
303               '<select name="other" onchange="insertStartLine(this.options [this.selectedIndex].value);this.options [0].selected = true" class="editDropdown">\n' +
304               '<option value="">Other ...</option>\n' +
305               '<option value="---+ ">h1</option>\n' +
306               '<option value="---++ ">h2</option>\n' +
307               '<option value="---+++ ">h3</option>\n' +
308               '<option value="---++++ ">h4</option>\n' +
309               '<option value="--- ">hr</option>\n' +
310               '</select>\n' +
311               '</td>\n' +
312               '<td>\n' +
313               '<select name="topic" onchange="insert(this.options [this.selectedIndex].value);this.options [0].selected = true" class="editDropdown">\n' +
314               '<option value="">Topic ...</option>\n' +
315               '%TOPICLIST{"<option value=$qname>$name</option>" separator=" "}%\n' +
316 rizwank 1.1   '</select>\n' +
317               '</td>\n' +
318               '</tr>\n' +
319               '</table>\n';
320               document.write( toolbar );
321               return;
322             }
323             // =================
324             function writeJavaScriptNote()
325             {
326               if( doFancyEdit() ) {
327                 return;
328               }
329               document.write("<br /><i>Note:</i> An advanced <nop>JavaScript editor is available for Microsoft Internet Explorer 4.0 and later");
330               return;
331             }
332             // =================
333             //STOP HIDING-->
334             </script>
335             </head>
336             <body bgcolor="#ffffff" onLoad="initForm()">
337 rizwank 1.1 #PageTop
338             <form name="main" action="%SCRIPTURLPATH%/preview%SCRIPTSUFFIX%/%WEB%/%TOPIC%" method="post">
339             %TMPL:DEF{"titleaction"}%(edit) %TMPL:END%
340             %TMPL:DEF{"webaction"}%Change topic%TMPL:END%
341             %TMPL:P{"simpleheader"}%
342             <script type="text/javascript">
343             <!--HIDE
344             writeToolbar("top");
345             //STOP HIDING-->
346             </script>
347             <textarea name="text" id="text" wrap="virtual" rows="%EDITBOXHEIGHT%" cols="%EDITBOXWIDTH%" style="%EDITBOXSTYLE%" onclick="storeCaret(this)" onKeyDown="if(window.event.keyCode==27) return false;" onKeyUp="storeCaret(this)" onselect="storeCaret(this)" >%TEXT%</textarea>
348             <script type="text/javascript">
349             <!--HIDE
350             writeToolbar("bottom");
351             //STOP HIDING-->
352             </script>
353             <input type="hidden" name="formtemplate" value="%FORMTEMPLATE%" />
354             <input type="hidden" name="topicparent" value="%TOPICPARENT%" />
355             <input type="hidden" name="cmd" value="%CMD%" />
356             See below for help in editing this page.
357             <script type="text/javascript">
358 rizwank 1.1 <!--HIDE
359             // Uncomment the next line if you really want to warn non-IE users that they 
360             // could use this template's editor in IE.
361             // writeJavaScriptNote();
362             //STOP HIDING-->
363             </script>
364             <table border="0" cellpadding="2" cellspacing="0">
365              <tr>
366               <td><b>-- <nop>%WIKIUSERNAME% - %DATE%</b></td>
367               <td> &nbsp;&nbsp; <code>&lt;==</code> Your signature for easy copy and paste (triple click to select)</td>
368              </tr>
369             </table>
370             %FORMFIELDS%
371             %TMPL:P{"standardfooter"}%
372             </form>
373             #PageBottom
374             </body>
375             </html>

Rizwan Kassim
Powered by
ViewCVS 0.9.2