Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // In cmsdesk siteID is in control
        if (!this.IsSiteManager)
        {
            // Init site filter when user is authorised for global and site contacts
            if (AuthorizedForGlobalContacts && AuthorizedForSiteContacts)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                if (!RequestHelper.IsPostBack())
                {
                    SiteOrGlobalSelector.SiteID = QueryHelper.GetInteger("siteId", CMSContext.CurrentSiteID);
                }
                listElem.SiteID = SiteOrGlobalSelector.SiteID;
                if (listElem.SiteID == UniSelector.US_GLOBAL_OR_SITE_RECORD)
                {
                    listElem.WhereCondition = SiteOrGlobalSelector.GetSiteWhereCondition("ContactSiteID");
                }
            }
            // Authorised for site contacts only
            else if (AuthorizedForSiteContacts)
            {
                listElem.SiteID = CMSContext.CurrentSiteID;
            }
            // Authorised for global contacts only
            else if (AuthorizedForGlobalContacts)
            {
                listElem.SiteID = UniSelector.US_GLOBAL_RECORD;
            }
            // User is not authorized
            else
            {
                RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ReadContacts");
            }
        }
        // In sitemanager "siteID" is in querystring
        else
        {
            listElem.SiteID = this.SiteID;
            // Hide title
            CurrentMaster.Title.TitleText = CurrentMaster.Title.TitleImage = string.Empty;
        }

        // Set header actions (add button)
        string url = this.ResolveUrl("New.aspx?siteId=" + listElem.SiteID);

        if (this.IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        string[,] actions  = new string[1, 8];
        actions[0, 0]      = "HyperLink";
        actions[0, 1]      = GetString("om.contact.new");
        actions[0, 3]      = url;
        actions[0, 5]      = GetImageUrl("Objects/OM_Contact/add.png");
        hdrActions.Actions = actions;

        // Register script for unimenu button selection
        CMSDeskPage.AddMenuButtonSelectScript(this, "Contacts", null, "menu");
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // In CMS Desk site ID is in control
        if (!IsSiteManager)
        {
            // Init site filter when user is authorized for global and site contacts
            if (AuthorizedForGlobalContacts && AuthorizedForSiteContacts)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                if (!RequestHelper.IsPostBack())
                {
                    SiteOrGlobalSelector.SiteID = QueryHelper.GetInteger("siteId", CMSContext.CurrentSiteID);
                }
                listElem.SiteID         = SiteOrGlobalSelector.SiteID;
                listElem.WhereCondition = SiteOrGlobalSelector.GetSiteWhereCondition("ContactSiteID");
            }
            // Authorized for site contacts only
            else if (AuthorizedForSiteContacts)
            {
                listElem.SiteID         = CMSContext.CurrentSiteID;
                listElem.WhereCondition = "ContactSiteID = " + listElem.SiteID;
            }
            // Authorized for global contacts only
            else if (AuthorizedForGlobalContacts)
            {
                listElem.SiteID         = UniSelector.US_GLOBAL_RECORD;
                listElem.WhereCondition = "ContactSiteID IS NULL";
            }
            // User is not authorized
            else
            {
                RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ReadContacts");
            }
        }
        // In Site Manager "siteID" is in query string
        else
        {
            listElem.SiteID = SiteID;
            if (SiteID == UniSelector.US_GLOBAL_RECORD)
            {
                listElem.WhereCondition = "ContactSiteID IS NULL";
            }
            else if (SiteID > 0)
            {
                listElem.WhereCondition = "ContactSiteID = " + SiteID;
            }
        }

        // Set header actions (add button)
        string url = ResolveUrl("New.aspx?siteId=" + listElem.SiteID);

        if (IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        string[,] actions  = new string[1, 8];
        actions[0, 0]      = "HyperLink";
        actions[0, 1]      = GetString("om.contact.new");
        actions[0, 3]      = url;
        actions[0, 5]      = GetImageUrl("Objects/OM_Contact/add.png");
        hdrActions.Actions = actions;
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SiteOrGlobalSelector.TargetObjectType = ContactGroupInfo.OBJECT_TYPE;

        // In CMS Desk "siteID is available in control
        if (!IsSiteManager)
        {
            // Init site filter when user is authorized for global and site objects
            if (AuthorizedForGlobalContactGroups && AuthorizedForSiteContactGroups)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                if (!RequestHelper.IsPostBack())
                {
                    SiteOrGlobalSelector.SiteID = SiteID;
                }
                siteId = SiteOrGlobalSelector.SiteID;
                if (siteId == UniSelector.US_GLOBAL_AND_SITE_RECORD)
                {
                    listElem.WhereCondition = SiteOrGlobalSelector.GetWhereCondition();
                }
            }
            // User is authorized for site accounts
            else if (AuthorizedForSiteContactGroups)
            {
                // Use default value = current site ID
            }
            // User is authorized only for global accounts
            else if (AuthorizedForGlobalContactGroups)
            {
                siteId = UniSelector.US_GLOBAL_RECORD;
            }
            // User is not authorized
            else
            {
                RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ReadContactGroups");
            }
        }
        // In Site Manager "siteID" is in query string
        else
        {
            siteId = SiteID;

            // Hide title
            PageTitle.TitleText = string.Empty;
        }

        // Set header actions (add button)
        listElem.SiteID = siteId;
        string url = ResolveUrl("New.aspx?siteId=" + siteId);

        if (IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        hdrActions.AddAction(new HeaderAction
        {
            Text        = GetString("om.contactgroup.new"),
            RedirectUrl = url
        });

        // Register script for UniMenu button selection
        AddMenuButtonSelectScript(this, "ContactGroups", null, "menu");
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SiteOrGlobalSelector.TargetObjectType = ContactInfo.OBJECT_TYPE;

        // In CMS Desk site ID is in control
        if (!IsSiteManager)
        {
            // Init site filter when user is authorized for global and site contacts
            if (AuthorizedForGlobalContacts && AuthorizedForSiteContacts)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                if (!RequestHelper.IsPostBack())
                {
                    SiteOrGlobalSelector.SiteID = QueryHelper.GetInteger("siteId", SiteContext.CurrentSiteID);
                }
                listElem.SiteID         = SiteOrGlobalSelector.SiteID;
                listElem.WhereCondition = SiteOrGlobalSelector.GetWhereCondition();
            }
            // Authorized for site contacts only
            else if (AuthorizedForSiteContacts)
            {
                listElem.SiteID         = SiteContext.CurrentSiteID;
                listElem.WhereCondition = "ContactSiteID = " + listElem.SiteID;
            }
            // Authorized for global contacts only
            else if (AuthorizedForGlobalContacts)
            {
                listElem.SiteID         = UniSelector.US_GLOBAL_RECORD;
                listElem.WhereCondition = "ContactSiteID IS NULL";
            }
            // User is not authorized
            else
            {
                RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ReadContacts");
            }
        }
        // In Site Manager "siteID" is in query string
        else
        {
            listElem.SiteID = SiteID;
            if (SiteID == UniSelector.US_GLOBAL_RECORD)
            {
                listElem.WhereCondition = "ContactSiteID IS NULL";
            }
            else if (SiteID > 0)
            {
                listElem.WhereCondition = "ContactSiteID = " + SiteID;
            }
        }

        // Set header actions (add button)
        string url = ResolveUrl("New.aspx?siteId=" + listElem.SiteID);

        if (IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        hdrActions.AddAction(new HeaderAction
        {
            Text        = GetString("om.contact.new"),
            RedirectUrl = url
        });

        var deletingInactiveContactsMethod = SettingsKeyInfoProvider.GetValue("CMSDeleteInactiveContactsMethod", SiteContext.CurrentSiteID);

        if (string.IsNullOrEmpty(deletingInactiveContactsMethod))
        {
            ShowWarning(string.Format(GetString("om.contactlist.inactivecontacts.warning"), "https://docs.kentico.com/x/9QKOAw"));
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SiteOrGlobalSelector.TargetObjectType = AccountInfo.OBJECT_TYPE;

        // In CMS Desk site ID is available in control
        if (!IsSiteManager)
        {
            // Init site filter when user is authorized for global and site accounts
            if (AuthorizedForGlobalAccounts && AuthorizedForSiteAccounts)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                if (!RequestHelper.IsPostBack())
                {
                    SiteOrGlobalSelector.SiteID = QueryHelper.GetInteger("siteId", SiteContext.CurrentSiteID);
                }
                listElem.SiteID         = SiteOrGlobalSelector.SiteID;
                listElem.WhereCondition = SiteOrGlobalSelector.GetWhereCondition();
            }
            // User is authorized for site accounts
            else if (AuthorizedForSiteAccounts)
            {
                // Use default value = current site ID
                listElem.SiteID         = SiteContext.CurrentSiteID;
                listElem.WhereCondition = "AccountSiteID = " + listElem.SiteID;
            }
            // User is authorized only for global accounts
            else if (AuthorizedForGlobalAccounts)
            {
                listElem.SiteID         = UniSelector.US_GLOBAL_RECORD;
                listElem.WhereCondition = "AccountSiteID IS NULL";
            }
            // User is not authorized
            else
            {
                RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ReadAccounts");
            }
        }
        // In Site Manager site ID is in query string
        else
        {
            listElem.SiteID = SiteID;
            if (SiteID == UniSelector.US_GLOBAL_RECORD)
            {
                listElem.WhereCondition = "AccountSiteID IS NULL";
            }
            else if (SiteID > 0)
            {
                listElem.WhereCondition = "AccountSiteID = " + SiteID;
            }
        }

        // Set header actions (add button)
        string url = ResolveUrl("New.aspx?siteId=" + listElem.SiteID);

        if (IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        hdrActions.AddAction(new HeaderAction
        {
            Text        = GetString("om.account.new"),
            RedirectUrl = url
        });
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // In cmsdesk "siteID is available in control
        if (!IsSiteManager)
        {
            // Init site filter when user is authorised for global and site objects
            if (AuthorizedForGlobalContactGroups && AuthorizedForSiteContactGroups)
            {
                CurrentMaster.DisplaySiteSelectorPanel = true;
                if (!RequestHelper.IsPostBack())
                {
                    SiteOrGlobalSelector.SiteID = SiteID;
                }
                siteId = SiteOrGlobalSelector.SiteID;
                if (siteId == UniSelector.US_GLOBAL_OR_SITE_RECORD)
                {
                    listElem.WhereCondition = SiteOrGlobalSelector.GetSiteWhereCondition("ContactGroupSiteID");
                }
            }
            // User is authorised for site accounts
            else if (AuthorizedForSiteContactGroups)
            {
                // Use default value = current site ID
            }
            // User is authorised only for global accounts
            else if (AuthorizedForGlobalContactGroups)
            {
                siteId = UniSelector.US_GLOBAL_RECORD;
            }
            // User is not authorized
            else
            {
                RedirectToCMSDeskAccessDenied(ModuleEntry.CONTACTMANAGEMENT, "ReadContactGroups");
            }
        }
        // In sitemanager "siteID" is in querystring
        else
        {
            siteId = SiteID;

            // Hide title
            CurrentMaster.Title.TitleText = CurrentMaster.Title.TitleImage = string.Empty;
        }

        // Set header actions (add button)
        listElem.SiteID = siteId;
        string url = ResolveUrl("New.aspx?siteId=" + siteId);

        if (IsSiteManager)
        {
            url = URLHelper.AddParameterToUrl(url, "isSiteManager", "1");
        }
        string[,] actions  = new string[1, 8];
        actions[0, 0]      = "HyperLink";
        actions[0, 1]      = GetString("om.contactgroup.new");
        actions[0, 3]      = url;
        actions[0, 5]      = GetImageUrl("Objects/OM_ContactGroup/add.png");
        hdrActions.Actions = actions;

        // Register script for unimenu button selection
        AddMenuButtonSelectScript(this, "ContactGroups", null, "menu");
    }