public void UpdateDocumentUrl(DocumentInfo document, string oldUrl, int portalId, int moduleId)
        {
            if (document.Url != oldUrl)
            {
                var ctrlUrl = new UrlController();

                // get tracking data for the old URL
                var urlTracking = ctrlUrl.GetUrlTracking(portalId, oldUrl, moduleId);
                if (urlTracking != null)
                {
                    // delete old URL tracking data
                    DataProvider.Instance().DeleteUrlTracking(portalId, oldUrl, moduleId);

                    // create new URL tracking data
                    ctrlUrl.UpdateUrl(
                        portalId,
                        document.Url,
                        urlTracking.UrlType,
                        urlTracking.LogActivity,
                        urlTracking.TrackClicks,
                        moduleId,
                        urlTracking.NewWindow);
                }
            }
        }
Ejemplo n.º 2
0
        protected void buttonImport_Click(object sender, EventArgs e)
        {
            try {
                var fromModule = ModuleController.Instance.GetModule(int.Parse(comboModule.SelectedValue), TabId, false);
                foreach (ListItem item in listDocuments.Items)
                {
                    if (item.Selected)
                    {
                        var document = GetDocument(int.Parse(item.Value), fromModule);
                        if (document != null)
                        {
                            // get original document tracking data
                            var ctrlUrl     = new UrlController();
                            var urlTracking = ctrlUrl.GetUrlTracking(PortalId, document.Url, document.ModuleId);

                            // import document
                            document.ItemId   = Null.NullInteger;
                            document.ModuleId = ModuleId;
                            DocumentsDataProvider.Instance.Add(document);

                            // add new url tracking data
                            if (urlTracking != null)
                            {
                                // WTF: using url.Clicks, url.LastClick, url.CreatedDate overload not working?
                                ctrlUrl.UpdateUrl(PortalId, document.Url, urlTracking.UrlType,
                                                  urlTracking.LogActivity, urlTracking.TrackClicks,
                                                  ModuleId, urlTracking.NewWindow);
                            }
                        }
                    }
                }

                ModuleSynchronizer.Synchronize(ModuleId, TabModuleId);
                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception ex) {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        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);
            }
        }
        public override void HandleRequest()
        {
            string       output       = null;
            DialogParams dialogParams = Content.FromJson <DialogParams>();            // This uses the new JSON Extensions in DotNetNuke.Common.Utilities.JsonExtensionsWeb

            string link = dialogParams.LinkUrl;

            dialogParams.LinkClickUrl = link;

            if (dialogParams != null)
            {
                if (!(dialogParams.LinkAction == "GetLinkInfo"))
                {
                    if (dialogParams.Track)
                    {
                        string tempVar = dialogParams.LinkUrl;
                        dialogParams.LinkClickUrl = GetLinkClickURL(ref dialogParams, ref tempVar);
                        dialogParams.LinkUrl      = tempVar;
                        UrlTrackingInfo linkTrackingInfo = _urlController.GetUrlTracking(dialogParams.PortalId, dialogParams.LinkUrl, dialogParams.ModuleId);

                        if (linkTrackingInfo != null)
                        {
                            dialogParams.Track       = linkTrackingInfo.TrackClicks;
                            dialogParams.TrackUser   = linkTrackingInfo.LogActivity;
                            dialogParams.DateCreated = linkTrackingInfo.CreatedDate.ToString();
                            dialogParams.LastClick   = linkTrackingInfo.LastClick.ToString();
                            dialogParams.Clicks      = linkTrackingInfo.Clicks.ToString();
                        }
                        else
                        {
                            dialogParams.Track     = false;
                            dialogParams.TrackUser = false;
                        }
                        dialogParams.LinkUrl = link;
                    }
                }

                switch (dialogParams.LinkAction)
                {
                case "GetLoggingInfo":                         //also meant for the tracking tab but this is to retrieve the user information
                    DateTime logStartDate = DateTime.MinValue;
                    DateTime logEndDate   = DateTime.MinValue;
                    string   logText      = "<table><tr><th>Date</th><th>User</th></tr><tr><td colspan='2'>The selected date-range did<br /> not return any results.</td></tr>";

                    if (DateTime.TryParse(dialogParams.LogStartDate, out logStartDate))
                    {
                        if (!(DateTime.TryParse(dialogParams.LogEndDate, out logEndDate)))
                        {
                            logEndDate = logStartDate.AddDays(1);
                        }

                        UrlController _urlController = new UrlController();
                        ArrayList     urlLog         = _urlController.GetUrlLog(dialogParams.PortalId, GetLinkUrl(ref dialogParams, dialogParams.LinkUrl), dialogParams.ModuleId, logStartDate, logEndDate);

                        if (urlLog != null)
                        {
                            logText = GetUrlLoggingInfo(urlLog);
                        }
                    }

                    dialogParams.TrackingLog = logText;

                    break;

                case "GetLinkInfo":
                    if (dialogParams.Track)
                    {
                        link = link.Replace(@"\", @"/");

                        //this section is for when the user clicks ok in the dialog box, we actually create a record for the linkclick urls.
                        if (!(dialogParams.LinkUrl.ToLower().Contains("linkclick.aspx")))
                        {
                            dialogParams.LinkClickUrl = GetLinkClickURL(ref dialogParams, ref link);
                        }

                        _urlController.UpdateUrl(dialogParams.PortalId, link, GetURLType(Globals.GetURLType(link)), dialogParams.TrackUser, true, dialogParams.ModuleId, false);
                    }
                    else
                    {
                        //this section is meant for retrieving/displaying the original links and determining if the links are being tracked(making sure the track checkbox properly checked)
                        UrlTrackingInfo linkTrackingInfo = null;

                        if (dialogParams.LinkUrl.Contains("fileticket"))
                        {
                            var queryString     = dialogParams.LinkUrl.Split('=');
                            var encryptedFileId = queryString[1].Split('&')[0];

                            string   fileID    = UrlUtils.DecryptParameter(encryptedFileId, dialogParams.PortalGuid);
                            FileInfo savedFile = _fileController.GetFileById(Int32.Parse(fileID), dialogParams.PortalId);

                            linkTrackingInfo = _urlController.GetUrlTracking(dialogParams.PortalId, string.Format("fileID={0}", fileID), dialogParams.ModuleId);
                        }
                        else if (dialogParams.LinkUrl.ToLowerInvariant().Contains("linkclick.aspx"))
                        {
                            try
                            {
                                if (dialogParams.LinkUrl.Contains("?"))
                                {
                                    link = dialogParams.LinkUrl.Split('?')[1].Split('&')[0];
                                    if (link.Contains("="))
                                    {
                                        link = link.Split('=')[1];
                                    }
                                }

                                int tabId;
                                if (int.TryParse(link, out tabId))                                     //if it's a tabid get the tab path
                                {
                                    dialogParams.LinkClickUrl = TabController.Instance.GetTab(tabId, dialogParams.PortalId, true).FullUrl;
                                    linkTrackingInfo          = _urlController.GetUrlTracking(dialogParams.PortalId, tabId.ToString(), dialogParams.ModuleId);
                                }
                                else
                                {
                                    dialogParams.LinkClickUrl = HttpContext.Current.Server.UrlDecode(link);                                             //get the actual link
                                    linkTrackingInfo          = _urlController.GetUrlTracking(dialogParams.PortalId, dialogParams.LinkClickUrl, dialogParams.ModuleId);
                                }
                            }
                            catch (Exception ex)
                            {
                                Logger.Error(ex);
                                dialogParams.LinkClickUrl = dialogParams.LinkUrl;
                            }
                        }

                        if (linkTrackingInfo == null)
                        {
                            dialogParams.Track     = false;
                            dialogParams.TrackUser = false;
                        }
                        else
                        {
                            dialogParams.Track     = linkTrackingInfo.TrackClicks;
                            dialogParams.TrackUser = linkTrackingInfo.LogActivity;
                        }
                    }
                    break;
                }
                output = dialogParams.ToJson();
            }

            Response.Write(output);
        }
Ejemplo n.º 5
0
        private void DoChangeURL()
        {
            string _Url     = Convert.ToString(ViewState["Url"]);
            string _Urltype = Convert.ToString(ViewState["UrlType"]);

            if (!String.IsNullOrEmpty(_Url))
            {
                var    objUrls     = new UrlController();
                string TrackingUrl = _Url;

                _Urltype = Globals.GetURLType(_Url).ToString("g").Substring(0, 1);
                if (_Urltype == "U" && (_Url.StartsWith("~/" + PortalSettings.DefaultIconLocation, StringComparison.InvariantCultureIgnoreCase)))
                {
                    _Urltype = "I";
                }
                ViewState["UrlType"] = _Urltype;
                if (_Urltype == "F")
                {
                    if (_Url.ToLower().StartsWith("fileid="))
                    {
                        TrackingUrl = _Url;
                        var objFile = FileManager.Instance.GetFile(int.Parse(_Url.Substring(7)));
                        if (objFile != null)
                        {
                            _Url = objFile.Folder + objFile.FileName;
                        }
                    }
                    else
                    {
                        //to handle legacy scenarios before the introduction of the FileServerHandler
                        var fileName   = Path.GetFileName(_Url);
                        var folderPath = _Url.Substring(0, _Url.LastIndexOf(fileName));
                        var folder     = FolderManager.Instance.GetFolder(_objPortal.PortalID, folderPath);
                        var fileId     = -1;
                        if (folder != null)
                        {
                            var file = FileManager.Instance.GetFile(folder, fileName);
                            if (file != null)
                            {
                                fileId = file.FileId;
                            }
                        }
                        TrackingUrl = "FileID=" + fileId.ToString();
                    }
                }
                if (_Urltype == "M")
                {
                    if (_Url.ToLower().StartsWith("userid="))
                    {
                        UserInfo objUser = UserController.GetUserById(_objPortal.PortalID, int.Parse(_Url.Substring(7)));
                        if (objUser != null)
                        {
                            _Url = objUser.Username;
                        }
                    }
                }
                UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(_objPortal.PortalID, TrackingUrl, ModuleID);
                if (objUrlTracking != null)
                {
                    chkNewWindow.Checked = objUrlTracking.NewWindow;
                    chkTrack.Checked     = objUrlTracking.TrackClicks;
                    chkLog.Checked       = objUrlTracking.LogActivity;
                }
                else //the url does not exist in the tracking table
                {
                    chkTrack.Checked = false;
                    chkLog.Checked   = false;
                }
                ViewState["Url"] = _Url;
            }
            else
            {
                if (!String.IsNullOrEmpty(_Urltype))
                {
                    optType.ClearSelection();
                    if (optType.Items.FindByValue(_Urltype) != null)
                    {
                        optType.Items.FindByValue(_Urltype).Selected = true;
                    }
                    else
                    {
                        optType.Items[0].Selected = true;
                    }
                }
                else
                {
                    if (optType.Items.Count > 0)
                    {
                        optType.ClearSelection();
                        optType.Items[0].Selected = true;
                    }
                }
                chkNewWindow.Checked = false; //Need check
                chkTrack.Checked     = false; //Need check
                chkLog.Checked       = false; //Need check
            }

            //Url type changed, then we must draw the controlos for that type
            _doRenderTypeControls = true;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <param name="moduleId">The Id of the module to be exported</param>
        /// <history>
        ///		[cnurse]	    17 Nov 2004	documented
        ///		[aglenwright]	18 Feb 2006	Added new fields: Createddate, description,
        ///                             modifiedbyuser, modifieddate, OwnedbyUser, SortorderIndex
        ///                             Added DocumentsSettings
        ///   [togrean]     10 Jul 2007 Fixed issues with importing documet settings since new fileds
        ///                             were added: AllowSorting, default folder, list name
        ///   [togrean]     13 Jul 2007 Added support for exporting documents Url tracking options
        /// </history>
        public string ExportModule(int moduleId)
        {
            var mCtrl  = new ModuleController();
            var module = mCtrl.GetModule(moduleId, Null.NullInteger);

            var strXml = new StringBuilder("<documents>");

            try {
                var documents = DocumentsDataProvider.Instance.GetDocuments(moduleId, module.PortalID);

                var now = DateTime.Now;
                if (documents.Any())
                {
                    foreach (var document in documents)
                    {
                        strXml.Append("<document>");
                        strXml.AppendFormat("<title>{0}</title>", XmlUtils.XMLEncode(document.Title));
                        strXml.AppendFormat("<url>{0}</url>", XmlUtils.XMLEncode(document.Url));
                        strXml.AppendFormat("<category>{0}</category>", XmlUtils.XMLEncode(document.Category));
                        strXml.AppendFormat(
                            "<description>{0}</description>",
                            XmlUtils.XMLEncode(document.Description));
                        strXml.AppendFormat(
                            "<forcedownload>{0}</forcedownload>",
                            XmlUtils.XMLEncode(document.ForceDownload.ToString()));
                        strXml.AppendFormat("<startDate>{0}</startDate>", XmlUtils.XMLEncode(document.StartDate.ToString()));
                        strXml.AppendFormat("<endDate>{0}</endDate>", XmlUtils.XMLEncode(document.EndDate.ToString()));
                        strXml.AppendFormat(
                            "<ownedbyuserid>{0}</ownedbyuserid>",
                            XmlUtils.XMLEncode(document.OwnedByUserId.ToString()));
                        strXml.AppendFormat(
                            "<sortorderindex>{0}</sortorderindex>",
                            XmlUtils.XMLEncode(document.SortOrderIndex.ToString()));
                        strXml.AppendFormat(
                            "<linkattributes>{0}</linkattributes>",
                            XmlUtils.XMLEncode(document.LinkAttributes));

                        // Export Url Tracking options too
                        var urlCtrl         = new UrlController();
                        var urlTrackingInfo = urlCtrl.GetUrlTracking(module.PortalID, document.Url, moduleId);

                        if ((urlTrackingInfo != null))
                        {
                            strXml.AppendFormat(
                                "<logactivity>{0}</logactivity>",
                                XmlUtils.XMLEncode(urlTrackingInfo.LogActivity.ToString()));
                            strXml.AppendFormat(
                                "<trackclicks>{0}</trackclicks>",
                                XmlUtils.XMLEncode(urlTrackingInfo.TrackClicks.ToString()));
                            strXml.AppendFormat("<newwindow>{0}</newwindow>", XmlUtils.XMLEncode(urlTrackingInfo.NewWindow.ToString()));
                        }
                        strXml.Append("</document>");
                    }
                }

                ExportSettings(module, strXml);
            }
            catch (Exception ex) {
                Exceptions.LogException(ex);
            }
            finally {
                // make sure XML is valid
                strXml.Append("</documents>");
            }

            return(strXml.ToString());
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
0
        private void ShowControls()
        {
            UrlController objUrls = new UrlController();

            // set url type
            if (optType.SelectedItem == null)
            {
                if (!String.IsNullOrEmpty(_Url))
                {
                    string TrackingUrl = _Url;

                    _UrlType = Globals.GetURLType(_Url).ToString("g").Substring(0, 1);

                    if (_UrlType == "F")
                    {
                        FileController objFiles = new FileController();
                        if (_Url.ToLower().StartsWith("fileid="))
                        {
                            TrackingUrl = _Url;
                            FileInfo objFile = objFiles.GetFileById(int.Parse(_Url.Substring(7)), _objPortal.PortalID);
                            if (objFile != null)
                            {
                                _Url = objFile.Folder + objFile.FileName;
                            }
                        }
                        else
                        {
                            // to handle legacy scenarios before the introduction of the FileServerHandler
                            TrackingUrl = "FileID=" + objFiles.ConvertFilePathToFileId(_Url, _objPortal.PortalID);
                        }
                    }

                    if (_UrlType == "M")
                    {
                        if (_Url.ToLower().StartsWith("userid="))
                        {
                            UserInfo objUser = UserController.GetUser(_objPortal.PortalID, int.Parse(_Url.Substring(7)), false);
                            if (objUser != null)
                            {
                                _Url = objUser.Username;
                            }
                        }
                    }

                    UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(_objPortal.PortalID, TrackingUrl, ModuleID);
                    if (objUrlTracking != null)
                    {
                        optType.Items.FindByValue(objUrlTracking.UrlType).Selected = true;
                        chkNewWindow.Checked = objUrlTracking.NewWindow;
                        chkTrack.Checked     = objUrlTracking.TrackClicks;
                        chkLog.Checked       = objUrlTracking.LogActivity;
                    }
                    else // the url does not exist in the tracking table
                    {
                        optType.Items.FindByValue(_UrlType).Selected = true;
                        chkNewWindow.Checked = false;
                        chkTrack.Checked     = true;
                        chkLog.Checked       = false;
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(_UrlType))
                    {
                        if (optType.Items.FindByValue(_UrlType) != null)
                        {
                            optType.Items.FindByValue(_UrlType).Selected = true;
                        }
                        else
                        {
                            optType.Items[0].Selected = true;
                        }
                    }
                    else
                    {
                        optType.Items[0].Selected = true;
                    }
                    chkNewWindow.Checked = false;
                    chkTrack.Checked     = true;
                    chkLog.Checked       = false;
                }
            }

            // load listitems
            switch (optType.SelectedItem.Value)
            {
            case "N":     // None

                URLRow.Visible  = false;
                TabRow.Visible  = false;
                FileRow.Visible = false;
                UserRow.Visible = false;
                break;

            case "U":     // Url

                URLRow.Visible  = true;
                TabRow.Visible  = false;
                FileRow.Visible = false;
                UserRow.Visible = false;

                if (txtUrl.Text == "")
                {
                    txtUrl.Text = _Url;
                }
                if (txtUrl.Text == "")
                {
                    txtUrl.Text = "http://";
                }
                txtUrl.Visible = true;

                cmdSelect.Visible = true;

                cboUrls.Items.Clear();
                cboUrls.DataSource = objUrls.GetUrls(_objPortal.PortalID);
                cboUrls.DataBind();
                if (cboUrls.Items.FindByValue(_Url) != null)
                {
                    cboUrls.Items.FindByValue(_Url).Selected = true;
                }
                cboUrls.Visible = false;

                cmdAdd.Visible    = false;
                cmdDelete.Visible = false;
                break;

            case "T":     // tab

                URLRow.Visible  = false;
                TabRow.Visible  = true;
                FileRow.Visible = false;
                UserRow.Visible = false;

                cboTabs.Items.Clear();

                cboTabs.DataSource = Globals.GetPortalTabs(_objPortal.PortalID, !_Required, true, false, false, false);
                cboTabs.DataBind();
                if (cboTabs.Items.FindByValue(_Url) != null)
                {
                    cboTabs.Items.FindByValue(_Url).Selected = true;
                }
                break;

            case "F":     // file

                URLRow.Visible  = false;
                TabRow.Visible  = false;
                FileRow.Visible = true;
                UserRow.Visible = false;

                LoadFolders();

                if (cboFolders.Items.Count == 0)
                {
                    lblMessage.Text = Localization.GetString("NoPermission", this.LocalResourceFile);
                    FileRow.Visible = false;
                    return;
                }

                // select folder
                string FileName;
                string FolderPath;
                if (_Url != string.Empty)
                {
                    FileName   = _Url.Substring(_Url.LastIndexOf("/") + 1);
                    FolderPath = _Url.Replace(FileName, "");
                }
                else
                {
                    FileName   = _Url;
                    FolderPath = string.Empty;
                }
                if (cboFolders.Items.FindByValue(FolderPath) != null)
                {
                    cboFolders.Items.FindByValue(FolderPath).Selected = true;
                }
                else
                {
                    cboFolders.Items[0].Selected = true;
                    FolderPath = cboFolders.SelectedValue;
                }

                //cboFiles.DataSource = GetFileList(FileFilter, !_Required, cboFolders.SelectedItem.Value);
                cboFiles.DataSource = GetFileList(!_Required);
                cboFiles.DataBind();
                if (cboFiles.Items.FindByText(FileName) != null)
                {
                    cboFiles.Items.FindByText(FileName).Selected = true;
                }
                cboFiles.Visible = true;
                txtFile.Visible  = false;

                string strWriteRoles = GetWriteRoles(FolderPath);
                cmdUpload.Visible = PortalSecurity.IsInRoles(strWriteRoles) && _ShowUpLoad;

                SetStorageLocationType();

                txtUrl.Visible    = false;
                cmdSave.Visible   = false;
                cmdCancel.Visible = false;
                break;

            case "M":     // membership users

                URLRow.Visible  = false;
                TabRow.Visible  = false;
                FileRow.Visible = false;
                UserRow.Visible = true;

                if (txtUser.Text == "")
                {
                    txtUser.Text = _Url;
                }
                break;
            }
        }