Implementation of 27753.

[TFS Changeset #70229]
This commit is contained in:
kenny
2010-06-20 13:43:53 +00:00
parent 8749ceabf0
commit 35158abb32
4 changed files with 182 additions and 48 deletions

View File

@@ -6,7 +6,7 @@
Umbraco.Sys.registerNamespace("Umbraco.Application");
Umbraco.Application.Actions = function() {
Umbraco.Application.Actions = function () {
/// <summary>
/// Application actions actions for the context menu, help dialogs, logout, etc...
/// This class supports an event listener model. Currently the available events are:
@@ -22,24 +22,24 @@ Umbraco.Application.Actions = function() {
_windowTitle: " - Umbraco CMS - ",
_currApp: "",
addEventHandler: function(fnName, fn) {
addEventHandler: function (fnName, fn) {
/// <summary>Adds an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
},
removeEventHandler: function(fnName, fn) {
removeEventHandler: function (fnName, fn) {
/// <summary>Removes an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
},
showSpeachBubble: function(ico, hdr, msg) {
showSpeachBubble: function (ico, hdr, msg) {
if (typeof (UmbClientMgr.mainWindow().UmbSpeechBubble) != "undefined") {
UmbClientMgr.mainWindow().UmbSpeechBubble.ShowMessage(ico, hdr, msg);
}
else alert(msg);
},
launchHelp: function(lang, userType) {
launchHelp: function (lang, userType) {
/// <summary>Launches the contextual help window</summary>
var rightUrl = UmbClientMgr.contentFrame().document.location.href.split("\/");
if (rightUrl.length > 0) {
@@ -48,18 +48,18 @@ Umbraco.Application.Actions = function() {
if (rightUrl.indexOf("?") > 0) {
rightUrl = rightUrl.substring(0, rightUrl.indexOf("?"));
}
var url = "http://umbraco.org/redir/help/" + lang + "/" + userType + "/" + this._currApp + "/" + rightUrl;
window.open(url, 'help', 'width=750,height=500,scrollbars=auto,resizable=1;');
var url = "/umbraco/helpRedirect.aspx?Application=" + this._currApp + '&ApplicationURL=' + rightUrl + '&Language=' + lang + "&UserType=" + userType;
window.open(url);
return false;
},
launchAbout: function() {
launchAbout: function () {
/// <summary>Launches the about Umbraco window</summary>
UmbClientMgr.openModalWindow("dialogs/about.aspx", UmbClientMgr.uiKeys()['general_about'], true, 450, 390);
return false;
},
launchCreateWizard: function() {
launchCreateWizard: function () {
/// <summary>Launches the create content wizard</summary>
if (this._currApp == 'media' || this._currApp == 'content' || this._currApp == '') {
@@ -74,7 +74,7 @@ Umbraco.Application.Actions = function() {
alert('Not supported - please create by right clicking the parentnode and choose new...');
},
logout: function() {
logout: function () {
/// <summary>Logs the user out</summary>
if (confirm(UmbClientMgr.uiKeys()["defaultdialogs_confirmlogout"])) {
//raise beforeLogout event
@@ -85,7 +85,7 @@ Umbraco.Application.Actions = function() {
return false;
},
shiftApp: function(whichApp, appName) {
shiftApp: function (whichApp, appName) {
/// <summary>Changes the application</summary>
this._debug("shiftApp: " + whichApp + ", " + appName);
@@ -112,7 +112,7 @@ Umbraco.Application.Actions = function() {
}
}
UmbClientMgr.mainTree().rebuildTree(whichApp, function(args) {
UmbClientMgr.mainTree().rebuildTree(whichApp, function (args) {
//the callback will fire when the tree rebuilding is done, we
//need to check the args to see if the tree was rebuild from cache
//and if it had a previously selected node, if it didn't then load the dashboard.
@@ -126,13 +126,13 @@ Umbraco.Application.Actions = function() {
UmbClientMgr.mainWindow().document.title = appName + this._windowTitle + window.location.hostname.toLowerCase().replace('www', '');
},
getCurrApp: function() {
getCurrApp: function () {
return this._currApp;
},
//TODO: Move this into a window manager class
openDialog: function(diaTitle, diaDoc, dwidth, dheight, optionalParams) {
openDialog: function (diaTitle, diaDoc, dwidth, dheight, optionalParams) {
/// <summary>Opens the dialog window</summary>
if (this._dialogWindow != null && !this._dialogWindow.closed) {
@@ -141,16 +141,16 @@ Umbraco.Application.Actions = function() {
this._dialogWindow = UmbClientMgr.mainWindow().open(diaDoc, 'dialogpage', "width=" + dwidth + "px,height=" + dheight + "px" + optionalParams);
},
openDashboard: function(whichApp) {
openDashboard: function (whichApp) {
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
},
actionTreeEditMode: function() {
actionTreeEditMode: function () {
/// <summary></summary>
UmbClientMgr.mainTree().toggleEditMode(true);
},
actionSort: function() {
actionSort: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -159,7 +159,7 @@ Umbraco.Application.Actions = function() {
},
actionRights: function() {
actionRights: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -167,7 +167,7 @@ Umbraco.Application.Actions = function() {
}
},
actionProtect: function() {
actionProtect: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -175,20 +175,20 @@ Umbraco.Application.Actions = function() {
}
},
actionRollback: function() {
actionRollback: function () {
/// <summary></summary>
UmbClientMgr.openModalWindow('dialogs/rollback.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rollback'], true, 600, 550);
},
actionRefresh: function() {
actionRefresh: function () {
/// <summary></summary>
//raise nodeRefresh event
jQuery(window.top).trigger("nodeRefresh", []);
},
actionNotify: function() {
actionNotify: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -196,11 +196,11 @@ Umbraco.Application.Actions = function() {
}
},
actionUpdate: function() {
actionUpdate: function () {
/// <summary></summary>
},
actionPublish: function() {
actionPublish: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '' != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -208,7 +208,7 @@ Umbraco.Application.Actions = function() {
}
},
actionToPublish: function() {
actionToPublish: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -218,20 +218,20 @@ Umbraco.Application.Actions = function() {
}
},
actionQuit: function() {
actionQuit: function () {
/// <summary></summary>
if (confirm(uiKeys['defaultdialogs_confirmlogout'] + '\n\n'))
document.location.href = 'logout.aspx';
},
actionRePublish: function() {
actionRePublish: function () {
/// <summary></summary>
UmbClientMgr.openModalWindow('dialogs/republish.aspx?rnd=' + this._utils.generateRandom(), 'Republishing entire site', true, 450, 210);
},
actionAssignDomain: function() {
actionAssignDomain: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -239,13 +239,13 @@ Umbraco.Application.Actions = function() {
}
},
actionLiveEdit: function() {
actionLiveEdit: function () {
/// <summary></summary>
window.open("canvas.aspx?redir=/" + UmbClientMgr.mainTree().getActionNode().nodeId + ".aspx", "liveediting");
},
actionNew: function() {
actionNew: function () {
/// <summary>Show the create new modal overlay</summary>
var actionNode = UmbClientMgr.mainTree().getActionNode();
if (actionNode.nodeType != '') {
@@ -264,7 +264,7 @@ Umbraco.Application.Actions = function() {
}
},
actionNewFolder: function() {
actionNewFolder: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -272,7 +272,7 @@ Umbraco.Application.Actions = function() {
}
},
actionSendToTranslate: function() {
actionSendToTranslate: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -280,7 +280,7 @@ Umbraco.Application.Actions = function() {
}
},
actionEmptyTranscan: function() {
actionEmptyTranscan: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -288,7 +288,7 @@ Umbraco.Application.Actions = function() {
}
},
actionImport: function() {
actionImport: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -296,7 +296,7 @@ Umbraco.Application.Actions = function() {
}
},
actionExport: function() {
actionExport: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -304,17 +304,17 @@ Umbraco.Application.Actions = function() {
}
},
actionAudit: function() {
actionAudit: function () {
/// <summary></summary>
UmbClientMgr.openModalWindow('dialogs/viewAuditTrail.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_auditTrail'], true, 550, 500);
},
actionPackage: function() {
actionPackage: function () {
/// <summary></summary>
},
actionDelete: function() {
actionDelete: function () {
/// <summary></summary>
var actionNode = UmbClientMgr.mainTree().getActionNode();
@@ -334,7 +334,7 @@ Umbraco.Application.Actions = function() {
umbraco.presentation.webservices.legacyAjaxCalls.DeleteContentPermanently(
UmbClientMgr.mainTree().getActionNode().nodeId,
UmbClientMgr.mainTree().getActionNode().nodeType,
function() {
function () {
_this._debug("actionDelete: Raising event");
//raise nodeDeleted event
jQuery(window.top).trigger("nodeDeleted", []);
@@ -343,30 +343,30 @@ Umbraco.Application.Actions = function() {
else {
umbraco.presentation.webservices.legacyAjaxCalls.Delete(
UmbClientMgr.mainTree().getActionNode().nodeId, "",
UmbClientMgr.mainTree().getActionNode().nodeType,
function() {
UmbClientMgr.mainTree().getActionNode().nodeType,
function () {
_this._debug("actionDelete: Raising event");
//raise nodeDeleted event
jQuery(window.top).trigger("nodeDeleted", []);
});
});
}
}
},
actionDisable: function() {
actionDisable: function () {
/// <summary>
/// Used for users when disable is selected.
/// </summary>
if (confirm(uiKeys['defaultdialogs_confirmdisable'] + ' "' + UmbClientMgr.mainTree().getActionNode().nodeName + '"?\n\n')) {
umbraco.presentation.webservices.legacyAjaxCalls.DisableUser(UmbClientMgr.mainTree().getActionNode().nodeId, function() {
umbraco.presentation.webservices.legacyAjaxCalls.DisableUser(UmbClientMgr.mainTree().getActionNode().nodeId, function () {
UmbClientMgr.mainTree().reloadActionNode();
});
}
},
actionMove: function() {
actionMove: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -374,19 +374,19 @@ Umbraco.Application.Actions = function() {
}
},
actionCopy: function() {
actionCopy: function () {
/// <summary></summary>
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
UmbClientMgr.openModalWindow("dialogs/moveOrCopy.aspx?app=" + this._currApp + "&mode=copy&id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_copy'], true, 500, 470);
}
},
_debug: function(strMsg) {
_debug: function (strMsg) {
if (this._isDebug) {
Sys.Debug.trace("AppActions: " + strMsg);
}
},
actionExportCode: function() {
actionExportCode: function () {
/// <summary></summary>
UmbClientMgr.openModalWindow("dialogs/exportCode.aspx", UmbClientMgr.uiKeys()['exportDocumentTypeAsCode'], true, 400, 350);
return false;