mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
most of the way through making the wcm tinymce extensions available from create html. still need to address:
- IE issues - how to handle uploaded files from the create html context - break out the filepicker backing code into its own bean (it's mingled into the XFormsBean at the moment) also reorganizing and pruning the xforms unit test tree. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5613 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
//
|
||||
// This script communicates with the XFormBean to produce and manage an xform.
|
||||
//
|
||||
// This script requires dojo.js, tiny_mce.js, and upload_helper.js to be
|
||||
// loaded in advance.
|
||||
// This script requires dojo.js, tiny_mce.js, tiny_mce_wcm_extensions.js, and
|
||||
// upload_helper.js to be loaded in advance.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -988,9 +988,9 @@ dojo.declare("alfresco.xforms.RichTextEditor",
|
||||
{
|
||||
this.hoverLayer = document.createElement("div");
|
||||
dojo.html.setClass(this.hoverLayer, "xformsRichTextEditorHoverLayer");
|
||||
this.hoverLayer.appendChild(document.createTextNode(alfresco.xforms.constants.resources["click_to_edit"]));
|
||||
this.hoverLayer.appendChild(document.createTextNode(alfresco.resources["click_to_edit"]));
|
||||
}
|
||||
if (!this.hoverLayer.parentNode)
|
||||
if (this.hoverLayer.parentNode != this.widget)
|
||||
{
|
||||
this.widget.appendChild(this.hoverLayer);
|
||||
this.hoverLayer.style.lineHeight = this.hoverLayer.offsetHeight + "px";
|
||||
@@ -1009,7 +1009,7 @@ dojo.declare("alfresco.xforms.RichTextEditor",
|
||||
|
||||
_hoverLayer_mouseoutHandler: function(event)
|
||||
{
|
||||
if (this.hoverLayer.parentNode)
|
||||
if (this.hoverLayer.parentNode == this.widget)
|
||||
{
|
||||
this.widget.removeChild(this.hoverLayer);
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@ dojo.declare("alfresco.xforms.RichTextEditor",
|
||||
|
||||
_hoverLayer_clickHandler: function(event)
|
||||
{
|
||||
if (this.hoverLayer.parentNode)
|
||||
if (this.hoverLayer.parentNode == this.widget)
|
||||
{
|
||||
this.widget.removeChild(this.hoverLayer);
|
||||
this._createTinyMCE();
|
||||
@@ -1260,7 +1260,7 @@ dojo.declare("alfresco.xforms.ListSelect",
|
||||
}
|
||||
}
|
||||
this._commitValueChange();
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -1522,7 +1522,7 @@ dojo.declare("alfresco.xforms.DatePicker",
|
||||
: null);
|
||||
|
||||
// XXXarielb - change to a static
|
||||
this._noValueSet = (alfresco.xforms.constants.resources["eg"] + " " +
|
||||
this._noValueSet = (alfresco.resources["eg"] + " " +
|
||||
dojo.date.format(new Date(),
|
||||
{datePattern: alfresco.xforms.constants.DATE_FORMAT,
|
||||
selector: 'dateOnly'}));
|
||||
@@ -1692,7 +1692,7 @@ dojo.declare("alfresco.xforms.TimePicker",
|
||||
function(xform, xformsNode)
|
||||
{
|
||||
dojo.require("dojo.widget.TimePicker");
|
||||
this._noValueSet = (alfresco.xforms.constants.resources["eg"] + " " +
|
||||
this._noValueSet = (alfresco.resources["eg"] + " " +
|
||||
dojo.date.format(new Date(),
|
||||
{timePattern: alfresco.xforms.constants.TIME_FORMAT,
|
||||
selector: "timeOnly"}));
|
||||
@@ -1864,7 +1864,7 @@ dojo.declare("alfresco.xforms.DateTimePicker",
|
||||
dojo.require("dojo.widget.DatePicker");
|
||||
dojo.require("dojo.widget.TimePicker");
|
||||
|
||||
this._noValueSet = (alfresco.xforms.constants.resources["eg"] + " " +
|
||||
this._noValueSet = (alfresco.resources["eg"] + " " +
|
||||
dojo.date.format(new Date(),
|
||||
{datePattern: alfresco.xforms.constants.DATE_TIME_FORMAT,
|
||||
selector: "dateOnly"}));
|
||||
@@ -4411,7 +4411,7 @@ dojo.declare("alfresco.xforms.XForm",
|
||||
{
|
||||
this.submitWidget = null;
|
||||
var invalid = this.rootWidget.getWidgetsInvalidForSubmit();
|
||||
_show_error(document.createTextNode(alfresco.xforms.constants.resources["validation_provide_values_for_required_fields"]));
|
||||
_show_error(document.createTextNode(alfresco.resources["validation_provide_values_for_required_fields"]));
|
||||
var error_list = document.createElement("ul");
|
||||
for (var j = 0; j < invalid.length; j++)
|
||||
{
|
||||
@@ -4635,6 +4635,7 @@ dojo.html.toCamelCase = function(str)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// tiny mce integration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
tinyMCE.init({
|
||||
theme: "advanced",
|
||||
mode: "exact",
|
||||
@@ -4654,267 +4655,71 @@ tinyMCE.init({
|
||||
urlconverter_callback: "alfresco_TinyMCE_urlconverter_callback"
|
||||
});
|
||||
|
||||
function alfresco_TinyMCE_urlconverter_callback(href, element, onsave)
|
||||
{
|
||||
dojo.debug("request to convert " + href + " onsave = " + onsave);
|
||||
if (onsave)
|
||||
{
|
||||
return (href && href.startsWith(alfresco.constants.AVM_WEBAPP_URL)
|
||||
? href.substring(alfresco.constants.AVM_WEBAPP_URL.length)
|
||||
: href);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (href && href.startsWith("/")
|
||||
? alfresco.constants.AVM_WEBAPP_URL + href
|
||||
: href);
|
||||
}
|
||||
}
|
||||
|
||||
function alfresco_TinyMCE_execcommand_callback(editor_id, elm, command, user_interface, value)
|
||||
{
|
||||
if (command == "mceLink")
|
||||
{
|
||||
// BEGIN COPIED FROM ADVANCED THEME editor_template_src.js
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
var doc = inst.getDoc();
|
||||
var selectedText = (tinyMCE.isMSIE
|
||||
? doc.selection.createRange().text
|
||||
: inst.getSel().toString());
|
||||
|
||||
if (!tinyMCE.linkElement &&
|
||||
tinyMCE.selectedElement.nodeName.toLowerCase() != "img" &&
|
||||
selectedText.length <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var href = "", target = "", title = "", onclick = "", action = "insert", style_class = "";
|
||||
|
||||
if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a")
|
||||
{
|
||||
tinyMCE.linkElement = tinyMCE.selectedElement;
|
||||
}
|
||||
|
||||
// Is anchor not a link
|
||||
if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "")
|
||||
{
|
||||
tinyMCE.linkElement = null;
|
||||
}
|
||||
|
||||
if (tinyMCE.linkElement)
|
||||
{
|
||||
href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href');
|
||||
target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target');
|
||||
title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title');
|
||||
onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
|
||||
style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class');
|
||||
|
||||
// Try old onclick to if copy/pasted content
|
||||
if (onclick == "")
|
||||
{
|
||||
onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
|
||||
}
|
||||
onclick = tinyMCE.cleanupEventStr(onclick);
|
||||
|
||||
href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
|
||||
|
||||
// Use mce_href if defined
|
||||
mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href');
|
||||
if (mceRealHref != "")
|
||||
{
|
||||
href = mceRealHref;
|
||||
if (tinyMCE.getParam('convert_urls'))
|
||||
{
|
||||
href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
|
||||
}
|
||||
}
|
||||
|
||||
action = "update";
|
||||
}
|
||||
|
||||
var window_props = { file: alfresco.constants.WEBAPP_CONTEXT + "/jsp/wcm/tiny_mce_link_dialog.jsp",
|
||||
width: 510 + tinyMCE.getLang('lang_insert_link_delta_width', 0),
|
||||
height: 400 + tinyMCE.getLang('lang_insert_link_delta_height', 0) };
|
||||
var dialog_props = { href: href,
|
||||
target: target,
|
||||
title: title,
|
||||
onclick: onclick,
|
||||
action: action,
|
||||
className: style_class,
|
||||
inline: "yes" };
|
||||
tinyMCE.openWindow(window_props, dialog_props);
|
||||
return true;
|
||||
}
|
||||
else if (command == "mceImage")
|
||||
{
|
||||
var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "",
|
||||
title = "", onmouseover = "", onmouseout = "", action = "insert";
|
||||
var img = tinyMCE.imgElement;
|
||||
var inst = tinyMCE.getInstanceById(editor_id);
|
||||
|
||||
if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")
|
||||
{
|
||||
img = tinyMCE.selectedElement;
|
||||
tinyMCE.imgElement = img;
|
||||
}
|
||||
|
||||
if (img)
|
||||
{
|
||||
// Is it a internal MCE visual aid image, then skip this one.
|
||||
if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
src = tinyMCE.getAttrib(img, 'src');
|
||||
alt = tinyMCE.getAttrib(img, 'alt');
|
||||
|
||||
// Try polling out the title
|
||||
if (alt == "")
|
||||
{
|
||||
alt = tinyMCE.getAttrib(img, 'title');
|
||||
}
|
||||
|
||||
// Fix width/height attributes if the styles is specified
|
||||
if (tinyMCE.isGecko)
|
||||
{
|
||||
var w = img.style.width;
|
||||
if (w != null && w.length != 0)
|
||||
{
|
||||
img.setAttribute("width", w);
|
||||
}
|
||||
|
||||
var h = img.style.height;
|
||||
if (h != null && h.length != 0)
|
||||
{
|
||||
img.setAttribute("height", h);
|
||||
}
|
||||
}
|
||||
|
||||
border = tinyMCE.getAttrib(img, 'border');
|
||||
hspace = tinyMCE.getAttrib(img, 'hspace');
|
||||
vspace = tinyMCE.getAttrib(img, 'vspace');
|
||||
width = tinyMCE.getAttrib(img, 'width');
|
||||
height = tinyMCE.getAttrib(img, 'height');
|
||||
align = tinyMCE.getAttrib(img, 'align');
|
||||
onmouseover = tinyMCE.getAttrib(img, 'onmouseover');
|
||||
onmouseout = tinyMCE.getAttrib(img, 'onmouseout');
|
||||
title = tinyMCE.getAttrib(img, 'title');
|
||||
|
||||
// Is realy specified?
|
||||
if (tinyMCE.isMSIE)
|
||||
{
|
||||
width = img.attributes['width'].specified ? width : "";
|
||||
height = img.attributes['height'].specified ? height : "";
|
||||
}
|
||||
|
||||
//onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));
|
||||
//onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));
|
||||
|
||||
src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
|
||||
|
||||
// Use mce_src if defined
|
||||
mceRealSrc = tinyMCE.getAttrib(img, 'mce_src');
|
||||
if (mceRealSrc != "")
|
||||
{
|
||||
src = mceRealSrc;
|
||||
|
||||
if (tinyMCE.getParam('convert_urls'))
|
||||
{
|
||||
src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
|
||||
}
|
||||
}
|
||||
action = "update";
|
||||
}
|
||||
|
||||
var window_props = { file: alfresco.constants.WEBAPP_CONTEXT + "/jsp/wcm/tiny_mce_image_dialog.jsp",
|
||||
width: 510 + tinyMCE.getLang('lang_insert_image_delta_width', 0),
|
||||
height: 400 + (tinyMCE.isMSIE ? 25 : 0) + tinyMCE.getLang('lang_insert_image_delta_height', 0) };
|
||||
var dialog_props = { src: src,
|
||||
alt: alt,
|
||||
border: border,
|
||||
hspace: hspace,
|
||||
vspace: vspace,
|
||||
width: width,
|
||||
height: height,
|
||||
align: align,
|
||||
title: title,
|
||||
onmouseover: onmouseover,
|
||||
onmouseout: onmouseout,
|
||||
action: action,
|
||||
inline: "yes" };
|
||||
tinyMCE.openWindow(window_props, dialog_props);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
alfresco.xforms.widgetConfig =
|
||||
{
|
||||
"xf:group":
|
||||
{
|
||||
"*": { "minimal": { "className": alfresco.xforms.HGroup }, "*": { "className": alfresco.xforms.VGroup }}
|
||||
"*": { "minimal": { className: alfresco.xforms.HGroup }, "*": { className: alfresco.xforms.VGroup }}
|
||||
},
|
||||
"xf:repeat":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.Repeat } }
|
||||
"*": { "*": { className: alfresco.xforms.Repeat } }
|
||||
},
|
||||
"xf:textarea":
|
||||
{
|
||||
"*": { "minimal": { "className": alfresco.xforms.PlainTextEditor },
|
||||
"*": { "className": alfresco.xforms.RichTextEditor, params: [ "bold,italic,underline,separator,forecolor,backcolor,separator,link,unlink,image", "", "" ] },
|
||||
"full": { "className": alfresco.xforms.RichTextEditor, params: ["bold,italic,underline,strikethrough,separator,fontselect,fontsizeselect", "link,unlink,image,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,separator,forecolor,backcolor", "" ] }},
|
||||
"*":
|
||||
{
|
||||
"minimal": { className: alfresco.xforms.PlainTextEditor },
|
||||
"*": { className: alfresco.xforms.RichTextEditor, params: [ "bold,italic,underline,separator,forecolor,backcolor,separator,link,unlink,image", "", "" ] },
|
||||
"full": { className: alfresco.xforms.RichTextEditor, params: ["bold,italic,underline,strikethrough,separator,fontselect,fontsizeselect", "link,unlink,image,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,undo,redo,separator,forecolor,backcolor", "" ] }
|
||||
}
|
||||
},
|
||||
"xf:upload":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.FilePicker } }
|
||||
"*": { "*": { className: alfresco.xforms.FilePicker } }
|
||||
},
|
||||
"xf:range":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.NumericalRange } }
|
||||
"*": { "*": { className: alfresco.xforms.NumericalRange } }
|
||||
},
|
||||
"xf:input":
|
||||
{
|
||||
"date": { "*": { "className": alfresco.xforms.DatePicker }},
|
||||
"time": { "*": { "className": alfresco.xforms.TimePicker }},
|
||||
"gDay": { "*": { "className": alfresco.xforms.DayPicker }},
|
||||
"gMonth": { "*": { "className": alfresco.xforms.MonthPicker }},
|
||||
"gYear": { "*": { "className": alfresco.xforms.YearPicker }},
|
||||
"gMonthDay": { "*": { "className": alfresco.xforms.MonthDayPicker }},
|
||||
"gYearMonth": { "*": { "className": alfresco.xforms.YearMonthPicker }},
|
||||
"dateTime": { "*": { "className": alfresco.xforms.DateTimePicker }},
|
||||
"*": { "*": { "className": alfresco.xforms.TextField }}
|
||||
"date": { "*": { className: alfresco.xforms.DatePicker }},
|
||||
"time": { "*": { className: alfresco.xforms.TimePicker }},
|
||||
"gDay": { "*": { className: alfresco.xforms.DayPicker }},
|
||||
"gMonth": { "*": { className: alfresco.xforms.MonthPicker }},
|
||||
"gYear": { "*": { className: alfresco.xforms.YearPicker }},
|
||||
"gMonthDay": { "*": { className: alfresco.xforms.MonthDayPicker }},
|
||||
"gYearMonth": { "*": { className: alfresco.xforms.YearMonthPicker }},
|
||||
"dateTime": { "*": { className: alfresco.xforms.DateTimePicker }},
|
||||
"*": { "*": { className: alfresco.xforms.TextField }}
|
||||
},
|
||||
"xf:select1":
|
||||
{
|
||||
"boolean": { "*": { "className": alfresco.xforms.Checkbox }},
|
||||
"*": { "full": { "className": alfresco.xforms.RadioSelect1},
|
||||
"*": { "className": alfresco.xforms.ComboboxSelect1 }}
|
||||
"boolean": { "*": { className: alfresco.xforms.Checkbox }},
|
||||
"*": { "full": { className: alfresco.xforms.RadioSelect1},
|
||||
"*": { className: alfresco.xforms.ComboboxSelect1 }}
|
||||
},
|
||||
"xf:select":
|
||||
{
|
||||
"*": { "full": { "className": alfresco.xforms.CheckboxSelect},
|
||||
"*": { "className": alfresco.xforms.ListSelect }}
|
||||
"*": { "full": { className: alfresco.xforms.CheckboxSelect},
|
||||
"*": { className: alfresco.xforms.ListSelect }}
|
||||
},
|
||||
"xf:submit":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.Submit } }
|
||||
"*": { "*": { className: alfresco.xforms.Submit } }
|
||||
},
|
||||
"xf:trigger":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.Trigger }}
|
||||
"*": { "*": { className: alfresco.xforms.Trigger }}
|
||||
},
|
||||
"xf:switch":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.SwitchGroup } }
|
||||
"*": { "*": { className: alfresco.xforms.SwitchGroup } }
|
||||
},
|
||||
"xf:case":
|
||||
{
|
||||
"*": { "*": { "className": alfresco.xforms.CaseGroup }}
|
||||
"*": { "*": { className: alfresco.xforms.CaseGroup }}
|
||||
},
|
||||
"chiba:data": { "*": { "*": null } },
|
||||
"xf:label": { "*": { "*": null } },
|
||||
|
Reference in New Issue
Block a user