19 include_once($ROOT_PATH.
'wysiwyg_plugin.inc');
20 require_once dirname(__FILE__).
'/../../../../core/include/init.inc';
46 wysiwyg_plugin::wysiwyg_plugin($wysiwyg);
47 $this->
_add_button(
'misccite',
'MiscCite',
'Insert Citation',
'false',
'58');
48 $this->
_add_button(
'miscdfn',
'MiscDfn',
'Insert Definition',
'false',
'59');
63 <script type=
"text/javascript" src=
"<?php echo sq_web_path('lib').'/js/general.js' ?>"></script>
64 <script type=
"text/javascript" src=
"<?php echo sq_web_path('fudge').'/var_serialise/var_serialise.js' ?>"></script>
66 <script type=
"text/javascript" language=
"Javascript">
67 var wysiwyg_editing =
true;
70 HTMLArea.prototype._matrixInsertCite =
function() {
74 var currArgs =
new Object();
75 currArgs[
"name"] =
"";
77 var sel = this._getSelection();
78 var range = this._createRange(sel);
79 var text_range =
false;
82 if (sel.type && sel.type.toLowerCase() ==
"control") {
83 var control_range = this._createRange(sel);
84 var text_range = this._createTextRange(sel);
85 if (text_range != null) {
87 editor.selectNodeContents(control_range(0));
89 alert(js_translate(
'object_requires_selection'));
93 sel = this._getSelection();
94 range = this._createRange(sel);
98 var current_cite = this.getClosest(
"cite");
100 if (HTMLArea.is_ie) {
101 inside_html = current_cite.innerHTML;
103 this.selectNodeContents(current_cite);
104 inside_html = editor.getSelectedHTML();
106 this.selectNodeContents(current_cite);
108 inside_html = editor.getSelectedHTML();
110 sel = this._getSelection();
111 range = this._createRange(sel);
114 var reg =
new RegExp(
"<\/?cite ?[^>]*>",
"gi");
115 inside_html = inside_html.replace(reg,
"");
119 var text = this._doc.createDocumentFragment();
121 var div = this._doc.createElement(
"div");
122 div.innerHTML = inside_html;
123 while (div.firstChild) {
124 text.appendChild(div.firstChild);
126 current_cite.parentNode.replaceChild(text, current_cite);
129 if (inside_html !=
'') {
130 this.insertHTML(
'<cite>' + inside_html +
'</cite>');
137 HTMLArea.prototype._matrixInsertDfn =
function() {
141 var currArgs =
new Object();
142 currArgs[
"title"] =
"";
144 var sel = this._getSelection();
145 var range = this._createRange(sel);
146 var text_range =
false;
149 if (sel.type && sel.type.toLowerCase() ==
"control") {
150 var control_range = this._createRange(sel);
151 var text_range = this._createTextRange(sel);
152 if (text_range != null) {
154 editor.selectNodeContents(control_range(0));
156 alert(js_translate(
'object_requires_selection'));
160 sel = this._getSelection();
161 range = this._createRange(sel);
164 var inside_html =
'';
165 var current_dfn = this.getClosest(
"dfn");
167 if (HTMLArea.is_ie) {
168 inside_html = current_dfn.innerHTML;
170 this.selectNodeContents(current_dfn);
171 inside_html = editor.getSelectedHTML();
173 this.selectNodeContents(current_dfn);
175 inside_html = editor.getSelectedHTML();
178 sel = this._getSelection();
179 range = this._createRange(sel);
184 var e =
'^(<dfn [^>]+>)(.*)</dfn>$';
185 var re =
new RegExp(e,
"i");
186 var tag_html = editor.getSelectedHTML().replace(re,
"$1");
188 var re =
new RegExp(
"\n",
"gi");
189 var tag_html = tag_html.replace(re,
"");
191 currArgs[
"title"] = current_dfn.title;
193 re =
new RegExp(
'if \\(!window\\.wysiwyg_editing\\)[\\s]+\\{[\\s]+window\\.open\\([\'"]([^\'"]+)[\'"], [\'"][0-9]+[\'"], [\'"]([^\'"]+)[\'"]\\);',
"gi");
194 results = re.exec(tag_html);
196 if (results != null) {
197 currArgs[
"title"] = results[1];
203 var para_html = inside_html.replace(/(<\/?)P/gi,
"$1p");
207 if (para_html.indexOf(
"<p") > -1) {
212 if (para_html.indexOf(
"<p") != para_html.lastIndexOf(
"<p")) {
213 alert(js_translate(
'select_one_paragraph_at_a_time'));
222 if (this._inPopup ==
true) { in_popup =
'1'; }
224 editor_<?php echo $this->
wysiwyg->name?>._object =
this;
225 var strPage =
"<?php echo $this->get_popup_href('insert_dfn.php')?>?&title=" + escape(currArgs[
"title"]) +
"&dfn=" + escape(inside_html) +
"&editor_name=" + escape(
"<?php echo $this->wysiwyg->name; ?>") +
"&in_popup=" + escape(in_popup);
227 this._popupDialog(
"matrixInsertDfn", strPage, 420, 270,
true,
function(param) {
233 if (param[
"title"] !=
"") {
235 if (param[
"dfn"] != inside_html) { inside_html = param[
"dfn"]; }
237 var html =
'<dfn title="' + param[
"title"] +
'">' + inside_html +
'</dfn>';
240 editor.insertHTML(html, range);
264 this._matrixInsertCite();
267 this._matrixInsertDfn();
284 if (allEnabled == null && this._tmp[
'disable_toolbar'] ==
true) {
285 this.updateToolbar(
false);
290 if (allEnabled == null && this._tmp[
'disable_toolbar'] ==
true) {
291 this.updateToolbar(
false);