Ejemplo n.º 1
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        var attributeType = AttributeType;

        // Update the control settings
        UpdateDefaultValueControlSettings();

        chkRequired.AutoPostBack = (attributeType == FieldDataType.Boolean);

        if (ControlsHelper.CausedPostBack(chkRequired))
        {
            if (rbDefaultValue.Visible)
            {
                chkDefaultValue.Value = rbDefaultValue.Value;
            }
            else
            {
                rbDefaultValue.Value = chkDefaultValue.Value;
            }
            rbDefaultValue.Visible  = AllowEmpty;
            chkDefaultValue.Visible = !AllowEmpty;
        }
        else if (ControlsHelper.CausedPostBack(drpObjType.DropDownList))
        {
            plcReferenceType.Visible = !String.IsNullOrEmpty(ValidationHelper.GetString(drpObjType.Value, String.Empty));
        }

        // Store associated control client ID of default value label
        DefaultValueAssociatedControlClientID = lblDefaultValue.AssociatedControlClientID;
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        gridElem.IsLiveSite = IsLiveSite;

        // Get score ID from query string
        scoreId = QueryHelper.GetInteger("ScoreID", 0);

        // Initialize score filter
        FormFieldInfo ffi = new FormFieldInfo();

        ffi.Name                           = "SUM(Value)";
        ffi.DataType                       = FieldDataType.Integer;
        ucScoreFilter.FieldInfo            = ffi;
        ucScoreFilter.DefaultOperator      = ">=";
        ucScoreFilter.WhereConditionFormat = "{0} {2} {1}";

        // Get modify permission of current user
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        var sourceData = GetContactsWithScore();

        if (DataHelper.GetItemsCount(sourceData) >= MAX_RECORDS)
        {
            ShowInformation(GetString("om.contact.notallrecords"));
        }
        gridElem.DataSource = sourceData;


        // Register OnExternalDataBound
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.OnBeforeFiltering   += gridElem_OnBeforeFiltering;

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
            }
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        rightHeaderActions.ActionPerformed += RightHeaderActions_ActionPerformed;

        // Show info that scheduler is disabled
        if (!SchedulingHelper.EnableScheduler)
        {
            ShowWarning(GetString("scheduledtask.disabled"));
        }

        listElem.SiteID = SiteID;
        string editUrl = UIContextHelper.GetElementUrl("CMS.ScheduledTasks", GetElementName("EditSystemTask"), true);

        editUrl          = URLHelper.AddParameterToUrl(editUrl, "siteid", SiteID.ToString());
        listElem.EditURL = editUrl;

        // Refresh action
        HeaderActions.AddAction(new HeaderAction
        {
            Text          = GetString("General.Refresh"),
            OnClientClick = "RefreshGrid();"
        });

        if (SiteInfo != null)
        {
            bool usesTimer = SchedulingHelper.UseAutomaticScheduler;
            if (usesTimer)
            {
                // Restart timer action
                rightHeaderActions.AddAction(new HeaderAction
                {
                    Text        = GetString("Task_List.Restart"),
                    EventName   = TASKS_RESTART_TIMER,
                    ButtonStyle = ButtonStyle.Default
                });
            }

            // Run execution ASAP action
            rightHeaderActions.AddAction(new HeaderAction
            {
                Text        = GetString("Task_List.RunNow"),
                EventName   = TASKS_RUN,
                Enabled     = SchedulingHelper.EnableScheduler && (!usesTimer || SchedulingTimer.TimerExists(SiteInfo.SiteName)),
                ButtonStyle = ButtonStyle.Default
            });
        }

        // Force action buttons to cause full postback so that tasks can be properly executed in global.asax
        ControlsHelper.RegisterPostbackControl(listElem);
        ControlsHelper.RegisterPostbackControl(rightHeaderActions);

        if (ControlsHelper.CausedPostBack(btnRefresh))
        {
            // Update content after refresh
            pnlUpdate.Update();
        }
    }
Ejemplo n.º 4
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (UIContext.EditedObject != null)
        {
            cgi    = (ContactGroupInfo)UIContext.EditedObject;
            siteID = cgi.ContactGroupSiteID;

            // Check permissions
            readSiteAccounts = AccountHelper.AuthorizedReadAccount(SiteContext.CurrentSiteID, false);
            modifySiteCG     = ContactGroupHelper.AuthorizedModifyContactGroup(SiteContext.CurrentSiteID, false);
            if (siteID <= 0)
            {
                readGlobalAccounts = AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);
                modifyGlobalCG     = ContactGroupHelper.AuthorizedModifyContactGroup(UniSelector.US_GLOBAL_RECORD, false);
            }

            // Setup unigrid
            gridElem.WhereCondition       = GetWhereCondition();
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
            gridElem.OnBeforeDataReload  += gridElem_OnBeforeDataReload;
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

            modifyCombined = ((siteID > 0) && modifySiteCG) || ((siteID <= 0) && (modifyGlobalCG));

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                // Display mass actions
                if (modifyCombined)
                {
                    drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
                }
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            accountSelector.UniSelector.OnItemsSelected            += UniSelector_OnItemsSelected;
            accountSelector.UniSelector.SelectionMode               = SelectionModeEnum.MultipleButton;
            accountSelector.UniSelector.DialogButton.ResourceString = "om.account.addaccount";
        }
        else
        {
            StopProcessing = true;
        }
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get modify permission of current user
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        var editUrl = UIContextHelper.GetElementUrl(ModuleName.CONTACTMANAGEMENT, "EditContact");

        editUrl = URLHelper.AddParameterToUrl(editUrl, "objectid", "{0}");
        editUrl = URLHelper.AddParameterToUrl(editUrl, "displaytitle", "0");

        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, WhereCondition);
        gridElem.EditActionUrl        = editUrl;
        gridElem.ZeroRowsText         = GetString("om.contact.nocontacts");
        gridElem.FilteredZeroRowsText = GetString("om.contact.nocontacts.filtered");

        if (QueryHelper.GetBoolean("deleteasync", false))
        {
            ShowConfirmation(GetString("om.contact.massdeletestarted"));
        }

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }

                drpAction.Items.Add(new ListItem(GetString("general.delete"), Convert.ToInt32(Action.Delete).ToString()));
                if (LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.FullContactManagement))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
                }
            }
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get edited object
        if (UIContext.EditedObject != null)
        {
            ai     = (AccountInfo)UIContext.EditedObject;
            SiteID = ai.AccountSiteID;

            // Setup unigrid
            gridElem.GridOptions.ShowSelection = (ai.AccountMergedWithAccountID == 0);
            gridElem.WhereCondition            = SqlHelper.AddWhereCondition(gridElem.WhereCondition, "(AccountID = " + ai.AccountID + ") AND ((ContactMergedWithContactID IS NULL AND ContactSiteID > 0) OR (ContactGlobalContactID IS NULL AND ContactSiteID IS NULL))");
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.ZeroRowsText         = GetString("om.account.nocontacts");

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                drpAction.Items.Add(new ListItem(GetString("om.contactrole.select"), Convert.ToInt32(Action.SelectRole).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            contactSelector.UniSelector.OnItemsSelected  += UniSelector_OnItemsSelected;
            contactSelector.UniSelector.SelectionMode     = SelectionModeEnum.MultipleButton;
            contactSelector.UniSelector.SelectItemPageUrl = "~/CMSModules/ContactManagement/Pages/Tools/Account/Add_Contact_Dialog.aspx";
            contactSelector.UniSelector.SetValue("SiteID", SiteID);
            contactSelector.UniSelector.SetValue("IsLiveSite", false);
            contactSelector.UniSelector.FilterControl        = "~/CMSModules/ContactManagement/Filters/ContactFilter.ascx";
            contactSelector.UniSelector.UseDefaultNameFilter = false;
            contactSelector.IsSiteManager = ContactHelper.IsSiteManager;

            modifyAccountContact = AccountHelper.AuthorizedModifyAccount(SiteID, false) || ContactHelper.AuthorizedModifyContact(SiteID, false);

            // Register JS scripts
            RegisterScripts();
        }
        else
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Loads the page.
    /// </summary>
    /// <param name="e">Event arguments</param>
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        CheckPermissions();
        CurrentMaster.DisplaySiteSelectorPanel = true;

        // Check enabled servers
        var isCallback = RequestHelper.IsCallback();

        if (!isCallback && !ServerInfoProvider.IsEnabledServer(SiteContext.CurrentSiteID))
        {
            ShowInformation(GetString("ObjectStaging.NoEnabledServer"));
            HideUI();
            return;
        }

        InitServerSelector();
        mCurrentTaskGroup = TaskGroupInfoProvider.GetTaskGroupInfo(UIContext.ObjectID);

        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        if (!isCallback)
        {
            CheckPermissions();

            PrepareDisabledModuleInfo();

            if (!ucDisabledModule.Check())
            {
                HideUI();
                return;
            }

            ScriptHelper.RegisterDialogScript(this);

            // Setup title
            if (!ControlsHelper.CausedPostBack(btnSyncSelected, btnSyncAll))
            {
                plcContent.Visible = true;

                InitButtons();
                InitUniGrid();
                TaskGroupSelectorEnabled = false;

                pnlLog.Visible = false;
            }
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (UIContext.EditedObject != null)
        {
            cgi = (ContactGroupInfo)UIContext.EditedObject;

            // Setup unigrid
            gridElem.WhereCondition       = GetWhereCondition();
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.OnDataReload        += gridElem_OnDataReload;

            mModifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                // Display mass actions
                if (mModifyPermission)
                {
                    drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
                }
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize account selector
            accountSelector.UniSelector.OnItemsSelected            += UniSelector_OnItemsSelected;
            accountSelector.UniSelector.SelectionMode               = SelectionModeEnum.MultipleButton;
            accountSelector.UniSelector.DialogButton.ResourceString = "om.account.addaccount";
        }
        else
        {
            StopProcessing = true;
        }
    }
    protected override void OnInit(EventArgs e)
    {
        // Do not check changes
        DocumentManager.RegisterSaveChangesScript = false;

        base.OnInit(e);

        var grid = docList.Grid;

        grid.GridName = "Listing.xml";

        // Ensure dialog parameters
        string dialogParameter = String.Empty;

        if (RequiresDialog)
        {
            dialogParameter            = "&dialog=1";
            grid.GridName              = "ListingDialog.xml";
            grid.Pager.DefaultPageSize = 10;
        }

        docList.NodeID = NodeID;
        docList.SelectItemJSFunction = "SelectItem";

        docList.DeleteReturnUrl    = CONTENT_CMSDESK_FOLDER + "Delete.aspx?multiple=true" + dialogParameter;
        docList.PublishReturnUrl   = CONTENT_CMSDESK_FOLDER + "PublishArchive.aspx?multiple=true" + dialogParameter;
        docList.ArchiveReturnUrl   = CONTENT_CMSDESK_FOLDER + "PublishArchive.aspx?multiple=true" + dialogParameter;
        docList.TranslateReturnUrl = "~/CMSModules/Translations/Pages/TranslateDocuments.aspx?currentastargetdefault=1" + dialogParameter;

        docList.RequiresDialog = RequiresDialog;

        SelectClass.SiteID = SiteContext.CurrentSiteID;
        SelectClass.DropDownSingleSelect.AutoPostBack = true;
        CurrentMaster.DisplaySiteSelectorPanel        = true;

        var filterForm = grid.FilterForm;

        filterForm.EnableViewState = true;

        if (ControlsHelper.CausedPostBack(true, SelectClass))
        {
            // Reset filter form's view state on class change
            filterForm.EnableViewState = false;

            grid.Reset();
        }
    }
Ejemplo n.º 10
0
    protected void Page_Init(object sender, EventArgs e)
    {
        mContactInfo = (ContactInfo)UIContext.EditedObject;

        if (mContactInfo == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        SiteID = mContactInfo.ContactSiteID;

        // Setup unigrid
        gridElem.GridOptions.ShowSelection = (mContactInfo.ContactMergedWithContactID == 0);
        gridElem.WhereCondition            = SqlHelper.AddWhereCondition(gridElem.WhereCondition, "(ContactID = " + mContactInfo.ContactID + ") AND ((AccountMergedWithAccountID IS NULL AND AccountSiteID > 0) OR (AccountGlobalAccountID IS NULL AND AccountSiteID IS NULL))");
        gridElem.OnAction            += gridElem_OnAction;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.ZeroRowsText         = GetString("om.contact.noaccounts");

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
            drpAction.Items.Add(new ListItem(GetString("om.contactrole.selectitem"), Convert.ToInt32(Action.SelectRole).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Initialize contact selector
        accountSelector.UniSelector.OnItemsSelected  += UniSelector_OnItemsSelected;
        accountSelector.UniSelector.SelectionMode     = SelectionModeEnum.MultipleButton;
        accountSelector.UniSelector.SelectItemPageUrl = "~/CMSModules/ContactManagement/Pages/Tools/Contact/Add_Account_Dialog.aspx";
        accountSelector.UniSelector.SetValue("SiteID", SiteID);
        accountSelector.UniSelector.SetValue("IsLiveSite", false);
        accountSelector.IsSiteManager = ContactHelper.IsSiteManager;
        accountSelector.UniSelector.DialogButton.ResourceString = "om.account.addaccount";

        mModifyAccountContact = AccountHelper.AuthorizedModifyAccount(SiteID, false) || ContactHelper.AuthorizedModifyContact(SiteID, false);
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        // Edit action URL
        string url = UIContextHelper.GetElementUrl(ModuleName.CONTACTMANAGEMENT, "EditAccount", false);

        url = URLHelper.AddParameterToUrl(url, "objectid", "{0}");

        // Setup UniGrid
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, WhereCondition);
        gridElem.EditActionUrl        = url;
        gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
        gridElem.FilteredZeroRowsText = GetString("om.account.noaccountsfound.filtered");

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }

                drpAction.Items.Add(new ListItem(GetString("general.delete"), Convert.ToInt32(Action.Delete).ToString()));
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
            }
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for UniGrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
Ejemplo n.º 12
0
    protected override void OnInit(EventArgs e)
    {
        // Do not check changes
        DocumentManager.RegisterSaveChangesScript = false;

        base.OnInit(e);

        docList.Grid.GridName = "Listing.xml";

        // Ensure dialog parameters
        string dialogParameter = String.Empty;

        if (RequiresDialog)
        {
            dialogParameter       = "&dialog=1";
            docList.Grid.GridName = "ListingDialog.xml";
            docList.Grid.Pager.DefaultPageSize = 10;
        }

        docList.NodeID = NodeID;
        docList.SelectItemJSFunction = "SelectItem";

        docList.DeleteReturnUrl    = "~/CMSModules/Content/CMSDesk/Delete.aspx?multiple=true" + dialogParameter;
        docList.PublishReturnUrl   = "~/CMSModules/Content/CMSDesk/PublishArchive.aspx?multiple=true" + dialogParameter;
        docList.ArchiveReturnUrl   = "~/CMSModules/Content/CMSDesk/PublishArchive.aspx?multiple=true" + dialogParameter;
        docList.TranslateReturnUrl = "~/CMSModules/Translations/Pages/TranslateDocuments.aspx" + dialogParameter.Replace("&", "?");

        docList.RequiresDialog = RequiresDialog;

        SelectClass.DropDownSingleSelect.AutoPostBack = true;

        docList.Grid.FilterForm.EnableViewState = true;

        if (ControlsHelper.CausedPostBack(true, SelectClass))
        {
            // Reset filter form's view state on class change
            docList.Grid.FilterForm.EnableViewState = false;
        }
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        var attributeType = AttributeType;

        // In case of decimal attribute type, change resource strings of field size and precision
        if (attributeType == FieldDataType.Decimal)
        {
            lblAttributeSize.ResourceString      = "TemplateDesigner.DecimalFieldPrecision";
            lblAttributePrecision.ResourceString = "TemplateDesigner.DecimalFieldScale";
        }

        // Update the control settings
        UpdateDefaultValueControlSettings();

        chkRequired.AutoPostBack = (attributeType == FieldDataType.Boolean);

        if (ControlsHelper.CausedPostBack(chkRequired))
        {
            if (rbDefaultValue.Visible)
            {
                chkDefaultValue.Value = rbDefaultValue.Value;
            }
            else
            {
                rbDefaultValue.Value = chkDefaultValue.Value;
            }
            rbDefaultValue.Visible  = AllowEmpty;
            chkDefaultValue.Visible = !AllowEmpty;
        }
        else if (ControlsHelper.CausedPostBack(drpObjType.DropDownList))
        {
            plcReferenceType.Visible = !String.IsNullOrEmpty(ValidationHelper.GetString(drpObjType.Value, String.Empty));
        }

        // Store associated control client ID of default value label
        DefaultValueAssociatedControlClientID = lblDefaultValue.AssociatedControlClientID;
    }
Ejemplo n.º 14
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        var attributeType = AttributeType;

        // Update edit time property so that it has the correct value on postback
        if (datetimeDefaultValue.NestedControl != null)
        {
            var calendarControl = ((FormEngineUserControl)datetimeDefaultValue.NestedControl);

            calendarControl.SetValue("EditTime", (AttributeType == FieldDataType.DateTime));
        }

        chkRequired.AutoPostBack = attributeType == FieldDataType.Boolean;

        if (ControlsHelper.CausedPostBack(chkRequired))
        {
            if (rbDefaultValue.Visible)
            {
                chkDefaultValue.Value = rbDefaultValue.Value;
            }
            else
            {
                rbDefaultValue.Value = chkDefaultValue.Value;
            }
            rbDefaultValue.Visible  = AllowEmpty;
            chkDefaultValue.Visible = !AllowEmpty;
        }
        else if (ControlsHelper.CausedPostBack(drpObjType.DropDownList))
        {
            plcReferenceType.Visible = !String.IsNullOrEmpty(ValidationHelper.GetString(drpObjType.Value, String.Empty));
        }

        // Store associated control client ID of default value label
        DefaultValueAssociatedControlClientID = lblDefaultValue.AssociatedControlClientID;
    }
Ejemplo n.º 15
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Check 'Manage objects tasks' permission
        if (!CurrentUser.IsAuthorizedPerResource("cms.staging", "ManageObjectsTasks"))
        {
            RedirectToAccessDenied("cms.staging", "ManageObjectsTasks");
        }

        CurrentMaster.DisplaySiteSelectorPanel = true;

        // Check enabled servers
        var isCallback = RequestHelper.IsCallback();

        if (!isCallback && !ServerInfoProvider.IsEnabledServer(SiteContext.CurrentSiteID))
        {
            ShowInformation(GetString("ObjectStaging.NoEnabledServer"));
            CurrentMaster.PanelHeader.Visible = false;
            plcContent.Visible = false;
            pnlFooter.Visible  = false;
            return;
        }

        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Setup server dropdown
        selectorElem.DropDownList.AutoPostBack       = true;
        selectorElem.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;

        // Set server ID
        SelectedServerID = ValidationHelper.GetInteger(selectorElem.Value, QueryHelper.GetInteger("serverId", 0));

        // All servers
        if (SelectedServerID == UniSelector.US_ALL_RECORDS)
        {
            SelectedServerID   = 0;
            selectorElem.Value = UniSelector.US_ALL_RECORDS;
        }
        else
        {
            selectorElem.Value = SelectedServerID.ToString();
        }

        ltlScript.Text += ScriptHelper.GetScript("var currentServerId = " + SelectedServerID + ";");

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        if (!isCallback)
        {
            // Check 'Manage object tasks' permission
            if (!CurrentUser.IsAuthorizedPerResource("cms.staging", "ManageObjectsTasks"))
            {
                RedirectToAccessDenied("cms.staging", "ManageObjectsTasks");
            }

            synchronizedSiteId = QueryHelper.GetInteger("siteid", 0);
            CurrentSiteID      = SiteContext.CurrentSiteID;

            ucDisabledModule.TestSettingKeys = "CMSStagingLogObjectChanges";
            ucDisabledModule.ParentPanel     = pnlNotLogged;

            if (synchronizedSiteId == -1)
            {
                ucDisabledModule.InfoText         = GetString("objectstaging.globalandsitenotlogged");
                ucDisabledModule.KeyScope         = DisabledModuleScope.CurrentSiteAndGlobal;
                ucDisabledModule.GlobalButtonText = GetString("objectstaging.enableglobalandsiteobjects");
            }
            else if (synchronizedSiteId == 0)
            {
                ucDisabledModule.InfoText         = GetString("objectstaging.globalnotlogged");
                ucDisabledModule.KeyScope         = DisabledModuleScope.Global;
                ucDisabledModule.GlobalButtonText = GetString("objectstaging.enableglobalobjects");
            }
            else
            {
                ucDisabledModule.InfoText       = GetString("ObjectStaging.SiteNotLogged");
                ucDisabledModule.KeyScope       = DisabledModuleScope.Site;
                ucDisabledModule.SiteButtonText = GetString("objectstaging.enablesiteobjects");
            }

            // Check logging
            if (!ucDisabledModule.Check())
            {
                CurrentMaster.PanelHeader.Visible = false;
                plcContent.Visible = false;
                return;
            }

            // Get object type
            objectType = QueryHelper.GetString("objecttype", string.Empty);

            // Create "synchronize current" header action for tree root, nodes or objects with database representation
            if (String.IsNullOrEmpty(objectType) || objectType.StartsWith("##", StringComparison.Ordinal) || (ModuleManager.GetReadOnlyObject(objectType) != null))
            {
                HeaderActions.AddAction(new HeaderAction
                {
                    Text      = GetString("ObjectTasks.SyncCurrent"),
                    EventName = SYNCHRONIZE_CURRENT
                });
            }

            // Add CSS class to panels wrapper in order it could be stacked
            CurrentMaster.PanelHeader.AddCssClass("header-container-multiple-panels");

            // Setup title
            ctlAsyncLog.TitleText = GetString("Synchronization.Title");

            // Get the selected types
            ObjectTypeTreeNode selectedNode = StagingTaskInfoProvider.ObjectTree.FindNode(objectType, (synchronizedSiteId > 0));
            objectType = (selectedNode != null) ? selectedNode.GetObjectTypes(true) : string.Empty;
            if (!ControlsHelper.CausedPostBack(HeaderActions, btnSyncSelected, btnSyncAll))
            {
                // Register the dialog script
                ScriptHelper.RegisterDialogScript(this);

                plcContent.Visible = true;

                // Initialize buttons
                btnDeleteAll.OnClientClick      = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";
                btnSyncSelected.OnClientClick   = "return !" + gridTasks.GetCheckSelectionScript();

                // Initialize grid
                gridTasks.ZeroRowsText    = GetString("Tasks.NoTasks");
                gridTasks.OnDataReload   += gridTasks_OnDataReload;
                gridTasks.ShowActionsMenu = true;
                gridTasks.Columns         = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";
                StagingTaskInfo ti = new StagingTaskInfo();
                gridTasks.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                pnlLog.Visible     = false;
                TaskTypeCategories = TaskHelper.TASK_TYPE_CATEGORY_GENERAL + ";" + TaskHelper.TASK_TYPE_CATEGORY_OBJECTS + ";" + TaskHelper.TASK_TYPE_CATEGORY_DATA;
            }
        }
    }
Ejemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        filter.SiteID = SiteID;
        filter.DisableGeneratingSiteClause = true;

        modifyPermission = AccountHelper.AuthorizedModifyAccount(SiteID, false);
        if (SiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
        {
            modifyGlobal = AccountHelper.AuthorizedModifyAccount(UniSelector.US_GLOBAL_RECORD, false);
            modifySite   = AccountHelper.AuthorizedModifyAccount(SiteContext.CurrentSiteID, false);
        }

        // Edit action URL
        string url = UIContextHelper.GetElementUrl(ModuleName.ONLINEMARKETING, "EditAccount", false);

        url = URLHelper.AddParameterToUrl(url, "objectid", "{0}");
        url = URLHelper.AddParameterToUrl(url, "siteid", SiteID.ToString());
        if (ContactHelper.IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "issitemanager", "1");
        }

        // Setup UniGrid
        gridElem.OnBeforeDataReload  += gridElem_OnBeforeDataReload;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, WhereCondition);
        gridElem.EditActionUrl        = url;
        gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
        gridElem.FilteredZeroRowsText = GetString("om.account.noaccountsfound.filtered");

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if ((modifyPermission || ContactGroupHelper.AuthorizedModifyContactGroup(SiteID, false)) && ContactGroupHelper.AuthorizedReadContactGroup(SiteID, false))
            {
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
            }
            if (modifyPermission)
            {
                drpAction.Items.Add(new ListItem(GetString("general.delete"), Convert.ToInt32(Action.Delete).ToString()));
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.Merge), Convert.ToInt32(Action.Merge).ToString()));
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
            }
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for UniGrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        if (Request.Params[Page.postEventArgumentID] == ACCOUNTS_MERGED)
        {
            ShowConfirmation(GetString("om.account.merginglist"));
        }

        // Register JS scripts
        RegisterScripts();
    }
Ejemplo n.º 17
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Check 'Manage object tasks' permission
        if (!CurrentUser.IsAuthorizedPerResource("cms.staging", "ManageAllTasks"))
        {
            RedirectToAccessDenied("cms.staging", "ManageAllTasks");
        }

        CurrentMaster.DisplaySiteSelectorPanel = true;

        // Check enabled servers
        var isCallback = RequestHelper.IsCallback();

        if (!isCallback && !ServerInfoProvider.IsEnabledServer(SiteContext.CurrentSiteID))
        {
            ShowInformation(GetString("ObjectStaging.NoEnabledServer"));
            CurrentMaster.PanelHeader.Visible = false;
            plcContent.Visible = false;
            pnlFooter.Visible  = false;
            return;
        }

        // Setup server dropdown
        selectorElem.DropDownList.AutoPostBack       = true;
        selectorElem.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;

        // Set server ID
        SelectedServerID = ValidationHelper.GetInteger(selectorElem.Value, 0);

        // All servers
        if (SelectedServerID == UniSelector.US_ALL_RECORDS)
        {
            SelectedServerID = 0;
        }

        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        if (!isCallback)
        {
            // Check 'Manage object tasks' permission
            if (!CurrentUser.IsAuthorizedPerResource("cms.staging", "ManageAllTasks"))
            {
                RedirectToAccessDenied("cms.staging", "ManageAllTasks");
            }

            ucDisabledModule.TestAnyKey      = true;
            ucDisabledModule.TestSettingKeys = "CMSStagingLogObjectChanges;CMSStagingLogDataChanges;CMSStagingLogChanges";
            ucDisabledModule.ParentPanel     = pnlNotLogged;
            ucDisabledModule.InfoText        = GetString("staging.disabledModule.allTasks");

            if (!ucDisabledModule.Check())
            {
                CurrentMaster.PanelHeader.Visible = false;
                plcContent.Visible = false;
                pnlFooter.Visible  = false;
                return;
            }

            // Register the dialog script
            ScriptHelper.RegisterDialogScript(this);

            // Setup title
            if (!ControlsHelper.CausedPostBack(btnSyncSelected, btnSyncAll))
            {
                plcContent.Visible = true;

                // Initialize buttons
                btnDeleteAll.OnClientClick      = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";
                btnSyncSelected.OnClientClick   = "return !" + gridTasks.GetCheckSelectionScript();

                // Initialize grid
                gridTasks.ZeroRowsText    = GetString("Tasks.NoTasks");
                gridTasks.OnDataReload   += gridTasks_OnDataReload;
                gridTasks.ShowActionsMenu = true;
                gridTasks.Columns         = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";

                StagingTaskInfo ti = new StagingTaskInfo();
                gridTasks.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                pnlLog.Visible = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (UIContext.EditedObject != null)
        {
            cgi = (ContactGroupInfo)UIContext.EditedObject;

            // Check permissions
            AuthorizationHelper.AuthorizedReadContact(true);
            mAuthorizedToModifyContactGroups = AuthorizationHelper.AuthorizedModifyContact(false);

            // Setup unigrid
            string where                  = "(ContactGroupMemberContactGroupID = " + cgi.ContactGroupID + ")";
            gridElem.WhereCondition       = where;
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.contact.nocontacts");
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

            if (!string.IsNullOrEmpty(cgi.ContactGroupDynamicCondition))
            {
                // Set specific confirmation to remove grid action
                var removeAction = (CMS.UIControls.UniGridConfig.Action)gridElem.GridActions.Actions[1];
                removeAction.Confirmation = "$om.contactgroupmember.confirmremove$";
            }

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));

                if (mAuthorizedToModifyContactGroups)
                {
                    drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                }

                if (AuthorizationHelper.AuthorizedModifyContact(false) && IsFullContactManagementAvailable())
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
                }

                if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.ONLINEMARKETING, "StartProcess") &&
                    IsFullContactManagementAvailable())
                {
                    drpAction.Items.Add(new ListItem(GetString("ma.automationprocess.select"), Convert.ToInt32(Action.StartNewProcess).ToString()));
                }
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            contactSelector.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
            contactSelector.UniSelector.SelectionMode    = SelectionModeEnum.MultipleButton;

            // Register JS scripts
            RegisterScripts();
        }
        else
        {
            StopProcessing = true;
        }
    }
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Check 'Manage servers' permission
        if (!CurrentUser.IsAuthorizedPerResource("cms.staging", "ManageDocumentsTasks"))
        {
            RedirectToAccessDenied("cms.staging", "ManageDocumentsTasks");
        }

        CurrentMaster.DisplaySiteSelectorPanel = true;

        // Check enabled servers
        var isCallback = RequestHelper.IsCallback();

        if (!isCallback && !ServerInfoProvider.IsEnabledServer(SiteContext.CurrentSiteID))
        {
            ShowInformation(GetString("ObjectStaging.NoEnabledServer"));
            CurrentMaster.PanelHeader.Visible = false;
            plcContent.Visible = false;
            pnlFooter.Visible  = false;
            return;
        }

        // Setup server dropdown
        selectorElem.DropDownList.AutoPostBack       = true;
        selectorElem.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;

        // Set server ID
        SelectedServerID = ValidationHelper.GetInteger(selectorElem.Value, QueryHelper.GetInteger("serverId", 0));

        // All servers
        if (SelectedServerID == UniSelector.US_ALL_RECORDS)
        {
            SelectedServerID   = 0;
            selectorElem.Value = UniSelector.US_ALL_RECORDS;
        }
        else
        {
            selectorElem.Value = SelectedServerID.ToString();
        }

        ltlScript.Text += ScriptHelper.GetScript("var currentServerId = " + SelectedServerID + ";");

        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        if (!isCallback)
        {
            int nodeId = QueryHelper.GetInteger("stagingnodeid", 0);

            aliasPath = "/";

            // Get the document node
            if (nodeId > 0)
            {
                TreeProvider tree = new TreeProvider(CurrentUser);
                TreeNode     node = tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES);
                if (node != null)
                {
                    aliasPath = node.NodeAliasPath;
                }
            }

            // Setup title
            ucDisabledModule.TestSettingKeys = "CMSStagingLogChanges";
            ucDisabledModule.InfoText        = GetString("ContentStaging.TaskSeparator");
            ucDisabledModule.ParentPanel     = pnlNotLogged;

            // Check logging
            if (!ucDisabledModule.Check())
            {
                CurrentMaster.PanelHeader.Visible = false;
                plcContent.Visible = false;
                pnlFooter.Visible  = false;
                return;
            }

            // Create header actions
            HeaderActions.AddAction(new HeaderAction
            {
                Text      = GetString("Tasks.SyncCurrent"),
                EventName = SYNCHRONIZE_CURRENT
            });

            HeaderActions.AddAction(new HeaderAction
            {
                Text        = GetString("Tasks.SyncSubtree"),
                EventName   = SYNCHRONIZE_SUBTREE,
                ButtonStyle = ButtonStyle.Default
            });

            // Create header action
            HeaderActions.AddAction(new HeaderAction
            {
                Text        = GetString("Tasks.CompleteSync"),
                EventName   = SYNCHRONIZE_COMPLETE,
                ButtonStyle = ButtonStyle.Default
            });

            // Add CSS class to panels wrapper in order it could be stacked
            CurrentMaster.PanelHeader.AddCssClass("header-container-multiple-panels");

            if (!ControlsHelper.CausedPostBack(HeaderActions, btnSyncSelected, btnSyncAll))
            {
                // Check 'Manage servers' permission
                if (!CurrentUser.IsAuthorizedPerResource("cms.staging", "ManageDocumentsTasks"))
                {
                    RedirectToAccessDenied("cms.staging", "ManageDocumentsTasks");
                }

                // Register the dialog script
                ScriptHelper.RegisterDialogScript(this);

                ltlScript.Text +=
                    ScriptHelper.GetScript("function ConfirmDeleteTask(taskId) { return confirm(" +
                                           ScriptHelper.GetString(GetString("Tasks.ConfirmDelete")) + "); }");
                ltlScript.Text +=
                    ScriptHelper.GetScript("function CompleteSync(){" +
                                           Page.ClientScript.GetPostBackEventReference(btnSyncComplete, "") + "}");

                // Initialize grid
                tasksUniGrid.OnDataReload   += tasksUniGrid_OnDataReload;
                tasksUniGrid.ShowActionsMenu = true;
                tasksUniGrid.Columns         = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";
                StagingTaskInfo ti = new StagingTaskInfo();
                tasksUniGrid.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                plcContent.Visible = true;

                // Initialize buttons
                btnSyncSelected.OnClientClick   = "return !" + tasksUniGrid.GetCheckSelectionScript();
                btnDeleteAll.OnClientClick      = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";

                pnlLog.Visible     = false;
                TaskTypeCategories = TaskHelper.TASK_TYPE_CATEGORY_CONTENT + ";" + TaskHelper.TASK_TYPE_CATEGORY_GENERAL;
            }
        }


        var script = @"var currentNodeId = 0,
selectDocuments = false;

function ChangeServer(value) {
    currentServerId = value;
}

function SelectNode(serverId, nodeId) {
    currentServerId = serverId;
    currentNodeId = nodeId;
    document.location = 'Tasks.aspx?serverId=' + currentServerId + '&stagingnodeid=' + nodeId;
}

function SelectDocNode(serverId, nodeId) {
    currentNodeId = nodeId;
    document.location = 'DocumentsList.aspx?serverId=' + currentServerId + '&stagingnodeid=' + nodeId;
}";

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), ClientID + "HandlingTasks", ScriptHelper.GetScript(script));
    }
Ejemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Initialize current user for the async actions
        currentUser = MembershipContext.AuthenticatedUser;

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        if (!RequestHelper.IsCallback())
        {
            // Check 'Manage object tasks' permission
            if (!currentUser.IsAuthorizedPerResource("cms.staging", "ManageObjectsTasks"))
            {
                RedirectToAccessDenied("cms.staging", "ManageObjectsTasks");
            }

            siteId          = QueryHelper.GetInteger("siteid", 0);
            currentSiteId   = SiteContext.CurrentSiteID;
            currentSiteName = SiteContext.CurrentSiteName;
            serverId        = QueryHelper.GetInteger("serverid", 0);

            ucDisabledModule.SettingsKeys = "CMSStagingLogObjectChanges";
            ucDisabledModule.InfoTexts.Add(GetString("StagingChanges.NotLogged") + "<br/>");
            ucDisabledModule.ParentPanel = pnlNotLogged;

            if (siteId == -1)
            {
                ucDisabledModule.InfoTexts.Add(GetString("objectstaging.globalandsitenotlogged"));
                ucDisabledModule.SiteObjects   = "CMSStagingLogObjectChanges";
                ucDisabledModule.GlobalObjects = "CMSStagingLogObjectChanges";
            }
            else if (siteId == 0)
            {
                ucDisabledModule.InfoTexts.Add(GetString("objectstaging.globalnotlogged"));
                ucDisabledModule.GlobalObjects = "CMSStagingLogObjectChanges";
            }
            else
            {
                ucDisabledModule.InfoTexts.Add(GetString("ObjectStaging.SiteNotLogged"));
                ucDisabledModule.SiteObjects = "CMSStagingLogObjectChanges";
            }

            // Check logging
            if (!ucDisabledModule.Check())
            {
                plcContent.Visible = false;
                return;
            }

            // Get object type
            objectType = QueryHelper.GetString("objecttype", string.Empty);

            // Create "synchronize current" header action only for objects with database representation
            if (ModuleManager.GetReadOnlyObject(objectType) != null)
            {
                HeaderActions.AddAction(new HeaderAction
                {
                    Text      = GetString("ObjectTasks.SyncCurrent"),
                    EventName = SYNCHRONIZE_CURRENT
                });
            }

            // Setup title
            titleElem.TitleText = GetString("Synchronization.Title");

            // Get the selected types
            ObjectTypeTreeNode selectedNode = StagingTaskInfoProvider.ObjectTree.FindNode(objectType, (siteId > 0));
            objectType = (selectedNode != null) ? selectedNode.GetObjectTypes(true) : string.Empty;
            if (!ControlsHelper.CausedPostBack(HeaderActions, btnSyncSelected, btnSyncAll))
            {
                // Register the dialog script
                ScriptHelper.RegisterDialogScript(this);

                plcContent.Visible = true;

                // Initialize buttons
                btnCancel.Attributes.Add("onclick", ctlAsync.GetCancelScript(true) + "return false;");
                btnCancel.Text                  = GetString("General.Cancel");
                btnDeleteAll.OnClientClick      = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";
                btnSyncSelected.OnClientClick   = "return !" + gridTasks.GetCheckSelectionScript();

                // Initialize grid
                gridTasks.ZeroRowsText         = GetString("Tasks.NoTasks");
                gridTasks.OnAction            += gridTasks_OnAction;
                gridTasks.OnDataReload        += gridTasks_OnDataReload;
                gridTasks.OnExternalDataBound += gridTasks_OnExternalDataBound;
                gridTasks.ShowActionsMenu      = true;
                gridTasks.Columns              = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";
                StagingTaskInfo ti = new StagingTaskInfo();
                gridTasks.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                pnlLog.Visible = false;
            }
        }

        ctlAsync.OnFinished   += ctlAsync_OnFinished;
        ctlAsync.OnError      += ctlAsync_OnError;
        ctlAsync.OnRequestLog += ctlAsync_OnRequestLog;
        ctlAsync.OnCancel     += ctlAsync_OnCancel;
    }
Ejemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Initialize current user for the async actions
        currentUser = MembershipContext.AuthenticatedUser;

        if (!RequestHelper.IsCallback())
        {
            // Check 'Manage object tasks' permission
            if (!currentUser.IsAuthorizedPerResource("cms.staging", "ManageAllTasks"))
            {
                RedirectToAccessDenied("cms.staging", "ManageAllTasks");
            }

            currentSiteId   = SiteContext.CurrentSiteID;
            currentSiteName = SiteContext.CurrentSiteName;

            ucDisabledModule.SettingsKeys = "CMSStagingLogObjectChanges;CMSStagingLogDataChanges;CMSStagingLogChanges";
            ucDisabledModule.InfoText     = GetString("AllTasks.TaskSeparator");
            ucDisabledModule.AtLeastOne   = true;
            ucDisabledModule.ShowButtons  = false;
            ucDisabledModule.SiteOrGlobal = true;
            ucDisabledModule.ParentPanel  = pnlNotLogged;

            if (!ucDisabledModule.Check())
            {
                pnlFooter.Visible  = false;
                plcContent.Visible = false;
                return;
            }

            // Register the dialog script
            ScriptHelper.RegisterDialogScript(this);
            serverId = QueryHelper.GetInteger("serverid", 0);

            // Setup title
            if (!ControlsHelper.CausedPostBack(btnSyncSelected, btnSyncAll))
            {
                plcContent.Visible = true;

                // Initialize buttons
                btnCancel.Attributes.Add("onclick", ctlAsync.GetCancelScript(true) + "return false;");
                btnCancel.Text                  = GetString("General.Cancel");
                btnDeleteAll.OnClientClick      = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";
                btnSyncSelected.OnClientClick   = "return !" + gridTasks.GetCheckSelectionScript();

                // Initialize grid
                gridTasks.ZeroRowsText         = GetString("Tasks.NoTasks");
                gridTasks.OnAction            += gridTasks_OnAction;
                gridTasks.OnDataReload        += gridTasks_OnDataReload;
                gridTasks.OnExternalDataBound += gridTasks_OnExternalDataBound;
                gridTasks.ShowActionsMenu      = true;
                gridTasks.Columns              = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";

                StagingTaskInfo ti = new StagingTaskInfo();
                gridTasks.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                pnlLog.Visible = false;
            }
        }

        ctlAsync.OnFinished   += ctlAsync_OnFinished;
        ctlAsync.OnError      += ctlAsync_OnError;
        ctlAsync.OnRequestLog += ctlAsync_OnRequestLog;
        ctlAsync.OnCancel     += ctlAsync_OnCancel;
    }
Ejemplo n.º 22
0
    /// <summary>
    /// Sets up controls.
    /// </summary>
    public void SetupControls()
    {
        if (StopProcessing)
        {
            // Do nothing
            ucSendMessage.StopProcessing = true;
            ucViewMessage.StopProcessing = true;
            inboxGrid.StopProcessing     = true;
        }
        else
        {
            bool isPostBack = RequestHelper.IsPostBack();

            if (!isPostBack)
            {
                inboxGrid.DelayedReload = false;
            }
            else
            {
                // Find postback invoker
                if (!ControlsHelper.CausedPostBack(inboxGrid, btnNewMessage, ucSendMessage.SendButton, ucSendMessage.CancelButton, btnReply, btnHidden, btnForward, btnDelete, btnOk, lnkBackHidden))
                {
                    inboxGrid.DelayedReload = false;
                }

                SetupLabels();
            }

            // Show content only for authenticated users
            if (AuthenticationHelper.IsAuthenticated())
            {
                // Initialize breadcrumbs
                InitializeBreadcrumbs();

                // Show control
                Visible = true;
                // Initialize unigrid
                inboxGrid.OnExternalDataBound   += inboxGrid_OnExternalDataBound;
                inboxGrid.GridView.RowDataBound += GridView_RowDataBound;
                inboxGrid.OnAction += inboxGrid_OnAction;
                // Set where condition clause
                inboxGrid.WhereCondition      = "MessageRecipientUserID=" + MembershipContext.AuthenticatedUser.UserID + " AND (MessageRecipientDeleted=0 OR MessageRecipientDeleted IS NULL)";
                inboxGrid.OnBeforeDataReload += inboxGrid_OnBeforeDataReload;
                inboxGrid.OnBeforeSorting    += inboxGrid_OnBeforeSorting;
                inboxGrid.OnShowButtonClick  += inboxGrid_OnShowButtonClick;
                inboxGrid.OnPageSizeChanged  += inboxGrid_OnPageSizeChanged;
                inboxGrid.IsLiveSite          = IsLiveSite;

                // Setup inner controls
                ucSendMessage.IsLiveSite  = IsLiveSite;
                ucViewMessage.IsLiveSite  = IsLiveSite;
                ucViewMessage.MessageMode = MessageModeEnum.Inbox;
                ucViewMessage.Message     = Message;

                // Create and assign javascript confirmation
                btnDelete.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Messsaging.DeletionConfirmation")) + ");";

                // Register events
                ucSendMessage.SendButtonClick += ucSendMessage_SendButtonClick;
                btnNewMessage.Click           += btnNewMessage_Click;
                btnReply.Click      += btnReply_Click;
                btnForward.Click    += btnForward_Click;
                btnDelete.Click     += btnDelete_Click;
                lnkBackHidden.Click += lnkBackHidden_Click;
                btnHidden.Click     += btnHidden_Click;

                StringBuilder actionScript = new StringBuilder();
                actionScript.Append(
                    @"
function PerformAction_", ClientID, @"(selectionFunction, actionId, actionLabel, whatId) {
    var confirmation = null;
    var label = document.getElementById(actionLabel);
    var action = document.getElementById(actionId).value;
    var whatDrp = document.getElementById(whatId);
    if (action == '", (int)Action.SelectAction, @"') {
        label.innerHTML = ", ScriptHelper.GetString(GetString("MassAction.SelectSomeAction")), @"
    }
    else if (eval(selectionFunction) && (whatDrp.value == '", (int)What.SelectedMessages, @"')) {
        label.innerHTML = ", ScriptHelper.GetString(GetString("Messaging.SelectMessages")), @";
    }
    else {
        switch(action) {
            case '", (int)Action.MarkAsRead, @"':
                confirmation = ", ScriptHelper.GetString(GetString("Messaging.ConfirmMarkAsRead")), @";
                break;
            case '", (int)Action.MarkAsUnread, @"':
                confirmation = ", ScriptHelper.GetString(GetString("Messaging.ConfirmMarkAsUnread")), @";
                break;
            case '", (int)Action.Delete, @"':
                confirmation = ", ScriptHelper.GetString(GetString("Messaging.ConfirmDelete")), @";
                break;
            default:
                confirmation = null;
                break;
        }
        if (confirmation != null) {
            return confirm(confirmation)
        }
    }
    return false;
}
");

                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "actionScript", ScriptHelper.GetScript(actionScript.ToString()));

                string messageActionScript =
                    @"
function ContextMessageAction_" + inboxGrid.ClientID + @"(action, messageId) {
    document.getElementById('" + hdnValue.ClientID + @"').value = action + ';' + messageId;" +
                    ControlsHelper.GetPostBackEventReference(btnHidden) + @";
}";
                ScriptHelper.RegisterStartupScript(this, typeof(string), "messageAction_" + ClientID + new Random(DateTime.Now.Millisecond).Next(), ScriptHelper.GetScript(messageActionScript));

                // Add action to button
                btnOk.OnClientClick = "return PerformAction_" + ClientID + "('" + inboxGrid.GetCheckSelectionScript() + "','" + drpAction.ClientID + "','" + lblActionInfo.ClientID + "','" + drpWhat.ClientID + "');";
                btnOk.Click        += btnOk_Click;

                if (!isPostBack)
                {
                    // Initialize dropdown lists
                    drpWhat.Items.Add(new ListItem(GetString("Messaging." + What.SelectedMessages), Convert.ToInt32(What.SelectedMessages).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("Messaging." + What.AllMessages), Convert.ToInt32(What.AllMessages).ToString()));

                    drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("Messaging.Action." + Action.MarkAsRead), Convert.ToInt32(Action.MarkAsRead).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("Messaging.Action." + Action.MarkAsUnread), Convert.ToInt32(Action.MarkAsUnread).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("Messaging.Action." + Action.Delete), Convert.ToInt32(Action.Delete).ToString()));
                }

                if (inboxGrid.PagerConfig == null)
                {
                    inboxGrid.PagerConfig = new UniGridPagerConfig();
                }
                inboxGrid.PagerConfig.DefaultPageSize = PageSize;
            }
            else
            {
                Visible = false;
            }
        }
    }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (UIContext.EditedObject != null)
        {
            cgi = (ContactGroupInfo)UIContext.EditedObject;
            contactGroupSiteID = cgi.ContactGroupSiteID;

            // Check permissions
            readSiteContacts = ContactHelper.AuthorizedReadContact(SiteContext.CurrentSiteID, false);
            modifySiteCG     = ContactGroupHelper.AuthorizedModifyContactGroup(SiteContext.CurrentSiteID, false);
            if (contactGroupSiteID <= 0)
            {
                readGlobalContacts = ContactHelper.AuthorizedReadContact(UniSelector.US_GLOBAL_RECORD, false);
                modifyGlobalCG     = ContactGroupHelper.AuthorizedModifyContactGroup(UniSelector.US_GLOBAL_RECORD, false);
            }

            // Setup unigrid
            gridElem.WhereCondition       = GetWhereCondition();
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.contact.nocontacts");
            gridElem.OnBeforeDataReload  += gridElem_OnBeforeDataReload;
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

            modifyCombined = ((contactGroupSiteID > 0) && modifySiteCG) || ((contactGroupSiteID <= 0) && modifyGlobalCG);

            if (!string.IsNullOrEmpty(cgi.ContactGroupDynamicCondition))
            {
                // Set specific confirmation to remove grid action
                var removeAction = (CMS.UIControls.UniGridConfig.Action)gridElem.GridActions.Actions[1];
                removeAction.Confirmation = "$om.contactgroupmember.confirmremove$";
            }

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));

                // Display mass actions
                if (modifyCombined)
                {
                    drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                }

                if (ContactHelper.AuthorizedModifyContact(contactGroupSiteID, false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
                }

                if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.ONLINEMARKETING, "StartProcess"))
                {
                    drpAction.Items.Add(new ListItem(GetString("ma.automationprocess.select"), Convert.ToInt32(Action.StartNewProcess).ToString()));
                }
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            contactSelector.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
            contactSelector.UniSelector.SelectionMode    = SelectionModeEnum.MultipleButton;

            // Register JS scripts
            RegisterScripts();
        }
        else
        {
            StopProcessing = true;
        }
    }
Ejemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        rightHeaderActions.ActionPerformed += RightHeaderActions_ActionPerformed;

        // Show info that scheduler is disabled
        if (!SchedulingHelper.EnableScheduler)
        {
            ShowWarning(GetString("scheduledtask.disabled"));
        }

        listElem.SiteID = SiteID;
        string editUrl = UIContextHelper.GetElementUrl("CMS.ScheduledTasks", GetElementName("EditTask"), true);

        editUrl          = URLHelper.AddParameterToUrl(editUrl, "siteid", SiteID.ToString());
        listElem.EditURL = editUrl;

        // New task action
        HeaderActions.AddAction(new HeaderAction
        {
            Text        = GetString("Task_List.NewItemCaption"),
            RedirectUrl = String.Format(listElem.EditURL, 0)
        });

        // Refresh action
        HeaderActions.AddAction(new HeaderAction
        {
            Text          = GetString("General.Refresh"),
            OnClientClick = "RefreshGrid();"
        });

        if (SiteInfo != null)
        {
            bool usesTimer = SchedulingHelper.UseAutomaticScheduler || !SchedulingHelper.RunSchedulerWithinRequest;
            if (usesTimer)
            {
                // Restart timer action
                rightHeaderActions.AddAction(new HeaderAction
                {
                    Text      = GetString("Task_List.Restart"),
                    EventName = TASKS_RESTART_TIMER
                });
            }

            // Run execution ASAP action
            rightHeaderActions.AddAction(new HeaderAction
            {
                Text      = GetString("Task_List.RunNow"),
                EventName = TASKS_RUN,
                Enabled   = SchedulingHelper.EnableScheduler && (!usesTimer || SchedulingTimer.TimerExists(SiteInfo.SiteName))
            });
        }

        // Reset action to the right
        rightHeaderActions.AddAction(new HeaderAction
        {
            Text          = GetString("tasks.resetexecutions"),
            OnClientClick = "if (!confirm(" + ScriptHelper.GetLocalizedString("tasks.resetall") + ")) return false;",
            EventName     = TASKS_RESET
        });

        // Force action buttons to cause full postback so that tasks can be properly executed in global.asax
        ControlsHelper.RegisterPostbackControl(listElem);
        ControlsHelper.RegisterPostbackControl(rightHeaderActions);

        if (ControlsHelper.CausedPostBack(btnRefresh))
        {
            // Update content after refresh
            pnlUpdate.Update();
        }
        else if (QueryHelper.GetBoolean("reseted", false))
        {
            // Show reset confirmation after reset button action
            ShowConfirmation(GetString("task.executions.reseted"));
        }
    }
Ejemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script for pendingCallbacks repair
        ScriptHelper.FixPendingCallbacks(Page);

        // Get site info
        currentSiteId   = SiteContext.CurrentSiteID;
        currentSiteName = SiteContext.CurrentSiteName;

        // Initialize current user for the async actions
        currentUser = MembershipContext.AuthenticatedUser;
        serverId    = QueryHelper.GetInteger("serverid", 0);

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

        if (ControlsHelper.CausedPostBack(btnSyncComplete))
        {
            SyncComplete();
        }
        else
        {
            if (!RequestHelper.IsCallback())
            {
                int nodeId = QueryHelper.GetInteger("nodeid", 0);

                aliasPath = "/";

                // Get the document node
                if (nodeId > 0)
                {
                    TreeProvider tree = new TreeProvider(currentUser);
                    TreeNode     node = tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES);
                    if (node != null)
                    {
                        aliasPath = node.NodeAliasPath;
                    }
                }

                // Setup title
                titleElem.TitleText           = GetString("Synchronization.Title");
                ucDisabledModule.SettingsKeys = "CMSStagingLogChanges";
                ucDisabledModule.InfoTexts.Add(GetString("ContentStaging.TaskSeparator") + "<br/>");
                ucDisabledModule.InfoTexts.Add(GetString("StagingChanges.NotLogged"));
                ucDisabledModule.ParentPanel = pnlNotLogged;

                // Check logging
                if (!ucDisabledModule.Check())
                {
                    plcContent.Visible = false;
                    pnlFooter.Visible  = false;
                    return;
                }

                // Create header actions
                HeaderActions.AddAction(new HeaderAction()
                {
                    Text      = GetString("Tasks.SyncCurrent"),
                    EventName = SYNCHRONIZE_CURRENT
                });

                HeaderActions.AddAction(new HeaderAction()
                {
                    Text      = GetString("Tasks.SyncSubtree"),
                    EventName = SYNCHRONIZE_SUBTREE
                });

                if (!ControlsHelper.CausedPostBack(HeaderActions, btnSyncSelected, btnSyncAll))
                {
                    // Check 'Manage servers' permission
                    if (!currentUser.IsAuthorizedPerResource("cms.staging", "ManageDocumentsTasks"))
                    {
                        RedirectToAccessDenied("cms.staging", "ManageDocumentsTasks");
                    }

                    // Register the dialog script
                    ScriptHelper.RegisterDialogScript(this);

                    ltlScript.Text +=
                        ScriptHelper.GetScript("function ConfirmDeleteTask(taskId) { return confirm(" +
                                               ScriptHelper.GetString(GetString("Tasks.ConfirmDelete")) + "); }");
                    ltlScript.Text +=
                        ScriptHelper.GetScript("function CompleteSync(){" +
                                               Page.ClientScript.GetPostBackEventReference(btnSyncComplete, null) + "}");

                    // Initialize grid
                    tasksUniGrid.OnExternalDataBound += tasksUniGrid_OnExternalDataBound;
                    tasksUniGrid.OnAction            += tasksUniGrid_OnAction;
                    tasksUniGrid.OnDataReload        += tasksUniGrid_OnDataReload;
                    tasksUniGrid.ShowActionsMenu      = true;
                    tasksUniGrid.Columns              = "TaskID, TaskSiteID, TaskDocumentID, TaskNodeAliasPath, TaskTitle, TaskTime, TaskType, TaskObjectType, TaskObjectID, TaskRunning, (SELECT COUNT(*) FROM Staging_Synchronization WHERE SynchronizationTaskID = TaskID AND SynchronizationErrorMessage IS NOT NULL AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AS FailedCount";
                    StagingTaskInfo ti = new StagingTaskInfo();
                    tasksUniGrid.AllColumns = SqlHelper.MergeColumns(ti.ColumnNames);

                    plcContent.Visible = true;

                    // Initialize buttons
                    btnCancel.Attributes.Add("onclick", ctlAsync.GetCancelScript(true) + "return false;");
                    btnCancel.Text                  = GetString("General.Cancel");
                    btnDeleteAll.Text               = GetString("Tasks.DeleteAll");
                    btnDeleteSelected.Text          = GetString("Tasks.DeleteSelected");
                    btnSyncAll.Text                 = GetString("Tasks.SyncAll");
                    btnSyncSelected.Text            = GetString("Tasks.SyncSelected");
                    btnSyncSelected.OnClientClick   = "return !" + tasksUniGrid.GetCheckSelectionScript();
                    btnDeleteAll.OnClientClick      = "return confirm(" + ScriptHelper.GetString(GetString("Tasks.ConfirmDeleteAll")) + ");";
                    btnDeleteSelected.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("general.confirmdelete")) + ");";

                    pnlLog.Visible = false;
                }
            }
        }

        ctlAsync.OnFinished   += ctlAsync_OnFinished;
        ctlAsync.OnError      += ctlAsync_OnError;
        ctlAsync.OnRequestLog += ctlAsync_OnRequestLog;
        ctlAsync.OnCancel     += ctlAsync_OnCancel;
    }