protected void Page_PreRender(object sender, EventArgs e)
 {
     // Check if site hasn't assigned more cultures than license approve
     if ((si != null) && !CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Insert))
     {
         uniSelector.ButtonAddItems.Enabled = false;
     }
     else if ((si != null) && !CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
     {
         ShowError(GetString("licenselimitation.siteculturesexceeded"));
         uniSelector.ButtonAddItems.Enabled = false;
     }
 }
Exemple #2
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        // Check license limitations
        if (!CultureInfoProvider.LicenseVersionCheck())
        {
            LicenseHelper.GetAllAvailableKeys(FeatureEnum.Multilingual);
        }

        // Set selected tab
        UIContext.PropertyTab = PropertyTabEnum.Languages;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get data from parameters
        siteId         = QueryHelper.GetInteger("siteid", 0);
        currentCulture = QueryHelper.GetString("culture", "");

        // Strings and images
        this.btnOk.Text     = GetString("General.Ok");
        this.btnCancel.Text = GetString("General.Cancel");

        this.lblNewCulture.Text = GetString("SiteDefaultCultureChange.NewCulture");
        this.chkDocuments.Text  = GetString("SiteDefaultCultureChange.Documents");

        CurrentMaster.Title.TitleText  = GetString("SiteDefaultCultureChange.Title");
        CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Sites/changeculture.png");

        SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);

        if (si != null)
        {
            // Check licensing policy
            if (LicenseHelper.CheckFeature(URLHelper.GetDomainName(si.DomainName), FeatureEnum.Multilingual))
            {
                // Get only site cultures
                this.cultureSelector.SiteID = siteId;
            }
            else
            {
                // Get all cultures for non multilingual
                cultureSelector.DisplayAllCultures = true;

                // Have to change culture of documents
                chkDocuments.Enabled = false;
            }

            // Check version limitations
            if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
            {
                lblError.Text    = GetString("licenselimitation.siteculturesexceeded");
                lblError.Visible = true;
                pnlForm.Enabled  = false;
            }


            currentCulture = CultureHelper.GetDefaultCulture(si.SiteName);
            if (!URLHelper.IsPostback())
            {
                this.cultureSelector.Value = currentCulture;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get the site info
        si = SiteInfoProvider.GetSiteInfo(QueryHelper.GetInteger("siteId", 0));
        if (si != null)
        {
            bool multilingual  = LicenseHelper.CheckFeature(URLHelper.GetDomainName(si.DomainName), FeatureEnum.Multilingual);
            bool cultureOnSite = CultureInfoProvider.IsCultureOnSite(CultureHelper.GetDefaultCulture(si.SiteName), si.SiteName);
            if (!multilingual && !cultureOnSite)
            {
                lnkAssignDefault.Text    = GetString("sitecultures.assigntodefault");
                lnkAssignDefault.Visible = true;
                plcAll.Visible           = false;
            }
            else
            {
                // Redirect only if cultures not exceeded => to be able to unassign
                if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
                {
                    LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetDomainName(si.DomainName), FeatureEnum.Multilingual);
                }
            }

            lblAvialable.Text = GetString("site_edit_cultures.culturetitle");


            siteName = si.SiteName;

            // Store default culture (it can't be removed)
            defaultCulture = CultureHelper.GetDefaultCulture(siteName);

            // Get the active cultures from DB
            DataSet ds = CultureInfoProvider.GetCultures("CultureID IN (SELECT CultureID FROM CMS_SiteCulture WHERE SiteID = " + si.SiteID + ")", null, 0, "CultureCode");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                currentValues = TextHelper.Join(";", SystemDataHelper.GetStringValues(ds.Tables[0], "CultureCode"));
            }

            if (!RequestHelper.IsPostBack())
            {
                uniSelector.Value = currentValues;
            }
        }

        uniSelector.ReturnColumnName    = "CultureCode";
        uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged;
    }
Exemple #5
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        // Hide Culture selector if there is only one culture or don't have license for multiple languages
        if ((cultureSelector.UniSelector.HasData && (cultureSelector.DropDownCultures.Items.Count < 2)) ||
            !CultureInfoProvider.LicenseVersionCheck())
        {
            Control languageMenu = pnlLang.Parent;

            if (languageMenu != null)
            {
                Control contentPanel = languageMenu.Parent;
                if (contentPanel != null)
                {
                    Control groupPanel = contentPanel.Parent;
                    if (groupPanel != null)
                    {
                        groupPanel.Visible = false;
                    }
                }
            }
        }
    }
Exemple #6
0
    protected string[] tabElem_OnTabCreated(UIElementInfo element, string[] parameters, int tabIndex)
    {
        string elementName = element.ElementName.ToLower();
        string siteName    = CMSContext.CurrentSiteName;

        if ((elementName == "onlinemarketing.languages") && (!CultureInfoProvider.IsSiteMultilignual(siteName) || !CultureInfoProvider.LicenseVersionCheck()))
        {
            return(null);
        }

        if (elementName.StartsWith("onlinemarketing.") && (!ModuleEntry.IsModuleLoaded("cms.onlinemarketing")))
        {
            return(null);
        }

        if (elementName.StartsWith("onlinemarketing.") && (elementName.Substring("onlinemarketing.".Length) == selected))
        {
            selectedTabIndex = tabIndex;
        }

        return(parameters);
    }
    protected void SaveSites()
    {
        // Remove old items
        string newValues        = ValidationHelper.GetString(usSites.Value, null);
        string items            = DataHelper.GetNewItemsInList(newValues, currentValues);
        bool   somethingChanged = false;
        bool   hasErrors        = false;

        if (!string.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (newItems != null)
            {
                // Add all new items to site
                foreach (string item in newItems)
                {
                    int siteId = ValidationHelper.GetInteger(item, 0);

                    SiteInfo    si = SiteInfoProvider.GetSiteInfo(siteId);
                    CultureInfo ci = CultureInfoProvider.GetCultureInfo(culture.CultureID);
                    if ((si != null) && (ci != null))
                    {
                        // Check if site does not contain document from this culture
                        TreeProvider tree  = new TreeProvider(CMSContext.CurrentUser);
                        DataSet      nodes = tree.SelectNodes(si.SiteName, "/%", ci.CultureCode, false, null, null, null, -1, false, 1, "NodeID");
                        if (DataHelper.DataSourceIsEmpty(nodes))
                        {
                            CultureInfoProvider.RemoveCultureFromSite(culture.CultureID, siteId);
                            somethingChanged = true;
                        }
                        else
                        {
                            hasErrors = true;
                            ShowError(string.Format(GetString("Culture_Edit_Sites.ErrorRemoveSiteFromCulture"), si.DisplayName));
                            continue;
                        }
                    }
                }
            }
        }

        // Add new items
        items = DataHelper.GetNewItemsInList(currentValues, newValues);
        if (!string.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (newItems != null)
            {
                // Add all new items to site
                foreach (string item in newItems)
                {
                    int siteId = ValidationHelper.GetInteger(item, 0);

                    // Add cullture to site
                    SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);
                    if (si != null)
                    {
                        if (CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Insert))
                        {
                            CultureInfoProvider.AddCultureToSite(culture.CultureID, siteId);
                            somethingChanged = true;
                        }
                        else
                        {
                            hasErrors = true;
                            ShowError(GetString("licenselimitation.siteculturesexceeded"));
                            break;
                        }
                    }
                }
            }
        }

        // If there were some errors, reload uniselector
        if (hasErrors)
        {
            usSites.Value = GetCultureSites();
            usSites.Reload(true);
        }

        if (somethingChanged)
        {
            ShowInformation(GetString("General.ChangesSaved"));
        }
    }
    protected TabItem tabElem_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        bool   splitViewSupported = true;
        string elementName        = element.ElementName.ToLowerCSafe();

        switch (elementName)
        {
        case "properties.languages":
            splitViewSupported = false;
            if (!CultureInfoProvider.IsSiteMultilignual(CMSContext.CurrentSiteName) || !CultureInfoProvider.LicenseVersionCheck())
            {
                return(null);
            }
            break;

        case "properties.security":
        case "properties.relateddocs":
        case "properties.linkeddocs":
            splitViewSupported = false;
            break;

        case "properties.wireframe":
        {
            // Hide wireframe tab if wireframe is not present
            if ((DocumentManager.Node == null) || (DocumentManager.Node.NodeWireframeTemplateID <= 0))
            {
                return(null);
            }

            splitViewSupported = false;
        }
        break;

        case "properties.variants":

            if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "")
            {
                // Check license and whether content personalization is enabled and whether exists at least one variant for current template
                if ((DocumentManager.Node == null) ||
                    !LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContentPersonalization, ModuleEntry.ONLINEMARKETING) ||
                    !ResourceSiteInfoProvider.IsResourceOnSite("CMS.ContentPersonalization", CMSContext.CurrentSiteName) ||
                    !PortalContext.ContentPersonalizationEnabled ||
                    (ModuleCommands.OnlineMarketingGetContentPersonalizationVariantId(DocumentManager.Node.GetUsedPageTemplateId(), String.Empty) <= 0))
                {
                    return(null);
                }
            }


            break;

        case "properties.workflow":
        case "properties.versions":
            if (DocumentManager.Workflow == null)
            {
                return(null);
            }
            break;
        }

        // Ensure tab pre-selection
        if (elementName.StartsWithCSafe("properties.") && (elementName.Substring("properties.".Length) == selected))
        {
            CurrentMaster.Tabs.SelectedTab = tabIndex;
        }

        // Ensure split view mode
        if (splitViewSupported && CMSContext.DisplaySplitMode)
        {
            tab.RedirectUrl = GetSplitViewUrl(tab.RedirectUrl);
        }

        return(tab);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // If languages on site not ok, redirect
        if (!CultureInfoProvider.LicenseVersionCheck())
        {
            URLHelper.Redirect(ResolveUrl("~/CMSMessages/LicenseLimit.aspx"));
        }

        userId = QueryHelper.GetInteger("userid", 0);
        siteID = SiteID;

        if (userId > 0)
        {
            ui = UserInfoProvider.GetUserInfo(userId);
            CheckUserAvaibleOnSite(ui);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                pnlLanguages.Visible = false;
                ShowError(GetString("Administration-User_List.ErrorGlobalAdmin"));
                return;
            }

            // Set site selector
            siteSelector.DropDownSingleSelect.AutoPostBack = true;
            siteSelector.AllowAll         = false;
            siteSelector.OnlyRunningSites = false;
            siteSelector.UserId           = ui.UserID;
            siteSelector.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;

            if (!RequestHelper.IsPostBack())
            {
                // Initialize radio buttons
                radAllLanguages.Checked      = !ui.UserHasAllowedCultures;
                radSelectedLanguages.Checked = ui.UserHasAllowedCultures;

                // Load the site selector with the data in order to preselect current site (if available in the list)
                siteSelector.UniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;
                siteSelector.UniSelector.AllowEmpty    = false;
                siteSelector.UpdateWhereCondition();
                siteSelector.Reload(true);

                // Select the current site if it is in the list, otherwise select the first site in the list
                if (siteSelector.DropDownSingleSelect.Items.FindByValue(CMSContext.CurrentSiteID.ToString()) != null)
                {
                    siteSelector.Value = CMSContext.CurrentSiteID;
                }
                else if (siteSelector.DropDownSingleSelect.Items.Count > 0)
                {
                    siteSelector.Value = siteSelector.DropDownSingleSelect.Items[0].Value;
                }
                siteSelector.DropDownSingleSelect.SelectedValue = siteSelector.Value.ToString();
            }


            // Show site selection in CMSDesk only for global administrator
            if ((SiteID > 0) && (!CMSContext.CurrentUser.IsGlobalAdministrator))
            {
                plcSite.Visible = false;
            }
            else
            {
                plcSite.Visible = radSelectedLanguages.Checked;
                siteID          = siteSelector.SiteID;
            }

            // Set grid visibility
            plcCultures.Visible = radSelectedLanguages.Checked;

            // Load user cultures
            DataTable dt = UserCultureInfoProvider.GetUserCultures(userId, siteID, null, null);
            currentValues = TextHelper.Join(";", SystemDataHelper.GetStringValues(dt, "CultureID"));

            if (!RequestHelper.IsPostBack())
            {
                uniSelector.Value = currentValues;
                uniSelector.Reload(true);
            }
        }

        uniSelector.WhereCondition      = "CultureID IN (SELECT CultureID FROM CMS_SiteCulture WHERE SiteID = " + siteID + ")";
        uniSelector.OnSelectionChanged += uniSelector_OnSelectionChanged;

        radAllLanguages.CheckedChanged      += radAllLanguages_CheckedChanged;
        radSelectedLanguages.CheckedChanged += radSelectedLanguages_CheckedChanged;
    }
Exemple #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        siteId = QueryHelper.GetInteger("siteid", 0);

        RequiredFieldValidatorCodeName.ErrorMessage    = GetString("Administration-Site_Edit.RequiresCodeName");
        RequiredFieldValidatorDisplayName.ErrorMessage = GetString("Administration-Site_Edit.RequiresDisplayName");
        RequiredFieldValidatorDomainName.ErrorMessage  = GetString("Administration-Site_Edit.RequiresDomainName");

        lblCodeName.Text    = GetString("Site_Edit.CodeName");
        lblDescription.Text = GetString("Site_Edit.Description");
        lblDisplayName.Text = GetString("Site_Edit.DisplayName");
        lblDomainName.Text  = GetString("Site_Edit.DomainName");
        lblCulture.Text     = GetString("Site_Edit.ContentCulture");
        //lblLicenseKey.Text = GetString("Site_Edit.LicenseKey");
        lblCssStyle.Text       = GetString("NewSite_SiteDetails.CssStyle");
        lblEditorStyle.Text    = GetString("Site_Edit.EditorStyleSheet");
        lblVisitorCulture.Text = GetString("Site_Edit.VisitorCulture");
        btnOk.Text             = GetString("general.ok");
        btnChange.Text         = GetString("general.change");

        // Set the culture textbox readonly
        this.txtCulture.Attributes.Add("readonly", "readonly");

        // Stylesheet selector
        ctrlEditorSelectStyleSheet.CurrentSelector.SpecialFields = new string[1, 2] {
            { GetString("administration-site_edit.sitestylesheet"), "0" }
        };
        ctrlEditorSelectStyleSheet.ReturnColumnName = "StyleSheetID";
        ctrlEditorSelectStyleSheet.SiteId           = siteId;

        ctrlSiteSelectStyleSheet.CurrentSelector.SpecialFields = new string[1, 2] {
            { GetString("general.selectnone"), "0" }
        };
        ctrlSiteSelectStyleSheet.ReturnColumnName = "StyleSheetID";
        ctrlSiteSelectStyleSheet.SiteId           = siteId;

        ltlScript.Text = ScriptHelper.GetScript(
            "var pageChangeUrl='" + ResolveUrl("~/CMSSiteManager/Sites/CultureChange.aspx") + "'; " +
            "function ChangeCulture(documentChanged){ var hiddenElem = document.getElementById('" + hdnDocumentsChangeChecked.ClientID + "');" +
            "hiddenElem.value = documentChanged;" +
            Page.ClientScript.GetPostBackEventReference(btnHidden, "") + "  } "
            );

        // Initialize culture selector
        this.cultureSelector.AddDefaultRecord = false;
        this.cultureSelector.SpecialFields    = new string[, ] {
            { GetString("Site_Edit.Automatic"), "" }
        };
        this.cultureSelector.SiteID = siteId;

        si = SiteInfoProvider.GetSiteInfo(siteId);
        if (si != null)
        {
            if (!RequestHelper.IsPostBack() && (si.SiteName != null))
            {
                siteName = si.SiteName;

                txtCodeName.Text    = siteName;
                txtDescription.Text = si.Description;
                txtDisplayName.Text = si.DisplayName;
                txtDomainName.Text  = si.DomainName;

                ctrlSiteSelectStyleSheet.Value   = si.SiteDefaultStylesheetID;
                ctrlEditorSelectStyleSheet.Value = si.SiteDefaultEditorStylesheet;

                if (CultureHelper.GetDefaultCulture(siteName) != null)
                {
                    CultureInfo ci = CultureInfoProvider.GetCultureInfo(CultureHelper.GetDefaultCulture(siteName));

                    if (ci != null)
                    {
                        txtCulture.Text = ResHelper.LocalizeString(ci.CultureName);
                        currentCulture  = ci.CultureCode;
                    }
                }

                this.cultureSelector.Value = si.DefaultVisitorCulture;

                // Check version limitations
                if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
                {
                    lblError.Text           = GetString("licenselimitation.siteculturesexceeded");
                    lblError.Visible        = true;
                    cultureSelector.Enabled = false;
                    btnOk.Enabled           = false;
                }
            }
        }

        btnChange.OnClientClick = "OpenCultureChanger('" + siteId + "','" + currentCulture + "'); return false;";
    }
Exemple #11
0
    protected string[] tabElem_OnTabCreated(UIElementInfo element, string[] parameters, int tabIndex)
    {
        bool   splitViewSupported = true;
        string elementName        = element.ElementName.ToLower();

        switch (elementName)
        {
        case "properties.languages":
            splitViewSupported = false;
            if (!CultureInfoProvider.IsSiteMultilignual(CMSContext.CurrentSiteName) || !CultureInfoProvider.LicenseVersionCheck())
            {
                return(null);
            }
            break;

        case "properties.security":
        case "properties.relateddocs":
        case "properties.linkeddocs":
            splitViewSupported = false;
            break;

        case "properties.variants":
            // Check license
            if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "")
            {
                if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContentPersonalization, ModuleEntry.ONLINEMARKETING) ||
                    !ResourceSiteInfoProvider.IsResourceOnSite("CMS.ContentPersonalization", CMSContext.CurrentSiteName))
                {
                    return(null);
                }
            }
            break;
        }

        // Ensure tab preselection
        if (elementName.StartsWith("properties.") && (elementName.Substring("properties.".Length) == selected))
        {
            CurrentMaster.Tabs.SelectedTab = tabIndex;
        }

        // Ensure split view mode
        if (splitViewSupported && CMSContext.DisplaySplitMode)
        {
            parameters[2] = GetSplitViewUrl(parameters[2]);
        }

        return(parameters);
    }
Exemple #12
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Display LANGUAGES option just in case its available in the current site context
        if (!pnlUILanguages.IsHidden)
        {
            pnlUILanguages.Visible = CultureInfoProvider.IsSiteMultilignual(CMSContext.CurrentSiteName) && CultureInfoProvider.LicenseVersionCheck();
        }
    }
Exemple #13
0
    protected void ContextMenu_OnReloadData(object sender, EventArgs e)
    {
        int nodeId = ValidationHelper.GetInteger(ContextMenu.Parameter, 0);

        // Get the node
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
        TreeNode     node = tree.SelectSingleNode(nodeId);

        if (node != null)
        {
            // Hide Properties menu item with separator
            plcProperties.Visible = !HidePropertiesItem && !node.IsWireframe();
            if (plcProperties.Visible)
            {
                iProperties.ImageUrl = GetImageUrl("CMSModules/CMS_Content/ContextMenu/Properties.png");
                iProperties.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'general');");

                // Properties menu
                iGeneral.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'general');");
                iUrls.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'urls');");
                iTemplate.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'template');");
                iMetadata.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'metadata');");
                iCategories.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'categories');");
                iMenu.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'menu');");
                iWorkflow.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'workflow');");
                iVersions.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'versions');");
                iRelated.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'relateddocs');");
                iLinked.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'linkeddocs');");
                iSecurity.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'security');");
                iAttachments.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'attachments');");
                iLanguages.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'languages');");
                iWireframe.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'wireframe');");
                iVariants.Attributes.Add("onclick", "Properties(GetContextMenuParameter('nodeMenu'), 'variants');");

                // Hide language item
                if (!CultureInfoProvider.IsSiteMultilignual(CMSContext.CurrentSiteName) || !CultureInfoProvider.LicenseVersionCheck())
                {
                    pnlUILanguages.Visible = false;
                }

                // Hide wireframe tab if wireframe is not present
                if (node.NodeWireframeTemplateID <= 0)
                {
                    pnlUIWireframe.Visible = false;
                }

                if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "")
                {
                    // Check license and whether content personalization is enabled and whether exists at least one variant for current template
                    if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContentPersonalization, ModuleEntry.ONLINEMARKETING) ||
                        !ResourceSiteInfoProvider.IsResourceOnSite("CMS.ContentPersonalization", CMSContext.CurrentSiteName) ||
                        !PortalContext.ContentPersonalizationEnabled ||
                        (ModuleCommands.OnlineMarketingGetContentPersonalizationVariantId(node.GetUsedPageTemplateId(), String.Empty) <= 0))
                    {
                        pnlUICPVariants.Visible = false;
                    }
                }

                // No workflow
                if (node.GetWorkflow() == null)
                {
                    // Hide menu items
                    pnlUIWorkflow.Visible = false;
                    pnlUIVersions.Visible = false;
                }
            }
        }
        else
        {
            iNoNode.Visible = true;
            plcFirstLevelContainer.Visible = false;
        }
    }
Exemple #14
0
    protected TabItem tabElem_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
    {
        string elementName = element.ElementName.ToLowerCSafe();
        string siteName    = CMSContext.CurrentSiteName;

        if ((elementName == "onlinemarketing.languages") && (!CultureInfoProvider.IsSiteMultilignual(siteName) || !CultureInfoProvider.LicenseVersionCheck()))
        {
            return(null);
        }

        if (elementName.StartsWithCSafe("onlinemarketing.") && (!ModuleEntry.IsModuleLoaded("cms.onlinemarketing")))
        {
            return(null);
        }

        return(tab);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        pnlGeneral.GroupingText  = GetString("general.general");
        pnlAdvanced.GroupingText = GetString("general.advanced");

        // Set selector mode
        selectClassNames.UniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;
        selectClassNames.UniSelector.AllowAll      = true;

        string condition         = string.Empty;
        string startingAliasPath = string.Empty;
        bool   excludeChildren   = false;
        bool   exclude           = false;
        int    classId           = 0;
        int    cultureId         = 0;


        if (WorkflowScopeId > 0)
        {
            if (CurrentScopeInfo != null)
            {
                workflowId        = CurrentScopeInfo.ScopeWorkflowID;
                siteId            = CurrentScopeInfo.ScopeSiteID;
                startingAliasPath = CurrentScopeInfo.ScopeStartingPath;
                classId           = CurrentScopeInfo.ScopeClassID;
                cultureId         = CurrentScopeInfo.ScopeCultureID;
                excludeChildren   = CurrentScopeInfo.ScopeExcludeChildren;
                exclude           = CurrentScopeInfo.ScopeExcluded;
                condition         = CurrentScopeInfo.ScopeMacroCondition;
            }
        }
        else
        {
            workflowId = QueryHelper.GetInteger("workflowid", 0);
            siteId     = QueryHelper.GetInteger("siteid", 0);
        }

        // Check languages on site
        SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);

        if (si != null)
        {
            // Check whether workflow is enabled for specified site
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetDomainName(si.DomainName), FeatureEnum.WorkflowVersioning);

            if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
            {
                ShowError(GetString("licenselimitation.siteculturesexceeded"));
                pnlForm.Enabled = false;
            }
            // Set selector's where condition
            selectClassNames.UniSelector.WhereCondition = "ClassID IN (SELECT ClassID FROM CMS_ClassSite WHERE SiteID=" + si.SiteID + ") AND ClassIsDocumentType = 1";
        }

        // Culture selector
        cultureSelector.UseCultureCode = false;
        cultureSelector.SpecialFields  = new string[, ] {
            { GetString("general.selectall"), "0" }
        };
        cultureSelector.SiteID = siteId;

        // Initialize condition resolver
        cbCondition.ResolverName      = "WorkflowBaseDocumentResolver";
        cbCondition.RuleCategoryNames = WorkflowObjectType.WORKFLOW;

        pathElem.SiteID = siteId;

        // Scripts for path selector
        if (!RequestHelper.IsPostBack())
        {
            cbCondition.Text = condition;
            pathElem.Value   = TreePathUtils.EnsureSingleNodePath(startingAliasPath);

            string className = DataClassInfoProvider.GetClassName(classId);
            if (!string.IsNullOrEmpty(className))
            {
                selectClassNames.Value = className;
            }

            // Show that the scope was created updated successfully
            if (QueryHelper.GetString("saved", string.Empty) == "1")
            {
                ShowChangesSaved();
            }

            cultureSelector.Value = cultureId;
            rbAllowed.Checked     = !exclude;
            rbExcluded.Checked    = exclude;

            // Only child documents
            if (startingAliasPath.EndsWithCSafe("/%"))
            {
                rbChildren.Checked = true;
            }
            else
            {
                // Only document
                if (excludeChildren)
                {
                    rbDoc.Checked = true;
                }
                // Document including children
                else
                {
                    rbDocAndChildren.Checked = true;
                }
            }
        }

        string workflowScopes    = GetString("Development-Workflow_Scope_New.Scopes");
        string workflowScopesUrl = "~/CMSModules/Workflows/Workflow_Scopes.aspx?workflowid=" + workflowId + "&siteid=" + siteId;
        string currentScope      = "";

        if (WorkflowScopeId > 0)
        {
            currentScope = GetString("Development-Workflow_Scope_New.ScopeID") + WorkflowScopeId;
        }
        else
        {
            currentScope = GetString("Development-Workflow_Scope_New.Scope");
        }

        // Initialize page title
        InitializeMasterPage(workflowScopes, workflowScopesUrl, currentScope);

        // Hide culture selector due to license restrictions
        plcCulture.Visible = LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Multilingual);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set selector mode
        selectClassNames.UniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;
        selectClassNames.UniSelector.AllowAll      = true;

        string startingAliasPath = string.Empty;
        int    classId           = 0;
        int    cultureId         = 0;


        if (WorkflowScopeId > 0)
        {
            if (CurrentScopeInfo != null)
            {
                workflowId        = CurrentScopeInfo.ScopeWorkflowID;
                siteId            = CurrentScopeInfo.ScopeSiteID;
                startingAliasPath = CurrentScopeInfo.ScopeStartingPath;
                classId           = CurrentScopeInfo.ScopeClassID;
                cultureId         = CurrentScopeInfo.ScopeCultureID;
            }
        }
        else
        {
            workflowId = QueryHelper.GetInteger("workflowid", 0);
            siteId     = QueryHelper.GetInteger("siteid", 0);
        }

        // Check languages on site
        SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);

        if (si != null)
        {
            // Check whether workflow is enabled for specified site
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetDomainName(si.DomainName), FeatureEnum.WorkflowVersioning);

            if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
            {
                lblError.Text    = GetString("licenselimitation.siteculturesexceeded");
                lblError.Visible = true;
                pnlForm.Enabled  = false;
            }
            // Set selector's where condition
            selectClassNames.UniSelector.WhereCondition = "ClassID IN (SELECT ClassID FROM CMS_ClassSite WHERE SiteID=" + si.SiteID + ") AND ClassIsDocumentType = 1";
        }

        // Culture selector
        cultureSelector.UseCultureCode = false;
        cultureSelector.SpecialFields  = new string[, ] {
            { GetString("general.selectall"), "0" }
        };
        cultureSelector.SiteID = siteId;

        pathElem.SiteID = siteId;

        // Scripts for path selector
        if (!RequestHelper.IsPostBack())
        {
            pathElem.Value = startingAliasPath;

            string className = DataClassInfoProvider.GetClassName(classId);
            if (!string.IsNullOrEmpty(className))
            {
                selectClassNames.Value = className;
            }

            // Show that the scope was created updated successfully
            if (QueryHelper.GetString("saved", string.Empty) == "1")
            {
                lblInfo.Visible = true;
                lblInfo.Text    = GetString("General.ChangesSaved");
            }

            cultureSelector.Value = cultureId;
        }

        string workflowScopes    = GetString("Development-Workflow_Scope_New.Scopes");
        string workflowScopesUrl = "~/CMSModules/Workflows/Workflow_Scopes.aspx?workflowid=" + workflowId + "&siteid=" + siteId;
        string currentScope      = "";

        if (WorkflowScopeId > 0)
        {
            currentScope = GetString("Development-Workflow_Scope_New.ScopeID") + WorkflowScopeId;
        }
        else
        {
            currentScope = GetString("Development-Workflow_Scope_New.Scope");
        }

        // Initialize page title
        InitializeMasterPage(workflowScopes, workflowScopesUrl, currentScope);

        // Hide culture selector due to license restrictions
        plcCulture.Visible = LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Multilingual);
    }