/// <summary> /// Gets callback result. /// </summary> public string GetCallbackResult() { mParameters = new Hashtable(); mParameters["where"] = gridElem.WhereCondition; mParameters["orderby"] = gridElem.SortDirect; WindowHelper.Add(Identifier, mParameters); string queryString = "?params=" + Identifier; queryString = URLHelper.AddParameterToUrl(queryString, "hash", QueryHelper.GetHash(queryString)); queryString = URLHelper.AddParameterToUrl(queryString, "emailid", EmailID.ToString()); return(queryString); }
/// <summary> /// Sets the dialog parameters to the context. /// </summary> protected void SetFieldDialogParameters(string textboxValue) { Hashtable parameters = new Hashtable(); parameters["TextBoxValue"] = textboxValue; parameters["HiddenValue"] = hdnValue.ClientID; parameters["TextBoxID"] = TextBox.ClientID; parameters["ButtonLocalizeField"] = btnLocalize.ClientID; parameters["ButtonLocalizeString"] = btnOtherLanguages.ClientID; parameters["ButtonRemoveLocalization"] = btnRemoveLocalization.ClientID; parameters["ResourceKeyPrefix"] = ResourceKeyPrefix; parameters["LocalizedContainer"] = cntrlContainer.ClientID; WindowHelper.Add(Identifier.ToString(), parameters); }
/// <summary> /// Page load event handler /// </summary> protected void Page_Load(object sender, EventArgs e) { WindowHelper.Add("ShowOnlySiteTemplates", ShowOnlySiteTemplates); btnSelect.OnClientClick = "return PTS_Select('" + ClientID + "', '" + RootCategoryID + "');"; btnClear.OnClientClick = "return PTS_Clear('" + ClientID + "');"; btnSelect.Text = GetString("general.select"); btnClear.Text = GetString("general.clear"); if (RequestHelper.IsPostBack() && (hdnSelected.Value == "")) { hdnSelected.Value = Request.Form[hdnSelected.UniqueID]; } }
protected void chkUnderlying_OnCheckedChanged(object sender, EventArgs e) { // Store whether to copy/link also underlying documents switch (CurrentAction) { case Action.Copy: WindowHelper.Add(Action.Copy + underlying, chkUnderlying.Checked); break; case Action.Link: case Action.LinkDoc: WindowHelper.Add(Action.Link + underlying, chkUnderlying.Checked); break; } }
/// <summary> /// Gets callback result. /// </summary> public string GetCallbackResult() { string queryString = string.Empty; if (!string.IsNullOrEmpty(CallbackArgument)) { // Prepare parameters... Hashtable mParameters = new Hashtable(); // ...for mass action if (CallbackArgument.StartsWithCSafe("massaction;", true)) { // Get values of callback argument string[] selection = CallbackArgument.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if (selection.Length != 3) { return(null); } // Get selected actions from DD-list Action action = (Action)ValidationHelper.GetInteger(selection[2], 0); switch (action) { case Action.ChangeStatus: mParameters["allownone"] = true; mParameters["clientid"] = ClientID; break; case Action.AddToGroup: break; default: return(null); } } mParameters["clientid"] = ClientID; mParameters["siteid"] = SiteId; WindowHelper.Add(Identifier, mParameters); queryString = "?params=" + Identifier; queryString = URLHelper.AddParameterToUrl(queryString, "hash", QueryHelper.GetHash(queryString)); } return(queryString); }
/// <summary> /// Raises the callback event. /// </summary> public void RaiseCallbackEvent(string eventArgument) { var p = new Hashtable(); p["textbox"] = txtTags.ClientID; p["group"] = GroupId; p["tags"] = eventArgument; WindowHelper.Add(DialogIdentifier, p); var url = IsLiveSite ? "~/CMSFormControls/LiveSelectors/TagSelector.aspx" : "~/CMSFormControls/Selectors/TagSelector.aspx"; url = URLHelper.AddParameterToUrl(url, "params", DialogIdentifier); callbackResult = ResolveUrl(url); }
/// <summary> /// Pass the parameters to newly opened window and returns reference to these dialog parameters. /// </summary> /// <returns>URL containing reference to dialog parameters</returns> private string GetEditorDialogParameters() { Hashtable parameters = new Hashtable(); parameters["editorid"] = ValueElementID; parameters["allowmacros"] = AllowMacros.ToString().ToLowerCSafe(); if (!string.IsNullOrEmpty(ResolverName)) { parameters["resolvername"] = ResolverName; } WindowHelper.Add(Identifier, parameters); string queryString = "?params=" + Identifier; return(URLHelper.AddParameterToUrl(queryString, "hash", QueryHelper.GetHash(queryString))); }
/// <summary> /// Button get token clicked event. /// </summary> protected void btnGetToken_OnClick(object sender, EventArgs e) { if (Form != null) { // Control data, show error if something is missing int appId = ValidationHelper.GetInteger(Form.GetFieldValue("FacebookAccountFacebookApplicationID"), 0); FacebookApplicationInfo appInfo = FacebookApplicationInfoProvider.GetFacebookApplicationInfo(appId); if (appInfo == null) { ShowError(GetString("sm.facebook.account.msg.appnotset")); return; } var facebookAccessTokenService = Service <IFacebookAccessTokenService> .Entry(); FacebookContext.FacebookAccessToken = facebookAccessTokenService.GetAccessToken(appInfo.FacebookApplicationConsumerKey, appInfo.FacebookApplicationConsumerSecret); string pageId = Form.GetFieldValue("FacebookAccountPageID").ToString(); if (String.IsNullOrEmpty(pageId)) { ShowError(GetString("sm.facebook.account.msg.pageurlnotset")); return; } // Store data in session string sessionKey = Guid.NewGuid().ToString(); Hashtable parameters = new Hashtable { { "AppId", appInfo.FacebookApplicationConsumerKey }, { "AppSecret", appInfo.FacebookApplicationConsumerSecret }, { "PageId", pageId }, { "TokenCntId", hdnToken.ClientID }, { "TokenExpirationCntId", hdnTokenExpiration.ClientID }, { "InfoLblId", lblMessage.ClientID }, { "TokenPageIdCntId", hdnTokenPageId.ClientID }, { "TokenAppIdCntId", hdnTokenAppId.ClientID }, { "TokenAppInfoId", appInfo.FacebookApplicationID.ToString() } }; WindowHelper.Add(sessionKey, parameters); // Open client dialog script string openDialogScript = String.Format("fbOpenModalDialog('{0}');", sessionKey); ScriptHelper.RegisterStartupScript(this, GetType(), "FBAccessTokenOpenModal" + ClientID, openDialogScript, true); } }
protected void Confirm() { try { EntityMapping mapping = GetTargetMapping(); EntityMappingSerializer serializer = new EntityMappingSerializer(); MappingHiddenField.Value = serializer.SerializeEntityMapping(mapping); MappingControl.Mapping = mapping; string parametersIdentifier = QueryHelper.GetString("pid", null); Hashtable parameters = WindowHelper.GetItem(parametersIdentifier) as Hashtable; parameters["Mapping"] = MappingHiddenField.Value; WindowHelper.Add(parametersIdentifier, parameters); } catch (Exception exception) { HandleError(exception); } }
/// <summary> /// Gets the editing script for the given path and extension /// </summary> /// <param name="path">File path</param> /// <param name="ext">File extension</param> protected string GetEditScript(string path, string ext) { string fileIdentifier = Identifier + path.GetHashCode(); WindowHelper.Remove(fileIdentifier); Hashtable properties = new Hashtable(); properties.Add("filepath", URLHelper.UnMapPath(path)); WindowHelper.Add(fileIdentifier, properties); if (ImageHelper.IsSupportedByImageEditor(ext)) { // Image editing (image editor) string parameters = String.Format("?identifier={0}&refresh=1", fileIdentifier); string validationHash = QueryHelper.GetHash(parameters); string url = URLHelper.ResolveUrl("~/CMSModules/Content/CMSDesk/Edit/ImageEditor.aspx") + parameters + "&hash=" + validationHash; return(String.Format("modalDialog({0}, 'imageeditor', 905, 670); return false;", ScriptHelper.GetString(url))); } else { // Text file editing switch (ext.TrimStart('.').ToLowerCSafe()) { case "css": case "skin": case "txt": case "xml": case "js": { // Prepare parameters string parameters = String.Format("?identifier={0}", fileIdentifier); string validationHash = QueryHelper.GetHash(parameters); string url = URLHelper.ResolveUrl("~/CMSModules/Content/Controls/Dialogs/Selectors/FileSystemSelector/EditTextFile.aspx") + parameters + "&hash=" + validationHash; return(String.Format("modalDialog({0}, 'texteditor', 905, 670); return false;", ScriptHelper.GetString(url))); } } } return(null); }
/// <summary> /// Gets callback result. /// </summary> public string GetCallbackResult() { mParameters = new Hashtable(); mParameters["where"] = gridElem.WhereCondition; mParameters["orderby"] = gridElem.SortDirect; // Get the dialog identifier Guid dialogIdentifier = GetDialogIdentifier(); // Store the dialog identifier with appropriate data in the session WindowHelper.Add(dialogIdentifier.ToString(), mParameters); string queryString = "?params=" + dialogIdentifier; queryString = URLHelper.AddParameterToUrl(queryString, "hash", QueryHelper.GetHash(queryString)); queryString = URLHelper.AddParameterToUrl(queryString, "emailid", EmailID.ToString()); return(queryString); }
protected void Page_PreRender(object sender, EventArgs e) { ScriptHelper.RegisterDialogScript(Page); string url = (ViewMode.IsLiveSite()) ? ApplicationUrlHelper.ResolveDialogUrl("~/CMSModules/AbuseReport/CMSPages/ReportAbuse.aspx") : ApplicationUrlHelper.ResolveDialogUrl("~/CMSModules/AbuseReport/Dialogs/ReportAbuse.aspx"); url = URLHelper.AddParameterToUrl(url, "params", Identifier); parameters.Add("confirmationtext", ConfirmationText); parameters.Add("reporttitle", ReportTitle); parameters.Add("reportdialogtitle", ReportDialogTitle); parameters.Add("reportobjectid", ReportObjectID); parameters.Add("reportobjecttype", ReportObjectType); parameters.Add("reporturl", RequestContext.CurrentURL); WindowHelper.Add(Identifier, parameters); lnkText.NavigateUrl = "javascript:modalDialog('" + url + "', 'reportDialog', 500, 440);"; }
/// <summary> /// Gets callback result. /// </summary> public string GetCallbackResult() { string queryString = string.Empty; if (!string.IsNullOrEmpty(CallbackArgument)) { // Prepare parameters mParameters = new Hashtable(); mParameters["accountcontactid"] = CallbackArgument; mParameters["allownone"] = true; WindowHelper.Add(Identifier, mParameters); queryString = "?params=" + Identifier; queryString = URLHelper.AddParameterToUrl(queryString, "hash", QueryHelper.GetHash(queryString)); } return(queryString); }
/// <summary> /// Sets the dialog parameters to the context. /// </summary> private void SetDialogParameters(bool mergeAll) { Hashtable parameters = new Hashtable(); DataSet ds; if (mergeAll) { ds = new AccountListInfo().Generalized.GetData(null, gridElem.WhereCondition, null, -1, null, false); } else { ds = new AccountListInfo().Generalized.GetData(null, SqlHelper.GetWhereCondition("AccountID", gridElem.SelectedItems), null, -1, null, false); } parameters["MergedAccounts"] = ds; parameters["ParentAccount"] = Account; parameters["issitemanager"] = ContactHelper.IsSiteManager; WindowHelper.Add(Identifier.ToString(), parameters); }
/// <summary> /// Initializes menu. /// </summary> private void InitializeMenu() { WindowHelper.Remove(Identifier); Hashtable props = new Hashtable(); props.Add("libraryid", LibraryID); props.Add("path", LibraryFolderPath); props.Add("cancel", false); WindowHelper.Add(Identifier, props); const string MEDIA_FORMCONTROLS_FOLDER = MEDIA_LIBRARY_FOLDER + "FormControls/"; NewFolderDialogUrl = MEDIA_FORMCONTROLS_FOLDER + "Selectors/InsertImageOrMedia/NewMediaFolder.aspx?identifier=" + Identifier; // Add security hash NewFolderDialogUrl = URLHelper.AddParameterToUrl(NewFolderDialogUrl, "hash", QueryHelper.GetHash(NewFolderDialogUrl, false)); btnAdd.OnClientClick = "modalDialog('" + UrlResolver.ResolveUrl(NewFolderDialogUrl) + "', 'NewFolder', 680, 200, null, true); return false;"; }
/// <summary> /// Sets the dialog parameters to the context. /// </summary> private void SetDialogParameters(bool mergeAll) { Hashtable parameters = new Hashtable(); DataSet ds = null; if (mergeAll) { ds = new AccountListInfo().Generalized.GetData(null, gridElem.WhereCondition, null, -1, null, false); } else { string[] array = new string[gridElem.SelectedItems.Count]; gridElem.SelectedItems.CopyTo(array); ds = new AccountListInfo().Generalized.GetData(null, SqlHelperClass.GetWhereCondition("AccountID", array), null, -1, null, false); } parameters["MergedAccounts"] = ds; parameters["ParentAccount"] = this.Account; parameters["issitemanager"] = ContactHelper.IsSiteManager; WindowHelper.Add(Identificator, parameters); }
/// <summary> /// Get callback result /// </summary> public string GetCallbackResult() { string whereCondition = (SiteID > 0) ? SqlHelper.AddWhereCondition(gridEvents.WhereClause, GenerateWhereCondition()) : gridEvents.WhereClause; mParameters = new Hashtable(); mParameters["where"] = whereCondition; mParameters["orderby"] = gridEvents.SortDirect; WindowHelper.Add(Identifier, mParameters); string queryString = "?params=" + Identifier; if (SiteID > 0) { queryString = URLHelper.AddParameterToUrl(queryString, "siteid", SiteID.ToString()); } queryString = URLHelper.AddParameterToUrl(queryString, "hash", QueryHelper.GetHash(queryString)); queryString = URLHelper.AddParameterToUrl(queryString, "eventid", EventID.ToString()); return(queryString); }
protected void ConfirmButton_Click(object sender, EventArgs e) { try { if (ValidateInput()) { Mapping mapping = CreateMappingFromInput(); MappingSerializer serializer = new MappingSerializer(); MappingHiddenField.Value = serializer.SerializeMapping(mapping); MappingControl.Mapping = mapping; string parametersIdentifier = QueryHelper.GetString("pid", null); Hashtable parameters = WindowHelper.GetItem(parametersIdentifier) as Hashtable; parameters["Mapping"] = MappingHiddenField.Value; WindowHelper.Add(parametersIdentifier, parameters); } } catch (Exception exception) { HandleError(exception); } }
protected void ConfirmButton_Click(object sender, EventArgs e) { if (mContext != null) { try { EntityMapping mapping = CreateEntityMappingFromForm(); EntityMappingSerializer serializer = new EntityMappingSerializer(); MappingHiddenField.Value = serializer.SerializeEntityMapping(mapping); mContext.InitializeMappingControl(mapping); string parametersIdentifier = QueryHelper.GetString("pid", null); Hashtable parameters = WindowHelper.GetItem(parametersIdentifier) as Hashtable; parameters["Mapping"] = MappingHiddenField.Value; WindowHelper.Add(parametersIdentifier, parameters); } catch (Exception exception) { HandleException(exception); } } }
/// <summary> /// Show or persist messages by checking the hidden fields that Javascript toggles when the boxes are closed. /// </summary> private void SetMessagesPlaceHolder() { string mErrorToggleField = "0"; string mWarningToggleField = "0"; if (!RequestHelper.IsPostBack() || Request.Form[InfoToggleField] == "1") { ShowInformation(GetString("support.ui.tip")); } if (!String.IsNullOrEmpty(MessagesPlaceHolder.WarningText) || (Request.Form[WarningToggleField] == "1" && WindowHelper.GetItem(WarningToggleField) != null)) { var warningText = String.IsNullOrEmpty(MessagesPlaceHolder.WarningText) ? WindowHelper.GetItem(WarningToggleField) : MessagesPlaceHolder.WarningText; mWarningToggleField = "1"; WindowHelper.Add(WarningToggleField, warningText); ShowWarning(warningText.ToString()); } else { MessagesPlaceHolder.WarningText = null; } if (!String.IsNullOrEmpty(MessagesPlaceHolder.ErrorText) || (Request.Form[ErrorToggleField] == "1" && WindowHelper.GetItem(ErrorToggleField) != null)) { var errorText = String.IsNullOrEmpty(MessagesPlaceHolder.ErrorText) ? WindowHelper.GetItem(ErrorToggleField) : MessagesPlaceHolder.ErrorText; if (!mSubmitValid) { WindowHelper.Add(ErrorToggleField, errorText); } mErrorToggleField = "1"; ShowError(errorText.ToString()); } ScriptHelper.RegisterHiddenField(this, InfoToggleField, Request.Form[InfoToggleField] ?? "1"); ScriptHelper.RegisterHiddenField(this, WarningToggleField, mWarningToggleField); ScriptHelper.RegisterHiddenField(this, ErrorToggleField, mErrorToggleField); }
/// <summary> /// Button get token clicked event. /// </summary> protected void btnGetToken_OnClick(object sender, EventArgs e) { if (Form != null) { // Control data, show error if something is missing int appId = ValidationHelper.GetInteger(Form.GetFieldValue("FacebookAccountFacebookApplicationID"), 0); FacebookApplicationInfo appInfo = FacebookApplicationInfoProvider.GetFacebookApplicationInfo(appId); if (appInfo == null) { ShowError(GetString("sm.facebook.account.msg.appnotset")); return; } string pageId = Form.GetFieldValue("FacebookAccountPageID").ToString(); if (String.IsNullOrEmpty(pageId)) { ShowError(GetString("sm.facebook.account.msg.pageidnotset")); return; } // Store data in session Hashtable parameters = new Hashtable { { "AppId", appInfo.FacebookApplicationConsumerKey }, { "AppSecret", appInfo.FacebookApplicationConsumerSecret }, { "PageId", pageId }, { "TokenCntId", hdnToken.ClientID }, { "TokenExpirationCntId", hdnTokenExpiration.ClientID }, { "InfoLblId", lblMessage.ClientID }, { "TokenPageIdCntId", hdnTokenPageId.ClientID }, { "TokenAppIdCntId", hdnTokenAppId.ClientID }, { "TokenAppInfoId", appInfo.FacebookApplicationID.ToString() } }; WindowHelper.Add(FacebookHelper.PAGE_ACCESS_TOKEN_SESSION_KEY, parameters); // Open client dialog script string openDialogScript = "fbOpenModalDialog();"; ScriptHelper.RegisterStartupScript(this, GetType(), "FBAccessTokenOpenModal" + ClientID, openDialogScript, true); } }
protected void Page_Load(object sender, EventArgs e) { CultureInfo currentUI = CultureInfo.CurrentUICulture; if (Convert.ToString(currentUI) == "en-US") { txtSecurityCode_TextBoxWatermarkExtender.WatermarkText = "COPY THE CODE"; } else if (Convert.ToString(currentUI) == "fr-FR") { txtSecurityCode_TextBoxWatermarkExtender.WatermarkText = "COPIER LE CODE"; } // Capta image url with anti cache query string parameter imgSecurityCode.ImageUrl = ResolveUrl(string.Format("~/CMSPages/Dialogs/CaptchaImage.aspx?hash={0}&captcha={1}&width={2}&height={3}", Guid.NewGuid(), ClientID, ImageWidth, ImageHeight)); // Show info label if (ShowInfoLabel) { lblSecurityCode.AssociatedControlClientID = txtSecurityCode.ClientID; lblSecurityCode.Text = ResHelper.GetString("SecurityCode.lblSecurityCode"); lblSecurityCode.Visible = true; } // Show after text plcAfterText.Visible = ShowAfterText; if (plcAfterText.Visible) { lblAfterText.Text = GetString("SecurityCode.Aftertext"); } if (!RequestHelper.IsPostBack()) { // Create a random code and store it in the Session object. if (KeepCodeAutomatically || (SessionHelper.GetValue("CaptchaImageText" + ClientID) == null)) { WindowHelper.Add("CaptchaImageText" + ClientID, GenerateRandomCode()); } } }
/// <summary> /// Returns correct URL for IFrame. /// </summary> private string GetFrameUrl() { string frameUrl = ResolveUrl("~/CMSModules/MediaLibrary/Controls/MediaLibrary/FolderActions/CopyMoveFolder.aspx"); Hashtable properties = new Hashtable(); // Fill properties table properties.Add("folderpath", FolderPath); properties.Add("libraryid", MediaLibraryID); properties.Add("newpath", NewPath); properties.Add("files", Files); properties.Add("allFiles", AllFiles); properties.Add("load", IsLoad); properties.Add("performaction", mPerformAction); properties.Add("action", Action); WindowHelper.Add(Identifier, properties); frameUrl = URLHelper.AddParameterToUrl(frameUrl, "params", Identifier); frameUrl = URLHelper.AddParameterToUrl(frameUrl, "hash", QueryHelper.GetHash(frameUrl)); return(frameUrl); }
protected void Page_Load(object sender, EventArgs e) { if (RequestHelper.IsPostBack()) { int currentId = ValidationHelper.GetInteger(this.hdnTemplateCode.Value, 0); pti = PageTemplateInfoProvider.GetPageTemplateInfo(currentId); } ScriptHelper.RegisterDialogScript(this.Page); WindowHelper.Add("ShowOnlySiteTemplates", ShowOnlySiteTemplates); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SelectTemplate", ScriptHelper.GetScript( "function OpenSelectTemplateDialog (selectorId){modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/PageTemplateSelector.aspx") + "?selectorid=' + selectorId + '&selectedPageTemplateId=' + document.getElementById(selectorId + '_hdnTemplateCode').value, 'PageTemplateSelection', '90%', '85%'); return false;} \n" + "function OnSelectPageTemplate(templateID, templateName, selectorId) { if (document.getElementById(selectorId + '_txtTemplate') != null) document.getElementById(selectorId + '_txtTemplate').value = templateName; if (document.getElementById(selectorId + '_hdnTemplateCode') != null) document.getElementById(selectorId + '_hdnTemplateCode').value = templateID; if ((templateName != null)&&(templateName != '')) setTimeout('BTN_Enable(\"' + selectorId + '_btnClear\");', 0);} \n" + "function ClearTemplate(selectorId) { document.getElementById(selectorId + '_txtTemplate').value = ''; document.getElementById(selectorId + '_hdnTemplateCode').value = 0; return false;} \n" )); btnSelect.OnClientClick = "return OpenSelectTemplateDialog('" + this.ClientID + "');"; btnClear.Attributes.Add("onclick", "return ClearTemplate('" + this.ClientID + "');"); btnSelect.Text = GetString("general.select"); btnClear.Text = GetString("general.clear"); }
/// <summary> /// Initializes menu. /// </summary> private void InitializeMenu() { string query = "?identifier=" + Identifier; string url = UrlResolver.ResolveUrl("~/CMSModules/Content/Controls/Dialogs/Selectors/FileSystemSelector/NewFolder.aspx") + query; url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url, false)); btnAdd.ToolTip = GetString("dialogs.actions.newfolder.desc"); btnAdd.OnClientClick = String.Format("modalDialog('{0}', 'NewFolder', 680, 200, null, true); return false;", url); // Delete folder button btnDelete.ToolTip = GetString("media.folder.delete"); btnDelete.OnClientClick = String.Format("if (!confirm({0})) {{ return false; }} ", ScriptHelper.GetLocalizedString("General.ConfirmDelete")); // New folder button WindowHelper.Remove(Identifier); Hashtable props = new Hashtable(); props.Add("targetpath", TargetFolderPath); WindowHelper.Add(Identifier, props); }
/// <summary> /// Loads dataset to windows helper from schema and data xml definitions. /// </summary> /// <param name="xml">XML data</param> /// <param name="schema">XML schema</param> protected DataSet LoadFromXML(string xml, string schema) { // Check whether schema and data are defined if (!String.IsNullOrEmpty(schema) && !String.IsNullOrEmpty(xml)) { //Create data set from xml DataSet ds = new DataSet(); // Load schnema StringReader sr = StringReader.New(schema); ds.ReadXmlSchema(sr); // Load data ds.TryReadXml(xml); // Set current dataset WindowHelper.Add(CurrentGuid().ToString(), ds); return(ds); } return(null); }
/// <summary> /// Initializes selection modal dialog. /// </summary> /// <param name="objectType">Object type</param> /// <param name="cliendId">Client ID</param> private string GetModalDialogUrl(string objectType, string cliendId) { var guid = Guid.NewGuid().ToString(); WindowHelper.Add(guid, new Hashtable { { "AllowAll", false }, { "AllowEmpty", false }, { "AllowDefault", true }, { "LocalizeItems", true }, { "ObjectType", objectType }, { "SelectionMode", SelectionModeEnum.SingleButton }, { "ResourcePrefix", objectType }, { "FilterControl", "~/CMSFormControls/Filters/ObjectFilter.ascx" }, { "CurrentSiteOnly", true } }); var url = URLHelper.GetAbsoluteUrl("~/CMSAdminControls/UI/UniSelector/SelectionDialog.aspx"); url = URLHelper.AddParameterToUrl(url, "clientId", cliendId); url = URLHelper.AddParameterToUrl(url, "params", guid); return(URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url))); }
/// <summary> /// Gets the editing script for the given path and extension /// </summary> /// <param name="path">File path</param> /// <param name="ext">File extension</param> protected string GetEditScript(string path, string ext) { string fileIdentifier = Identifier + path.GetHashCode(); WindowHelper.Remove(fileIdentifier); Hashtable props = new Hashtable(); props.Add("filepath", URLHelper.UnMapPath(path)); WindowHelper.Add(fileIdentifier, props); const string CONTENT_FOLDER = "~/CMSModules/Content/"; if (ImageHelper.IsSupportedByImageEditor(ext)) { // Image editing (image editor) string parameters = String.Format("?identifier={0}&refresh=1", fileIdentifier); string validationHash = QueryHelper.GetHash(parameters); string url = UrlResolver.ResolveUrl(CONTENT_FOLDER + "CMSDesk/Edit/ImageEditor.aspx") + parameters + "&hash=" + validationHash; return(String.Format("modalDialog({0}, 'imageeditor', 905, 670); return false;", ScriptHelper.GetString(url))); } // Text file editing if (FileHelper.IsTextFileExtension(ext)) { // Prepare parameters string parameters = String.Format("?identifier={0}", fileIdentifier); string validationHash = QueryHelper.GetHash(parameters); string url = UrlResolver.ResolveUrl(CONTENT_FOLDER + "Controls/Dialogs/Selectors/FileSystemSelector/EditTextFile.aspx") + parameters + "&hash=" + validationHash; return(String.Format("modalDialog({0}, 'texteditor', 905, 688); return false;", ScriptHelper.GetString(url))); } return(null); }
/// <summary> /// Returns URL for the inner IFrame. /// </summary> private string GetFrameUrl(object nodeIds, object parentAlias, object targetId, object ext, object aliasPath, object multiple, object action, object parameters) { string frameUrl = ResolveUrl("~/CMSModules/Content/Controls/Dialogs/Properties/DocCopyMoveProperites.aspx"); Hashtable properties = new Hashtable(); // Fill properties table properties.Add("sourcenodeids", nodeIds); properties.Add("parentalias", parentAlias); properties.Add("targetid", targetId); properties.Add("ext", ext); properties.Add("aliaspath", aliasPath); properties.Add("multiple", multiple); properties.Add("parameters", parameters); properties.Add("output", CurrentAction); Hashtable param = WindowHelper.GetItem(parameters as string) as Hashtable; if (param != null) { // Transfer parameters to new hashtable for iframe foreach (string key in param.Keys) { properties[key] = param[key]; } } if ((action != null) && (ValidationHelper.GetInteger(targetId, 0) > 0)) { properties.Add("action", action); } WindowHelper.Add(Identifier, properties); frameUrl = URLHelper.AddParameterToUrl(frameUrl, "params", Identifier); frameUrl = URLHelper.AddParameterToUrl(frameUrl, "hash", QueryHelper.GetHash(frameUrl)); return(frameUrl); }
protected void btnOK_Click(object sender, EventArgs e) { // If data are valid if (bfParameters.ValidateData()) { // Fill BasicForm with user data bfParameters.SaveData(null); if (bfParameters.DataRow != null) { int reportID = QueryHelper.GetInteger("ReportID", 0); ReportInfo ri = ReportInfoProvider.GetReportInfo(reportID); if (ri == null) { return; } FormInfo fi = new FormInfo(ri.ReportParameters); DataRow defaultRow = fi.GetDataRow(false); fi.LoadDefaultValues(defaultRow, true); // Load default parameters to items ,where displayed in edit form not checked List <IField> items = fi.ItemsList; foreach (IField item in items) { FormFieldInfo ffi = item as FormFieldInfo; if ((ffi != null) && (!ffi.Visible)) { bfParameters.DataRow[ffi.Name] = defaultRow[ffi.Name]; } } WindowHelper.Add(hdnGuid.Value, bfParameters.DataRow.Table.DataSet); } // Refreshh opener update panel script ltlScript.Text = ScriptHelper.GetScript("wopener.refresh (); CloseDialog()"); } }