1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!--
3 * FCKeditor - The text editor for internet
4 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
5 *
6 * Licensed under the terms of the GNU Lesser General Public License:
7 *    http://www.opensource.org/licenses/lgpl-license.php
8 *
9 * For further information visit:
10 *    http://www.fckeditor.net/
11 *
12 * File Name: fck_abbr.html
13 *  Plugin to insert abbr-title TAGs which let a text-info pop up while mousecursor moves over this text.
14 *
15 * File Authors:
16 *  SNOOPY-0815
17 *   [based upon plugin infopup by Thomas Goerldt]
18 *	further developed by:
19 *  kwillems (kwillems-at-zonnet.nl 02-14-2007)
20
21-->
22<html>
23<head>
24<title>Abbr</title>
25<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
26<meta content="noindex, nofollow" name="robots">
27<script language="javascript">
28
29var oEditor	= window.parent.InnerDialogLoaded() ;
30var FCKLang	= oEditor.FCKLang ;
31var FCKAbbr	= oEditor.FCKAbbr ;
32var FCKAbbrSelection;
33var immutable_plugin;
34var immutable_id;
35var immutable_text;
36
37window.onload = function () {
38	// First of all, translate the dialog box texts
39	oEditor.FCKLanguageManager.TranslatePage( document );
40
41	var oLink = getoLink();
42
43	var oSelection = checkSelection ();
44    FCKAbbrSelection = oSelection;
45
46	// display an alert-message when no selection is made if we want to make a abbr
47	// and also the cursor is not placed in a abbr
48	if(oSelection == '' && !oLink) {
49		document.getElementById('message').style.display = 'block';
50
51	}
52	// the cursor is placed in a abbr, so we have one!
53	// we want to display the inputfield and the checknbox to remove the abbr
54	else if (oLink) {
55		document.getElementById('inputfield').style.display = 'block';
56		document.getElementById('checkbox').style.display = 'block';
57		oEditor.FCK.Selection.SelectNode( oLink );
58		document.getElementById("infotext").value = oLink.title;
59		document.getElementById('infotext').focus();
60	}
61	// we want to insert a abbr
62	else {
63		document.getElementById('inputfield').style.display = 'block';
64        document.getElementById('stet_checkbox').style.display = 'block';
65        document.getElementById('stet_checkbox').style.display = 'block';
66        document.getElementById('edit_checkbox').style.display = 'block';
67
68	}
69
70	// Show the "Ok" button?
71	if(oSelection != '' || oLink) {
72		window.parent.SetOkButton( true ) ;
73		document.getElementById('infotext').focus();
74	}
75}
76
77
78function toggle_infotext() {
79   if(document.getElementById("stet").checked) {
80     document.getElementById('infotext').value = 'stet';
81     document.getElementById('infotext').disabled = true;
82   }
83  else {
84     document.getElementById('infotext').disabled = false;
85     document.getElementById('infotext').value = '';
86  }
87}
88
89function Ok() {
90    if(document.getElementById("remove").checked) {
91        document.getElementById("infotext").value = '';
92    }
93
94    if(document.getElementById("edit").checked) {
95       var checked = document.getElementById('revise_imm_markup').checked;
96
97       if(checked) {
98         text =  document.getElementById("edited_text").value ;
99         text = text.replace(/\n/g,"");
100         text = text.replace(/\s+/g," ");
101         oEditor.FCK.fckLImmutables[immutable_id] = text;
102         var regex = new RegExp(">(.*)<");
103         matches = text.match(regex);
104         if(matches && matches[1]){
105           FCKAbbr.InsertEdited(matches[1]);
106         }
107             return true;
108       }
109
110       if(immutable_plugin) {
111         var regex = new RegExp(">.*<");
112         text = document.getElementById("edited_text").value;
113         text = text.replace(/\n/g,"");
114         text = text.replace(/\s+/g," ");
115         immutable_plugin = immutable_plugin.replace(regex,'>' + text + '//<');
116         immutable_plugin = immutable_plugin.replace(/\/{2}<\/{2}/g, '<');
117         oEditor.FCK.fckLImmutables[immutable_id] = immutable_plugin;
118         FCKAbbr.InsertEdited(text);
119       }
120       else {
121         FCKAbbr.InsertEdited(document.getElementById("edited_text").value);
122       }
123       return true;
124    }
125
126
127		if (oLink && document.getElementById("infotext").value != '') {
128							// if abbr already exists, insert or replace title
129			oLink.title=document.getElementById("infotext").value;
130		}
131		else if(oLink && oLink.title && document.getElementById("infotext").value == '') {			// title should me removed
132
133			oLink.removeAttribute('title');
134            FCKAbbr.Insert(document.getElementById("infotext").value, oEditor.FCKBrowserInfo.IsSafari, document.getElementById("stet").checked);
135		}
136		else {
137												// otherwise, make a new element, with or without title
138			FCKAbbr.Insert(document.getElementById("infotext").value, oEditor.FCKBrowserInfo.IsSafari, document.getElementById("stet").checked);
139		}
140
141	return true;
142}
143
144var saveSelection = "";
145function checkSelection () {
146	if (document.selection) {													// IE
147		oSelection = oEditor.FCK.EditorDocument.selection.createRange().text;
148	}
149	else if (window.getSelection) {												// Mozilla, Safari (ok, I know: Safari ain't supported yet!
150		oSelection = oEditor.FCK.EditorWindow.getSelection();
151	}
152	else if (document.getSelection) {
153		oSelection = oEditor.FCK.EditorDocument.getSelection();					// Mozilla, Netscape, Opera
154	}
155
156    var parent = getSelectedNodeParent().parentNode;
157    var id = parent ?  parent.getAttribute('id') : false ;
158
159    if(!id) {  //IE when selection overshoots span element
160        saveSelection = oSelection.toString();
161        saveSelection = saveSelection.replace(/^\s+/,"");
162        saveSelection = saveSelection.replace(/\s+$/,"");
163        parent = getCurrentNode(parent);
164        id = parent ?  parent.getAttribute('id') : false ;
165        // id = parent.getAttribute('id');
166        if(!id || !id.match(/imm_\d+/)) {
167            if(parent && parent.parentNode) {
168               id = parent.parentNode.getAttribute('id');
169            }
170        }
171    }
172
173    if(id) {
174      if((matches= id.match(/imm_(\d+)/))) {
175            immutable_plugin = oEditor.FCK.fckLImmutables[matches[1]];
176            immutable_id = matches[1];
177            immutable_text = oSelection.toString();
178
179      }
180
181    }
182
183	return oSelection;
184
185}
186
187function getCurrentNode(node) {
188
189  var children = node.childNodes;
190
191  for(var i=0; i<children.length; i++) {
192
193      if(children[i].nodeName == '#text') {
194        var text = children[i].nodeValue;
195        if(text) {
196            text = text.replace(/^\s+/);
197            text = text.replace(/\s+$/);
198            if(text == saveSelection) {
199                return children[i].parentNode;
200            }
201        }
202      }
203         var retv = getCurrentNode(children[i]);
204         if(retv) return retv;
205    }
206
207}
208function toggleImmutable() {
209   var checked = document.getElementById('revise_imm_markup').checked;
210
211   if(checked) {
212      document.getElementById('edited_text').value  = immutable_plugin.replace(/\/{2}<\/{2}/g, '<');
213   }
214   else document.getElementById('edited_text').value = immutable_text;
215}
216
217function getSelectedNodeParent()
218{
219    if (document.selection)
220        return oEditor.FCK.EditorDocument.selection.createRange().parentElement();
221    else
222    {
223        var selection = oEditor.FCK.EditorWindow.getSelection();
224        if (selection.rangeCount > 0)
225                return selection.getRangeAt(0).startContainer.parentNode;
226    }
227}
228
229function getoLink () {
230	if( oEditor.FCKBrowserInfo.IsIE) {
231		oLink = oEditor.FCK.Selection.MoveToAncestorNode( 'plugin' )				// lower-case!!!!!!! I don't know why, but it's working!!!
232        if(!oLink) oLink = oEditor.FCK.Selection.MoveToAncestorNode( 'PLUGIN' );
233	}
234	else {
235		oLink = oEditor.FCK.Selection.MoveToAncestorNode( 'PLUGIN' );
236	}
237
238	return oLink;
239}
240
241
242function openEditor() {
243        if(!FCKAbbrSelection) return;
244		document.getElementById('inputfield').style.display = 'none';
245        document.getElementById('stet_checkbox').style.display = 'none';
246        document.getElementById('stet_checkbox').style.display = 'none';
247        document.getElementById('edit_checkbox').style.display = 'none';
248        document.getElementById('editing_area').style.display = 'block';
249        if(immutable_plugin) {
250            document.getElementById('imm_revise_dlg').style.display = 'block';
251           // document.getElementById('editing_area_header').innerHTML = "Immutable Plugin Editor";
252            document.getElementById('editing_area_header').style.display = 'inline';
253        }
254        var str = FCKAbbrSelection.toString();
255        str = str.replace(/([\{\}:~\?\!])\s/g, "$1");
256        document.getElementById('edited_text').value = str;
257
258
259}
260
261</script>
262
263<style type="text/css">
264#message, #inputfield, #checkbox,#stet_checkbox, #edit_checkbox, #editing_area { display: none; }
265/*#inputfield, .title { font-size: 10pt; } */
266#checkbox,#stet_checkbox, #edit_checkbox, #edited_text { font-size: 9pt; }
267#message { font-size: 11pt; color: white; background-color:blue; }
268abbr { border-bottom: 1px dotted rgb(102, 102, 102); cursor: help; }
269</style>
270
271</head>
272<body  style="OVERFLOW: auto">
273
274<table cellSpacing="8"  cellPadding="0" align="center" border="0">
275<tr>
276<td>
277<span id="message" fckLang="AbbrDlgSelectFirst">You have to select the plugin syntax first!</span>
278<div id="inputfield">
279<span fckLang="AbbrDlgHLCreate"><b>Create a Plugin</b></span><br />
280<span fckLang="DlgNotAvail">No Longer Available. </span> See documentation.
281<input type = "hidden" size="30" name="infotext" id="infotext"  value="">
282</div>
283
284<tr><td>
285<div id="stet_checkbox">
286<span fckLang="AbbrDlgHLStet"><b class="title" >Stet Plugin</b></span><br />
287<span fckLang="DlgNotAvail"> No Longer Available.</span> <span fckLang="DlgPluginUseNowiki"> Use &lt;nowiki&gt;</span>
288<br />
289<input id="stet" type="hidden" value="">&nbsp;&nbsp;<label for="stet">
290<span fckLang="AbbrDlgStet">Create a string literal from text containing HTML and/or DokuWiki Markup characters </span></label>
291<br>
292</div>
293<tr><td>
294<div id="edit_checkbox"><span fckLang="AbbrDlgHLEdit">
295<b class="title">Edit Dokuwiki Plugin</b></span><br>
296<input id="edit" onclick="openEditor();" type="checkbox">&nbsp;&nbsp;&nbsp;<label for="edit">
297<span fckLang="AbbrDlgEditPlugin">Edit a plugin</span></label></div>
298</td>
299</tr>
300
301<tr><td>
302<div id="checkbox">
303<input id="remove" type="checkbox">&nbsp;&nbsp;&nbsp;<label for="remove">
304<span fckLang="AbbrDlgRemove">Remove Plugin</span></label></div>
305</td>
306</tr>
307</table>
308
309<div id='editing_area' style="display:none;">
310<span id="editing_area_header" style="font-size:175%; font-weight:bold; display:none;"
311              fckLang="ImmutableEditorHeader">Immutable Plugin Editor</span><br/><br/>
312<textarea id="edited_text" rows=8 cols=40>
313text area
314</textarea>
315<br>
316<div id="imm_revise_dlg" style = 'display:none'>
317<input id="revise_imm_markup" onclick="toggleImmutable();" type="checkbox">&nbsp;&nbsp;&nbsp;
318<label for="imm_revise_markup"><span style="font-size:150%" fckLang="AbbrDlgImmRevise"
319>Revise Plugin Syntax</span></label></div>
320</div>
321</div>
322
323
324</body>
325</html>
326