Exemplo n.º 1
0
    /// <summary>
    /// Initializes header action control.
    /// </summary>
    private void InitHeaderActions()
    {
        // Find out if current account is merged into another site or global account
        if (ai != null)
        {
            mergedIntoSite    = (ai.AccountMergedWithAccountID != 0);
            mergedIntoGlobal  = (ai.AccountGlobalAccountID != 0);
            mergedIntoGlobal &= AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);

            if (!ContactHelper.IsSiteManager)
            {
                mergedIntoGlobal &= SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSCMGlobalAccounts");
            }
        }

        HeaderActions.AddAction(new SaveAction(Page));

        if (mergedIntoSite || mergedIntoGlobal)
        {
            HeaderActions.AddAction(new HeaderAction
            {
                ControlType = HeaderActionTypeEnum.Hyperlink,
                Text        = GetString("om.contact.splitfromparent"),
                ImageUrl    = GetImageUrl("CMSModules/CMS_ContactManagement/split.png"),
                CommandName = "split"
            });
        }

        HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        chkContacts.Enabled = (CurrentAccount.AccountPrimaryContactID != 0) || (CurrentAccount.AccountSecondaryContactID != 0);
        chkAddress.Enabled  = !String.IsNullOrEmpty(CurrentAccount.AccountAddress1) || !String.IsNullOrEmpty(CurrentAccount.AccountAddress2) || !String.IsNullOrEmpty(CurrentAccount.AccountCity) || !String.IsNullOrEmpty(CurrentAccount.AccountZIP);
        chkEmail.Enabled    = !String.IsNullOrEmpty(CurrentAccount.AccountEmail);
        chkURL.Enabled      = !String.IsNullOrEmpty(CurrentAccount.AccountWebSite);
        chkPhone.Enabled    = !String.IsNullOrEmpty(CurrentAccount.AccountPhone) || !String.IsNullOrEmpty(CurrentAccount.AccountFax);

        // Current account is global object
        if (ai.AccountSiteID == 0)
        {
            plcSite.Visible    = true;
            plcContact.Visible = false;
            // Display site selector in site manager
            if (ContactHelper.IsSiteManager)
            {
                siteOrGlobalSelector.Visible = false;
            }
            // Display 'site or global' selector in CMS desk for global objects
            else if (AccountHelper.AuthorizedReadAccount(SiteContext.CurrentSiteID, false) && AccountHelper.AuthorizedModifyAccount(SiteContext.CurrentSiteID, false))
            {
                siteSelector.Visible = false;
            }
            else
            {
                plcSite.Visible = false;
            }
        }
    }
Exemplo n.º 3
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;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Ensure, that it is going to be rendered
        pnlRole.Visible = true;

        ScriptHelper.RegisterWOpenerScript(Page);
        ScriptHelper.RegisterJQuery(Page);

        // Try to get parameters
        string    identifier = QueryHelper.GetString("params", null);
        Hashtable parameters = (Hashtable)WindowHelper.GetItem(identifier);

        // Validate hash
        if ((QueryHelper.ValidateHash("hash", "selectedvalue")) && (parameters != null))
        {
            int siteid = ValidationHelper.GetInteger(parameters["SiteID"], -1);
            if (siteid != -1)
            {
                AccountHelper.AuthorizedReadAccount(siteid, true);
                if (AccountHelper.AuthorizedModifyAccount(siteid, false) || ContactHelper.AuthorizedModifyContact(siteid, false))
                {
                    contactRoleSelector.SiteID     = siteid;
                    contactRoleSelector.IsLiveSite = ValidationHelper.GetBoolean(parameters["IsLiveSite"], false);
                    contactRoleSelector.UniSelector.DialogWindowName = "SelectContactRole";
                    contactRoleSelector.IsSiteManager = ValidationHelper.GetBoolean(parameters["IsSiteManager"], false);

                    selectionDialog.LocalizeItems = QueryHelper.GetBoolean("localize", true);

                    // Load resource prefix
                    string resourcePrefix = ValidationHelper.GetString(parameters["ResourcePrefix"], "general");

                    // Set the page title
                    string titleText = GetString(resourcePrefix + ".selectitem|general.selectitem");

                    lblAddAccounts.ResourceString = resourcePrefix + ".contactsrole";
                    pnlRoleHeading.Visible        = true;

                    PageTitle.TitleText = titleText;
                    Page.Title          = titleText;
                }
                // No permission modify
                else
                {
                    RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ModifyAccount");
                }
            }
            else
            {
                // Redirect to error page
                URLHelper.Redirect(ResolveUrl("~/CMSMessages/Error.aspx?title=" + ResHelper.GetString("dialogs.badhashtitle") + "&text=" + ResHelper.GetString("dialogs.badhashtext")));
            }
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.PanelContent.CssClass = "";

        int siteID = AccountHelper.ObjectSiteID(EditedObject);

        // Check read permission
        if (!AccountHelper.AuthorizedReadAccount(siteID, false) && !ContactHelper.AuthorizedReadContact(siteID, false))
        {
            RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ReadAccounts");
        }
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.PanelContent.CssClass = String.Empty;

        int siteID = ContactHelper.ObjectSiteID(EditedObject);

        // Check read permission
        if (!AccountHelper.AuthorizedReadAccount(siteID, false) && !ContactHelper.AuthorizedReadContact(siteID, false))
        {
            RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ReadContacts");
        }
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check UI elements
        CheckUIElementAccessHierarchical(ModuleName.ONLINEMARKETING, "account.contacts");

        CurrentMaster.PanelContent.CssClass = "";

        int siteID = AccountHelper.ObjectSiteID(EditedObject);

        // Check read permission
        if (!AccountHelper.AuthorizedReadAccount(siteID, false) && !ContactHelper.AuthorizedReadContact(siteID, false))
        {
            RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ReadAccounts");
        }
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!QueryHelper.ValidateHash("hash") || Parameters == null)
        {
            StopProcessing = true;
            return;
        }

        siteId = ValidationHelper.GetInteger(Parameters["siteid"], 0);
        where  = ValidationHelper.GetString(Parameters["where"], null);

        // Check read permission
        if (AccountHelper.AuthorizedReadAccount(siteId, true))
        {
            if (siteId == UniSelector.US_GLOBAL_RECORD)
            {
                CurrentMaster.Title.TitleText = GetString("om.account.selectglobal");
            }
            else
            {
                CurrentMaster.Title.TitleText = GetString("om.account.selectsite");
            }

            CurrentMaster.Title.TitleImage = GetImageUrl("Objects/OM_Account/object.png");
            Page.Title = CurrentMaster.Title.TitleText;

            imgNew.ImageUrl        = GetImageUrl("Objects/OM_Account/add.png");
            btnNew.Click          += new EventHandler(btn_Click);
            btnNew.CommandArgument = null;

            if (siteId > 0)
            {
                gridElem.WhereCondition = "(AccountMergedWithAccountID IS NULL AND AccountSiteID = " + siteId + ")";
            }
            else
            {
                gridElem.WhereCondition = "(AccountGlobalAccountID IS NULL AND AccountSiteID IS NULL)";
            }
            gridElem.WhereCondition       = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, "AccountID NOT IN (SELECT AccountID FROM OM_Account WHERE " + where + ")");
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.ShowActionsMenu      = false;
            if (!RequestHelper.IsPostBack())
            {
                gridElem.Pager.DefaultPageSize = 10;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!QueryHelper.ValidateHash("hash") || Parameters == null)
        {
            StopProcessing = true;
            return;
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");

        siteId = ValidationHelper.GetInteger(Parameters["siteid"], 0);
        where  = ValidationHelper.GetString(Parameters["where"], null);

        // Check read permission
        if (AccountHelper.AuthorizedReadAccount(siteId, true))
        {
            if (siteId == UniSelector.US_GLOBAL_RECORD)
            {
                PageTitle.TitleText = GetString("om.account.selectglobal");
            }
            else
            {
                PageTitle.TitleText = GetString("om.account.selectsite");
            }
            Page.Title = PageTitle.TitleText;

            // Load header actions
            InitHeaderActions();

            if (siteId > 0)
            {
                gridElem.WhereCondition = "(AccountMergedWithAccountID IS NULL AND AccountSiteID = " + siteId + ")";
            }
            else
            {
                gridElem.WhereCondition = "(AccountGlobalAccountID IS NULL AND AccountSiteID IS NULL)";
            }
            gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, "AccountID NOT IN (SELECT AccountID FROM OM_Account WHERE " + where + ")");
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.ShowActionsMenu      = false;
            if (!RequestHelper.IsPostBack())
            {
                gridElem.Pager.DefaultPageSize = 10;
            }
        }
    }
Exemplo n.º 10
0
    /// <summary>
    /// Initializes header action control.
    /// </summary>
    private void InitHeaderActions()
    {
        // Find out if current account is merged into another site or global account
        if (ai != null)
        {
            mergedIntoSite    = ai.AccountMergedWithAccountID != 0;
            mergedIntoGlobal  = ai.AccountGlobalAccountID != 0;
            mergedIntoGlobal &= AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);

            if (!ContactHelper.IsSiteManager)
            {
                mergedIntoGlobal &= SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSCMGlobalAccounts");
            }
        }

        // Header actions
        string[,] actions;
        if (mergedIntoSite || mergedIntoGlobal)
        {
            actions = new string[2, 11];
        }
        else
        {
            actions = new string[1, 11];
        }
        actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON;
        actions[0, 1] = GetString("General.Save");
        actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png");
        actions[0, 6] = "save";
        actions[0, 8] = "true";

        if (mergedIntoSite || mergedIntoGlobal)
        {
            actions[1, 0] = HeaderActions.TYPE_SAVEBUTTON;
            actions[1, 1] = GetString("om.contact.splitfromparent");
            actions[1, 5] = GetImageUrl("CMSModules/CMS_ContactManagement/split.png");
            actions[1, 6] = "split";
            actions[1, 8] = "false";
        }
        ((CMSPage)Page).CurrentMaster.HeaderActions.LinkCssClass     = "ContentSaveLinkButton";
        ((CMSPage)Page).CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        ((CMSPage)Page).CurrentMaster.HeaderActions.Actions          = actions;
    }
Exemplo n.º 11
0
    private void OnTabCreated(object sender, TabCreatedEventArgs e)
    {
        if (e.Tab == null)
        {
            return;
        }

        switch (e.Tab.TabName.ToLowerCSafe())
        {
        case "contactcustomfields":
            // Check if contact has any custom fields
            var formInfo = FormHelper.GetFormInfo("OM.Contact", false);
            if (!formInfo.GetFields(true, false, false).Any())
            {
                e.Tab = null;
            }
            break;

        case "contactaccounts":
            if (!AccountHelper.AuthorizedReadAccount(Contact.ContactSiteID, false) && !ContactHelper.AuthorizedReadContact(Contact.ContactSiteID, false))
            {
                e.Tab = null;
            }
            break;

        case "ips":
            if (!ActivitySettingsHelper.IPLoggingEnabled(SiteContext.CurrentSiteName))
            {
                e.Tab = null;
            }
            break;

        case "contactprocesses":
            // Marketing automation
            if (!WorkflowInfoProvider.IsMarketingAutomationAllowed())
            {
                e.Tab = null;
            }
            break;
        }
    }
Exemplo n.º 12
0
    /// <summary>
    /// Sets visibility of buttons that are connected to merged account - split button and link to his parent.
    /// </summary>
    private void SetButtonsVisibility()
    {
        // Find out if current account is merged into another site or account contact
        bool mergedIntoSite   = ValidationHelper.GetInteger(EditForm.Data["AccountMergedWithAccountID"], 0) != 0;
        bool mergedIntoGlobal = ValidationHelper.GetInteger(EditForm.Data["AccountGlobalAccountID"], 0) != 0 &&
                                AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);
        bool globalAccountsVisible = SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSCMGlobalAccounts") || CurrentUser.IsGlobalAdministrator;

        if ((mergedIntoGlobal && globalAccountsVisible) || mergedIntoSite)
        {
            // Get parent account
            if (mergedIntoSite)
            {
                parentAccount = AccountInfoProvider.GetAccountInfo(ValidationHelper.GetInteger(EditForm.Data["AccountMergedWithAccountID"], 0));
                headingMergedInto.ResourceString = "om.account.mergedintosite";
            }
            else
            {
                parentAccount = AccountInfoProvider.GetAccountInfo(ValidationHelper.GetInteger(EditForm.Data["AccountGlobalAccountID"], 0));
                headingMergedInto.ResourceString = "om.account.mergedintoglobal";
            }

            lblMergedIntoAccountName.Text = HTMLHelper.HTMLEncode(parentAccount.AccountName.Trim());

            string accountDetailDialogURL = UIContextHelper.GetElementDialogUrl(ModuleName.ONLINEMARKETING, "EditAccount", parentAccount.AccountID, "isSiteManager=" + ContactHelper.IsSiteManager);
            string openDialogScript       = ScriptHelper.GetModalDialogScript(accountDetailDialogURL, "AccountDetail");

            btnMergedAccount.IconCssClass  = "icon-edit";
            btnMergedAccount.OnClientClick = openDialogScript;
            btnMergedAccount.ToolTip       = GetString("om.account.viewdetail");
        }
        else
        {
            panelMergedAccountDetails.Visible = btnSplit.Visible = false;
        }
    }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool isGlobal = Account.AccountSiteID == 0;

        // Current contact is global object
        if (isGlobal)
        {
            filter.SiteID = SiteContext.CurrentSiteID;
            // Display site selector in site manager
            if (ContactHelper.IsSiteManager)
            {
                filter.SiteID = UniSelector.US_GLOBAL_RECORD;
                filter.DisplaySiteSelector = true;
            }
            // Display 'site or global' selector in CMS desk for global objects
            else if (AccountHelper.AuthorizedModifyAccount(SiteContext.CurrentSiteID, false) && AccountHelper.AuthorizedReadAccount(SiteContext.CurrentSiteID, false))
            {
                filter.DisplayGlobalOrSiteSelector = true;
            }
        }
        else
        {
            filter.SiteID = Account.AccountSiteID;
        }
        filter.ShowGlobalStatuses =
            ConfigurationHelper.AuthorizedReadConfiguration(UniSelector.US_GLOBAL_RECORD, false) &&
            (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSCMGlobalConfiguration") || ContactHelper.IsSiteManager);

        filter.ShowChildren = ShowChildrenOption;

        string where = filter.WhereCondition;

        if (!filter.ChildrenSelected)
        {
            // Display only direct children ("first level")
            where = SqlHelper.AddWhereCondition(where, "AccountGlobalAccountID = " + Account.AccountID + " OR AccountMergedWithAccountID = " + Account.AccountID);
        }

        // Get children for account
        where = SqlHelper.AddWhereCondition(where, "AccountID IN (SELECT * FROM Func_OM_Account_GetChildren(" + Account.AccountID + ", 0))");

        gridElem.WhereCondition       = where;
        gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        btnSplit.Click += btnSplit_Click;

        // Register JS scripts
        RegisterScripts();
    }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");

        // Set title
        PageTitle.TitleText = GetString("om.contact.collision");
        // Validate hash
        Regex re = RegexHelper.GetRegex(@"[\w\d_$$]*");

        mIdentifier = QueryHelper.GetString("params", "");
        if (!QueryHelper.ValidateHash("hash") || !re.IsMatch(mIdentifier))
        {
            pnlContent.Visible = false;
            return;
        }

        // Load dialog parameters
        Hashtable parameters = (Hashtable)WindowHelper.GetItem(mIdentifier);

        if (parameters != null)
        {
            mMergedAccounts = (DataSet)parameters["MergedAccounts"];
            mParentAccount  = (AccountInfo)parameters["ParentAccount"];

            if (!mParentAccount.CheckPermissions(PermissionsEnum.Read, CurrentSiteName, CurrentUser))
            {
                RedirectToAccessDenied(mParentAccount.TypeInfo.ModuleName, "Read");
            }

            mIsSitemanager = ValidationHelper.GetBoolean(parameters["issitemanager"], false);

            if (mIsSitemanager)
            {
                mStamp = SettingsKeyInfoProvider.GetStringValue("CMSCMStamp");
            }
            else
            {
                mStamp = SettingsKeyInfoProvider.GetStringValue(SiteContext.CurrentSiteName + ".CMSCMStamp");
            }

            mStamp = MacroResolver.Resolve(mStamp);

            if (mParentAccount != null)
            {
                // Check permissions
                AccountHelper.AuthorizedReadAccount(mParentAccount.AccountSiteID, true);

                // Load data
                if (!RequestHelper.IsPostBack())
                {
                    Initialize();
                }
                LoadContactCollisions();
                LoadContactGroups();
                LoadCustomFields();

                // Init controls
                btnMerge.Click        += new EventHandler(btnMerge_Click);
                btnStamp.OnClientClick = "AddStamp('" + htmlNotes.CurrentEditor.ClientID + "'); return false;";
                ScriptHelper.RegisterTooltip(Page);
                RegisterScripts();
                accountStatusSelector.SiteID   = mParentAccount.AccountSiteID;
                accountSelector.SiteID         = mParentAccount.AccountSiteID;
                accountSelector.WhereCondition = "((AccountMergedWithAccountID IS NULL) AND (AccountSiteID > 0)) OR ((AccountGlobalAccountID IS NULL) AND (AccountSiteID IS NULL))";
                accountSelector.WhereCondition = GetSubsidiaryWhere(accountSelector.WhereCondition);

                // Set tabs
                tabFields.HeaderText        = GetString("om.contact.fields");
                tabContacts.HeaderText      = GetString("om.contact.list");
                tabContactGroups.HeaderText = GetString("om.contactgroup.list");
                tabCustomFields.HeaderText  = GetString("general.customfields");
            }
        }

        // User relative messages placeholder so that JQueryTab isn't moved a bit
        MessagesPlaceHolder.UseRelativePlaceHolder = false;

        // Do not let the editor overflow dialog window
        htmlNotes.SetValue("width", "520");
    }
Exemplo n.º 15
0
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        string where = null;
        bool authorizedSiteAccounts   = false;
        bool authorizedGlobalAccounts = AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);

        currentUser = CMSContext.CurrentUser;

        if (SiteID > 0)
        {
            authorizedSiteAccounts = AccountHelper.AuthorizedReadAccount(SiteID, false);
        }
        else
        {
            authorizedSiteAccounts = AccountHelper.AuthorizedReadAccount(CMSContext.CurrentSiteID, false);
        }

        // Filter site objects
        if (this.SiteID > 0)
        {
            if (authorizedSiteAccounts)
            {
                where = "(AccountSiteID = " + this.SiteID + " AND AccountMergedWithAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Filter only global objects
        else if ((this.SiteID == UniSelector.US_GLOBAL_RECORD) || (this.SiteID == 0))
        {
            if (authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display current site and global contacts
        else if (this.SiteID == UniSelector.US_GLOBAL_OR_SITE_RECORD)
        {
            if (authorizedSiteAccounts && authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL) OR (AccountSiteID = " + CMSContext.CurrentSiteID + " AND AccountMergedWithAccountID IS NULL)";
                uniSelector.AddGlobalObjectSuffix = true;
            }
            else if (authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountMergedWithAccountID IS NULL)";
            }
            else if (authorizedSiteAccounts)
            {
                where = "(AccountSiteID = " + CMSContext.CurrentSiteID + " AND AccountMergedWithAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display all objects
        else if ((this.SiteID == UniSelector.US_ALL_RECORDS) && currentUser.UserSiteManagerAdmin)
        {
            where = "((AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL) OR (AccountSiteID > 0 AND AccountMergedWithAccountID IS NULL))";
            uniSelector.AddGlobalObjectSuffix = true;
        }
        // Not enough permissions
        else
        {
            where = "(1=0)";
        }

        uniSelector.WhereCondition = SqlHelperClass.AddWhereCondition(this.WhereCondition, where);
        uniSelector.Reload(true);
    }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Ensure, that it is going to be rendered
        pnlRole.Visible = true;

        ScriptHelper.RegisterWOpenerScript(Page);
        ScriptHelper.RegisterJQuery(Page);

        // Try to get parameters
        string    identifier = QueryHelper.GetString("params", null);
        Hashtable parameters = (Hashtable)WindowHelper.GetItem(identifier);

        // Validate hash
        if ((QueryHelper.ValidateHash("hash", "selectedvalue")) && (parameters != null))
        {
            int siteid = ValidationHelper.GetInteger(parameters["SiteID"], -1);
            if (siteid != -1)
            {
                AccountHelper.AuthorizedReadAccount(siteid, true);
                if (AccountHelper.AuthorizedModifyAccount(siteid, false) || ContactHelper.AuthorizedModifyContact(siteid, false))
                {
                    contactRoleSelector.SiteID     = siteid;
                    contactRoleSelector.IsLiveSite = ValidationHelper.GetBoolean(parameters["IsLiveSite"], false);
                    contactRoleSelector.UniSelector.DialogWindowName = "SelectContactRole";
                    contactRoleSelector.IsSiteManager = ValidationHelper.GetBoolean(parameters["IsSiteManager"], false);

                    selectionDialog.LocalizeItems = QueryHelper.GetBoolean("localize", true);

                    // Load resource prefix
                    string resourcePrefix = ValidationHelper.GetString(parameters["ResourcePrefix"], "general");

                    // Set the page title
                    string titleText = GetString(resourcePrefix + ".selectitem|general.selectitem");

                    // Validity group text
                    pnlRole.GroupingText = GetString(resourcePrefix + ".contactsrole");

                    CurrentMaster.Title.TitleText = titleText;
                    Page.Title = titleText;

                    string imgPath = ValidationHelper.GetString(parameters["IconPath"], null);
                    if (String.IsNullOrEmpty(imgPath))
                    {
                        string objectType = ValidationHelper.GetString(parameters["ObjectType"], null);

                        CurrentMaster.Title.TitleImage = GetObjectIconUrl(objectType, null);
                    }
                    else
                    {
                        CurrentMaster.Title.TitleImage = imgPath;
                    }

                    // Cancel button
                    btnCancel.ResourceString = "general.cancel";
                    btnCancel.Attributes.Add("onclick", "return US_Cancel();");
                }
                // No permission modify
                else
                {
                    RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ModifyAccount");
                }
            }
            else
            {
                // Redirect to error page
                URLHelper.Redirect(ResolveUrl("~/CMSMessages/Error.aspx?title=" + ResHelper.GetString("dialogs.badhashtitle") + "&text=" + ResHelper.GetString("dialogs.badhashtext")));
            }
        }
    }
Exemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (EditedObject != null)
        {
            // Register script for unimenu button selection
            AddMenuButtonSelectScript(this, "Accounts", null, "menu");

            // Get account info object
            AccountInfo ai     = (AccountInfo)EditedObject;
            string      append = null;

            // Check permission
            AccountHelper.AuthorizedReadAccount(ai.AccountSiteID, true);

            // Check if running under site manager (and distribute "site manager" flag to other tabs)
            string siteManagerParam = string.Empty;
            if (IsSiteManager)
            {
                siteManagerParam = "&issitemanager=1";
            }

            // Set default help topic
            SetHelp("onlinemarketing_account_general", "helpTopic");

            // register scripts in modal dialog
            if (isDialogMode)
            {
                RegisterModalPageScripts();
            }

            // Append '(merged)' behind account name in breadcrumbs
            if (ai.AccountMergedWithAccountID != 0)
            {
                append = " " + GetString("om.account.mergedsuffix");
            }
            // Append '(global)'
            else if (ai.AccountSiteID == 0)
            {
                append = " " + GetString("om.account.globalsuffix");
            }

            // Modify header appearance in modal dialog (display title instead of breadcrumbs)
            if (QueryHelper.GetBoolean("dialogmode", false))
            {
                CurrentMaster.Title.TitleText  = GetString("om.account.edit") + " - " + HTMLHelper.HTMLEncode(ai.AccountName) + append;
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/OM_Account/object.png");
            }
            else
            {
                // Get url for breadcrumbs
                string url = ResolveUrl("~/CMSModules/ContactManagement/Pages/Tools/Account/List.aspx");
                url = URLHelper.AddParameterToUrl(url, "siteid", SiteID.ToString());
                if (IsSiteManager)
                {
                    url = URLHelper.AddParameterToUrl(url, "issitemanager", "1");
                }

                CurrentPage.InitBreadcrumbs(2);
                CurrentPage.SetBreadcrumb(0, GetString("om.account.list"), url, "_parent", null);
                CurrentPage.SetBreadcrumb(1, HTMLHelper.HTMLEncode(CMSContext.ResolveMacros("{%EditedObject.DisplayName%}")) + append, null, null, null);
            }

            // Check if account has any custom fields
            int i = 0;

            FormInfo formInfo = FormHelper.GetFormInfo(ai.ClassName, false);
            if (formInfo.GetFormElements(true, false, true).Any())
            {
                i = 1;
            }

            // Initialize tabs
            InitTabs("content");
            SetTab(0, GetString("general.general"), "Tab_General.aspx?accountid=" + ai.AccountID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_account_general');");
            if (i > 0)
            {
                // Add tab for custom fields
                SetTab(1, GetString("general.customfields"), "Tab_CustomFields.aspx?accountid=" + ai.AccountID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_account_customfields');");
            }

            // Display contacts tab only if user is authorized to read contacts
            if (ContactHelper.AuthorizedReadContact(ai.AccountSiteID, false) || AccountHelper.AuthorizedReadAccount(ai.AccountSiteID, false))
            {
                SetTab(1 + i, GetString("om.contact.list"), "Tab_Contacts.aspx?accountid=" + ai.AccountID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_account_contacts');");
            }

            // Hide last 2 tabs if the account is merged
            if (ai.AccountMergedWithAccountID == 0)
            {
                SetTab(2 + i, GetString("om.account.subsidiaries"), "Tab_Subsidiaries.aspx?accountid=" + ai.AccountID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_account_subsidiaries');");
                SetTab(3 + i, GetString("om.account.merge"), "Tab_Merge.aspx?accountid=" + ai.AccountID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_account_merge');");
            }

            // Data.com
            SetTab(4 + i, "Data.com", "Tab_DataCom.aspx?accountid=" + ai.AccountID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_account_datacom');");
        }
    }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Account != null)
        {
            // Current account is global object
            if (Account.AccountSiteID == 0)
            {
                mFilter.SiteID = SiteContext.CurrentSiteID;
                // Display site selector in site manager
                if (ContactHelper.IsSiteManager)
                {
                    mFilter.DisplaySiteSelector = true;
                    mFilter.SiteID = UniSelector.US_GLOBAL_RECORD;
                }
                // Display 'site or global' selector in CMS desk for global objects
                else if (AccountHelper.AuthorizedModifyAccount(SiteContext.CurrentSiteID, false) && AccountHelper.AuthorizedReadAccount(SiteContext.CurrentSiteID, false))
                {
                    mFilter.DisplayGlobalOrSiteSelector = true;
                }
                mFilter.HideMergedIntoGlobal = true;
            }
            else
            {
                mFilter.SiteID = Account.AccountSiteID;
            }
            mFilter.ShowGlobalStatuses =
                ConfigurationHelper.AuthorizedReadConfiguration(UniSelector.US_GLOBAL_RECORD, false) &&
                (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSCMGlobalConfiguration") || ContactHelper.IsSiteManager);
            gridElem.WhereCondition = mFilter.WhereCondition;
            gridElem.WhereCondition = SqlHelper.AddWhereCondition(gridElem.WhereCondition, "AccountID <> " + Account.AccountID);
            gridElem.ZeroRowsText   = GetString("om.account.noaccountsfound");

            btnMergeSelected.Click += btnMergeSelected_Click;
            btnMergeAll.Click      += btnMergeAll_Click;

            if (Request[Page.postEventArgumentID] == "saved")
            {
                ShowConfirmation(GetString("om.account.merging"));

                // Clear selected items
                gridElem.ResetSelection();
            }
        }
        else
        {
            StopProcessing = true;
            Visible        = false;
        }
    }
Exemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script for unimenu button selection
        AddMenuButtonSelectScript(this, "Contacts", null, "menu");

        // Get current user info
        CurrentUserInfo user = CMSContext.CurrentUser;

        // Get contact info object
        ContactInfo ci = (ContactInfo)EditedObject;

        if (ci == null)
        {
            return;
        }

        // Check permission read
        ContactHelper.AuthorizedReadContact(ci.ContactSiteID, true);

        // Check if running under site manager (and distribute "site manager" flag to other tabs)
        string siteManagerParam = string.Empty;

        if (IsSiteManager)
        {
            siteManagerParam = "&issitemanager=1";
        }

        // Set default help topic
        SetHelp("onlinemarketing_contact_general", "helpTopic");

        // register scripts in modal dialog
        if (isDialogMode)
        {
            RegisterModalPageScripts();
        }

        string append = null;

        if (ci.ContactMergedWithContactID != 0)
        {
            // Append '(merged)' behind contact name in breadcrumbs
            append = " " + GetString("om.contact.mergedsuffix");
        }
        else if (ci.ContactSiteID == 0)
        {
            // Append '(global)' behind contact name in breadcrumbs
            append = " " + GetString("om.contact.globalsuffix");
        }

        // Modify header appearance in modal dialog (display title instead of breadcrumbs)
        if (QueryHelper.GetBoolean("dialogmode", false))
        {
            CurrentMaster.Title.TitleText  = GetString("om.contact.edit") + " - " + HTMLHelper.HTMLEncode(ContactInfoProvider.GetContactFullName(ci)) + append;
            CurrentMaster.Title.TitleImage = GetImageUrl("Objects/OM_Contact/object.png");
        }
        else
        {
            // Get url for breadcrumbs
            string url = ResolveUrl("~/CMSModules/ContactManagement/Pages/Tools/Contact/List.aspx");
            url = URLHelper.AddParameterToUrl(url, "siteid", SiteID.ToString());
            if (IsSiteManager)
            {
                url = URLHelper.AddParameterToUrl(url, "issitemanager", "1");
            }

            CurrentPage.InitBreadcrumbs(2);
            CurrentPage.SetBreadcrumb(0, GetString("om.contact.list"), url, "_parent", null);
            CurrentPage.SetBreadcrumb(1, ContactInfoProvider.GetContactFullName(ci) + append, null, null, null);
        }

        // Check if contact has any custom fields
        int i = 0;

        FormInfo formInfo = FormHelper.GetFormInfo(ci.Generalized.DataClass.ClassName, false);

        if (formInfo.GetFormElements(true, false, true).Any())
        {
            i = 1;
        }

        int  contactId      = ci.ContactID;
        bool ipTabAvailable = ActivitySettingsHelper.IPLoggingEnabled(CMSContext.CurrentSiteName) || ContactHelper.IsSiteManager;
        int  counter        = 0;

        // Initialize tabs
        InitTabs("content");

        SetTab(counter++, GetString("general.general"), "Tab_General.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_general');");

        if (i > 0)
        {
            // Add tab for custom fields
            SetTab(counter++, GetString("general.customfields"), "Tab_CustomFields.aspx?contactid=" + ci.ContactID + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_customfields');");
        }

        if (AccountHelper.AuthorizedReadAccount(ci.ContactSiteID, false) || ContactHelper.AuthorizedReadContact(ci.ContactSiteID, false))
        {
            SetTab(counter++, GetString("om.account.list"), "Tab_Accounts.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_accounts');");
        }

        SetTab(counter++, GetString("om.membership.list"), "Membership/Tab_Membership.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_membership');");

        SetTab(counter++, GetString("om.activity.list"), "Tab_Activities.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_activities');");

        if (ipTabAvailable)
        {
            SetTab(counter++, GetString("om.activity.iplist"), "Tab_IPs.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_ips');");
        }

        // Show contact groups
        SetTab(counter++, GetString("om.contactgroup.list"), "Tab_ContactGroups.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_contactgroups');");

        // Show scoring tab for site contacts
        if (ci.ContactSiteID > 0)
        {
            SetTab(counter++, GetString("om.score.list"), "Tab_Scoring.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_scoring');");
        }

        // Hide last 3 tabs if the contact is merged
        if (ci.ContactMergedWithContactID == 0)
        {
            SetTab(counter++, GetString("om.contact.merge"), "Tab_Merge.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_merge');");
        }

        // Data.com
        SetTab(counter++, "Data.com", "Tab_DataCom.aspx?contactid=" + contactId + siteManagerParam, "SetHelpTopic('helpTopic', 'onlinemarketing_contact_datacom');");

        // Marketing automation
        if (WorkflowInfoProvider.IsMarketingAutomationAllowed())
        {
            string stateUrl = String.Format("{0}?objectid={1}{2}", "Tab_Processes.aspx", contactId, siteManagerParam);
            SetTab(counter++, GetString("ma.contact.processes"), stateUrl, "SetHelpTopic('helpTopic', 'automation_state_list');");
        }
    }
Exemplo n.º 20
0
    private void OnTabCreated(object sender, TabCreatedEventArgs e)
    {
        if (e.Tab == null)
        {
            return;
        }

        switch (e.Tab.TabName.ToLowerCSafe())
        {
        case "account.customfields":
            // Check if contact has any custom fields
            var formInfo = FormHelper.GetFormInfo("OM.Account", false);
            if (!formInfo.GetFields(true, false, false).Any())
            {
                e.Tab = null;
            }
            break;

        case "account.contacts":
            // Display contacts tab only if user is authorized to read contacts
            if (!ContactHelper.AuthorizedReadContact(Account.AccountSiteID, false) && !AccountHelper.AuthorizedReadAccount(Account.AccountSiteID, false))
            {
                e.Tab = null;
            }
            break;

        case "account.merge":
        case "account.subsidiaries":
            if (Account.AccountMergedWithAccountID != 0)
            {
                e.Tab = null;
            }
            break;
        }
    }
Exemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set title
        CurrentMaster.Title.TitleText     = GetString("om.contact.collision");
        CurrentMaster.Title.TitleImage    = GetImageUrl("CMSModules/CMS_ContactManagement/collisiondialog.png");
        CurrentMaster.Title.HelpTopicName = "account_collision";
        CurrentMaster.Title.HelpName      = "helpTopic";

        // Validate hash
        Regex re = RegexHelper.GetRegex(@"[\w\d_$$]*");

        identificator = QueryHelper.GetString("params", "");
        if (!QueryHelper.ValidateHash("hash") || !re.IsMatch(identificator))
        {
            pnlContent.Visible = false;
            return;
        }

        // Load dialog parameters
        Hashtable parameters = (Hashtable)WindowHelper.GetItem(identificator.ToString());

        if (parameters != null)
        {
            mergedAccounts = (DataSet)parameters["MergedAccounts"];
            parentAccount  = (AccountInfo)parameters["ParentAccount"];
            isSitemanager  = ValidationHelper.GetBoolean(parameters["issitemanager"], false);

            if (isSitemanager)
            {
                stamp = SettingsKeyProvider.GetStringValue("CMSCMStamp");
            }
            else
            {
                stamp = SettingsKeyProvider.GetStringValue(CMSContext.CurrentSiteName + ".CMSCMStamp");
            }

            stamp = CMSContext.CurrentResolver.ResolveMacros(stamp);

            if (parentAccount != null)
            {
                // Check permissions
                AccountHelper.AuthorizedReadAccount(parentAccount.AccountSiteID, true);

                // Load data
                if (!RequestHelper.IsPostBack())
                {
                    Initialize();
                }
                LoadContactCollisions();
                LoadContactGroups();
                LoadCustomFields();

                // Init controls
                btnMerge.Click += new EventHandler(btnMerge_Click);
                btnCancel.Attributes.Add("onclick", "window.close(); return false;");
                btnStamp.OnClientClick = "AddStamp('" + htmlNotes.CurrentEditor.ClientID + "'); return false;";
                ScriptHelper.RegisterTooltip(Page);
                RegisterScripts();
                accountStatusSelector.SiteID        = parentAccount.AccountSiteID;
                accountSelector.SiteID              = parentAccount.AccountSiteID;
                accountSelector.WhereCondition      = "((AccountMergedWithAccountID IS NULL) AND (AccountSiteID > 0)) OR ((AccountGlobalAccountID IS NULL) AND (AccountSiteID IS NULL))";
                accountSelector.WhereCondition      = GetSubsidiaryWhere(accountSelector.WhereCondition);
                accountStatusSelector.IsSiteManager = isSitemanager;

                // Set groupping text
                pnlGeneral.GroupingText = GetString("general.general");
                pnlAddress.GroupingText = GetString("general.address");
                pnlNotes.GroupingText   = GetString("om.contact.notes");

                // Set tabs
                tabFields.HeaderText        = GetString("om.contact.fields");
                tabContacts.HeaderText      = GetString("om.contact.list");
                tabContactGroups.HeaderText = GetString("om.contactgroup.list");
                tabCustomFields.HeaderText  = GetString("general.customfields");
            }
        }
    }
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        string where = null;
        bool authorizedSiteAccounts   = false;
        bool authorizedGlobalAccounts = AccountHelper.AuthorizedReadAccount(UniSelector.US_GLOBAL_RECORD, false);

        currentUser = MembershipContext.AuthenticatedUser;

        if (SiteID > 0)
        {
            authorizedSiteAccounts = AccountHelper.AuthorizedReadAccount(SiteID, false);
        }
        else
        {
            authorizedSiteAccounts = AccountHelper.AuthorizedReadAccount(SiteContext.CurrentSiteID, false);
        }

        // Filter site objects
        if (SiteID > 0)
        {
            if (authorizedSiteAccounts)
            {
                where = "(AccountSiteID = " + SiteID + " AND AccountMergedWithAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Filter only global objects
        else if ((SiteID == UniSelector.US_GLOBAL_RECORD) || (SiteID == 0))
        {
            if (authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display current site and global contacts
        else if (SiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
        {
            if (authorizedSiteAccounts && authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL) OR (AccountSiteID = " + SiteContext.CurrentSiteID + " AND AccountMergedWithAccountID IS NULL)";
                uniSelector.AddGlobalObjectSuffix = true;
            }
            else if (authorizedGlobalAccounts)
            {
                where = "(AccountSiteID IS NULL AND AccountMergedWithAccountID IS NULL)";
            }
            else if (authorizedSiteAccounts)
            {
                where = "(AccountSiteID = " + SiteContext.CurrentSiteID + " AND AccountMergedWithAccountID IS NULL)";
            }
            else
            {
                where = "(1=0)";
            }
        }
        // Display all objects
        else if ((SiteID == UniSelector.US_ALL_RECORDS) && currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
        {
            where = "((AccountSiteID IS NULL AND AccountGlobalAccountID IS NULL) OR (AccountSiteID > 0 AND AccountMergedWithAccountID IS NULL))";
            uniSelector.AddGlobalObjectSuffix = true;
        }
        // Not enough permissions
        else
        {
            where = "(1=0)";
        }

        uniSelector.WhereCondition = SqlHelper.AddWhereCondition(WhereCondition, where);
        uniSelector.Reload(true);
    }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (CMSContext.EditedObject != null)
        {
            currentUser = CMSContext.CurrentUser;
            cgi         = (ContactGroupInfo)CMSContext.EditedObject;
            siteID      = cgi.ContactGroupSiteID;

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

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

            modifyCombined =
                // Site contact group -> only site accounts can be added
                ((siteID > 0) && (modifySiteAccounts || modifySiteCG))
                // Global contact group -> both site and global accounts can be added
                || ((siteID <= 0) && (
                        // User can display only global accounts
                        (readGlobalAccounts && !readSiteAccounts && (modifyGlobalAccounts || modifyGlobalCG)) ||
                        // User can display only site accounts
                        (readSiteAccounts && !readGlobalAccounts && (modifySiteAccounts || modifySiteCG)) ||
                        // User can display both site and global accounts
                        (readSiteAccounts && readGlobalAccounts && (modifySiteCG || modifySiteAccounts) && (modifyGlobalCG || modifyGlobalAccounts))
                        ));

            // 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 (RequestHelper.CausedPostback(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            accountSelector.UniSelector.ButtonImage                = GetImageUrl("/Objects/OM_Account/add.png");
            accountSelector.UniSelector.DialogImage.CssClass       = "NewItemImage";
            accountSelector.UniSelector.DialogLink.CssClass        = "MenuItemEdit";
            accountSelector.UniSelector.DialogLabel.ResourceString = "om.account.addaccount";

            accountSelector.UniSelector.OnItemsSelected += new EventHandler(UniSelector_OnItemsSelected);
            accountSelector.UniSelector.SelectionMode    = SelectionModeEnum.MultipleButton;

            // Register JS scripts
            RegisterScripts();
        }
        else
        {
            StopProcessing = true;
        }
    }
Exemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Account != null)
        {
            // Current account is global object
            if (this.Account.AccountSiteID == 0)
            {
                filter.SiteID = CMSContext.CurrentSiteID;
                // Display site selector in site manager
                if (ContactHelper.IsSiteManager)
                {
                    filter.SiteID = UniSelector.US_GLOBAL_RECORD;
                    filter.DisplaySiteSelector = true;
                }
                // Display 'site or global' selector in CMS desk for global objects
                else if (AccountHelper.AuthorizedModifyAccount(CMSContext.CurrentSiteID, false) && AccountHelper.AuthorizedReadAccount(CMSContext.CurrentSiteID, false))
                {
                    filter.DisplayGlobalOrSiteSelector = true;
                }
                filter.HideMergedIntoGlobal = true;
            }
            else
            {
                filter.SiteID = Account.AccountSiteID;
            }
            filter.ShowGlobalStatuses =
                ConfigurationHelper.AuthorizedReadConfiguration(UniSelector.US_GLOBAL_RECORD, false) &&
                (SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSCMGlobalConfiguration") || ContactHelper.IsSiteManager);
            gridElem.OnExternalDataBound += new OnExternalDataBoundEventHandler(CMControlsHelper.UniGridOnExternalDataBound);
            gridElem.WhereCondition       = filter.WhereCondition;
            gridElem.WhereCondition       = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, "AccountID <> " + this.Account.AccountID);
            gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");

            btnMergeSelected.Click += new EventHandler(btnMergeSelected_Click);
            btnMergeAll.Click      += new EventHandler(btnMergeAll_Click);

            if (QueryHelper.GetBoolean("saved", false))
            {
                lblInfo.Visible = true;
            }
        }
        else
        {
            this.StopProcessing = true;
            this.Visible        = false;
        }
    }
Exemplo n.º 25
0
 private void Page_Load(object sender, EventArgs e)
 {
     // Check permission read
     AccountHelper.AuthorizedReadAccount(Account.AccountSiteID, true);
 }