protected override void OnInit(EventArgs e) { string tmp = string.Empty, siteUrl = SPContext.Current.Web.Url.TrimEnd('/'), html, tmpCssClass = "c" + ProductPage.GuidLower(Guid.NewGuid(), false); bool hasL = ProductPage.LicEdition(ProductPage.GetContext(), (ProductPage.LicInfo)null, 0), is14Popup = "1".Equals(Context.Request.QueryString ["roxDlg"]); Random rnd = new Random(); if (!(ProductPage.Config <bool> (null, "_nojquery") || Page.Items.Contains("jquery"))) { Page.Items ["jquery"] = new object(); Page.ClientScript.RegisterClientScriptInclude("jquery", siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/jQuery.js?v=" + ProductPage.Version); } Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName, siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".js?r=" + "&v=" + ProductPage.Version); base.OnInit(e); if (!string.IsNullOrEmpty(Context.Request.QueryString ["roxPrintZen"])) { html = "<div class=\"rox-prz-toolbar\"><button type=\"button\" onclick=\"roxDoPrint();\">" + (is14Popup ? " " : string.Empty) + ProductPage.GetProductResource("ToolBar_PrintNow" + (is14Popup ? "Ctx" : string.Empty)) + "</button> <span>" + ProductPage.GetProductResource("ToolBar_PrintPreview" + (is14Popup ? "Ctx" : string.Empty)); if (is14Popup) { html += (" | Zoom: <select id=\"roxpzzoomer\" onchange=\"roxPrintZoom(this.options[this.selectedIndex].value);\"><option value=\"100\">100%</option><option value=\"120\">120%</option><option value=\"150\">150%</option><option value=\"200\">200% " + ProductPage.GetResource("Recommended") + "</option></select>"); } html += "</span></div>"; if (!ProductPage.LicEdition(ProductPage.GetContext(), (ProductPage.LicInfo)null, 2)) { html += ("<div class=\"" + tmpCssClass + "\">Powered by <b>SharePoint-Tools.net/PrintZen</b></div><style type=\"text/css\"> ." + tmpCssClass + " { text-align: center; font-size: " + rnd.Next(24, 37) + "px; padding-bottom: 12px; display: none; } @media print { div." + tmpCssClass + " { display: block !important; } } </style>"); } tmp += "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".css?r=" + "&v=" + ProductPage.Version + "\"/>"; tmp += "<style type=\"text/css\"> div.rox-prz-toolbar button { padding-left: 18px; padding-right: 18px; } </style>"; tmp += "<script> roxPrintPage = '" + SPEncode.ScriptEncode(html) + "'; roxDlgOnLoad = " + "1".Equals(Context.Request.QueryString ["roxDlgShow"]).ToString().ToLowerInvariant() + "; " + (hasL ? string.Empty : "setInterval(function() { jQuery('div.ms-bodyareacell').hide(); }, 250);") + " </script>"; Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName + "2", siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/mash.tl.aspx?op=r&r=" + rnd.Next(100, 1000) + "&o=" + Context.Server.UrlEncode(tmp)); } }
internal void AddMenuItem(IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { MenuItemTemplate child = new MenuItemTemplate(caption, img) { ID = id, Description = desc, PermissionContext = this.PermContext, Permissions = this.Perms }; if (string.IsNullOrEmpty(clickScript)) { child.ClientOnClickNavigateUrl = SPEncode.ScriptEncode(clickUrl); } else { child.ClientOnClickScript = clickScript; } this.Controls.Add(child); if (ProductPage.Is14) { this.ribbons.Add(new RibbonItem(child, inst, this.ClientID + id, caption, img, desc, clickUrl, clickScript, cmdNo)); this.WebPartIDs.ToString(); } }
// Thank you to the following blog for the code to enable AJAX use of the TaxonomyWebTaggingControl // http://pholpar.wordpress.com/2010/03/03/ajax-enabling-the-taxonomywebtaggingcontrol/ private string GetReloadJavaScript(TaxonomyWebTaggingControl taxonomyControl) { String script = String.Empty; String containerId = SPEncode.ScriptEncode(taxonomyControl.Controls[1].ClientID); Type type_TaxonomyWebTaggingControl = typeof(TaxonomyWebTaggingControl); MethodInfo mi_getOnloadJavascript = type_TaxonomyWebTaggingControl.GetMethod("getOnloadJavascript", BindingFlags.NonPublic | BindingFlags.Instance); String fullScript = (String)mi_getOnloadJavascript.Invoke(taxonomyControl, null); int pos = fullScript.IndexOf(String.Format("function {0}_load()", containerId)); if (pos > -1) { string endRequestFunctionName = string.Format("{0}_EndRequest", containerId); StringBuilder builder = new StringBuilder(); builder.Append("var myPrm = Sys.WebForms.PageRequestManager.getInstance();"); builder.Append("myPrm.add_endRequest(").Append(endRequestFunctionName).Append(");"); builder.Append("function ").Append(endRequestFunctionName).Append("(sender, args)"); builder.Append("{"); // we get te first part of the script needed to initialization // we start from pos 1, because we don't need the leading '{' builder.Append(fullScript.Substring(1, pos - 1)); builder.Append("Microsoft.SharePoint.Taxonomy.ScriptForWebTaggingUI.onLoad('"); builder.Append(containerId); builder.Append("');"); builder.Append("}}"); script = builder.ToString(); } return(script); }
protected override void ValidateInstance(IDictionary inst, ref string clickScript) { string str; bool flag = false; string str2 = ","; if (inst["unix"] != null) { try { flag = (bool)inst["unix"]; } catch { flag = false; } } if (flag && !ZenMenuItem.IsLic(2)) { flag = false; clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + base.SchemaName + "_unix", new object[0]), "Basic" })) + "');"; } if (!string.IsNullOrEmpty(str = inst["sep"] + string.Empty)) { if (str == "s") { str2 = ";"; } else if (str == "t") { str2 = "\t"; } } else if (inst["excel"] != null) { try { if ((bool)inst["excel"]) { str2 = ";"; } } catch { } } if ((str2 != ",") && !ZenMenuItem.IsLic(2)) { str2 = ","; clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + base.SchemaName + "_sep", new object[0]), "Basic" })) + "');"; } this.seps[inst["id"]] = str2; this.unixes[inst["id"]] = flag; }
protected override void ValidateInstance(IDictionary inst, ref string clickScript) { bool unix = false; string acsep, sep = ","; if (inst ["unix"] != null) { try { unix = (bool)inst ["unix"]; } catch { unix = false; } } if (unix && !IsLic(2)) { unix = false; clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + SchemaName + "_unix"), "Basic")) + "\');"; } if (!string.IsNullOrEmpty(acsep = inst ["sep"] + string.Empty)) { if (acsep == "s") { sep = ";"; } else if (acsep == "t") { sep = "\t"; } } else if (inst ["excel"] != null) { try { if ((bool)inst ["excel"]) { sep = ";"; } } catch { } } if ((sep != ",") && !IsLic(2)) { sep = ","; clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + SchemaName + "_sep"), "Basic")) + "\');"; } seps [inst ["id"]] = sep; unixes [inst ["id"]] = unix; }
internal void AddMenuItem(IDictionary inst, string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { MenuItemTemplate item = new MenuItemTemplate(caption, img); item.ID = id; item.Description = desc; item.PermissionContext = PermContext; item.Permissions = Perms; if (string.IsNullOrEmpty(clickScript)) { item.ClientOnClickNavigateUrl = SPEncode.ScriptEncode(clickUrl); } else { item.ClientOnClickScript = clickScript; } Controls.Add(item); if (ProductPage.Is14) { ribbons.Add(new RibbonItem(item, inst, ClientID + id, caption, img, desc, clickUrl, clickScript, cmdNo)); WebPartIDs.ToString(); } }
public static void GetFilterInfo(IDictionary inst, string schemaName, ref string clickScript, System.Web.UI.WebControls.WebParts.WebPart webPart, Page page, ref bool includeFilters, ref string fj, ref List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters) { SPWebPartManager currentWebPartManager = null; System.Web.UI.WebControls.WebParts.WebPart part = null; IList list = null; List <string> list2 = new List <string>(); List <object[]> list3 = new List <object[]>(); includeFilters = false; string filterCaml = ""; if (inst["filter"] != null) { try { includeFilters = (bool)inst["filter"]; } catch { includeFilters = false; } } if (includeFilters && !IsLic(2)) { includeFilters = false; clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + schemaName + "_filter", new object[0]), "Basic" })) + "');"; } if (includeFilters && (effectiveFilters == null)) { effectiveFilters = new List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > >(); try { currentWebPartManager = WebPartManager.GetCurrentWebPartManager(page) as SPWebPartManager; } catch { } if ((webPart != null) && (currentWebPartManager != null)) { foreach (System.Web.UI.WebControls.WebParts.WebPart part2 in ProductPage.TryEach <System.Web.UI.WebControls.WebParts.WebPart>(currentWebPartManager.WebParts)) { if (part2.GetType().AssemblyQualifiedName == "roxority_FilterZen.roxority_FilterWebPart, roxority_FilterZen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a2103dd0c3e898e1") { foreach (System.Web.UI.WebControls.WebParts.WebPart part3 in ((getConnPartMethod == null) ? (getConnPartMethod = part2.GetType().GetMethod("GetConnectedParts", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, System.Type.EmptyTypes, null)) : getConnPartMethod).Invoke(part2, null) as IEnumerable <System.Web.UI.WebControls.WebParts.WebPart> ) { if (part3.ID.Equals(webPart.ID)) { part = part2; break; } } } if (part != null) { break; } } } if (part != null) { try { if (!((bool)part.GetType().GetMethod("LicEd", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(part, new object[] { 2 }))) { clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt", new object[0])) + "');"; part = null; } } catch { clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt", new object[0])) + "');"; part = null; } } fj = string.Empty; if (part != null) { try { filterCaml = ((roxority_FilterZen.roxority_FilterWebPart)(part)).GeneratedQuery; list = ((partFiltersProp == null) ? (partFiltersProp = part.GetType().GetProperty("PartFilters", BindingFlags.Public | BindingFlags.Instance)) : partFiltersProp).GetValue(part, null) as IList; fj = ((partJsonProp == null) ? (partJsonProp = part.GetType().GetProperty("JsonFilters", BindingFlags.Public | BindingFlags.Instance)) : partJsonProp).GetValue(part, null) as string; list2.AddRange(((string)((camlAndProp == null) ? (camlAndProp = part.GetType().GetProperty("CamlFiltersAndCombined", BindingFlags.Public | BindingFlags.Instance)) : camlAndProp).GetValue(part, null)).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)); } catch { } if (list != null) { foreach (object obj3 in list) { if (kvpValProp == null) { kvpValProp = obj3.GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } object obj2 = kvpValProp.GetValue(obj3, null); if (obj2 != null) { if (fpKeyProp == null) { fpKeyProp = obj2.GetType().GetProperty("Key", BindingFlags.Public | BindingFlags.Instance); } if (fpValProp == null) { fpValProp = obj2.GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } if (fpOpProp == null) { fpOpProp = obj2.GetType().GetProperty("CamlOperator", BindingFlags.Public | BindingFlags.Instance); } list3.Add(new object[] { fpKeyProp.GetValue(obj2, null), fpValProp.GetValue(obj2, null), (CamlOperator)Enum.Parse(typeof(CamlOperator), fpOpProp.GetValue(obj2, null).ToString(), true) }); } } } foreach (object[] objArray in list3) { int num2; KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > item = new KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> >(objArray[0] as string, new KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool>(new List <KeyValuePair <string, CamlOperator> >(), list2.Contains(objArray[0] as string))); int num = num2 = -1; foreach (KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > pair2 in effectiveFilters) { num2++; if (pair2.Key == item.Key) { num = num2; item = pair2; break; } } item.Value.Key.Add(new KeyValuePair <string, CamlOperator>(objArray[1] as string, (CamlOperator)objArray[2])); if (num >= 0) { effectiveFilters[num] = item; } else { effectiveFilters.Add(item); } } } } fj += "((((((" + filterCaml + "))))))"; }
protected override void CreateChildControls() { string fj = string.Empty; string str2 = string.Empty; string str7 = string.Empty; bool includeFilters = false; bool useView = false; int cmdNo = 0; new Hashtable(); List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters = null; SPContext current = SPContext.Current; SPSecurity.CatchAccessDeniedException = false; current.Site.CatchAccessDeniedException = false; if ((((this.Page != null) && (this.Page.Header != null)) && ((this.List != null) && (this.Context != null))) && (((this.Context.Request != null) && (this.Context.Request.Url != null)) && !this.Context.Request.Url.AbsolutePath.ToLowerInvariant().Contains("/_layouts/roxority_"))) { using (ProductPage page = new ProductPage()) { using (SPSite site = new SPSite(current.Site.ID)) { site.CatchAccessDeniedException = false; using (SPWeb web = site.OpenWeb(current.Web.ID)) { IEnumerable <IDictionary> enumerable = JsonSchemaManager.GetInstances(page, null, this.SchemaName, web, this.List, this.DispForm ? null : this.View, true, true, false); if (enumerable != null) { string siteUrl = web.ServerRelativeUrl.TrimEnd(new char[] { '/' }); this.PhVals["View_Title"] = string.Empty; if (this.WebPart == null) { this.PhVals["WebPart_Title"] = string.Empty; } this.PhVals["TitleBar_Title"] = this.Page.Title; if (this.LoadScript) { if (!ProductPage.Config <bool>(null, "_nojquery") && !this.Page.Items.Contains("jquery")) { this.Page.Items["jquery"] = new object(); this.Page.ClientScript.RegisterClientScriptInclude("jquery", string.Concat(new object[] { siteUrl, "/_layouts/", ProductPage.AssemblyName, "/jQuery.js?v=", ProductPage.Version })); } this.Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName, string.Concat(new object[] { siteUrl, "/_layouts/", ProductPage.AssemblyName, "/", ProductPage.AssemblyName, ".js?v=", ProductPage.Version })); } if (ProductPage.Is14) { this.Page.ClientScript.RegisterClientScriptBlock(typeof(ClientScriptManager), ProductPage.AssemblyName + "_Script", ProductPage.GetResource("__RibbonScript", new object[] { "{", "}", this.Prod, this.ProdName }), true); } foreach (IDictionary dictionary in enumerable) { string resource; if (!this.IsActionSupported(dictionary)) { continue; } foreach (DictionaryEntry entry in dictionary) { string introduced40 = this.actionPropPrefix + entry.Key; this.PhVals[introduced40] = entry.Value + string.Empty; } this.PhVals["QueryString_a"] = dictionary["id"] + string.Empty; string clickScript = string.Empty; if (!ProductPage.isEnabled) { using (SPSite site2 = ProductPage.GetAdminSite()) { string str4; clickScript = "if(confirm('" + SPEncode.ScriptEncode(ProductPage.GetResource("NotEnabledPlain", new object[] { str4 = ProductPage.MergeUrlPaths(site2.Url, string.Concat(new object[] { "/_layouts/", ProductPage.AssemblyName, "/default.aspx?cfg=enable&r=", page.Rnd.Next() })), ProductPage.GetTitle() })) + @"\n\n" + SPEncode.ScriptEncode(ProductPage.GetResource("NotEnabledPrompt", new object[0])) + "'))location.href='" + str4 + "';"; goto Label_0737; } } if (!this.Page.Items.Contains(this.Prod + "zenlistids")) { this.Page.Items[this.Prod + "zenlistids"] = str2 = "," + this.List.ID + ","; } else if (!(str2 = this.Page.Items[this.Prod + "zenlistids"] + string.Empty).Contains("," + this.List.ID + ",")) { this.Page.Items[this.Prod + "zenlistids"] = str2 = string.Concat(new object[] { str2, ",", this.List.ID, "," }); } if (!this.Page.Items.Contains(this.Prod + "zencmdcount")) { this.Page.Items[this.Prod + "zencmdcount"] = cmdNo = 1; } else { this.Page.Items[this.Prod + "zencmdcount"] = cmdNo = ((int)this.Page.Items[this.Prod + "zencmdcount"]) + 1; } this.ValidateInstance(dictionary, ref clickScript); useView = false; if (dictionary["view"] != null) { try { useView = (bool)dictionary["view"]; } catch { useView = false; } } if (useView && !IsLic(this.Vl)) { useView = false; clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + this.SchemaName + "_view", new object[0]), (this.Vl == 2) ? "Basic" : ((this.Vl == 0) ? "Lite" : "Ultimate") })) + "');"; } GetFilterInfo(dictionary, this.SchemaName, ref clickScript, this.WebPart, this.Page, ref includeFilters, ref fj, ref effectiveFilters); Label_0737: if (Lic.expired) { resource = ProductPage.GetResource("LicExpiry", new object[0]); } else { resource = JsonSchemaManager.GetDisplayName(dictionary, this.SchemaName, false); } string desc = Lic.expired ? ProductPage.GetResource("LicStudio", new object[] { ProductPage.GetTitle() }) : (IsLic(2) ? (dictionary["desc"]).ToString() : ("SharePoint-Tools.net/" + this.ProdName)); //if (string.IsNullOrEmpty(clickScript) && string.IsNullOrEmpty(clickScript = this.GetClickScript(siteUrl, clickScript, dictionary, web, useView, includeFilters, effectiveFilters, fj, this.GetFlag(dictionary)))) //{ // this.AddItem(dictionary, dictionary["id"] + string.Empty, resource, siteUrl + this.IconUrl, desc, siteUrl + (Lic.expired ? string.Concat(new object[] { "/_layouts/", ProductPage.AssemblyName, "/default.aspx?cfg=lic&r=", page.Rnd.Next() }) : this.GetActionUrl(dictionary, web, useView, includeFilters, effectiveFilters, fj, this.GetFlag(dictionary))), string.Empty, cmdNo); //} //else //{ var actionUrl = this.GetActionUrl(dictionary, web, useView, includeFilters, effectiveFilters, fj, this.GetFlag(dictionary)); var script = "post_to_url('" + actionUrl.Split('?')[0] + "','" + actionUrl.Split('?')[1] + "')"; this.AddItem(dictionary, dictionary["id"] + string.Empty, resource, siteUrl + this.IconUrl, desc, Lic.expired ? string.Concat(new object[] { siteUrl, "/_layouts/", ProductPage.AssemblyName, "/default.aspx?cfg=lic&r=", page.Rnd.Next() }) : string.Empty, Lic.expired ? string.Empty : script, cmdNo); //} if (string.IsNullOrEmpty(str7)) { try { str7 = string.Concat(new object[] { siteUrl, "/_layouts/", ProductPage.AssemblyName, "/default.aspx?cfg=tools&tool=Tool_", this.SchemaName, "&r=", page.Rnd.Next() }); } catch { } } if ((cmdNo >= 1) && !IsLic(2)) { break; } } if (this.ribbons.Count > 0) { foreach (RibbonItem item in this.ribbons) { this.Page.ClientScript.RegisterStartupScript(typeof(ClientScriptManager), ProductPage.AssemblyName + "_Script_" + item.CmdNo, " " + this.Prod + (string.IsNullOrEmpty(item.ClickScript) ? "Urls" : "Commands") + "['" + item.ID + "'] = '" + SPEncode.ScriptEncode(string.IsNullOrEmpty(item.ClickScript) ? item.ClickUrl : item.ClickScript) + "'; ", true); this.AddRibbonButton(item.Inst, item.ID, item.Caption, item.Img, item.Desc, item.ClickUrl, item.ClickScript, item.CmdNo, item.Item); } } this.OnActionsCreated(cmdNo); } } } } } base.CreateChildControls(); }
protected string GetUplScript() { return(ProductPage.LicEdition(ProductPage.GetContext(), (IDictionary)null, 4) ? ("roxUps['" + ClientID + "'].doUpload();") : ("alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", "UploadZen Web Part", "Ultimate")) + "');")); }
protected override void CreateChildControls() { string fj = string.Empty, listIDs = string.Empty, clickScript, temp, clickUrl = string.Empty, itemCaption, itemDesc, contentListUrl = string.Empty, siteUrl; bool includeFilters = false, useView = false; int cmdCount = 0; Hashtable customProps = new Hashtable(); List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters = null; IEnumerable <IDictionary> actions; SPContext ctx = SPContext.Current; ctx.Site.CatchAccessDeniedException = SPSecurity.CatchAccessDeniedException = false; if ((Page != null) && (Page.Header != null) && (List != null) && (Context != null) && (Context.Request != null) && (Context.Request.Url != null) && !Context.Request.Url.AbsolutePath.ToLowerInvariant().Contains("/_layouts/roxority_")) { using (ProductPage prodPage = new ProductPage()) using (SPSite site = new SPSite(ctx.Site.ID)) { site.CatchAccessDeniedException = false; using (SPWeb thisWeb = site.OpenWeb(ctx.Web.ID)) if ((actions = JsonSchemaManager.GetInstances(prodPage, null, SchemaName, thisWeb, List, DispForm ? null : View, true, true, false)) != null) { siteUrl = thisWeb.ServerRelativeUrl.TrimEnd('/'); PhVals ["View_Title"] = string.Empty; if (WebPart == null) { PhVals ["WebPart_Title"] = string.Empty; } PhVals ["TitleBar_Title"] = Page.Title; if (LoadScript) { if (!(ProductPage.Config <bool> (null, "_nojquery") || Page.Items.Contains("jquery"))) { Page.Items ["jquery"] = new object(); Page.ClientScript.RegisterClientScriptInclude("jquery", siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/jQuery.js?v=" + ProductPage.Version); } Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName, siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".js?v=" + ProductPage.Version); } if (ProductPage.Is14) { Page.ClientScript.RegisterClientScriptBlock(typeof(ClientScriptManager), ProductPage.AssemblyName + "_Script", ProductPage.GetResource("__RibbonScript", "{", "}", Prod, ProdName), true); } foreach (IDictionary inst in actions) { if (IsActionSupported(inst)) { foreach (DictionaryEntry prop in inst) { PhVals [actionPropPrefix + prop.Key] = prop.Value + string.Empty; } PhVals ["QueryString_a"] = inst ["id"] + string.Empty; clickScript = string.Empty; if (!ProductPage.isEnabled) { using (SPSite adminSite = ProductPage.GetAdminSite()) clickScript = "if(confirm('" + (SPEncode.ScriptEncode(ProductPage.GetResource("NotEnabledPlain", temp = ProductPage.MergeUrlPaths(adminSite.Url, "/_layouts/" + ProductPage.AssemblyName + "/default.aspx?cfg=enable&r=" + prodPage.Rnd.Next()), ProductPage.GetTitle())) + "\\n\\n" + SPEncode.ScriptEncode(ProductPage.GetResource("NotEnabledPrompt"))) + "'))location.href='" + temp + "';"; } else { if (!Page.Items.Contains(Prod + "zenlistids")) { Page.Items [Prod + "zenlistids"] = listIDs = "," + List.ID + ","; } else if (!(listIDs = Page.Items [Prod + "zenlistids"] + string.Empty).Contains("," + List.ID + ",")) { Page.Items [Prod + "zenlistids"] = listIDs = listIDs + "," + List.ID + ","; } if (!Page.Items.Contains(Prod + "zencmdcount")) { Page.Items [Prod + "zencmdcount"] = cmdCount = 1; } else { Page.Items [Prod + "zencmdcount"] = cmdCount = ((int)Page.Items [Prod + "zencmdcount"]) + 1; } ValidateInstance(inst, ref clickScript); useView = false; if (inst ["view"] != null) { try { useView = (bool)inst ["view"]; } catch { useView = false; } } if (useView && !IsLic(Vl)) { useView = false; clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + SchemaName + "_view"), ((Vl == 2) ? "Basic" : ((Vl == 0) ? "Lite" : "Ultimate")))) + "\');"; } GetFilterInfo(inst, SchemaName, ref clickScript, WebPart, Page, ref includeFilters, ref fj, ref effectiveFilters); } if (Lic.expired) { itemCaption = ProductPage.GetResource("LicExpiry"); } else { itemCaption = JsonSchemaManager.GetDisplayName(inst, SchemaName, false); } itemDesc = Lic.expired ? ProductPage.GetResource("LicStudio", ProductPage.GetTitle()) : (IsLic(2) ? (inst ["desc"] + "") : ("SharePoint-Tools.net/" + ProdName)); if (string.IsNullOrEmpty(clickScript) && string.IsNullOrEmpty(clickScript = GetClickScript(siteUrl, clickScript, inst, thisWeb, useView, includeFilters, effectiveFilters, fj, GetFlag(inst)))) { AddItem(inst, inst ["id"] + string.Empty, itemCaption, siteUrl + IconUrl, itemDesc, clickUrl = siteUrl + (Lic.expired ? ("/_layouts/" + ProductPage.AssemblyName + "/default.aspx?cfg=lic&r=" + prodPage.Rnd.Next()) : GetActionUrl(inst, thisWeb, useView, includeFilters, effectiveFilters, fj, GetFlag(inst))), string.Empty, cmdCount); } else { AddItem(inst, inst ["id"] + string.Empty, itemCaption, siteUrl + IconUrl, itemDesc, Lic.expired ? (siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/default.aspx?cfg=lic&r=" + prodPage.Rnd.Next()) : string.Empty, Lic.expired ? string.Empty : clickScript, cmdCount); } if (string.IsNullOrEmpty(contentListUrl)) { try { contentListUrl = siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/default.aspx?cfg=tools&tool=Tool_" + SchemaName + "&r=" + prodPage.Rnd.Next(); } catch { } } if ((cmdCount >= 1) && !IsLic(2)) { break; } } } if (ribbons.Count > 0) { foreach (RibbonItem rib in ribbons) { Page.ClientScript.RegisterStartupScript(typeof(ClientScriptManager), ProductPage.AssemblyName + "_Script_" + rib.CmdNo, " " + Prod + (string.IsNullOrEmpty(rib.ClickScript) ? "Urls" : "Commands") + "['" + rib.ID + "'] = '" + SPEncode.ScriptEncode(string.IsNullOrEmpty(rib.ClickScript) ? rib.ClickUrl : rib.ClickScript) + "'; ", true); AddRibbonButton(rib.Inst, rib.ID, rib.Caption, rib.Img, rib.Desc, rib.ClickUrl, rib.ClickScript, rib.CmdNo, rib.Item); } } OnActionsCreated(cmdCount); } } } base.CreateChildControls(); }
public static void GetFilterInfo(IDictionary inst, string schemaName, ref string clickScript, SystemWebPart webPart, Page page, ref bool includeFilters, ref string fj, ref List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters) { int i1, i2; object val; SPWebPartManager wpMan = null; SystemWebPart filterPart = null; IList flist = null; List <string> andFilters = new List <string> (); List <object []> filters = new List <object []> (); KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > kvp; includeFilters = false; if (inst ["filter"] != null) { try { includeFilters = (bool)inst ["filter"]; } catch { includeFilters = false; } } if (includeFilters && !IsLic(2)) { includeFilters = false; clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + schemaName + "_filter"), "Basic")) + "\');"; } if (includeFilters && (effectiveFilters == null)) { effectiveFilters = new List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > (); try { wpMan = SPWebPartManager.GetCurrentWebPartManager(page) as SPWebPartManager; } catch { } if ((webPart != null) && (wpMan != null)) { foreach (SystemWebPart wp in ProductPage.TryEach <SystemWebPart> (wpMan.WebParts)) { if (wp.GetType().AssemblyQualifiedName == ProductPage.FILTERZEN_TYPENAME) { foreach (SystemWebPart cwp in (((getConnPartMethod == null) ? (getConnPartMethod = wp.GetType().GetMethod("GetConnectedParts", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly, null, Type.EmptyTypes, null)) : getConnPartMethod).Invoke(wp, null) as IEnumerable <SystemWebPart>)) { if (cwp.ID.Equals(webPart.ID)) { filterPart = wp; break; } } } if (filterPart != null) { break; } } } if (filterPart != null) { try { if (!((bool)filterPart.GetType().GetMethod("LicEd", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(filterPart, new object [] { 2 }))) { clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt")) + "\');"; filterPart = null; } } catch { clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt")) + "\');"; filterPart = null; } } fj = string.Empty; if (filterPart != null) { try { flist = ((partFiltersProp == null) ? (partFiltersProp = filterPart.GetType().GetProperty("PartFilters", BindingFlags.Instance | BindingFlags.Public)) : partFiltersProp).GetValue(filterPart, null) as IList; fj = ((partJsonProp == null) ? (partJsonProp = filterPart.GetType().GetProperty("JsonFilters", BindingFlags.Instance | BindingFlags.Public)) : partJsonProp).GetValue(filterPart, null) as string; andFilters.AddRange(((string)((camlAndProp == null) ? (camlAndProp = filterPart.GetType().GetProperty("CamlFiltersAndCombined", BindingFlags.Instance | BindingFlags.Public)) : camlAndProp).GetValue(filterPart, null)).Split(new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)); } catch { } if (flist != null) { foreach (object kv in flist) { if (kvpValProp == null) { kvpValProp = kv.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); } if ((val = kvpValProp.GetValue(kv, null)) != null) { if (fpKeyProp == null) { fpKeyProp = val.GetType().GetProperty("Key", BindingFlags.Public | BindingFlags.Instance); } if (fpValProp == null) { fpValProp = val.GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } if (fpOpProp == null) { fpOpProp = val.GetType().GetProperty("CamlOperator", BindingFlags.Public | BindingFlags.Instance); } filters.Add(new object [] { fpKeyProp.GetValue(val, null), fpValProp.GetValue(val, null), (CamlOperator)Enum.Parse(typeof(CamlOperator), fpOpProp.GetValue(val, null).ToString(), true) }); } } } foreach (object [] f in filters) { kvp = new KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > (f [0] as string, new KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> (new List <KeyValuePair <string, CamlOperator> > (), andFilters.Contains(f [0] as string))); i1 = i2 = -1; foreach (KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > k in effectiveFilters) { i2++; if (k.Key == kvp.Key) { i1 = i2; kvp = k; break; } } kvp.Value.Key.Add(new KeyValuePair <string, CamlOperator> (f [1] as string, (CamlOperator)f [2])); if (i1 >= 0) { effectiveFilters [i1] = kvp; } else { effectiveFilters.Add(kvp); } } } } }
public static void RenderUploadZenActions(HtmlTextWriter __w, HttpContext context, ref SPSite adminSite, ref ProductPage prodPage, SPWeb web, SPList list, bool multiUploadMode, HyperLink uploadMultipleLink) { string temp, srcUrl; int cmdCount = 0; IEnumerable <IDictionary> actionsEnum; SPContext ctx = ProductPage.GetContext(); bool hideAlways = ProductPage.Config(ctx, "HideLink").Equals("always"), hideAuto = ProductPage.Config(ctx, "HideLink").Equals("auto"); HyperLink link; List <IDictionary> actions = (((actionsEnum = JsonSchemaManager.GetInstances(prodPage = new ProductPage(), null, "UploadActions", web, list, null, true, true, false)) == null) ? new List <IDictionary> () : new List <IDictionary> (actionsEnum)); if ((!ProductPage.isEnabled) && (adminSite == null)) { adminSite = ProductPage.GetAdminSite(); } if (multiUploadMode) { } else { foreach (IDictionary inst in actions) { if (UploadZenMenuItem.GetBool(inst, "p", true)) { link = new HyperLink(); link.Text = JsonSchemaManager.GetDisplayName(inst, "UploadActions", false); link.ToolTip = inst ["desc"] + string.Empty; if ("c".Equals(inst ["m"])) { link.NavigateUrl = ProductPage.isEnabled ? UploadZenMenuItem.GetUrl(SPContext.Current, context, inst, web, list, false) : ("javascript:if(confirm('" + (SPEncode.ScriptEncode(ProductPage.GetResource("NotEnabledPlain", temp = ProductPage.MergeUrlPaths(adminSite.Url, "/_layouts/roxority_UploadZen.aspx?cfg=enable"), "UploadZen")) + "\\n\\n" + SPEncode.ScriptEncode(ProductPage.GetResource("NotEnabledPrompt"))) + "'))location.href='" + temp + "';"); } else { if (string.IsNullOrEmpty(srcUrl = context.Request.QueryString ["Source"])) { srcUrl = list.DefaultViewUrl + "?"; } else { srcUrl += "&"; } link.NavigateUrl = srcUrl + "roxuplshow=" + inst ["id"]; } link.Target = "_top"; link.RenderControl(__w); __w.Write("<br/>"); cmdCount++; } } if (hideAlways || (hideAuto && (cmdCount > 0))) { uploadMultipleLink.Visible = false; } if ((!uploadMultipleLink.NavigateUrl.StartsWith("/")) && (!uploadMultipleLink.NavigateUrl.StartsWith("http"))) { uploadMultipleLink.NavigateUrl = web.Url.TrimEnd('/') + "/_layouts/" + uploadMultipleLink.NavigateUrl; } } }
protected override void CreateChildControls() { string siteUrl = SPContext.Current.Web.Url.TrimEnd('/'), printID; bool hasPart; WebPartManager wpMan; if (string.IsNullOrEmpty(Context.Request.QueryString ["roxPrintZen"])) { AddMenuItems(Controls, GetControls(Context, Page, ID, "sam", siteUrl, Parent)); } else { //Page.ClientScript.RegisterClientScriptBlock (typeof (PrintZenSiteMenuItem), "roxPrintZenCss", "<link type=\"text/css\" rel=\"stylesheet\" href=\"" + siteUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".css?r=" + "&v=" + ProductPage.Version + "\"/>" + (Context.Request.UserAgent.Contains ("MSIE") ? "<style type=\"text/css\"> div.rox-prz-toolbar button { text-align: left; padding-left: 18px; } </style><script type=\"text/javascript\" language=\"JavaScript\"> roxIsPrintPage = true; roxDlgOnLoad = " + "1".Equals (Context.Request.QueryString ["roxDlgShow"]).ToString ().ToLowerInvariant () + "; " + (hasL ? string.Empty : "setInterval(function() { jQuery('div.ms-bodyareacell').hide(); }, 250);") + " </script>" : string.Empty), false); //if (hasL && ((ct = ProductPage.FindControl (Page.Controls, "MSO_ContentDiv") as HtmlGenericControl) != null)) { // foreach (Control subCt in ct.Controls) // if (done = ((lc = subCt as LiteralControl) != null)) { // lc.Text = html + lc.Text; // break; // } // if (!done) // ct.Controls.AddAt (0, new LiteralControl (html)); //} else // foreach (Control ctl in GetControls (Page.Form.Controls, !hasL)) // if ((!hasL) && ((wc = ctl as WebControl) != null)) { // wc.Style [HtmlTextWriterStyle.Display] = "none"; // wc.Style [HtmlTextWriterStyle.Visibility] = "hidden"; // wc.Style [HtmlTextWriterStyle.Height] = "1px"; // wc.Style [HtmlTextWriterStyle.Overflow] = "hidden"; // } else if (hasL && ((lc = ctl as LiteralControl) != null)) { // lc.Text = html + lc.Text; // break; // } if ((!"__roxPage".Equals(printID = Context.Request.QueryString ["roxPrintZen"], StringComparison.InvariantCultureIgnoreCase)) && ((wpMan = WebPartManager.GetCurrentWebPartManager(Page)) != null)) { foreach (WebPartZoneBase zone in wpMan.Zones) { if (printID.StartsWith("g_")) { hasPart = false; foreach (SystemWebPart wp in ProductPage.TryEach <SystemWebPart> (zone.WebParts)) { if (hasPart = wp.ID.Equals(printID, StringComparison.InvariantCultureIgnoreCase)) { break; } } if (!hasPart) { zone.Visible = false; } else { foreach (SystemWebPart wp in ProductPage.TryEach <SystemWebPart> (zone.WebParts)) { if (!wp.ID.Equals(printID, StringComparison.InvariantCultureIgnoreCase)) { wp.Visible = false; } else { Page.ClientScript.RegisterClientScriptBlock(typeof(PrintZenSiteMenuItem), "roxPrintPagePartTitle", "jQuery(document).ready(function() { document.title = '" + SPEncode.ScriptEncode(wp.DisplayTitle) + "'; });", true); } } } } else if (zone.ID != printID) { zone.Visible = false; } } } } base.CreateChildControls(); }
public static string GetRollupClickScriptStatic(IDictionary inst, string webPageUrl, TahoeWebPart webPart, List <object []> filters, List <string> andFilters, Dictionary <string, string> oobFilterPairs) { string pageUrl = string.Empty, query = string.Empty, jop = "&roxDlgShow=" + (JsonSchemaManager.Bool(inst ["dp"], true) ? "1" : "0") + "&rpzopt=' + (JSON.stringify(roxLastOps['" + webPart.ID + "'][1]))"; SortedDictionary <string, string> qs = new SortedDictionary <string, string> (); qs ["a"] = inst ["id"] + string.Empty; qs ["l"] = webPart.ID; qs ["View"] = HttpUtility.UrlEncode(webPageUrl); qs ["r"] = DateTime.Now.Ticks.ToString(); qs ["t"] = HttpUtility.UrlEncode(webPart.Title); foreach (KeyValuePair <string, string> kvp in qs) { query += ((string.IsNullOrEmpty(query) ? "?" : "&") + kvp.Key + "=" + kvp.Value); } pageUrl = SPContext.Current.Web.Url.TrimEnd('/') + "/_layouts/" + ProductPage.AssemblyName + "/prnt.aspx" + query; if (ProductPage.Is14 && "o".Equals(inst ["t"])) { return((IsLic(2) ? 2 : 0) + "OpenPopUpPage('" + pageUrl + jop + " + '&roxDlg=1');"); } if (!"w".Equals(inst ["t"])) { return((IsLic(2) ? 2 : 0) + "window.open('" + pageUrl + jop + ", '" + webPart.ID + "', '" + SPEncode.ScriptEncode(ProductPage.Config(ProductPage.GetContext(), "Popup")) + "');"); } return((IsLic(2) ? 2 : 0) + "location.href='" + pageUrl + jop + ";"); }
public static string GetClickScript(HttpContext context, string callerID, string siteUrl, string clickScript, IDictionary inst, SPWeb thisWeb, bool useView, bool includeFilters, List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters, string fj, bool forceScript, bool dispForm, SPList list, SPListItem listItem, Guid viewID, IEnumerable <string> allPageParams, Control parent, bool origPage) { string pageUrl; pageUrl = siteUrl + GetActionUrl(context, inst, thisWeb, useView, includeFilters, effectiveFilters, fj, dispForm, list, listItem, viewID, allPageParams, parent, origPage); if (ProductPage.Is14 && "o".Equals(inst ["t"])) { return("OpenPopUpPage('" + pageUrl + "&roxDlg=1&roxDlgShow=" + (JsonSchemaManager.Bool(inst ["dp"], true) ? "1" : "0") + "');"); } if (!"w".Equals(inst ["t"])) { return("window.open('" + pageUrl + "&roxDlgShow=" + (JsonSchemaManager.Bool(inst ["dp"], true) ? "1" : "0") + "', '" + callerID + "', '" + SPEncode.ScriptEncode(ProductPage.Config(ProductPage.GetContext(), "Popup")) + "');"); } return(forceScript ? ("location.href='" + pageUrl + "&roxDlgShow=" + (JsonSchemaManager.Bool(inst ["dp"], true) ? "1" : "0") + "';") : string.Empty); }