mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.0 to HEAD
5456: (From WCM_DEPLOY) There were many pure conflicts on license headers, one conflict due to CR-LF and some other smaller issues to resolve: ----------------------------------------- Resolved (line endings not cr-lf): root\projects\repository\config\alfresco\public-services-context.xml Reverted: root\projects\web-client\source\web\images\icons\ajax_anim.gif Reverted or Resolved (License text conflicts): svn revert root\projects\jndi-client\source\java\org\alfresco\jndi\JndiTest.java svn resolved root\projects\jndi-client\source\java\org\alfresco\jndi\AVMFileDirContext.java svn revert root\projects\jndi-client\source\java\org\alfresco\jndi\AVMBulkLoader.java svn revert root\projects\jndi-client\source\java\org\alfresco\filter\CacheControlFilter.java svn revert root\projects\jndi-client\source\java\org\alfresco\filter\CacheControlFilterInfoBean.java svn revert -R root\projects\catalina-virtual\source\java\org\alfresco\mbeans svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\context\AVMStandardContext.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\loader\AVMWebappClassLoader.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\loader\AVMWebappLoader.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMResourceBinding.java svn resolved root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMHostConfig.java - why the change in method naming convention? svn resolved root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMHost.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\DefaultAVMResourceBinding.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\valve\AVMUrlValveTest.java svn resolved root\projects\catalina-virtual\source\java\org\alfresco\catalina\valve\AVMUrlValve.java svn revert root\projects\catalina-virtual\source\java\org\alfresco\catalina\host\AVMHostMatch.java Modified: root\projects\web-client\source\java\org\alfresco\web\ui\wcm\component\UIDeployWebsite.java (Kevin to check line 330) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5484 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
150
source/web/scripts/ajax/ajax_helper.js
Normal file
150
source/web/scripts/ajax/ajax_helper.js
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Ajax helper library
|
||||
//
|
||||
// This script manages ajax requests and provides a wrapper around the dojo
|
||||
// library.
|
||||
//
|
||||
// This script requires dojo.js to be loaded in advance.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AJAX helper
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
alfresco = typeof alfresco == "undefined" ? {} : alfresco;
|
||||
alfresco.constants = typeof alfresco.constants == "undefined" ? {} : alfresco.constants;
|
||||
alfresco.constants.AJAX_LOADER_DIV_ID = "alfresco-ajax-loader";
|
||||
|
||||
alfresco.AjaxHelper = function()
|
||||
{
|
||||
}
|
||||
|
||||
/** 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,
|
||||
"text/xml");
|
||||
result.target = target;
|
||||
result.content = methodArgs;
|
||||
result.method = "POST";
|
||||
result.load = load;
|
||||
dojo.event.connect(result, "load", function(type, data, evt)
|
||||
{
|
||||
alfresco.AjaxHelper._loadHandler(result);
|
||||
});
|
||||
result.error = error || function(type, e, impl)
|
||||
{
|
||||
dojo.debug("error [" + type + "] " + e.message);
|
||||
if (impl.status == 401)
|
||||
{
|
||||
document.getElementById("logout").onclick();
|
||||
}
|
||||
else
|
||||
{
|
||||
_show_error(document.createTextNode(e.message));
|
||||
alfresco.AjaxHelper._loadHandler(this);
|
||||
}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Sends an ajax request object. */
|
||||
alfresco.AjaxHelper.sendRequest = function(req)
|
||||
{
|
||||
alfresco.AjaxHelper._sendHandler(req);
|
||||
req.encoding = "utf-8";
|
||||
dojo.io.queueBind(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ajax loader div element. If it hasn't yet been created, it is created.
|
||||
*/
|
||||
alfresco.AjaxHelper._getLoaderElement = function()
|
||||
{
|
||||
var result = document.getElementById(alfresco.constants.AJAX_LOADER_DIV_ID);
|
||||
if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
result = document.createElement("div");
|
||||
result.setAttribute("id", alfresco.constants.AJAX_LOADER_DIV_ID);
|
||||
dojo.html.setClass(result, "xformsAjaxLoader");
|
||||
dojo.html.hide(result);
|
||||
document.body.appendChild(result);
|
||||
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()
|
||||
{
|
||||
var ajaxLoader = alfresco.AjaxHelper._getLoaderElement();
|
||||
ajaxLoader.innerHTML = (alfresco.AjaxHelper._requests.length == 0
|
||||
? alfresco.xforms.constants.resources["idle"]
|
||||
: (alfresco.xforms.constants.resources["loading"] +
|
||||
(alfresco.AjaxHelper._requests.length > 1
|
||||
? " (" + alfresco.AjaxHelper._requests.length + ")"
|
||||
: "...")));
|
||||
if (djConfig.isDebug)
|
||||
{
|
||||
dojo.debug(ajaxLoader.innerHTML);
|
||||
}
|
||||
if (/* djConfig.isDebug && */ alfresco.AjaxHelper._requests.length != 0)
|
||||
{
|
||||
dojo.html.show(ajaxLoader);
|
||||
}
|
||||
else
|
||||
{
|
||||
dojo.html.hide(ajaxLoader);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ajax event handlers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
alfresco.AjaxHelper._sendHandler = function(req)
|
||||
{
|
||||
alfresco.AjaxHelper._requests.push(req);
|
||||
alfresco.AjaxHelper._updateLoaderDisplay();
|
||||
}
|
||||
|
||||
alfresco.AjaxHelper._loadHandler = function(req)
|
||||
{
|
||||
var index = alfresco.AjaxHelper._requests.indexOf(req);
|
||||
if (index != -1)
|
||||
{
|
||||
alfresco.AjaxHelper._requests.splice(index, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
var urls = [];
|
||||
for (var i = 0; i < alfresco.AjaxHelper._requests.length; i++)
|
||||
{
|
||||
urls.push(alfresco.AjaxHelper._requests[i].url);
|
||||
}
|
||||
throw new Error("unable to find " + req.url +
|
||||
" in [" + urls.join(", ") + "]");
|
||||
}
|
||||
alfresco.AjaxHelper._updateLoaderDisplay();
|
||||
}
|
Reference in New Issue
Block a user