/// <summary> /// Displays corresponding tooltip image. /// </summary> private bool DisplayTooltip(HtmlGenericControl image, DataTable dt, string fieldName, string fieldValue, string dataType) { // Single value - not collision if (((!String.IsNullOrEmpty(fieldValue)) && (DataHelper.DataSourceIsEmpty(dt) || ((dt.Rows.Count == 1) && (ValidationHelper.GetString(dt.Rows[0][fieldName], null) == fieldValue)))) || ((String.IsNullOrEmpty(fieldValue) || (((fieldName == "AccountCountryID") || (fieldName == "AccountStateID")) && (ValidationHelper.GetInteger(fieldValue, -1) == 0))) && (dt.Rows.Count == 1))) { ScriptHelper.AppendTooltip(image, FillTooltipData(dt, fieldName, fieldValue, dataType), "help"); image.Attributes["class"] = "validation-success icon-check-circle form-control-icon"; image.Visible = true; } // No data - hide icon else if (String.IsNullOrEmpty(fieldValue) && DataHelper.DataSourceIsEmpty(dt)) { image.Visible = false; } // Multiple values - collision else { ScriptHelper.AppendTooltip(image, FillTooltipData(dt, fieldName, fieldValue, dataType), "help"); image.Attributes["class"] = "validation-warning icon-exclamation-triangle form-control-icon"; image.Visible = true; } image.Style.Add("cursor", "help"); // Reset row filter mMergedAccounts.Tables[0].DefaultView.RowFilter = null; return(image.Visible); }
/// <summary> /// Displays corresponding tooltip image. /// </summary> private bool DisplayTooltip(Image image, DataTable dt, string fieldName, string fieldValue, FormFieldDataTypeEnum dataType) { // Single value - not collision if (((!String.IsNullOrEmpty(fieldValue)) && (DataHelper.DataSourceIsEmpty(dt) || ((dt.Rows.Count == 1) && (ValidationHelper.GetString(dt.Rows[0][fieldName], null) == fieldValue)))) || ((String.IsNullOrEmpty(fieldValue) || (((fieldName == "AccountCountryID") || (fieldName == "AccountStateID")) && (ValidationHelper.GetInteger(fieldValue, -1) == 0))) && (dt.Rows.Count == 1))) { FillTooltipData(image, dt, fieldName, fieldValue, dataType); image.ImageUrl = GetImageUrl("CMSModules/CMS_ContactManagement/resolved.png"); image.Visible = true; } // No data - hide icon else if (String.IsNullOrEmpty(fieldValue) && DataHelper.DataSourceIsEmpty(dt)) { image.Visible = false; } // Multiple values - collision else { FillTooltipData(image, dt, fieldName, fieldValue, dataType); image.ImageUrl = GetImageUrl("CMSModules/CMS_ContactManagement/collision.png"); image.Visible = true; } image.Style.Add("cursor", "help"); ScriptHelper.AppendTooltip(image, image.ToolTip, "help"); // Reset row filter mergedAccounts.Tables[0].DefaultView.RowFilter = null; return(image.Visible); }
private void AddTooltip(string tooltipText, WebControl webControl) { if (webControl != null && !string.IsNullOrEmpty(tooltipText)) { ScriptHelper.AppendTooltip(webControl, tooltipText, null); } }
private void AppendWarning(string message) { HtmlGenericControl image = new HtmlGenericControl("i"); image.Attributes["class"] = "form-control-icon validation-warning icon-exclamation-triangle"; ScriptHelper.AppendTooltip(image, message, "help", 0, true); WarningPlaceHolder.Controls.Add(image); }
protected void Page_Load(object sender, EventArgs e) { ScriptHelper.RegisterTooltip(Page); ScriptHelper.AppendTooltip(iconHelpPageBuilder, GetString("documenttype_edit_features.pagebuilder.tooltip"), null); ScriptHelper.AppendTooltip(iconHelpNavigationItem, GetString("documenttype_edit_features.navigationitem.tooltip"), null); ScriptHelper.AppendTooltip(iconHelpHasUrl, GetString("documenttype_edit_features.url.tooltip"), null); ScriptHelper.AppendTooltip(iconHelpMetadata, GetString("documenttype_edit_features.metadata.tooltip"), null); ScriptHelper.RegisterModule(this, "CMS/PageTypeFeatures", new { highlightSelection = false }); }
/// <summary> /// Displays contact relation which has more than 1 role. /// </summary> private int DisplayRoleCollisions(int contactID, DataSet relations) { DataRow[] drs = relations.Tables[0].Select("ContactID = " + contactID + " AND ContactRoleID > 0", "ContactRoleID"); // Contact is specified more than once if ((drs != null) && (drs.Length > 1)) { // Find out if contact roles are different var roleIDs = new List <int>(); int id; roleIDs.Add(ValidationHelper.GetInteger(drs[0]["ContactRoleID"], 0)); mRoles.Add(drs[0]["ContactID"], drs[0]["ContactRoleID"]); foreach (DataRow dr in drs) { id = ValidationHelper.GetInteger(dr["ContactRoleID"], 0); if (!roleIDs.Contains(id)) { roleIDs.Add(id); } } // Display relation only for contacts with more roles if (roleIDs.Count > 1) { // Display table first part Literal ltl = new Literal(); string contactName = drs[0]["ContactFirstName"] + " " + drs[0]["ContactMiddleName"]; contactName = contactName.Trim() + " " + drs[0]["ContactLastName"]; ltl.Text = "<div class=\"form-group\"><div class=\"editing-form-label-cell\"><span class=\"control-label\">" + HTMLHelper.HTMLEncode(contactName.Trim()) + "</span></div>"; ltl.Text += "<div class=\"editing-form-value-cell\"><div class=\"control-group-inline-forced\">"; plcAccountContact.Controls.Add(ltl); // Display role selector FormEngineUserControl roleSelector = Page.LoadUserControl("~/CMSModules/ContactManagement/FormControls/ContactRoleSelector.ascx") as FormEngineUserControl; roleSelector.SetValue("siteid", mParentAccount.AccountSiteID); plcAccountContact.Controls.Add(roleSelector); mRoleControls.Add(drs[0]["ContactID"], roleSelector); // Display tooltip var img = new HtmlGenericControl("i"); img.Attributes["class"] = "validation-warning icon-exclamation-triangle form-control-icon"; ScriptHelper.AppendTooltip(img, AccountContactTooltip(roleIDs), "help"); plcAccountContact.Controls.Add(img); // Display table last part Literal ltlLast = new Literal(); ltlLast.Text = "</div></div></div>"; plcAccountContact.Controls.Add(ltlLast); return(1); } } return(0); }
private string GetRate(object sender, string rateResourceString, object parameter) { WebControl control = sender as WebControl; if (control != null) { ScriptHelper.AppendTooltip(control, GetString(rateResourceString), null); } return(String.Format(PERCENT_FORMAT, ValidationHelper.GetDouble(parameter, 0))); }
private void AppendError(string message) { Image image = new Image { ToolTip = message, ImageUrl = GetImageUrl("CMSModules/CMS_ContactManagement/error.gif") }; ScriptHelper.AppendTooltip(image, image.ToolTip, "help"); image.Style.Add("cursor", "help"); WarningPlaceHolder.Controls.Add(image); }
private void AppendCompatibilityWarnings(string name, IList <string> warnings) { if (warnings.Count > 0) { string tooltip = GetCompatibilityWarningsHtml(warnings); HtmlGenericControl image = new HtmlGenericControl("i"); image.Attributes["class"] = "form-control-icon validation-warning icon-exclamation-triangle " + String.Format("Warning{0}", name); ScriptHelper.AppendTooltip(image, tooltip, "help", 0, false); image.Style.Add("display", "none"); WarningPlaceHolder.Controls.Add(image); } }
/// <summary> /// Setups control for Gravatar type of user picture. /// </summary> private void SetupControlsForGravatar() { // Hide avatar controls btnDeleteImage.Visible = btnShowGallery.Visible = plcUploader.Visible = false; // Show only UserPicture control pnlAvatarImage.Visible = UserPicture.Visible = imgHelp.Visible = true; // Help icon for Gravatar string tooltip = GetString("avatar.gravatarinfo"); ScriptHelper.AppendTooltip(imgHelp, tooltip, null); imgHelp.ToolTip = tooltip; }
private void AppendCompatibilityWarnings(string name, IList <string> warnings) { if (warnings.Count > 0) { Image image = new Image { ToolTip = GetCompatibilityWarningsHtml(name, warnings), ImageUrl = GetImageUrl("CMSModules/CMS_ContactManagement/collision.png"), CssClass = String.Format("Warning{0}", name) }; ScriptHelper.AppendTooltip(image, image.ToolTip, "help"); image.Style.Add("cursor", "help"); image.Style.Add("display", "none"); WarningPlaceHolder.Controls.Add(image); } }
protected void Page_Load(object sender, EventArgs e) { InitializeControls(); // Register scripts for currency change ScriptHelper.RegisterDialogScript(this); // Append tooltip string tooltip = GetString("com.maincurrencytooltip"); ScriptHelper.AppendTooltip(lblCurrentMainCurrency, tooltip, null); icoHelp.ToolTip = tooltip; // Display info message when main currency saved if (QueryHelper.GetBoolean("currencysaved", false)) { ShowInformation(GetString("com.storesettings.maincurrencychanged")); } }
private void InitChart() { lblChartHeading.Text = String.Format(GetString("ma.automationprocess.analytics.chart.heading"), NumberOfAllContacts); if (Process.WorkflowRecurrenceType != ProcessRecurrenceTypeEnum.NonRecurring && NumberOfAllContacts > 0) { iconHelp.Visible = true; ScriptHelper.RegisterTooltip(this); ScriptHelper.AppendTooltip(iconHelp, String.Format(GetString("ma.automationprocess.analytics.chart.heading.info"), NumberOfUniqueContacts), null); } ScriptHelper.RegisterModule(Page, "CMS.OnlineMarketing/Process/ProcessContactsChart", new { chartElement = pnlChart.ClientID, data = GetChartData() }); pnlUpdateChart.Update(); }
/// <summary> /// Gets <c>Label</c> instance for the input <c>SettingsKeyInfo</c> object. /// </summary> /// <param name="settingsKey"><c>SettingsKeyInfo</c> instance</param> /// <param name="inputControl">Input control associated to the label</param> /// <param name="groupNo">Number representing index of the processing settings group</param> /// <param name="keyNo">Number representing index of the processing SettingsKeyInfo</param> private Label GetLabel(SettingsKeyInfo settingsKey, Control inputControl, int groupNo, int keyNo) { LocalizedLabel label = new LocalizedLabel { EnableViewState = false, ID = string.Format(@"lblDispName{0}{1}", groupNo, keyNo), CssClass = "control-label editing-form-label", Text = HTMLHelper.HTMLEncode(settingsKey.KeyDisplayName), DisplayColon = true }; if (inputControl != null) { label.AssociatedControlID = inputControl.ID; } ScriptHelper.AppendTooltip(label, ResHelper.LocalizeString(settingsKey.KeyDescription), null); return(label); }
protected void Page_Load(object sender, EventArgs e) { CheckPermissions(); InitializeControls(); RegisterClientScripts(); // Register custom info message handler this.SettingsGroupViewer.OnInfoMessageChanged += new CMSModules_Settings_Controls_SettingsGroupViewer.InfoMessageChangedHandler(SettingsGroupViewer_OnInfoMessageChanged); // Init label for accessibility this.lblHdnChangeCurrency.Text = GetString("general.change"); this.lblHdnChangeCurrency.Style["display"] = "none"; // Append tooltip ScriptHelper.AppendTooltip(this.lblCurrentMainCurrency, GetString("com.maincurrencytooltip"), "help"); // Display info message when main currency saved if (QueryHelper.GetBoolean("currencysaved", false)) { this.lblInfo.Visible = true; this.lblInfo.Text = GetString("com.storesettings.maincurrencychanged");; } }
protected void Page_Load(object sender, EventArgs e) { InitializeControls(); // Register scripts for saving document by shortcut ScriptHelper.RegisterSaveShortcut(this, "save", null); // Register scripts for currency change ScriptHelper.RegisterDialogScript(this); // Init label for accessibility lblHdnChangeCurrency.Text = GetString("general.change"); lblHdnChangeCurrency.Style["display"] = "none"; // Append tooltip ScriptHelper.AppendTooltip(lblCurrentMainCurrency, GetString("com.maincurrencytooltip"), "help"); // Display info message when main currency saved if (QueryHelper.GetBoolean("currencysaved", false)) { ShowInformation(GetString("com.storesettings.maincurrencychanged")); } }
private string GetRate(object sender, string rateName, object rateValue) { string rateTooltip = String.Empty; switch (rateName.ToLowerCSafe()) { case "clickrate": rateTooltip = GetString(mMonitorBouncedEmails ? "newsletter.clickratetooltip.delivered" : "newsletter.clickratetooltip.sent"); break; case "deliveryrate": rateTooltip = GetString("newsletter.deliveryratetooltip"); break; case "openrate": rateTooltip = GetString(mMonitorBouncedEmails ? "newsletter.openratetooltip.delivered" : "newsletter.openratetooltip.sent"); break; case "bouncerate": rateTooltip = GetString("newsletter.bounceratetooltip"); break; case "unsubscriptionrate": rateTooltip = GetString(mMonitorBouncedEmails ? "newsletter.unsubscriptionratetooltip.delivered" : "newsletter.unsubscriptionratetooltip.sent"); break; } WebControl control = sender as WebControl; if (control != null) { ScriptHelper.AppendTooltip(control, rateTooltip, null); } return(String.Format(PERCENT_FORMAT, ValidationHelper.GetDouble(rateValue, 0))); }
/// <summary> /// Displays contact relation which has more than 1 role. /// </summary> private int DisplayRoleCollisions(int contactID, DataSet relations) { DataRow[] drs = relations.Tables[0].Select("ContactID = " + contactID + " AND ContactRoleID > 0", "ContactRoleID"); // Contact is specified more than once if ((drs != null) && (drs.Length > 1)) { // Find out if contact roles are different ArrayList roleIDs = new ArrayList(); int id; roleIDs.Add(ValidationHelper.GetInteger(drs[0]["ContactRoleID"], 0)); roles.Add(drs[0]["ContactID"], drs[0]["ContactRoleID"]); foreach (DataRow dr in drs) { id = ValidationHelper.GetInteger(dr["ContactRoleID"], 0); if (!roleIDs.Contains(id)) { roleIDs.Add(id); } } // Display relation only for contacts with more roles if (roleIDs.Count > 1) { // Display table first part Literal ltl = new Literal(); string contactName = drs[0]["ContactFirstName"] + " " + drs[0]["ContactMiddleName"]; contactName = contactName.Trim() + " " + drs[0]["ContactLastName"]; ltl.Text = "<tr class=\"CollisionRow\"><td>" + contactName.Trim() + "</td>"; ltl.Text += "<td class=\"ComboBoxColumn\"><div class=\"ComboBox\">"; plcAccountContact.Controls.Add(ltl); // Display role selector FormEngineUserControl roleSelector = Page.LoadControl("~/CMSModules/ContactManagement/FormControls/ContactRoleSelector.ascx") as FormEngineUserControl; roleSelector.SetValue("siteid", parentAccount.AccountSiteID); plcAccountContact.Controls.Add(roleSelector); roleControls.Add(drs[0]["ContactID"], roleSelector); // Display table middle part Literal ltlMiddle = new Literal(); ltlMiddle.Text = "</div></td><td>"; plcAccountContact.Controls.Add(ltlMiddle); // Display icon with tooltip Image imgTooltip = new Image(); AccountContactTooltip(imgTooltip, roleIDs); imgTooltip.ImageUrl = GetImageUrl("CMSModules/CMS_ContactManagement/collision.png"); imgTooltip.Style.Add("cursor", "help"); ScriptHelper.AppendTooltip(imgTooltip, imgTooltip.ToolTip, "help"); plcAccountContact.Controls.Add(imgTooltip); // Display table last part Literal ltlLast = new Literal(); ltlLast.Text = "</td></tr>"; plcAccountContact.Controls.Add(ltlLast); return(1); } } return(0); }
protected void Page_Load(object sender, EventArgs e) { // Set class txtPassword.CssClass = TextBoxClass; if (ShowStrengthIndicator) { string tooltipMessage = string.Empty; StringBuilder sb = new StringBuilder(); if (UsePasswordPolicy) { sb.Append(GetString("passwordstrength.notacceptable"), ";", GetString("passwordstrength.weak")); tooltipMessage = string.Format(GetString("passwordstrength.hint"), MinLength, MinNonAlphaNumChars, PreferedLength, PreferedNonAlphaNumChars); } else { sb.Append(GetString("passwordstrength.weak"), ";", GetString("passwordstrength.weak")); tooltipMessage = string.Format(GetString("passwordstrength.recommend"), PreferedLength, PreferedNonAlphaNumChars); } // Register jQuery and registration of script which shows password strength ScriptHelper.RegisterJQuery(Page); ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/membership.js"); sb.Append(";", GetString("passwordstrength.acceptable"), ";", GetString("passwordstrength.average"), ";", GetString("passwordstrength.strong"), ";", GetString("passwordstrength.excellent")); string regex = "''"; if (!string.IsNullOrEmpty(RegularExpression)) { regex = "/" + RegularExpression + "/"; } // Javascript for calling js function on keyup of textbox string txtVar = "txtSearch_" + txtPassword.ClientID; string script = txtVar + " = $j('#" + txtPassword.ClientID + @"'); if (" + txtVar + @" ) { " + txtVar + @".keyup(function(event){ ShowStrength('" + txtPassword.ClientID + "', '" + MinLength + "', '" + PreferedLength + "', '" + MinNonAlphaNumChars + "', '" + PreferedNonAlphaNumChars + "', " + regex + ", '" + lblEvaluation.ClientID + "', '" + sb.ToString() + "', '" + ClassPrefix + "', '" + UsePasswordPolicy + "', '" + pnlPasswIndicator.ClientID + "', '" + UseStylesForStrenghtIndicator + @"'); }); }"; ScriptHelper.RegisterStartupScript(this, typeof(string), "PasswordStrength_" + txtPassword.ClientID, ScriptHelper.GetScript(script)); if (UseStylesForStrenghtIndicator) { pnlPasswStrengthIndicator.Style.Add("height", "5px"); pnlPasswStrengthIndicator.Style.Add("background-color", "#dddddd"); pnlPasswIndicator.Style.Add("height", "5px"); } ScriptHelper.RegisterTooltip(Page); ScriptHelper.AppendTooltip(lblPasswStregth, tooltipMessage, "help"); } else { pnlPasswStrengthIndicator.Visible = false; lblEvaluation.Visible = false; lblPasswStregth.Visible = false; } // Set up required field validator if (AllowEmpty) { rfvPassword.Enabled = false; } else { rfvPassword.Text = GetString("general.requirespassword"); rfvPassword.ValidationGroup = ValidationGroup; if (ShowValidationOnNewLine) { rfvPassword.Text += "<br />"; } } }
/// <summary> /// Page load. /// </summary> protected void Page_Load(object sender, EventArgs e) { string aType = SetMode(avValue); picUser.UserAvatarType = aType; switch (aType) { case AvatarInfoProvider.AVATAR: // Get resource strings lblUploader.Text = GetString("filelist.btnupload") + ResHelper.Colon; // Setup delete image properties btnDeleteImage.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/delete.png"); btnDeleteImage.OnClientClick = "return deleteAvatar('" + hiddenDeleteAvatar.ClientID + "', '" + hiddenAvatarGuid.ClientID + "', '" + pnlAvatarImage.ClientID + "' );"; btnDeleteImage.ToolTip = GetString("general.delete"); btnDeleteImage.AlternateText = btnDeleteImage.ToolTip; // Setup show gallery button btnShowGallery.Text = GetString("avat.selector.select"); btnShowGallery.Visible = SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSEnableDefaultAvatars"); // Register dialog script string resolvedAvatarsPage = string.Empty; if (IsLiveSite) { if (CMSContext.CurrentUser.IsAuthenticated()) { resolvedAvatarsPage = CMSContext.ResolveDialogUrl("~/CMSModules/Avatars/CMSPages/AvatarsGallery.aspx"); } else { resolvedAvatarsPage = CMSContext.ResolveDialogUrl("~/CMSModules/Avatars/CMSPages/PublicAvatarsGallery.aspx"); } } else { resolvedAvatarsPage = ResolveUrl("~/CMSModules/Avatars/Dialogs/AvatarsGallery.aspx"); } ScriptHelper.RegisterDialogScript(Page); ControlsHelper.RegisterClientScriptBlock(this, Page, typeof(string), "SelectAvatar", ScriptHelper.GetScript("function SelectAvatar(avatarType, clientId) { " + "modalDialog('" + resolvedAvatarsPage + "?avatartype=' + avatarType + '&clientid=' + clientId, 'permissionDialog', 600, 270); return false;}")); ltlScript.Text = ScriptHelper.GetScript("function UpdateForm(){ ; } \n "); // Setup btnShowGallery action btnShowGallery.Attributes.Add("onclick", "SelectAvatar('" + AvatarInfoProvider.GetAvatarTypeString(avatarType) + "', '" + ClientID + "'); return false;"); // Get image size param(s) for preview string sizeParams = string.Empty; // Keep aspect ratio is set - property was set directly or indirectly by max side size property. if (KeepAspectRatio) { sizeParams += "&maxsidesize=" + (MaxPictureWidth > MaxPictureHeight ? MaxPictureWidth : MaxPictureHeight); } else { sizeParams += "&width=" + MaxPictureWidth + "&height=" + MaxPictureHeight; } // JavaScript which creates selected image preview and saves image guid to hidden field string getAvatarPath = ResolveUrl("~/CMSModules/Avatars/CMSPages/GetAvatar.aspx"); string updateHiddenScript = ScriptHelper.GetScript("function " + ClientID + "updateHidden(guidPrefix, clientId)" + "{" + "if ( clientId == '" + ClientID + "')" + "{" + "avatarGuid = guidPrefix.substring(4);" + "if ( avatarGuid != '')" + "{" + "hidden = document.getElementById('" + hiddenAvatarGuid.ClientID + "');" + "hidden.value = avatarGuid ;" + "div = document.getElementById('" + pnlPreview.ClientID + "');" + "div.style.display='';" + "div.innerHTML = '<img src=\"" + getAvatarPath + "?avatarguid=" + "'+ avatarGuid + '" + sizeParams + "\" />" + " <img src=\"" + btnDeleteImage.ImageUrl + "\" border=\"0\" onclick=\"deleteImagePreview(\\'" + hiddenAvatarGuid.ClientID + "\\',\\'" + pnlPreview.ClientID + "\\')\" style=\"cursor:pointer\"/>';" + "placeholder = document.getElementById('" + pnlAvatarImage.ClientID + "');" + "if ( placeholder != null)" + "{" + "placeholder.style.display='none';" + "}" + "}" + "}" + "}"); ControlsHelper.RegisterClientScriptBlock(this, Page, typeof(string), ClientID + "updateHidden", updateHiddenScript); // JavaScript which deletes image preview string deleteImagePreviewScript = ScriptHelper.GetScript("function deleteImagePreview(hiddenId, divId)" + "{" + "if( confirm(" + ScriptHelper.GetString(GetString("myprofile.pictdeleteconfirm")) + "))" + "{" + "hidden = document.getElementById(hiddenId);" + "hidden.value = '' ;" + "div = document.getElementById(divId);" + "div.style.display='none';" + "div.innerHTML = ''; " + "}" + "}"); ControlsHelper.RegisterClientScriptBlock(this, Page, typeof(string), "deleteImagePreviewScript", deleteImagePreviewScript); // JavaScript which pseudo deletes avatar string deleteAvatarScript = ScriptHelper.GetScript("function deleteAvatar(hiddenDeleteId, hiddenGuidId, placeholderId)" + "{" + "if( confirm(" + ScriptHelper.GetString(GetString("myprofile.pictdeleteconfirm")) + "))" + "{" + "hidden = document.getElementById(hiddenDeleteId);" + "hidden.value = 'true' ;" + "placeholder = document.getElementById(placeholderId);" + "placeholder.style.display='none';" + "hidden = document.getElementById(hiddenGuidId);" + "hidden.value = '' ;" + "}" + "return false; " + "}"); ControlsHelper.RegisterClientScriptBlock(this, Page, typeof(string), "deleteAvatar", deleteAvatarScript); // Try to load avatar either on first load or when it is first attempt to load an avatar if ((UserInfo == null) && (!RequestHelper.IsPostBack() || !AvatarAlreadyLoaded) && (avatarID != 0)) { AvatarAlreadyLoaded = true; pnlAvatarImage.Visible = true; picUser.AvatarID = avatarID; } btnDeleteImage.Visible = ((avatarID > 0) || ((UserInfo != null) && (UserInfo.UserAvatarID > 0))); plcUploader.Visible = true; imgHelp.Visible = false; break; case AvatarInfoProvider.GRAVATAR: // Hide avatar controls btnDeleteImage.Visible = false; btnShowGallery.Visible = false; plcUploader.Visible = false; // Help icon for Gravatar ScriptHelper.RegisterTooltip(Page); imgHelp.ImageUrl = GetImageUrl("CMSModules/CMS_Settings/help.png"); imgHelp.Attributes.Add("alt", ""); ScriptHelper.AppendTooltip(imgHelp, GetString("avatar.gravatarinfo"), null); // Show only UserPicture control pnlAvatarImage.Visible = true; picUser.Visible = true; imgHelp.Visible = true; break; } }
/// <summary> /// Handles the UniGrid's OnExternalDataBound event. /// </summary> /// <param name="sender">The sender</param> /// <param name="sourceName">Name of the source</param> /// <param name="parameter">The data row</param> /// <returns>Formatted value to be used in the UniGrid</returns> protected object UniGrid_OnExternalDataBound(object sender, string sourceName, object parameter) { string tooltipText = null; var webControl = sender as WebControl; // Prepare a tooltip for the column switch (sourceName.ToLowerCSafe()) { case "issueopenedemails": tooltipText = GetString(mBounceMonitoringEnabled ? "newsletter.openratetooltip.delivered" : "newsletter.openratetooltip.sent"); break; case "issueclickedlinks": tooltipText = GetString(mBounceMonitoringEnabled ? "newsletter.clickratetooltip.delivered" : "newsletter.clickratetooltip.sent"); break; case "deliveryrate": tooltipText = GetString("newsletter.deliveryratetooltip"); break; case "unsubscriberate": tooltipText = GetString(mBounceMonitoringEnabled ? "newsletter.unsubscriptionratetooltip.delivered" : "newsletter.unsubscriptionratetooltip.sent"); break; default: break; } // If the sender is from a column with a tooltip, append tooltip to the control if ((webControl != null) && !String.IsNullOrEmpty(tooltipText)) { ScriptHelper.AppendTooltip(webControl, tooltipText, null); } switch (sourceName.ToLowerCSafe()) { case "issuesubject": return(GetIssueSubject(parameter as DataRowView)); case "issuestatus": IssueStatusEnum status = EnumHelper.GetDefaultValue <IssueStatusEnum>(); var statusID = ValidationHelper.GetInteger(parameter, -1); if (Enum.IsDefined(typeof(IssueStatusEnum), statusID)) { status = (IssueStatusEnum)statusID; } return(IssueHelper.GetStatusFriendlyName(status, null)); case "issuesentemails": var num = ValidationHelper.GetInteger(parameter, 0); return((num > 0) ? num.ToString() : String.Empty); case "issueopenedemails": return(GetOpenedEmails(parameter as DataRowView)); case "issueclickedlinks": return(GetClickRate(parameter as DataRowView)); case "deliveryrate": return(GetDeliveryRate(parameter as DataRowView)); case "unsubscriberate": return(GetUnsubscriptionRate(parameter as DataRowView)); default: return(parameter); } }
/// <summary> /// Saves modified image data. /// </summary> /// <param name="name">Image name</param> /// <param name="extension">Image extension</param> /// <param name="mimetype">Image mimetype</param> /// <param name="title">Image title</param> /// <param name="description">Image description</param> /// <param name="binary">Image binary data</param> /// <param name="width">Image width</param> /// <param name="height">Image height</param> private void SaveImage(string name, string extension, string mimetype, string title, string description, byte[] binary, int width, int height) { // Process media file if (mfi == null) { mfi = MediaFileInfoProvider.GetMediaFileInfo(mediafileGuid, CurrentSiteName); } if (mfi != null) { MediaLibraryInfo mli = MediaLibraryInfoProvider.GetMediaLibraryInfo(mfi.FileLibraryID); if (mli != null) { string path = Path.GetDirectoryName(DirectoryHelper.CombinePath(MediaLibraryInfoProvider.GetMediaLibraryFolderPath(mli.LibraryID), mfi.FilePath)); bool permissionsOK = DirectoryHelper.CheckPermissions(path, false, true, true, true); // Check file write permissions FileInfo file = FileInfo.New(MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath)); if (file != null) { permissionsOK = permissionsOK && !file.IsReadOnly; } if (permissionsOK) { MediaFileInfo originalMfi = mfi.Clone(true); try { // Ensure object version SynchronizationHelper.EnsureObjectVersion(mfi); if (isPreview && !String.IsNullOrEmpty(PreviewPath)) { SiteInfo si = SiteInfoProvider.GetSiteInfo(mfi.FileSiteID); if (si != null) { string previewExt = (!String.IsNullOrEmpty(extension) && (extension != OldPreviewExt)) ? extension : OldPreviewExt; string previewName = Path.GetFileNameWithoutExtension(PreviewPath); string previewFolder = MediaLibraryHelper.EnsurePath(DirectoryHelper.CombinePath(Path.GetDirectoryName(mfi.FilePath).TrimEnd('/'), MediaLibraryHelper.GetMediaFileHiddenFolder(si.SiteName))); // Delete old preview files with thumbnails MediaFileInfoProvider.DeleteMediaFilePreview(CMSContext.CurrentSiteName, mli.LibraryID, mfi.FilePath, false); MediaFileInfoProvider.DeleteMediaFilePreviewThumbnails(mfi); // Save preview file MediaFileInfoProvider.SaveFileToDisk(si.SiteName, mli.LibraryFolder, previewFolder, previewName, previewExt, mfi.FileGUID, binary, false, false); // Log synchronization task SynchronizationHelper.LogObjectChange(mfi, TaskTypeEnum.UpdateObject); } } else { string newExt = null; string newName = null; if (!String.IsNullOrEmpty(extension)) { newExt = extension; } if (!String.IsNullOrEmpty(mimetype)) { mfi.FileMimeType = mimetype; } mfi.FileTitle = title; mfi.FileDescription = description; if (width > 0) { mfi.FileImageWidth = width; } if (height > 0) { mfi.FileImageHeight = height; } if (binary != null) { mfi.FileBinary = binary; mfi.FileSize = binary.Length; } // Test all parameters to empty values and update new value if available if (!String.IsNullOrEmpty(name)) { newName = name; } // If filename changed move preview file and remove all ald thumbnails if ((!String.IsNullOrEmpty(newName) && (mfi.FileName != newName)) || (!String.IsNullOrEmpty(newExt) && (mfi.FileExtension.ToLowerCSafe() != newExt.ToLowerCSafe()))) { SiteInfo si = SiteInfoProvider.GetSiteInfo(mfi.FileSiteID); if (si != null) { string fileName = (newName != null ? newName : mfi.FileName); string fileExt = (newExt != null ? newExt : mfi.FileExtension); string newPath = MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, DirectoryHelper.CombinePath(Path.GetDirectoryName(mfi.FilePath), fileName) + fileExt); string filePath = MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath); // Rename file only if file with same name does not exsists if (!File.Exists(newPath)) { // Ensure max length of file path if (newPath.Length < 260) { // Remove old thumbnails MediaFileInfoProvider.DeleteMediaFileThumbnails(mfi); MediaFileInfoProvider.DeleteMediaFilePreviewThumbnails(mfi); // Move media file MediaFileInfoProvider.MoveMediaFile(si.SiteName, mli.LibraryID, mfi.FilePath, DirectoryHelper.CombinePath(Path.GetDirectoryName(mfi.FilePath), fileName) + fileExt, false); // Set new file name or extension mfi.FileName = fileName; mfi.FileExtension = fileExt; // Ensure new binary if (binary != null) { mfi.FileBinary = binary; mfi.FileSize = binary.Length; } } else { throw new IOExceptions.PathTooLongException(); } } else { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.fileexists"; SavingFailed = true; return; } } } else { // Remove old thumbnails MediaFileInfoProvider.DeleteMediaFileThumbnails(mfi); // Remove original media file before save string filePath = MediaFileInfoProvider.GetMediaFilePath(mfi.FileLibraryID, mfi.FilePath); if (File.Exists(filePath)) { File.Delete(filePath); } } // Save new data MediaFileInfoProvider.SetMediaFileInfo(mfi, false); } } catch (Exception e) { // Log exception EventLogProvider ev = new EventLogProvider(); ev.LogEvent("ImageEditor", "Save file", e); baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.processing"; ScriptHelper.AppendTooltip(baseImageEditor.LblLoadFailed, e.Message, "help"); SavingFailed = true; // Save original media file info MediaFileInfoProvider.SetMediaFileInfo(originalMfi, false); } } else // User hasn't permissions for save file { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.filesystempermissions"; SavingFailed = true; } } } }
private void ReloadData() { if (Node != null) { // Hide parts which are not relevant to content only nodes if (ShowContentOnlyProperties) { pnlUIAdvanced.Visible = false; pnlUICache.Visible = false; pnlUIDesign.Visible = false; plcPermanent.Visible = false; pnlUIOnlineMarketing.Visible = false; } // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool?logVisit = Node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); if (Node.NodeParentID > 0) // Init "inherit" option for child nodes (and hide option for root) { chkPageVisitInherit.Checked = (logVisit == null); if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; } // Check modify permission canEdit = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show document group owner selector if (ModuleEntryManager.IsModuleLoaded(ModuleName.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize panel content Panel rowWrapperPanel = new Panel(); rowWrapperPanel.CssClass = "form-group"; Panel lblPanel = new Panel(); lblPanel.CssClass = "editing-form-label-cell"; Panel ctrlPanel = new Panel(); ctrlPanel.CssClass = "editing-form-value-cell"; // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; lblOwnerGroup.CssClass = "control-label"; lblPanel.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = pnlUIOwner.IsHidden; ctrlPanel.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(Node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", SiteContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", Node.NodeID); // Add controls to containers rowWrapperPanel.Controls.Add(lblPanel); rowWrapperPanel.Controls.Add(ctrlPanel); plcOwnerGroup.Controls.Add(rowWrapperPanel); plcOwnerGroup.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(Node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClassInfo(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); // URL if (plcPermanent.Visible) { string permanentUrl = DocumentURLProvider.GetPermanentDocUrl(Node.NodeGUID, Node.NodeAlias, Node.NodeSiteName, extension: ".aspx"); permanentUrl = URLHelper.ResolveUrl(permanentUrl); lnkPermanentURL.HRef = permanentUrl; lnkPermanentURL.InnerText = permanentUrl; } string liveUrl = DocumentURLProvider.GetAbsoluteLiveSiteURL(Node); lnkLiveURL.HRef = liveUrl; lnkLiveURL.InnerText = liveUrl; bool isRoot = Node.IsRoot(); // Hide preview URL for root node if (!isRoot) { plcPreview.Visible = true; btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm(" + ScriptHelper.GetLocalizedString("GeneralProperties.GeneratePreviewURLConf") + ")){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); if (Node.IsPublished) { lblPublished.Text = GetString("General.Yes"); lblPublished.CssClass += " DocumentPublishedYes"; } else { lblPublished.CssClass += " DocumentPublishedNo"; lblPublished.Text = GetString("General.No"); } // Load page info for inherited cache settings currentPage = PageInfoProvider.GetPageInfo(Node.NodeSiteName, Node.NodeAliasPath, Node.DocumentCulture, null, Node.NodeID, false); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; radFSInherit.Visible = false; chkCssStyle.Visible = false; } else { // Show what is inherited value radInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeCacheMinutes") + ")"; radFSInherit.Text = GetString("GeneralProperties.radInherit") + " (" + GetInheritedCacheCaption("NodeAllowCacheInFileSystem") + ")"; } string cacheMinutes = ""; switch (Node.NodeCacheMinutes) { case null: // Cache setting is inherited { radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; if (!isRoot) { radInherit.Checked = true; radNo.Checked = false; if ((currentPage != null) && (currentPage.NodeCacheMinutes > 0)) { cacheMinutes = currentPage.NodeCacheMinutes.ToString(); } } } break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; cacheMinutes = Node.NodeCacheMinutes.ToString(); break; } // Set secured radio buttons switch (Node.NodeAllowCacheInFileSystem) { case false: radFSNo.Checked = true; break; case true: radFSYes.Checked = true; break; default: if (!isRoot) { radFSInherit.Checked = true; } else { radFSYes.Checked = true; } break; } txtCacheMinutes.Text = cacheMinutes; if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } var defaultStylesheet = GetDefaultStylesheet(); if (Node.DocumentInheritsStylesheet && !isRoot) { chkCssStyle.Checked = true; // Get stylesheet from the parent node string value = GetStylesheetParentValue(); ctrlSiteSelectStyleSheet.Value = String.IsNullOrEmpty(value) ? defaultStylesheet : value; } else { // Get stylesheet from the current node var stylesheetId = Node.DocumentStylesheetID; ctrlSiteSelectStyleSheet.Value = (stylesheetId == 0) ? defaultStylesheet : stylesheetId.ToString(); } } // Disable new button if document inherit stylesheet bool disableCssSelector = (!isRoot && chkCssStyle.Checked); ctrlSiteSelectStyleSheet.Enabled = !disableCssSelector; ctrlSiteSelectStyleSheet.ButtonNewEnabled = !disableCssSelector; // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (Node.DocumentRatings > 0) { rating = Node.DocumentRatingValue / Node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = Node.DocumentID; plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; if (!canEdit) { // Disable form editing DisableFormEditing(); } } else { btnResetRating.Visible = false; } }
private void ReloadData() { if (Node != null) { // Check modify permission canEdit = (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } txtAlias.Text = Node.NodeAlias; chkExcludeFromSearch.Checked = Node.DocumentSearchExcluded; } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClassInfo(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetUTCLongStringOffset(usedTimeZone), "help"); lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfo.Provider.Get(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); if (Node.IsPublished) { lblPublished.Text = GetString("General.Yes"); lblPublished.CssClass += " DocumentPublishedYes"; } else { lblPublished.CssClass += " DocumentPublishedNo"; lblPublished.Text = GetString("General.No"); } if (!canEdit) { // Disable form editing DisableFormEditing(); } } }
protected void Page_Load(Object sender, EventArgs e) { // Get parameters selDate = QueryHelper.GetString("selDate", ""); allowEmpty = QueryHelper.GetBoolean("allowempty", false); editTime = QueryHelper.GetBoolean("editTime", false); controlId = QueryHelper.GetText("controlid", ""); SetBrowserClass(); ScriptHelper.RegisterTooltip(Page); // Disable caching Response.Cache.SetCacheability(HttpCacheability.NoCache); pagetitle = GetString("Calendar.Title"); // Fill in the dropdown values if (drpHours.Items.Count == 0) { FillNumbers(drpHours, 0, 23); } if (drpMinutes.Items.Count == 0) { FillNumbers(drpMinutes, 0, 59); } if (drpSeconds.Items.Count == 0) { FillNumbers(drpSeconds, 0, 59); } // Fill in the month selector if (drpMonth.Items.Count == 0) { FillMonths(drpMonth, mCulture); } // Setup the buttons btnCancel.Text = GetString("general.cancel"); btnCancel.Attributes.Add("onclick", "return CloseDialog();"); if (editTime) { btnNow.Text = GetString("Calendar.Now"); } else { btnNow.Text = GetString("Calendar.Today"); } btnOk.Text = GetString("general.ok"); btnNA.Text = GetString("general.na"); btnNA.Attributes.Add("onclick", "CloseWindow(" + ScriptHelper.GetString(controlId) + ", ''); return false;"); if (!RequestHelper.IsPostBack()) { DateTime now = TimeZoneHelper.GetUserDateTime(MembershipContext.AuthenticatedUser); // Selected date if (selDate == "") { SetTime(now, true); } else { SetTime(ValidationHelper.GetDateTime(selDate, now), true); } // Allow empty ? if (!allowEmpty) { btnNA.Visible = false; } else { btnNA.Visible = true; } // Edit time ? if (editTime) { pnlTime.Visible = true; } else { pnlTime.Visible = false; } } // Display time zone in form 'GMT+1:00' int timeZoneId = QueryHelper.GetInteger("timezoneid", 0); if (timeZoneId > 0) { TimeZoneInfo tzi = TimeZoneInfoProvider.GetTimeZoneInfo(timeZoneId); if (tzi != null) { lblGMTShift.Visible = true; lblGMTShift.Text = TimeZoneHelper.GetUTCStringOffset(tzi); ScriptHelper.AppendTooltip(lblGMTShift, TimeZoneHelper.GetUTCLongStringOffset(tzi), "help"); } } // Next and previous month images calDate.NextMonthText = "<img src=\"" + GetImageUrl("Design/Controls/Calendar/next.png") + "\" />"; calDate.PrevMonthText = "<img src=\"" + GetImageUrl("Design/Controls/Calendar/previous.png") + "\" />"; RegisterModalPageScripts(); RegisterEscScript(); }
protected void Page_Load(Object sender, EventArgs e) { currentSite = SiteContext.CurrentSite; currentUser = MembershipContext.AuthenticatedUser; ipAddress = RequestContext.UserHostAddress; currentUrl = RequestContext.RawURL; if (!RequestHelper.IsCallback()) { pnlLog.Visible = false; pnlPageContent.Visible = true; // Gets the node if (Node != null) { // Check license if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty) { if (!LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.DocumentLevelPermissions)) { if (LicenseHelper.IsUnavailableUIHidden()) { plcContainer.Visible = false; } else { pnlPermissions.Visible = false; lblLicenseInfo.Visible = true; lblLicenseInfo.Text = GetString("Security.NotAvailableInThisEdition"); } } } // Register scripts ScriptHelper.RegisterDialogScript(this); // Check if document inherits permissions and display info inheritsPermissions = AclInfoProvider.DoesNodeInheritPermissions(Node); lblInheritanceInfo.Text = inheritsPermissions ? GetString("Security.InheritsInfo.Inherits") : GetString("Security.InheritsInfo.DoesNotInherit"); if (!RequestHelper.IsPostBack()) { SetupAccess(); } // Hide link to the inheritance settings if this is the root node if (Node.NodeParentID == 0) { plcAuthParent.Visible = false; lnkInheritance.Visible = false; } else { // Add parent caption radParent.Text = GetString("Security.Parent") + " (" + GetInheritedAccessCaption("IsSecuredNode") + ")"; } } else { pnlPageContent.Visible = false; } } ctlAsyncLog.OnFinished += ctlAsyncLog_OnFinished; ctlAsyncLog.OnError += ctlAsyncLog_OnError; ctlAsyncLog.OnCancel += ctlAsyncLog_OnCancel; pnlPageContent.Enabled = !DocumentManager.ProcessingAction; InitializeBackButton(); ScriptHelper.RegisterTooltip(Page); ScriptHelper.AppendTooltip(iconHelp, GetString("security.access.tooltip"), null); }
/// <summary> /// Handles the UniGrid's OnExternalDataBound event. /// </summary> /// <param name="sender">The sender</param> /// <param name="sourceName">Name of the source</param> /// <param name="parameter">The data row</param> /// <returns>Formatted value to be used in the UniGrid</returns> private object UniGrid_OnExternalDataBound(object sender, string sourceName, object parameter) { var webControl = sender as WebControl; // Prepare a tooltip for the column string tooltipText = GetTooltipText(sourceName); // If the sender is from a column with a tooltip, append tooltip to the control if ((webControl != null) && !String.IsNullOrEmpty(tooltipText)) { ScriptHelper.AppendTooltip(webControl, tooltipText, null); } switch (sourceName.ToLowerInvariant()) { case "issuedisplayname": return(GetIssueDisplayName(parameter as DataRowView)); case "issuestatus": IssueStatusEnum status = EnumHelper.GetDefaultValue <IssueStatusEnum>(); var statusID = ValidationHelper.GetInteger(parameter, -1); if (Enum.IsDefined(typeof(IssueStatusEnum), statusID)) { status = (IssueStatusEnum)statusID; } return(IssueHelper.GetStatusFriendlyName(status, null)); case "issuesentemails": var num = ValidationHelper.GetInteger(parameter, 0); return((num > 0) ? num.ToString() : String.Empty); case "issueopenedemailsrate": return(GetOpenedEmailsRate(parameter as DataRowView)); case "issueopenedemails": return(GetOpenedEmailsCount(parameter as DataRowView)); case "issueclickedlinksrate": return(GetClickRate(parameter as DataRowView)); case "issueclickedlinks": return(GetClickCount(parameter as DataRowView)); case "deliveryrate": return(GetDeliveryRate(parameter as DataRowView)); case "delivered": return(GetDeliveryCount(parameter as DataRowView)); case "unsubscriberate": return(GetUnsubscriptionRate(parameter as DataRowView)); case "unsubscribtions": return(GetUnsubscriptionCount(parameter as DataRowView)); default: return(parameter); } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { imgTextHint.ImageUrl = GetImageUrl("Design/Forums/hint.gif"); imgTextHint.AlternateText = "Hint"; ScriptHelper.AppendTooltip(imgTextHint, GetString("ForumSearch.SearchTextHint"), "help"); btnSearch.Text = GetString("general.search"); if (EnableForumSelection) { plcForums.Visible = true; string selected = ";" + QueryHelper.GetString("searchforums", "") + ";"; bool allForums = QueryHelper.GetBoolean("allforums", false); ForumPostsDataSource fpd = new ForumPostsDataSource(); fpd.CacheMinutes = 0; fpd.SelectedColumns = "GroupID, GroupDisplayName, ForumID, ForumDisplayName,GroupOrder, ForumOrder, ForumName "; fpd.Distinct = true; fpd.SelectOnlyApproved = false; fpd.SiteName = SiteContext.CurrentSiteName; string where = "(GroupGroupID IS NULL) AND (GroupName != 'adhocforumgroup') AND (ForumOpen=1)"; // Get only selected forum groups if (!String.IsNullOrEmpty(ForumGroups)) { string groups = ""; foreach (string group in ForumGroups.Split(';')) { groups += " '" + SqlHelper.GetSafeQueryString(group) + "',"; } // Add new part to where condition where += " AND (GroupName IN (" + groups.TrimEnd(',') + "))"; } if (HideForumForUnauthorized) { where = ForumInfoProvider.CombineSecurityWhereCondition(where, 0); } fpd.WhereCondition = where; fpd.OrderBy = "GroupOrder, ForumOrder ASC, ForumName ASC"; DataSet ds = fpd.DataSource as DataSet; if (!DataHelper.DataSourceIsEmpty(ds)) { int oldGroup = -1; foreach (DataRow dr in ds.Tables[0].Rows) { if (oldGroup != ValidationHelper.GetInteger(dr["GroupID"], 0)) { ListItem li = new ListItem(ResHelper.LocalizeString(Convert.ToString(dr["GroupDisplayName"])), ""); li.Attributes.Add("disabled", "disabled"); if (!listForums.Items.Contains(li)) { listForums.Items.Add(li); } oldGroup = ValidationHelper.GetInteger(dr["GroupID"], 0); } string forumId = Convert.ToString(dr["ForumID"]); ListItem lif = new ListItem(" \xA0\xA0\xA0\xA0 " + ResHelper.LocalizeString(Convert.ToString(dr["ForumDisplayName"])), forumId); if ((selected.Contains(";" + forumId + ";")) && (!allForums)) { lif.Selected = true; } // On postback on ASPX if (!listForums.Items.Contains(lif)) { listForums.Items.Add(lif); } } } } }
/// <summary> /// Saves modified image data. /// </summary> /// <param name="name">Image name</param> /// <param name="extension">Image extension</param> /// <param name="mimetype">Image mimetype</param> /// <param name="title">Image title</param> /// <param name="description">Image description</param> /// <param name="binary">Image binary data</param> /// <param name="width">Image width</param> /// <param name="height">Image height</param> private void SaveImage(string name, string extension, string mimetype, string title, string description, byte[] binary, int width, int height) { LoadInfos(); // Save image data depending to image type switch (baseImageEditor.ImageType) { // Process attachment case ImageHelper.ImageTypeEnum.Attachment: if ((ai != null) && (AttachmentManager != null)) { // Save new data try { // Get the node TreeNode node = DocumentHelper.GetDocument(ai.AttachmentDocumentID, baseImageEditor.Tree); // Check Create permission when saving temporary attachment, check Modify permission else NodePermissionsEnum permissionToCheck = (ai.AttachmentFormGUID == Guid.Empty) ? NodePermissionsEnum.Modify : NodePermissionsEnum.Create; // Check permission if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, permissionToCheck) != AuthorizationResultEnum.Allowed) { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "attach.actiondenied"; this.SavingFailed = true; return; } if (!IsNameUnique(name, extension)) { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.namenotunique"; this.SavingFailed = true; return; } // Ensure automatic check-in/ check-out bool useWorkflow = false; bool autoCheck = false; WorkflowManager workflowMan = new WorkflowManager(baseImageEditor.Tree); if (node != null) { // Get workflow info WorkflowInfo wi = workflowMan.GetNodeWorkflow(node); // Check if the document uses workflow if (wi != null) { useWorkflow = true; autoCheck = !wi.UseCheckInCheckOut(CurrentSiteName); } // Check out the document if (autoCheck) { VersionManager.CheckOut(node, node.IsPublished, true); VersionHistoryID = node.DocumentCheckedOutVersionHistoryID; } // Workflow has been lost, get published attachment if (useWorkflow && (VersionHistoryID == 0)) { ai = AttachmentManager.GetAttachmentInfo(ai.AttachmentGUID, CurrentSiteName); } // If extension changed update CMS.File extension if ((node.NodeClassName.ToLower() == "cms.file") && (node.DocumentExtensions != extension)) { // Update document extensions if no custom are used if (!node.DocumentUseCustomExtensions) { node.DocumentExtensions = extension; } node.SetValue("DocumentType", extension); DocumentHelper.UpdateDocument(node, baseImageEditor.Tree); } } if (ai != null) { // Test all parameters to empty values and update new value if available if (name != "") { if (!name.EndsWith(extension)) { ai.AttachmentName = name + extension; } else { ai.AttachmentName = name; } } if (extension != "") { ai.AttachmentExtension = extension; } if (mimetype != "") { ai.AttachmentMimeType = mimetype; } ai.AttachmentTitle = title; ai.AttachmentDescription = description; if (binary != null) { ai.AttachmentBinary = binary; ai.AttachmentSize = binary.Length; } if (width > 0) { ai.AttachmentImageWidth = width; } if (height > 0) { ai.AttachmentImageHeight = height; } // Ensure object ai.MakeComplete(true); if (VersionHistoryID > 0) { VersionManager.SaveAttachmentVersion(ai, VersionHistoryID); } else { AttachmentManager.SetAttachmentInfo(ai); // Log the sycnhronization and search task for the document if (node != null) { // Update search index for given document if ((node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled)) { SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID()); } DocumentSynchronizationHelper.LogDocumentChange(node, TaskTypeEnum.UpdateDocument, baseImageEditor.Tree); } } // Check in the document if (autoCheck) { if (VersionManager != null) { if (VersionHistoryID > 0 && node != null) { VersionManager.CheckIn(node, null, null); } } } } } catch (Exception ex) { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.processing"; ScriptHelper.AppendTooltip(baseImageEditor.LblLoadFailed, ex.Message, "help"); EventLogProvider.LogException("Image editor", "SAVEIMAGE", ex); this.SavingFailed = true; } } break; case ImageHelper.ImageTypeEnum.PhysicalFile: if (!String.IsNullOrEmpty(filePath)) { CurrentUserInfo currentUser = CMSContext.CurrentUser; if ((currentUser != null) && currentUser.IsGlobalAdministrator) { try { string physicalPath = Server.MapPath(filePath); string newPath = physicalPath; // Write binary data to the disk File.WriteAllBytes(physicalPath, binary); // Handle rename of the file if (!String.IsNullOrEmpty(name)) { newPath = DirectoryHelper.CombinePath(Path.GetDirectoryName(physicalPath), name); } if (!String.IsNullOrEmpty(extension)) { string oldExt = Path.GetExtension(physicalPath); newPath = newPath.Substring(0, newPath.Length - oldExt.Length) + extension; } // Move the file if (newPath != physicalPath) { File.Move(physicalPath, newPath); } } catch (Exception ex) { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.processing"; ScriptHelper.AppendTooltip(baseImageEditor.LblLoadFailed, ex.Message, "help"); EventLogProvider.LogException("Image editor", "SAVEIMAGE", ex); this.SavingFailed = true; } } else { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.rights"; this.SavingFailed = true; } } break; // Process metafile case ImageHelper.ImageTypeEnum.Metafile: if (mf != null) { if (UserInfoProvider.IsAuthorizedPerObject(mf.MetaFileObjectType, mf.MetaFileObjectID, PermissionsEnum.Modify, this.CurrentSiteName, CMSContext.CurrentUser)) { try { // Test all parameters to empty values and update new value if available if (name.CompareTo("") != 0) { if (!name.EndsWith(extension)) { mf.MetaFileName = name + extension; } else { mf.MetaFileName = name; } } if (extension.CompareTo("") != 0) { mf.MetaFileExtension = extension; } if (mimetype.CompareTo("") != 0) { mf.MetaFileMimeType = mimetype; } mf.MetaFileTitle = title; mf.MetaFileDescription = description; if (binary != null) { mf.MetaFileBinary = binary; mf.MetaFileSize = binary.Length; } if (width > 0) { mf.MetaFileImageWidth = width; } if (height > 0) { mf.MetaFileImageHeight = height; } // Save new data MetaFileInfoProvider.SetMetaFileInfo(mf); if (RefreshAfterAction) { if (String.IsNullOrEmpty(externalControlID)) { baseImageEditor.LtlScript.Text = ScriptHelper.GetScript("Refresh();"); } else { baseImageEditor.LtlScript.Text = ScriptHelper.GetScript(String.Format("InitRefresh({0}, false, false, '{1}', 'refresh')", ScriptHelper.GetString(externalControlID), mf.MetaFileGUID)); } } } catch (Exception ex) { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.processing"; ScriptHelper.AppendTooltip(baseImageEditor.LblLoadFailed, ex.Message, "help"); EventLogProvider.LogException("Image editor", "SAVEIMAGE", ex); this.SavingFailed = true; } } else { baseImageEditor.LblLoadFailed.Visible = true; baseImageEditor.LblLoadFailed.ResourceString = "img.errors.rights"; this.SavingFailed = true; } } break; } }
private void ReloadData() { if (Node != null) { // Log activities checkboxes if (!RequestHelper.IsPostBack()) { bool?logVisit = Node.DocumentLogVisitActivity; chkLogPageVisit.Checked = (logVisit == true); if (Node.NodeParentID > 0) // Init "inherit" option for child nodes (and hide option for root) { chkPageVisitInherit.Checked = (logVisit == null); if (logVisit == null) { chkPageVisitInherit_CheckedChanged(null, EventArgs.Empty); } } chkLogPageVisit.Enabled = !chkPageVisitInherit.Checked; } // Check modify permission canEdit = (CMSContext.CurrentUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) != AuthorizationResultEnum.Denied); // Show document group owner selector if (ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY) && canEditOwner && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Groups)) { plcOwnerGroup.Controls.Clear(); // Initialize table TableRow rowOwner = new TableRow(); TableCell cellTitle = new TableCell(); TableCell cellSelector = new TableCell(); // Initialize caption LocalizedLabel lblOwnerGroup = new LocalizedLabel(); lblOwnerGroup.EnableViewState = false; lblOwnerGroup.ResourceString = "community.group.documentowner"; lblOwnerGroup.ID = "lblOwnerGroup"; cellTitle.Controls.Add(lblOwnerGroup); // Initialize selector fcDocumentGroupSelector = (FormEngineUserControl)Page.LoadUserControl("~/CMSAdminControls/UI/Selectors/DocumentGroupSelector.ascx"); fcDocumentGroupSelector.ID = "fcDocumentGroupSelector"; fcDocumentGroupSelector.StopProcessing = pnlUIOwner.IsHidden; cellSelector.Controls.Add(fcDocumentGroupSelector); fcDocumentGroupSelector.Value = ValidationHelper.GetInteger(Node.GetValue("NodeGroupID"), 0); fcDocumentGroupSelector.SetValue("siteid", CMSContext.CurrentSiteID); fcDocumentGroupSelector.SetValue("nodeid", Node.NodeID); // Add controls to containers rowOwner.Cells.Add(cellTitle); rowOwner.Cells.Add(cellSelector); plcOwnerGroup.Controls.Add(rowOwner); plcOwnerGroup.Visible = true; } // Show owner editing only when authorized to change the permissions if (canEditOwner) { lblOwner.Visible = false; usrOwner.Visible = true; usrOwner.SetValue("AdditionalUsers", new int[] { Node.NodeOwner }); } else { usrOwner.Visible = false; } if (!RequestHelper.IsPostBack()) { if (canEditOwner) { usrOwner.Value = Node.GetValue("NodeOwner"); } } // Load the data lblName.Text = HttpUtility.HtmlEncode(Node.GetDocumentName()); lblNamePath.Text = HttpUtility.HtmlEncode(Convert.ToString(Node.GetValue("DocumentNamePath"))); lblAliasPath.Text = Convert.ToString(Node.NodeAliasPath); string typeName = DataClassInfoProvider.GetDataClass(Node.NodeClassName).ClassDisplayName; lblType.Text = HttpUtility.HtmlEncode(ResHelper.LocalizeString(typeName)); lblNodeID.Text = Convert.ToString(Node.NodeID); // Modifier SetUserLabel(lblLastModifiedBy, "DocumentModifiedByUserId"); // Get modified time TimeZoneInfo usedTimeZone = null; DateTime lastModified = ValidationHelper.GetDateTime(Node.GetValue("DocumentModifiedWhen"), DateTimeHelper.ZERO_TIME); lblLastModified.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(lastModified, CMSContext.CurrentUser, CMSContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblLastModified, TimeZoneHelper.GetGMTLongStringOffset(usedTimeZone), "help"); if (!canEditOwner) { // Owner SetUserLabel(lblOwner, "NodeOwner"); } // Creator SetUserLabel(lblCreatedBy, "DocumentCreatedByUserId"); DateTime createdWhen = ValidationHelper.GetDateTime(Node.GetValue("DocumentCreatedWhen"), DateTimeHelper.ZERO_TIME); lblCreated.Text = TimeZoneHelper.GetCurrentTimeZoneDateTimeString(createdWhen, CMSContext.CurrentUser, CMSContext.CurrentSite, out usedTimeZone); ScriptHelper.AppendTooltip(lblCreated, TimeZoneHelper.GetGMTLongStringOffset(usedTimeZone), "help"); // URL string liveUrl = Node.IsLink ? CMSContext.GetUrl(Node.NodeAliasPath, null) : CMSContext.GetUrl(Node.NodeAliasPath, Node.DocumentUrlPath); lnkLiveURL.Text = URLHelper.ResolveUrl(liveUrl, true, false); lnkLiveURL.NavigateUrl = URLHelper.ResolveUrl(liveUrl); bool isRoot = (Node.NodeClassName.ToLowerCSafe() == "cms.root"); // Preview URL if (!isRoot) { plcPreview.Visible = true; string path = canEdit ? "/CMSModules/CMS_Content/Properties/resetlink.png" : "/CMSModules/CMS_Content/Properties/resetlinkdisabled.png"; btnResetPreviewGuid.ImageUrl = GetImageUrl(path); btnResetPreviewGuid.ToolTip = GetString("GeneralProperties.InvalidatePreviewURL"); btnResetPreviewGuid.ImageAlign = ImageAlign.AbsBottom; btnResetPreviewGuid.Click += btnResetPreviewGuid_Click; btnResetPreviewGuid.OnClientClick = "if(!confirm('" + GetString("GeneralProperties.GeneratePreviewURLConf") + "')){return false;}"; InitPreviewUrl(); } lblGUID.Text = Convert.ToString(Node.NodeGUID); lblDocGUID.Text = (Node.DocumentGUID == Guid.Empty) ? ResHelper.Dash : Node.DocumentGUID.ToString(); lblDocID.Text = Convert.ToString(Node.DocumentID); // Culture CultureInfo ci = CultureInfoProvider.GetCultureInfo(Node.DocumentCulture); lblCulture.Text = ((ci != null) ? ResHelper.LocalizeString(ci.CultureName) : Node.DocumentCulture); lblPublished.Text = (Node.IsPublished ? "<span class=\"DocumentPublishedYes\">" + GetString("General.Yes") + "</span>" : "<span class=\"DocumentPublishedNo\">" + GetString("General.No") + "</span>"); if (!RequestHelper.IsPostBack()) { // Init radio buttons for cache settings if (isRoot) { radInherit.Visible = false; radFSInherit.Visible = false; chkCssStyle.Visible = false; } string cacheMinutes = ""; switch (Node.NodeCacheMinutes) { case -1: // Cache is off { radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; if (!isRoot) { radInherit.Checked = true; radNo.Checked = false; } } break; case 0: // Cache is off radNo.Checked = true; radYes.Checked = false; radInherit.Checked = false; break; default: // Cache is enabled radNo.Checked = false; radYes.Checked = true; radInherit.Checked = false; cacheMinutes = Node.NodeCacheMinutes.ToString(); break; } // Set secured radio buttons switch (Node.NodeAllowCacheInFileSystem) { case 0: radFSNo.Checked = true; break; case 1: radFSYes.Checked = true; break; default: if (!isRoot) { radFSInherit.Checked = true; } else { radFSYes.Checked = true; } break; } txtCacheMinutes.Text = cacheMinutes; if (!radYes.Checked) { txtCacheMinutes.Enabled = false; } if (Node.GetValue("DocumentStylesheetID") == null) { // If default site not exist edit is set to -1 - disabled if (CMSContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.Value = "default"; } else { ctrlSiteSelectStyleSheet.Value = -1; } } else { // If stylesheet is inherited from parent document if (ValidationHelper.GetInteger(Node.GetValue("DocumentStylesheetID"), 0) == -1) { if (!isRoot) { chkCssStyle.Checked = true; // Get parent stylesheet string value = PageInfoProvider.GetParentProperty(CMSContext.CurrentSite.SiteID, Node.NodeAliasPath, "(DocumentStylesheetID <> -1 OR DocumentStylesheetID IS NULL) AND DocumentCulture = N'" + SqlHelperClass.GetSafeQueryString(Node.DocumentCulture, false) + "'", "DocumentStylesheetID"); if (String.IsNullOrEmpty(value)) { // If default site stylesheet not exist edit is set to -1 - disabled if (CMSContext.CurrentSiteStylesheet != null) { ctrlSiteSelectStyleSheet.Value = "default"; } else { ctrlSiteSelectStyleSheet.Value = -1; } } else { // Set parent stylesheet to current document ctrlSiteSelectStyleSheet.Value = value; } } } else { ctrlSiteSelectStyleSheet.Value = Node.GetValue("DocumentStylesheetID"); } } } // Disable new button if document inherit stylesheet bool disableCssSelector = (!isRoot && chkCssStyle.Checked); ctrlSiteSelectStyleSheet.Enabled = !disableCssSelector; ctrlSiteSelectStyleSheet.ButtonNewEnabled = !disableCssSelector; // Initialize Rating control RefreshCntRatingResult(); double rating = 0.0f; if (Node.DocumentRatings > 0) { rating = Node.DocumentRatingValue / Node.DocumentRatings; } ratingControl.MaxRating = 10; ratingControl.CurrentRating = rating; ratingControl.Visible = true; ratingControl.Enabled = false; // Initialize Reset button for rating btnResetRating.Text = GetString("general.reset"); btnResetRating.OnClientClick = "if (!confirm(" + ScriptHelper.GetString(GetString("GeneralProperties.ResetRatingConfirmation")) + ")) return false;"; object[] param = new object[1]; param[0] = Node.DocumentID; plcAdHocForums.Visible = hasAdHocForum; plcAdHocBoards.Visible = hasAdHocBoard; if (!canEdit) { // Disable form editing DisableFormEditing(); } } else { btnResetRating.Visible = false; } }