コード例 #1
0
ファイル: library.aspx.cs プロジェクト: jaytem/minGit
    private void Display_UpdateQlinkTemplateByCategory()
    {
        hdnIsPostBack.Value = "false";

        //FormAction = "LangType=" & m_intContentLanguage & "&action=DoUpdateQlinkTemplateByCategory"
        //SetPostBackPage()
        FolderData folder_data;
        PermissionData security_data;
        LibraryData[] library_data;
        librarytoolbar m_libraryToolBar;
        int i = 0;

        _FolderId = Convert.ToInt64(Request.QueryString["id"]);
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        _CurrentPageNumber = System.Convert.ToInt32(this.uxPagingUpdateLink.SelectedPage);

        library_data = _ContentApi.GetAllChildLibItemsByType(_Type, _FolderId, _OrderBy, System.Convert.ToInt32(_CurrentPageNumber + 1), m_refcontentapi.RequestInformationRef.PagingSize, ref _TotalPagesNumber);

        //Fix for Assets in a multisite enviroment [workarea/library.aspx.vb]
        Microsoft.VisualBasic.Collection fCol = new Microsoft.VisualBasic.Collection();
        Ektron.Cms.API.Folder fapi = new Ektron.Cms.API.Folder();
        Ektron.Cms.FolderData[] fdata;
        Ektron.Cms.Content.EkContent m_refContent;
        ContentAPI m_refContentApi = new ContentAPI();

        m_refContent = m_refContentApi.EkContentRef;

        fdata = m_refContentApi.GetChildFolders(0, false, EkEnumeration.FolderOrderBy.Name);
        if (fdata != null)
        {
            foreach (FolderData thisfdata in fdata)
            {
                if (thisfdata.FolderType == 2)
                {
                    fCol = m_refContent.GetFolderInfov2_0(thisfdata.Id);
                    foreach (LibraryData thisresult in library_data)
                    {
                        thisresult.FileName = Regex.Replace(thisresult.FileName, "http://" + fCol["DomainProduction"] + "javascript", "javascript");
                    }
                }
            }
        }
        //End fix for multisite and Assets

        m_libraryToolBar = (librarytoolbar)(LoadControl("controls/library/librarytoolbar.ascx"));
        ToolBarHolder.Controls.Add(m_libraryToolBar);
        m_libraryToolBar.AppImgPath = _AppImgPath;
        m_libraryToolBar.PageAction = _PageAction;
        m_libraryToolBar.FolderInfo = folder_data;
        m_libraryToolBar.SecurityInfo = security_data;
        m_libraryToolBar.FolderId = _FolderId;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.LibType = _Type;
        UpdateQlinkTemplateByCategoryPanel.Visible = true;

        qlinkfrom.InnerHtml = _SitePath + "<input type=\"textbox\" size=\"50\" maxlength=\"255\" value=\"" + folder_data.TemplateFileName + "\" name=\"template_from\"/>";
        qlinkto.InnerHtml = _SitePath + "<input type=\"textbox\" size=\"50\" maxlength=\"255\" value=\"" + folder_data.TemplateFileName + "\" name=\"template_to\"/>";

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "CHECK";
        colBound.HeaderText = "<input type=\"checkbox\" name=\"all\" onclick=\"javascript:checkAll(document.forms[0].all.checked);\"/>";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.HeaderStyle.CssClass = "title-header";
        QlinkTemplateByCategoryGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = "<a href=\"library.aspx?LangType=" + _ContentLanguage + "&action=ViewLibraryByCategory&orderby=LibraryTitle&id=" + _FolderId + "&type=" + _Type + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">" + _MessageHelper.GetMessage("generic Title") + "</a>";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.HeaderStyle.CssClass = "title-header";
        QlinkTemplateByCategoryGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ID";
        colBound.HeaderText = "<a href=\"library.aspx?LangType=" + _ContentLanguage + "&action=ViewLibraryByCategory&orderby=LibraryID&id=" + _FolderId + "&type=" + _Type + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">" + _MessageHelper.GetMessage("generic ID") + "</a>";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.HeaderStyle.CssClass = "title-header";
        QlinkTemplateByCategoryGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DATEMODIFIED";
        colBound.HeaderText = "<a href=\"library.aspx?LangType=" + _ContentLanguage + "&action=ViewLibraryByCategory&orderby=date&id=" + _FolderId + "&type=" + _Type + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">" + _MessageHelper.GetMessage("generic Date Modified") + "</a>";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.HeaderStyle.CssClass = "title-header";
        QlinkTemplateByCategoryGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "FILENAME";
        colBound.HeaderText = "<a href=\"library.aspx?LangType=" + _ContentLanguage + "&action=ViewLibraryByCategory&orderby=LibraryFilename&id=" + _FolderId + "&type=" + _Type + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">" + _MessageHelper.GetMessage("generic URL Link") + "</a>";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.HeaderStyle.CssClass = "title-header";
        QlinkTemplateByCategoryGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "CONTENTID";
        colBound.HeaderText = "<a href=\"library.aspx?LangType=" + _ContentLanguage + "&action=ViewLibraryByCategory&orderby=ContentID&id=" + _FolderId + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">" + _MessageHelper.GetMessage("generic Content ID") + "</a>";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.HeaderStyle.CssClass = "title-header";
        QlinkTemplateByCategoryGrid.Columns.Add(colBound);

        QlinkTemplateByCategoryGrid.BorderColor = System.Drawing.Color.White;

        DataTable dt = new DataTable();
        DataRow dr;
        //int intItemLanguage = -1;
        dt.Columns.Add(new DataColumn("CHECK", typeof(string)));
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        dt.Columns.Add(new DataColumn("DATEMODIFIED", typeof(string)));
        dt.Columns.Add(new DataColumn("FILENAME", typeof(string)));
        dt.Columns.Add(new DataColumn("CONTENTID", typeof(string)));

        if (!(library_data == null))
        {
            string strLibIds = "";
            for (i = 0; i <= library_data.Length - 1; i++)
            {
                strLibIds = strLibIds + library_data[i].Id + ",";
                dr = dt.NewRow();
                dr[0] = "<input type=\"checkbox\" name=\"id_" + library_data[i].Id + "\"/>";
                dr[1] = "<a href=\"library.aspx?LangType=" + _ContentLanguage + "&action=ViewLibraryItem&id=" + library_data[i].Id + "&parent_id=" + _FolderId + "\" title=\'" + _MessageHelper.GetMessage("generic View") + " \"" + Strings.Replace(library_data[i].Title, "\'", "`", 1, -1, 0) + "\"" + "\'>" + library_data[i].Title + "</a>";
                dr[2] = library_data[i].Id;
                dr[3] = library_data[i].DisplayLastEditDate;
                dr[4] = library_data[i].FileName;
                dr[5] = library_data[i].ContentId;
                dt.Rows.Add(dr);
            }
            if (strLibIds != "")
            {
                strLibIds = strLibIds.Substring(0, strLibIds.Length - 1);
            }
            libids.Value = strLibIds;
        }
        folder_id.Value = Convert.ToString(_FolderId);
        DataView dv = new DataView(dt);
        QlinkTemplateByCategoryGrid.DataSource = dv;
        QlinkTemplateByCategoryGrid.DataBind();

        if (_TotalPagesNumber > 1)
        {
            this.uxPagingUpdateLink.TotalPages = _TotalPagesNumber;
            this.uxPagingUpdateLink.CurrentPageIndex = _CurrentPageNumber;
        }
        else
        {
            this.uxPagingUpdateLink.Visible = false;
        }
    }