mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
adding support for wcm tinymce extensions to create html from web content wizard
- extracted file picker backing code into its own bean - refactoring for to extract file picker bean - refactoring to manage uploads from file picker outside of xforms context - added some language utility methods to common.js - refactored extension dialogs to deal with quirkyness of tinymce dialog codebase on IE - mostly works now and addressed bug WCM-471 - resourcifying a couple strings i missed in filepickerbean git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5675 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,11 +36,14 @@ alfresco.AjaxHelper = function()
|
||||
{
|
||||
}
|
||||
|
||||
/** All pending ajax requests. */
|
||||
alfresco.AjaxHelper._requests = [];
|
||||
|
||||
/** Creates an ajax request object. */
|
||||
alfresco.AjaxHelper.createRequest = function(target, serverMethod, methodArgs, load, error)
|
||||
{
|
||||
var result = new dojo.io.Request(alfresco.constants.WEBAPP_CONTEXT +
|
||||
"/ajax/invoke/XFormsBean." + serverMethod,
|
||||
"/ajax/invoke/" + serverMethod,
|
||||
"text/xml");
|
||||
result.target = target;
|
||||
result.content = methodArgs;
|
||||
@@ -97,9 +100,6 @@ alfresco.AjaxHelper._getLoaderElement = function()
|
||||
return result;
|
||||
}
|
||||
|
||||
/** All pending ajax requests. */
|
||||
alfresco.AjaxHelper._requests = [];
|
||||
|
||||
/** Updates the loader message or hides it if nothing is being loaded. */
|
||||
alfresco.AjaxHelper._updateLoaderDisplay = function()
|
||||
{
|
||||
|
@@ -283,4 +283,35 @@ function log(message)
|
||||
var logLine = log.window_.document.createElement("div");
|
||||
logLine.appendChild(log.window_.document.createTextNode(message));
|
||||
log.window_.document.body.appendChild(logLine);
|
||||
}
|
||||
}
|
||||
|
||||
if (!String.prototype.startsWith)
|
||||
{
|
||||
String.prototype.startsWith = function(s)
|
||||
{
|
||||
return this.indexOf(s) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Array.prototype.indexOf)
|
||||
{
|
||||
Array.prototype.indexOf = function(o)
|
||||
{
|
||||
for (var i = 0; i < this.length; i++)
|
||||
{
|
||||
if (this[i] == o)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Array.prototype.peek)
|
||||
{
|
||||
Array.prototype.peek = function(o)
|
||||
{
|
||||
return this[this.length - 1];
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,20 @@
|
||||
// This script requires dojo.js, ajax_helper.js and upload_helper.js to be
|
||||
// loaded in advance.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
alfresco = typeof alfresco == "undefined" ? {} : alfresco;
|
||||
if (typeof alfresco == "undefined")
|
||||
{
|
||||
throw new Error("file_picker_widget requires alfresco be defined");
|
||||
}
|
||||
|
||||
if (typeof alfresco.constants == "undefined")
|
||||
{
|
||||
throw new Error("file_picker_widget requires alfresco.constants be defined");
|
||||
}
|
||||
|
||||
if (typeof alfresco.resources == "undefined")
|
||||
{
|
||||
throw new Error("file_picker_widget requires alfresco.resources be defined");
|
||||
}
|
||||
|
||||
/**
|
||||
* The file picker widget.
|
||||
@@ -55,7 +68,7 @@ alfresco.FilePickerWidget._handleUpload = function(id, fileInput, webappRelative
|
||||
id,
|
||||
alfresco.FilePickerWidget._upload_completeHandler,
|
||||
alfresco.constants.WEBAPP_CONTEXT,
|
||||
"/ajax/invoke/XFormsBean.uploadFile",
|
||||
"/ajax/invoke/FilePickerBean.uploadFile",
|
||||
{ currentPath: webappRelativePath });
|
||||
}
|
||||
|
||||
@@ -182,19 +195,22 @@ _showSelectedValue: function()
|
||||
this._selectButton = d.createElement("input");
|
||||
this._selectButton.filePickerWidget = this;
|
||||
this._selectButton.type = "button";
|
||||
this._selectButton.value = this.value == null ? "Select" : "Change";
|
||||
|
||||
this._selectButton.value = (this.value == null
|
||||
? alfresco.resources["select"]
|
||||
: alfresco.resources["change"]);
|
||||
this._selectButton.disabled = this.readonly;
|
||||
this._selectButton.style.margin = "0px 10px 0px 10px";
|
||||
this._selectButton.style.margin = "0px 10px";
|
||||
this.node.appendChild(this._selectButton);
|
||||
|
||||
this.selectedPathInput.style.width = (1 -
|
||||
((this._selectButton.offsetWidth +
|
||||
dojo.html.getMargin(this._selectButton).width) /
|
||||
dojo.html.getContentBox(this.node).width)) * 100 + "%";
|
||||
dojo.event.connect(this._selectButton,
|
||||
"onclick",
|
||||
this,
|
||||
this._selectButton_clickHandler);
|
||||
|
||||
dojo.event.browser.addListener(this._selectButton,
|
||||
"onclick",
|
||||
this._selectButton_clickHandler);
|
||||
},
|
||||
|
||||
_selectButton_clickHandler: function(event)
|
||||
@@ -211,7 +227,7 @@ _selectPathInput_changeHandler: function(event)
|
||||
_navigateToNode: function(path)
|
||||
{
|
||||
var req = alfresco.AjaxHelper.createRequest(this,
|
||||
"getFilePickerData",
|
||||
"FilePickerBean.getFilePickerData",
|
||||
{},
|
||||
function(type, data, evt)
|
||||
{
|
||||
@@ -236,7 +252,6 @@ _showPicker: function(data)
|
||||
parseInt(this.statusDiv.style.marginTop) +
|
||||
parseInt(this.statusDiv.style.marginBottom))
|
||||
: 0) + "px");
|
||||
|
||||
this.resize_callback(this);
|
||||
|
||||
var currentPath = data.getElementsByTagName("current-node")[0];
|
||||
@@ -305,6 +320,7 @@ _showPicker: function(data)
|
||||
var addContentLink = d.createElement("a");
|
||||
headerRightDiv.appendChild(addContentLink);
|
||||
addContentLink.setAttribute("webappRelativePath", currentPath);
|
||||
addContentLink.style.textDecoration = "none";
|
||||
addContentLink.filePickerWidget = this;
|
||||
addContentLink.setAttribute("href", "javascript:void(0)");
|
||||
dojo.event.connect(addContentLink,
|
||||
@@ -335,6 +351,7 @@ _showPicker: function(data)
|
||||
headerRightDiv.appendChild(navigateToParentLink);
|
||||
navigateToParentLink.setAttribute("webappRelativePath", currentPath);
|
||||
navigateToParentLink.filePickerWidget = this;
|
||||
navigateToParentLink.style.textDecoration = "none";
|
||||
navigateToParentLink.setAttribute("href", "javascript:void(0)");
|
||||
if (currentPathName != "/")
|
||||
{
|
||||
@@ -394,7 +411,6 @@ _showPicker: function(data)
|
||||
(this.statusDiv ? this.statusDiv.offsetHeight : 0) -
|
||||
footerDiv.offsetHeight -
|
||||
headerDiv.offsetHeight - 10) + "px";
|
||||
|
||||
var childNodes = data.getElementsByTagName("child-node");
|
||||
for (var i = 0; i < childNodes.length; i++)
|
||||
{
|
||||
@@ -455,6 +471,7 @@ _createRow: function(fileName, webappRelativePath, isDirectory, fileTypeImage,
|
||||
{
|
||||
e = d.createElement("a");
|
||||
e.filePickerWidget = this;
|
||||
e.style.textDecoration = "none";
|
||||
e.setAttribute("href", "javascript:void(0)");
|
||||
e.setAttribute("webappRelativePath", webappRelativePath);
|
||||
dojo.event.connect(e, "onclick", function(event)
|
||||
|
@@ -106,7 +106,7 @@ function alfresco_TinyMCE_execcommand_callback(editor_id, elm, command, user_int
|
||||
|
||||
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) };
|
||||
height: 265 + tinyMCE.getLang('lang_insert_link_delta_height', 0) };
|
||||
var dialog_props = { href: href,
|
||||
target: target,
|
||||
title: title,
|
||||
@@ -201,7 +201,7 @@ function alfresco_TinyMCE_execcommand_callback(editor_id, elm, command, user_int
|
||||
|
||||
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) };
|
||||
height: 265 + (tinyMCE.isMSIE ? 25 : 0) + tinyMCE.getLang('lang_insert_image_delta_height', 0) };
|
||||
var dialog_props = { src: src,
|
||||
alt: alt,
|
||||
border: border,
|
||||
|
@@ -3944,7 +3944,7 @@ dojo.declare("alfresco.xforms.XForm",
|
||||
function()
|
||||
{
|
||||
var req = alfresco.AjaxHelper.createRequest(this,
|
||||
"getXForm",
|
||||
"XFormsBean.getXForm",
|
||||
{},
|
||||
function(type, data, evt, kwArgs)
|
||||
{
|
||||
@@ -4134,7 +4134,7 @@ dojo.declare("alfresco.xforms.XForm",
|
||||
};
|
||||
|
||||
var req = alfresco.AjaxHelper.createRequest(this,
|
||||
"swapRepeatItems",
|
||||
"XFormsBean.swapRepeatItems",
|
||||
params,
|
||||
function(type, data, event)
|
||||
{
|
||||
@@ -4156,7 +4156,7 @@ dojo.declare("alfresco.xforms.XForm",
|
||||
}
|
||||
params.repeatIds = params.repeatIds.join(",");
|
||||
var req = alfresco.AjaxHelper.createRequest(this,
|
||||
"setRepeatIndeces",
|
||||
"XFormsBean.setRepeatIndeces",
|
||||
params,
|
||||
function(type, data, evt)
|
||||
{
|
||||
@@ -4169,7 +4169,7 @@ dojo.declare("alfresco.xforms.XForm",
|
||||
fireAction: function(id)
|
||||
{
|
||||
var req = alfresco.AjaxHelper.createRequest(this,
|
||||
"fireAction",
|
||||
"XFormsBean.fireAction",
|
||||
{ id: id },
|
||||
function(type, data, evt)
|
||||
{
|
||||
@@ -4185,7 +4185,7 @@ dojo.declare("alfresco.xforms.XForm",
|
||||
value = value == null ? "" : value;
|
||||
dojo.debug("setting value " + id + " = " + value);
|
||||
var req = alfresco.AjaxHelper.createRequest(this,
|
||||
"setXFormsValue",
|
||||
"XFormsBean.setXFormsValue",
|
||||
{ id: id, value: value },
|
||||
function(type, data, evt)
|
||||
{
|
||||
@@ -4472,7 +4472,7 @@ function _show_error(msg)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DOM utilities
|
||||
// DOM utilities - XXXarielb should be merged into common.js
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function _findElementById(node, id)
|
||||
@@ -4596,36 +4596,6 @@ if (!XPathResult)
|
||||
FIRST_ORDERED_NODE_TYPE: 9
|
||||
};
|
||||
}
|
||||
if (!String.prototype.startsWith)
|
||||
{
|
||||
String.prototype.startsWith = function(s)
|
||||
{
|
||||
return this.indexOf(s) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Array.prototype.indexOf)
|
||||
{
|
||||
Array.prototype.indexOf = function(o)
|
||||
{
|
||||
for (var i = 0; i < this.length; i++)
|
||||
{
|
||||
if (this[i] == o)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Array.prototype.peek)
|
||||
{
|
||||
Array.prototype.peek = function(o)
|
||||
{
|
||||
return this[this.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
dojo.html.toCamelCase = function(str)
|
||||
{
|
||||
|
Reference in New Issue
Block a user