public override void Dispose() { if (jsonFarmMan != null) { jsonFarmMan.Dispose(); jsonFarmMan = null; } if (jsonSiteMan != null) { jsonSiteMan.Dispose(); jsonSiteMan = null; } if (prodPage != null) { prodPage.Dispose(); prodPage = null; } if (extWeb != null) { extWeb.Dispose(); extWeb = null; } if (extSite != null) { extSite.Dispose(); extSite = null; } base.Dispose(); }
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; } } }
public static DataSource FromID(string id, bool farmScope, bool siteScope, string typeName) { bool flag = false; IDictionary inst = new OrderedDictionary(); if (string.IsNullOrEmpty(id)) { id = "default"; } inst["id"] = id; using (ProductPage page = new ProductPage()) { KeyValuePair <JsonSchemaManager, JsonSchemaManager> pair = JsonSchemaManager.TryGet(page, null, farmScope, siteScope, "roxority_Shared"); foreach (JsonSchemaManager manager in new JsonSchemaManager[] { pair.Value, pair.Key }) { if (manager != null) { using (manager) { foreach (JsonSchemaManager.Schema schema in manager.AllSchemas.Values) { if ((schema == null) || !(schema.Name == "DataSources")) { continue; } if ("new".Equals(id, StringComparison.InvariantCultureIgnoreCase)) { return(Load(schema, inst, typeName)); } foreach (IDictionary dictionary2 in schema.GetInstances(SPContext.Current.Web, null, null)) { if (flag = (dictionary2 != null) && id.Equals(dictionary2["id"])) { foreach (DictionaryEntry entry in dictionary2) { inst[entry.Key] = entry.Value; } break; } } if (flag) { return(Load(schema, inst, typeName)); } } } } } } return(null); }
public override string RenderValueForEdit(JsonSchemaManager.Property prop, IDictionary instance, bool disabled, bool readOnly) { bool flag = prop.Name.EndsWith("_pd"); string str2 = instance["id"] + "_" + prop.Name; prop.RawSchema["lines"] = 3; string str = base.RenderValueForEdit(prop, instance, disabled, readOnly); if (JsonSchemaManager.Bool(prop.RawSchema["allow_fieldsel"], true)) { str = str + RenderFieldDropDown(base["Tool_ItemEditor_DataFields_LabelAdd", new object[0]], false, str2 + "_fields", string.Empty, "var tb=jQuery('#" + str2 + "'),sel=jQuery('#" + str2 + @"_fields')[0];if((sel.selectedIndex>0)&&(sel.selectedIndex<(sel.options.length-1))){tb.val(tb.val()+(tb.val() ?'\n':'')+'" + (flag ? string.Empty : "[") + "'+sel.options[sel.selectedIndex].value+'" + (flag ? string.Empty : "]") + "');roxScrollEnd(tb[0]);sel.selectedIndex=0;}", true, false, prop.Editable); } return(str); }
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); }
public RecordPropertyValueCollection this[string name] { get { RecordPropertyValueCollection values; Converter <string, string> getSourceValue = null; string loginName = string.Empty; bool flag = false; IDictionary dictionary = null; UserDataSource dataSource = this.DataSource as UserDataSource; if (!this.propVals.TryGetValue(name, out values)) { string str3; string[] strArray; int num; int num2; IEnumerable <IDictionary> enumerable; if ("roxVcardExport".Equals(name) && (this.DataSource is UserDataSource)) { this.propVals[name] = values = new RecordPropertyValueCollection(this.DataSource, this, null, new object[] { "<span class=\"rox-vcard\">" + string.Format(ProductPage.Config(ProductPage.GetContext(), "VcardPropFormat"), UserDataSource.GetVcardExport(this), '{', '}') + "</span>" }, null, null, null); return(values); } if (((!name.StartsWith("{", StringComparison.InvariantCultureIgnoreCase) || !name.EndsWith("}", StringComparison.InvariantCultureIgnoreCase)) || ((this.DataSource == null) || (this.DataSource.JsonSchema == null))) || (((this.DataSource.JsonSchema.Owner == null) || ((strArray = name.Substring(1, name.Length - 2).Trim().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)) == null)) || ((strArray.Length < 1) || ((enumerable = JsonSchemaManager.GetInstances(this.DataSource.JsonSchema.Owner.ProdPage, null, "DataFieldFormats", null, null, null, true, true, false, "roxority_Shared")) == null)))) { string str; if (!name.StartsWith("rox___")) { RecordProperty propertyByName = this.DataSource.Properties.GetPropertyByName(name); if (propertyByName == null) { throw new Exception(ProductPage.GetResource("Tool_DataSources_UnField", new object[] { name, JsonSchemaManager.GetDisplayName(this.DataSource.JsonInstance, "DataSources", false) })); } this.propVals[name] = values = this.DataSource.GetPropertyValues(this, propertyByName); return(values); } if (getSourceValue == null) { getSourceValue = n => this[n, string.Empty]; } this.propVals[name] = values = new RecordPropertyValueCollection(this.DataSource, this, null, ((str = GetSpecialFieldValue(this.DataSource, name, getSourceValue)) == null) ? new object[0] : new object[] { str }, null, null, null); return(values); } foreach (IDictionary dictionary2 in enumerable) { if ((dictionary2 != null) && (strArray[0].Equals(dictionary2["name"]) || strArray[0].Equals(dictionary2["id"]))) { dictionary = dictionary2; break; } } if ((dictionary == null) || string.IsNullOrEmpty(loginName = dictionary["t"] + string.Empty)) { long num3; if (strArray[0].Contains("_")) { for (int i = 1; i < strArray.Length; i++) { foreach (string str4 in RecordProperty.ExtractNames(strArray[i], true, this.DataSource)) { strArray[i] = strArray[i].Replace("[" + str4 + "]", this[str4].Value + string.Empty); } while (((num = strArray[i].IndexOf('{')) >= 0) && ((num2 = strArray[i].IndexOf('}', num + 1)) > num)) { strArray[i] = strArray[i].Replace(str3 = strArray[i].Substring(num, (num2 - num) + 1), this[str3].Value + string.Empty); } } } if ((!flag && (flag = strArray[0] == "DateTime_FromBinary")) && ((strArray.Length > 1) && long.TryParse(strArray[1], out num3))) { loginName = DateTime.FromBinary(num3).ToShortDateString(); } else if (((!flag && (flag = strArray[0] == "DateTime_FromDdMm")) && ((strArray.Length > 1) && (strArray[1].Length == 4))) && long.TryParse(strArray[1], out num3)) { loginName = new DateTime(DateTime.Today.Year, int.Parse(strArray[1].Substring(2)), int.Parse(strArray[1].Substring(0, 2))).ToString((strArray.Length > 2) ? strArray[2] : "MMMM dd", CultureInfo.CurrentUICulture); } else if ((!flag && (flag = strArray[0] == "DateTime_FromFileTime")) && ((strArray.Length > 1) && long.TryParse(strArray[1], out num3))) { loginName = DateTime.FromFileTime(num3).ToShortDateString(); } else if ((!flag && (flag = strArray[0] == "DateTime_FromFileTimeUtc")) && ((strArray.Length > 1) && long.TryParse(strArray[1], out num3))) { loginName = DateTime.FromFileTimeUtc(num3).ToShortDateString(); } else if ((!flag && (flag = strArray[0] == "DateTime_FromTicks")) && ((strArray.Length > 1) && long.TryParse(strArray[1], out num3))) { loginName = new DateTime(num3).ToShortDateString(); } else if ((!flag && (flag = strArray[0] == "String_Replace")) && (strArray.Length > 3)) { loginName = strArray[1].Replace(strArray[2], strArray[3]); } else if ((!flag && (flag = strArray[0] == "UserProfiles_PropertyValue")) && ((strArray.Length > 3) && (dataSource != null))) { loginName = dataSource.GetRecordVal(strArray[1], strArray[2], strArray[3]); } else if ((!flag && (flag = strArray[0] == "UserProfiles_CurrentUser")) && (dataSource != null)) { loginName = SPContext.Current.Web.CurrentUser.LoginName; } if (!flag) { loginName = ProductPage.GetResource("Tool_DataSources_UnFormat", new object[] { strArray[0] }); } } else { for (int j = 1; j < strArray.Length; j++) { loginName = loginName.Replace("[" + j + "]", this[strArray[j]].Value + string.Empty); } foreach (string str5 in RecordProperty.ExtractNames(loginName, true, this.DataSource)) { loginName = loginName.Replace("[" + str5 + "]", this[str5].Value + string.Empty); } while (((num = loginName.IndexOf('{')) >= 0) && ((num2 = loginName.IndexOf('}', num + 1)) > num)) { loginName = loginName.Replace(str3 = loginName.Substring(num, (num2 - num) + 1), this[str3].Value + string.Empty); } if ("h".Equals(dictionary["m"])) { loginName = "<roxhtml/>" + loginName; } } this.propVals[name] = values = new RecordPropertyValueCollection(this.DataSource, this, null, new object[] { loginName }, null, null, null); } return(values); } }
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 override void OnLoad(EventArgs e) { RollupWebPart webPart = ParentToolPane.SelectedWebPart as RollupWebPart; EnsureChildControls(); base.OnLoad(e); expDropDownList.Enabled = printDropDownList.Enabled = ((webPart == null) || webPart.LicEd(2)); if (dataSourceDropDownList.Items.Count == 0) { if ((webPart != null) && !string.IsNullOrEmpty(webPart.DataSourcePath)) { foreach (IDictionary inst in JsonSchemaManager.GetInstances(webPart.DataSourcePath, "DataSources", DataSource.SCHEMAPROP_ASMNAME)) { dataSourceDropDownList.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(inst, "DataSources", false) + " -- " + ProductPage.GetResource("PC_DataSources_t_" + inst ["t"]), inst ["id"] + string.Empty)); } if (!string.IsNullOrEmpty(webPart.DataSourceID)) { try { dataSourceDropDownList.SelectedValue = webPart.DataSourceID; } catch { } } } } RefreshFieldDropDown(groupDropDownList, 2, webPart, true, webPart.groupProp, null, null); RefreshFieldDropDown(tabDropDownList, 2, webPart, true, webPart.tabProp, null, null); RefreshFieldDropDown(sortDropDownList, 2, webPart, true, webPart.sortProp, "___roxRandomizedSort", ProductPage.GetResource("Disp___roxRandomizedSort")); RefreshFieldDropDown(propDropDownList, 0, webPart, false, string.Empty, null, null); if (printDropDownList.Items.Count == 0) { printDropDownList.Items.Add(new ListItem(Res("Anim_b"), string.Empty)); if ((webPart != null) && printDropDownList.Enabled && !string.IsNullOrEmpty(webPart.PzPath)) { foreach (IDictionary inst in JsonSchemaManager.GetInstances(webPart.PzPath, "PrintActions", "roxority_PrintZen")) { if (!"n".Equals(inst ["mpz"])) { printDropDownList.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(inst, "PrintActions", false), inst ["id"] + string.Empty)); } } if (!string.IsNullOrEmpty(webPart.PrintAction)) { try { printDropDownList.SelectedValue = webPart.PrintAction; } catch { printDropDownList.SelectedIndex = 0; } } } } if (expDropDownList.Items.Count == 0) { expDropDownList.Items.Add(new ListItem(Res("Anim_b"), string.Empty)); if ((webPart != null) && expDropDownList.Enabled && !string.IsNullOrEmpty(webPart.EzPath)) { foreach (IDictionary inst in JsonSchemaManager.GetInstances(webPart.EzPath, "ExportActions", "roxority_ExportZen")) { expDropDownList.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(inst, "ExportActions", false), inst ["id"] + string.Empty)); } if (!string.IsNullOrEmpty(webPart.ExportAction)) { try { expDropDownList.SelectedValue = webPart.ExportAction; } catch { expDropDownList.SelectedIndex = 0; } } } } if ((webPart != null) && ((propsTextBox.Rows = webPart.Properties.Split(new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Length + 1) < 3)) { propsTextBox.Rows = 3; } dataSourceDropDownList.Attributes ["onchange"] = "alert('" + Res("DataSourceChange") + "');"; }
public void RefreshControls() { object tmp; string key; Guid webID, listID; ListItem item; SPList list = null; JsonSchemaManager.Property.Type.LibSet.Config libSet; if (Part != null) { tmp = Part.Library; if (Part.AllowSelectAction && (ActionDropDown != null) && (ActionDropDown.Items.Count == 0)) { foreach (IDictionary inst in Instances) { ActionDropDown.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(inst, "UploadActions", false) + ":", inst ["id"] + string.Empty)); } } if (Part.AllowSelectLibSite && (WebDropDown != null) && (WebDropDown.Items.Count == 0)) { foreach (KeyValuePair <Guid, string> kvp in GetWebs(SPContext.Current.Site.RootWeb, true, 0, new JsonSchemaManager.Property.Type.WebSet.Config(Action ["webs"]))) { WebDropDown.Items.Add(item = new ListItem(kvp.Value, ProductPage.GuidLower(kvp.Key, true))); if (kvp.Key.Equals(((webPart.extWeb == null) ? SPContext.Current.Web : webPart.extWeb).ID)) { item.Selected = true; } } } if ((Part.AllowSelectLibWeb || Part.AllowSelectLibSite || Part.AllowSelectLibPage) && (LibDropDown != null) && (LibDropDown.Items.Count == 0)) { if (Part.AllowSelectLibWeb || Part.AllowSelectLibSite) { libSet = new JsonSchemaManager.Property.Type.LibSet.Config(Action ["show"]); using (SPWeb web = SPContext.Current.Site.OpenWeb(((WebDropDown != null) && (!Guid.Empty.Equals(webID = ProductPage.GetGuid(WebDropDown.SelectedValue, true)))) ? webID : SPContext.Current.Web.ID)) foreach (SPList lib in ProductPage.TryEach <SPList> (web.Lists)) { if ((lib is SPDocumentLibrary) && (libSet.IsMatch(lib, webPart.JsonFarmMan) || libSet.IsMatch(lib, webPart.JsonSiteMan))) { LibDropDown.Items.Add(new ListItem(lib.Title, ProductPage.GuidLower(lib.ID, true))); } } } else if (Part.Library != null) { foreach (KeyValuePair <SystemWebPart, SPDocumentLibrary> kvp in Part.libParts) { if (LibDropDown.Items.FindByValue(key = ProductPage.GuidLower(kvp.Value.ID, true)) == null) { LibDropDown.Items.Add(new ListItem(kvp.Value.Title, key)); } } } if (Part.Library != null) { try { LibDropDown.SelectedValue = ProductPage.GuidLower(Part.Library.ID, true); } catch { } } } if (Part.AllowSelectFolder && (FolderDropDown != null) && (FolderDropDown.Items.Count == 0)) { if ((Part.AllowSelectLibWeb || Part.AllowSelectLibSite || Part.AllowSelectLibPage) && (LibDropDown != null) && !Guid.Empty.Equals(listID = ProductPage.GetGuid(LibDropDown.SelectedValue, true))) { using (SPWeb web = SPContext.Current.Site.OpenWeb(((WebDropDown != null) && (!Guid.Empty.Equals(webID = ProductPage.GetGuid(WebDropDown.SelectedValue, true)))) ? webID : SPContext.Current.Web.ID)) list = web.Lists [listID]; } else if (Part.Library != null) { list = Part.Library; } if (list != null) { foreach (KeyValuePair <string, string> kvp in GetFolders(list.RootFolder, true, 0, Part.ExcludeFolderNames.Split(new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))) { FolderDropDown.Items.Add(item = new ListItem(kvp.Value, kvp.Key)); } } if (Part.folder != null) { try { FolderDropDown.SelectedValue = Part.folder.ServerRelativeUrl; } catch { } } } if (!eventsSet) { eventsSet = true; if ((FolderDropDown != null) && (FolderDropDown.Items.Count > 0)) { FolderDropDown.SelectedIndexChanged += FolderDropDown_SelectedIndexChanged; } if ((LibDropDown != null) && (LibDropDown.Items.Count > 0)) { LibDropDown.SelectedIndexChanged += LibDropDown_SelectedIndexChanged; } if ((WebDropDown != null) && (WebDropDown.Items.Count > 0)) { WebDropDown.SelectedIndexChanged += WebDropDown_SelectedIndexChanged; } } } }
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(); }
protected override void OnLoad(EventArgs e) { roxority_RollupZen.RollupWebPart selectedWebPart = base.ParentToolPane.SelectedWebPart as roxority_RollupZen.RollupWebPart; this.EnsureChildControls(); base.OnLoad(e); this.expDropDownList.Enabled = this.printDropDownList.Enabled = (selectedWebPart == null) || selectedWebPart.LicEd(2); if (((this.dataSourceDropDownList.Items.Count == 0) && (selectedWebPart != null)) && !string.IsNullOrEmpty(selectedWebPart.DataSourcePath)) { foreach (IDictionary dictionary in JsonSchemaManager.GetInstances(selectedWebPart.DataSourcePath, "DataSources", "roxority_Shared")) { this.dataSourceDropDownList.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(dictionary, "DataSources", false) + " -- " + ProductPage.GetResource("PC_DataSources_t_" + dictionary["t"], new object[0]), dictionary["id"] + string.Empty)); } if (!string.IsNullOrEmpty(selectedWebPart.DataSourceID)) { try { this.dataSourceDropDownList.SelectedValue = selectedWebPart.DataSourceID; } catch { } } } this.RefreshFieldDropDown(this.groupDropDownList, 2, selectedWebPart, true, selectedWebPart.groupProp, null, null); this.RefreshFieldDropDown(this.tabDropDownList, 2, selectedWebPart, true, selectedWebPart.tabProp, null, null); this.RefreshFieldDropDown(this.sortDropDownList, 2, selectedWebPart, true, selectedWebPart.sortProp, "___roxRandomizedSort", ProductPage.GetResource("Disp___roxRandomizedSort", new object[0])); this.RefreshFieldDropDown(this.propDropDownList, 0, selectedWebPart, false, string.Empty, null, null); if (this.printDropDownList.Items.Count == 0) { this.printDropDownList.Items.Add(new ListItem(Res("Anim_b", new object[0]), string.Empty)); if (((selectedWebPart != null) && this.printDropDownList.Enabled) && !string.IsNullOrEmpty(selectedWebPart.PzPath)) { foreach (IDictionary dictionary2 in JsonSchemaManager.GetInstances(selectedWebPart.PzPath, "PrintActions", "roxority_PrintZen")) { if (!"n".Equals(dictionary2["mpz"])) { this.printDropDownList.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(dictionary2, "PrintActions", false), dictionary2["id"] + string.Empty)); } } if (!string.IsNullOrEmpty(selectedWebPart.PrintAction)) { try { this.printDropDownList.SelectedValue = selectedWebPart.PrintAction; } catch { this.printDropDownList.SelectedIndex = 0; } } } } if (this.expDropDownList.Items.Count == 0) { this.expDropDownList.Items.Add(new ListItem(Res("Anim_b", new object[0]), string.Empty)); if (((selectedWebPart != null) && this.expDropDownList.Enabled) && !string.IsNullOrEmpty(selectedWebPart.EzPath)) { foreach (IDictionary dictionary3 in JsonSchemaManager.GetInstances(selectedWebPart.EzPath, "ExportActions", "roxority_ExportZen")) { this.expDropDownList.Items.Add(new ListItem(JsonSchemaManager.GetDisplayName(dictionary3, "ExportActions", false), dictionary3["id"] + string.Empty)); } if (!string.IsNullOrEmpty(selectedWebPart.ExportAction)) { try { this.expDropDownList.SelectedValue = selectedWebPart.ExportAction; } catch { this.expDropDownList.SelectedIndex = 0; } } } } if ((selectedWebPart != null) && ((this.propsTextBox.Rows = selectedWebPart.Properties.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Length + 1) < 3)) { this.propsTextBox.Rows = 3; } this.dataSourceDropDownList.Attributes["onchange"] = "alert('" + Res("DataSourceChange", new object[0]) + "');"; }
public static IDictionary GetControls(HttpContext context, Page page, string ownerID, string check, string siteUrl, Control parent) { string thisID, clickScript, fj = string.Empty; bool isSep1, isSep2, hasSep1, hasSep2, includeFilters = false, isPeop, origPage, doZones; int zoneCount; List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters = null; Type [] types = new Type [] { typeof(WebPartVerb) }, rollTypes = new Type [] { typeof(IDictionary) }; Type wpType; OrderedDictionary dict = new OrderedDictionary(), ctl, items = null, actionItem, actionItems = null; KeyValuePair <JsonSchemaManager, JsonSchemaManager> jsonMans; JsonSchemaManager.Schema ctlSchema, actSchema; WebPartManager wpMan = WebPartManager.GetCurrentWebPartManager(page); Reflector refl; SPList list; List <SystemWebPart> parts; IEnumerable <SystemWebPart> partsEnum; WebPartVerb wpVerb; using (ProductPage ppage = new ProductPage()) { jsonMans = JsonSchemaManager.TryGet(ppage, null, true, true, null); foreach (JsonSchemaManager jman in new JsonSchemaManager [] { jsonMans.Key, jsonMans.Value }) { if (jman != null) { if (((ctlSchema = jman.AllSchemas ["PrintControls"]) != null) && ((actSchema = jman.AllSchemas ["PrintActions"]) != null)) { foreach (IDictionary launcher in ctlSchema.Instances) { if (launcher != null) { if (JsonSchemaManager.Bool(launcher [check], true)) { ctl = MakeSubControl(ownerID + "_" + launcher ["id"], JsonSchemaManager.GetDisplayName(launcher, ctlSchema.Name, false), ctlSchema.GetInstanceDescription(launcher), string.Empty, siteUrl + "/_layouts/images/roxority_PrintZen/printer32.png", items = new OrderedDictionary()); foreach (IDictionary action in actSchema.Instances) { if (action != null) { items [thisID = (ctl ["id"] + "_" + action ["id"])] = actionItem = MakeSubControl(thisID, JsonSchemaManager.GetDisplayName(action, "PrintActions", false), ctlSchema.GetInstanceDescription(action), string.Empty, siteUrl + "/_layouts/images/lg_icxps.gif", actionItems = new OrderedDictionary()); hasSep1 = hasSep2 = isSep1 = isSep2 = false; zoneCount = -1; if (wpMan != null) { if (hasSep2 = hasSep1 = (JsonSchemaManager.Bool(launcher ["pp"], true) && !"n".Equals(action ["mpp"]))) { actionItems [thisID + "_pp"] = MakeSubControl(thisID + "_pp", ProductPage.GetProductResource("PrintPageContent"), ProductPage.GetProductResource("PrintPageContentDesc"), clickScript = PrintZenMenuItem.GetClickScript(context, ownerID, siteUrl, string.Empty, action, SPContext.Current.Web, false, false, null, null, true, false, null, null, Guid.Empty, null, page, false), siteUrl + "/_layouts/images/lg_icgen.gif", null); } if (JsonSchemaManager.Bool(launcher ["pw"], true) && ((partsEnum = ProductPage.TryEach <SystemWebPart> (wpMan.WebParts)) != null)) { parts = new List <SystemWebPart> (partsEnum); parts.Sort((wp1, wp2) => { WebPartZoneBase zone1, zone2; if ((wp1 == null) && (wp2 == null)) { return(0); } if (wp1 == null) { return(-1); } if (wp2 == null) { return(1); } if (((zone1 = wp1.Zone) == null) || ((zone2 = wp2.Zone) == null)) { return((wp1.ZoneIndex == wp2.ZoneIndex) ? wp1.TabIndex.CompareTo(wp2.TabIndex) : wp1.ZoneIndex.CompareTo(wp2.ZoneIndex)); } return((zone1.TabIndex == zone2.TabIndex) ? wp1.ZoneIndex.CompareTo(wp2.ZoneIndex) : zone1.TabIndex.CompareTo(zone2.TabIndex)); }); foreach (SystemWebPart wp in parts) { refl = new Reflector((wpType = wp.GetType()).Assembly); list = (("Microsoft.SharePoint.WebPartPages.XsltListViewWebPart".Equals(wpType.FullName) || (wp is ListViewWebPart)) ? ((wp is ListViewWebPart) ? (refl.Get(wp, "List") as SPList) : ((SPView)refl.Get(wp, "ContextView")).ParentList) : null); isPeop = ((wpType.FullName == "roxority_RollupZen.RollupWebPart") || (wpType.FullName == "roxority_PeopleZen.roxority_UserListWebPart")); if (IsPartSupported(action, wp, isPeop, list, out origPage)) { if (hasSep1 && !isSep1) { isSep1 = true; actionItems [thisID + "_sep1"] = null; } hasSep2 = true; if (isPeop && (!origPage) && ((wpVerb = refl.Call(wp, "GetPrintVerb", rollTypes, new object [] { action }) as WebPartVerb) != null)) { clickScript = wpVerb.ClientClickHandler + string.Empty; } else if ((list != null) && !origPage) { clickScript = string.Empty; PrintZenMenuItem.GetFilterInfo(action, "PrintActions", ref clickScript, wp, page, ref includeFilters, ref fj, ref effectiveFilters); if (string.IsNullOrEmpty(clickScript)) { clickScript = PrintZenMenuItem.GetClickScript(context, ownerID, siteUrl, string.Empty, action, SPContext.Current.Web, JsonSchemaManager.Bool(action ["view"], true), includeFilters, effectiveFilters, fj, true, false, list, null, ProductPage.GetGuid(refl.Get(wp, "ViewGuid") + string.Empty), PrintZenMenuItem.GetAllPageParams(context, true, null), parent, origPage); } } else { clickScript = PrintZenMenuItem.GetClickScript(context, ownerID, siteUrl, string.Empty, action, SPContext.Current.Web, false, false, null, null, true, false, null, null, ProductPage.GetGuid(wp.ID.Substring(2).Replace('_', '-')), PrintZenMenuItem.GetAllPageParams(context, true, null), parent, origPage); } actionItems [thisID + "_" + wp.ID] = MakeSubControl(thisID + "_" + wp.ID, wp.DisplayTitle, GetPartDesc(wp, refl), clickScript, siteUrl + "/_layouts/roxority_PrintZen/mash.tl.aspx?op=imgoverlay&backimg=" + HttpUtility.UrlEncode("/_layouts/images/roxority_PrintZen/printer32.png") + "&overlay=" + HttpUtility.UrlEncode(string.IsNullOrEmpty(wp.TitleIconImageUrl) ? (string.IsNullOrEmpty(wp.CatalogIconImageUrl) ? "/_layouts/images/itobject.gif" : wp.CatalogIconImageUrl) : wp.TitleIconImageUrl) + "&r=" + ppage.Rnd.Next(), null); } } } if (doZones = (JsonSchemaManager.Bool(launcher ["pz"], true) && (!"n".Equals(action ["mwz"])) && ((!JsonSchemaManager.Bool(launcher ["pp"], true)) || (((zoneCount = wpMan.Zones.Count) > 1))))) { if (zoneCount > 0) { zoneCount = 0; foreach (WebPartZoneBase zone in ProductPage.TryEach <WebPartZoneBase> (wpMan.Zones)) { if (zone.WebParts.Count > (JsonSchemaManager.Bool(launcher ["pw"], true) ? 1 : 0)) { zoneCount++; } } } } if (doZones && ((zoneCount < 0) || (zoneCount > 1))) { foreach (WebPartZoneBase zone in ProductPage.TryEach <WebPartZoneBase> (wpMan.Zones)) { if (zone.WebParts.Count > (JsonSchemaManager.Bool(launcher ["pw"], true) ? 1 : 0)) { if (hasSep2 && !isSep2) { isSep2 = true; actionItems [thisID + "_sep2"] = null; } clickScript = PrintZenMenuItem.GetClickScript(context, ownerID, siteUrl, string.Empty, action, SPContext.Current.Web, false, false, null, null, true, false, null, null, Guid.Empty, null, zone, false); actionItems [thisID + "_" + zone.ID] = MakeSubControl(thisID + "_" + zone.ID, ProductPage.GetProductResource("WebPartZone", zone.DisplayTitle), GetZoneDesc(zone), clickScript, siteUrl + "/_layouts/images/lg_icgen.gif", null); } } } } if (actionItems.Count == 0) { items.Remove(thisID); } } } if (items.Count > 0) { dict [launcher ["id"]] = ctl; } } if ((items != null) && (items.Count == 1)) { foreach (DictionaryEntry entry in actionItems) { items [entry.Key] = entry.Value; } items.RemoveAt(0); } } } } } } } return(dict); }
public static ICollection <IDictionary> GetActions(string fpath) { return(JsonSchemaManager.GetInstances(fpath, "ExportActions")); }
internal static void ExportRollup(TextWriter writer, IDictionary action, Hashtable opt, SPWeb web, Hashtable fht, string [] listColumns, string locale, Action <string, string> csvWrite, string sep) { string tmp, fieldName, colVal, mulSep = ProductPage.Config(ProductPage.GetContext(), "MultiSep"); object val, ds; int pos; bool filt = ((action ["filter"] is bool) && (bool)action ["filter"]); if (refl == null) { refl = new Reflector(Assembly.Load("roxority_PeopleZen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=68349fdcd3484f01")); } foreach (string k in new ArrayList(opt.Keys)) { if (opt [k] is string) { opt [k] = HttpUtility.UrlDecode(opt [k] + string.Empty); } } if (filt && (fht == null) && opt.ContainsKey("f")) { fht = new Hashtable(); fht ["f"] = JSON.JsonDecode(HttpUtility.UrlDecode(opt ["f"] + string.Empty)); if (opt.ContainsKey("fa")) { fht ["fa"] = JSON.JsonDecode(HttpUtility.UrlDecode(opt ["fa"] + string.Empty)); } } using (IDisposable consumer = refl.New("roxority.Data.DataSourceConsumer", JsonSchemaManager.Bool(action ["nopg"], false) ? 0 : (int)opt ["ps"], (int)opt ["p"], "1".Equals(opt ["dty"]), "1".Equals(opt ["did"]), opt ["pr"] + string.Empty, (object)(tmp = (opt ["spn"] + string.Empty)), string.IsNullOrEmpty(tmp) ? null : (object)"1".Equals(opt ["sd"]), JsonSchemaManager.Bool(action ["notb"], false) ? string.Empty : (opt ["tpn"] + string.Empty), JsonSchemaManager.Bool(action ["notb"], false) ? string.Empty : opt ["tv"], (object)(tmp = (opt ["gpn"] + string.Empty)), string.IsNullOrEmpty(tmp) ? null : (object)"1".Equals(opt ["gd"]), "1".Equals(opt ["gb"]), "1".Equals(opt ["gs"]), web, opt ["dsid"] + string.Empty, null, filt ? fht : null, null, new List <Exception> ()) as IDisposable) { ds = refl.Get(consumer, "DataSource"); foreach (object crec in refl.Get(consumer, "List") as IEnumerable) { for (int i = 0; i < listColumns.Length; i++) { fieldName = ((pos = listColumns [i].IndexOf(':')) <= 0) ? (listColumns [i]) : (listColumns [i].Substring(0, pos)); val = refl.Call(crec, "Get", new Type [] { typeof(string), typeof(string), ds.GetType().BaseType }, new object [] { fieldName, string.Empty, ds }); colVal = GetExportValue(web, val, null, locale, ((fieldName.ToLowerInvariant().Contains("birthday") || fieldName.ToLowerInvariant().Contains("xxxhiredate")) && !string.IsNullOrEmpty(val + string.Empty)), mulSep); csvWrite(colVal, ((i == listColumns.Length - 1) ? "\r\n" : sep)); } } } }
public static void Export(TextWriter writer, ICollection <IDictionary> allActions, string webUrl, string exportListID, string ruleID, string listViewID, string separator, string unixFlag, string fs, int min, string fj) { string locale = string.Empty, viewXml, sep = ",", versioning, colVal, subVersion, colName, verVal, newVerVal, tmp, fieldName, rollJson = null, mulSep = ProductPage.Config(ProductPage.GetContext(), "MultiSep"), acsep; string [] listColumns; int pos, verIndex = -1, theEnc; bool expGrps = false, versionRows = false, skipRow = false, isRoll, is2, is4, isMin; object val; HttpContext context = null; Encoding encoding = Encoding.Default; SPList exportList = null; SPListItemCollection listItems = null; SPView listView = null; SPField field; SPQuery query; List <SPListItemVersion> versions; Dictionary <string, string> verVals; ProductPage.LicInfo li = ProductPage.LicInfo.Get(null); ArrayList filters = null; SPView defView; Hashtable fht = null, rollOpt = null; XmlDocument doc = new XmlDocument(); XmlNode node; Action <string, string> csvWrite = null; IDictionary action = null; Guid ruleGuid, instGuid; List <string> originalViewFields; is2 = ProductPage.LicEdition(ProductPage.GetContext(), li, 2); is4 = ProductPage.LicEdition(ProductPage.GetContext(), li, 4); isMin = ProductPage.LicEdition(ProductPage.GetContext(), li, min); try { context = HttpContext.Current; } catch { } if (isRoll = ((context != null) && (context.Request != null) && (context.Request.QueryString != null) && !string.IsNullOrEmpty(rollJson = context.Request.QueryString ["rpzopt"]))) { rollOpt = JSON.JsonDecode(rollJson) as Hashtable; } if (li.expired) { throw new SPException(ProductPage.GetResource("LicExpiry")); } if (!isMin) { throw new SPException(ProductPage.GetResource("NopeEd", "ExportZen.exe", "Ultimate")); } using (SPSite site = new SPSite(webUrl)) using (SPWeb exportWeb = site.OpenWeb()) { if ((!isRoll) && (string.IsNullOrEmpty(exportListID) || ((exportList = exportWeb.Lists [new Guid(exportListID)]) == null))) { throw new SPException(ProductPage.GetProductResource("Old_NoExportList")); } foreach (IDictionary inst in allActions) { if (ruleID.Equals(inst ["id"] + string.Empty, StringComparison.InvariantCultureIgnoreCase) || ruleID.Equals(inst ["name"] + string.Empty, StringComparison.InvariantCultureIgnoreCase) || ((!Guid.Empty.Equals(instGuid = ProductPage.GetGuid(inst ["id"] + string.Empty))) && (!Guid.Empty.Equals(ruleGuid = ProductPage.GetGuid(ruleID))) && ruleGuid.Equals(instGuid))) { action = inst; break; } } if (action == null) { throw new SPException(ProductPage.GetProductResource("Old_NoRuleItem", ruleID, allActions.Count, ProductPage.LoginName(exportWeb.CurrentUser.LoginName), ProductPage.Config(ProductPage.GetContext(), "_lang"))); } if (is4 && (exportList != null) && !string.IsNullOrEmpty(listViewID)) { try { listView = exportList.Views [new Guid(listViewID)]; } catch { } } if (((listColumns = (action ["cols"] + string.Empty).Split(new string [] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries)) == null) || (listColumns.Length == 0)) { if (isRoll) { listColumns = HttpUtility.UrlDecode(((((int)rollOpt ["nm"]) != 0) ? (DataSource.SCHEMAPROP_PREFIX + DataSource.SCHEMAPROP_TITLEFIELD + ":" + ProductPage.GetResource("Name") + "\r\n") : string.Empty) + rollOpt ["pr"] + "").Split(new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); } else if (exportList != null) { if ((defView = listView) == null) { defView = exportList.DefaultView; } originalViewFields = new List <string> (defView.ViewFields.Count); foreach (string fn in defView.ViewFields) { if ((Array.IndexOf <string> (ProductPage.SPOddFieldNames, fn) < 0) || fn.StartsWith("Link")) { originalViewFields.Add(fn + (((field = ProductPage.GetField(exportList, fn)) == null) ? string.Empty : (":" + field.Title))); } } listColumns = originalViewFields.ToArray(); } } if ((listColumns.Length > 3) && !is2) { listColumns = new string [] { listColumns [0], listColumns [1], listColumns [2] } } ; versionRows = (((val = action ["vhrows"]) is bool) && (bool)val); if (!string.IsNullOrEmpty(versioning = (action ["vhcol"] + string.Empty).Trim())) { for (int i = 0; i < listColumns.Length; i++) { if ("roxVersion".Equals((string.Empty + listColumns [i]).Trim(), StringComparison.InvariantCultureIgnoreCase)) { verIndex = i; break; } } if (verIndex < 0) { Array.Resize <string> (ref listColumns, listColumns.Length + 1); listColumns [verIndex = (listColumns.Length - 1)] = versioning; } else { listColumns [verIndex] = versioning; } } try { locale = action ["loc"] + string.Empty; } catch { } try { if (!string.IsNullOrEmpty(tmp = action ["enc"] + string.Empty)) { if (int.TryParse(tmp, out theEnc)) { encoding = Encoding.GetEncoding(theEnc); } else { encoding = Encoding.GetEncoding(tmp); } } } catch { } if (context != null) { context.Response.ContentEncoding = encoding; context.Response.ContentType = "text/csv; charset=" + encoding.WebName; context.Response.AddHeader("Content-Disposition", "attachment;filename=\"" + SafeName(((exportList == null) ? context.Request.QueryString ["t"] : exportList.Title) + " " + JsonSchemaManager.GetDisplayName(action, "ExportActions", false)) + "_" + DateTime.Now.Ticks + ".csv" + "\""); } try { if ((action ["bom"] is bool) && (bool)action ["bom"]) { writer.Write("\uFEFF"); } } catch { } if (is2) { acsep = action ["sep"] + string.Empty; if (!string.IsNullOrEmpty(separator)) { sep = separator; } else if ((action ["excel"] is bool) && ((bool)action ["excel"]) && (string.IsNullOrEmpty(acsep) || acsep == "s")) { sep = ";"; } else if (acsep == "t") { sep = "\t"; } } if (!JsonSchemaManager.Bool(action ["nf"], false)) { for (int i = 0; i < listColumns.Length; i++) { fieldName = (((pos = listColumns [i].IndexOf(':')) <= 0) ? (listColumns [i]) : (listColumns [i].Substring(pos + 1))).Trim(); if ((fieldName == "ID") && (i == 0)) { fieldName = "\"ID\""; } writer.Write(fieldName + ((i == listColumns.Length - 1) ? ("\r\n") : (sep))); } } if (is2 && !string.IsNullOrEmpty(fs)) { filters = JSON.JsonDecode(fs) as ArrayList; } if (is2 && !string.IsNullOrEmpty(fj)) { fht = JSON.JsonDecode(fj) as Hashtable; } if ((filters != null) && (filters.Count == 0)) { filters = null; } if (exportList != null) { if ((listView == null) && (filters == null)) { listItems = exportList.Items; } else { query = ((listView != null) ? new SPQuery(listView) : new SPQuery()); if (listView == null) { query.Folder = exportList.RootFolder; viewXml = "<View><Query/></View>"; } else { viewXml = listView.SchemaXml; } query.AutoHyperlink = query.ExpandUserField = query.ItemIdQuery = false; query.ExpandRecurrence = query.IndividualProperties = query.IncludePermissions = query.IncludeMandatoryColumns = query.IncludeAttachmentVersion = query.IncludeAttachmentUrls = query.IncludeAllUserPermissions = query.RecurrenceOrderBy = true; query.RowLimit = 0; query.ViewFields = string.Empty; foreach (SPField f in ProductPage.TryEach <SPField> (exportList.Fields)) { query.ViewFields += string.Format(ProductPage.FORMAT_CAML_VIEWFIELD, f.InternalName); } if (filters != null) { doc.LoadXml(viewXml); if (!string.IsNullOrEmpty(viewXml = ProductPage.ApplyCore(exportList, viewXml, doc, filters, ref expGrps, false, fht, null))) { doc.LoadXml(viewXml); if ((node = doc.DocumentElement.SelectSingleNode("Query")) != null) { query.Query = node.InnerXml; } } } listItems = exportList.GetItems(query); } } csvWrite = delegate(string csvVal, string suffix) { writer.Write(CsvEscape(csvVal, sep, is2 && "1".Equals(unixFlag)) + suffix); }; if (isRoll) { ExportRollup(writer, action, rollOpt, exportWeb, fht, listColumns, locale, csvWrite, sep); } else if (listItems != null) { foreach (SPListItem item in ProductPage.TryEach <SPListItem> (listItems)) { for (int i = 0; i < listColumns.Length; i++) { skipRow = false; if ((!string.IsNullOrEmpty(versioning)) && (i == verIndex)) { versions = new List <SPListItemVersion> (); verVals = new Dictionary <string, string> (); colVal = string.Empty; foreach (SPListItemVersion v in item.Versions) { versions.Add(v); } versions.Sort(delegate(SPListItemVersion one, SPListItemVersion two) { return(one.VersionLabel.CompareTo(two.VersionLabel)); }); if (versionRows && (versions.Count > 1)) { skipRow = true; csvWrite(string.Empty, "\r\n"); for (int v = versions.Count - 1; v >= 0; v--) { for (int vc = 0; vc < listColumns.Length; vc++) { if (vc == verIndex) { csvWrite(versions [v].VersionLabel, ((vc == (listColumns.Length - 1)) ? "\r\n" : sep)); } else { colVal = string.Empty; if (!"ID".Equals(fieldName = ((pos = listColumns [vc].IndexOf(':')) <= 0) ? (listColumns [vc]) : (listColumns [vc].Substring(0, pos)))) { field = ProductPage.GetField(item, fieldName); val = string.Empty; try { val = versions [v] [fieldName]; } catch { } colVal = GetExportValue(exportWeb, val, field, locale, mulSep); } csvWrite(colVal, ((vc == (listColumns.Length - 1)) ? "\r\n" : sep)); } } } } else { for (int v = 0; v < versions.Count; v++) { subVersion = versions [v].VersionLabel + " " + versions [v].Created.ToLocalTime() + "\r\n" + versions [v].CreatedBy.LookupValue; for (int lc = 0; lc < listColumns.Length; lc++) { if (lc != verIndex) { try { colName = ((pos = listColumns [lc].IndexOf(':')) <= 0) ? (listColumns [lc]) : (listColumns [lc].Substring(0, pos).Trim()); if ((field = ProductPage.GetField(item, colName)) != null) { colName = field.InternalName; } try { val = versions [v] [colName]; } catch { val = null; } newVerVal = GetExportValue(exportWeb, val, field, locale, mulSep); if ((!verVals.TryGetValue(colName, out verVal)) || (verVal != newVerVal)) { verVals [colName] = newVerVal; subVersion += ("\r\n" + (((pos = listColumns [lc].IndexOf(':')) <= 0) ? (listColumns [lc]) : (listColumns [lc].Substring(pos + 1).Trim())) + ": " + newVerVal); } } catch { } } } colVal = subVersion + "\r\n\r\n" + colVal; } } } else { if ((field = ProductPage.GetField(item, (fieldName = ((pos = listColumns [i].IndexOf(':')) <= 0) ? (listColumns [i]) : (listColumns [i].Substring(0, pos))))) != null) { val = item [field.Id]; } else { try { val = item [fieldName]; } catch { val = null; } } colVal = GetExportValue(exportWeb, val, field, locale, mulSep); } if (!skipRow) { csvWrite(colVal, ((i == listColumns.Length - 1) ? "\r\n" : sep)); } } } } } }
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 + ";"); }