コード例 #1
0
    /// <summary>
    /// Initializes workflow edit menu.
    /// </summary>
    protected void InitalizeMenu()
    {
        string[,] tabs = new string[4, 4];
        tabs[0, 0]     = GetString("general.general");
        tabs[0, 1]     = "SetHelpTopic('helpTopic', 'newgeneral_tab');";
        tabs[0, 2]     = "Workflow_General.aspx?workflowId=" + workflowId;
        tabs[1, 0]     = GetString("Development-Workflow_Edit.Steps");
        tabs[1, 1]     = "SetHelpTopic('helpTopic', 'steps_tab');";
        tabs[1, 2]     = "Workflow_Steps.aspx?workflowId=" + workflowId;

        // Hide if no site or no running site
        if ((SiteInfoProvider.GetSitesCount() > 0))
        {
            tabs[2, 0] = GetString("Development-Workflow_Edit.Scopes");
            tabs[2, 1] = "SetHelpTopic('helpTopic', 'scope_tab');";
            tabs[2, 2] = "Workflow_Scopes.aspx?workflowId=" + workflowId;
        }

        tabs[3, 0] = GetString("general.documents");
        tabs[3, 1] = "SetHelpTopic('helpTopic', 'documents_tab');";
        tabs[3, 2] = "Workflow_Documents.aspx?workflowId=" + workflowId;

        CurrentMaster.Tabs.UrlTarget = "workflowsContent";
        CurrentMaster.Tabs.Tabs      = tabs;
    }
コード例 #2
0
    protected void btnDefault_Click(object sender, EventArgs e)
    {
        ResetFilter();

        // Load default selection
        ImportTypeEnum importType = ImportTypeEnum.Default;

        if (Settings.IsWebTemplate)
        {
            if (SiteInfoProvider.GetSitesCount() == 0)
            {
                // No site exists, overwrite all
                importType = ImportTypeEnum.AllNonConflicting;
            }
            else
            {
                // Some site exists, only new objects
                importType = ImportTypeEnum.New;
            }
        }

        DefaultSelectionParameters parameters = new DefaultSelectionParameters()
        {
            ObjectType       = base.ObjectType,
            SiteObjects      = base.SiteObject,
            ImportType       = importType,
            LoadTasks        = false,
            ClearProgressLog = true
        };

        Settings.LoadDefaultSelection(parameters);

        RaiseButtonPressed(sender, e);
    }
コード例 #3
0
    protected void CtrlAsyncUnzipOnFinished(object sender, EventArgs e)
    {
        // Stop the timer
        const string script = "StopUnzipTimer();";

        var settings = ImportSettings;

        // Check if a new module is being imported
        if (settings.IsInstallableModule)
        {
            // Start the import process immediately
            settings.DefaultProcessObjectType = ProcessObjectEnum.All;
            settings.CopyFiles = false;
            settings.CopyCodeFiles = false;
            if (!StartImport(settings))
            {
                return;
            }

            // Skip step for site and objects selection
            wzdImport.ActiveStepIndex++;

            // Skip step for object selection
            wzdImport.ActiveStepIndex++;

        } // Decide if importing site
        else if (settings.SiteIsIncluded)
        {
            // No site exists and...
            if (SiteInfoProvider.GetSitesCount() == 0)
            {
                // ...single site import
                if (ValidationHelper.GetBoolean(settings.GetInfo(ImportExportHelper.INFO_SINGLE_OBJECT), false))
                {
                    SetErrorLabel(GetString("SiteImport.SingleSiteObjectNoSite"));
                    return;
                }
                // ...older unsupported (PE) site
                if (!SiteIsSupported(settings))
                {
                    SetErrorLabel(GetString("SiteImport.SiteNotSupported"));
                    return;
                }
            }

            // Init control
            stpSiteDetails.ReloadData();
        }
        else
        {
            // Skip step for site selection
            wzdImport.ActiveStepIndex++;
            stpImport.ReloadData(true);
        }

        // Move to the next step
        wzdImport.ActiveStepIndex++;

        ltlScriptAfter.Text += ScriptHelper.GetScript(script);
    }
コード例 #4
0
    protected void btnDefault_Click(object sender, EventArgs e)
    {
        // Load default selection
        ImportTypeEnum importType = ImportTypeEnum.Default;

        if (Settings.IsWebTemplate)
        {
            if (SiteInfoProvider.GetSitesCount() == 0)
            {
                // No site exists, overwrite all
                importType = ImportTypeEnum.All;
            }
            else
            {
                // Some site exists, only new objects
                importType = ImportTypeEnum.New;
            }
        }

        Settings.LoadDefaultSelection(ObjectType, SiteObject, importType, true, false);
    }
コード例 #5
0
    /// <summary>
    /// Returns <c>true</c> only for Admin and for controls which have SiteID (and are not under group or any other parent) and are not from E-Commerce module. Returns <c>false</c> otherwise.
    /// </summary>
    private bool ShowCloneUnderSite()
    {
        int sitesCount = SiteInfoProvider.GetSitesCount();

        bool isAdmin = MembershipContext.AuthenticatedUser?.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin) ?? false;

        bool isSupportedModule = !ModuleName.ECOMMERCE.Equals(typeInfo.ModuleName, StringComparison.OrdinalIgnoreCase);

        bool isSupportedObject = ((typeInfo.SupportsGlobalObjects && (sitesCount > 0)) || (sitesCount > 1)) &&
                                 (typeInfo.SiteIDColumn != ObjectTypeInfo.COLUMN_NAME_UNKNOWN) &&
                                 (typeInfo.OriginalObjectType != CategoryInfo.OBJECT_TYPE);

        bool hasNoBindings = (InfoToClone.Generalized.ObjectParentID == 0) &&
                             (InfoToClone.Generalized.ObjectGroupID == 0);

        return(typeInfo.SupportsCloneToOtherSite &&
               hasNoBindings &&
               isAdmin &&
               isSupportedModule &&
               isSupportedObject);
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (InfoToClone != null)
        {
            ScriptHelper.RegisterJQuery(this.Page);

            typeInfo = InfoToClone.TypeInfo;

            siteElem.AllowGlobal = typeInfo.SupportsGlobalObjects;

            SetLabel(lblDisplayName, "displaynamelabel", "clonning.newdisplayname");
            SetLabel(lblCodeName, "codenamelabel", "clonning.newcodename");

            lblKeepFieldsTranslated.ToolTip = GetString("clonning.settings.keepfieldstranslated.tooltip");
            lblCloneUnderSite.ToolTip       = GetString("clonning.settings.cloneundersite.tooltip");
            lblMetafiles.ToolTip            = GetString("clonning.settings.metafiles.tooltip");
            lblMaxRelativeLevel.ToolTip     = GetString("clonning.settings.maxrelativelevel.tooltip");


            plcCodeName.Visible    = (typeInfo.CodeNameColumn != ObjectTypeInfo.COLUMN_NAME_UNKNOWN);
            plcDisplayName.Visible = (typeInfo.DisplayNameColumn != ObjectTypeInfo.COLUMN_NAME_UNKNOWN) && !typeInfo.DisplayNameColumn.EqualsCSafe(typeInfo.CodeNameColumn, true);

            // Try to load Custom properties
            customProperties = LoadCustomProperties(typeInfo.ObjectType);
            if ((customProperties == null) && (typeInfo.ObjectType != typeInfo.OriginalObjectType))
            {
                // Try get original object type settings control
                customProperties = LoadCustomProperties(typeInfo.OriginalObjectType);
            }

            if (customProperties != null)
            {
                headCustom.Text              = GetCustomParametersTitle();
                customProperties.ID          = "customProperties";
                customProperties.InfoToClone = InfoToClone;

                plcCustomParameters.Controls.Add(customProperties);
                plcCustomParametersBox.Visible = customProperties.DisplayControl;

                if (customProperties.HideDisplayName)
                {
                    plcDisplayName.Visible = false;
                }
                if (customProperties.HideCodeName)
                {
                    plcCodeName.Visible = false;
                }

                if (!RequestHelper.IsPostBack())
                {
                    TransferExcludedTypes();
                }
            }

            // Show site DDL only for Global Admin and for controls which have SiteID (and are not under group or any other parent) and are not from E-Commerce/Forums module
            int sitesCount = SiteInfoProvider.GetSitesCount();
            plcCloneUnderSite.Visible = typeInfo.SupportsCloneToOtherSite &&
                                        (typeInfo.SiteIDColumn != ObjectTypeInfo.COLUMN_NAME_UNKNOWN) &&
                                        (MembershipContext.AuthenticatedUser != null) &&
                                        (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin)) &&
                                        ((typeInfo.SupportsGlobalObjects && (sitesCount > 0)) || (sitesCount > 1)) &&
                                        (InfoToClone.Generalized.ObjectGroupID == 0) &&
                                        (InfoToClone.Generalized.ObjectParentID == 0) &&
                                        !typeInfo.ModuleName.EqualsCSafe(ModuleName.ECOMMERCE, true) &&
                                        !typeInfo.ModuleName.EqualsCSafe(ModuleName.FORUMS, true) &&
                                        (typeInfo.OriginalObjectType != CategoryInfo.OBJECT_TYPE);

            if (((typeInfo.BindingObjectTypes != null) && (typeInfo.BindingObjectTypes.Count > 0)) || ((typeInfo.OtherBindingObjectTypes != null) && (typeInfo.OtherBindingObjectTypes.Count > 0)))
            {
                // Remove site binding from bindings if exists
                List <string> bindings = new List <string>();
                if (typeInfo.BindingObjectTypes != null)
                {
                    bindings.AddRange(typeInfo.BindingObjectTypes);
                }
                if (typeInfo.OtherBindingObjectTypes != null)
                {
                    bindings.AddRange(typeInfo.OtherBindingObjectTypes);
                }
                if (!string.IsNullOrEmpty(typeInfo.SiteBinding))
                {
                    if (bindings.Contains(typeInfo.SiteBinding))
                    {
                        bindings.Remove(typeInfo.SiteBinding);
                    }
                }
                if (bindings.Count > 0)
                {
                    List <string> excludedTypes = new List <string>();
                    excludedTypes.AddRange(excludedBindings);
                    excludedTypes.AddRange(excludedOtherBindings);

                    int itemNumber = 0;
                    lblBindings.ToolTip = GetCloneHelpText(bindings, excludedTypes, out itemNumber);

                    if (itemNumber == 1)
                    {
                        lblBindings.Text    = lblBindings.ToolTip;
                        lblBindings.ToolTip = "";
                    }
                    else
                    {
                        SetLabel(lblBindings, "bindingslabel", "clonning.settings.bindings");
                    }

                    plcBindings.Visible = itemNumber > 0;
                }
            }

            if ((typeInfo.ChildObjectTypes != null) && (typeInfo.ChildObjectTypes.Count > 0))
            {
                int itemNumber = 0;
                lblChildren.ToolTip = GetCloneHelpText(typeInfo.ChildObjectTypes, excludedChildren, out itemNumber);

                if (itemNumber == 1)
                {
                    lblChildren.Text    = lblChildren.ToolTip;
                    lblChildren.ToolTip = "";
                }
                else
                {
                    lblChildren.Text = GetString("clonning.settings.children");
                }

                plcChildren.Visible      = itemNumber > 0;
                plcChildrenLevel.Visible = ShowChildrenLevel(excludedChildren);
            }

            if (!string.IsNullOrEmpty(typeInfo.SiteBinding) && (InfoToClone.Generalized.ObjectGroupID == 0))
            {
                // For objects with SiteID column allow site bindings only for global versions of the object (for example polls)
                if ((typeInfo.SiteIDColumn == ObjectTypeInfo.COLUMN_NAME_UNKNOWN) || (InfoToClone.Generalized.ObjectSiteID == 0))
                {
                    lblAssignToCurrentSite.ToolTip = GetString("clonning.settings.assigntocurrentsite.tooltip");
                    plcAssignToCurrentSite.Visible = true;

                    lblSiteBindings.ToolTip = GetCloneHelpText(new List <string>()
                    {
                        typeInfo.SiteBinding
                    });

                    plcSiteBindings.Visible = true;
                }
            }

            if ((InfoToClone.MetaFiles != null) && (InfoToClone.MetaFiles.Count > 0))
            {
                plcMetafiles.Visible = true;
            }

            // Preselect site of the object as a "clone under site" option
            if (plcCloneUnderSite.Visible && !RequestHelper.IsPostBack())
            {
                siteElem.SiteName = InfoToClone.Generalized.ObjectSiteName;
            }

            if (!RequestHelper.IsPostBack())
            {
                if (plcCodeName.Visible)
                {
                    txtCodeName.Text = InfoToClone.Generalized.GetUniqueCodeName();
                }
                if (plcDisplayName.Visible)
                {
                    txtDisplayName.Text = InfoToClone.Generalized.GetUniqueDisplayName();
                }

                // Exception for cultures for assigning to current site (for cultures the default value should be false)
                if (typeInfo.ObjectType == CultureInfo.OBJECT_TYPE)
                {
                    chkAssignToCurrentSite.Checked = false;
                }
            }

            if (plcChildren.Visible)
            {
                LoadMaxRelativeLevel();
            }
        }
    }
コード例 #7
0
    protected void ctrlAsync_OnFinished(object sender, EventArgs e)
    {
        // Stop the timer
        const string script = "StopUnzipTimer();";

        // Decide if importing site
        if (ImportSettings.SiteIsIncluded)
        {
            // Single site import and no site exists
            if (ValidationHelper.GetBoolean(ImportSettings.GetInfo(ImportExportHelper.INFO_SINGLE_OBJECT), false) && (SiteInfoProvider.GetSitesCount() == 0))
            {
                lblError.Visible = true;
                lblError.Text    = GetString("SiteImport.SingleSiteObjectNoSite");
                return;
            }

            // Init control
            stpSiteDetails.ReloadData();
        }
        else
        {
            wzdImport.ActiveStepIndex++;
            stpImport.ReloadData(true);
        }

        wzdImport.ActiveStepIndex++;

        ltlScriptAfter.Text += ScriptHelper.GetScript(script);
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!StopProcessing)
        {
            if (!RequestHelper.IsCallback())
            {
                radNewSite.CheckedChanged  += rad_CheckedChanged;
                radExisting.CheckedChanged += rad_CheckedChanged;

                rfvSiteDisplayName.ErrorMessage = GetString("ImportSite.StepSiteDetails.SiteDisplayNameError");
                rfvDomain.ErrorMessage          = GetString("ImportSite.StepSiteDetails.ErrorDomain");

                lblSiteDisplayName.Text = GetString("ImportSite.StepSiteDetails.SiteDisplayName");
                lblSiteName.Text        = GetString("ImportSite.StepSiteDetails.SiteName");
                lblDomain.Text          = GetString("ImportSite.StepSiteDetails.DomainName");
                lblCulture.Text         = GetString("ImportSite.StepSiteDetails.CultureName");
                lblSite.Text            = GetString("ImportSite.StepSiteDetails.Site");

                radExisting.Text = GetString("ImportSite.StepSiteDetails.ExistingSite");
                radNewSite.Text  = GetString("ImportSite.StepSiteDetails.NewSite");

                if (AllowExisting)
                {
                    siteSelector.AllowAll   = false;
                    siteSelector.AllowEmpty = false;
                    if (siteSelector.DropDownSingleSelect.Items.Count == 0)
                    {
                        if (SiteInfoProvider.GetSitesCount() > 0)
                        {
                            plcNewSelection.Visible = true;
                            plcExisting.Visible     = true;

                            siteSelector.Value = SiteContext.CurrentSiteID;

                            // Force to load now
                            siteSelector.Reload(true);
                        }
                        else
                        {
                            plcNewSelection.Visible = false;
                            plcExisting.Visible     = false;
                        }
                    }


                    // Single site object is imported
                    if (!SingleObject || (Settings.TemporaryFilesCreated && !Settings.SiteIsIncluded))
                    {
                        ltlScript.Text += ScriptHelper.GetScript(
                            "function SelectionChanged() { \n" +
                            "   var newSite = document.getElementById('" + radNewSite.ClientID + "').checked; \n" +
                            "   document.getElementById('" + txtDomain.ClientID + "').disabled = !newSite; \n" +
                            "   document.getElementById('" + txtSiteDisplayName.ValueElementID + "').disabled = !newSite; \n" +
                            "   document.getElementById('" + txtSiteName.ValueElementID + "').disabled = !newSite; \n" +
                            "   document.getElementById('" + siteSelector.ValueElementID + "').disabled = newSite; \n" +
                            "} \n"
                            );

                        radNewSite.Attributes.Add("onclick", "SelectionChanged()");
                        radExisting.Attributes.Add("onclick", "SelectionChanged()");
                    }
                }
                else
                {
                    plcNewSelection.Visible = false;
                    plcExisting.Visible     = false;
                }
            }
        }
    }
コード例 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (InfoToClone != null)
        {
            ScriptHelper.RegisterJQuery(this.Page);

            typeInfo = InfoToClone.TypeInfo;

            siteElem.AllowGlobal = typeInfo.SupportsGlobalObjects;

            SetLabel(lblDisplayName, "displaynamelabel", "clonning.newdisplayname");
            SetLabel(lblCodeName, "codenamelabel", "clonning.newcodename");

            lblKeepFieldsTranslated.ToolTip = GetString("clonning.settings.keepfieldstranslated.tooltip");
            lblCloneUnderSite.ToolTip       = GetString("clonning.settings.cloneundersite.tooltip");
            lblMetafiles.ToolTip            = GetString("clonning.settings.metafiles.tooltip");
            lblMaxRelativeLevel.ToolTip     = GetString("clonning.settings.maxrelativelevel.tooltip");

            lblShowAdvanced.Text = "<a href=\"javascript: ShowHideAdvancedSection();\">" + GetString("clonning.settings.showadvanced") + "</a>";
            lblShowSimple.Text   = "<a href=\"javascript: ShowHideAdvancedSection();\">" + GetString("clonning.settings.showsimple") + "</a>";

            plcCodeName.Visible    = (typeInfo.CodeNameColumn != TypeInfo.COLUMN_NAME_UNKNOWN);
            plcDisplayName.Visible = (typeInfo.DisplayNameColumn != TypeInfo.COLUMN_NAME_UNKNOWN) && !typeInfo.DisplayNameColumn.EqualsCSafe(typeInfo.CodeNameColumn, true);

            // Try to load Custom properties
            customProperties = LoadCustomProperties(typeInfo.ObjectType);
            if ((customProperties == null) && (typeInfo.ObjectType != typeInfo.OriginalObjectType))
            {
                // Try get original object type settings control
                customProperties = LoadCustomProperties(typeInfo.OriginalObjectType);
            }

            if (customProperties != null)
            {
                customProperties.ID          = "customProperties";
                customProperties.InfoToClone = InfoToClone;

                plcCustomParameters.Controls.Add(customProperties);
                plcCustomParametersBox.Visible = customProperties.DisplayControl;

                if (customProperties.HideDisplayName)
                {
                    plcDisplayName.Visible = false;
                }
                if (customProperties.HideCodeName)
                {
                    plcCodeName.Visible = false;
                }

                TransferExcludedTypes();
            }

            ltlSpace.Text  = (plcDisplayName.Visible || plcCodeName.Visible ? "<br />" : "");
            ltlSpace2.Text = ltlSpace.Text;

            // Show site DDL only for Global Admin and for controls which have SiteID (and are not under group or any other parent) and are not from E-Commerce/Forums module
            plcCloneUnderSite.Visible = typeInfo.SupportsCloneToOtherSite && (typeInfo.SiteIDColumn != TypeInfo.COLUMN_NAME_UNKNOWN) && (CMSContext.CurrentUser != null) && (CMSContext.CurrentUser.IsGlobalAdministrator) &&
                                        (SiteInfoProvider.GetSitesCount() > 1) && (InfoToClone.Generalized.ObjectGroupID == 0) && (InfoToClone.Generalized.ObjectParentID == 0) &&
                                        !typeInfo.ModuleName.EqualsCSafe(ModuleEntry.ECOMMERCE, true) && !typeInfo.ModuleName.EqualsCSafe(ModuleEntry.FORUMS, true) && (typeInfo.OriginalObjectType != PredefinedObjectType.CATEGORY);

            if (!string.IsNullOrEmpty(typeInfo.BindingObjectTypes) || !string.IsNullOrEmpty(typeInfo.OtherBindingObjectTypes))
            {
                // Remove site binding from bindings if exists
                string bindings = typeInfo.BindingObjectTypes + ";" + typeInfo.OtherBindingObjectTypes;
                if (!string.IsNullOrEmpty(typeInfo.SiteBinding))
                {
                    bindings = bindings.Replace(typeInfo.SiteBinding, "");
                }
                if (!string.IsNullOrEmpty(bindings.Replace(";", "")))
                {
                    List <string> excludedTypes = new List <string>();
                    excludedTypes.AddRange(excludedBindings);
                    excludedTypes.AddRange(excludedOtherBindings);

                    int itemNumber = 0;
                    lblBindings.ToolTip = GetCloneHelpText(bindings, excludedTypes, out itemNumber);

                    if (itemNumber == 1)
                    {
                        lblBindings.Text    = lblBindings.ToolTip;
                        lblBindings.ToolTip = "";
                    }
                    else
                    {
                        SetLabel(lblBindings, "bindingslabel", "clonning.settings.bindings");
                    }

                    plcBindings.Visible = itemNumber > 0;
                }
            }

            if (!string.IsNullOrEmpty(typeInfo.ChildObjectTypes))
            {
                int itemNumber = 0;
                lblChildren.ToolTip = GetCloneHelpText(typeInfo.ChildObjectTypes, excludedChildren, out itemNumber);

                if (itemNumber == 1)
                {
                    lblChildren.Text    = lblChildren.ToolTip;
                    lblChildren.ToolTip = "";
                }
                else
                {
                    lblChildren.Text = GetString("clonning.settings.children");
                }

                plcChildren.Visible      = itemNumber > 0;
                plcChildrenLevel.Visible = ShowChildrenLevel(excludedChildren);
            }

            if (!string.IsNullOrEmpty(typeInfo.SiteBinding) && (InfoToClone.Generalized.ObjectGroupID == 0))
            {
                // For objects with SiteID column allow site bindings only for global versions of the object (for example polls)
                if ((typeInfo.SiteIDColumn == TypeInfo.COLUMN_NAME_UNKNOWN) || (InfoToClone.Generalized.ObjectSiteID == 0))
                {
                    lblAssignToCurrentSite.ToolTip = GetString("clonning.settings.assigntocurrentsite.tooltip");
                    plcAssignToCurrentSite.Visible = true;

                    lblSiteBindings.ToolTip = GetCloneHelpText(typeInfo.SiteBinding);

                    plcSiteBindings.Visible = true;
                }
            }

            if ((InfoToClone.MetaFiles != null) && (InfoToClone.MetaFiles.Count > 0))
            {
                plcMetafiles.Visible = true;
            }

            // Preselect site of the object as a "clone under site" option
            if (plcCloneUnderSite.Visible && !RequestHelper.IsPostBack())
            {
                siteElem.SiteName = InfoToClone.Generalized.ObjectSiteName;
            }

            if (!RequestHelper.IsPostBack())
            {
                if (plcCodeName.Visible)
                {
                    txtCodeName.Text = InfoToClone.Generalized.GetUniqueCodeName();
                }
                if (plcDisplayName.Visible)
                {
                    txtDisplayName.Text = InfoToClone.Generalized.GetUniqueDisplayName();
                }

                // Exception for cultures for assigning to current site (for cultures the default value should be false)
                if (typeInfo.ObjectType == SiteObjectType.CULTURE)
                {
                    chkAssignToCurrentSite.Checked = false;
                }
            }

            if (plcChildren.Visible)
            {
                LoadMaxRelativeLevel();
            }
        }
    }
コード例 #10
0
    /// <summary>
    /// Initializes user edit menu.
    /// </summary>
    protected void InitalizeMenu()
    {
        string generalString       = GetString("general.general");
        string passwordString      = GetString("Administration-User_Edit.Password");
        string rolesString         = GetString("general.roles");
        string sitesString         = GetString("general.sites");
        string customFieldsString  = GetString("Administration-User_Edit.CustomFields");
        string departmentsString   = GetString("Administration-User_Edit.Departments");
        string notificationsString = GetString("Administration-User_Edit.Notifications");
        string categoriesString    = GetString("Administration-User_Edit.Categories");
        string friendsString       = GetString("friends.friends");
        string subscriptionsString = GetString("Administration-User_Edit.Subscriptions");
        string languagesString     = GetString("general.languages");
        string membershipString    = GetString("membership.title");

        // Check custom fields of user
        int      customFieldsTab = 0;
        UserInfo ui = UserInfoProvider.GetUserInfo(userId);

        CheckUserAvaibleOnSite(ui);
        if (ui != null)
        {
            // Get user form information and check for visible non-system fields
            FormInfo formInfo = FormHelper.GetFormInfo(ui.ClassName, false);
            customFieldsTab = (formInfo.GetFormElements(true, false, true).Count > 0 ? 1 : 0);

            // Check custom fields of user settings if needed
            if ((customFieldsTab == 0) && (ui.UserSettings != null))
            {
                // Get user settings form information and check for visible non-system fields
                formInfo        = FormHelper.GetFormInfo(ui.UserSettings.ClassName, false);
                customFieldsTab = (formInfo.GetFormElements(true, false, true).Count > 0 ? 1 : 0);
            }
        }

        // Display notifications tab ?
        bool showNotificationsTab = LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleEntry.NOTIFICATIONS);
        int  notificationsTab     = Convert.ToInt32(showNotificationsTab);

        // Display languages tab ?
        bool showLanguagesTab = LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Multilingual);
        int  languagesTab     = Convert.ToInt32(showLanguagesTab);

        // Display change password tab ?
        bool showChangePasswordTab = !RequestHelper.IsWindowsAuthentication() || (!ui.UserIsExternal && !ui.UserIsDomain);
        int  changePasswordTab     = Convert.ToInt32(showChangePasswordTab);

        bool showMembershipTab = LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Membership);

        // Is E-commerce on site? => show department tab
        bool ecommerceOnSite = false;

        if (CMSContext.CurrentSiteName != null)
        {
            // Check if E-commerce module is installed
            ecommerceOnSite = ModuleEntry.IsModuleLoaded(ModuleEntry.ECOMMERCE) && ResourceSiteInfoProvider.IsResourceOnSite("CMS.Ecommerce", CMSContext.CurrentSiteName);
        }

        int departmentTab    = Convert.ToInt32(ecommerceOnSite);
        int generalTabsCount = (CMSContext.CurrentUser.IsGlobalAdministrator) ? 8 : 7;

        string[,] tabs = new string[generalTabsCount + changePasswordTab + departmentTab + customFieldsTab + notificationsTab + languagesTab + 1, 4];

        int lastTabIndex = 0;

        tabs[lastTabIndex, 0] = generalString;
        tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'general_tab8');";
        tabs[lastTabIndex, 2] = "User_Edit_General.aspx?userid=" + userId + "&siteid=" + SiteID;
        lastTabIndex++;

        if (showChangePasswordTab)
        {
            tabs[lastTabIndex, 0] = passwordString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'password_tab');";
            tabs[lastTabIndex, 2] = "User_Edit_Password.aspx?userid=" + userId + "&siteid=" + SiteID;
            lastTabIndex++;
        }

        tabs[lastTabIndex, 0] = GetString("user.edit.settings");
        tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'usersettings_tab');";
        tabs[lastTabIndex, 2] = "User_Edit_Settings.aspx?userid=" + userId + "&siteid=" + SiteID;

        if (customFieldsTab > 0)
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = customFieldsString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'CustomFields_tab');";
            tabs[lastTabIndex, 2] = "User_Edit_CustomFields.aspx?userid=" + userId + "&siteid=" + SiteID;
        }

        if (CMSContext.CurrentUser.IsGlobalAdministrator)
        {
            int sitesCount = SiteInfoProvider.GetSitesCount();
            if (sitesCount > 0)
            {
                lastTabIndex++;
                tabs[lastTabIndex, 0] = sitesString;
                tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'sites_tab');";
                tabs[lastTabIndex, 2] = "User_Edit_Sites.aspx?userid=" + userId + "&siteid=" + SiteID;
            }

            lastTabIndex++;
            tabs[lastTabIndex, 0] = rolesString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'roles_tab');";
            tabs[lastTabIndex, 2] = "User_Edit_Roles.aspx?userid=" + userId + "&siteid=" + SiteID;
        }
        else
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = rolesString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'roles_tab');";
            tabs[lastTabIndex, 2] = "User_Edit_Roles.aspx?userid=" + userId + "&siteid=" + SiteID;
        }

        // Is e-commerce on site? => show department tab OR feature available
        if (ecommerceOnSite)
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = departmentsString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'departments_tab');";
            tabs[lastTabIndex, 2] = ResolveUrl("~/CMSModules/Ecommerce/Pages/Administration/Users/User_Edit_Departments.aspx") + "?userid=" + userId + "&siteid=" + SiteID;
        }

        if (showNotificationsTab)
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = notificationsString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'notifications_tab');";
            tabs[lastTabIndex, 2] = ResolveUrl("~/CMSModules/Notifications/Administration/Users/User_Edit_Notifications.aspx") + "?userid=" + userId + "&siteid=" + SiteID;
        }

        lastTabIndex++;
        tabs[lastTabIndex, 0] = categoriesString;
        tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'categories_tab');";
        tabs[lastTabIndex, 2] = "User_Edit_Categories.aspx?userid=" + userId + "&siteid=" + SiteID;

        bool showFriendsTab = LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Friends, ModuleEntry.COMMUNITY);

        if (showFriendsTab)
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = friendsString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'friends_tab');";
            tabs[lastTabIndex, 2] = ResolveUrl("~/CMSModules/Friends/Administration/Users/User_Edit_Friends_Frameset.aspx?userid=" + userId + "&siteid=" + SiteID);
        }

        lastTabIndex++;
        tabs[lastTabIndex, 0] = subscriptionsString;
        tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'user_subscriptions_tab');";
        tabs[lastTabIndex, 2] = "User_Edit_Subscriptions.aspx?userid=" + userId + "&siteid=" + SiteID;

        if (showLanguagesTab)
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = languagesString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'user_languages_tab');";
            tabs[lastTabIndex, 2] = "User_Edit_Languages.aspx?userid=" + userId + "&siteid=" + SiteID;
        }

        if (showMembershipTab)
        {
            lastTabIndex++;
            tabs[lastTabIndex, 0] = membershipString;
            tabs[lastTabIndex, 1] = "SetHelpTopic('helpTopic', 'user_membership_tab');";
            tabs[lastTabIndex, 2] = "User_Edit_Membership.aspx?userid=" + userId + "&siteid=" + SiteID;
        }

        // Object relationships
        //if (TypeInfo.AllowObjectRelationships)
        //{
        //    lastTabIndex++;
        //    tabs[lastTabIndex, 0] = GetString("General.Relationships");
        //    tabs[lastTabIndex, 2] = ResolveUrl("~/CMSModules/AdminControls/Pages/ObjectRelationships.aspx?objectid=" + userId + "&objecttype=cms.user&siteid=" + siteId);
        //}

        CurrentMaster.Tabs.UrlTarget = "content";
        CurrentMaster.Tabs.Tabs      = tabs;
    }
コード例 #11
0
    /// <summary>
    /// Event handling creation of tabs.
    /// </summary>
    private void OnTabCreated(object sender, TabCreatedEventArgs e)
    {
        if (e.Tab == null)
        {
            return;
        }

        var tab = e.Tab;

        switch (tab.TabName.ToLowerCSafe())
        {
        case "customfields":
            // Check custom fields of user
        {
            int      customFields = 0;
            var      userId       = QueryHelper.GetInteger("objectid", 0);
            UserInfo ui           = UserInfoProvider.GetUserInfo(userId);
            if (ui != null)
            {
                if (!MembershipContext.AuthenticatedUser.IsGlobalAdministrator && !ui.IsInSite(SiteContext.CurrentSiteName))
                {
                    URLHelper.SeeOther(UIHelper.GetInformationUrl(ResHelper.GetString("user.notinsite")));
                }

                // Get user form information and check for visible non-system fields
                FormInfo formInfo = FormHelper.GetFormInfo(ui.ClassName, false);
                customFields = (formInfo.GetFormElements(true, false, true).Any() ? 1 : 0);

                // Check custom fields of user settings if needed
                if ((customFields == 0) && (ui.UserSettings != null))
                {
                    // Get user settings form information and check for visible non-system fields
                    formInfo     = FormHelper.GetFormInfo(ui.UserSettings.ClassName, false);
                    customFields = (formInfo.GetFormElements(true, false, true).Any() ? 1 : 0);
                }
            }

            if (customFields == 0)
            {
                e.Tab = null;
            }
        }
        break;

        case "notifications":
            // Display notifications tab ?
            if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleName.NOTIFICATIONS))
            {
                e.Tab = null;
            }
            break;

        case "languages":
            // Display languages tab ?
            if (!LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Multilingual))
            {
                e.Tab = null;
            }
            break;

        case "membership":
            // Display membership tab ?
            if (!LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.Membership))
            {
                e.Tab = null;
            }
            break;

        case "departments":
        {
            // Is E-commerce on site ?
            bool ecommerceOnSite = false;
            if (SiteContext.CurrentSiteName != null)
            {
                // Check if E-commerce module is installed
                ecommerceOnSite = ModuleEntryManager.IsModuleLoaded(ModuleName.ECOMMERCE) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.ECOMMERCE, SiteContext.CurrentSiteName);
            }

            if (!ecommerceOnSite)
            {
                e.Tab = null;
            }
        }
        break;

        case "sites":
        {
            bool showSites = false;
            if (MembershipContext.AuthenticatedUser.IsGlobalAdministrator)
            {
                int sitesCount = SiteInfoProvider.GetSitesCount();
                if (sitesCount > 0)
                {
                    showSites = true;
                }
            }

            if (!showSites)
            {
                e.Tab = null;
            }
        }
        break;

        case "friends":
            if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Friends, ModuleName.COMMUNITY))
            {
                e.Tab = null;
            }
            break;
        }
    }
コード例 #12
0
    protected void wzdImport_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {
        switch (e.CurrentStepIndex)
        {
        // Import type
        case 0:
        {
            if (!siteType.SelectTemplate)
            {
                try
                {
                    // Get blank web template
                    WebTemplateInfo wi = WebTemplateInfoProvider.GetWebTemplateInfo("BlankSite");
                    if (wi == null)
                    {
                        e.Cancel = true;
                        return;
                    }

                    WebTemplateID = wi.WebTemplateId;

                    string path = Server.MapPath(wi.WebTemplateFileName);
                    if (File.Exists(path + "\\template.zip"))
                    {
                        // Template from zip file
                        path += "\\" + ZipStorageProvider.GetZipFileName("template.zip");

                        ImportSettings.TemporaryFilesPath    = path;
                        ImportSettings.SourceFilePath        = path;
                        ImportSettings.TemporaryFilesCreated = true;
                        ImportSettings.RefreshMacroSecurity  = true;
                    }
                    else
                    {
                        // Init the settings
                        ImportSettings.TemporaryFilesCreated = false;
                        ImportSettings.SourceFilePath        = Server.MapPath(wi.WebTemplateFileName);
                        ImportSettings.RefreshMacroSecurity  = true;
                    }

                    if (!File.Exists(ImportSettings.SourceFilePath))
                    {
                        try
                        {
                            ImportProvider.CreateTemporaryFiles(ImportSettings);
                        }
                        catch (Exception ex)
                        {
                            lblError.Visible = true;
                            lblError.Text    = ex.Message;
                            e.Cancel         = true;
                            return;
                        }
                    }

                    if (SiteInfoProvider.GetSitesCount() == 0)
                    {
                        // No site exists, overwrite all
                        ImportSettings.ImportType = ImportTypeEnum.All;
                        ImportSettings.CopyFiles  = false;
                    }
                    else
                    {
                        // Some site exists, only new objects
                        ImportSettings.ImportType = ImportTypeEnum.New;
                    }


                    ltlScriptAfter.Text = ScriptHelper.GetScript(
                        "var actDiv = document.getElementById('actDiv'); \n" +
                        "if (actDiv != null) { actDiv.style.display='block'; } \n" +
                        "var buttonsDiv = document.getElementById('buttonsDiv'); if (buttonsDiv != null) { buttonsDiv.disabled=true; } \n" +
                        "BTN_Disable('" + NextButton.ClientID + "'); \n" +
                        "StartSelectionTimer();"
                        );

                    // Preselect objects asynchronously
                    ctrlAsync.Parameter = "N";
                    ctrlAsync.RunAsync(SelectObjects, WindowsIdentity.GetCurrent());

                    e.Cancel = true;
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Message;
                    e.Cancel      = true;
                    return;
                }
            }
            else
            {
                siteDetails.SiteName        = null;
                siteDetails.SiteDisplayName = null;
                selectTemplate.ReloadData();
            }

            wzdImport.ActiveStepIndex++;
        }
        break;

        // Template selection
        case 1:
        {
            if (!selectTemplate.ApplySettings())
            {
                e.Cancel = true;
                return;
            }

            // Init the settings
            WebTemplateInfo wi = WebTemplateInfoProvider.GetWebTemplateInfo(selectTemplate.WebTemplateId);
            if (wi == null)
            {
                throw new Exception("Web template not found.");
            }

            ImportSettings.IsWebTemplate = true;

            string path = Server.MapPath(wi.WebTemplateFileName);
            if (File.Exists(path + "\\template.zip"))
            {
                // Template from zip file
                path += "\\" + ZipStorageProvider.GetZipFileName("template.zip");

                ImportSettings.TemporaryFilesPath    = path;
                ImportSettings.SourceFilePath        = path;
                ImportSettings.TemporaryFilesCreated = true;
                ImportSettings.RefreshMacroSecurity  = true;
            }
            else
            {
                // Template from folder
                ImportSettings.TemporaryFilesCreated = false;
                ImportSettings.SourceFilePath        = path;
                ImportSettings.RefreshMacroSecurity  = true;
                try
                {
                    ImportProvider.CreateTemporaryFiles(ImportSettings);
                }
                catch (Exception ex)
                {
                    lblError.Visible = true;
                    lblError.Text    = ex.Message;
                    e.Cancel         = true;
                    return;
                }
            }

            if (SiteInfoProvider.GetSitesCount() == 0)
            {
                // No site exists, overwrite all
                ImportSettings.ImportType = ImportTypeEnum.All;
            }
            else
            {
                // Some site exists, only new objects
                ImportSettings.ImportType = ImportTypeEnum.New;
            }

            ltlScriptAfter.Text = ScriptHelper.GetScript(
                "var actDiv = document.getElementById('actDiv');\n" +
                "if (actDiv != null) { actDiv.style.display='block'; }\n" +
                "var buttonsDiv = document.getElementById('buttonsDiv');\n" +
                "if (buttonsDiv != null) { buttonsDiv.disabled=true; }\n" +
                "BTN_Disable('" + NextButton.ClientID + "');\n" +
                "BTN_Disable('" + PreviousButton.ClientID + "');\n" +
                "StartSelectionTimer();"
                );

            // Preselect objects asynchronously
            ctrlAsync.Parameter = "T";
            ctrlAsync.RunAsync(SelectObjects, WindowsIdentity.GetCurrent());

            e.Cancel = true;
        }
        break;

        // Site details
        case 2:
            if (!siteDetails.ApplySettings())
            {
                e.Cancel = true;
                return;
            }

            // Update settings
            ImportSettings = siteDetails.Settings;

            Culture = siteDetails.Culture;

            pnlImport.ReloadData(true);
            wzdImport.ActiveStepIndex++;
            break;

        // Objects selection
        case 3:
            if (!pnlImport.ApplySettings())
            {
                e.Cancel = true;
                return;
            }

            // Check licences
            string error = ImportExportControl.CheckLicenses(ImportSettings);
            if (!string.IsNullOrEmpty(error))
            {
                lblError.Text = error;

                e.Cancel = true;
                return;
            }

            ImportSettings = pnlImport.Settings;

            PreviousButton.Enabled = false;
            NextButton.Enabled     = false;

            SiteName = ImportSettings.SiteName;
            Domain   = ImportSettings.SiteDomain;

            // Init the Mimetype helper (required for the Import)
            MimeTypeHelper.LoadMimeTypes();

            // Start asynchronnous Import
            ImportSettings.SetSettings(ImportExportHelper.SETTINGS_DELETE_TEMPORARY_FILES, false);
            ImportSettings.DefaultProcessObjectType = ProcessObjectEnum.Selected;
            ImportManager.Settings = ImportSettings;

            // Import site asynchronously
            ctrlImport.RunAsync(ImportManager.Import, WindowsIdentity.GetCurrent());
            ctrlImport.PostbackOnError = false;

            ltlScript.Text = ScriptHelper.GetScript("StartImportStateTimer();");
            wzdImport.ActiveStepIndex++;
            break;

        // Import progress
        case 4:
            PreviousButton.Visible = false;

            CultureHelper.SetPreferredCulture(Culture);
            if (siteType.SelectTemplate)
            {
                // Done
                finishSite.Domain         = Domain;
                finishSite.SiteIsRunning  = SiteIsRunning;
                wzdImport.ActiveStepIndex = 7;
            }
            else
            {
                if (ImportManager.Settings.IsWarning())
                {
                    try
                    {
                        // Convert default culture
                        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
                        tree.ChangeSiteDefaultCulture(SiteName, Culture, "en-US");

                        // Change root GUID
                        TreeNode root = DocumentHelper.GetDocument(SiteName, "/", Culture, false, "cms.root", null, null, 1, false, null, tree);
                        if (root != null)
                        {
                            root.NodeGUID = Guid.NewGuid();
                            DocumentHelper.UpdateDocument(root, tree);
                        }
                    }
                    catch (Exception ex)
                    {
                        EventLogProvider ev = new EventLogProvider();
                        ev.LogEvent("NewSiteWizard", "FINISH", ex);
                        lblError.Text = ex.Message;
                        e.Cancel      = true;
                        return;
                    }
                }
                selectMaster.SiteName = SiteName;
                selectMaster.ReloadData();
            }
            break;

        // Master template
        case 5:
            if (!selectMaster.ApplySettings())
            {
                e.Cancel = true;
                return;
            }

            siteStructure.SiteName = SiteName;
            break;

        // Define site structure
        case 6:
            finishSite.Domain        = Domain;
            finishSite.SiteIsRunning = SiteIsRunning;
            break;

        // Other steps
        default:
            wzdImport.ActiveStepIndex = e.NextStepIndex;
            break;
        }
    }
コード例 #13
0
    /// <summary>
    /// Initializes workflow step edit menu.
    /// </summary>
    protected void InitalizeMenu()
    {
        if (wsi != null)
        {
            string generalString = GetString("general.general");
            string rolesString   = GetString("general.roles");

            string[,] tabs = new string[2, 4];
            tabs[0, 0]     = generalString;
            tabs[0, 1]     = "SetHelpTopic('helpTopic', 'new_step');";
            tabs[0, 2]     = "Workflow_Step_General.aspx?workflowStepId=" + workflowStepId;

            string stepName = wsi.StepName.ToLower();
            if ((stepName != "edit") && (stepName != "published") && (stepName != "archived") && (SiteInfoProvider.GetSitesCount() > 0))
            {
                tabs[1, 0] = rolesString;
                tabs[1, 1] = "SetHelpTopic('helpTopic', 'roles_tab2');";
                tabs[1, 2] = "Workflow_Step_Roles.aspx?workflowStepId=" + workflowStepId;
            }

            CurrentMaster.Tabs.UrlTarget = "wfStepContent";
            CurrentMaster.Tabs.Tabs      = tabs;
        }
    }
コード例 #14
0
    /// <summary>
    /// Initializes workflow edit menu.
    /// </summary>
    protected void InitalizeMenu()
    {
        // General tab
        TabItem general = new TabItem()
        {
            Text          = GetString("general.general"),
            RedirectUrl   = "Workflow_General.aspx?workflowId=" + WorkflowId,
            OnClientClick = "SetHelpTopic('helpTopic', 'workflow_general');"
        };

        SetTab(general);

        // Steps tab
        TabItem steps = new TabItem()
        {
            Text          = GetString("Development-Workflow_Edit.Steps"),
            RedirectUrl   = CurrentWorkflow.IsBasic ? "Workflow_Steps.aspx?workflowId=" + WorkflowId : "Workflow_Designer.aspx?workflowId=" + WorkflowId,
            OnClientClick = CurrentWorkflow.IsBasic ? "SetHelpTopic('helpTopic', 'workflow_steps');" : "SetHelpTopic('helpTopic', 'workflow_designer');"
        };

        SetTab(steps);

        // Display additional tabs for document workflow
        if (CurrentWorkflow.IsDocumentWorkflow)
        {
            // Hide if no site or no running site
            if ((SiteInfoProvider.GetSitesCount() > 0))
            {
                // Scopes tab
                TabItem scopes = new TabItem()
                {
                    Text          = GetString("Development-Workflow_Edit.Scopes"),
                    RedirectUrl   = "Workflow_Scopes.aspx?workflowId=" + WorkflowId,
                    OnClientClick = "SetHelpTopic('helpTopic', 'workflow_scope');"
                };
                SetTab(scopes);
            }
        }

        // E-mails tab
        TabItem emails = new TabItem()
        {
            Text          = GetString("Development-Workflow_Edit.Emails"),
            RedirectUrl   = "Workflow_Emails.aspx?workflowId=" + WorkflowId,
            OnClientClick = "SetHelpTopic('helpTopic', 'workflow_emails');"
        };

        SetTab(emails);

        // Display additional tabs for document workflow
        if (CurrentWorkflow.IsDocumentWorkflow)
        {
            // Documents tab
            TabItem docs = new TabItem()
            {
                Text          = GetString("general.documents"),
                RedirectUrl   = "Workflow_Documents.aspx?workflowId=" + WorkflowId,
                OnClientClick = "SetHelpTopic('helpTopic', 'workflow_documents');"
            };
            SetTab(docs);
        }
    }