mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
using tinymce as the wysywg editor.
making next and finish buttons behave the same. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3592 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -212,6 +212,12 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
*/
|
||||
public String getPresentationTemplateType()
|
||||
{
|
||||
if (this.getPresentationTemplateFileName() != null)
|
||||
{
|
||||
// String s = this.getPresentationTemplateFileName();
|
||||
// String extension =
|
||||
this.presentationTemplateType = "XSL";
|
||||
}
|
||||
return this.presentationTemplateType;
|
||||
}
|
||||
|
||||
|
@@ -74,16 +74,25 @@ public class XFormsInputMethod
|
||||
e.appendChild(result.createTextNode("djConfig = { isDebug: false };\n" +
|
||||
"var WEBAPP_CONTEXT = \"" + cp + "\";\n"));
|
||||
div.appendChild(e);
|
||||
|
||||
e = result.createElement("script");
|
||||
e.setAttribute("type", "text/javascript");
|
||||
e.setAttribute("src", cp + "/scripts/tiny_mce/tiny_mce_src.js");
|
||||
e.appendChild(result.createTextNode("\n"));
|
||||
div.appendChild(e);
|
||||
|
||||
e = result.createElement("script");
|
||||
e.setAttribute("type", "text/javascript");
|
||||
e.setAttribute("src", cp + "/scripts/ajax/dojo.js");
|
||||
e.appendChild(result.createTextNode("\n"));
|
||||
div.appendChild(e);
|
||||
|
||||
e = result.createElement("script");
|
||||
e.setAttribute("type", "text/javascript");
|
||||
e.setAttribute("src", cp + "/scripts/ajax/xforms.js");
|
||||
e.appendChild(result.createTextNode("\n"));
|
||||
div.appendChild(e);
|
||||
|
||||
ts.writeXML(result, out);
|
||||
}
|
||||
|
||||
|
@@ -56,26 +56,28 @@ tim.generate(instanceData, tt, out);
|
||||
<script type="text/javascript">
|
||||
dojo.addOnLoad(function()
|
||||
{
|
||||
//alert('foo');
|
||||
var b = document.getElementById("wizard:next-button");
|
||||
var baseOnClick = b.onclick;
|
||||
b.onclick = function()
|
||||
{
|
||||
if (!document.submitTrigger.done)
|
||||
{
|
||||
document.submitTrigger.buttonClick();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return baseOnClick();
|
||||
}
|
||||
}
|
||||
addSubmitHandlerToButton(document.getElementById("wizard:next-button"));
|
||||
addSubmitHandlerToButton(document.getElementById("wizard:finish-button"));
|
||||
});
|
||||
function doSubmit()
|
||||
{
|
||||
var b = document.getElementById("wizard:next-button");
|
||||
b.click();
|
||||
}
|
||||
//
|
||||
//var baseOnClick = b.onclick;
|
||||
//b.onclick = function()
|
||||
//{
|
||||
// if (!document.submitTrigger.done)
|
||||
// {
|
||||
// document.submitTrigger.buttonClick();
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return baseOnClick();
|
||||
// }
|
||||
//}
|
||||
//});
|
||||
//function doSubmit()
|
||||
//{
|
||||
//var b = document.getElementById("wizard:next-button");
|
||||
//b.click();
|
||||
//}
|
||||
|
||||
</script>
|
||||
|
@@ -214,27 +214,8 @@ final InstanceData instanceData = new InstanceData() {
|
||||
<script type="text/javascript">
|
||||
dojo.addOnLoad(function()
|
||||
{
|
||||
//alert('foo');
|
||||
var b = document.getElementById("edit-file:save-button");
|
||||
var baseOnClick = b.onclick;
|
||||
b.onclick = function()
|
||||
{
|
||||
if (!document.submitTrigger.done)
|
||||
{
|
||||
document.submitTrigger.buttonClick();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return baseOnClick();
|
||||
}
|
||||
}
|
||||
addSubmitHandlerToButton(document.getElementById("edit-file:save-button"));
|
||||
});
|
||||
function doSubmit()
|
||||
{
|
||||
var b = document.getElementById("edit-file:save-button");
|
||||
b.click();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
@@ -10,6 +10,21 @@ dojo.require("dojo.html.style");
|
||||
dojo.hostenv.writeIncludes();
|
||||
dojo.addOnLoad(xforms_init);
|
||||
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
mode : "exact",
|
||||
// elements : "editor",
|
||||
save_callback : "saveContent",
|
||||
add_unload_trigger: false,
|
||||
add_form_submit_trigger: false,
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
||||
theme_advanced_buttons2_add : "separator,forecolor,backcolor",
|
||||
theme_advanced_disable: "styleselect",
|
||||
extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style]"
|
||||
});
|
||||
|
||||
//dojo.provide("alfresco.xforms.textarea");
|
||||
//
|
||||
//dojo.declare("alfresco.xforms.Widget",
|
||||
@@ -134,32 +149,34 @@ function load_body(body, ui_element_stack)
|
||||
cell = document.createElement("td");
|
||||
row.appendChild(cell);
|
||||
var nodeRef = document.createElement("div");
|
||||
nodeRef.setAttribute("style", "height: 200px; border: solid 1px black;");
|
||||
nodeRef.setAttribute("style", "height: 200px; width: 100%; border: solid 1px black;");
|
||||
cell.appendChild(nodeRef);
|
||||
var id = o.getAttribute("id");
|
||||
nodeRef.setAttribute("id", id);
|
||||
var initial_value = get_initial_value(o) || "";
|
||||
nodeRef.appendChild(document.createTextNode(initial_value));
|
||||
var w = dojo.widget.createWidget("Editor",
|
||||
{
|
||||
widgetId: id,
|
||||
focusOnLoad: false,
|
||||
items: [ "|", "bold", "italic", "underline", "strikethrough", "|", "colorGroup", "|", "createLink", "insertImage" ]
|
||||
},
|
||||
nodeRef);
|
||||
dojo.event.connect(w,
|
||||
"setRichText",
|
||||
function(event)
|
||||
{
|
||||
dojo.event.connect(w._richText,
|
||||
"onBlur",
|
||||
function()
|
||||
{
|
||||
setXFormsValue(w.widgetId,
|
||||
w._richText.getEditorContent());
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
nodeRef.innerHTML = initial_value;
|
||||
tinyMCE.addMCEControl(nodeRef, id);
|
||||
// var w = dojo.widget.createWidget("Editor",
|
||||
// {
|
||||
// widgetId: id,
|
||||
// focusOnLoad: false,
|
||||
// items: [ "|", "bold", "italic", "underline", "strikethrough", "|", "colorGroup", "|", "createLink", "insertImage" ]
|
||||
// },
|
||||
// nodeRef);
|
||||
// dojo.event.connect(w,
|
||||
// "setRichText",
|
||||
// function(event)
|
||||
// {
|
||||
// dojo.event.connect(w._richText,
|
||||
// "onBlur",
|
||||
// function()
|
||||
// {
|
||||
// setXFormsValue(w.widgetId,
|
||||
// w._richText.getEditorContent());
|
||||
// });
|
||||
//
|
||||
// });
|
||||
//
|
||||
break;
|
||||
case "xforms:input":
|
||||
var id = o.getAttribute("id");
|
||||
@@ -495,7 +512,8 @@ function fireAction(id)
|
||||
load: function(type, data, evt)
|
||||
{
|
||||
document.submitTrigger.done = true;
|
||||
doSubmit();
|
||||
document.submitTrigger.currentButton.click();
|
||||
document.submitTrigger.currentButton = null;
|
||||
},
|
||||
error: function(type, e)
|
||||
{
|
||||
@@ -521,3 +539,32 @@ function setXFormsValue(id, value)
|
||||
};
|
||||
dojo.io.bind(req);
|
||||
}
|
||||
|
||||
function addSubmitHandlerToButton(b)
|
||||
{
|
||||
var baseOnClick = b.onclick;
|
||||
b.onclick = function(event)
|
||||
{
|
||||
// alert("submitting xform from " + b.getAttribute("id") +
|
||||
// " b " + b +
|
||||
// " this " + this );
|
||||
if (!document.submitTrigger.done)
|
||||
{
|
||||
// alert("not done, resubmitting");
|
||||
tinyMCE.triggerSave();
|
||||
document.submitTrigger.currentButton = this;
|
||||
document.submitTrigger.buttonClick();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// alert("done - doing base click");
|
||||
return baseOnClick(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function saveContent(id, content)
|
||||
{
|
||||
setXFormsValue(id, content);
|
||||
}
|
||||
|
Reference in New Issue
Block a user