2010-04-22 Miguel de Dios <miguel.dedios@artica.es>

* include/javascript/tiny_mce/*: re-added (lost files) js library (BSD) for
	the eyecandy widget for textarea. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2593 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-04-22 18:46:31 +00:00
parent c083229b15
commit d7882076ff
70 changed files with 3439 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/tiny_mce/*: re-added (lost files) js library (BSD) for
the eyecandy widget for textarea.
2010-04-22 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/tiny_mce/*: added js library (BSD) for the eyecandy

View File

@ -0,0 +1,169 @@
tinyMCE.addI18n({en:{
common:{
edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
apply:"Apply",
insert:"Insert",
update:"Update",
cancel:"Cancel",
close:"Close",
browse:"Browse",
class_name:"Class",
not_set:"-- Not set --",
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
invalid_data:"Error: Invalid values entered, these are marked in red.",
more_colors:"More colors"
},
contextmenu:{
align:"Alignment",
left:"Left",
center:"Center",
right:"Right",
full:"Full"
},
insertdatetime:{
date_fmt:"%Y-%m-%d",
time_fmt:"%H:%M:%S",
insertdate_desc:"Insert date",
inserttime_desc:"Insert time",
months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
},
print:{
print_desc:"Print"
},
preview:{
preview_desc:"Preview"
},
directionality:{
ltr_desc:"Direction left to right",
rtl_desc:"Direction right to left"
},
layer:{
insertlayer_desc:"Insert new layer",
forward_desc:"Move forward",
backward_desc:"Move backward",
absolute_desc:"Toggle absolute positioning",
content:"New layer..."
},
save:{
save_desc:"Save",
cancel_desc:"Cancel all changes"
},
nonbreaking:{
nonbreaking_desc:"Insert non-breaking space character"
},
iespell:{
iespell_desc:"Run spell checking",
download:"ieSpell not detected. Do you want to install it now?"
},
advhr:{
advhr_desc:"Horizontal rule"
},
emotions:{
emotions_desc:"Emotions"
},
searchreplace:{
search_desc:"Find",
replace_desc:"Find/Replace"
},
advimage:{
image_desc:"Insert/edit image"
},
advlink:{
link_desc:"Insert/edit link"
},
xhtmlxtras:{
cite_desc:"Citation",
abbr_desc:"Abbreviation",
acronym_desc:"Acronym",
del_desc:"Deletion",
ins_desc:"Insertion",
attribs_desc:"Insert/Edit Attributes"
},
style:{
desc:"Edit CSS Style"
},
paste:{
paste_text_desc:"Paste as Plain Text",
paste_word_desc:"Paste from Word",
selectall_desc:"Select All"
},
paste_dlg:{
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
text_linebreaks:"Keep linebreaks",
word_title:"Use CTRL+V on your keyboard to paste the text into the window."
},
table:{
desc:"Inserts a new table",
row_before_desc:"Insert row before",
row_after_desc:"Insert row after",
delete_row_desc:"Delete row",
col_before_desc:"Insert column before",
col_after_desc:"Insert column after",
delete_col_desc:"Remove column",
split_cells_desc:"Split merged table cells",
merge_cells_desc:"Merge table cells",
row_desc:"Table row properties",
cell_desc:"Table cell properties",
props_desc:"Table properties",
paste_row_before_desc:"Paste table row before",
paste_row_after_desc:"Paste table row after",
cut_row_desc:"Cut table row",
copy_row_desc:"Copy table row",
del:"Delete table",
row:"Row",
col:"Column",
cell:"Cell"
},
autosave:{
unload_msg:"The changes you made will be lost if you navigate away from this page.",
restore_content: "Restore auto-saved content",
warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?"
},
fullscreen:{
desc:"Toggle fullscreen mode"
},
media:{
desc:"Insert / edit embedded media",
edit:"Edit embedded media"
},
fullpage:{
desc:"Document properties"
},
template:{
desc:"Insert predefined template content"
},
visualchars:{
desc:"Visual control characters on/off."
},
spellchecker:{
desc:"Toggle spellchecker",
menu:"Spellchecker settings",
ignore_word:"Ignore word",
ignore_words:"Ignore all",
langs:"Languages",
wait:"Please wait...",
sug:"Suggestions",
no_sug:"No suggestions",
no_mpell:"No misspellings found."
},
pagebreak:{
desc:"Insert page break."
},
advlist : {
types : 'Types',
def : 'Default',
lower_alpha : "Lower alpha",
lower_greek : "Lower greek",
lower_roman : "Lower roman",
upper_alpha : "Upper alpha",
upper_roman : "Upper roman",
circle : "Circle",
disc : "Disc",
square : "Square"
}
}});

View File

@ -0,0 +1,5 @@
input.radio {border:1px none #000; background:transparent; vertical-align:middle;}
.panel_wrapper div.current {height:80px;}
#width {width:50px; vertical-align:middle;}
#width2 {width:50px; vertical-align:middle;}
#size {width:100px;}

View File

@ -0,0 +1,43 @@
var AdvHRDialog = {
init : function(ed) {
var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
w = dom.getAttrib(n, 'width');
f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
},
update : function() {
var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
h = '<hr';
if (f.size.value) {
h += ' size="' + f.size.value + '"';
st += ' height:' + f.size.value + 'px;';
}
if (f.width.value) {
h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
}
if (f.noshade.checked) {
h += ' noshade="noshade"';
st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
}
if (ed.settings.inline_styles)
h += ' style="' + tinymce.trim(st) + '"';
h += ' />';
ed.execCommand("mceInsertContent", false, h);
tinyMCEPopup.close();
}
};
tinyMCEPopup.requireLangPack();
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);

View File

@ -0,0 +1,5 @@
tinyMCE.addI18n('en.advhr_dlg',{
width:"Width",
size:"Height",
noshade:"No shadow"
});

View File

@ -0,0 +1,52 @@
tinyMCE.addI18n('en.advlink_dlg',{
title:"Insert/edit link",
url:"Link URL",
target:"Target",
titlefield:"Title",
is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
list:"Link list",
general_tab:"General",
popup_tab:"Popup",
events_tab:"Events",
advanced_tab:"Advanced",
general_props:"General properties",
popup_props:"Popup properties",
event_props:"Events",
advanced_props:"Advanced properties",
popup_opts:"Options",
anchor_names:"Anchors",
target_same:"Open in this window / frame",
target_parent:"Open in parent window / frame",
target_top:"Open in top frame (replaces all frames)",
target_blank:"Open in new window",
popup:"Javascript popup",
popup_url:"Popup URL",
popup_name:"Window name",
popup_return:"Insert 'return false'",
popup_scrollbars:"Show scrollbars",
popup_statusbar:"Show status bar",
popup_toolbar:"Show toolbars",
popup_menubar:"Show menu bar",
popup_location:"Show location bar",
popup_resizable:"Make window resizable",
popup_dependent:"Dependent (Mozilla/Firefox only)",
popup_size:"Size",
popup_position:"Position (X/Y)",
id:"Id",
style:"Style",
classes:"Classes",
target_name:"Target name",
langdir:"Language direction",
target_langcode:"Target language",
langcode:"Language code",
encoding:"Target character encoding",
mime:"Target MIME type",
rel:"Relationship page to target",
rev:"Relationship target to page",
tabindex:"Tabindex",
accesskey:"Accesskey",
ltr:"Left to right",
rtl:"Right to left",
link_list:"Link list"
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

View File

@ -0,0 +1,19 @@
tinyMCEPopup.requireLangPack();
var ExampleDialog = {
init : function() {
var f = document.forms[0];
// Get the selected contents as text and place it in the input
f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg');
},
insert : function() {
// Insert the contents from the input into the document
tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value);
tinyMCEPopup.close();
}
};
tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog);

View File

@ -0,0 +1,471 @@
/**
* fullpage.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinyMCEPopup.requireLangPack();
var doc;
var defaultDocTypes =
'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
var defaultEncodings =
'Western european (iso-8859-1)=iso-8859-1,' +
'Central European (iso-8859-2)=iso-8859-2,' +
'Unicode (UTF-8)=utf-8,' +
'Chinese traditional (Big5)=big5,' +
'Cyrillic (iso-8859-5)=iso-8859-5,' +
'Japanese (iso-2022-jp)=iso-2022-jp,' +
'Greek (iso-8859-7)=iso-8859-7,' +
'Korean (iso-2022-kr)=iso-2022-kr,' +
'ASCII (us-ascii)=us-ascii';
var defaultMediaTypes =
'all=all,' +
'screen=screen,' +
'print=print,' +
'tty=tty,' +
'tv=tv,' +
'projection=projection,' +
'handheld=handheld,' +
'braille=braille,' +
'aural=aural';
var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
function init() {
var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style;
// Setup doctype select box
doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(',');
for (i=0; i<doctypes.length; i++) {
p = doctypes[i].split('=');
if (p.length > 1)
addSelectValue(f, 'doctypes', p[0], p[1]);
}
// Setup fonts select box
fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';');
for (i=0; i<fonts.length; i++) {
p = fonts[i].split('=');
if (p.length > 1)
addSelectValue(f, 'fontface', p[0], p[1]);
}
// Setup fontsize select box
fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
for (i=0; i<fonts.length; i++)
addSelectValue(f, 'fontsize', fonts[i], fonts[i]);
// Setup mediatype select boxs
mediaTypes = ed.getParam("fullpage_media_types", defaultMediaTypes).split(',');
for (i=0; i<mediaTypes.length; i++) {
p = mediaTypes[i].split('=');
if (p.length > 1) {
addSelectValue(f, 'element_style_media', p[0], p[1]);
addSelectValue(f, 'element_link_media', p[0], p[1]);
}
}
// Setup encodings select box
encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(',');
for (i=0; i<encodings.length; i++) {
p = encodings[i].split('=');
if (p.length > 1) {
addSelectValue(f, 'docencoding', p[0], p[1]);
addSelectValue(f, 'element_script_charset', p[0], p[1]);
addSelectValue(f, 'element_link_charset', p[0], p[1]);
}
}
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
//document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color');
document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage');
document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage');
document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
// Resize some elements
if (isVisible('stylesheetbrowser'))
document.getElementById('stylesheet').style.width = '220px';
if (isVisible('link_href_browser'))
document.getElementById('element_link_href').style.width = '230px';
if (isVisible('bgimage_browser'))
document.getElementById('bgimage').style.width = '210px';
// Add iframe
dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}});
doc = dom.get('documentIframe').contentWindow.document;
h = tinyMCEPopup.getWindowArg('head_html');
// Preprocess the HTML disable scripts and urls
h = h.replace(/<script>/gi, '<script type="text/javascript">');
h = h.replace(/type=([\"\'])?/gi, 'type=$1-mce-');
h = h.replace(/(src=|href=)/g, '_mce_$1');
// Write in the content in the iframe
doc.write(h + '</body></html>');
doc.close();
// Parse xml and doctype
xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
docType = getReItem(/<\!DOCTYPE.*?>/gi, h.replace(/\n/g, ''), 0).replace(/ +/g, ' ');
f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);
// Parse title
if (e = doc.getElementsByTagName('title')[0])
el.metatitle.value = e.textContent || e.text;
// Parse meta
tinymce.each(doc.getElementsByTagName('meta'), function(n) {
var na = (n.getAttribute('name', 2) || '').toLowerCase(), va = n.getAttribute('content', 2), eq = n.getAttribute('httpEquiv', 2) || '';
e = el['meta' + na];
if (na == 'robots') {
selectByValue(f, 'metarobots', tinymce.trim(va), true, true);
return;
}
switch (eq.toLowerCase()) {
case "content-type":
tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1);
// Override XML encoding
if (tmp != "")
xmlEnc = tmp;
return;
}
if (e)
e.value = va;
});
selectByValue(f, 'doctypes', docType, true, true);
selectByValue(f, 'docencoding', xmlEnc, true, true);
selectByValue(f, 'langdir', doc.body.getAttribute('dir', 2) || '', true, true);
if (xmlVer != '')
el.xml_pi.checked = true;
// Parse appearance
// Parse primary stylesheet
tinymce.each(doc.getElementsByTagName("link"), function(l) {
var m = l.getAttribute('media', 2) || '', t = l.getAttribute('type', 2) || '';
if (t == "-mce-text/css" && (m == "" || m == "screen" || m == "all") && (l.getAttribute('rel', 2) || '') == "stylesheet") {
f.stylesheet.value = l.getAttribute('_mce_href', 2) || '';
return false;
}
});
// Get from style elements
tinymce.each(doc.getElementsByTagName("style"), function(st) {
var tmp = parseStyleElement(st);
for (x=0; x<tmp.length; x++) {
if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color'])
f.visited_color.value = tmp[x].data['color'];
if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color'])
f.link_color.value = tmp[x].data['color'];
if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color'])
f.active_color.value = tmp[x].data['color'];
}
});
f.textcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "text");
f.active_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "alink");
f.link_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "link");
f.visited_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "vlink");
f.bgcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "bgcolor");
f.bgimage.value = tinyMCEPopup.dom.getAttrib(doc.body, "background");
// Get from style info
style = tinyMCEPopup.dom.parseStyle(tinyMCEPopup.dom.getAttrib(doc.body, 'style'));
if (style['font-family'])
selectByValue(f, 'fontface', style['font-family'], true, true);
else
selectByValue(f, 'fontface', ed.getParam("fullpage_default_fontface", ""), true, true);
if (style['font-size'])
selectByValue(f, 'fontsize', style['font-size'], true, true);
else
selectByValue(f, 'fontsize', ed.getParam("fullpage_default_fontsize", ""), true, true);
if (style['color'])
f.textcolor.value = convertRGBToHex(style['color']);
if (style['background-image'])
f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
if (style['background-color'])
f.bgcolor.value = style['background-color'];
if (style['margin']) {
tmp = style['margin'].replace(/[^0-9 ]/g, '');
tmp = tmp.split(/ +/);
f.topmargin.value = tmp.length > 0 ? tmp[0] : '';
f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0];
f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0];
f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0];
}
if (style['margin-left'])
f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');
if (style['margin-right'])
f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, '');
if (style['margin-top'])
f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');
if (style['margin-bottom'])
f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');
f.style.value = tinyMCEPopup.dom.serializeStyle(style);
// Update colors
updateColor('textcolor_pick', 'textcolor');
updateColor('bgcolor_pick', 'bgcolor');
updateColor('visited_color_pick', 'visited_color');
updateColor('active_color_pick', 'active_color');
updateColor('link_color_pick', 'link_color');
}
function getReItem(r, s, i) {
var c = r.exec(s);
if (c && c.length > i)
return c[i];
return '';
}
function updateAction() {
var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser;
head = doc.getElementsByTagName('head')[0];
// Fix scripts without a type
nl = doc.getElementsByTagName('script');
for (i=0; i<nl.length; i++) {
if (tinyMCEPopup.dom.getAttrib(nl[i], '_mce_type') == '')
nl[i].setAttribute('_mce_type', 'text/javascript');
}
// Get primary stylesheet
nl = doc.getElementsByTagName("link");
for (i=0; i<nl.length; i++) {
l = nl[i];
tmp = tinyMCEPopup.dom.getAttrib(l, 'media');
if (tinyMCEPopup.dom.getAttrib(l, '_mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.getAttrib(l, 'rel') == "stylesheet") {
addlink = false;
if (f.stylesheet.value == '')
l.parentNode.removeChild(l);
else
l.setAttribute('_mce_href', f.stylesheet.value);
break;
}
}
// Add new link
if (f.stylesheet.value != '') {
l = doc.createElement('link');
l.setAttribute('type', 'text/css');
l.setAttribute('_mce_href', f.stylesheet.value);
l.setAttribute('rel', 'stylesheet');
head.appendChild(l);
}
setMeta(head, 'keywords', f.metakeywords.value);
setMeta(head, 'description', f.metadescription.value);
setMeta(head, 'author', f.metaauthor.value);
setMeta(head, 'copyright', f.metacopyright.value);
setMeta(head, 'robots', getSelectValue(f, 'metarobots'));
setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));
doc.body.dir = getSelectValue(f, 'langdir');
doc.body.style.cssText = f.style.value;
doc.body.setAttribute('vLink', f.visited_color.value);
doc.body.setAttribute('link', f.link_color.value);
doc.body.setAttribute('text', f.textcolor.value);
doc.body.setAttribute('aLink', f.active_color.value);
doc.body.style.fontFamily = getSelectValue(f, 'fontface');
doc.body.style.fontSize = getSelectValue(f, 'fontsize');
doc.body.style.backgroundColor = f.bgcolor.value;
if (f.leftmargin.value != '')
doc.body.style.marginLeft = f.leftmargin.value + 'px';
if (f.rightmargin.value != '')
doc.body.style.marginRight = f.rightmargin.value + 'px';
if (f.bottommargin.value != '')
doc.body.style.marginBottom = f.bottommargin.value + 'px';
if (f.topmargin.value != '')
doc.body.style.marginTop = f.topmargin.value + 'px';
html = doc.getElementsByTagName('html')[0];
html.setAttribute('lang', f.langcode.value);
html.setAttribute('xml:lang', f.langcode.value);
if (f.bgimage.value != '')
doc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";
else
doc.body.style.backgroundImage = '';
ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer();
ser.setRules('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml::lang|xmlns],body[style|dir|vlink|link|text|alink],head');
h = ser.serialize(doc.documentElement);
h = h.substring(0, h.lastIndexOf('</body>'));
if (h.indexOf('<title>') == -1)
h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
else
h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
if ((v = getSelectValue(f, 'doctypes')) != '')
h = v + '\n' + h;
if (f.xml_pi.checked) {
s = '<?xml version="1.0"';
if ((v = getSelectValue(f, 'docencoding')) != '')
s += ' encoding="' + v + '"';
s += '?>\n';
h = s + h;
}
h = h.replace(/type=\"\-mce\-/gi, 'type="');
tinyMCEPopup.editor.plugins.fullpage.head = h;
tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {});
tinyMCEPopup.close();
}
function changedStyleField(field) {
}
function setMeta(he, k, v) {
var nl, i, m;
nl = he.getElementsByTagName('meta');
for (i=0; i<nl.length; i++) {
if (k == 'Content-Type' && tinyMCEPopup.dom.getAttrib(nl[i], 'http-equiv') == k) {
if (v == '')
nl[i].parentNode.removeChild(nl[i]);
else
nl[i].setAttribute('content', "text/html; charset=" + v);
return;
}
if (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) {
if (v == '')
nl[i].parentNode.removeChild(nl[i]);
else
nl[i].setAttribute('content', v);
return;
}
}
if (v == '')
return;
m = doc.createElement('meta');
if (k == 'Content-Type')
m.httpEquiv = k;
else
m.setAttribute('name', k);
m.setAttribute('content', v);
he.appendChild(m);
}
function parseStyleElement(e) {
var v = e.innerHTML;
var p, i, r;
v = v.replace(/<!--/gi, '');
v = v.replace(/-->/gi, '');
v = v.replace(/[\n\r]/gi, '');
v = v.replace(/\s+/gi, ' ');
r = [];
p = v.split(/{|}/);
for (i=0; i<p.length; i+=2) {
if (p[i] != "")
r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.parseStyle(p[i+1])};
}
return r;
}
function serializeStyleElement(d) {
var i, s, st;
s = '<!--\n';
for (i=0; i<d.length; i++) {
s += d[i].rule + ' {\n';
st = tinyMCE.serializeStyle(d[i].data);
if (st != '')
st += ';';
s += st.replace(/;/g, ';\n');
s += '}\n';
if (i != d.length - 1)
s += '\n';
}
s += '\n-->';
return s;
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,85 @@
tinyMCE.addI18n('en.fullpage_dlg',{
title:"Document properties",
meta_tab:"General",
appearance_tab:"Appearance",
advanced_tab:"Advanced",
meta_props:"Meta information",
langprops:"Language and encoding",
meta_title:"Title",
meta_keywords:"Keywords",
meta_description:"Description",
meta_robots:"Robots",
doctypes:"Doctype",
langcode:"Language code",
langdir:"Language direction",
ltr:"Left to right",
rtl:"Right to left",
xml_pi:"XML declaration",
encoding:"Character encoding",
appearance_bgprops:"Background properties",
appearance_marginprops:"Body margins",
appearance_linkprops:"Link colors",
appearance_textprops:"Text properties",
bgcolor:"Background color",
bgimage:"Background image",
left_margin:"Left margin",
right_margin:"Right margin",
top_margin:"Top margin",
bottom_margin:"Bottom margin",
text_color:"Text color",
font_size:"Font size",
font_face:"Font face",
link_color:"Link color",
hover_color:"Hover color",
visited_color:"Visited color",
active_color:"Active color",
textcolor:"Color",
fontsize:"Font size",
fontface:"Font family",
meta_index_follow:"Index and follow the links",
meta_index_nofollow:"Index and don't follow the links",
meta_noindex_follow:"Do not index but follow the links",
meta_noindex_nofollow:"Do not index and don\'t follow the links",
appearance_style:"Stylesheet and style properties",
stylesheet:"Stylesheet",
style:"Style",
author:"Author",
copyright:"Copyright",
add:"Add new element",
remove:"Remove selected element",
moveup:"Move selected element up",
movedown:"Move selected element down",
head_elements:"Head elements",
info:"Information",
add_title:"Title element",
add_meta:"Meta element",
add_script:"Script element",
add_style:"Style element",
add_link:"Link element",
add_base:"Base element",
add_comment:"Comment node",
title_element:"Title element",
script_element:"Script element",
style_element:"Style element",
base_element:"Base element",
link_element:"Link element",
meta_element:"Meta element",
comment_element:"Comment",
src:"Src",
language:"Language",
href:"Href",
target:"Target",
type:"Type",
charset:"Charset",
defer:"Defer",
media:"Media",
properties:"Properties",
name:"Name",
value:"Value",
content:"Content",
rel:"Rel",
rev:"Rev",
hreflang:"Href lang",
general_props:"General",
advanced_props:"Advanced"
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

View File

@ -0,0 +1,36 @@
tinyMCEPopup.requireLangPack();
var PasteTextDialog = {
init : function() {
this.resize();
},
insert : function() {
var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
// Convert linebreaks into paragraphs
if (document.getElementById('linebreaks').checked) {
lines = h.split(/\r?\n/);
if (lines.length > 1) {
h = '';
tinymce.each(lines, function(row) {
h += '<p>' + row + '</p>';
});
}
}
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
tinyMCEPopup.close();
},
resize : function() {
var vp = tinyMCEPopup.dom.getViewPort(window), el;
el = document.getElementById('content');
el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 90) + 'px';
}
};
tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);

View File

@ -0,0 +1,51 @@
tinyMCEPopup.requireLangPack();
var PasteWordDialog = {
init : function() {
var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
// Create iframe
el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
ifr = document.getElementById('iframe');
doc = ifr.contentWindow.document;
// Force absolute CSS urls
css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
css = css.concat(tinymce.explode(ed.settings.content_css) || []);
tinymce.each(css, function(u) {
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
});
// Write content into iframe
doc.open();
doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
doc.close();
doc.designMode = 'on';
this.resize();
window.setTimeout(function() {
ifr.contentWindow.focus();
}, 10);
},
insert : function() {
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
tinyMCEPopup.close();
},
resize : function() {
var vp = tinyMCEPopup.dom.getViewPort(window), el;
el = document.getElementById('iframe');
if (el) {
el.style.width = (vp.w - 20) + 'px';
el.style.height = (vp.h - 90) + 'px';
}
}
};
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);

View File

@ -0,0 +1,6 @@
.panel_wrapper {height:85px;}
.panel_wrapper div.current {height:85px;}
/* IE */
* html .panel_wrapper {height:100px;}
* html .panel_wrapper div.current {height:100px;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 B

View File

@ -0,0 +1,23 @@
#frmbody {
padding: 10px;
background-color: #FFF;
border: 1px solid #CCC;
}
.frmRow {
margin-bottom: 10px;
}
#templatesrc {
border: none;
width: 320px;
height: 240px;
}
.title {
padding-bottom: 5px;
}
.mceActionPanel {
padding-top: 5px;
}

View File

@ -0,0 +1,11 @@
.panel_wrapper div.current {
height: 290px;
}
#id, #style, #title, #dir, #hreflang, #lang, #classlist, #tabindex, #accesskey {
width: 200px;
}
#events_panel input {
width: 200px;
}

View File

@ -0,0 +1,9 @@
input.field, select.field {width:200px;}
input.picker {width:179px; margin-left: 5px;}
input.disabled {border-color:#F2F2F2;}
img.picker {vertical-align:text-bottom; cursor:pointer;}
h1 {padding: 0 0 5px 0;}
.panel_wrapper div.current {height:160px;}
#xhtmlxtrasdel .panel_wrapper div.current, #xhtmlxtrasins .panel_wrapper div.current {height: 230px;}
a.browse span {display:block; width:20px; height:20px; background:url('../../../themes/advanced/img/icons.gif') -140px -20px;}
#datetime {width:180px;}

View File

@ -0,0 +1,28 @@
/**
* abbr.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
SXE.initElementDialog('abbr');
if (SXE.currentAction == "update") {
SXE.showRemoveButton();
}
}
function insertAbbr() {
SXE.insertElement('abbr');
tinyMCEPopup.close();
}
function removeAbbr() {
SXE.removeElement('abbr');
tinyMCEPopup.close();
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,28 @@
/**
* acronym.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
SXE.initElementDialog('acronym');
if (SXE.currentAction == "update") {
SXE.showRemoveButton();
}
}
function insertAcronym() {
SXE.insertElement('acronym');
tinyMCEPopup.close();
}
function removeAcronym() {
SXE.removeElement('acronym');
tinyMCEPopup.close();
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,126 @@
/**
* attributes.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
tinyMCEPopup.resizeToInnerSize();
var inst = tinyMCEPopup.editor;
var dom = inst.dom;
var elm = inst.selection.getNode();
var f = document.forms[0];
var onclick = dom.getAttrib(elm, 'onclick');
setFormValue('title', dom.getAttrib(elm, 'title'));
setFormValue('id', dom.getAttrib(elm, 'id'));
setFormValue('style', dom.getAttrib(elm, "style"));
setFormValue('dir', dom.getAttrib(elm, 'dir'));
setFormValue('lang', dom.getAttrib(elm, 'lang'));
setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));
setFormValue('onblur', dom.getAttrib(elm, 'onblur'));
setFormValue('onclick', onclick);
setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));
setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));
setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));
setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));
setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));
setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));
setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));
setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));
setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));
className = dom.getAttrib(elm, 'class');
addClassesToList('classlist', 'advlink_styles');
selectByValue(f, 'classlist', className, true);
TinyMCE_EditableSelects.init();
}
function setFormValue(name, value) {
if(value && document.forms[0].elements[name]){
document.forms[0].elements[name].value = value;
}
}
function insertAction() {
var inst = tinyMCEPopup.editor;
var elm = inst.selection.getNode();
tinyMCEPopup.execCommand("mceBeginUndoLevel");
setAllAttribs(elm);
tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
}
function setAttrib(elm, attrib, value) {
var formObj = document.forms[0];
var valueElm = formObj.elements[attrib.toLowerCase()];
var inst = tinyMCEPopup.editor;
var dom = inst.dom;
if (typeof(value) == "undefined" || value == null) {
value = "";
if (valueElm)
value = valueElm.value;
}
if (value != "") {
dom.setAttrib(elm, attrib.toLowerCase(), value);
if (attrib == "style")
attrib = "style.cssText";
if (attrib.substring(0, 2) == 'on')
value = 'return true;' + value;
if (attrib == "class")
attrib = "className";
elm[attrib]=value;
} else
elm.removeAttribute(attrib);
}
function setAllAttribs(elm) {
var f = document.forms[0];
setAttrib(elm, 'title');
setAttrib(elm, 'id');
setAttrib(elm, 'style');
setAttrib(elm, 'class', getSelectValue(f, 'classlist'));
setAttrib(elm, 'dir');
setAttrib(elm, 'lang');
setAttrib(elm, 'tabindex');
setAttrib(elm, 'accesskey');
setAttrib(elm, 'onfocus');
setAttrib(elm, 'onblur');
setAttrib(elm, 'onclick');
setAttrib(elm, 'ondblclick');
setAttrib(elm, 'onmousedown');
setAttrib(elm, 'onmouseup');
setAttrib(elm, 'onmouseover');
setAttrib(elm, 'onmousemove');
setAttrib(elm, 'onmouseout');
setAttrib(elm, 'onkeypress');
setAttrib(elm, 'onkeydown');
setAttrib(elm, 'onkeyup');
// Refresh in old MSIE
// if (tinyMCE.isMSIE5)
// elm.outerHTML = elm.outerHTML;
}
function insertAttribute() {
tinyMCEPopup.close();
}
tinyMCEPopup.onInit.add(init);
tinyMCEPopup.requireLangPack();

View File

@ -0,0 +1,28 @@
/**
* cite.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
SXE.initElementDialog('cite');
if (SXE.currentAction == "update") {
SXE.showRemoveButton();
}
}
function insertCite() {
SXE.insertElement('cite');
tinyMCEPopup.close();
}
function removeCite() {
SXE.removeElement('cite');
tinyMCEPopup.close();
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,63 @@
/**
* del.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
SXE.initElementDialog('del');
if (SXE.currentAction == "update") {
setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
SXE.showRemoveButton();
}
}
function setElementAttribs(elm) {
setAllCommonAttribs(elm);
setAttrib(elm, 'datetime');
setAttrib(elm, 'cite');
}
function insertDel() {
var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');
tinyMCEPopup.execCommand('mceBeginUndoLevel');
if (elm == null) {
var s = SXE.inst.selection.getContent();
if(s.length > 0) {
insertInlineElement('del');
var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});
for (var i=0; i<elementArray.length; i++) {
var elm = elementArray[i];
setElementAttribs(elm);
}
}
} else {
setElementAttribs(elm);
}
tinyMCEPopup.editor.nodeChanged();
tinyMCEPopup.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
function insertInlineElement(en) {
var ed = tinyMCEPopup.editor, dom = ed.dom;
ed.getDoc().execCommand('FontName', false, 'mceinline');
tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) {
if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')
dom.replace(dom.create(en), n, 1);
});
}
function removeDel() {
SXE.removeElement('del');
tinyMCEPopup.close();
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,231 @@
/**
* element_common.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinyMCEPopup.requireLangPack();
function initCommonAttributes(elm) {
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
// Setup form data for common element attributes
setFormValue('title', dom.getAttrib(elm, 'title'));
setFormValue('id', dom.getAttrib(elm, 'id'));
selectByValue(formObj, 'class', dom.getAttrib(elm, 'class'), true);
setFormValue('style', dom.getAttrib(elm, 'style'));
selectByValue(formObj, 'dir', dom.getAttrib(elm, 'dir'));
setFormValue('lang', dom.getAttrib(elm, 'lang'));
setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));
setFormValue('onblur', dom.getAttrib(elm, 'onblur'));
setFormValue('onclick', dom.getAttrib(elm, 'onclick'));
setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));
setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));
setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));
setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));
setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));
setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));
setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));
setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));
setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));
}
function setFormValue(name, value) {
if(document.forms[0].elements[name]) document.forms[0].elements[name].value = value;
}
function insertDateTime(id) {
document.getElementById(id).value = getDateTime(new Date(), "%Y-%m-%dT%H:%M:%S");
}
function getDateTime(d, fmt) {
fmt = fmt.replace("%D", "%m/%d/%y");
fmt = fmt.replace("%r", "%I:%M:%S %p");
fmt = fmt.replace("%Y", "" + d.getFullYear());
fmt = fmt.replace("%y", "" + d.getYear());
fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));
fmt = fmt.replace("%d", addZeros(d.getDate(), 2));
fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));
fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));
fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));
fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));
fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));
fmt = fmt.replace("%%", "%");
return fmt;
}
function addZeros(value, len) {
var i;
value = "" + value;
if (value.length < len) {
for (i=0; i<(len-value.length); i++)
value = "0" + value;
}
return value;
}
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
var sel = form_obj.elements[field_name];
var found = false;
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
option.selected = false;
}
if (!found && add_custom && value != '') {
var option = new Option('Value: ' + value, value);
option.selected = true;
sel.options[sel.options.length] = option;
}
return found;
}
function setAttrib(elm, attrib, value) {
var formObj = document.forms[0];
var valueElm = formObj.elements[attrib.toLowerCase()];
tinyMCEPopup.editor.dom.setAttrib(elm, attrib, value || valueElm.value);
}
function setAllCommonAttribs(elm) {
setAttrib(elm, 'title');
setAttrib(elm, 'id');
setAttrib(elm, 'class');
setAttrib(elm, 'style');
setAttrib(elm, 'dir');
setAttrib(elm, 'lang');
/*setAttrib(elm, 'onfocus');
setAttrib(elm, 'onblur');
setAttrib(elm, 'onclick');
setAttrib(elm, 'ondblclick');
setAttrib(elm, 'onmousedown');
setAttrib(elm, 'onmouseup');
setAttrib(elm, 'onmouseover');
setAttrib(elm, 'onmousemove');
setAttrib(elm, 'onmouseout');
setAttrib(elm, 'onkeypress');
setAttrib(elm, 'onkeydown');
setAttrib(elm, 'onkeyup');*/
}
SXE = {
currentAction : "insert",
inst : tinyMCEPopup.editor,
updateElement : null
}
SXE.focusElement = SXE.inst.selection.getNode();
SXE.initElementDialog = function(element_name) {
addClassesToList('class', 'xhtmlxtras_styles');
TinyMCE_EditableSelects.init();
element_name = element_name.toLowerCase();
var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());
if (elm != null && elm.nodeName.toUpperCase() == element_name.toUpperCase()) {
SXE.currentAction = "update";
}
if (SXE.currentAction == "update") {
initCommonAttributes(elm);
SXE.updateElement = elm;
}
document.forms[0].insert.value = tinyMCEPopup.getLang(SXE.currentAction, 'Insert', true);
}
SXE.insertElement = function(element_name) {
var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()), h, tagName;
tinyMCEPopup.execCommand('mceBeginUndoLevel');
if (elm == null) {
var s = SXE.inst.selection.getContent();
if(s.length > 0) {
tagName = element_name;
insertInlineElement(element_name);
var elementArray = tinymce.grep(SXE.inst.dom.select(element_name));
for (var i=0; i<elementArray.length; i++) {
var elm = elementArray[i];
if (SXE.inst.dom.getAttrib(elm, '_mce_new')) {
elm.id = '';
elm.setAttribute('id', '');
elm.removeAttribute('id');
elm.removeAttribute('_mce_new');
setAllCommonAttribs(elm);
}
}
}
} else {
setAllCommonAttribs(elm);
}
SXE.inst.nodeChanged();
tinyMCEPopup.execCommand('mceEndUndoLevel');
}
SXE.removeElement = function(element_name){
element_name = element_name.toLowerCase();
elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());
if(elm && elm.nodeName.toUpperCase() == element_name.toUpperCase()){
tinyMCEPopup.execCommand('mceBeginUndoLevel');
tinyMCE.execCommand('mceRemoveNode', false, elm);
SXE.inst.nodeChanged();
tinyMCEPopup.execCommand('mceEndUndoLevel');
}
}
SXE.showRemoveButton = function() {
document.getElementById("remove").style.display = '';
}
SXE.containsClass = function(elm,cl) {
return (elm.className.indexOf(cl) > -1) ? true : false;
}
SXE.removeClass = function(elm,cl) {
if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) {
return true;
}
var classNames = elm.className.split(" ");
var newClassNames = "";
for (var x = 0, cnl = classNames.length; x < cnl; x++) {
if (classNames[x] != cl) {
newClassNames += (classNames[x] + " ");
}
}
elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end
}
SXE.addClass = function(elm,cl) {
if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl;
return true;
}
function insertInlineElement(en) {
var ed = tinyMCEPopup.editor, dom = ed.dom;
ed.getDoc().execCommand('FontName', false, 'mceinline');
tinymce.each(dom.select('span,font'), function(n) {
if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')
dom.replace(dom.create(en, {_mce_new : 1}), n, 1);
});
}

View File

@ -0,0 +1,62 @@
/**
* ins.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function init() {
SXE.initElementDialog('ins');
if (SXE.currentAction == "update") {
setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
SXE.showRemoveButton();
}
}
function setElementAttribs(elm) {
setAllCommonAttribs(elm);
setAttrib(elm, 'datetime');
setAttrib(elm, 'cite');
}
function insertIns() {
var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS');
tinyMCEPopup.execCommand('mceBeginUndoLevel');
if (elm == null) {
var s = SXE.inst.selection.getContent();
if(s.length > 0) {
insertInlineElement('INS');
var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';});
for (var i=0; i<elementArray.length; i++) {
var elm = elementArray[i];
setElementAttribs(elm);
}
}
} else {
setElementAttribs(elm);
}
tinyMCEPopup.editor.nodeChanged();
tinyMCEPopup.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
function removeIns() {
SXE.removeElement('ins');
tinyMCEPopup.close();
}
function insertInlineElement(en) {
var ed = tinyMCEPopup.editor, dom = ed.dom;
ed.getDoc().execCommand('FontName', false, 'mceinline');
tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) {
if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline')
dom.replace(dom.create(en), n, 1);
});
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,32 @@
tinyMCE.addI18n('en.xhtmlxtras_dlg',{
attribute_label_title:"Title",
attribute_label_id:"ID",
attribute_label_class:"Class",
attribute_label_style:"Style",
attribute_label_cite:"Cite",
attribute_label_datetime:"Date/Time",
attribute_label_langdir:"Text Direction",
attribute_option_ltr:"Left to right",
attribute_option_rtl:"Right to left",
attribute_label_langcode:"Language",
attribute_label_tabindex:"TabIndex",
attribute_label_accesskey:"AccessKey",
attribute_events_tab:"Events",
attribute_attrib_tab:"Attributes",
general_tab:"General",
attrib_tab:"Attributes",
events_tab:"Events",
fieldset_general_tab:"General Settings",
fieldset_attrib_tab:"Element Attributes",
fieldset_events_tab:"Element Events",
title_ins_element:"Insertion Element",
title_del_element:"Deletion Element",
title_acronym_element:"Acronym Element",
title_abbr_element:"Abbreviation Element",
title_cite_element:"Citation Element",
remove:"Remove",
insert_date:"Insert current date/time",
option_ltr:"Left to right",
option_rtl:"Right to left",
attribs_title:"Insert/Edit Attributes"
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,72 @@
tinyMCEPopup.requireLangPack();
function init() {
var ed, tcont;
tinyMCEPopup.resizeToInnerSize();
ed = tinyMCEPopup.editor;
// Give FF some time
window.setTimeout(insertHelpIFrame, 10);
tcont = document.getElementById('plugintablecontainer');
document.getElementById('plugins_tab').style.display = 'none';
var html = "";
html += '<table id="plugintable">';
html += '<thead>';
html += '<tr>';
html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>';
html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>';
html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>';
html += '</tr>';
html += '</thead>';
html += '<tbody>';
tinymce.each(ed.plugins, function(p, n) {
var info;
if (!p.getInfo)
return;
html += '<tr>';
info = p.getInfo();
if (info.infourl != null && info.infourl != '')
html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
else
html += '<td width="50%" title="' + n + '">' + info.longname + '</td>';
if (info.authorurl != null && info.authorurl != '')
html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
else
html += '<td width="35%">' + info.author + '</td>';
html += '<td width="15%">' + info.version + '</td>';
html += '</tr>';
document.getElementById('plugins_tab').style.display = '';
});
html += '</tbody>';
html += '</table>';
tcont.innerHTML = html;
tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate;
}
function insertHelpIFrame() {
var html;
if (tinyMCEPopup.getParam('docs_url')) {
html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';
document.getElementById('iframecontainer').innerHTML = html;
document.getElementById('help_tab').style.display = 'block';
}
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,37 @@
tinyMCEPopup.requireLangPack();
var AnchorDialog = {
init : function(ed) {
var action, elm, f = document.forms[0];
this.editor = ed;
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
v = ed.dom.getAttrib(elm, 'name');
if (v) {
this.action = 'update';
f.anchorName.value = v;
}
f.insert.value = ed.getLang(elm ? 'update' : 'insert');
},
update : function() {
var ed = this.editor, elm, name = document.forms[0].anchorName.value;
tinyMCEPopup.restoreSelection();
if (this.action != 'update')
ed.selection.collapse(1);
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
if (elm)
elm.name = name;
else
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
tinyMCEPopup.close();
}
};
tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);

View File

@ -0,0 +1,335 @@
/**
* charmap.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinyMCEPopup.requireLangPack();
var charmap = [
['&nbsp;', '&#160;', true, 'no-break space'],
['&amp;', '&#38;', true, 'ampersand'],
['&quot;', '&#34;', true, 'quotation mark'],
// finance
['&cent;', '&#162;', true, 'cent sign'],
['&euro;', '&#8364;', true, 'euro sign'],
['&pound;', '&#163;', true, 'pound sign'],
['&yen;', '&#165;', true, 'yen sign'],
// signs
['&copy;', '&#169;', true, 'copyright sign'],
['&reg;', '&#174;', true, 'registered sign'],
['&trade;', '&#8482;', true, 'trade mark sign'],
['&permil;', '&#8240;', true, 'per mille sign'],
['&micro;', '&#181;', true, 'micro sign'],
['&middot;', '&#183;', true, 'middle dot'],
['&bull;', '&#8226;', true, 'bullet'],
['&hellip;', '&#8230;', true, 'three dot leader'],
['&prime;', '&#8242;', true, 'minutes / feet'],
['&Prime;', '&#8243;', true, 'seconds / inches'],
['&sect;', '&#167;', true, 'section sign'],
['&para;', '&#182;', true, 'paragraph sign'],
['&szlig;', '&#223;', true, 'sharp s / ess-zed'],
// quotations
['&lsaquo;', '&#8249;', true, 'single left-pointing angle quotation mark'],
['&rsaquo;', '&#8250;', true, 'single right-pointing angle quotation mark'],
['&laquo;', '&#171;', true, 'left pointing guillemet'],
['&raquo;', '&#187;', true, 'right pointing guillemet'],
['&lsquo;', '&#8216;', true, 'left single quotation mark'],
['&rsquo;', '&#8217;', true, 'right single quotation mark'],
['&ldquo;', '&#8220;', true, 'left double quotation mark'],
['&rdquo;', '&#8221;', true, 'right double quotation mark'],
['&sbquo;', '&#8218;', true, 'single low-9 quotation mark'],
['&bdquo;', '&#8222;', true, 'double low-9 quotation mark'],
['&lt;', '&#60;', true, 'less-than sign'],
['&gt;', '&#62;', true, 'greater-than sign'],
['&le;', '&#8804;', true, 'less-than or equal to'],
['&ge;', '&#8805;', true, 'greater-than or equal to'],
['&ndash;', '&#8211;', true, 'en dash'],
['&mdash;', '&#8212;', true, 'em dash'],
['&macr;', '&#175;', true, 'macron'],
['&oline;', '&#8254;', true, 'overline'],
['&curren;', '&#164;', true, 'currency sign'],
['&brvbar;', '&#166;', true, 'broken bar'],
['&uml;', '&#168;', true, 'diaeresis'],
['&iexcl;', '&#161;', true, 'inverted exclamation mark'],
['&iquest;', '&#191;', true, 'turned question mark'],
['&circ;', '&#710;', true, 'circumflex accent'],
['&tilde;', '&#732;', true, 'small tilde'],
['&deg;', '&#176;', true, 'degree sign'],
['&minus;', '&#8722;', true, 'minus sign'],
['&plusmn;', '&#177;', true, 'plus-minus sign'],
['&divide;', '&#247;', true, 'division sign'],
['&frasl;', '&#8260;', true, 'fraction slash'],
['&times;', '&#215;', true, 'multiplication sign'],
['&sup1;', '&#185;', true, 'superscript one'],
['&sup2;', '&#178;', true, 'superscript two'],
['&sup3;', '&#179;', true, 'superscript three'],
['&frac14;', '&#188;', true, 'fraction one quarter'],
['&frac12;', '&#189;', true, 'fraction one half'],
['&frac34;', '&#190;', true, 'fraction three quarters'],
// math / logical
['&fnof;', '&#402;', true, 'function / florin'],
['&int;', '&#8747;', true, 'integral'],
['&sum;', '&#8721;', true, 'n-ary sumation'],
['&infin;', '&#8734;', true, 'infinity'],
['&radic;', '&#8730;', true, 'square root'],
['&sim;', '&#8764;', false,'similar to'],
['&cong;', '&#8773;', false,'approximately equal to'],
['&asymp;', '&#8776;', true, 'almost equal to'],
['&ne;', '&#8800;', true, 'not equal to'],
['&equiv;', '&#8801;', true, 'identical to'],
['&isin;', '&#8712;', false,'element of'],
['&notin;', '&#8713;', false,'not an element of'],
['&ni;', '&#8715;', false,'contains as member'],
['&prod;', '&#8719;', true, 'n-ary product'],
['&and;', '&#8743;', false,'logical and'],
['&or;', '&#8744;', false,'logical or'],
['&not;', '&#172;', true, 'not sign'],
['&cap;', '&#8745;', true, 'intersection'],
['&cup;', '&#8746;', false,'union'],
['&part;', '&#8706;', true, 'partial differential'],
['&forall;', '&#8704;', false,'for all'],
['&exist;', '&#8707;', false,'there exists'],
['&empty;', '&#8709;', false,'diameter'],
['&nabla;', '&#8711;', false,'backward difference'],
['&lowast;', '&#8727;', false,'asterisk operator'],
['&prop;', '&#8733;', false,'proportional to'],
['&ang;', '&#8736;', false,'angle'],
// undefined
['&acute;', '&#180;', true, 'acute accent'],
['&cedil;', '&#184;', true, 'cedilla'],
['&ordf;', '&#170;', true, 'feminine ordinal indicator'],
['&ordm;', '&#186;', true, 'masculine ordinal indicator'],
['&dagger;', '&#8224;', true, 'dagger'],
['&Dagger;', '&#8225;', true, 'double dagger'],
// alphabetical special chars
['&Agrave;', '&#192;', true, 'A - grave'],
['&Aacute;', '&#193;', true, 'A - acute'],
['&Acirc;', '&#194;', true, 'A - circumflex'],
['&Atilde;', '&#195;', true, 'A - tilde'],
['&Auml;', '&#196;', true, 'A - diaeresis'],
['&Aring;', '&#197;', true, 'A - ring above'],
['&AElig;', '&#198;', true, 'ligature AE'],
['&Ccedil;', '&#199;', true, 'C - cedilla'],
['&Egrave;', '&#200;', true, 'E - grave'],
['&Eacute;', '&#201;', true, 'E - acute'],
['&Ecirc;', '&#202;', true, 'E - circumflex'],
['&Euml;', '&#203;', true, 'E - diaeresis'],
['&Igrave;', '&#204;', true, 'I - grave'],
['&Iacute;', '&#205;', true, 'I - acute'],
['&Icirc;', '&#206;', true, 'I - circumflex'],
['&Iuml;', '&#207;', true, 'I - diaeresis'],
['&ETH;', '&#208;', true, 'ETH'],
['&Ntilde;', '&#209;', true, 'N - tilde'],
['&Ograve;', '&#210;', true, 'O - grave'],
['&Oacute;', '&#211;', true, 'O - acute'],
['&Ocirc;', '&#212;', true, 'O - circumflex'],
['&Otilde;', '&#213;', true, 'O - tilde'],
['&Ouml;', '&#214;', true, 'O - diaeresis'],
['&Oslash;', '&#216;', true, 'O - slash'],
['&OElig;', '&#338;', true, 'ligature OE'],
['&Scaron;', '&#352;', true, 'S - caron'],
['&Ugrave;', '&#217;', true, 'U - grave'],
['&Uacute;', '&#218;', true, 'U - acute'],
['&Ucirc;', '&#219;', true, 'U - circumflex'],
['&Uuml;', '&#220;', true, 'U - diaeresis'],
['&Yacute;', '&#221;', true, 'Y - acute'],
['&Yuml;', '&#376;', true, 'Y - diaeresis'],
['&THORN;', '&#222;', true, 'THORN'],
['&agrave;', '&#224;', true, 'a - grave'],
['&aacute;', '&#225;', true, 'a - acute'],
['&acirc;', '&#226;', true, 'a - circumflex'],
['&atilde;', '&#227;', true, 'a - tilde'],
['&auml;', '&#228;', true, 'a - diaeresis'],
['&aring;', '&#229;', true, 'a - ring above'],
['&aelig;', '&#230;', true, 'ligature ae'],
['&ccedil;', '&#231;', true, 'c - cedilla'],
['&egrave;', '&#232;', true, 'e - grave'],
['&eacute;', '&#233;', true, 'e - acute'],
['&ecirc;', '&#234;', true, 'e - circumflex'],
['&euml;', '&#235;', true, 'e - diaeresis'],
['&igrave;', '&#236;', true, 'i - grave'],
['&iacute;', '&#237;', true, 'i - acute'],
['&icirc;', '&#238;', true, 'i - circumflex'],
['&iuml;', '&#239;', true, 'i - diaeresis'],
['&eth;', '&#240;', true, 'eth'],
['&ntilde;', '&#241;', true, 'n - tilde'],
['&ograve;', '&#242;', true, 'o - grave'],
['&oacute;', '&#243;', true, 'o - acute'],
['&ocirc;', '&#244;', true, 'o - circumflex'],
['&otilde;', '&#245;', true, 'o - tilde'],
['&ouml;', '&#246;', true, 'o - diaeresis'],
['&oslash;', '&#248;', true, 'o slash'],
['&oelig;', '&#339;', true, 'ligature oe'],
['&scaron;', '&#353;', true, 's - caron'],
['&ugrave;', '&#249;', true, 'u - grave'],
['&uacute;', '&#250;', true, 'u - acute'],
['&ucirc;', '&#251;', true, 'u - circumflex'],
['&uuml;', '&#252;', true, 'u - diaeresis'],
['&yacute;', '&#253;', true, 'y - acute'],
['&thorn;', '&#254;', true, 'thorn'],
['&yuml;', '&#255;', true, 'y - diaeresis'],
['&Alpha;', '&#913;', true, 'Alpha'],
['&Beta;', '&#914;', true, 'Beta'],
['&Gamma;', '&#915;', true, 'Gamma'],
['&Delta;', '&#916;', true, 'Delta'],
['&Epsilon;', '&#917;', true, 'Epsilon'],
['&Zeta;', '&#918;', true, 'Zeta'],
['&Eta;', '&#919;', true, 'Eta'],
['&Theta;', '&#920;', true, 'Theta'],
['&Iota;', '&#921;', true, 'Iota'],
['&Kappa;', '&#922;', true, 'Kappa'],
['&Lambda;', '&#923;', true, 'Lambda'],
['&Mu;', '&#924;', true, 'Mu'],
['&Nu;', '&#925;', true, 'Nu'],
['&Xi;', '&#926;', true, 'Xi'],
['&Omicron;', '&#927;', true, 'Omicron'],
['&Pi;', '&#928;', true, 'Pi'],
['&Rho;', '&#929;', true, 'Rho'],
['&Sigma;', '&#931;', true, 'Sigma'],
['&Tau;', '&#932;', true, 'Tau'],
['&Upsilon;', '&#933;', true, 'Upsilon'],
['&Phi;', '&#934;', true, 'Phi'],
['&Chi;', '&#935;', true, 'Chi'],
['&Psi;', '&#936;', true, 'Psi'],
['&Omega;', '&#937;', true, 'Omega'],
['&alpha;', '&#945;', true, 'alpha'],
['&beta;', '&#946;', true, 'beta'],
['&gamma;', '&#947;', true, 'gamma'],
['&delta;', '&#948;', true, 'delta'],
['&epsilon;', '&#949;', true, 'epsilon'],
['&zeta;', '&#950;', true, 'zeta'],
['&eta;', '&#951;', true, 'eta'],
['&theta;', '&#952;', true, 'theta'],
['&iota;', '&#953;', true, 'iota'],
['&kappa;', '&#954;', true, 'kappa'],
['&lambda;', '&#955;', true, 'lambda'],
['&mu;', '&#956;', true, 'mu'],
['&nu;', '&#957;', true, 'nu'],
['&xi;', '&#958;', true, 'xi'],
['&omicron;', '&#959;', true, 'omicron'],
['&pi;', '&#960;', true, 'pi'],
['&rho;', '&#961;', true, 'rho'],
['&sigmaf;', '&#962;', true, 'final sigma'],
['&sigma;', '&#963;', true, 'sigma'],
['&tau;', '&#964;', true, 'tau'],
['&upsilon;', '&#965;', true, 'upsilon'],
['&phi;', '&#966;', true, 'phi'],
['&chi;', '&#967;', true, 'chi'],
['&psi;', '&#968;', true, 'psi'],
['&omega;', '&#969;', true, 'omega'],
// symbols
['&alefsym;', '&#8501;', false,'alef symbol'],
['&piv;', '&#982;', false,'pi symbol'],
['&real;', '&#8476;', false,'real part symbol'],
['&thetasym;','&#977;', false,'theta symbol'],
['&upsih;', '&#978;', false,'upsilon - hook symbol'],
['&weierp;', '&#8472;', false,'Weierstrass p'],
['&image;', '&#8465;', false,'imaginary part'],
// arrows
['&larr;', '&#8592;', true, 'leftwards arrow'],
['&uarr;', '&#8593;', true, 'upwards arrow'],
['&rarr;', '&#8594;', true, 'rightwards arrow'],
['&darr;', '&#8595;', true, 'downwards arrow'],
['&harr;', '&#8596;', true, 'left right arrow'],
['&crarr;', '&#8629;', false,'carriage return'],
['&lArr;', '&#8656;', false,'leftwards double arrow'],
['&uArr;', '&#8657;', false,'upwards double arrow'],
['&rArr;', '&#8658;', false,'rightwards double arrow'],
['&dArr;', '&#8659;', false,'downwards double arrow'],
['&hArr;', '&#8660;', false,'left right double arrow'],
['&there4;', '&#8756;', false,'therefore'],
['&sub;', '&#8834;', false,'subset of'],
['&sup;', '&#8835;', false,'superset of'],
['&nsub;', '&#8836;', false,'not a subset of'],
['&sube;', '&#8838;', false,'subset of or equal to'],
['&supe;', '&#8839;', false,'superset of or equal to'],
['&oplus;', '&#8853;', false,'circled plus'],
['&otimes;', '&#8855;', false,'circled times'],
['&perp;', '&#8869;', false,'perpendicular'],
['&sdot;', '&#8901;', false,'dot operator'],
['&lceil;', '&#8968;', false,'left ceiling'],
['&rceil;', '&#8969;', false,'right ceiling'],
['&lfloor;', '&#8970;', false,'left floor'],
['&rfloor;', '&#8971;', false,'right floor'],
['&lang;', '&#9001;', false,'left-pointing angle bracket'],
['&rang;', '&#9002;', false,'right-pointing angle bracket'],
['&loz;', '&#9674;', true,'lozenge'],
['&spades;', '&#9824;', false,'black spade suit'],
['&clubs;', '&#9827;', true, 'black club suit'],
['&hearts;', '&#9829;', true, 'black heart suit'],
['&diams;', '&#9830;', true, 'black diamond suit'],
['&ensp;', '&#8194;', false,'en space'],
['&emsp;', '&#8195;', false,'em space'],
['&thinsp;', '&#8201;', false,'thin space'],
['&zwnj;', '&#8204;', false,'zero width non-joiner'],
['&zwj;', '&#8205;', false,'zero width joiner'],
['&lrm;', '&#8206;', false,'left-to-right mark'],
['&rlm;', '&#8207;', false,'right-to-left mark'],
['&shy;', '&#173;', false,'soft hyphen']
];
tinyMCEPopup.onInit.add(function() {
tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
});
function renderCharMapHTML() {
var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
var cols=-1;
for (i=0; i<charmap.length; i++) {
if (charmap[i][2]==true) {
cols++;
html += ''
+ '<td class="charmap">'
+ '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+ charmap[i][1]
+ '</a></td>';
if ((cols+1) % charsPerRow == 0)
html += '</tr><tr height="' + tdHeight + '">';
}
}
if (cols % charsPerRow > 0) {
var padd = charsPerRow - (cols % charsPerRow);
for (var i=0; i<padd-1; i++)
html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
}
html += '</tr></table>';
return html;
}
function insertChar(chr) {
tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
// Refocus in window
if (tinyMCEPopup.isWindow)
window.focus();
tinyMCEPopup.editor.focus();
tinyMCEPopup.close();
}
function previewChar(codeA, codeB, codeN) {
var elmA = document.getElementById('codeA');
var elmB = document.getElementById('codeB');
var elmV = document.getElementById('codeV');
var elmN = document.getElementById('codeN');
if (codeA=='#160;') {
elmV.innerHTML = '__';
} else {
elmV.innerHTML = '&' + codeA;
}
elmB.innerHTML = '&amp;' + codeA;
elmA.innerHTML = '&amp;' + codeB;
elmN.innerHTML = codeN;
}

View File

@ -0,0 +1,253 @@
tinyMCEPopup.requireLangPack();
var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
var colors = [
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
];
var named = {
'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown',
'#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue',
'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod',
'#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen',
'#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue',
'#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue',
'#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen',
'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey',
'#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory',
'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue',
'#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen',
'#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey',
'#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
'#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue',
'#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin',
'#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid',
'#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff',
'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue',
'#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver',
'#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen',
'#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen'
};
function init() {
var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
tinyMCEPopup.resizeToInnerSize();
generatePicker();
if (inputColor) {
changeFinalColor(inputColor);
col = convertHexToRGB(inputColor);
if (col)
updateLight(col.r, col.g, col.b);
}
}
function insertAction() {
var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
tinyMCEPopup.restoreSelection();
if (f)
f(color);
tinyMCEPopup.close();
}
function showColor(color, name) {
if (name)
document.getElementById("colorname").innerHTML = name;
document.getElementById("preview").style.backgroundColor = color;
document.getElementById("color").value = color.toLowerCase();
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
if (!col)
return col;
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return {r : r, g : g, b : b};
}
return null;
}
function generatePicker() {
var el = document.getElementById('light'), h = '', i;
for (i = 0; i < detail; i++){
h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
+ ' onmousedown="isMouseDown = true; return false;"'
+ ' onmouseup="isMouseDown = false;"'
+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
+ ' onmouseover="isMouseOver = true;"'
+ ' onmouseout="isMouseOver = false;"'
+ '></div>';
}
el.innerHTML = h;
}
function generateWebColors() {
var el = document.getElementById('webcolors'), h = '', i;
if (el.className == 'generated')
return;
h += '<table border="0" cellspacing="1" cellpadding="0">'
+ '<tr>';
for (i=0; i<colors.length; i++) {
h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
+ '</a></td>';
if ((i+1) % 18 == 0)
h += '</tr><tr>';
}
h += '</table>';
el.innerHTML = h;
el.className = 'generated';
}
function generateNamedColors() {
var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
if (el.className == 'generated')
return;
for (n in named) {
v = named[n];
h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'
}
el.innerHTML = h;
el.className = 'generated';
}
function dechex(n) {
return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
}
function computeColor(e) {
var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
partWidth = document.getElementById('colors').width / 6;
partDetail = detail / 2;
imHeight = document.getElementById('colors').height;
r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
coef = (imHeight - y) / imHeight;
r = 128 + (r - 128) * coef;
g = 128 + (g - 128) * coef;
b = 128 + (b - 128) * coef;
changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
updateLight(r, g, b);
}
function updateLight(r, g, b) {
var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
for (i=0; i<detail; i++) {
if ((i>=0) && (i<partDetail)) {
finalCoef = i / partDetail;
finalR = dechex(255 - (255 - r) * finalCoef);
finalG = dechex(255 - (255 - g) * finalCoef);
finalB = dechex(255 - (255 - b) * finalCoef);
} else {
finalCoef = 2 - i / partDetail;
finalR = dechex(r * finalCoef);
finalG = dechex(g * finalCoef);
finalB = dechex(b * finalCoef);
}
color = finalR + finalG + finalB;
setCol('gs' + i, '#'+color);
}
}
function changeFinalColor(color) {
if (color.indexOf('#') == -1)
color = convertRGBToHex(color);
setCol('preview', color);
document.getElementById('color').value = color;
}
function setCol(e, c) {
try {
document.getElementById(e).style.backgroundColor = c;
} catch (ex) {
// Ignore IE warning
}
}
tinyMCEPopup.onInit.add(init);

View File

@ -0,0 +1,245 @@
var ImageDialog = {
preInit : function() {
var url;
tinyMCEPopup.requireLangPack();
if (url = tinyMCEPopup.getParam("external_image_list_url"))
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
},
init : function() {
var f = document.forms[0], ed = tinyMCEPopup.editor;
// Setup browse button
document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
if (isVisible('srcbrowser'))
document.getElementById('src').style.width = '180px';
e = ed.selection.getNode();
this.fillFileList('image_list', 'tinyMCEImageList');
if (e.nodeName == 'IMG') {
f.src.value = ed.dom.getAttrib(e, 'src');
f.alt.value = ed.dom.getAttrib(e, 'alt');
f.border.value = this.getAttrib(e, 'border');
f.vspace.value = this.getAttrib(e, 'vspace');
f.hspace.value = this.getAttrib(e, 'hspace');
f.width.value = ed.dom.getAttrib(e, 'width');
f.height.value = ed.dom.getAttrib(e, 'height');
f.insert.value = ed.getLang('update');
this.styleVal = ed.dom.getAttrib(e, 'style');
selectByValue(f, 'image_list', f.src.value);
selectByValue(f, 'align', this.getAttrib(e, 'align'));
this.updateStyle();
}
},
fillFileList : function(id, l) {
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
l = window[l];
if (l && l.length > 0) {
lst.options[lst.options.length] = new Option('', '');
tinymce.each(l, function(o) {
lst.options[lst.options.length] = new Option(o[0], o[1]);
});
} else
dom.remove(dom.getParent(id, 'tr'));
},
update : function() {
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
tinyMCEPopup.restoreSelection();
if (f.src.value === '') {
if (ed.selection.getNode().nodeName == 'IMG') {
ed.dom.remove(ed.selection.getNode());
ed.execCommand('mceRepaint');
}
tinyMCEPopup.close();
return;
}
if (!ed.settings.inline_styles) {
args = tinymce.extend(args, {
vspace : nl.vspace.value,
hspace : nl.hspace.value,
border : nl.border.value,
align : getSelectValue(f, 'align')
});
} else
args.style = this.styleVal;
tinymce.extend(args, {
src : f.src.value,
alt : f.alt.value,
width : f.width.value,
height : f.height.value
});
el = ed.selection.getNode();
if (el && el.nodeName == 'IMG') {
ed.dom.setAttribs(el, args);
} else {
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
ed.dom.setAttribs('__mce_tmp', args);
ed.dom.setAttrib('__mce_tmp', 'id', '');
ed.undoManager.add();
}
tinyMCEPopup.close();
},
updateStyle : function() {
var dom = tinyMCEPopup.dom, st, v, f = document.forms[0];
if (tinyMCEPopup.editor.settings.inline_styles) {
st = tinyMCEPopup.dom.parseStyle(this.styleVal);
// Handle align
v = getSelectValue(f, 'align');
if (v) {
if (v == 'left' || v == 'right') {
st['float'] = v;
delete st['vertical-align'];
} else {
st['vertical-align'] = v;
delete st['float'];
}
} else {
delete st['float'];
delete st['vertical-align'];
}
// Handle border
v = f.border.value;
if (v || v == '0') {
if (v == '0')
st['border'] = '0';
else
st['border'] = v + 'px solid black';
} else
delete st['border'];
// Handle hspace
v = f.hspace.value;
if (v) {
delete st['margin'];
st['margin-left'] = v + 'px';
st['margin-right'] = v + 'px';
} else {
delete st['margin-left'];
delete st['margin-right'];
}
// Handle vspace
v = f.vspace.value;
if (v) {
delete st['margin'];
st['margin-top'] = v + 'px';
st['margin-bottom'] = v + 'px';
} else {
delete st['margin-top'];
delete st['margin-bottom'];
}
// Merge
st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');
this.styleVal = dom.serializeStyle(st, 'img');
}
},
getAttrib : function(e, at) {
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
if (ed.settings.inline_styles) {
switch (at) {
case 'align':
if (v = dom.getStyle(e, 'float'))
return v;
if (v = dom.getStyle(e, 'vertical-align'))
return v;
break;
case 'hspace':
v = dom.getStyle(e, 'margin-left')
v2 = dom.getStyle(e, 'margin-right');
if (v && v == v2)
return parseInt(v.replace(/[^0-9]/g, ''));
break;
case 'vspace':
v = dom.getStyle(e, 'margin-top')
v2 = dom.getStyle(e, 'margin-bottom');
if (v && v == v2)
return parseInt(v.replace(/[^0-9]/g, ''));
break;
case 'border':
v = 0;
tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
sv = dom.getStyle(e, 'border-' + sv + '-width');
// False or not the same as prev
if (!sv || (sv != v && v !== 0)) {
v = 0;
return false;
}
if (sv)
v = sv;
});
if (v)
return parseInt(v.replace(/[^0-9]/g, ''));
break;
}
}
if (v = dom.getAttrib(e, at))
return v;
return '';
},
resetImageData : function() {
var f = document.forms[0];
f.width.value = f.height.value = "";
},
updateImageData : function() {
var f = document.forms[0], t = ImageDialog;
if (f.width.value == "")
f.width.value = t.preloadImg.width;
if (f.height.value == "")
f.height.value = t.preloadImg.height;
},
getImageData : function() {
var f = document.forms[0];
this.preloadImg = new Image();
this.preloadImg.onload = this.updateImageData;
this.preloadImg.onerror = this.resetImageData;
this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
}
};
ImageDialog.preInit();
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);

View File

@ -0,0 +1,156 @@
tinyMCEPopup.requireLangPack();
var LinkDialog = {
preInit : function() {
var url;
if (url = tinyMCEPopup.getParam("external_link_list_url"))
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
},
init : function() {
var f = document.forms[0], ed = tinyMCEPopup.editor;
// Setup browse button
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');
if (isVisible('hrefbrowser'))
document.getElementById('href').style.width = '180px';
this.fillClassList('class_list');
this.fillFileList('link_list', 'tinyMCELinkList');
this.fillTargetList('target_list');
if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {
f.href.value = ed.dom.getAttrib(e, 'href');
f.linktitle.value = ed.dom.getAttrib(e, 'title');
f.insert.value = ed.getLang('update');
selectByValue(f, 'link_list', f.href.value);
selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));
selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));
}
},
update : function() {
var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
tinyMCEPopup.restoreSelection();
e = ed.dom.getParent(ed.selection.getNode(), 'A');
// Remove element if there is no href
if (!f.href.value) {
if (e) {
tinyMCEPopup.execCommand("mceBeginUndoLevel");
b = ed.selection.getBookmark();
ed.dom.remove(e, 1);
ed.selection.moveToBookmark(b);
tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
return;
}
}
tinyMCEPopup.execCommand("mceBeginUndoLevel");
// Create new anchor elements
if (e == null) {
ed.getDoc().execCommand("unlink", false, null);
tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
tinymce.each(ed.dom.select("a"), function(n) {
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
e = n;
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
});
}
});
} else {
ed.dom.setAttribs(e, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? getSelectValue(f, "target_list") : null,
'class' : f.class_list ? getSelectValue(f, "class_list") : null
});
}
// Don't move caret if selection was image
if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
ed.focus();
ed.selection.select(e);
ed.selection.collapse(0);
tinyMCEPopup.storeSelection();
}
tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close();
},
checkPrefix : function(n) {
if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
n.value = 'mailto:' + n.value;
if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
n.value = 'http://' + n.value;
},
fillFileList : function(id, l) {
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
l = window[l];
if (l && l.length > 0) {
lst.options[lst.options.length] = new Option('', '');
tinymce.each(l, function(o) {
lst.options[lst.options.length] = new Option(o[0], o[1]);
});
} else
dom.remove(dom.getParent(id, 'tr'));
},
fillClassList : function(id) {
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
cl = [];
tinymce.each(v.split(';'), function(v) {
var p = v.split('=');
cl.push({'title' : p[0], 'class' : p[1]});
});
} else
cl = tinyMCEPopup.editor.dom.getClasses();
if (cl.length > 0) {
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
tinymce.each(cl, function(o) {
lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
});
} else
dom.remove(dom.getParent(id, 'tr'));
},
fillTargetList : function(id) {
var dom = tinyMCEPopup.dom, lst = dom.get(id), v;
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');
if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
tinymce.each(v.split(','), function(v) {
v = v.split('=');
lst.options[lst.options.length] = new Option(v[0], v[1]);
});
}
}
};
LinkDialog.preInit();
tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);

View File

@ -0,0 +1,62 @@
tinyMCEPopup.requireLangPack();
tinyMCEPopup.onInit.add(onLoadInit);
function saveContent() {
tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Remove Gecko spellchecking
if (tinymce.isGecko)
document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
setWrap('soft');
document.getElementById('wraped').checked = true;
}
resizeInputs();
}
function setWrap(val) {
var v, n, s = document.getElementById('htmlSource');
s.wrap = val;
if (!tinymce.isIE) {
v = s.value;
n = s.cloneNode(false);
n.setAttribute("wrap", val);
s.parentNode.replaceChild(n, s);
n.value = v;
}
}
function toggleWordWrap(elm) {
if (elm.checked)
setWrap('soft');
else
setWrap('off');
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
var el = document.getElementById('htmlSource');
if (!tinymce.isIE) {
wHeight = self.innerHeight - 65;
wWidth = self.innerWidth - 16;
} else {
wHeight = document.body.clientHeight - 70;
wWidth = document.body.clientWidth - 16;
}
el.style.height = Math.abs(wHeight) + 'px';
el.style.width = Math.abs(wWidth) + 'px';
}

View File

@ -0,0 +1,62 @@
tinyMCE.addI18n('en.advanced',{
style_select:"Styles",
font_size:"Font size",
fontdefault:"Font family",
block:"Format",
paragraph:"Paragraph",
div:"Div",
address:"Address",
pre:"Preformatted",
h1:"Heading 1",
h2:"Heading 2",
h3:"Heading 3",
h4:"Heading 4",
h5:"Heading 5",
h6:"Heading 6",
blockquote:"Blockquote",
code:"Code",
samp:"Code sample",
dt:"Definition term ",
dd:"Definition description",
bold_desc:"Bold (Ctrl+B)",
italic_desc:"Italic (Ctrl+I)",
underline_desc:"Underline (Ctrl+U)",
striketrough_desc:"Strikethrough",
justifyleft_desc:"Align left",
justifycenter_desc:"Align center",
justifyright_desc:"Align right",
justifyfull_desc:"Align full",
bullist_desc:"Unordered list",
numlist_desc:"Ordered list",
outdent_desc:"Outdent",
indent_desc:"Indent",
undo_desc:"Undo (Ctrl+Z)",
redo_desc:"Redo (Ctrl+Y)",
link_desc:"Insert/edit link",
unlink_desc:"Unlink",
image_desc:"Insert/edit image",
cleanup_desc:"Cleanup messy code",
code_desc:"Edit HTML Source",
sub_desc:"Subscript",
sup_desc:"Superscript",
hr_desc:"Insert horizontal ruler",
removeformat_desc:"Remove formatting",
custom1_desc:"Your custom description here",
forecolor_desc:"Select text color",
backcolor_desc:"Select background color",
charmap_desc:"Insert custom character",
visualaid_desc:"Toggle guidelines/invisible elements",
anchor_desc:"Insert/edit anchor",
cut_desc:"Cut",
copy_desc:"Copy",
paste_desc:"Paste",
image_props_desc:"Image properties",
newdocument_desc:"New document",
help_desc:"Help",
blockquote_desc:"Blockquote",
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?",
path:"Path",
newdocument:"Are you sure you want clear all contents?",
toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",
more_colors:"More colors"
});

View File

@ -0,0 +1,51 @@
tinyMCE.addI18n('en.advanced_dlg',{
about_title:"About TinyMCE",
about_general:"About",
about_help:"Help",
about_license:"License",
about_plugins:"Plugins",
about_plugin:"Plugin",
about_author:"Author",
about_version:"Version",
about_loaded:"Loaded plugins",
anchor_title:"Insert/edit anchor",
anchor_name:"Anchor name",
code_title:"HTML Source Editor",
code_wordwrap:"Word wrap",
colorpicker_title:"Select a color",
colorpicker_picker_tab:"Picker",
colorpicker_picker_title:"Color picker",
colorpicker_palette_tab:"Palette",
colorpicker_palette_title:"Palette colors",
colorpicker_named_tab:"Named",
colorpicker_named_title:"Named colors",
colorpicker_color:"Color:",
colorpicker_name:"Name:",
charmap_title:"Select custom character",
image_title:"Insert/edit image",
image_src:"Image URL",
image_alt:"Image description",
image_list:"Image list",
image_border:"Border",
image_dimensions:"Dimensions",
image_vspace:"Vertical space",
image_hspace:"Horizontal space",
image_align:"Alignment",
image_align_baseline:"Baseline",
image_align_top:"Top",
image_align_middle:"Middle",
image_align_bottom:"Bottom",
image_align_texttop:"Text top",
image_align_textbottom:"Text bottom",
image_align_left:"Left",
image_align_right:"Right",
link_title:"Insert/edit link",
link_url:"Link URL",
link_target:"Target",
link_target_same:"Open link in the same window",
link_target_blank:"Open link in a new window",
link_titlefield:"Title",
link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
link_list:"Link list"
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,11 @@
tinyMCE.addI18n('en.simple',{
bold_desc:"Bold (Ctrl+B)",
italic_desc:"Italic (Ctrl+I)",
underline_desc:"Underline (Ctrl+U)",
striketrough_desc:"Strikethrough",
bullist_desc:"Unordered list",
numlist_desc:"Ordered list",
undo_desc:"Undo (Ctrl+Z)",
redo_desc:"Redo (Ctrl+Y)",
cleanup_desc:"Cleanup messy code"
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -0,0 +1,70 @@
/**
* editable_selects.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
var TinyMCE_EditableSelects = {
editSelectElm : null,
init : function() {
var nl = document.getElementsByTagName("select"), i, d = document, o;
for (i=0; i<nl.length; i++) {
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
o = new Option('(value)', '__mce_add_custom__');
o.className = 'mceAddSelectValue';
nl[i].options[nl[i].options.length] = o;
nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
}
}
},
onChangeEditableSelect : function(e) {
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
ne = d.createElement("input");
ne.id = se.id + "_custom";
ne.name = se.name + "_custom";
ne.type = "text";
ne.style.width = se.offsetWidth + 'px';
se.parentNode.insertBefore(ne, se);
se.style.display = 'none';
ne.focus();
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
TinyMCE_EditableSelects.editSelectElm = se;
}
},
onBlurEditableSelectInput : function() {
var se = TinyMCE_EditableSelects.editSelectElm;
if (se) {
if (se.previousSibling.value != '') {
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
selectByValue(document.forms[0], se.id, se.previousSibling.value);
} else
selectByValue(document.forms[0], se.id, '');
se.style.display = 'inline';
se.parentNode.removeChild(se.previousSibling);
TinyMCE_EditableSelects.editSelectElm = null;
}
},
onKeyDown : function(e) {
e = e || window.event;
if (e.keyCode == 13)
TinyMCE_EditableSelects.onBlurEditableSelectInput();
}
};

View File

@ -0,0 +1,200 @@
/**
* form_utils.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
function getColorPickerHTML(id, target_form_element) {
var h = "";
h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
return h;
}
function updateColor(img_id, form_element_id) {
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
}
function setBrowserDisabled(id, state) {
var img = document.getElementById(id);
var lnk = document.getElementById(id + "_link");
if (lnk) {
if (state) {
lnk.setAttribute("realhref", lnk.getAttribute("href"));
lnk.removeAttribute("href");
tinyMCEPopup.dom.addClass(img, 'disabled');
} else {
if (lnk.getAttribute("realhref"))
lnk.setAttribute("href", lnk.getAttribute("realhref"));
tinyMCEPopup.dom.removeClass(img, 'disabled');
}
}
}
function getBrowserHTML(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback", cb, html;
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
if (!cb)
return "";
html = "";
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
return html;
}
function openBrowser(img_id, target_form_element, type, option) {
var img = document.getElementById(img_id);
if (img.className != "mceButtonDisabled")
tinyMCEPopup.openBrowser(target_form_element, type, option);
}
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
var sel = form_obj.elements[field_name];
var found = false;
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
option.selected = false;
}
if (!found && add_custom && value != '') {
var option = new Option(value, value);
option.selected = true;
sel.options[sel.options.length] = option;
sel.selectedIndex = sel.options.length - 1;
}
return found;
}
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null || elm.selectedIndex === -1)
return "";
return elm.options[elm.selectedIndex].value;
}
function addSelectValue(form_obj, field_name, name, value) {
var s = form_obj.elements[field_name];
var o = new Option(name, value);
s.options[s.options.length] = o;
}
function addClassesToList(list_id, specific_option) {
// Setup class droplist
var styleSelectElm = document.getElementById(list_id);
var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
styles = tinyMCEPopup.getParam(specific_option, styles);
if (styles) {
var stylesAr = styles.split(';');
for (var i=0; i<stylesAr.length; i++) {
if (stylesAr != "") {
var key, value;
key = stylesAr[i].split('=')[0];
value = stylesAr[i].split('=')[1];
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
}
}
} else {
tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
});
}
}
function isVisible(element_id) {
var elm = document.getElementById(element_id);
return elm && elm.style.display != "none";
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function trimSize(size) {
return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2');
}
function getCSSSize(size) {
size = trimSize(size);
if (size == "")
return "";
// Add px
if (/^[0-9]+$/.test(size))
size += 'px';
return size;
}
function getStyle(elm, attrib, style) {
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
if (val != '')
return '' + val;
if (typeof(style) == 'undefined')
style = attrib;
return tinyMCEPopup.dom.getStyle(elm, style);
}

View File

@ -0,0 +1,77 @@
/**
* mctabs.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
function MCTabs() {
this.settings = [];
};
MCTabs.prototype.init = function(settings) {
this.settings = settings;
};
MCTabs.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i;
panelElm= document.getElementById(panel_id);
panelContainerElm = panelElm ? panelElm.parentNode : null;
tabElm = document.getElementById(tab_id);
tabContainerElm = tabElm ? tabElm.parentNode : null;
selectionClass = this.getParam('selection_class', 'current');
if (tabElm && tabContainerElm) {
nodes = tabContainerElm.childNodes;
// Hide all other tabs
for (i = 0; i < nodes.length; i++) {
if (nodes[i].nodeName == "LI")
nodes[i].className = '';
}
// Show selected tab
tabElm.className = 'current';
}
if (panelElm && panelContainerElm) {
nodes = panelContainerElm.childNodes;
// Hide all other panels
for (i = 0; i < nodes.length; i++) {
if (nodes[i].nodeName == "DIV")
nodes[i].className = 'panel';
}
// Show selected panel
panelElm.className = 'current';
}
};
MCTabs.prototype.getAnchor = function() {
var pos, url = document.location.href;
if ((pos = url.lastIndexOf('#')) != -1)
return url.substring(pos + 1);
return "";
};
// Global instance
var mcTabs = new MCTabs();

View File

@ -0,0 +1,220 @@
/**
* validate.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
/**
// String validation:
if (!Validator.isEmail('myemail'))
alert('Invalid email.');
// Form validation:
var f = document.forms['myform'];
if (!Validator.isEmail(f.myemail))
alert('Invalid email.');
*/
var Validator = {
isEmail : function(s) {
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
},
isAbsUrl : function(s) {
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
},
isSize : function(s) {
return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
},
isId : function(s) {
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
},
isEmpty : function(s) {
var nl, i;
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
return true;
if (s.type == 'checkbox' && !s.checked)
return true;
if (s.type == 'radio') {
for (i=0, nl = s.form.elements; i<nl.length; i++) {
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
return false;
}
return true;
}
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
},
isNumber : function(s, d) {
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
},
test : function(s, p) {
s = s.nodeType == 1 ? s.value : s;
return s == '' || new RegExp(p).test(s);
}
};
var AutoValidator = {
settings : {
id_cls : 'id',
int_cls : 'int',
url_cls : 'url',
number_cls : 'number',
email_cls : 'email',
size_cls : 'size',
required_cls : 'required',
invalid_cls : 'invalid',
min_cls : 'min',
max_cls : 'max'
},
init : function(s) {
var n;
for (n in s)
this.settings[n] = s[n];
},
validate : function(f) {
var i, nl, s = this.settings, c = 0;
nl = this.tags(f, 'label');
for (i=0; i<nl.length; i++)
this.removeClass(nl[i], s.invalid_cls);
c += this.validateElms(f, 'input');
c += this.validateElms(f, 'select');
c += this.validateElms(f, 'textarea');
return c == 3;
},
invalidate : function(n) {
this.mark(n.form, n);
},
reset : function(e) {
var t = ['label', 'input', 'select', 'textarea'];
var i, j, nl, s = this.settings;
if (e == null)
return;
for (i=0; i<t.length; i++) {
nl = this.tags(e.form ? e.form : e, t[i]);
for (j=0; j<nl.length; j++)
this.removeClass(nl[j], s.invalid_cls);
}
},
validateElms : function(f, e) {
var nl, i, n, s = this.settings, st = true, va = Validator, v;
nl = this.tags(f, e);
for (i=0; i<nl.length; i++) {
n = nl[i];
this.removeClass(n, s.invalid_cls);
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
st = this.mark(f, n);
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
st = this.mark(f, n);
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
st = this.mark(f, n);
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
st = this.mark(f, n);
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
st = this.mark(f, n);
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
st = this.mark(f, n);
if (this.hasClass(n, s.id_cls) && !va.isId(n))
st = this.mark(f, n);
if (this.hasClass(n, s.min_cls, true)) {
v = this.getNum(n, s.min_cls);
if (isNaN(v) || parseInt(n.value) < parseInt(v))
st = this.mark(f, n);
}
if (this.hasClass(n, s.max_cls, true)) {
v = this.getNum(n, s.max_cls);
if (isNaN(v) || parseInt(n.value) > parseInt(v))
st = this.mark(f, n);
}
}
return st;
},
hasClass : function(n, c, d) {
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
},
getNum : function(n, c) {
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
c = c.replace(/[^0-9]/g, '');
return c;
},
addClass : function(n, c, b) {
var o = this.removeClass(n, c);
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
},
removeClass : function(n, c) {
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
return n.className = c != ' ' ? c : '';
},
tags : function(f, s) {
return f.getElementsByTagName(s);
},
mark : function(f, n) {
var s = this.settings;
this.addClass(n, s.invalid_cls);
this.markLabels(f, n, s.invalid_cls);
return false;
},
markLabels : function(f, n, ic) {
var nl, i;
nl = this.tags(f, "label");
for (i=0; i<nl.length; i++) {
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
this.addClass(nl[i], ic);
}
return null;
}
};