コード例 #1
0
ファイル: Edit.aspx.cs プロジェクト: zahedbri/mojoportal
        private void PopulateFileControls()
        {
            Title        = SiteUtils.FormatPageTitle(siteSettings, SharedFileResources.SharedFilesEditLabel);
            heading.Text = SharedFileResources.SharedFilesEditLabel;

            SharedFile file = new SharedFile(moduleId, itemId);

            if ((file.ItemId > 0) && (file.ModuleId == moduleId))
            {
                pnlNotFound.Visible = false;
                pnlFolder.Visible   = false;
                pnlFile.Visible     = true;

                using (IDataReader reader = SharedFileFolder.GetSharedModuleFolders(file.ModuleId))
                {
                    ddFolders.DataSource = reader;
                    ddFolders.DataBind();
                }

                ddFolders.Items.Insert(0, new ListItem("Root", "-1"));
                ddFolders.SelectedValue = file.FolderId.ToInvariantString();

                hdnCurrentFolderId.Value = file.FolderId.ToInvariantString();

                if (timeZone != null)
                {
                    lblUploadDate.Text = file.UploadDate.ToLocalTime(timeZone).ToString();
                }
                else
                {
                    lblUploadDate.Text = file.UploadDate.AddHours(TimeOffset).ToString();
                }

                SiteUser uploadUser = new SiteUser(siteSettings, file.UploadUserId);
                lblUploadBy.Text     = uploadUser.Name;
                lblFileSize.Text     = file.SizeInKB.ToString();
                txtFriendlyName.Text = file.FriendlyName;
                edDescription.Text   = file.Description;

                if (config.EnableVersioning)
                {
                    using (IDataReader reader = file.GetHistory())
                    {
                        grdHistory.DataSource = reader;
                        grdHistory.DataBind();
                    }
                }

                PopulateAllowedRolesList(cblRolesThatCanViewFile, file.ViewRoles);
            }
            else
            {
                pnlNotFound.Visible = true;
                pnlFolder.Visible   = false;
                pnlFile.Visible     = false;
            }
        }
コード例 #2
0
        private void PopulateFileControls()
        {
            Title = SiteUtils.FormatPageTitle(siteSettings, SharedFileResources.SharedFilesEditLabel);

            SharedFile file = new SharedFile(this.moduleId, this.itemId);

            if ((file.ItemId > 0) && (file.ModuleId == this.moduleId))
            {
                this.pnlNotFound.Visible = false;
                this.pnlFolder.Visible   = false;
                this.pnlFile.Visible     = true;

                using (IDataReader reader = SharedFileFolder.GetSharedModuleFolders(file.ModuleId))
                {
                    this.ddFolders.DataSource = reader;
                    this.ddFolders.DataBind();
                }
                this.ddFolders.Items.Insert(0, new ListItem("Root", "-1"));
                this.ddFolders.SelectedValue = file.FolderId.ToString();

                this.lblUploadDate.Text = file.UploadDate.AddHours(timeOffset).ToString();
                SiteUser uploadUser = new SiteUser(siteSettings, file.UploadUserId);
                this.lblUploadBy.Text     = uploadUser.Name;
                this.lblFileSize.Text     = file.SizeInKB.ToString();
                this.txtFriendlyName.Text = file.FriendlyName;
                edDescription.Text        = file.Description;

                using (IDataReader reader = file.GetHistory())
                {
                    grdHistory.DataSource = reader;
                    grdHistory.DataBind();
                }
            }
            else
            {
                pnlNotFound.Visible = true;
                pnlFolder.Visible   = false;
                pnlFile.Visible     = false;
            }
        }
コード例 #3
0
        private void PopulateFolderControls()
        {
            Title = SiteUtils.FormatPageTitle(siteSettings, SharedFileResources.SharedFilesEditFolderLabel);

            SharedFileFolder folder = new SharedFileFolder(this.moduleId, this.itemId);

            if ((folder.FolderId > 0) && (folder.ModuleId == this.moduleId))
            {
                this.pnlNotFound.Visible = false;
                this.pnlFile.Visible     = false;
                this.pnlFolder.Visible   = true;

                this.txtFolderName.Text = folder.FolderName;

                using (IDataReader reader = SharedFileFolder.GetSharedModuleFolders(folder.ModuleId))
                {
                    this.ddFolderList.DataSource = reader;
                    this.ddFolderList.DataBind();
                }
                this.ddFolderList.Items.Insert(0, new ListItem("Root", "-1"));
                this.ddFolderList.SelectedValue = folder.ParentId.ToString();

                // prevent a folder from being its own parent
                ListItem item = this.ddFolderList.Items.FindByText(folder.FolderName);
                if (item != null)
                {
                    this.ddFolderList.Items.Remove(item);
                }
            }
            else
            {
                this.pnlNotFound.Visible = true;
                this.pnlFolder.Visible   = false;
                this.pnlFile.Visible     = false;
            }
        }