示例#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");
    }
示例#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;
    }
示例#3
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");
    }