Esempio n. 1
0
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	03/10/2006  Created
        /// </history>
        public override void DataBind()
        {
            UserInfo objUser = UserController.GetUser(PortalId, _userId, false);

            if ((objUser != null && objUser.IsSuperUser) || PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
            {
                Response.Redirect(Globals.NavigateURL("Access Denied"), true);
            }

            base.DataBind();

            //this needs to execute always to the client script code is registred in InvokePopupCal
            cmdEffectiveCalendar.NavigateUrl = Calendar.InvokePopupCal(txtEffectiveDate);
            cmdExpiryCalendar.NavigateUrl    = Calendar.InvokePopupCal(txtExpiryDate);

            string localizedCalendarText = Localization.GetString("Calendar");
            string calendarText          = "<img src='" + ResolveUrl("~/images/calendar.png") + "' border='0' alt='" + localizedCalendarText + "'>&nbsp;" + localizedCalendarText;

            cmdExpiryCalendar.Text    = calendarText;
            cmdEffectiveCalendar.Text = calendarText;

            //Localize Headers
            Localization.LocalizeDataGrid(ref grdUserRoles, this.LocalResourceFile);

            //Bind the role data to the datalist
            BindData();

            BindGrid();
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	03/10/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            if (!ModulePermissionController.CanEditModuleContent(ModuleConfiguration))
            {
                Response.Redirect(Globals.NavigateURL("Access Denied"), true);
            }
            base.DataBind();

            //this needs to execute always to the client script code is registred in InvokePopupCal
            cmdEffectiveCalendar.NavigateUrl = Calendar.InvokePopupCal(txtEffectiveDate);
            cmdExpiryCalendar.NavigateUrl    = Calendar.InvokePopupCal(txtExpiryDate);

            string localizedCalendarText = Localization.GetString("Calendar");
            string calendarText          = "<img src='" + ResolveUrl("~/images/calendar.png") + "' border='0' alt='" + localizedCalendarText + "'>";

            cmdExpiryCalendar.Text    = calendarText;
            cmdEffectiveCalendar.Text = calendarText;

            //Localize Headers
            Localization.LocalizeDataGrid(ref grdUserRoles, LocalResourceFile);

            //Bind the role data to the datalist
            BindData();

            BindGrid();
        }
Esempio n. 3
0
        /// <inheritdoc/>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            this.dateField = new TextBox();
            this.dateField.ControlStyle.CopyFrom(this.ControlStyle);
            this.dateField.ID = this.ID + "date";
            this.Controls.Add(this.dateField);

            this.Controls.Add(new LiteralControl("&nbsp;"));

            this.linkCalendar             = new HyperLink();
            this.linkCalendar.CssClass    = "CommandButton";
            this.linkCalendar.Text        = "<img src=\"" + Globals.ApplicationPath + "/images/calendar.png\" border=\"0\" />&nbsp;&nbsp;" + Localization.GetString("Calendar");
            this.linkCalendar.NavigateUrl = Calendar.InvokePopupCal(this.dateField);
            this.Controls.Add(this.linkCalendar);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.cmdDisplay.Click += this.cmdDisplay_Click;

            try
            {
                // this needs to execute always to the client script code is registred in InvokePopupCal
                this.cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(this.txtStartDate);
                this.cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(this.txtEndDate);
                if (!this.Page.IsPostBack)
                {
                    if (!string.IsNullOrEmpty(this._URL))
                    {
                        this.lblLogURL.Text = this.URL; // saved for loading Log grid
                        TabType URLType = Globals.GetURLType(this._URL);
                        if (URLType == TabType.File && this._URL.StartsWith("fileid=", StringComparison.InvariantCultureIgnoreCase) == false)
                        {
                            // to handle legacy scenarios before the introduction of the FileServerHandler
                            var fileName = Path.GetFileName(this._URL);

                            var folderPath = this._URL.Substring(0, this._URL.LastIndexOf(fileName));
                            var folder     = FolderManager.Instance.GetFolder(this.PortalSettings.PortalId, folderPath);

                            var file = FileManager.Instance.GetFile(folder, fileName);

                            this.lblLogURL.Text = "FileID=" + file.FileId;
                        }

                        var             objUrls        = new UrlController();
                        UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(this.PortalSettings.PortalId, this.lblLogURL.Text, this.ModuleID);
                        if (objUrlTracking != null)
                        {
                            if (string.IsNullOrEmpty(this._FormattedURL))
                            {
                                this.lblURL.Text = Globals.LinkClick(this.URL, this.PortalSettings.ActiveTab.TabID, this.ModuleID, false);
                                if (!this.lblURL.Text.StartsWith("http") && !this.lblURL.Text.StartsWith("mailto"))
                                {
                                    this.lblURL.Text = Globals.AddHTTP(this.Request.Url.Host) + this.lblURL.Text;
                                }
                            }
                            else
                            {
                                this.lblURL.Text = this._FormattedURL;
                            }

                            this.lblCreatedDate.Text = objUrlTracking.CreatedDate.ToString();

                            if (objUrlTracking.TrackClicks)
                            {
                                this.pnlTrack.Visible = true;
                                if (string.IsNullOrEmpty(this._TrackingURL))
                                {
                                    if (!this.URL.StartsWith("http"))
                                    {
                                        this.lblTrackingURL.Text = Globals.AddHTTP(this.Request.Url.Host);
                                    }

                                    this.lblTrackingURL.Text += Globals.LinkClick(this.URL, this.PortalSettings.ActiveTab.TabID, this.ModuleID, objUrlTracking.TrackClicks);
                                }
                                else
                                {
                                    this.lblTrackingURL.Text = this._TrackingURL;
                                }

                                this.lblClicks.Text = objUrlTracking.Clicks.ToString();
                                if (!Null.IsNull(objUrlTracking.LastClick))
                                {
                                    this.lblLastClick.Text = objUrlTracking.LastClick.ToString();
                                }
                            }

                            if (objUrlTracking.LogActivity)
                            {
                                this.pnlLog.Visible = true;

                                this.txtStartDate.Text = DateTime.Today.AddDays(-6).ToShortDateString();
                                this.txtEndDate.Text   = DateTime.Today.AddDays(1).ToShortDateString();
                            }
                        }
                    }
                    else
                    {
                        this.Visible = false;
                    }
                }
            }
            catch (Exception exc) // Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	9/21/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdCancel.Click += OnCancelClick;
            cmdCopy.Click   += OnCopyClick;
            cmdDelete.Click += OnDeleteClick;
            cmdEmail.Click  += OnEmailClick;
            cmdUpdate.Click += OnUpdateClick;
            DNNTxtBannerGroup.PopulateOnDemand += PopulateBannersOnDemand;

            try
            {
                if ((Request.QueryString["VendorId"] != null))
                {
                    VendorId = Int32.Parse(Request.QueryString["VendorId"]);
                }
                if ((Request.QueryString["BannerId"] != null))
                {
                    BannerId = Int32.Parse(Request.QueryString["BannerId"]);
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (Page.IsPostBack == false)
                {
                    ctlImage.FileFilter = Globals.glbImageFileTypes;
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    var objBannerTypes = new BannerTypeController();
                    //Get the banner types from the database
                    cboBannerType.DataSource = objBannerTypes.GetBannerTypes();
                    cboBannerType.DataBind();

                    var objBanners = new BannerController();
                    if (BannerId != Null.NullInteger)
                    {
                        //Obtain a single row of banner information
                        BannerInfo objBanner = objBanners.GetBanner(BannerId);
                        if (objBanner != null)
                        {
                            txtBannerName.Text = objBanner.BannerName;
                            cboBannerType.Items.FindByValue(objBanner.BannerTypeId.ToString()).Selected = true;
                            DNNTxtBannerGroup.Text = objBanner.GroupName;
                            ctlImage.Url           = objBanner.ImageFile;
                            if (objBanner.Width != 0)
                            {
                                txtWidth.Text = objBanner.Width.ToString();
                            }
                            if (objBanner.Height != 0)
                            {
                                txtHeight.Text = objBanner.Height.ToString();
                            }
                            txtDescription.Text = objBanner.Description;
                            if (!String.IsNullOrEmpty(objBanner.URL))
                            {
                                ctlURL.Url = objBanner.URL;
                            }
                            txtImpressions.Text = objBanner.Impressions.ToString();
                            txtCPM.Text         = objBanner.CPM.ToString();
                            if (!Null.IsNull(objBanner.StartDate))
                            {
                                txtStartDate.Text = objBanner.StartDate.ToShortDateString();
                            }
                            if (!Null.IsNull(objBanner.EndDate))
                            {
                                txtEndDate.Text = objBanner.EndDate.ToShortDateString();
                            }
                            optCriteria.Items.FindByValue(objBanner.Criteria.ToString()).Selected = true;

                            ctlAudit.CreatedByUser = objBanner.CreatedByUser;
                            ctlAudit.CreatedDate   = objBanner.CreatedDate.ToString();

                            var arrBanners = new ArrayList();

                            arrBanners.Add(objBanner);
                            bannersRow.Visible    = true;
                            lstBanners.DataSource = arrBanners;
                            lstBanners.DataBind();
                        }
                        else //security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true);
                        }
                    }
                    else
                    {
                        txtImpressions.Text = "0";
                        txtCPM.Text         = "0";
                        optCriteria.Items.FindByValue("1").Selected = true;
                        cmdDelete.Visible = false;
                        cmdCopy.Visible   = false;
                        cmdEmail.Visible  = false;
                        ctlAudit.Visible  = false;
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	10/18/2004	documented
        ///     [cnurse]	10/19/2004	modified to support custm module specific settings
        ///     [vmasanas]  11/28/2004  modified to support modules in admin tabs
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                // Verify that the current user has access to edit this module
                if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false && PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString()) == false)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (Page.IsPostBack == false)
                {
                    ctlIcon.FileFilter = Globals.glbImageFileTypes;

                    dgPermissions.TabId    = PortalSettings.ActiveTab.TabID;
                    dgPermissions.ModuleID = moduleId;

                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    cboTab.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, -1, false, true, false, false, true);
                    cboTab.DataBind();
                    //if is and admin or host tab, then add current tab
                    if (PortalSettings.ActiveTab.ParentId == PortalSettings.AdminTabId || PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId)
                    {
                        cboTab.Items.Insert(0, new ListItem(PortalSettings.ActiveTab.TabName, PortalSettings.ActiveTab.TabID.ToString()));
                    }

                    // tab administrators can only manage their own tab
                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
                    {
                        chkAllTabs.Enabled    = false;
                        chkDefault.Enabled    = false;
                        chkAllModules.Enabled = false;
                        cboTab.Enabled        = false;
                    }

                    if (moduleId != -1)
                    {
                        BindData();
                    }
                    else
                    {
                        cboVisibility.SelectedIndex = 0; // maximized
                        chkAllTabs.Checked          = false;
                        cmdDelete.Visible           = false;
                    }

                    //Set visibility of Specific Settings
                    if (ctlSpecific != null)
                    {
                        //Get the module settings from the PortalSettings and pass the
                        //two settings hashtables to the sub control to process
                        ctlSpecific.LoadSettings();
                        dshSpecific.Visible = true;
                        tblSpecific.Visible = true;
                    }
                    else
                    {
                        dshSpecific.Visible = false;
                        tblSpecific.Visible = false;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	9/8/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                if ((Request.QueryString["pid"] != null) && (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId || UserInfo.IsSuperUser))
                {
                    intPortalId              = int.Parse(Request.QueryString["pid"]);
                    ctlLogo.ShowUpLoad       = false;
                    ctlBackground.ShowUpLoad = false;
                }
                else
                {
                    intPortalId              = PortalId;
                    ctlLogo.ShowUpLoad       = true;
                    ctlBackground.ShowUpLoad = true;
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdExpiryCalendar.NavigateUrl = Calendar.InvokePopupCal(txtExpiryDate);
                ClientAPI.AddButtonConfirm(cmdRestore, Localization.GetString("RestoreCCSMessage", LocalResourceFile));

                // If this is the first visit to the page, populate the site data
                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteMessage", LocalResourceFile));

                    PortalController        objPortalController = new PortalController();
                    ListController          ctlList             = new ListController();
                    ListEntryInfoCollection colProcessor        = ctlList.GetListEntryInfoCollection("Processor");

                    cboProcessor.DataSource = colProcessor;
                    cboProcessor.DataBind();
                    cboProcessor.Items.Insert(0, new ListItem("<" + Localization.GetString("None_Specified") + ">", ""));

                    PortalInfo objPortal = objPortalController.GetPortal(intPortalId);

                    txtPortalName.Text                 = objPortal.PortalName;
                    ctlLogo.Url                        = objPortal.LogoFile;
                    ctlLogo.FileFilter                 = Globals.glbImageFileTypes;
                    txtDescription.Text                = objPortal.Description;
                    txtKeyWords.Text                   = objPortal.KeyWords;
                    ctlBackground.Url                  = objPortal.BackgroundFile;
                    ctlBackground.FileFilter           = Globals.glbImageFileTypes;
                    txtFooterText.Text                 = objPortal.FooterText;
                    optUserRegistration.SelectedIndex  = objPortal.UserRegistration;
                    optBannerAdvertising.SelectedIndex = objPortal.BannerAdvertising;

                    cboSplashTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboSplashTabId.DataBind();
                    if (cboSplashTabId.Items.FindByValue(objPortal.SplashTabId.ToString()) != null)
                    {
                        cboSplashTabId.Items.FindByValue(objPortal.SplashTabId.ToString()).Selected = true;
                    }
                    cboHomeTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboHomeTabId.DataBind();
                    if (cboHomeTabId.Items.FindByValue(objPortal.HomeTabId.ToString()) != null)
                    {
                        cboHomeTabId.Items.FindByValue(objPortal.HomeTabId.ToString()).Selected = true;
                    }
                    cboLoginTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboLoginTabId.DataBind();
                    if (cboLoginTabId.Items.FindByValue(objPortal.LoginTabId.ToString()) != null)
                    {
                        cboLoginTabId.Items.FindByValue(objPortal.LoginTabId.ToString()).Selected = true;
                    }
                    cboUserTabId.DataSource = Globals.GetPortalTabs(intPortalId, true, true, false, false, false);
                    cboUserTabId.DataBind();
                    if (cboUserTabId.Items.FindByValue(objPortal.UserTabId.ToString()) != null)
                    {
                        cboUserTabId.Items.FindByValue(objPortal.UserTabId.ToString()).Selected = true;
                    }

                    ListEntryInfoCollection colList = ctlList.GetListEntryInfoCollection("Currency");

                    cboCurrency.DataSource = colList;
                    cboCurrency.DataBind();
                    if (Null.IsNull(objPortal.Currency) || cboCurrency.Items.FindByValue(objPortal.Currency) == null)
                    {
                        cboCurrency.Items.FindByValue("USD").Selected = true;
                    }
                    else
                    {
                        cboCurrency.Items.FindByValue(objPortal.Currency).Selected = true;
                    }
                    RoleController objRoleController = new RoleController();

                    ArrayList Arr = objRoleController.GetUserRolesByRoleName(intPortalId, objPortal.AdministratorRoleName);
                    int       i;
                    for (i = 0; i <= Arr.Count - 1; i++)
                    {
                        UserRoleInfo objUser = (UserRoleInfo)Arr[i];
                        cboAdministratorId.Items.Add(new ListItem(objUser.FullName, objUser.UserID.ToString()));
                    }
                    if (cboAdministratorId.Items.FindByValue(objPortal.AdministratorId.ToString()) != null)
                    {
                        cboAdministratorId.Items.FindByValue(objPortal.AdministratorId.ToString()).Selected = true;
                    }

                    if (!Null.IsNull(objPortal.ExpiryDate))
                    {
                        txtExpiryDate.Text = objPortal.ExpiryDate.ToShortDateString();
                    }
                    txtHostFee.Text   = objPortal.HostFee.ToString();
                    txtHostSpace.Text = objPortal.HostSpace.ToString();
                    txtPageQuota.Text = objPortal.PageQuota.ToString();
                    txtUserQuota.Text = objPortal.UserQuota.ToString();
                    if (objPortal.SiteLogHistory != 0)
                    {
                        txtSiteLogHistory.Text = objPortal.SiteLogHistory.ToString();
                    }

                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    ArrayList arrDesktopModules = objDesktopModules.GetDesktopModules();

                    ArrayList arrPremiumModules = new ArrayList();
                    foreach (DesktopModuleInfo objDesktopModule in arrDesktopModules)
                    {
                        if (objDesktopModule.IsPremium)
                        {
                            arrPremiumModules.Add(objDesktopModule);
                        }
                    }

                    ArrayList arrPortalDesktopModules = objDesktopModules.GetPortalDesktopModules(intPortalId, Null.NullInteger);
                    foreach (PortalDesktopModuleInfo objPortalDesktopModule in arrPortalDesktopModules)
                    {
                        foreach (DesktopModuleInfo objDesktopModule in arrPremiumModules)
                        {
                            if (objDesktopModule.DesktopModuleID == objPortalDesktopModule.DesktopModuleID)
                            {
                                arrPremiumModules.Remove(objDesktopModule);
                                break;
                            }
                        }
                    }

                    ctlDesktopModules.Available = arrPremiumModules;
                    ctlDesktopModules.Assigned  = arrPortalDesktopModules;

                    if (!String.IsNullOrEmpty(objPortal.PaymentProcessor))
                    {
                        if (cboProcessor.Items.FindByText(objPortal.PaymentProcessor) != null)
                        {
                            cboProcessor.Items.FindByText(objPortal.PaymentProcessor).Selected = true;
                        }
                        else // default
                        {
                            if (cboProcessor.Items.FindByText("PayPal") != null)
                            {
                                cboProcessor.Items.FindByText("PayPal").Selected = true;
                            }
                        }
                    }
                    else
                    {
                        cboProcessor.Items.FindByValue("").Selected = true;
                    }
                    txtUserId.Text = objPortal.ProcessorUserId;
                    txtPassword.Attributes.Add("value", objPortal.ProcessorPassword);
                    txtHomeDirectory.Text = objPortal.HomeDirectory;

                    //Populate the default language combobox
                    Localization.LoadCultureDropDownList(cboDefaultLanguage, CultureDropDownTypes.NativeName, objPortal.DefaultLanguage);

                    //Populate the timezone combobox (look up timezone translations based on currently set culture)
                    Localization.LoadTimeZoneDropDownList(cboTimeZone, ((PageBase)Page).PageCulture.Name, Convert.ToString(objPortal.TimeZoneOffset));

                    SkinInfo objSkin;

                    ctlPortalSkin.Width    = "275px";
                    ctlPortalSkin.SkinRoot = SkinInfo.RootSkin;
                    objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlPortalSkin.SkinSrc = objSkin.SkinSrc;
                        }
                    }
                    ctlPortalContainer.Width    = "275px";
                    ctlPortalContainer.SkinRoot = SkinInfo.RootContainer;
                    objSkin = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlPortalContainer.SkinSrc = objSkin.SkinSrc;
                        }
                    }

                    ctlAdminSkin.Width    = "275px";
                    ctlAdminSkin.SkinRoot = SkinInfo.RootSkin;
                    objSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlAdminSkin.SkinSrc = objSkin.SkinSrc;
                        }
                    }
                    ctlAdminContainer.Width    = "275px";
                    ctlAdminContainer.SkinRoot = SkinInfo.RootContainer;
                    objSkin = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin);
                    if (objSkin != null)
                    {
                        if (objSkin.PortalId == PortalId)
                        {
                            ctlAdminContainer.SkinSrc = objSkin.SkinSrc;
                        }
                    }

                    LoadStyleSheet();

                    if (Convert.ToString(PortalSettings.HostSettings["SkinUpload"]) == "G" && !UserInfo.IsSuperUser)
                    {
                        lnkUploadSkin.Visible      = false;
                        lnkUploadContainer.Visible = false;
                    }
                    else
                    {
                        ModuleInfo FileManagerModule = (new ModuleController()).GetModuleByDefinition(intPortalId, "File Manager");
                        string[]   parameters        = new string[3];
                        parameters[0]             = "mid=" + FileManagerModule.ModuleID;
                        parameters[1]             = "ftype=" + UploadType.Skin;
                        parameters[2]             = "rtab=" + TabId;
                        lnkUploadSkin.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", parameters);

                        parameters[1] = "ftype=" + UploadType.Container;
                        lnkUploadContainer.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", parameters);
                    }

                    if (Request.UrlReferrer != null)
                    {
                        if (Request.UrlReferrer.AbsoluteUri == Request.Url.AbsoluteUri)
                        {
                            ViewState["UrlReferrer"] = "";
                        }
                        else
                        {
                            ViewState["UrlReferrer"] = Convert.ToString(Request.UrlReferrer);
                        }
                    }
                    else
                    {
                        ViewState["UrlReferrer"] = "";
                    }
                }

                if (UserInfo.IsSuperUser)
                {
                    dshHost.Visible   = true;
                    tblHost.Visible   = true;
                    cmdDelete.Visible = true;
                    if (Convert.ToString(ViewState["UrlReferrer"]) == "")
                    {
                        cmdCancel.Visible = false;
                    }
                    else
                    {
                        cmdCancel.Visible = true;
                    }
                }
                else
                {
                    dshHost.Visible   = false;
                    tblHost.Visible   = false;
                    cmdDelete.Visible = false;
                    cmdCancel.Visible = false;
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// The Page_Load server event handler on this page is used to populate the role information for the page
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (!Page.IsPostBack)
                {
                    if (!String.IsNullOrEmpty(_URL))
                    {
                        lblLogURL.Text = URL; // saved for loading Log grid

                        TabType URLType = Globals.GetURLType(_URL);
                        if (URLType == TabType.File && _URL.ToLower().StartsWith("fileid=") == false)
                        {
                            // to handle legacy scenarios before the introduction of the FileServerHandler
                            FileController objFiles = new FileController();
                            lblLogURL.Text = "FileID=" + objFiles.ConvertFilePathToFileId(_URL, PortalSettings.PortalId);
                        }

                        UrlController   objUrls        = new UrlController();
                        UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(PortalSettings.PortalId, lblLogURL.Text, ModuleID);
                        if (objUrlTracking != null)
                        {
                            if (_FormattedURL == "")
                            {
                                if (!URL.StartsWith("http") && !URL.StartsWith("mailto"))
                                {
                                    lblURL.Text = Globals.AddHTTP(Request.Url.Host);
                                }
                                lblURL.Text += Globals.LinkClick(URL, PortalSettings.ActiveTab.TabID, ModuleID, false);
                            }
                            else
                            {
                                lblURL.Text = _FormattedURL;
                            }
                            lblCreatedDate.Text = objUrlTracking.CreatedDate.ToString();

                            if (objUrlTracking.TrackClicks)
                            {
                                pnlTrack.Visible = true;
                                if (_TrackingURL == "")
                                {
                                    if (!URL.StartsWith("http"))
                                    {
                                        lblTrackingURL.Text = Globals.AddHTTP(Request.Url.Host);
                                    }
                                    lblTrackingURL.Text += Globals.LinkClick(URL, PortalSettings.ActiveTab.TabID, ModuleID, objUrlTracking.TrackClicks);
                                }
                                else
                                {
                                    lblTrackingURL.Text = _TrackingURL;
                                }
                                lblClicks.Text = objUrlTracking.Clicks.ToString();
                                if (!Null.IsNull(objUrlTracking.LastClick))
                                {
                                    lblLastClick.Text = objUrlTracking.LastClick.ToString();
                                }
                            }

                            if (objUrlTracking.LogActivity)
                            {
                                pnlLog.Visible = true;

                                txtStartDate.Text = DateAndTime.DateAdd(DateInterval.Day, -6, DateTime.Today).ToShortDateString();
                                txtEndDate.Text   = DateAndTime.DateAdd(DateInterval.Day, 1, DateTime.Today).ToShortDateString();
                            }
                        }
                    }
                    else
                    {
                        this.Visible = false;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <history>
        ///     [cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [VMasanas]  9/28/2004   Changed redirect to Access Denied
        /// </history>
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                // Verify that the current user has access to edit this module
                if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false && PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString()) == false)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }

                if ((Request.QueryString["action"] != null))
                {
                    strAction = Request.QueryString["action"].ToLower();
                }

                //this needs to execute always to the client script code is registred in InvokePopupCal
                cmdStartCalendar.NavigateUrl = Calendar.InvokePopupCal(txtStartDate);
                cmdEndCalendar.NavigateUrl   = Calendar.InvokePopupCal(txtEndDate);

                if (Page.IsPostBack == false)
                {
                    //Set the tab id of the permissions grid to the TabId (Note If in add mode
                    //this means that the default permissions inherit from the parent)
                    if (strAction == "edit" || strAction == "delete")
                    {
                        dgPermissions.TabID = TabId;
                    }
                    else
                    {
                        dgPermissions.TabID = -1;
                    }

                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));

                    // load the list of files found in the upload directory
                    ctlIcon.ShowFiles = true;
                    ctlIcon.ShowTabs  = false;
                    ctlIcon.ShowUrls  = false;
                    ctlIcon.Required  = false;

                    ctlIcon.ShowLog       = false;
                    ctlIcon.ShowNewWindow = false;
                    ctlIcon.ShowTrack     = false;
                    ctlIcon.FileFilter    = Globals.glbImageFileTypes;
                    ctlIcon.Width         = "275px";

                    // tab administrators can only manage their own tab
                    if (PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) == false)
                    {
                        cboTab.Enabled = false;
                    }

                    ctlSkin.Width         = "275px";
                    ctlSkin.SkinRoot      = SkinInfo.RootSkin;
                    ctlContainer.Width    = "275px";
                    ctlContainer.SkinRoot = SkinInfo.RootContainer;

                    ctlURL.Width = "275px";

                    rowCopySkin.Visible = false;
                    rowCopyPerm.Visible = false;

                    switch (strAction)
                    {
                    case "":     // add
                        CheckQuota();
                        InitializeTab();
                        cboCopyPage.SelectedIndex = 0;
                        cmdDelete.Visible         = false;
                        break;

                    case "edit":
                        rowCopySkin.Visible = true;
                        rowCopyPerm.Visible = true;
                        BindData();
                        rowTemplate.Visible = false;
                        dshCopy.Visible     = false;
                        tblCopy.Visible     = false;
                        break;

                    case "copy":
                        CheckQuota();
                        BindData();
                        rowTemplate.Visible = false;
                        if (cboCopyPage.Items.FindByValue(TabId.ToString()) != null)
                        {
                            cboCopyPage.Items.FindByValue(TabId.ToString()).Selected = true;
                            DisplayTabModules();
                        }
                        cmdDelete.Visible = false;
                        break;

                    case "delete":

                        if (DeleteTab(TabId))
                        {
                            Response.Redirect(Globals.AddHTTP(PortalAlias.HTTPAlias), true);
                        }
                        else
                        {
                            strAction = "edit";
                            BindData();
                            rowTemplate.Visible = false;
                            dshCopy.Visible     = false;
                            tblCopy.Visible     = false;
                        }
                        break;
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }