/// <summary>
 /// Initializes the master page elements.
 /// </summary>
 private void InitializeMasterPage()
 {
     HeaderAction action = new HeaderAction();
     action.Text = GetString("board.subscriptions.newitem");
     action.RedirectUrl = "~/CMSModules/Groups/Tools/MessageBoards/Boards/Board_Edit_Subscription_Edit.aspx?boardid=" + boardId.ToString() + "&groupid=" + groupId;
     CurrentMaster.HeaderActions.AddAction(action);
 }
    /// <summary>
    /// Initializes master page and header actions.
    /// </summary>
    private void InitMaster()
    {
        // Init filter for the first time according to user permissions
        if (!RequestHelper.IsPostBack())
        {
            if (AuthorizedForGlobalPolls && AuthorizedForSitePolls)
            {
                fltSite.SiteID = QueryHelper.GetInteger("siteid", SiteContext.CurrentSiteID);
            }
            else if (AuthorizedForSitePolls)
            {
                // User is authorized for site polls => select site polls
                fltSite.SiteID = SiteContext.CurrentSiteID;
            }
            else
            {
                // User is authorized for global polls => select global polls only
                fltSite.SiteID = UniSelector.US_GLOBAL_RECORD;
            }
        }

        HeaderAction action = new HeaderAction();

        action.Text        = GetString("Polls_List.NewItemCaption");
        action.RedirectUrl = ResolveUrl("Polls_New.aspx?siteid=" + fltSite.SiteID);
        hdrActions.AddAction(action);

        // Set the page title
        PageTitle.TitleText = GetString("Polls_List.HeaderCaption");
        CurrentMaster.DisplaySiteSelectorPanel = AuthorizedForSitePolls && AuthorizedForGlobalPolls;
    }
    /// <summary>
    /// OnLoad event.
    /// </summary>
    /// <param name="e">Event argument</param>
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        si = EditForm.EditedObject as CssStylesheetInfo;

        previewState = GetPreviewStateFromCookies(CSSSTYLESHEET);

        // Add preview action
        HeaderAction preview = new HeaderAction
        {
            Text          = GetString("general.preview"),
            OnClientClick = "performToolbarAction('split');return false;",
            Visible       = (previewState == 0),
            Tooltip       = GetString("preview.tooltip"),
            Index         = 1
        };

        editMenuElem.ObjectEditMenu.AddExtraAction(preview);
        editMenuElem.ObjectEditMenu.PreviewMode = true;
        editMenuElem.MenuPanel.CssClass         = "PreviewMenu";

        bool hide = !(BrowserHelper.IsSafari() || BrowserHelper.IsChrome());

        if (hide)
        {
            pnlContainer.CssClass += " Hidden ";
        }
    }
Пример #4
0
    protected override void OnPreRender(EventArgs e)
    {
        if (CurrentWorkflow != null)
        {
            // Only basic workflow without auto-publish can be converted
            if (WorkflowInfoProvider.IsAdvancedWorkflowAllowed() && CurrentWorkflow.IsBasic)
            {
                HeaderAction convert = new HeaderAction()
                {
                    Text          = GetString("workflow.convert"),
                    ImageUrl      = GetImageUrl("Design/Controls/UniGrid/Actions/convert.png"),
                    OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("workflow.confirmconversion"), true) + ");",
                    EventName     = CONVERT_ACTION
                };

                if (editElem.CurrentWorkflow.WorkflowAutoPublishChanges)
                {
                    convert.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/convertdisabled.png");
                    convert.Tooltip  = GetString("workflow.conversionerror.versioningwithoutworkflow");
                    convert.Enabled  = false;
                }
                CurrentMaster.HeaderActions.AddAction(convert);
            }
        }
        base.OnPreRender(e);
    }
    protected override void OnPreRender(EventArgs e)
    {
        if (CurrentWorkflow != null)
        {
            // Only basic workflow without auto-publish can be converted
            if (WorkflowInfoProvider.IsAdvancedWorkflowAllowed() && CurrentWorkflow.IsBasic)
            {
                HeaderAction convert = new HeaderAction()
                {
                    Text = GetString("workflow.convert"),
                    ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/convert.png"),
                    OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("workflow.confirmconversion"), true) + ");",
                    EventName = CONVERT_ACTION
                };

                if (editElem.CurrentWorkflow.WorkflowAutoPublishChanges)
                {
                    convert.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/convertdisabled.png");
                    convert.Tooltip = GetString("workflow.conversionerror.versioningwithoutworkflow");
                    convert.Enabled = false;
                }
                CurrentMaster.HeaderActions.AddAction(convert);
            }
        }
        base.OnPreRender(e);
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get poll id from querystring
        pollId  = QueryHelper.GetInteger("pollId", 0);
        groupId = QueryHelper.GetInteger("groupId", 0);

        if (CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE, false))
        {
            HeaderAction newItem = new HeaderAction();
            newItem.Text        = GetString("Polls_Answer_List.NewItemCaption");
            newItem.RedirectUrl = ResolveUrl("Polls_Edit_Answer_Edit.aspx?pollId=" + pollId.ToString() + "&groupId=" + groupId);
            CurrentMaster.HeaderActions.AddAction(newItem);

            HeaderAction reset = new HeaderAction();
            reset.Text          = GetString("Polls_Answer_List.ResetButton");
            reset.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Polls_Answer_List.ResetConfirmation")) + ");";
            reset.CommandName   = "btnReset_Click";
            CurrentMaster.HeaderActions.AddAction(reset);

            CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed);

            AnswerList.AllowEdit = true;
        }

        AnswerList.OnEdit             += new EventHandler(AnswerList_OnEdit);
        AnswerList.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(AnswerList_OnCheckPermissions);
        AnswerList.PollId              = pollId;
        AnswerList.GroupId             = groupId;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lnkBackHidden.Click += lnkBackHidden_Click;

        HeaderAction action = new HeaderAction();

        action.Text        = GetString("events_attendee_edit.newitemcaption");
        action.CommandName = "new_attendee";
        action.RedirectUrl = null;
        actionsElem.AddAction(action);

        // Load edit attendee id from hidden field
        if (!String.IsNullOrEmpty(hdnState.Value))
        {
            attendeeEdit.EventID    = EventID;
            attendeeEdit.AttendeeID = ValidationHelper.GetInteger(hdnState.Value, 0);
        }

        actionsElem.ActionPerformed += actionsElem_ActionPerformed;

        attendeesList.UsePostback         = true;
        attendeesList.EventID             = EventID;
        attendeeEdit.OnCheckPermissions  += attendeeEdit_OnCheckPermissions;
        attendeesList.OnCheckPermissions += attendeeEdit_OnCheckPermissions;
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        widgetId = QueryHelper.GetInteger("widgetid", 0);

        Title = "Widget part documentation";

        // Resource string
        btnOk.Text = GetString("General.Ok");

        WidgetInfo wi = WidgetInfoProvider.GetWidgetInfo(widgetId);

        // set Documentation header - "View documentation" + "Generate Documentation"
        if (wi != null)
        {
            HeaderAction action = new HeaderAction();
            action.Text        = GetString("webparteditdocumentation.view");
            action.RedirectUrl = "~/CMSModules/Widgets/Dialogs/WidgetDocumentation.aspx?widgetid=" + wi.WidgetID;
            action.Target      = "_blank";
            CurrentMaster.HeaderActions.AddAction(action);
        }

        // HTML editor settings
        htmlText.AutoDetectLanguage = false;
        htmlText.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        htmlText.EditorAreaCSS      = "";
        htmlText.ToolbarSet         = "SimpleEdit";

        // Load data
        if (!RequestHelper.IsPostBack() && (wi != null))
        {
            htmlText.ResolvedValue = wi.WidgetDocumentation;
        }
    }
Пример #9
0
    /// <summary>
    /// Creates buttons in header actions
    /// </summary>
    private void CreateButtons()
    {
        var updateAction = new HeaderAction
        {
            ButtonStyle = ButtonStyle.Default,
            CommandName = UPDATE_STATUSES_ACTION,
            Tooltip     = GetString("translationservice.updatestatusestooltip"),
            Text        = GetString("translationservice.updatestatuses"),
            Enabled     = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.TranslationServices", "Modify") && !Grid.IsEmpty
        };

        string translateUrl = AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Translations/Pages/TranslateDocuments.aspx") + "?select=1&dialog=1";

        translateUrl = URLHelper.AddParameterToUrl(translateUrl, "hash", QueryHelper.GetHash(URLHelper.GetQuery(translateUrl)));

        // Check if any human translation is enabled
        bool enabled = TranslationServiceInfoProvider.GetTranslationServices("(TranslationServiceEnabled = 1) AND (TranslationServiceIsMachine = 0)", null, 0, "TranslationServiceID, TranslationServiceName").Any(t => TranslationServiceHelper.IsServiceAvailable(t.TranslationServiceName, SiteContext.CurrentSiteName));

        var submitAction = new HeaderAction
        {
            OnClientClick = "modalDialog('" + translateUrl + "', 'SubmitTranslation', 988, 640);",
            Tooltip       = GetString(enabled ? "translationservice.submittranslationtooltip" : "translationservice.noenabledservices"),
            Text          = GetString("translationservice.submittranslation"),
            Enabled       = enabled && MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Content", "SubmitForTranslation")
        };

        AddHeaderAction(submitAction);
        AddHeaderAction(updateAction);

        HeaderActions.ReloadData();
    }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        previewState = GetPreviewStateFromCookies(WEBPARTCONTAINER);

        // Add preview action
        HeaderAction preview = new HeaderAction
        {
            Text          = GetString("general.preview"),
            OnClientClick = "performToolbarAction('split');return false;",
            Visible       = (previewState == 0),
            Index         = 1,
            Tooltip       = GetString("preview.tooltip")
        };

        editMenuElem.ObjectEditMenu.AddExtraAction(preview);
        editMenuElem.ObjectEditMenu.PreviewMode   = true;
        editMenuElem.MenuPanel.CssClass           = "PreviewMenu";
        editMenuElem.ObjectManager.OnAfterAction += ObjectManager_OnAfterAction;

        bool hide = !(BrowserHelper.IsSafari() || BrowserHelper.IsChrome());

        if (hide)
        {
            pnlContainer.CssClass += " Hidden ";
        }

        // Register action script for dialog purposes
        if (DialogMode)
        {
            ScriptHelper.RegisterClientScriptBlock(Page, typeof(String), "PreviewHierarchyPerformAction", ScriptHelper.GetScript("function actionPerformed(action) { if (action == 'saveandclose') { document.getElementById('" + hdnClose.ClientID + "').value = '1'; }; " + editMenuElem.ObjectManager.GetJSFunction(ComponentEvents.SAVE, null, null) + "; }"));
        }
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        widgetId = QueryHelper.GetInteger("widgetid", 0);

        Title = "Widget part documentation";

        // Resource string
        btnOk.Text = GetString("General.Ok");

        WidgetInfo wi = WidgetInfoProvider.GetWidgetInfo(widgetId);

        // set Documentation header - "View documentation" + "Generate Documentation"
        if (wi != null)
        {

            HeaderAction action = new HeaderAction();
            action.Text = GetString("webparteditdocumentation.view");
            action.RedirectUrl = "~/CMSModules/Widgets/Dialogs/WidgetDocumentation.aspx?widgetid=" + wi.WidgetID;
            action.Target = "_blank";
            CurrentMaster.HeaderActions.AddAction(action);
        }

        // HTML editor settings
        htmlText.AutoDetectLanguage = false;
        htmlText.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        htmlText.EditorAreaCSS = "";
        htmlText.ToolbarSet = "SimpleEdit";

        // Load data
        if (!RequestHelper.IsPostBack() && (wi != null))
        {
            htmlText.ResolvedValue = wi.WidgetDocumentation;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        webpartId = QueryHelper.GetInteger("webpartid", 0);

        Title = "Web part documentation";

        // Resource string
        btnOk.Text = GetString("General.Ok");

        WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(webpartId);

        EditedObject = wpi;
        if (wpi != null)
        {
            HeaderAction action = new HeaderAction();
            action.Text        = GetString("webparteditdocumentation.view");
            action.RedirectUrl = "~/CMSModules/PortalEngine/UI/WebParts/WebPartDocumentationPage.aspx?webpartid=" + wpi.WebPartName;
            action.Target      = "_blank";
            CurrentMaster.HeaderActions.AddAction(action);
        }

        // HTML editor settings
        htmlText.AutoDetectLanguage = false;
        htmlText.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        htmlText.EditorAreaCSS      = "";
        htmlText.ToolbarSet         = "SimpleEdit";

        // Load data
        if (!RequestHelper.IsPostBack() && (wpi != null))
        {
            htmlText.ResolvedValue = wpi.WebPartDocumentation;
        }
    }
Пример #13
0
        public void Execute(ParamsMergeModel[] fileMerge, string destinyDirectory, HeaderAction selectedHeaderAction)
        {
            if (fileMerge.Length <= 0)
            {
                return;
            }

            _destinyDirectory = destinyDirectory;
            _headerAction     = selectedHeaderAction;
            _fileMerge        = fileMerge;


            using (var mainWorkbook = new XLWorkbook(XLEventTracking.Disabled)) //new Workbook
            {
                var mainWorksheet = mainWorkbook.Worksheets.Add("Main");

                for (_indexFile = 0; _indexFile < _fileMerge.Length; _indexFile++) // Loop in files
                {
                    if (_cancel)
                    {
                        return;
                    }

                    using (var workBookFile = new XLWorkbook(_fileMerge[_indexFile].GetPath(), XLEventTracking.Disabled)) // Load from file
                    {
                        OnLog?.Invoke(this, new LogArgs(_fileMerge[_indexFile].FileName, EventLog.ReadFile));
                        OnProgress?.Invoke(this, new ProgressArgs(_indexFile + 1));

                        for (_indexSheet = 0; _indexSheet < workBookFile.Worksheets.Count; _indexSheet++) // Loop in sheets
                        {
                            if (_cancel)
                            {
                                return;
                            }

                            var worksheet = workBookFile.Worksheets.Worksheet(_indexSheet + 1);

                            OnLog?.Invoke(this, new LogArgs(worksheet.Name, EventLog.ReadSheet));

                            if (_fileMerge[_indexFile].SeparatorCSV == null)
                            {
                                if (LoadFromWorksheet(worksheet, out IXLRange ragenUsed))
                                {
                                    mainWorksheet.Cell($"A{GetRowCount(mainWorksheet)}").Value = ragenUsed;
                                }
                            }
                            else
                            {
                                if (LoadFromWorksheet(worksheet, out IList <string[]> list))
                                {
                                    mainWorksheet.Cell($"A{GetRowCount(mainWorksheet)}").Value = list;
                                }
                            }
                        }
                    }

                    SaveFile(mainWorkbook);
                }
            }
        }
Пример #14
0
    /// <summary>
    /// Initializes header actions.
    /// </summary>
    private void InitHeaderActions()
    {
        if (!SiteContext.CurrentSite.SiteIsContentOnly && MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.ABTest", "New"))
        {
            string url = UIContextHelper.GetElementUrl("CMS.ABTest", "New", EditInDialog);

            // Get the alias path of the current node, if in content
            if (Node != null)
            {
                listElem.NodeID = Node.NodeID;
                listElem.ShowOriginalPageColumn = false;
                string aliasPath = Node.NodeAliasPath;
                listElem.AliasPath = aliasPath;

                url = URLHelper.AddParameterToUrl(url, "NodeID", Node.NodeID.ToString());
                url = URLHelper.AddParameterToUrl(url, "AliasPath", aliasPath);
            }

            url = ResolveUrl(url);

            // Set header action
            var action = new HeaderAction
            {
                ResourceName = "CMS.ABTest",
                Permission   = "Manage",
                Text         = GetString("abtesting.abtest.new"),
                RedirectUrl  = url,
                OpenInDialog = EditInDialog
            };

            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get poll id from querystring
        pollId = QueryHelper.GetInteger("pollId", 0);
        pi = PollInfoProvider.GetPollInfo(pollId);
        EditedObject = pi;

        // Check global and site read permmision
        CheckPollsReadPermission(pi.PollSiteID);

        if (CheckPollsModifyPermission(pi.PollSiteID, false))
        {
            HeaderAction newItem = new HeaderAction();
            newItem.Text = GetString("Polls_Answer_List.NewItemCaption");
            newItem.RedirectUrl = ResolveUrl("Polls_Answer_Edit.aspx?pollId=" + pollId);
            CurrentMaster.HeaderActions.AddAction(newItem);

            HeaderAction reset = new HeaderAction();
            reset.Text = GetString("Polls_Answer_List.ResetButton");
            reset.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Polls_Answer_List.ResetConfirmation")) + ");";
            reset.CommandName = "btnReset_Click";
            CurrentMaster.HeaderActions.AddAction(reset);
            CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

            AnswerList.AllowEdit = true;
        }

        AnswerList.OnEdit += new EventHandler(AnswerList_OnEdit);
        AnswerList.PollId = pollId;
        AnswerList.IsLiveSite = false;
        AnswerList.AllowEdit = CheckPollsModifyPermission(pi.PollSiteID, false);
    }
Пример #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int projectId = QueryHelper.GetInteger("projectid", 0);
        groupId = QueryHelper.GetInteger("groupid", 0);

        if (projectId > 0)
        {
            // Display project tasks
            listElem.ProjectID = projectId;
            listElem.OrderByType = ProjectTaskOrderByEnum.ProjectOrder;
        }
        else
        {
            // Display all task (project + ad-hoc tasks)
            listElem.Grid.GridName = URLHelper.ResolveUrl("~/CMSModules/ProjectManagement/Controls/UI/ProjectTask/ListAll.xml");
            listElem.OrderByType = ProjectTaskOrderByEnum.ProjectOrder;
            listElem.OrderBy = "ProjectTaskDisplayName";
        }

        // Set OnCheckPermissions event handler
        listElem.OnCheckPermissionsExtended += new CMSAdminControl.CheckPermissionsExtendedEventHandler(listElem_OnCheckPermissionsExtended);

        listElem.CommunityGroupID = groupId;

        HeaderAction action = new HeaderAction();
        action.Text = GetString("pm.projecttask.new");
        action.RedirectUrl = ResolveUrl("~/CMSModules/Groups/Tools/ProjectManagement/ProjectTask/Edit.aspx?projectid=" + projectId + "&groupid=" + groupId);
        CurrentMaster.HeaderActions.AddAction(action);
    }
Пример #17
0
    /// <summary>
    /// Initializes header actions.
    /// </summary>
    private void InitHeaderActions()
    {
        if (MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MVTest", "New"))
        {
            string url = UIContextHelper.GetElementUrl("CMS.MVTest", "New", EditInDialog);

            // Get the alias path of the current node
            if (Node != null)
            {
                // Set NodeID in order to check the access to the document
                listElem.NodeID    = Node.NodeID;
                listElem.AliasPath = Node.NodeAliasPath;

                url = URLHelper.AddParameterToUrl(url, "NodeID", Node.NodeID.ToString());
                url = URLHelper.AddParameterToUrl(url, "AliasPath", Node.NodeAliasPath);
            }

            // Set header action
            var action = new HeaderAction
            {
                ResourceName = "CMS.MVTest",
                Permission   = "Manage",
                Text         = GetString("mvtest.new"),
                RedirectUrl  = ResolveUrl(url),
                OpenInDialog = EditInDialog
            };

            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
Пример #18
0
    /// <summary>
    /// Init menu
    /// </summary>
    private void InitHeaderActions()
    {
        // Save action
        SaveAction save = new SaveAction(Page);

        headerActions.ActionsList.Add(save);

        // Preview
        HeaderAction preview = new HeaderAction()
        {
            ControlType   = HeaderActionTypeEnum.LinkButton,
            Text          = GetString("general.preview"),
            OnClientClick = "performToolbarAction('split');return false;",
            ImageUrl      = GetImageUrl("CMSModules/CMS_Content/EditMenu/Preview.png"),
            SmallImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/16/Preview.png"),
            Visible       = (previewState == 0),
            Tooltip       = GetString("preview.tooltip")
        };

        headerActions.ActionsList.Add(preview);

        headerActions.ActionPerformed += (sender, e) =>
        {
            if (e.CommandName == ComponentEvents.SAVE)
            {
                Save();
            }
        };
    }
Пример #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int projectId = QueryHelper.GetInteger("projectid", 0);

        ProjectInfo pi = ProjectInfoProvider.GetProjectInfo(projectId);
        if (pi != null)
        {
            if (pi.ProjectSiteID != SiteContext.CurrentSiteID)
            {
                RedirectToInformation(GetString("general.notassigned"));
            }
        }

        if (projectId > 0)
        {
            // Display project tasks
            listElem.ProjectID = projectId;
            listElem.OrderByType = ProjectTaskOrderByEnum.ProjectOrder;
            listElem.OrderBy = "TaskPriorityOrder ASC, ProjectTaskDeadline DESC";
        }
        else
        {
            // Display all task (project + ad-hoc tasks)
            listElem.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/UI/ProjectTask/ListAll.xml";
            listElem.OrderBy = "ProjectTaskDisplayName";
            listElem.SiteName = SiteContext.CurrentSiteName;
        }

        HeaderAction action = new HeaderAction();
        action.Text = (projectId > 0) ? GetString("pm.projecttask.new") : GetString("pm.projecttask.newpersonal");
        action.RedirectUrl = ResolveUrl("Edit.aspx" + ((projectId > 0) ? ("?projectid=" + projectId) : ""));
        CurrentMaster.HeaderActions.AddAction(action);
    }
Пример #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region "New project link"

        HeaderAction action = new HeaderAction();
        action.Text        = GetString("pm.project.new");
        action.CommandName = "new_project";
        actionsElem.AddAction(action);

        actionsElem.ActionPerformed += actionsElem_ActionPerformed;

        #endregion

        // Breadcrumbs back handlers
        lnkBackHidden.Click += lnkBackHidden_Click;

        // Breadcrumb strings
        InitializeBreadcrumbs();

        // List settings
        ucProjectList.UsePostbackOnEdit = true;
        ucProjectList.OnAction         += ucProjectList_OnAction;
        ucProjectList.CommunityGroupID  = CommunityGroupID;

        // New item settings
        ucProjectNew.CommunityGroupID = CommunityGroupID;
        ucProjectNew.OnSaved         += ucProjectNew_OnSaved;

        ucProjectNew.OnCheckPermissions  += controls_OnCheckPermissions;
        ucProjectList.OnCheckPermissions += controls_OnCheckPermissions;
        ucProjectList.OnDelete           += ucProjectList_OnDelete;
    }
    /// <summary>
    /// Initializes header actions.
    /// </summary>
    private void InitHeaderActions()
    {
        if (MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MVTest", "New"))
        {
            string url = UIContextHelper.GetElementUrl("CMS.MVTest", "New", EditInDialog);

            // Get the alias path of the current node
            if (Node != null)
            {
                // Set NodeID in order to check the access to the document
                listElem.NodeID = Node.NodeID;
                listElem.AliasPath = Node.NodeAliasPath;

                url = URLHelper.AddParameterToUrl(url, "NodeID", Node.NodeID.ToString());
                url = URLHelper.AddParameterToUrl(url, "AliasPath", Node.NodeAliasPath);
            }

            // Set header action
            var action = new HeaderAction
            {
                ResourceName = "CMS.MVTest",
                Permission = "Manage",
                Text = GetString("mvtest.new"),
                RedirectUrl = ResolveUrl(url),
                OpenInDialog = EditInDialog
            };

            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
Пример #22
0
    private void InitHeaderActions()
    {
        // Add extra action to object menu
        layoutAction = new HeaderAction
        {
            Text          = GetString("documenttype_edit_form.generatedefaultlayout"),
            Enabled       = Enabled && radCustomLayout.Checked,
            OnClientClick = (LayoutTypeEnum.Html.ToString() == drpLayoutType.SelectedValue) ? "SetContent(GenerateHtmlLayout()); return false;" : "SetContent(GenerateAscxLayout()); return false;",
            Visible       = !IsEditedObjectLocked(),
            ButtonStyle   = ButtonStyle.Default,
        };
        AddExtraHeaderAction(layoutAction);

        if (EditedObjectSupportsLocking && (ObjectEditMenu != null))
        {
            // Register for get client validation script event
            ObjectEditMenu.OnGetClientValidationScript += ObjectEditMenu_OnGetClientValidationScript;
        }
        else
        {
            // Get save validation script
            string script = GetValidationScript();
            if (!string.IsNullOrEmpty(script))
            {
                btnSave.OnClientClick = string.Format("if (!{0}) {{ return false; }}", script);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get poll id from querystring
        pollId = QueryHelper.GetInteger("pollId", 0);
        groupId = QueryHelper.GetInteger("groupId", 0);

        if (CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE, false))
        {
            HeaderAction newItem = new HeaderAction();
            newItem.Text = GetString("Polls_Answer_List.NewItemCaption");
            newItem.RedirectUrl = ResolveUrl("Polls_Edit_Answer_Edit.aspx?pollId=" + pollId.ToString() + "&groupId=" + groupId);
            CurrentMaster.HeaderActions.AddAction(newItem);

            HeaderAction reset = new HeaderAction();
            reset.Text = GetString("Polls_Answer_List.ResetButton");
            reset.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Polls_Answer_List.ResetConfirmation")) + ");";
            reset.CommandName = "btnReset_Click";
            CurrentMaster.HeaderActions.AddAction(reset);

            CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed);

            AnswerList.AllowEdit = true;
        }

        AnswerList.OnEdit += new EventHandler(AnswerList_OnEdit);
        AnswerList.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(AnswerList_OnCheckPermissions);
        AnswerList.PollId = pollId;
        AnswerList.GroupId = groupId;
    }
Пример #24
0
 private static void AssignClientScriptToAction(HeaderAction action, string clientScript)
 {
     if (action != null)
     {
         action.OnClientClick = clientScript;
     }
 }
Пример #25
0
    protected override void OnPreRender(EventArgs e)
    {
        int classId = ClassID;

        if (classId <= 0)
        {
            classId = filter.ClassId;
        }

        var classInfo = DataClassInfoProvider.GetDataClassInfo(classId);

        if ((classInfo != null) && (classInfo.ClassIsDocumentType && classInfo.ClassIsCoupledClass))
        {
            // Generate default
            HeaderAction generate = new HeaderAction
            {
                Text          = GetString("DocumentType_Edit_Transformation_Edit.ButtonDefault"),
                Tooltip       = GetString("transformationtypecode.generatetooltip"),
                OnClientClick = "GenerateDefaultCode('default'); return false;"
            };

            if (CurrentMaster.ObjectEditMenu != null)
            {
                CurrentMaster.ObjectEditMenu.AddExtraAction(generate);
            }
        }

        base.OnPreRender(e);

        if (DialogMode)
        {
            PageBreadcrumbs.Items.Clear();
            PageTitle.TitleText = GetString("DocumentType_Edit_Transformation_Edit.NewTransformation");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        webpartId = QueryHelper.GetInteger("webpartid", 0);

        Title = "Web part documentation";

        // Resource string
        btnOk.Text = GetString("General.Ok");

        WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(webpartId);
        EditedObject = wpi;
        if (wpi != null)
        {
            HeaderAction action = new HeaderAction();
            action.Text = GetString("webparteditdocumentation.view");
            action.RedirectUrl = "~/CMSModules/PortalEngine/UI/WebParts/WebPartDocumentationPage.aspx?webpartid=" + wpi.WebPartName;
            action.Target = "_blank";
            CurrentMaster.HeaderActions.AddAction(action);
        }

        // HTML editor settings
        htmlText.AutoDetectLanguage = false;
        htmlText.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        htmlText.EditorAreaCSS = "";
        htmlText.ToolbarSet = "SimpleEdit";

        // Load data
        if (!RequestHelper.IsPostBack() && (wpi != null))
        {
            htmlText.ResolvedValue = wpi.WebPartDocumentation;
        }
    }
    /// <summary>
    /// Init menu
    /// </summary>
    private void InitHeaderActions()
    {
        // Save action
        SaveAction save = new SaveAction();

        headerActions.ActionsList.Add(save);

        // Preview
        HeaderAction preview = new HeaderAction
        {
            Text          = GetString("general.preview"),
            OnClientClick = "performToolbarAction('split');return false;",
            Visible       = (previewState == 0),
            Tooltip       = GetString("preview.tooltip")
        };

        headerActions.ActionsList.Add(preview);

        headerActions.ActionPerformed += (sender, e) =>
        {
            if (e.CommandName == ComponentEvents.SAVE)
            {
                Save();
            }
        };
    }
Пример #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int projectId = QueryHelper.GetInteger("projectid", 0);

        groupId = QueryHelper.GetInteger("groupid", 0);

        if (projectId > 0)
        {
            // Display project tasks
            listElem.ProjectID   = projectId;
            listElem.OrderByType = ProjectTaskOrderByEnum.ProjectOrder;
        }
        else
        {
            // Display all task (project + ad-hoc tasks)
            listElem.Grid.GridName = URLHelper.ResolveUrl("~/CMSModules/ProjectManagement/Controls/UI/ProjectTask/ListAll.xml");
            listElem.OrderByType   = ProjectTaskOrderByEnum.ProjectOrder;
            listElem.OrderBy       = "ProjectTaskDisplayName";
        }

        // Set OnCheckPermissions event handler
        listElem.OnCheckPermissionsExtended += new CMSAdminControl.CheckPermissionsExtendedEventHandler(listElem_OnCheckPermissionsExtended);

        listElem.CommunityGroupID = groupId;

        HeaderAction action = new HeaderAction();

        action.Text        = GetString("pm.projecttask.new");
        action.RedirectUrl = ResolveUrl("~/CMSModules/Groups/Tools/ProjectManagement/ProjectTask/Edit.aspx?projectid=" + projectId + "&groupid=" + groupId);
        CurrentMaster.HeaderActions.AddAction(action);
    }
    /// <summary>
    /// Adds header actions to page.
    /// </summary>
    private void InitHeaderActions()
    {
        // Tasks on azure are processed by special worker role  or by scheduler
        // Scheduler may be set to run the task only on one CMS server at the time (shared index files)
        // In this cases we cant allow user to start task processing on the current server.
        if (!SystemContext.IsRunningOnAzure && !SearchTaskInfoProvider.ProcessSearchTasksByScheduler)
        {
            // Add process tasks action
            mProcessTasksAction = new HeaderAction
            {
                Text        = Control.GetString("smartsearch.task.processtasks"),
                CommandName = PROCESS
            };
            Control.AddHeaderAction(mProcessTasksAction);
            ComponentEvents.RequestEvents.RegisterForEvent(PROCESS, (sender, args) => SearchTaskInfoProvider.ProcessTasks());
        }

        // Add refresh action
        mRefreshAction = new HeaderAction
        {
            Text        = Control.GetString("general.refresh"),
            CommandName = REFRESH
        };
        Control.AddHeaderAction(mRefreshAction);
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check permissions
        isAuthorised = (CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Design", "Design"));

        // Setup device layouts grid
        deviceLayoutsGrid.WhereCondition = "ProfileID IN (SELECT ProfileID FROM CMS_TemplateDeviceLayout WHERE PageTemplateID = " + PageTemplateID + ")";
        deviceLayoutsGrid.OnAction += new OnActionEventHandler(deviceLayoutsGrid_OnAction);

        // "Create device layout" button
        string dialogUrl = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageLayouts/PageLayout_CustomDeviceLayout.aspx?dialog=1&templateid=" + PageTemplateID);

        if (isAuthorised)
        {
            // Create header button
            createDeviceLayout = new HeaderAction()
            {
                ControlType = HeaderActionTypeEnum.LinkButton,
                Text = GetString("devicelayout.create"),
                Tooltip = GetString("devicelayout.create.tooltip"),
                OnClientClick = "modalDialog('" + dialogUrl + "', 'createCustomDeviceLayout', 500, 480); return false;",
                ImageUrl = GetImageUrl("Objects/CMS_DeviceProfile/add.png"),
                SmallImageUrl = GetImageUrl("Objects/CMS_DeviceProfile/add.png")
            };

            AddHeaderAction(createDeviceLayout);
        }

        string script = @"
        function GetEditDeviceUrl(deviceProfileId) {
        return '" + URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/DeviceLayout_Frameset.aspx") + "?deviceprofileid=' + deviceProfileId + '&templateid=" + PageTemplateID + "&aliaspath=" + aliasPath + @"';
        }";
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "editScript", script, true);
    }
    /// <summary>
    /// Initializes header actions.
    /// </summary>
    private void InitHeaderActions()
    {
        if (MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.ABTest", "New"))
        {
            string url = UIContextHelper.GetElementUrl("CMS.ABTest", "New", EditInDialog);

            // Get the alias path of the current node, if in content
            if (Node != null)
            {
                listElem.NodeID = Node.NodeID;
                listElem.ShowOriginalPageColumn = false;
                string aliasPath = Node.NodeAliasPath;
                listElem.AliasPath = aliasPath;

                url = URLHelper.AddParameterToUrl(url, "NodeID", Node.NodeID.ToString());
                url = URLHelper.AddParameterToUrl(url, "AliasPath", aliasPath);
            }

            url = ResolveUrl(url);

            // Set header action
            var action = new HeaderAction
            {
                ResourceName = "CMS.ABTest",
                Permission = "Manage",
                Text = GetString("abtesting.abtest.new"),
                RedirectUrl = url,
                OpenInDialog = EditInDialog
            };

            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
    /// <summary>
    /// Initializes master page and header actions.
    /// </summary>
    private void InitMaster()
    {
        // Init filter for the first time according to user permissions
        if (!RequestHelper.IsPostBack())
        {
            if (AuthorizedForGlobalPolls && AuthorizedForSitePolls)
            {
                fltSite.SiteID = QueryHelper.GetInteger("siteid", SiteContext.CurrentSiteID);
            }
            else if (AuthorizedForSitePolls)
            {
                // User is authorized for site polls => select site polls
                fltSite.SiteID = SiteContext.CurrentSiteID;
            }
            else
            {
                // User is authorized for global polls => select global polls only
                fltSite.SiteID = UniSelector.US_GLOBAL_RECORD;
            }
        }

        HeaderAction action = new HeaderAction();
        action.Text = GetString("Polls_List.NewItemCaption");
        action.RedirectUrl = ResolveUrl("Polls_New.aspx?siteid=" + fltSite.SiteID);
        hdrActions.AddAction(action);

        // Set the page title
        PageTitle.TitleText = GetString("Polls_List.HeaderCaption");
        CurrentMaster.DisplaySiteSelectorPanel = AuthorizedForSitePolls && AuthorizedForGlobalPolls;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        userId      = QueryHelper.GetInteger("userId", 0);
        currentUser = MembershipContext.AuthenticatedUser;
        if (userId <= 0 && currentUser != null)
        {
            userId = currentUser.UserID;
        }

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check 'manage' permission
        bool friendsManagePermission = currentUser.IsAuthorizedPerResource("CMS.Friends", "Manage") || (currentUser.UserID == userId);

        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        // Check that only global administrator can edit global administrator's accounts
        if (userId > 0)
        {
            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                plcTable.Visible = false;
                lblError.Text    = GetString("Administration-User_List.ErrorGlobalAdmin");
                lblError.Visible = true;
            }
            else
            {
                ScriptHelper.RegisterDialogScript(this);
                FriendsList.UserID              = userId;
                FriendsList.OnCheckPermissions += CheckPermissions;
                FriendsList.ZeroRowsText        = GetString("friends.nouserfriends");

                // Request friend link
                string script =
                    "function displayRequest(){ \n" +
                    "modalDialog('" + AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Friends/Dialogs/Friends_Request.aspx") + "?userid=" + userId + "&siteid=" + SiteID + "', 'rejectDialog', 810, 460);}";

                ScriptHelper.RegisterStartupScript(this, GetType(), "displayModalRequest", ScriptHelper.GetScript(script));

                HeaderAction action = new HeaderAction();
                action.Text          = GetString("Friends_List.NewItemCaption");
                action.OnClientClick = "displayRequest();";
                action.RedirectUrl   = null;
                action.Enabled       = friendsManagePermission;
                CurrentMaster.HeaderActions.AddAction(action);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        userId = QueryHelper.GetInteger("userId", 0);
        currentUser = MembershipContext.AuthenticatedUser;
        if (userId <= 0 && currentUser != null)
        {
            userId = currentUser.UserID;
        }

        // Check 'read' permissions
        if (!currentUser.IsAuthorizedPerResource("CMS.Friends", "Read") && (currentUser.UserID != userId))
        {
            RedirectToAccessDenied("CMS.Friends", "Read");
        }

        // Check 'manage' permission
        bool friendsManagePermission = currentUser.IsAuthorizedPerResource("CMS.Friends", "Manage") || (currentUser.UserID == userId);

        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty) != string.Empty)
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Friends);
        }

        // Check that only global administrator can edit global administrator's accounts
        if (userId > 0)
        {
            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            EditedObject = ui;

            if (!CheckGlobalAdminEdit(ui))
            {
                plcTable.Visible = false;
                lblError.Text = GetString("Administration-User_List.ErrorGlobalAdmin");
                lblError.Visible = true;
            }
            else
            {
                ScriptHelper.RegisterDialogScript(this);
                FriendsList.UserID = userId;
                FriendsList.OnCheckPermissions += CheckPermissions;
                FriendsList.ZeroRowsText = GetString("friends.nouserfriends");

                // Request friend link
                string script =
                    "function displayRequest(){ \n" +
                    "modalDialog('" + AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Friends/Dialogs/Friends_Request.aspx") + "?userid=" + userId + "&siteid=" + SiteID + "', 'rejectDialog', 810, 460);}";

                ScriptHelper.RegisterStartupScript(this, GetType(), "displayModalRequest", ScriptHelper.GetScript(script));

                HeaderAction action = new HeaderAction();
                action.Text = GetString("Friends_List.NewItemCaption");
                action.OnClientClick = "displayRequest();";
                action.RedirectUrl = null;
                action.Enabled = friendsManagePermission;
                CurrentMaster.HeaderActions.AddAction(action);
            }
        }
    }
Пример #35
0
 private void Start()
 {
     mode      = FindObjects.GameLogic.GetComponent <SubMode>();
     header    = FindObjects.GameLogic.GetComponent <HeaderAction>();
     setting   = FindObjects.GameLogic.GetComponent <GameSetting>();
     ui        = FindObjects.GameLogic.GetComponent <UserInterface>();
     uiSetting = FindObjects.GameLogic.GetComponent <UISetting>();
 }
    /// <summary>
    /// Set header actions.
    /// </summary>
    private void SetHeaderActions()
    {
        HeaderAction action = new HeaderAction();

        action.Text        = GetString("General.Refresh");
        action.RedirectUrl = RequestContext.CurrentURL;
        CurrentMaster.HeaderActions.AddAction(action);
    }
 /// <summary>
 /// Initializes the master page elements.
 /// </summary>
 private void InitializeMasterPage()
 {
     // Setup master page action element
     HeaderAction action = new HeaderAction();
     action.Text = GetString("board.subscriptions.newitem");
     action.RedirectUrl = ResolveUrl("~/CMSModules/MessageBoards/Tools/Boards/Board_Edit_Subscription_Edit.aspx?boardid=" + mBoardId.ToString() + "&changemaster=" + changeMaster);
     CurrentMaster.HeaderActions.AddAction(action);
 }
    /// <summary>
    /// Initializes the master page elements.
    /// </summary>
    private void InitializeMasterPage()
    {
        HeaderAction action = new HeaderAction();

        action.Text        = GetString("board.subscriptions.newitem");
        action.RedirectUrl = "~/CMSModules/Groups/Tools/MessageBoards/Boards/Board_Edit_Subscription_Edit.aspx?boardid=" + boardId.ToString() + "&groupid=" + groupId;
        CurrentMaster.HeaderActions.AddAction(action);
    }
Пример #39
0
 /// <summary>
 /// Adds extra action to the object edit menu.
 /// </summary>
 /// <param name="action">Header action</param>
 public void AddExtraHeaderAction(HeaderAction action)
 {
     if ((action != null) && (ObjectEditMenu != null))
     {
         // Add extra action to object menu
         ObjectEditMenu.AddExtraAction(action);
     }
 }
Пример #40
0
 /// <summary>
 /// Adds menu action.
 /// </summary>
 /// <param name="action">Action</param>
 protected void AddAction(HeaderAction action)
 {
     if (action != null)
     {
         // Action
         menu.ActionsList.Add(action);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get AnswerID and PollID from querystring
        int pollId = QueryHelper.GetInteger("pollid", 0);

        string currentPollAnswer = GetString("Polls_Answer_Edit.NewItemCaption");

        int answerId = QueryHelper.GetInteger("answerId", 0);

        if (QueryHelper.GetInteger("saved", 0) == 1)
        {
            AnswerEdit.Saved = true;
        }
        AnswerEdit.ItemID = answerId;
        AnswerEdit.PollId = pollId;

        if (answerId > 0)
        {
            // Modifying existing answer
            CurrentMaster.Title.HelpTopicName = "answer_edit";
            PollAnswerInfo pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(answerId);
            EditedObject = pollAnswerObj;
            if (pollAnswerObj != null)
            {
                currentPollAnswer = GetString("Polls_Answer_Edit.AnswerLabel") + " " + pollAnswerObj.AnswerOrder.ToString();
                pollId            = pollAnswerObj.AnswerPollID;
            }
        }
        else
        {
            // Creating new answer - check if parent object exists
            EditedObject = PollInfoProvider.GetPollInfo(pollId);
            CurrentMaster.Title.HelpTopicName = "new_answer";
        }

        // Initializes page title control
        string[,] breadcrumbs           = new string[2, 3];
        breadcrumbs[0, 0]               = GetString("Polls_Answer_Edit.ItemListLink");
        breadcrumbs[0, 1]               = "~/CMSModules/Polls/Tools/Polls_Answer_List.aspx?pollId=" + pollId;
        breadcrumbs[0, 2]               = "";
        breadcrumbs[1, 0]               = currentPollAnswer;
        breadcrumbs[1, 1]               = "";
        breadcrumbs[1, 2]               = "";
        CurrentMaster.Title.Breadcrumbs = breadcrumbs;

        HeaderAction add = new HeaderAction()
        {
            ControlType = HeaderActionTypeEnum.Hyperlink,
            Text        = GetString("Polls_Answer_List.NewItemCaption"),
            RedirectUrl = ResolveUrl("Polls_Answer_Edit.aspx?pollId=" + pollId.ToString()),
            ImageUrl    = GetImageUrl("CMSModules/CMS_Polls/addanswer.png")
        };

        CurrentMaster.HeaderActions.AddAction(add);

        AnswerEdit.OnSaved   += new EventHandler(AnswerEdit_OnSaved);
        AnswerEdit.IsLiveSite = false;
    }
Пример #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        stringCodeName = QueryHelper.GetString("stringCodeName", String.Empty);
        cultureId      = QueryHelper.GetInteger("cultureId", 0);

        // Validate culture ID
        if (cultureId <= 0)
        {
            ShowError(GetString("general.invalidcultureid"));
            return;
        }

        if (QueryHelper.GetBoolean("saved", false))
        {
            ShowChangesSaved();
        }

        // Init new header action
        HeaderAction action = new HeaderAction
        {
            Text        = GetString("culture.newstring"),
            RedirectUrl = "~/CMSModules/SystemDevelopment/Development/Resources/UICulture_StringsDefault_New.aspx?cultureId=" + cultureId,
        };

        CurrentMaster.HeaderActions.ActionsList.Add(action);

        codeNameBreadcrumbItem = new BreadcrumbItem
        {
            Text = stringCodeName.ToLowerCSafe(),
        };
        PageBreadcrumbs.AddBreadcrumb(codeNameBreadcrumbItem);

        // Ensure breadcrumbs suffix
        UIHelper.SetBreadcrumbsSuffix(GetString("objecttype.cms_resourcestring"));

        // Initialize controls
        rfvKey.ErrorMessage = GetString("culture.enterakey");

        if (!RequestHelper.IsPostBack())
        {
            CultureInfo uic = CultureInfoProvider.GetCultureInfo(cultureId);

            if (uic != null)
            {
                string             cultureCode = uic.CultureCode;
                FileResourceEditor fre         = new FileResourceEditor(Server.MapPath(FileResourceManager.GetResFilename(cultureCode)), cultureCode);
                if (fre != null)
                {
                    txtKey.Text  = stringCodeName;
                    txtText.Text = fre.GetResourceString(stringCodeName, cultureCode);
                }
            }
            else
            {
                ShowError(GetString("general.invalidcultureid"));
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get AnswerID and PollID from querystring
        int pollId = QueryHelper.GetInteger("pollid", 0);

        string currentPollAnswer = GetString("Polls_Answer_Edit.NewItemCaption");

        int answerId = QueryHelper.GetInteger("answerId", 0);
        if (QueryHelper.GetInteger("saved", 0) == 1)
        {
            AnswerEdit.Saved = true;
        }
        AnswerEdit.ItemID = answerId;
        AnswerEdit.PollId = pollId;

        if (answerId > 0)
        {
            // Modifying existing answer
            CurrentMaster.Title.HelpTopicName = "answer_edit";
            PollAnswerInfo pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(answerId);
            EditedObject = pollAnswerObj;
            if (pollAnswerObj != null)
            {
                currentPollAnswer = GetString("Polls_Answer_Edit.AnswerLabel") + " " + pollAnswerObj.AnswerOrder.ToString();
                pollId = pollAnswerObj.AnswerPollID;
            }
        }
        else
        {
            // Creating new answer - check if parent object exists
            EditedObject = PollInfoProvider.GetPollInfo(pollId);
            CurrentMaster.Title.HelpTopicName = "new_answer";
        }

        // Initializes page title control
        string[,] breadcrumbs = new string[2,3];
        breadcrumbs[0, 0] = GetString("Polls_Answer_Edit.ItemListLink");
        breadcrumbs[0, 1] = "~/CMSModules/Polls/Tools/Polls_Answer_List.aspx?pollId=" + pollId;
        breadcrumbs[0, 2] = "";
        breadcrumbs[1, 0] = currentPollAnswer;
        breadcrumbs[1, 1] = "";
        breadcrumbs[1, 2] = "";
        CurrentMaster.Title.Breadcrumbs = breadcrumbs;

        HeaderAction add = new HeaderAction()
        {
            ControlType = HeaderActionTypeEnum.Hyperlink,
            Text = GetString("Polls_Answer_List.NewItemCaption"),
            RedirectUrl = ResolveUrl("Polls_Answer_Edit.aspx?pollId=" + pollId.ToString()),
            ImageUrl = GetImageUrl("CMSModules/CMS_Polls/addanswer.png")
        };

        CurrentMaster.HeaderActions.AddAction(add);

        AnswerEdit.OnSaved += new EventHandler(AnswerEdit_OnSaved);
        AnswerEdit.IsLiveSite = false;
    }
Пример #44
0
 public static PSHeaderAction ToPSHeaderAction(HeaderAction sdkHeaderAction)
 {
     return(new PSHeaderAction
     {
         HeaderName = sdkHeaderAction.HeaderName,
         HeaderActionType = (PSHeaderActionType)Enum.Parse(typeof(PSHeaderActionType), sdkHeaderAction.HeaderActionType),
         Value = sdkHeaderAction.Value
     });
 }
Пример #45
0
    /// <summary>
    /// Initializes the master page elements.
    /// </summary>
    private void InitializeMasterPage()
    {
        // Setup master page action element
        HeaderAction action = new HeaderAction();

        action.Text        = GetString("board.subscriptions.newitem");
        action.RedirectUrl = ResolveUrl("~/CMSModules/MessageBoards/Tools/Boards/Board_Edit_Subscription_Edit.aspx?boardid=" + mBoardId.ToString() + "&changemaster=" + changeMaster);
        CurrentMaster.HeaderActions.AddAction(action);
    }
 /// <summary>
 /// Initializes Master Page.
 /// </summary>
 protected void InitializeMasterPage(string currentForumPost)
 {
     Title = "Forum post listing";
     PageTitle.TitleText = GetString("Forums.Listing.Title");
     if (postInfo != null)
     {
         HeaderAction action = new HeaderAction();
         action.Text = GetString("Forums.ParentPost");
         action.OnClientClick = "SelectPost(" + postInfo.PostParentID + ", " + postInfo.PostForumID + ");";
         action.RedirectUrl = null;
         CurrentMaster.HeaderActions.AddAction(action);
     }
 }
    /// <summary>
    /// Initializes Master Page.
    /// </summary>
    protected void InitializeMasterPage(int forumId)
    {
        Title = "Forums - Subscriptions List";

        HeaderAction action = new HeaderAction();
        action.Text = GetString("ForumSubscription_List.NewItemCaption");

        if (forumId > 0)
        {
            action.RedirectUrl = ResolveUrl("ForumSubscription_Edit.aspx?forumid=" + forumId);
        }

        CurrentMaster.HeaderActions.AddAction(action);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        messageList.IsLiveSite = false;
        messageList.BoardID = mBoardId;
        messageList.GroupID = mGroupId;
        messageList.OnAction += messageList_OnAction;

        if (mBoardId > 0)
        {
            HeaderAction action = new HeaderAction();
            action.Text = GetString("Board.MessageList.NewMessage");
            action.OnClientClick = "modalDialog('" + AuthenticationHelper.ResolveDialogUrl("~/CMSModules/MessageBoards/Tools/Messages/Message_Edit.aspx") + "?boardId=" + mBoardId + "&changemaster=" + QueryHelper.GetBoolean("changemaster", false) + "', 'MessageEdit', 800, 535); return false;";
            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.Page.Title = GetString("dialogs.youtube.inserttitle");
        PageTitle.TitleText = GetString("dialogs.youtube.inserttitle");
        CurrentMaster.Body.Attributes.Add("onbeforeunload", "$cmsj('.YouTubePreviewBox').remove();");

        HeaderAction action = new HeaderAction
        {
            Text = GetString("dialogs.youtube.goto"),
            Target = "_blank",
            RedirectUrl = "http://www.youtube.com"
        };

        CurrentMaster.HeaderActions.AddAction(action);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        messageList.BoardID = mBoardId;
        messageList.GroupID = mGroupId;
        messageList.EditPageUrl = "~/CMSModules/Groups/Tools/MessageBoards/Messages/Message_Edit.aspx";
        messageList.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(messageList_OnCheckPermissions);
        messageList.OnAction += new CommandEventHandler(messageList_OnAction);

        if (mBoardId > 0)
        {
            HeaderAction action = new HeaderAction();
            action.Text = GetString("Board.MessageList.NewMessage");
            action.OnClientClick = "modalDialog('" + ResolveUrl("~/CMSModules/Groups/Tools/MessageBoards/Messages/Message_Edit.aspx") + "?boardId=" + mBoardId + "', 'MessageEdit', 500, 400); return false;";
            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        webpartId = QueryHelper.GetInteger("webpartid", 0);
        EditedObject = WebPartInfoProvider.GetWebPartInfo(webpartId);
        GenerateCode();

        // Ensure header action
        HeaderAction generate = new HeaderAction();
        generate.Text = GetString("WebPartCode.Generate");
        generate.Tooltip = generate.Text;
        generate.CommandName = "generate";

        HeaderActions.AddAction(generate);

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get AnswerID and PollID from querystring
        int pollId = QueryHelper.GetInteger("pollid", 0);

        string currentPollAnswer = GetString("Polls_Answer_Edit.NewItemCaption");

        int answerId = QueryHelper.GetInteger("answerId", 0);
        if (QueryHelper.GetInteger("saved", 0) == 1)
        {
            AnswerEdit.Saved = true;
        }
        AnswerEdit.ItemID = answerId;
        AnswerEdit.PollId = pollId;

        if (answerId > 0)
        {
            // Modifying existing answer
            PollAnswerInfo pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(answerId);
            EditedObject = pollAnswerObj;
            if (pollAnswerObj != null)
            {
                currentPollAnswer = GetString("Polls_Answer_Edit.AnswerLabel") + " " + pollAnswerObj.AnswerOrder.ToString();
                pollId = pollAnswerObj.AnswerPollID;
            }
        }
        else
        {
            // Creating new answer - check if parent object exists
            EditedObject = PollInfoProvider.GetPollInfo(pollId);
        }

        // Create breadcrumbs
        CreateBreadCrumbs(pollId, currentPollAnswer);

        HeaderAction add = new HeaderAction
        {
            Text = GetString("Polls_Answer_List.NewItemCaption"),
            RedirectUrl = ResolveUrl("Polls_Answer_Edit.aspx?pollId=" + pollId),
        };

        CurrentMaster.HeaderActions.AddAction(add);

        AnswerEdit.OnSaved += AnswerEdit_OnSaved;
        AnswerEdit.IsLiveSite = false;
    }
    protected override void OnPreRender(EventArgs e)
    {
        HeaderAction rotate = new HeaderAction
        {
            ControlType = HeaderActionTypeEnum.LinkButton,
            Text = GetString("devicepreview.rotate"),
            ImageUrl = GetImageUrl("Objects/CMS_DeviceProfile/rotate.png"),
            SmallImageUrl = GetImageUrl("Objects/CMS_DeviceProfile/rotate.png"),
            OnClientClick="CMSViewValidate.RotateDevice();return false;",
            Visible = true
        };

        CurrentMaster.HeaderActions.ActionsList.Add(rotate);
        CurrentMaster.HeaderActions.IsLiveSite = false;

        base.OnPreRender(e);
    }
Пример #54
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        ScriptHelper.RegisterDialogScript(Page);

        HeaderAction updateAction = new HeaderAction
        {
            OnClientClick = ControlsHelper.GetPostBackEventReference(btnUpdateStatuses),
            Tooltip = GetString("translationservice.updatestatusestooltip"),
            Text = GetString("translationservice.updatestatuses"),
            Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.TranslationServices", "Modify") && !listElem.Grid.IsEmpty
        };

        string translateUrl = AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Translations/Pages/TranslateDocuments.aspx") + "?select=1&dialog=1";
        translateUrl = URLHelper.AddParameterToUrl(translateUrl, "hash", QueryHelper.GetHash(URLHelper.GetQuery(translateUrl)));

        // Check if any human translation is enabled
        bool enabled = TranslationServiceInfoProvider.GetTranslationServices("(TranslationServiceEnabled = 1) AND (TranslationServiceIsMachine = 0)", null, 0, "TranslationServiceID, TranslationServiceName").Any(t => TranslationServiceHelper.IsServiceAvailable(t.TranslationServiceName, SiteContext.CurrentSiteName));

        HeaderAction submitAction = new HeaderAction
        {
            OnClientClick = "modalDialog('" + translateUrl + "', 'SubmitTranslation', 988, 634);",
            Tooltip = GetString(enabled ? "translationservice.submittranslationtooltip" : "translationservice.noenabledservices"),
            Text = GetString("translationservice.submittranslation"),
            Enabled = enabled && MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Content", "SubmitForTranslation")
        };

        AddHeaderAction(submitAction);
        AddHeaderAction(updateAction);

        CurrentMaster.HeaderActions.ReloadData();

        if (!listElem.Grid.IsEmpty)
        {
            string statusCheck = SettingsKeyInfoProvider.GetStringValue("CMSTranslationsLastStatusCheck");
            if (string.IsNullOrEmpty(statusCheck))
            {
                statusCheck = GetString("general.notavailable");
            }

            ShowInformation(string.Format(GetString("translationservice.laststatuscheck"), statusCheck));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.Page.Title = GetString("dialogs.youtube.inserttitle");
        CurrentMaster.Title.TitleText = GetString("dialogs.youtube.inserttitle");
        CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Content/Dialogs/YouTube.png");
        CurrentMaster.Title.HelpTopicName = "dialogs_youtube";
        CurrentMaster.Body.Attributes.Add("onbeforeunload", "$j('.YouTubePreviewBox').remove();");

        HeaderAction action = new HeaderAction()
        {
            ControlType = HeaderActionTypeEnum.Hyperlink,
            Text = GetString("dialogs.youtube.goto"),
            Target = "_blank",
            ImageUrl = GetImageUrl("CMSModules/CMS_Content/Dialogs/opennew.png"),
            RedirectUrl = "http://www.youtube.com"
        };

        CurrentMaster.HeaderActions.AddAction(action);
    }
Пример #56
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        ScriptHelper.RegisterDialogScript(this.Page);

        HeaderAction updateAction = new HeaderAction()
        {
            OnClientClick = ControlsHelper.GetPostBackEventReference(btnUpdateStatuses, null),
            Tooltip = GetString("translationservice.updatestatusestooltip"),
            Text = GetString("translationservice.updatestatuses"),
            Enabled = CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.TranslationServices", "Modify") && !listElem.Grid.IsEmpty
        };
        updateAction.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Approve" + (updateAction.Enabled ? "" : "Disabled") + ".png");

        string translateUrl = CMSContext.ResolveDialogUrl("~/CMSModules/Translations/Pages/TranslateDocuments.aspx") + "?select=1&modal=1";
        translateUrl = URLHelper.AddParameterToUrl(translateUrl, "hash", QueryHelper.GetHash(URLHelper.GetQuery(translateUrl)));

        HeaderAction submitAction = new HeaderAction()
        {
            OnClientClick = "modalDialog('" + translateUrl + "', 'SubmitTranslation', 600, 570);",
            Tooltip = GetString("translationservice.submittranslationtooltip"),
            Text = GetString("translationservice.submittranslation"),
            Enabled = CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Content", "SubmitForTranslation")
        };
        submitAction.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/AddPost" + (submitAction.Enabled ? "" : "Disabled") + ".png");

        this.AddHeaderAction(submitAction);
        this.AddHeaderAction(updateAction);

        CurrentMaster.HeaderActions.ReloadData();

        if (!listElem.Grid.IsEmpty)
        {
            string statusCheck = SettingsKeyProvider.GetStringValue("CMSTranslationsLastStatusCheck");
            if (string.IsNullOrEmpty(statusCheck))
            {
                statusCheck = GetString("general.notavailable");
            }

            ShowInformation(string.Format(GetString("translationservice.laststatuscheck"), statusCheck));
        }
    }
    /// <summary>
    /// Initializes header actions.
    /// </summary>
    protected void InitHeaderActions()
    {
        bool isAuthorized = CurrentUser.IsAuthorizedPerResource("cms.form", "EditForm");

        int attachCount = 0;
        if (isAuthorized)
        {
            // Get number of attachments
            InfoDataSet<MetaFileInfo> ds = MetaFileInfoProvider.GetMetaFiles(bizFormId, FormObjectType.BIZFORM, MetaFileInfoProvider.OBJECT_CATEGORY_LAYOUT, null, null, "MetafileID", -1);
            attachCount = ds.Items.Count;

            string script = @"
        function UpdateAttachmentCount(count) {
        var counter = document.getElementById('attachmentCount');
        if (counter != null) {
        if (count > 0) { counter.innerHTML = ' (' + count + ')'; }
        else { counter.innerHTML = ''; }
        }
        }";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "UpdateAttachmentScript_" + this.ClientID, script, true);

            // Register dialog scripts
            ScriptHelper.RegisterDialogScript(Page);
        }

        // Prepare metafile dialog URL
        string metaFileDialogUrl = ResolveUrl(@"~/CMSModules/AdminControls/Controls/MetaFiles/MetaFileDialog.aspx");
        string query = string.Format("?objectid={0}&objecttype={1}", bizFormId, FormObjectType.BIZFORM);
        metaFileDialogUrl += string.Format("{0}&category={1}&hash={2}", query, MetaFileInfoProvider.OBJECT_CATEGORY_LAYOUT, QueryHelper.GetHash(query));

        // Init attachment button
        attachments = new HeaderAction()
        {
            ControlType = HeaderActionTypeEnum.LinkButton,
            Text = GetString("general.attachments") + string.Format("<span id='attachmentCount'>{0}</span>", (attachCount > 0) ? " (" + attachCount.ToString() + ")" : string.Empty),
            Tooltip = GetString("general.attachments"),
            OnClientClick = string.Format(@"if (modalDialog) {{modalDialog('{0}', 'Attachments', '700', '500');}}", metaFileDialogUrl) + " return false;",
            ImageUrl = isAuthorized ? GetImageUrl("Objects/CMS_MetaFile/attachment.png") : GetImageUrl("Objects/CMS_MetaFile/attachment_disabled.png"),
            Enabled = isAuthorized
        };
        layoutElem.HeaderActions.ActionsList.Add(attachments);
    }
    /// <summary>
    /// Load page life-cycle event.
    /// </summary>
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        LoadForm();

        InitAsyncLog();

        // Add Serialize all objects button
        mSerializeAction = new HeaderAction
        {
            Text = GetString("ci.serializeallobjects"),
            CommandName = "serialize",
            ButtonStyle = ButtonStyle.Default
        };
        HeaderActions.AddAction(mSerializeAction);
        HeaderActions.ActionPerformed += ActionPerformed;

        ShowInformation(GetString("ci.performancemessage"));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = MembershipContext.AuthenticatedUser;
        ScriptHelper.RegisterDialogScript(this);
        FriendsListRequested.UserID = currentUser.UserID;
        FriendsListRequested.OnCheckPermissions += CheckPermissions;
        FriendsListRequested.ZeroRowsText = GetString("friends.norequestedfriends");

        // Request friend link
        string script =
            "function displayRequest(){ \n" +
            "modalDialog('" + AuthenticationHelper.ResolveDialogUrl("~/CMSModules/Friends/Dialogs/Friends_Request.aspx") + "?userid=" + currentUser.UserID + "', 'rejectDialog', 810, 460);}";

        ScriptHelper.RegisterStartupScript(this, GetType(), "displayModalRequest", ScriptHelper.GetScript(script));

        HeaderAction action = new HeaderAction();
        action.Text = GetString("Friends_List.NewItemCaption");
        action.OnClientClick = "displayRequest()";
        CurrentMaster.HeaderActions.AddAction(action);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get GroupID from query string
        groupID = QueryHelper.GetInteger("groupID", 0);

        CheckGroupPermissions(groupID, CMSAdminControl.PERMISSION_READ);

        if (CheckGroupPermissions(groupID, CMSAdminControl.PERMISSION_MANAGE, false))
        {
            HeaderAction action = new HeaderAction();
            action.Text = GetString("group.polls.newpoll");
            action.RedirectUrl = ResolveUrl("Polls_New.aspx") + "?groupid=" + groupID;
            CurrentMaster.HeaderActions.AddAction(action);

            pollsList.DeleteEnabled = true;
        }

        pollsList.OnEdit += new EventHandler(pollsList_OnEdit);
        pollsList.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(pollsList_OnCheckPermissions);
        pollsList.GroupId = groupID;
        pollsList.IsLiveSite = false;
    }