protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement);

        // Init header actions
        string[,] actions = new string[1, 11];
        actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON;
        actions[0, 1] = GetString("General.Save");
        actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        actions[0, 6] = "save";
        actions[0, 8] = "true";
        CurrentMaster.HeaderActions.LinkCssClass = "ContentSaveLinkButton";
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        CurrentMaster.HeaderActions.Actions = actions;

        // Get data class info
        DataClassInfo classInfo = (DataClassInfo)EditedObject;
        if (classInfo == null)
        {
            return;
        }

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        if (mapControl != null)
        {
            mapControl.ID = "ctrlMapping";
            mapControl.SetValue("classname", classInfo.ClassName);
            mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled);
            plcMapping.Controls.Add(mapControl);
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement);

        // Init header actions
        string[,] actions = new string[1, 11];
        actions[0, 0]     = HeaderActions.TYPE_SAVEBUTTON;
        actions[0, 1]     = GetString("General.Save");
        actions[0, 5]     = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        actions[0, 6]     = "save";
        actions[0, 8]     = "true";
        CurrentMaster.HeaderActions.LinkCssClass     = "ContentSaveLinkButton";
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        CurrentMaster.HeaderActions.Actions          = actions;

        // Get data class info
        DataClassInfo classInfo = (DataClassInfo)EditedObject;

        if (classInfo == null)
        {
            return;
        }

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        if (mapControl != null)
        {
            mapControl.ID = "ctrlMapping";
            mapControl.SetValue("classname", classInfo.ClassName);
            mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled);
            plcMapping.Controls.Add(mapControl);
        }
    }
Exemple #3
0
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        filteredControl = FilteredControl as CMSUserControl;

        // Initialize UniSelector with document types
        uniSelector.DisplayNameFormat = "{%ClassDisplayName%} ({%ClassName%})";
        uniSelector.SelectionMode     = SelectionModeEnum.SingleDropDownList;

        if (drpClassType.SelectedValue == "doctype")
        {
            uniSelector.WhereCondition = "ClassIsDocumentType = 1";
        }
        else
        {
            uniSelector.WhereCondition = "ClassIsCustomTable = 1";
        }

        if (!IsSiteManager)
        {
            uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, "ClassID IN (SELECT ClassID FROM CMS_ClassSite WHERE SiteID = " + SiteContext.CurrentSiteID + ")");
        }

        uniSelector.ReturnColumnName = "ClassID";
        uniSelector.ObjectType       = DataClassInfo.OBJECT_TYPE;
        uniSelector.ResourcePrefix   = "allowedclasscontrol";
        uniSelector.AllowAll         = false;
        uniSelector.AllowEmpty       = false;
        uniSelector.DropDownSingleSelect.AutoPostBack = true;
        uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged;
        uniSelector.IsLiveSite          = IsLiveSite && ((filteredControl == null) || filteredControl.IsLiveSite);
        uniSelector.DialogWindowName    = "DocumentTypeSelectionDialog";
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        // Hide filter button, this filter has its own
        UniGrid grid = filteredControl as UniGrid;

        if (grid != null)
        {
            grid.HideFilterButton = true;
        }

        allowGlobalProducts = ECommerceSettings.AllowGlobalProducts(SiteContext.CurrentSiteName);

        // Display Global and site option if global products are allowed
        siteElem.ShowSiteAndGlobal = allowGlobalProducts;

        // Initialize controls
        if (!URLHelper.IsPostback())
        {
            FillThreeStateDDL(ddlNeedsShipping);
            FillThreeStateDDL(ddlAllowForSale);
            FillDocumentTypesDDL();
            ResetFilter();
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;
        forumGroupSelector.UniSelector.ReturnColumnName = "GroupID";
        forumGroupSelector.UniSelector.OnSelectionChanged += new EventHandler(UniSelector_OnSelectionChanged);
        forumGroupSelector.DropDownSingleSelect.AutoPostBack = true;

        // Set group selector dropdow to show only forumgroups of the site
        int siteId = ValidationHelper.GetInteger(filteredControl.GetValue("SiteID"), 0);
        forumGroupSelector.SiteId = siteId;

        // Get first forum group to be able to filter uni selector
        if (!RequestHelper.IsPostBack())
        {
            if (siteId > 0)
            {
                DataSet defaultGroup = ForumGroupInfoProvider.GetGroups("GroupGroupID IS NULL AND GroupName NOT LIKE 'AdHoc%' AND  GroupSiteID=" + siteId, "GroupDisplayName", 1, "GroupID");
                if (!DataHelper.DataSourceIsEmpty(defaultGroup))
                {
                    int defaultGroupId = ValidationHelper.GetInteger(defaultGroup.Tables[0].Rows[0]["GroupID"], 0);
                    if (defaultGroupId > 0)
                    {
                        forumGroupSelector.UniSelector.Value = defaultGroupId;
                        WhereCondition = GenerateWhereCondition(defaultGroupId);
                    }
                }
                ;
            }
        }
    }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        // Get form info
        BizFormInfo formInfo = EditedObject as BizFormInfo;

        if (formInfo == null)
        {
            return;
        }

        // Get class of the form
        DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(formInfo.FormClassID);

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        if (mapControl != null)
        {
            mapControl.ID = "ctrlMapping";
            mapControl.SetValue("classname", classInfo.ClassName);
            mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled);
            plcMapping.Controls.Add(mapControl);
        }

        if (!RequestHelper.IsPostBack())
        {
            // Initialize checkbox value and mapping dialog visibility
            chkLogActivity.Checked = formInfo.FormLogActivity;
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;
        forumGroupSelector.UniSelector.ReturnColumnName      = "GroupID";
        forumGroupSelector.UniSelector.OnSelectionChanged   += new EventHandler(UniSelector_OnSelectionChanged);
        forumGroupSelector.DropDownSingleSelect.AutoPostBack = true;

        // Set group selector dropdow to show only forumgroups of the site
        int siteId = ValidationHelper.GetInteger(filteredControl.GetValue("SiteID"), 0);

        forumGroupSelector.SiteId = siteId;

        // Get first forum group to be able to filter uni selector
        if (!RequestHelper.IsPostBack())
        {
            if (siteId > 0)
            {
                DataSet defaultGroup = ForumGroupInfoProvider.GetGroups("GroupGroupID IS NULL AND GroupName NOT LIKE 'AdHoc%' AND  GroupSiteID=" + siteId, "GroupDisplayName", 1, "GroupID");
                if (!DataHelper.DataSourceIsEmpty(defaultGroup))
                {
                    int defaultGroupId = ValidationHelper.GetInteger(defaultGroup.Tables[0].Rows[0]["GroupID"], 0);
                    if (defaultGroupId > 0)
                    {
                        forumGroupSelector.UniSelector.Value = defaultGroupId;
                        WhereCondition = GenerateWhereCondition(defaultGroupId);
                    }
                }
                ;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        // Get form info
        BizFormInfo formInfo = EditedObject as BizFormInfo;
        if (formInfo == null)
        {
            return;
        }

        // Get class of the form
        DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(formInfo.FormClassID);

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        if (mapControl != null)
        {
            mapControl.ID = "ctrlMapping";
            mapControl.SetValue("classname", classInfo.ClassName);
            mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled);
            plcMapping.Controls.Add(mapControl);
        }

        if (!RequestHelper.IsPostBack())
        {
            // Initialize checkbox value and mapping dialog visibility
            plcMapping.Visible = chkLogActivity.Checked = formInfo.FormLogActivity;
        }
    }
Exemple #9
0
    /// <summary>
    /// Setups the selector for further usage.
    /// </summary>
    private void SetupSelector()
    {
        mFilteredUserControl = FilteredControl as CMSUserControl;

        SetSelectorWhereCondition();

        uniSelector.ObjectType = DataClassInfo.OBJECT_TYPE;
        uniSelector.DropDownSingleSelect.AutoPostBack = true;
        uniSelector.IsLiveSite = IsLiveSite && ((mFilteredUserControl == null) || mFilteredUserControl.IsLiveSite);
    }
Exemple #10
0
 /// <summary>
 /// Ensures that support chat control is inserted correctly into the header if the chat is module is available.
 /// </summary>
 private void EnsureSupportChat()
 {
     if ((ModuleEntryManager.IsModuleLoaded(ModuleName.CHAT)) && (SiteContext.CurrentSiteID > 0))
     {
         CMSUserControl supportChatControl = Page.LoadUserControl("~/CMSModules/Chat/Controls/SupportChatHeader.ascx") as CMSUserControl;
         if (supportChatControl != null)
         {
             plcSupportChat.Controls.Add(supportChatControl);
             plcSupportChat.Visible = true;
         }
     }
 }
Exemple #11
0
 /// <summary>
 /// Ensures that StagingTaskGroupMenu control is inserted correctly into the header.
 /// </summary>
 private void EnsureStagingTaskGroupMenu()
 {
     if (StagingTaskInfoProvider.LoggingOfStagingTasksEnabled(SiteContext.CurrentSiteName))
     {
         CMSUserControl stagingTaskGroupMenu = Page.LoadUserControl("~/CMSAdminControls/UI/StagingTaskGroupMenu.ascx") as CMSUserControl;
         if (stagingTaskGroupMenu != null)
         {
             plcStagingTaskGroupContainer.Visible = true;
             plcStagingTaskGroup.Controls.Add(stagingTaskGroupMenu);
             plcStagingTaskGroup.Visible = true;
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement);

        // Check if current user is authorised to read either site or global contacts
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.ContactManagement", "ModifyContacts"))
        {
            RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyContacts");
        }

        // Init header actions
        string[,] actions = new string[1, 11];
        actions[0, 0]     = HeaderActions.TYPE_SAVEBUTTON;
        actions[0, 1]     = GetString("General.Save");
        actions[0, 5]     = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        actions[0, 6]     = "save";
        actions[0, 8]     = "true";
        CurrentMaster.HeaderActions.LinkCssClass     = "ContentSaveLinkButton";
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        CurrentMaster.HeaderActions.Actions          = actions;

        // Get form info
        BizFormInfo formInfo = (BizFormInfo)EditedObject;

        if (formInfo == null)
        {
            return;
        }

        // Get class of the form
        DataClassInfo classInfo = DataClassInfoProvider.GetDataClass(formInfo.FormClassID);

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        if (mapControl != null)
        {
            mapControl.ID = "ctrlMapping";
            mapControl.SetValue("classname", classInfo.ClassName);
            mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled);
            plcMapping.Controls.Add(mapControl);
        }

        if (!RequestHelper.IsPostBack())
        {
            // Initialize checkbox value and mapping dialog visibility
            plcMapping.Visible = chkLogActivity.Checked = formInfo.FormLogActivity;
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucAttachments    = Page.LoadUserControl("~/CMSModules/Content/Controls/Attachments/AttachmentLightboxGallery.ascx") as CMSUserControl;
        ucAttachments.ID = "ctrlAttachments";
        plcAttachmentLightBox.Controls.Add(ucAttachments);

        TreeNode currentDocument = DocumentContext.CurrentDocument;

        if (currentDocument != null)
        {
            // Get document type transformation
            string             transformationName         = currentDocument.NodeClassName + ".AttachmentLightbox";
            string             selectedTransformationName = currentDocument.NodeClassName + ".AttachmentLightboxDetail";
            TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationName);

            // If transformation not present, use default from the Root document type
            if (ti == null)
            {
                transformationName = "cms.root.AttachmentLightbox";
                ti = TransformationInfoProvider.GetTransformation(transformationName);
            }
            if (ti == null)
            {
                throw new Exception("[DocumentAttachments]: Default transformation '" + transformationName + "' doesn't exist!");
            }
            ti = TransformationInfoProvider.GetTransformation(selectedTransformationName);

            // If transformation not present, use default from the Root document type
            if (ti == null)
            {
                selectedTransformationName = "cms.root.AttachmentLightboxDetail";
                ti = TransformationInfoProvider.GetTransformation(selectedTransformationName);
            }
            if (ti == null)
            {
                throw new Exception("[DocumentAttachments]: Default transformation '" + selectedTransformationName + "' doesn't exist!");
            }

            ucAttachments.SetValue("TransformationName", transformationName);
            ucAttachments.SetValue("SelectedItemTransformationName", selectedTransformationName);
            ucAttachments.SetValue("SiteName", SiteContext.CurrentSiteName);
            ucAttachments.SetValue("Path", currentDocument.NodeAliasPath);
            ucAttachments.SetValue("CultureCode", currentDocument.DocumentCulture);
            ucAttachments.SetValue("OrderBy", "AttachmentOrder, AttachmentName");
            ucAttachments.SetValue("PageSize", 0);
            ucAttachments.SetValue("GetBinary", false);
            ucAttachments.SetValue("CacheMinutes", SettingsKeyInfoProvider.GetIntValue(SiteContext.CurrentSite + ".CMSCacheMinutes"));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ucAttachments = this.Page.LoadControl("~/CMSModules/Content/Controls/Attachments/AttachmentLightboxGallery.ascx") as CMSUserControl;
        ucAttachments.ID = "ctrlAttachments";
        plcAttachmentLightBox.Controls.Add(ucAttachments);

        TreeNode currentDocument = CMSContext.CurrentDocument;
        if (currentDocument != null)
        {
            // Get document type transformation
            string transformationName = currentDocument.NodeClassName + ".AttachmentLightbox";
            string selectedTransformationName = currentDocument.NodeClassName + ".AttachmentLightboxDetail";
            TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationName);

            // If transformation not present, use default from the Root document type
            if (ti == null)
            {
                transformationName = "cms.root.AttachmentLightbox";
                ti = TransformationInfoProvider.GetTransformation(transformationName);
            }
            if (ti == null)
            {
                throw new Exception("[DocumentAttachments]: Default transformation '" + transformationName + "' doesn't exist!");
            }
            ti = TransformationInfoProvider.GetTransformation(selectedTransformationName);

            // If transformation not present, use default from the Root document type
            if (ti == null)
            {
                selectedTransformationName = "cms.root.AttachmentLightboxDetail";
                ti = TransformationInfoProvider.GetTransformation(selectedTransformationName);
            }
            if (ti == null)
            {
                throw new Exception("[DocumentAttachments]: Default transformation '" + selectedTransformationName + "' doesn't exist!");
            }

            ucAttachments.SetValue("TransformationName", transformationName);
            ucAttachments.SetValue("SelectedItemTransformationName", selectedTransformationName);
            ucAttachments.SetValue("SiteName", CMSContext.CurrentSiteName);
            ucAttachments.SetValue("Path", currentDocument.NodeAliasPath);
            ucAttachments.SetValue("CultureCode", currentDocument.DocumentCulture);
            ucAttachments.SetValue("OrderBy", "AttachmentOrder, AttachmentName");
            ucAttachments.SetValue("PageSize", 0);
            ucAttachments.SetValue("GetBinary", false);
            ucAttachments.SetValue("CacheMinutes", SettingsKeyProvider.GetIntValue(CMSContext.CurrentSite + ".CMSCacheMinutes"));
        }
    }
Exemple #15
0
    /// <summary>
    /// OnModeration required.
    /// </summary>
    private void forumEdit_OnModerationRequired(object sender, EventArgs e)
    {
        CMSUserControl ctrl = sender as CMSUserControl;

        if (ctrl != null)
        {
            ctrl.StopProcessing = true;
        }

        plcPreview.Visible            = false;
        forumEdit.Visible             = false;
        plcModerationRequired.Visible = true;
        ltrTitle.Visible       = false;
        lblModerationInfo.Text = GetString("forums.requiresmoderationafteraction");
        btnOk.Text             = GetString("general.ok");
    }
    /// <summary>
    /// Reloads data.
    /// </summary>
    public void ReloadData()
    {
        // Get data
        DataSet ds = SettingsCategoryInfoProvider.GetChildSettingsCategories(CategoryName, "CategoryIsGroup = 1");

        Controls.Clear();

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            DataRowCollection rows = ds.Tables[0].Rows;
            foreach (DataRow row in rows)
            {
                // Create new panel with info about subcategory
                var            sci      = new SettingsCategoryInfo(row);
                CMSUserControl catPanel = CreatePanelForCategory(sci);

                catPanel.ID = ControlsHelper.GetUniqueID(this, "CategoryPanel_" + ValidationHelper.GetIdentifier(sci.CategoryName));
                Controls.Add(catPanel);
            }
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;
        forumGroupSelector.UniSelector.ReturnColumnName      = "GroupID";
        forumGroupSelector.UniSelector.OnSelectionChanged   += new EventHandler(UniSelector_OnSelectionChanged);
        forumGroupSelector.DropDownSingleSelect.AutoPostBack = true;

        // Set group selector dropdow to show only forumgroups of the site
        int siteId = ValidationHelper.GetInteger(filteredControl.GetValue("SiteID"), 0);

        forumGroupSelector.SiteId = siteId;

        // Get first forum group to be able to filter uni selector
        if (!RequestHelper.IsPostBack())
        {
            if (siteId > 0)
            {
                var groupIds = ForumGroupInfoProvider.GetForumGroups()
                               .WhereNull("GroupGroupID")
                               .WhereNotStartsWith("GroupName", "AdHoc")
                               .WhereEquals("GroupSiteID", siteId)
                               .OrderBy("GroupDisplayName")
                               .TopN(1)
                               .Column("GroupID")
                               .GetListResult <int>();

                if (groupIds.Any())
                {
                    int defaultGroupId = ValidationHelper.GetInteger(groupIds.First(), 0);
                    if (defaultGroupId > 0)
                    {
                        forumGroupSelector.UniSelector.Value = defaultGroupId;
                        WhereCondition = GenerateWhereCondition(defaultGroupId);
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.ContactManagement);

        // Init header actions
        CurrentMaster.HeaderActions.ActionsList.Add(new SaveAction(Page));

        // Register event for save action
        ComponentEvents.RequestEvents.RegisterForEvent(ComponentEvents.SAVE, SaveButton_Click);

        // Get data class info
        if (ClassInfo == null)
        {
            return;
        }

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl    = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        mapControl.ID = "ctrlMapping";
        mapControl.SetValue("classname", ClassInfo.ClassName);
        mapControl.SetValue("allowoverwrite", ClassInfo.ClassContactOverwriteEnabled);
        mapControl.IsLiveSite = false;
        plcMapping.Controls.Add(mapControl);

        ResourceInfo resource = ResourceInfoProvider.GetResourceInfo(QueryHelper.GetInteger("moduleid", 0));

        if (!SystemContext.DevelopmentMode && (resource != null) && !resource.ResourceIsInDevelopment)
        {
            pnlCustomization.MessagesPlaceHolder = MessagesPlaceHolder;
            pnlCustomization.Columns             = new string[] { "ClassContactMapping", "ClassContactOverwriteEnabled" };
            pnlCustomization.HeaderActions       = HeaderActions;
        }
        else
        {
            pnlCustomization.StopProcessing = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.ContactManagement);

        // Init header actions
        CurrentMaster.HeaderActions.ActionsList.Add(new SaveAction(Page));

        // Register event for save action
        ComponentEvents.RequestEvents.RegisterForEvent(ComponentEvents.SAVE, SaveButton_Click);

        // Get data class info
        if (ClassInfo == null)
        {
            return;
        }

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        mapControl.ID = "ctrlMapping";
        mapControl.SetValue("classname", ClassInfo.ClassName);
        mapControl.SetValue("allowoverwrite", ClassInfo.ClassContactOverwriteEnabled);
        mapControl.IsLiveSite = false;
        plcMapping.Controls.Add(mapControl);

        ResourceInfo resource = ResourceInfoProvider.GetResourceInfo(QueryHelper.GetInteger("moduleid", 0));
        if (!SystemContext.DevelopmentMode && (resource != null) && !resource.ResourceIsInDevelopment)
        {
            pnlCustomization.MessagesPlaceHolder = MessagesPlaceHolder;
            pnlCustomization.Columns = new string[] { "ClassContactMapping", "ClassContactOverwriteEnabled" };
            pnlCustomization.HeaderActions = HeaderActions;
        }
        else
        {
            pnlCustomization.StopProcessing = true;
        }
    }
Exemple #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserImpersonate();
        CheckTrial();

        // Facebook Connect sign out
        if (CMSContext.CurrentUser.IsAuthenticated())
        {
            if (QueryHelper.GetInteger("logout", 0) > 0)
            {
                // Stop processing for all controls during logout
                ucUsers.StopProcessing      = true;
                siteSelector.StopProcessing = true;
                ucUICultures.StopProcessing = true;
                btnSignOut_Click(this, EventArgs.Empty);
                return;
            }
        }

        // Display the techPreview info if there is a key in the web.config
        pnlTechPreview.Visible = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSUseTechnicalPreview"], false);

        InitializeVersion();

        lnkTestingMode.Text        = GetString("cmstesting.headerlink");
        lnkTestingMode.Visible     = SettingsKeyProvider.TestingMode;
        lnkTestingMode.NavigateUrl = "~/CMSPages/GetTestingModeReport.aspx";

        lblUserInfo.Text = HTMLHelper.HTMLEncode(CMSContext.CurrentUser.FullName);

        pnlBody.CssClass = IsAPIExampleHeader ? "APIExamplesHeader" : (IsCMSDesk ? "CMSDeskHeader" : "SMHeader");

        tabControl.Visible = !IsCMSDesk && !IsAPIExampleHeader || IsCMSDesk;

        lblSignOut.Text = GetString("signoutbutton.signout");

        lnkCMSDesk.Text        = GetString("Header.CMSDesk");
        lnkCMSDesk.NavigateUrl = EnsureViewModeParam("~/CMSDesk/default.aspx", "returnviewmode");
        lnkCMSDesk.Target      = "_parent";

        lnkCMSSiteManager.Text        = GetString("Header.SiteManager");
        lnkCMSSiteManager.NavigateUrl = EnsureViewModeParam("~/CMSSiteManager/default.aspx", "returnviewmode");
        lnkCMSSiteManager.Target      = "_parent";

        string eventLogText = GetString("administration.ui.eventlog");

        lnkLog.NavigateUrl   = ResolveUrl("~/CMSModules/EventLog/EventLog.aspx");
        lnkLog.ToolTip       = eventLogText;
        imgLog.ImageUrl      = GetImageUrl("Objects/CMS_EventLog/list.png");
        imgLog.AlternateText = eventLogText;

        string debugText = GetString("administration-system.debug");

        lnkDebug.NavigateUrl   = ResolveUrl("~/CMSModules/System/Debug/System_DebugFrameset.aspx");
        lnkDebug.ToolTip       = debugText;
        imgDebug.ImageUrl      = GetImageUrl("CMSModules/CMS_System/debug.png");
        imgDebug.AlternateText = debugText;

        pwdExpiration.ShowChangePasswordLink      = true;
        pwdExpiration.ExpirationTextBefore        = GetString("passwordexpiration.expired");
        pwdExpiration.ExpirationWarningTextBefore = string.Format(GetString("passwordexpiration.willexpire"), CMSContext.CurrentUser.UserPasswordExpiration);

        // Displays windows azure and EMS icons
        if (AzureHelper.IsRunningOnAzure && SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSShowAzureLogo"))
        {
            imgWindowsAzure.Visible  = true;
            imgWindowsAzure.ImageUrl = GetImageUrl("General/IconWindowsAzure.png");
            pnlExtraIcons.Visible    = true;
        }
        if (LicenseHelper.CurrentEdition == ProductEditionEnum.EnterpriseMarketingSolution)
        {
            imgEnterpriseSolution.Visible  = true;
            imgEnterpriseSolution.ImageUrl = GetImageUrl("General/IconEnterpriseSolution.png");
            pnlExtraIcons.Visible          = true;
        }
        if (!CMSContext.CurrentUser.UserSiteManagerAdmin)
        {
            plcLog.Visible   = false;
            plcDebug.Visible = false;
        }
        string redirectURL = null;

        string scHideWarning = @"
function HideWarning() {
  var panel = document.getElementById('" + pnlPwdExp.ClientID + @"');
  if(panel)
  {
    panel.style.display = ""none"";
    window.top.layouts[0].resizeAll(); 
  }
}";

        ScriptHelper.RegisterStartupScript(this, typeof(string), "HideHeaderWarning", scHideWarning, true);

        SiteInfo si = CMSContext.CurrentSite;

        if ((si != null) && (!si.SiteIsOffline))
        {
            // Initialize variables from query string
            int    nodeId      = QueryHelper.GetInteger("nodeid", 0);
            string culture     = QueryHelper.GetText("culture", null);
            string liveSiteUrl = "~";

            // Set url to node from which CMSDesk was opened
            if (IsCMSDesk && (nodeId > 0) && !String.IsNullOrEmpty(culture))
            {
                TreeProvider treeProvider = new TreeProvider(CMSContext.CurrentUser);
                TreeNode     node         = treeProvider.SelectSingleNode(nodeId, culture, false, false);
                if (node != null)
                {
                    liveSiteUrl = CMSContext.GetUrl(node.NodeAliasPath, node.DocumentUrlPath);
                }
            }
            // Resolve Url and add live site view mode
            liveSiteUrl             = ResolveUrl(liveSiteUrl);
            liveSiteUrl             = URLHelper.AddParameterToUrl(liveSiteUrl, "viewmode", "livesite");
            liveSiteUrl             = EnsureViewModeParam(liveSiteUrl, "viewmode");
            lnkLiveSite.Text        = ResHelper.GetString("Header.LiveSite");
            lnkLiveSite.NavigateUrl = liveSiteUrl;
            lnkLiveSite.Target      = "_parent";
        }

        if (IsCMSDesk)
        {
            // Make 'Site manager' link visible for global administrators
            CurrentUserInfo ui = CMSContext.CurrentUser;
            if (ui.UserSettings != null)
            {
                plcSiteManagerRedirect.Visible = ui.UserSiteManagerAdmin;
            }

            // Site selector settings
            siteSelector.DropDownSingleSelect.CssClass = "HeaderSiteDrop";
            siteSelector.UpdatePanel.RenderMode        = UpdatePanelRenderMode.Inline;
            siteSelector.AllowAll = false;
            siteSelector.UniSelector.OnSelectionChanged   += SiteSelector_OnSelectionChanged;
            siteSelector.UniSelector.OnBeforeClientChanged = "if (!CheckChanges()) { this.value = this.originalValue; return false; }";
            siteSelector.DropDownSingleSelect.AutoPostBack = true;
            siteSelector.OnlyRunningSites = true;

            if (!RequestHelper.IsPostBack())
            {
                siteSelector.Value = CMSContext.CurrentSiteID;
            }

            // Show only assigned sites for not global admins
            if (!CMSContext.CurrentUser.IsGlobalAdministrator)
            {
                siteSelector.UserId = CMSContext.CurrentUser.UserID;
            }

            StringBuilder script = new StringBuilder();
            script.Append(
                @"function SetActivePage() {}
  function SiteRedirect(url) { parent.location = url; }
  function CheckChanges() {
    try { if (!parent.frames['cmsdesktop'].CheckChanges()) return false; } catch (ex) { }
    return true;
  }
");
            ScriptHelper.RegisterStartupScript(this, typeof(string), "headerScript", ScriptHelper.GetScript(script.ToString()));

            lnkLogo.NavigateUrl = "~/CMSDesk/default.aspx";
            lnkLogo.Target      = "_parent";

            redirectURL = URLHelper.CurrentURL;

            tabControl.UrlTarget          = "cmsdesktop";
            tabControl.QueryParameterName = "section";
            tabControl.ModuleName         = "CMS.Desk";
            tabControl.ModuleAvailabilityForSiteRequired = true;
            tabControl.OnTabCreated += tabControl_OnTabCreated;

            if (RequestHelper.IsWindowsAuthentication())
            {
                pnlSignOut.Visible = false;
                pnlRight.CssClass += " HeaderWithoutSignOut";
            }
            else
            {
                // Init Facebook Connect and join logout script to sign out button
                string logoutScript = FacebookConnectHelper.FacebookConnectInitForSignOut(CMSContext.CurrentSiteName, ltlFBConnectScript);
                if (!String.IsNullOrEmpty(logoutScript))
                {
                    // If Facebook Connect initialized include 'CheckChanges()' to logout script
                    logoutScript = "if (CheckChanges()) { " + logoutScript + " } return false; ";
                }
                else
                {
                    // If Facebook Connect not initialized just return 'CheckChanges()' script
                    logoutScript = "return CheckChanges();";
                }
                lnkSignOut.OnClientClick = logoutScript;
            }
        }
        else
        {
            plcSiteSelector.Visible = false;
            pnlSeparator.Visible    = true;

            lblUserInfo.Text               = HTMLHelper.HTMLEncode(CMSContext.CurrentUser.FullName);
            plcCMSDeskRedirect.Visible     = true;
            plcSiteManagerRedirect.Visible = IsAPIExampleHeader;

            lnkTestingMode.Text        = GetString("cmstesting.headerlink");
            lnkTestingMode.Visible     = SettingsKeyProvider.TestingMode;
            lnkTestingMode.NavigateUrl = "~/CMSPages/GetTestingModeReport.aspx";

            string url = null;
            if (IsAPIExampleHeader)
            {
                url = "~/CMSAPIExamples/default.aspx";
            }
            else
            {
                url = "~/CMSSiteManager/default.aspx";
            }
            lnkLogo.NavigateUrl = url;
            lnkLogo.Target      = "_parent";

            redirectURL = "~/CMSMessages/Redirect.aspx?frame=top&url=" + url;

            tabControl.OnTabCreated      += new UITabs.TabCreatedEventHandler(tabControl_OnTabCreated);
            tabControl.UrlTarget          = "cmsdesktop";
            tabControl.QueryParameterName = "section";
            tabControl.ModuleName         = "CMS.SiteManager";
            tabControl.UseClientScript    = true;

            if (RequestHelper.IsWindowsAuthentication())
            {
                pnlSignOut.Visible = false;
                pnlRight.CssClass += " HeaderWithoutSignOut";
            }
            else
            {
                lblSignOut.Text          = GetString("signoutbutton.signout");
                lnkSignOut.OnClientClick = FacebookConnectHelper.FacebookConnectInitForSignOut(CMSContext.CurrentSiteName, ltlFBConnectScript);
            }
        }

        CheckUICultureChange(redirectURL);

        if (ModuleEntry.IsModuleRegistered("CMS.Chat") && ModuleEntry.IsModuleLoaded("CMS.Chat") && (CMSContext.CurrentSiteID > 0))
        {
            CMSUserControl supportChatControl = Page.LoadUserControl("~/CMSModules/Chat/Controls/SupportChatHeader.ascx") as CMSUserControl;
            if (supportChatControl != null)
            {
                plcSupportChatControl.Controls.Add(supportChatControl);
                pnlSupportChat.Visible = true;
            }
        }
    }
Exemple #21
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged   += Site_Changed;
        siteSelector.UniSelector.DialogWindowName      = "SiteSelectionDialog";

        // All cultures field in cultures mode
        switch (FilterMode)
        {
        case "cultures":
        {
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields.Add(new SpecialField {
                    Text = GetString("general.allcultures"), Value = String.Empty
                });
        }
        break;

        case "role":
        {
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
        }
        break;

        case "user":
        {
            siteSelector.AllowAll   = true;
            siteSelector.AllowEmpty = false;
        }
        break;

        case "notificationtemplate":
        {
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
        }
        break;

        case "notificationtemplateglobal":
        {
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields.Add(new SpecialField {
                    Text = GetString("general.global"), Value = String.Empty
                });
        }
        break;

        case "department":
        {
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
        }
        break;

        default:
        {
            if ((Parameters != null) && (Parameters["ObjectType"] != null))
            {
                // Get object type
                GeneralizedInfo currentObject = ModuleManager.GetObject(ValidationHelper.GetString(Parameters["ObjectType"], String.Empty));
                if (currentObject != null)
                {
                    // Show global value if supports global objects
                    if (currentObject.TypeInfo.SupportsGlobalObjects)
                    {
                        siteSelector.AllowGlobal = true;
                    }
                    siteSelector.AllowAll   = false;
                    siteSelector.AllowEmpty = false;
                    siteSelector.Value      = SiteContext.CurrentSiteID;
                }
            }
            else
            {
                // Use default settings
                siteSelector.AllowAll   = true;
                siteSelector.AllowEmpty = false;
                plcLabel.Visible        = false;
                RemoveFormFilterStyles();
            }
        }
        break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.Value = defaultValue;
                }
            }
        }
    }
Exemple #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Groups != null)
        {
            ScriptHelper.RegisterJQuery(Page);
            ScriptHelper.RegisterScriptFile(Page, "jquery/jquery-tools.js");
            ScriptHelper.RegisterScriptFile(Page, "~/CMSAdminControls/UI/UniMenu/UniMenu.js");

            if (RememberSelectedItem)
            {
                StringBuilder selectionScript = new StringBuilder();
                selectionScript.AppendLine("function SelectButton(elem)");
                selectionScript.AppendLine("{");
                selectionScript.AppendLine("    var selected = 'Selected';");
                selectionScript.AppendLine("    var jElem =$j(elem);");
                selectionScript.AppendFormat("    $j('#{0}').find('.'+selected).removeClass(selected);\n", pnlControls.ClientID);
                selectionScript.AppendLine("    jElem.addClass(selected);");
                selectionScript.AppendLine("}");
                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "UIToolbarSelectionScript", ScriptHelper.GetScript(selectionScript.ToString()));
            }

            // Generate script for activating menu buttons by script
            string        buttonSelection       = (RememberSelectedItem ? "SelectButton(this);" : "");
            StringBuilder remoteSelectionScript = new StringBuilder();
            remoteSelectionScript.AppendLine("var SelectedItemID = null;");
            remoteSelectionScript.AppendLine("function SelectItem(elementID, elementUrl, forceSelection)");
            remoteSelectionScript.AppendLine("{");
            remoteSelectionScript.AppendLine("  if(forceSelection === undefined) forceSelection = true;");
            remoteSelectionScript.AppendLine("  if(SelectedItemID == elementID && !forceSelection) { return; }");
            remoteSelectionScript.AppendLine("    SelectedItemID = elementID;");
            remoteSelectionScript.AppendLine("    var selected = 'Selected';");
            remoteSelectionScript.AppendFormat("    $j(\"#{0} .\"+selected).removeClass(selected);\n", pnlControls.ClientID);
            remoteSelectionScript.AppendFormat("    $j(\"#{0} div[name='\"+elementID+\"']\").addClass(selected);\n", pnlControls.ClientID);
            remoteSelectionScript.AppendLine("    if(elementUrl != null && elementUrl != '') {");
            if (!String.IsNullOrEmpty(TargetFrameset))
            {
                remoteSelectionScript.AppendLine(String.Format("{0}parent.frames['{1}'].location.href = elementUrl;", buttonSelection, TargetFrameset));
            }
            else
            {
                remoteSelectionScript.AppendLine(buttonSelection + "self.location.href = elementUrl;");
            }
            remoteSelectionScript.AppendLine("    }");
            remoteSelectionScript.AppendLine("}");
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "UIToolbarRemoteSelectionScript", ScriptHelper.GetScript(remoteSelectionScript.ToString()));

            ArrayList controlsList = new ArrayList();
            int       groupsCount  = Groups.GetUpperBound(0) + 1;
            InnerControls = new List <CMSUserControl>(groupsCount);

            // Process the groups
            for (identifier = 0; identifier < groupsCount; identifier++)
            {
                // Check array dimensions
                if (Groups.GetUpperBound(1) < 2)
                {
                    if (ShowErrors)
                    {
                        Controls.Add(GetError(GetString("unimenu.wrongdimensions")));
                    }
                    continue;
                }

                string captionText        = Groups[identifier, 0];
                string contentControlPath = Groups[identifier, 1];
                string cssClass           = Groups[identifier, 2];
                int    uiElementId        = (Groups.GetUpperBound(1) == 3 ? ValidationHelper.GetInteger(Groups[identifier, 3], 0) : 0);

                // Caption and path to content control have to be entered
                if (string.IsNullOrEmpty(captionText))
                {
                    if (ShowErrors)
                    {
                        Controls.Add(GetError(GetString("unimenu.captionempty")));
                    }
                    continue;
                }
                if (string.IsNullOrEmpty(contentControlPath) && (uiElementId <= 0))
                {
                    if (ShowErrors)
                    {
                        Controls.Add(GetError(GetString("unimenu.pathempty")));
                    }
                    continue;
                }

                CMSPanel groupPanel = new CMSPanel()
                {
                    ID      = "pnlGroup" + identifier,
                    ShortID = "g" + identifier
                };

                // Add controls to main panel
                groupPanel.Controls.Add(GetLeftBorder());

                bool createGroup = false;

                if (!string.IsNullOrEmpty(contentControlPath))
                {
                    CMSUserControl contentControl = null;
                    try
                    {
                        // Try to load content control
                        contentControl         = (CMSUserControl)Page.LoadControl(contentControlPath);
                        contentControl.ID      = "ctrlContent" + identifier;
                        contentControl.ShortID = "c" + identifier;
                    }
                    catch
                    {
                        Controls.Add(GetError(GetString("unimenu.errorloadingcontrol")));
                        continue;
                    }
                    Panel innerPanel = GetContent(contentControl, 0, captionText);
                    if (innerPanel != null)
                    {
                        groupPanel.Controls.Add(innerPanel);
                        createGroup = true;
                    }

                    InnerControls.Insert(identifier, (CMSUserControl)contentControl);
                }
                else if (uiElementId > 0)
                {
                    Panel innerPanel = GetContent(null, uiElementId, captionText);
                    if (innerPanel != null)
                    {
                        groupPanel.Controls.Add(innerPanel);
                        createGroup = true;
                    }
                }

                groupPanel.Controls.Add(GetRightBorder());

                groupPanel.CssClass = cssClass;

                // Add group panel to list of controls
                if (createGroup)
                {
                    mMenuEmpty = false;
                    controlsList.Add(groupPanel);

                    // Insert separator after group
                    if (groupsCount > 1)
                    {
                        controlsList.Add(GetGroupSeparator());
                    }
                }
            }

            // Handle the preselection
            if (preselectedPanel != null)
            {
                // Add the selected class to the preselected button
                preselectedPanel.CssClass += " Selected";
            }
            else if ((firstPanel != null) && HighlightFirstItem)
            {
                // Add the selected class to the first button
                firstPanel.CssClass += " Selected";
            }

            // Add group panels to to the control
            foreach (Control control in controlsList)
            {
                pnlControls.Controls.Add(control);
            }
        }
        else
        {
            Controls.Add(GetError(GetString("unimenu.wrongdimensions")));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContactManagement);

        // Check if current user is authorised to read either site or global contacts
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource(ModuleEntry.CONTACTMANAGEMENT, "ModifyContacts"))
        {
            RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ModifyContacts");
        }

        // Init header actions
        string[,] actions = new string[1,11];
        actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON;
        actions[0, 1] = GetString("General.Save");
        actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        actions[0, 6] = "save";
        actions[0, 8] = "true";
        CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        CurrentMaster.HeaderActions.Actions = actions;

        // Get form info
        BizFormInfo formInfo = (BizFormInfo)EditedObject;
        if (formInfo == null)
        {
            return;
        }

        // Get class of the form
        DataClassInfo classInfo = DataClassInfoProvider.GetDataClass(formInfo.FormClassID);

        // Load mapping dialog control and initialize it
        plcMapping.Controls.Clear();
        mapControl = (CMSUserControl)Page.LoadUserControl("~/CMSModules/ContactManagement/Controls/UI/Contact/MappingDialog.ascx");
        if (mapControl != null)
        {
            mapControl.ID = "ctrlMapping";
            mapControl.SetValue("classname", classInfo.ClassName);
            mapControl.SetValue("allowoverwrite", classInfo.ClassContactOverwriteEnabled);
            plcMapping.Controls.Add(mapControl);
        }

        if (!RequestHelper.IsPostBack())
        {
            // Initialize checkbox value and mapping dialog visibility
            plcMapping.Visible = chkLogActivity.Checked = formInfo.FormLogActivity;
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        // Hide filter button, this filter has its own
        UniGrid grid = filteredControl as UniGrid;
        if (grid != null)
        {
            grid.HideFilterButton = true;
        }

        allowGlobalProducts = ECommerceSettings.AllowGlobalProducts(CMSContext.CurrentSiteName);

        // Initialize controls
        if (!URLHelper.IsPostback())
        {
            FillThreeStateDDL(ddlNeedsShipping);
            FillThreeStateDDL(ddlAllowForSale);

            FillDocumentTypesDDL();
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged += Site_Changed;
        siteSelector.UniSelector.DialogWindowName = "SiteSelectionDialog";
        siteSelector.IsLiveSite = this.IsLiveSite;

        // All cultures field in cultures mode
        switch (this.FilterMode)
        {
            case "cultures":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.UniSelector.SpecialFields = new string[1, 2] { { ResHelper.GetString("general.allcultures"), "" } };
                break;

            case "role":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.AllowGlobal = true;
                break;

            case "user":
                siteSelector.AllowAll = true;
                siteSelector.AllowEmpty = false;
                break;

            case "notificationtemplate":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                break;

            case "notificationtemplateglobal":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.UniSelector.SpecialFields = new string[1, 2] { { ResHelper.GetString("general.global"), "" } };
                break;

            case "department":
                siteSelector.AllowEmpty = false;
                siteSelector.AllowAll = false;
                siteSelector.AllowGlobal = true;
                break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.UniSelector.Value = defaultValue;
                    WhereCondition = GenerateWhereCondition(defaultValue);
                }
            }
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged += Site_Changed;
        siteSelector.UniSelector.DialogWindowName = "SiteSelectionDialog";

        // All cultures field in cultures mode
        switch (FilterMode)
        {
            case "cultures":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.UniSelector.SpecialFields.Add(new SpecialField { Text = GetString("general.allcultures"), Value = String.Empty });
                }
                break;

            case "role":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.AllowGlobal = true;
                }
                break;

            case "user":
                {
                    siteSelector.AllowAll = true;
                    siteSelector.AllowEmpty = false;
                }
                break;

            case "notificationtemplate":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                }
                break;

            case "notificationtemplateglobal":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.UniSelector.SpecialFields.Add(new SpecialField { Text = GetString("general.global"), Value = String.Empty });
                }
                break;

            case "department":
                {
                    siteSelector.AllowEmpty = false;
                    siteSelector.AllowAll = false;
                    siteSelector.AllowGlobal = true;
                }
                break;

            default:
                {
                    if ((Parameters != null) && (Parameters["ObjectType"] != null))
                    {
                        // Get object type
                        GeneralizedInfo currentObject = ModuleManager.GetObject(ValidationHelper.GetString(Parameters["ObjectType"], String.Empty));
                        if (currentObject != null)
                        {
                            // Show global value if supports global objects
                            if (currentObject.TypeInfo.SupportsGlobalObjects)
                            {
                                siteSelector.AllowGlobal = true;
                            }
                            siteSelector.AllowAll = false;
                            siteSelector.AllowEmpty = false;
                            siteSelector.Value = SiteContext.CurrentSiteID;
                        }
                    }
                    else
                    {
                        // Use default settings
                        siteSelector.AllowAll = true;
                        siteSelector.AllowEmpty = false;
                        plcLabel.Visible = false;
                        RemoveFormFilterStyles();
                    }
                }
                break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.UniSelector.Value = defaultValue;
                    WhereCondition = GenerateWhereCondition(defaultValue);
                }
            }
        }
    }
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        filteredControl = FilteredControl as CMSUserControl;

        // Initialize UniSelector with document types
        uniSelector.DisplayNameFormat = "{%ClassDisplayName%} ({%ClassName%})";
        uniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;

        if (drpClassType.SelectedValue == "doctype")
        {
            uniSelector.WhereCondition = "ClassIsDocumentType = 1";
        }
        else
        {
            uniSelector.WhereCondition = "ClassIsCustomTable = 1";
        }

        if (!IsSiteManager)
        {
            uniSelector.WhereCondition = SqlHelperClass.AddWhereCondition(uniSelector.WhereCondition, "ClassID IN (SELECT ClassID FROM CMS_ClassSite WHERE SiteID = " + CMSContext.CurrentSiteID + ")");
        }

        uniSelector.ReturnColumnName = "ClassID";
        uniSelector.ObjectType = SettingsObjectType.CLASS;
        uniSelector.ResourcePrefix = "allowedclasscontrol";
        uniSelector.AllowAll = false;
        uniSelector.AllowEmpty = false;
        uniSelector.DropDownSingleSelect.AutoPostBack = true;
        uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged;
        uniSelector.IsLiveSite = IsLiveSite && (filteredControl != null ? filteredControl.IsLiveSite : true);
        uniSelector.DialogWindowName = "DocumentTypeSelectionDialog";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Initialize menu
        DataSet siteCulturesDS = CultureInfoProvider.GetSiteCultures(CMSContext.CurrentSiteName);

        Group content = new Group
        {
            Caption     = GetString("ContentMenu.ContentManagement"),
            ControlPath = "~/CMSAdminControls/UI/UniMenu/Content/ContentMenu.ascx",
            CssClass    = "ContentMenuGroup"
        };

        contentMenu.Groups.Add(content);

        CMSUserControl modeMenu = Page.LoadUserControl("~/CMSAdminControls/UI/UniMenu/Content/ModeMenu.ascx") as CMSUserControl;

        if (modeMenu != null)
        {
            modeMenu.ID = "grpMode";
            modeMenu.SetValue("SelectedMode", SelectedMode);
            Group view = new Group
            {
                Caption  = GetString("ContentMenu.ViewMode"),
                Control  = modeMenu,
                CssClass = "ContentMenuGroup"
            };
            contentMenu.Groups.Add(view);
        }

        if (DeviceProfileInfoProvider.IsDeviceProfilesEnabled(CMSContext.CurrentSiteName))
        {
            CMSUserControl devicesMenu = Page.LoadUserControl("~/CMSModules/DeviceProfile/Controls/ProfilesMenuControl.ascx") as CMSUserControl;
            if (devicesMenu != null)
            {
                devicesMenu.ID = "grpDevices";
                devicesMenu.SetValue("SelectedDevice", SelectedDevice);
                Group view = new Group
                {
                    Caption  = GetString("ContentMenu.Device"),
                    Control  = devicesMenu,
                    CssClass = "ContentMenuGroup"
                };
                contentMenu.Groups.Add(view);
            }
        }

        // Do not display language menu
        if (!DataHelper.DataSourceIsEmpty(siteCulturesDS) && (siteCulturesDS.Tables[0].Rows.Count > 1))
        {
            CMSUserControl langMenu = Page.LoadUserControl("~/CMSModules/Content/Controls/LanguageMenu.ascx") as CMSUserControl;
            if (langMenu != null)
            {
                langMenu.ID = "grpLang";
                langMenu.SetValue("SelectedCulture", SelectedCulture);
                Group lang = new Group
                {
                    Control  = langMenu,
                    Caption  = GetString("contentmenu.language"),
                    CssClass = "ContentMenuGroup"
                };
                contentMenu.Groups.Add(lang);
            }
        }

        Group other = new Group
        {
            Caption     = GetString("contentmenu.other"),
            ControlPath = "~/CMSAdminControls/UI/UniMenu/Content/OtherMenu.ascx",
            CssClass    = "ContentMenuGroup"
        };

        contentMenu.Groups.Add(other);
    }
Exemple #29
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        filteredControl = FilteredControl as CMSUserControl;

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.UniSelector.OnSelectionChanged   += Site_Changed;
        siteSelector.UniSelector.DialogWindowName      = "SiteSelectionDialog";
        siteSelector.IsLiveSite = this.IsLiveSite;

        // All cultures field in cultures mode
        switch (this.FilterMode)
        {
        case "cultures":
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields = new string[1, 2] {
                { ResHelper.GetString("general.allcultures"), "" }
            };
            break;

        case "role":
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
            break;

        case "user":
            siteSelector.AllowAll   = true;
            siteSelector.AllowEmpty = false;
            break;

        case "notificationtemplate":
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            break;

        case "notificationtemplateglobal":
            siteSelector.AllowEmpty = false;
            siteSelector.AllowAll   = false;
            siteSelector.UniSelector.SpecialFields = new string[1, 2] {
                { ResHelper.GetString("general.global"), "" }
            };
            break;

        case "department":
            siteSelector.AllowEmpty  = false;
            siteSelector.AllowAll    = false;
            siteSelector.AllowGlobal = true;
            break;
        }

        // Set initial filter value
        if (!RequestHelper.IsPostBack())
        {
            if (filteredControl != null)
            {
                int defaultValue = ValidationHelper.GetInteger(filteredControl.GetValue("DefaultFilterValue"), 0);

                if (defaultValue > 0)
                {
                    siteSelector.UniSelector.Value = defaultValue;
                    WhereCondition = GenerateWhereCondition(defaultValue);
                }
            }
        }
    }