Clears client tree cache on double click of app icon.

[TFS Changeset #70072]
This commit is contained in:
Shandem
2010-06-19 23:24:51 +00:00
parent 91617d8dee
commit 738da5b4e7
3 changed files with 78 additions and 29 deletions

View File

@@ -41,7 +41,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{05329D
config templates\config\metablogConfig.config = config templates\config\metablogConfig.config
config templates\config\restExtensions.config = config templates\config\restExtensions.config
config templates\config\scripting.config = config templates\config\scripting.config
config templates\config\tinyMceConfig.config = config templates\config\tinyMceConfig.config
config templates\config\umbracoSettings.config = config templates\config\umbracoSettings.config
config templates\config\UrlRewriting.config = config templates\config\UrlRewriting.config
config templates\config\xsltExtensions.config = config templates\config\xsltExtensions.config

View File

@@ -113,18 +113,18 @@
var rightAction = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["rightAction"]%>';
var rightActionId = '{<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["id"]%>}';
jQuery(document).ready(function() {
jQuery(document).ready(function () {
UmbClientMgr.setUmbracoPath("<%=umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>");
//call wresize first for IE/FF resize issues
jQuery(window).wresize(function() { resizePage(); });
jQuery(window).wresize(function () { resizePage(); });
resizePage();
jQuery("#umbracoMainPageBody").css("background", "#fff");
//wire up the history mgr
UmbClientMgr.historyManager().addEventHandler("navigating", function(e, app) {
UmbClientMgr.historyManager().addEventHandler("navigating", function (e, app) {
//show modal wait dialog. TODO: Finish this
//jQuery("<div id='appLoading'>&nbsp;</div>").appendTo("body")
// .ModalWindowShow("", false, 300, 100, 300, 0)
@@ -143,8 +143,42 @@
"content", true);
}
jQuery("#right").show();
});
// Handles single vs double click on application item icon buttons...
function appItemSingleClick(itemName) {
UmbClientMgr.historyManager().addHistory(itemName);
return false;
}
function appItemDoubleClick(itemName) {
//When double clicking, we'll clear the tree cache so that it loads the dashboard
UmbClientMgr.mainTree().clearTreeCache();
UmbClientMgr.historyManager().addHistory(itemName);
return false;
}
function appClick(appItem) {
var that = this;
setTimeout(function () {
var dblclick = parseInt($(that).data('double'), 10);
if (dblclick > 0) {
$(that).data('double', dblclick - 1);
} else {
appItemSingleClick.call(that, appItem);
}
}, 300);
return false;
}
function appDblClick(appItem) {
$(this).data('double', 2);
appItemDoubleClick.call(this, appItem);
return false;
}
</script>
</body>

View File

@@ -15,6 +15,7 @@ using umbraco.BusinessLogic.Actions;
using ClientDependency.Core;
using umbraco.IO;
using System.Linq;
using System.Text;
namespace umbraco.cms.presentation
{
@@ -25,28 +26,42 @@ namespace umbraco.cms.presentation
{
protected umbWindow UmbWindow1;
protected System.Web.UI.WebControls.PlaceHolder bubbleText;
protected void Page_Load(object sender, System.EventArgs e)
{
protected void Page_Load(object sender, System.EventArgs e)
{
var apps = this.getUser().Applications.ToList();
bool userHasAccesstodefaultApp = apps.Where(x => x.alias == "content").Count() > 0;
// Load user module icons ..
if (apps.Count() > 1) {
if (apps.Count() > 1)
{
var JSEvents = new StringBuilder();
PlaceHolderAppIcons.Text = ui.Text("main", "sections", base.getUser());
plcIcons.Text = "";
foreach (BusinessLogic.Application a in apps) {
string iconElement = String.Format("<li><a class=\"{0}\" title=\"" + ui.Text("sections", a.alias, base.getUser()) + "\" href=\"umbraco.aspx#" + a.alias + "\" onclick=\"" + ClientTools.Scripts.ShiftApp(a.alias) + "; return false;\">", a.icon.Substring(1, a.icon.Length - 1));
foreach (BusinessLogic.Application a in apps)
{
string aiconSubstring = a.icon.Substring(1, a.icon.Length - 1);
JSEvents.Append(@"jQuery('." + aiconSubstring + "').click(function() { appClick.call(this, '" + a.alias + "'); } );");
JSEvents.Append(@"jQuery('." + aiconSubstring + "').dblclick(function() { appDblClick.call(this, '" + a.alias + "'); } );");
string iconElement = String.Format("<li><a class=\"{0}\" title=\"" + ui.Text("sections", a.alias, base.getUser()) + "\" href=\"javascript:void(0);\">", aiconSubstring);
if (a.icon.StartsWith("."))
iconElement +=
iconElement +=
"<img src=\"images/nada.gif\" class=\"trayHolder\" alt=\"\" /></a></li>";
else
iconElement += "<img src=\"images/tray/" + a.icon + "\" class=\"trayIcon\" alt=\"" + ui.Text("sections", a.alias, base.getUser()) + "\"></a></li>";
plcIcons.Text += iconElement;
}
} else
Page.ClientScript.RegisterStartupScript(this.GetType(), "AppIcons", "jQuery(document).ready(function() { " + JSEvents.ToString() + " } );", true);
}
else
PlaceHolderAppIcons.Visible = false;
@@ -58,26 +73,27 @@ namespace umbraco.cms.presentation
}
// Load globalized labels
treeWindow.Text = ui.Text("main", "tree", base.getUser());
// Load globalized labels
treeWindow.Text = ui.Text("main", "tree", base.getUser());
RenderActionJS();
// Load default right action
// string rightAction = String.Format(@"
// var initApp = '{0}';
// var rightAction = '{1}';
// var rightActionId = '{2}';", umbraco.presentation.UmbracoContext.Current.Request["app"], helper.Request("rightAction"), helper.Request("id"));
// ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "rightAction", rightAction, true);
// Version check goes here!
// Load default right action
// string rightAction = String.Format(@"
// var initApp = '{0}';
// var rightAction = '{1}';
// var rightActionId = '{2}';", umbraco.presentation.UmbracoContext.Current.Request["app"], helper.Request("rightAction"), helper.Request("id"));
// ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "rightAction", rightAction, true);
// Version check goes here!
string updateCheckCookie = "";
if (Request.Cookies["updateCheck"] != null)
{
updateCheckCookie = Request.Cookies["updateCheck"].Value.ToString();
}
if (GlobalSettings.VersionCheckPeriod > 0 && String.IsNullOrEmpty(updateCheckCookie) && base.getUser().UserType.Alias == "admin") {
if (GlobalSettings.VersionCheckPeriod > 0 && String.IsNullOrEmpty(updateCheckCookie) && base.getUser().UserType.Alias == "admin")
{
// Add scriptmanager version check
ScriptManager sm = ScriptManager.GetCurrent(Page);
@@ -86,11 +102,11 @@ namespace umbraco.cms.presentation
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "upgradeChecker", "jQuery(document).ready(function() {umbraco.presentation.webservices.CheckForUpgrade.CallUpgradeService(umbracoCheckUpgrade);});", true);
Response.Cookies["updateCheck"].Value = "1";
Response.Cookies["updateCheck"].Value = "1";
Response.Cookies["updateCheck"].Expires = DateTime.Now.AddDays(GlobalSettings.VersionCheckPeriod);
}
DataBind();
}
}
DataBind();
}
/// <summary>
/// Renders out all JavaScript references that have bee declared in IActions