diff --git a/umbraco/businesslogic/UmbracoSettings.cs b/umbraco/businesslogic/UmbracoSettings.cs
index eeb3b7d026..89c641f177 100644
--- a/umbraco/businesslogic/UmbracoSettings.cs
+++ b/umbraco/businesslogic/UmbracoSettings.cs
@@ -598,6 +598,26 @@ namespace umbraco
}
}
+ ///
+ /// Gets HelpPage configurations.
+ /// A help page configuration specify language, user type, application, application url and
+ /// the target help page url.
+ ///
+ public static XmlNode HelpPages
+ {
+ get
+ {
+ try
+ {
+ return GetKeyAsNode("/settings/help");
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+
///
/// Gets all repositories registered, and returns them as XmlNodes, containing name, alias and webservice url.
/// These repositories are used by the build-in package installer and uninstaller to install new packages and check for updates.
diff --git a/umbraco/presentation/config/umbracoSettings.config b/umbraco/presentation/config/umbracoSettings.config
index d90e7a4c8d..bc06b61673 100644
--- a/umbraco/presentation/config/umbracoSettings.config
+++ b/umbraco/presentation/config/umbracoSettings.config
@@ -25,6 +25,7 @@
1050
+
robot@umbraco.dk
@@ -142,4 +143,11 @@
UsersMembershipProvider
+
+
+
+
+
+
+
diff --git a/umbraco/presentation/umbraco/helpRedirect.aspx.cs b/umbraco/presentation/umbraco/helpRedirect.aspx.cs
index 8546d302ee..a4fb3420b3 100644
--- a/umbraco/presentation/umbraco/helpRedirect.aspx.cs
+++ b/umbraco/presentation/umbraco/helpRedirect.aspx.cs
@@ -4,14 +4,120 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
+using System.Xml;
namespace umbraco.presentation.umbraco
{
+ public class Help
+ {
+ public string DefaultURL { get; set; }
+ public List HelpConfigPages { get; set; }
+
+ public Help(XmlNode helpConfigNode)
+ {
+ DefaultURL = GetXmlAttributeAsString(helpConfigNode.Attributes["defaultUrl"]);
+
+ HelpConfigPages = new List();
+
+ foreach (XmlNode linkNode in helpConfigNode.ChildNodes)
+ {
+ if (linkNode.NodeType != XmlNodeType.Element) continue;
+
+ HelpConfigPages.Add(new HelpConfigPage
+ {
+ Application = GetXmlAttributeAsString(linkNode.Attributes["application"]),
+ ApplicationUrl = GetXmlAttributeAsString(linkNode.Attributes["applicationUrl"]),
+ Language = GetXmlAttributeAsString(linkNode.Attributes["language"]),
+ UserType = GetXmlAttributeAsString(linkNode.Attributes["userType"]),
+ HelpUrl = GetXmlAttributeAsString(linkNode.Attributes["helpUrl"])
+ });
+ }
+ }
+
+ public string ResolveHelpUrl(HelpPage requestedHelpPage)
+ {
+ HelpConfigPage bestMatchingConfigPage = null;
+
+ int currentBestMatchCount = 0;
+
+ foreach (HelpConfigPage helpConfigPage in HelpConfigPages)
+ {
+ int attributeMatchCount = 0;
+
+ if ((helpConfigPage.Application != "" && String.Compare(helpConfigPage.Application, requestedHelpPage.Application, true) != 0) ||
+ (helpConfigPage.ApplicationUrl != "" && String.Compare(helpConfigPage.ApplicationUrl, requestedHelpPage.ApplicationUrl, true) != 0) ||
+ (helpConfigPage.Language != "" && String.Compare(helpConfigPage.Language, requestedHelpPage.Language, true) != 0) ||
+ (helpConfigPage.UserType != "" && String.Compare(helpConfigPage.UserType, requestedHelpPage.UserType, true) != 0))
+ {
+ continue;
+ }
+
+ if (String.Compare(helpConfigPage.Application, requestedHelpPage.Application, true) == 0) attributeMatchCount++;
+ if (String.Compare(helpConfigPage.ApplicationUrl, requestedHelpPage.ApplicationUrl, true) == 0) attributeMatchCount++;
+ if (String.Compare(helpConfigPage.Language, requestedHelpPage.Language, true) == 0) attributeMatchCount++;
+ if (String.Compare(helpConfigPage.UserType, requestedHelpPage.UserType, true) == 0) attributeMatchCount++;
+
+ if (attributeMatchCount > currentBestMatchCount)
+ {
+ currentBestMatchCount = attributeMatchCount;
+ bestMatchingConfigPage = helpConfigPage;
+ }
+ }
+ return bestMatchingConfigPage == null ? GenerateDefaultUrl(requestedHelpPage) : GenerateConfiguredUrl(bestMatchingConfigPage);
+ }
+
+ public string GenerateConfiguredUrl(HelpConfigPage helpConfigPage)
+ {
+ return String.Format(helpConfigPage.HelpUrl,
+ helpConfigPage.Application,
+ helpConfigPage.ApplicationUrl,
+ helpConfigPage.Language,
+ helpConfigPage.UserType).ToLower();
+ }
+
+ public string GenerateDefaultUrl(HelpPage helpPage)
+ {
+ return string.Format(DefaultURL,
+ helpPage.Application,
+ helpPage.ApplicationUrl);
+ }
+
+ private string GetXmlAttributeAsString(XmlAttribute attribute) {
+
+ if (attribute == null) return "";
+
+ return attribute.Value.Trim();
+
+ }
+ }
+
+ public class HelpPage
+ {
+ public string Application { get; set; }
+ public string ApplicationUrl { get; set; }
+ public string Language { get; set; }
+ public string UserType { get; set; }
+ }
+
+ public class HelpConfigPage : HelpPage
+ {
+ public string HelpUrl { get; set; }
+ }
+
public partial class helpRedirect : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
+ Help help = new Help(UmbracoSettings.HelpPages);
+ HelpPage requestedHelpPage = new HelpPage {
+ Application = Request.QueryString["Application"],
+ ApplicationUrl = Request.QueryString["ApplicationUrl"],
+ Language = Request.QueryString["Language"],
+ UserType = Request.QueryString["UserType"]
+ };
+
+ Response.Redirect(help.ResolveHelpUrl(requestedHelpPage));
}
}
}
\ No newline at end of file
diff --git a/umbraco/presentation/umbraco_client/Application/UmbracoApplicationActions.js b/umbraco/presentation/umbraco_client/Application/UmbracoApplicationActions.js
index b8293c2c52..c086aa77b3 100644
--- a/umbraco/presentation/umbraco_client/Application/UmbracoApplicationActions.js
+++ b/umbraco/presentation/umbraco_client/Application/UmbracoApplicationActions.js
@@ -6,7 +6,7 @@
Umbraco.Sys.registerNamespace("Umbraco.Application");
-Umbraco.Application.Actions = function() {
+Umbraco.Application.Actions = function () {
///
/// 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) {
/// Adds an event listener to the event name event
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) {
/// Removes an event listener to the event name event
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) {
/// Launches the contextual help window
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 () {
/// Launches the about Umbraco window
UmbClientMgr.openModalWindow("dialogs/about.aspx", UmbClientMgr.uiKeys()['general_about'], true, 450, 390);
return false;
},
- launchCreateWizard: function() {
+ launchCreateWizard: function () {
/// Launches the create content wizard
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 () {
/// Logs the user out
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) {
/// Changes the application
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) {
/// Opens the dialog window
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 () {
///
UmbClientMgr.mainTree().toggleEditMode(true);
},
- actionSort: function() {
+ actionSort: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -159,7 +159,7 @@ Umbraco.Application.Actions = function() {
},
- actionRights: function() {
+ actionRights: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -167,7 +167,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionProtect: function() {
+ actionProtect: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -175,20 +175,20 @@ Umbraco.Application.Actions = function() {
}
},
- actionRollback: function() {
+ actionRollback: function () {
///
UmbClientMgr.openModalWindow('dialogs/rollback.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rollback'], true, 600, 550);
},
- actionRefresh: function() {
+ actionRefresh: function () {
///
//raise nodeRefresh event
jQuery(window.top).trigger("nodeRefresh", []);
},
- actionNotify: function() {
+ actionNotify: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -196,11 +196,11 @@ Umbraco.Application.Actions = function() {
}
},
- actionUpdate: function() {
+ actionUpdate: function () {
///
},
- actionPublish: function() {
+ actionPublish: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '' != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -208,7 +208,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionToPublish: function() {
+ actionToPublish: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -218,20 +218,20 @@ Umbraco.Application.Actions = function() {
}
},
- actionQuit: function() {
+ actionQuit: function () {
///
if (confirm(uiKeys['defaultdialogs_confirmlogout'] + '\n\n'))
document.location.href = 'logout.aspx';
},
- actionRePublish: function() {
+ actionRePublish: function () {
///
UmbClientMgr.openModalWindow('dialogs/republish.aspx?rnd=' + this._utils.generateRandom(), 'Republishing entire site', true, 450, 210);
},
- actionAssignDomain: function() {
+ actionAssignDomain: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -239,13 +239,13 @@ Umbraco.Application.Actions = function() {
}
},
- actionLiveEdit: function() {
+ actionLiveEdit: function () {
///
window.open("canvas.aspx?redir=/" + UmbClientMgr.mainTree().getActionNode().nodeId + ".aspx", "liveediting");
},
- actionNew: function() {
+ actionNew: function () {
/// Show the create new modal overlay
var actionNode = UmbClientMgr.mainTree().getActionNode();
if (actionNode.nodeType != '') {
@@ -264,7 +264,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionNewFolder: function() {
+ actionNewFolder: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -272,7 +272,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionSendToTranslate: function() {
+ actionSendToTranslate: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -280,7 +280,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionEmptyTranscan: function() {
+ actionEmptyTranscan: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -288,7 +288,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionImport: function() {
+ actionImport: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -296,7 +296,7 @@ Umbraco.Application.Actions = function() {
}
},
- actionExport: function() {
+ actionExport: function () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -304,17 +304,17 @@ Umbraco.Application.Actions = function() {
}
},
- actionAudit: function() {
+ actionAudit: function () {
///
UmbClientMgr.openModalWindow('dialogs/viewAuditTrail.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_auditTrail'], true, 550, 500);
},
- actionPackage: function() {
+ actionPackage: function () {
///
},
- actionDelete: function() {
+ actionDelete: function () {
///
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 () {
///
/// Used for users when disable is selected.
///
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 () {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -374,19 +374,19 @@ Umbraco.Application.Actions = function() {
}
},
- actionCopy: function() {
+ actionCopy: function () {
///
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 () {
///
UmbClientMgr.openModalWindow("dialogs/exportCode.aspx", UmbClientMgr.uiKeys()['exportDocumentTypeAsCode'], true, 400, 350);
return false;