示例#1
0
    private void Display_EditLibraryItem()
    {
        EditLibraryItemPanel.Visible = true;
        FolderData folder_data;
        PermissionData security_data;
        LibraryData library_data;
        librarytoolbar m_libraryToolBar;
        string strPath = "";
        string[] tmpAr;
        _Id = Convert.ToInt64(Request.QueryString["id"]);
        _FolderId = Convert.ToInt64(Request.QueryString["parent_id"]);
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);
        if (!(library_data == null))
        {
            _Type = library_data.Type;
        }
        else
        {
            //ErrorString = "Item not found -HC"
        }

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = _MessageHelper.GetMessage("generic Title");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        EditLibraryItemGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ID";
        colBound.HeaderText = _MessageHelper.GetMessage("generic ID");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        EditLibraryItemGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TYPE";
        if ((_Type == "files") || (_Type == "images"))
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic Filename");
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic URL Link");
        }
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        EditLibraryItemGrid.Columns.Add(colBound);

        if (_Type == "quicklinks")
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "CONTENTID";
            colBound.HeaderText = _MessageHelper.GetMessage("generic Content ID");
            colBound.ItemStyle.Wrap = false;
            colBound.HeaderStyle.CssClass = "title-header";
            colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
            colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            EditLibraryItemGrid.Columns.Add(colBound);
        }

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        dt.Columns.Add(new DataColumn("TYPE", typeof(string)));
        if (_Type == "quicklinks")
        {
            dt.Columns.Add(new DataColumn("CONTENTID", typeof(string)));
        }
        if (!(library_data == null))
        {
            dr = dt.NewRow();
            dr[0] = "<input type=\"text\" size=\"25\" maxlength=\"200\" name=\"frm_title\"  id=\"frm_title\" value=\"" + library_data.Title + "\" onkeypress = \"javascript:return CheckKeyValue(event, \'34,13\');\"/>";
            dr[1] = library_data.Id;

            if (_Type == "hyperlinks")
            {
                dr[2] = "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + library_data.FileName + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
            }
            else if (((_Type == "quicklinks") || (_Type == "forms")) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(library_data.ContentType, true) == false)) //   (library_data.FileName.IndexOf("javascript:void window.open") < 0) Then
            {
                if (folder_data.IsDomainFolder || folder_data.DomainProduction != "")
                {
                    tmpAr = library_data.FileName.Split(folder_data.DomainProduction.ToCharArray()[0]);
                    dr[2] = strPath + "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + tmpAr[1] + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                }
                else
                {
                    if (_SitePath == "/")
                    {
                        tmpAr = Strings.Split(library_data.FileName, _SitePath, 2, 0);
                    }
                    else
                    {
                        tmpAr = Strings.Split(library_data.FileName, _SitePath);
                    }

                    strPath = (string)(tmpAr[0] + _SitePath);
                    dr[2] = strPath + "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + tmpAr[1] + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                }
            }
            else
            {
                // dr(2) = library_data.FileName
                dr[2] += "<input type=\"text\" disabled=\"true\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + library_data.FileName + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
            }

            if (_Type == "quicklinks")
            {
                dr[3] = "<input type=\"hidden\" size=\"9\" maxlength=\"19\" name=\"frm_content_id\" value=\"" + library_data.ContentId + "\"/>" + library_data.ContentId;
            }
            else
            {
                dr[2] += "<input type=\"hidden\" name=\"frm_content_id\" value=\"\"/>";
            }
            dr[2] += "<input type=hidden name=frm_libtype id=frm_libtype value=\"" + _Type + "\"/>";
            dt.Rows.Add(dr);
        }

        DataView dv = new DataView(dt);
        EditLibraryItemGrid.DataSource = dv;
        EditLibraryItemGrid.DataBind();

        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.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.LibraryInfo = library_data;
        if (_Type != "quicklinks" && _Type != "forms")
        {
            editTabs.Visible = true;
            dvSummary.Attributes.Add("class", _SelectedDivStyleClass);
            bool bManagedAsset = false;
            ContentData content_data = null;
            ContentAPI m_refcontentapi = new ContentAPI();
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data;

            if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refcontentapi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refcontentapi.ContentLanguage = _ContentLanguage;
            }

            if (library_data.ContentId != 0)
            {
                content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);
            }
            if (!(content_data == null))
            {
                meta_data = content_data.MetaData;
                _ContentTeaser = content_data.Teaser;
                if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                {
                    bManagedAsset = true;
                }
            }
            else
            {
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            // Setting the titles for tabs
            EditdvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            EditdvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            EditdvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            RenderSummaryEditor();

            //Populating the category
            string Action = "Edit";
            PopulateCategory(Action);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)
                    {
                        if (m_refcontentapi.ContentLanguage != Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                        {
                            int v = 0;
                            ShowMeta.Text = CustomFields.WriteFilteredMetadataForEdit(meta_data, true, "update", _FolderId, ref v, null).ToString();

                            ShowTagEditArea(m_refcontentapi, library_data);
                        }
                        else
                        {
                            string strLink;
                            strLink = "<a href=\"library.aspx?LangType=" + meta_data[0].Language.ToString() + "&action=" + _PageAction + "&id=" + _Id + "&parent_id=" + _FolderId + "\">";
                            ShowMeta.Text = "<span style=\"COLOR: red\">*Note - Related metadata/tags will be displayed only if a specific language was selected. You may either go back to the page and select a language, or click " + strLink + "here</a> to view the metadata with the language selected automatically.</span>";
                        }
                    }

                }
            }
        }
    }
示例#2
0
    private void Display_AddLibraryItem()
    {
        FolderData folder_data = null;
        PermissionData security_data = null;
        LibraryData library_data = null;
        LibraryConfigData lib_setting_data = null;
        librarytoolbar m_libraryToolBar = null;
        //int i = 0;
        string Action = "add";
        EditLibraryItemPanel.Visible = true;

        //Id, FolderId differes in this action
        if (!string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            _Id = Convert.ToInt64(Request.QueryString["id"]);
        }
        if (!string.IsNullOrEmpty(Request.QueryString["folder"]))
        {
            _FolderId = Convert.ToInt64(Request.QueryString["folder"]);
        }
        if (_Type == "images" || _Type == "files")
        {
            LibraryItem.Enctype = "multipart/form-data";
        }

        if (!string.IsNullOrEmpty(Request.QueryString["operation"]))
        {
            _Operation = Request.QueryString["operation"].ToLower();
        }
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        if (_Operation == "overwrite")
        {
            library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);
        }
        lib_setting_data = _ContentApi.GetLibrarySettings(_FolderId);
        jsImageExtension.Text = lib_setting_data.ImageExtensions;
        jsFileExtension.Text = lib_setting_data.FileExtensions;
        if (security_data.CanAddToFileLib)
        {
            jsAddToFileLib.Text = "true";
        }
        else
        {
            jsAddToFileLib.Text = "true";
        }
        if (security_data.CanAddToImageLib)
        {
            jsAddToImageLib.Text = "true";
        }
        else
        {
            jsAddToImageLib.Text = "true";
        }
        frm_folder_id.Value = Convert.ToString(_FolderId);
        frm_libtype.Value = _Type;
        frm_operation.Value = _Operation;
        frm_library_id.Value = Convert.ToString(_Id);
        if (_Type == "images")
        {
            upload_directory.Value = lib_setting_data.ImageDirectory;
        }
        else if (_Type == "files")
        {
            upload_directory.Value = lib_setting_data.FileDirectory;
        }
        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.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.Operation = _Operation;
        AddLibraryItemPanel.Visible = true;

        tr1_td1_ali.InnerHtml = _MessageHelper.GetMessage("generic Title");
        if ((_Type == "files") || (_Type == "images"))
        {
            tr1_td2_ali.InnerHtml = _MessageHelper.GetMessage("generic Filename");
        }
        else
        {
            tr1_td2_ali.InnerHtml = _MessageHelper.GetMessage("generic URL Link");
        }
        if (_Type == "quicklinks")
        {
            tr1_td3_ali.InnerHtml = _MessageHelper.GetMessage("generic Content ID");
        }
        else
        {
            tr1_td3_ali.Visible = false;
        }
        if ((_Type == "quicklinks") || (_Type == "Forms"))
        {
            tr2_td3_ali.InnerHtml = "<input type=\"text\" style=\"width:75px\" size=\"9\" maxlength=\"19\" name=\"frm_content_id\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
        }
        else
        {
            tr2_td3_ali.InnerHtml = "<input type=\"hidden\" name=\"frm_content_id\" value=\"\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
            tr2_td3_ali.Attributes.Add("style", "display:none;");
        }

        if (_Operation == "overwrite")
        {
            tr2_td1_ali.InnerHtml = library_data.Title + "<input type=\"hidden\" size=\"25\" maxlength=\"200\" name=\"frm_title\" value=\"" + library_data.Title + "\"/>";
        }
        else
        {
            tr2_td1_ali.InnerHtml = "<input type=\"text\" size=\"15\" maxlength=\"200\" name=\"frm_title\"  id=\"frm_title\" onkeypress = \"javascript:return CheckKeyValue(event, \'34,13\');\"/>";
        }

        if (_Operation == "overwrite")
        {
            frm_oldfilename.Value = library_data.FileName;
            OverwriteSubPanel1.Visible = true;
            OverwriteSubPanel2.Visible = true;
            TD_filename.InnerHtml = "<input type=\"file\" size=\"40\" maxlength=\"255\" id=\"frm_filename\" name=\"frm_filename\"/>";
            tr2_td2_ali_controls.Text = library_data.FileName;
            if (library_data.Type == "images")
            {
                Overwrite_Image.ImageUrl = library_data.FileName.Replace(" ", "%20");
                Overwrite_Image.ImageUrl += "?id=" + EkFunctions.Random(1, 1000).ToString();
                Overwrite_Image.Visible = true;
            }
            else
            {
                Overwrite_link.Visible = true;
                Overwrite_link.Text = _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title;
                Overwrite_link.NavigateUrl = library_data.FileName;
                Overwrite_link.Target = "CurrentPreview";
                Overwrite_link.ToolTip = _MessageHelper.GetMessage("generic Preview title");
            }
            AddItemFocus.Text = "document.forms[0].frm_filename.focus();";
        }
        else
        {
            OverwriteSubPanel0.Visible = true;

            if (_Type == "hyperlinks")
            {
                tr2_td2_ali_controls.Text = "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"http://\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                frm_filename.Visible = false;
            }
            else if (_Type == "quicklinks")
            {
                tr2_td2_ali_controls.Text = "<span style=\"white-space:nowrap;\">" + _SitePath + "<input type=\"text\" size=\"" + (50 - Strings.Len(_SitePath)) + "\" maxlength=\"255\" name=\"frm_filename\" value=\"\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/></span>";
                frm_filename.Visible = false;
            }
            AddItemFocus.Text = "document.forms[0].frm_title.focus();";
        }

        if (_Type != "quicklinks" && _Type != "forms")
        {
            addTabs.Visible = false;
            editTabs.Visible = true;

            dvSummary.Attributes.Add("class", _SelectedDivStyleClass);
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data = null;
            ContentAPI m_refcontentapi = new ContentAPI();
            ContentData content_data = new ContentData();
            bool bManagedAsset = false;
            string ty = "";

            if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refcontentapi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refcontentapi.ContentLanguage = _ContentLanguage;
            }

            if (_Operation == "overwrite")
            {
                Action = "Edit";
                ty = "update";
                if (library_data.ContentId != 0)
                {
                    content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);

                    if (!(content_data == null))
                    {
                        meta_data = content_data.MetaData;
                        _ContentTeaser = content_data.Teaser;
                        if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                        {
                            bManagedAsset = true;
                        }
                    }
                    else
                    {
                        meta_data = m_refcontentapi.GetMetaDataTypes("id");
                    }
                }
            }
            else
            {
                if (_PageAction == "addlibraryitem")
                {
                    ty = "add";
                }
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            RenderSummaryEditor();
            // Setting the titles for tabs
            AdddvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            AdddvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            AdddvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            EditdvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            EditdvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            EditdvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            //Populating the category Tab

            PopulateCategory(Action);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)//  bManagedAsset)
                    {
                        int c = 0;
                        ShowMeta.Text = CustomFields.WriteFilteredMetadataForEdit(meta_data, true, ty, _FolderId, ref c, null).ToString();

                        ShowTagEditArea(m_refcontentapi, library_data);
                    }
                }
            }
        }
    }
示例#3
0
    private void Display_ViewLibraryItem()
    {
        ViewLibraryItemPanel.Visible = true;
        FolderData folder_data;
        PermissionData security_data;
        LibraryData library_data;
        librarytoolbar m_libraryToolBar;
        _Id = Convert.ToInt64(Request.QueryString["id"]);
        _FolderId = Convert.ToInt64(Request.QueryString["parent_id"]);
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);

        //StagingFileName property would be empty for non-multisite links and as well as when the site is not in Staging Mode
        if (library_data.StagingFileName == "")
        {
            library_data.StagingFileName = library_data.FileName;
        }

        if (!(library_data == null))
        {
            _Type = library_data.Type;
        }
        else
        {
            //ErrorString = "Item not found -HC"
        }

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.ItemStyle.CssClass = "label";
        ViewLibraryItemGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TEXT";
        System.Web.UI.WebControls.Unit percUnit;
        percUnit = System.Web.UI.WebControls.Unit.Percentage(95);
        colBound.HeaderStyle.Width = percUnit;
        ViewLibraryItemGrid.Columns.Add(colBound);
        percUnit = System.Web.UI.WebControls.Unit.Empty;

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("TEXT", typeof(string)));

        if (!(library_data == null))
        {
            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("generic title label") + "</span>";
            dr[1] = library_data.Title;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            if (library_data.Type == "quicklinks" || library_data.Type == "hyperlinks")
            {
                dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("url link label") + "</span>";
            }
            else
            {
                dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("filename label") + "</span>";
            }
            dr[1] = library_data.FileName;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("library id label") + "</span>";
            dr[1] = library_data.Id;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("parent folder label") + "</span>";
            dr[1] = library_data.FolderName;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content LUE label") + "</span>";
            dr[1] = library_data.EditorLastName + ", " + library_data.EditorFirstName;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content LED label") + "</span>";
            dr[1] = library_data.DisplayLastEditDate;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content DC label") + "</span>";
            dr[1] = library_data.DisplayDateCreated;

            dt.Rows.Add(dr);
        }
        // Don't tbind the data yet, may have teaser data to include...

        //SEARCH METADATA''''''''''''
        ContentData content_data = null;
        if (_Type != "quicklinks" && _Type != "forms")
        {
            bool bManagedAsset = false;

            ContentAPI m_refcontentapi = new ContentAPI();
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data;

            if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refcontentapi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refcontentapi.ContentLanguage = _ContentLanguage;
            }

            if (library_data.ContentId != 0)
            {
                content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);
            }
            if (!(content_data == null))
            {
                meta_data = content_data.MetaData;
                _ContentTeaser = content_data.Teaser;
                _ContentTeaser = _ContentTeaser.Replace("<p> </p>", string.Empty);
                if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                {
                    bManagedAsset = true;
                }
            }
            else
            {
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            // Add the Teaser-Data for this Library item:
            dr = dt.NewRow();
            dr[0] = _MessageHelper.GetMessage("description label");
            dr[1] = _ContentTeaser;
            dt.Rows.Add(dr);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)
                    {
                        //ViewLibraryMeta.Text = cFieldsO.WriteMetadataForView(meta_data).ToString
                        if (m_refcontentapi.ContentLanguage != Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                        {
                            ViewLibraryMeta.Text = CustomFields.WriteFilteredMetadataForView(meta_data, _FolderId, true).ToString();

                            // display tag info for this library item
                            System.Text.StringBuilder taghtml = new System.Text.StringBuilder();
                            taghtml.Append("<fieldset style=\"margin:10px\">");
                            taghtml.Append("<legend>" + _MessageHelper.GetMessage("lbl personal tags") + "</legend>");
                            taghtml.Append("<div style=\"height: 80px; overflow: auto;\" >");
                            if (library_data.Id > 0)
                            {
                                LocalizationAPI localizationApi = new LocalizationAPI();
                                TagData[] tdaUser;
                                tdaUser = (new Ektron.Cms.Community.TagsAPI()).GetTagsForObject(library_data.Id, EkEnumeration.CMSObjectTypes.Library, m_refcontentapi.ContentLanguage);

                                if (tdaUser != null && tdaUser.Length > 0)
                                {

                                    foreach (TagData td in tdaUser)
                                    {
                                        taghtml.Append("<input disabled=\"disabled\" checked=\"checked\" type=\"checkbox\" id=\"userPTagsCbx_" + td.Id.ToString() + "\" name=\"userPTagsCbx_" + td.Id.ToString() + "\" />&#160;");
                                        taghtml.Append("<img src=\'" + localizationApi.GetFlagUrlByLanguageID(td.LanguageId) + "\' />");
                                        taghtml.Append("&#160;" + td.Text + "<br />");
                                    }
                                }
                                else
                                {
                                    taghtml.Append(_MessageHelper.GetMessage("lbl notagsselected"));
                                }
                            }
                            taghtml.Append("</div>");
                            taghtml.Append("</fieldset>");
                            ViewLibraryTags.Text = taghtml.ToString();
                        }
                        else
                        {
                            string strLink;
                            strLink = "<a href=\"library.aspx?LangType=" + meta_data[0].Language.ToString() + "&action=" + _PageAction + "&id=" + _Id + "&parent_id=" + _FolderId + "\">";
                            ViewLibraryMeta.Text = "<span style=\"COLOR: red\">*Note - Related metadata/tags will be displayed only if a specific language was selected on the previous page. You may either go back to the previous page to select a language, or click " + strLink + "here</a> to view the metadata with the language selected automatically.</span>";
                        }
                    }
                }
            }
        }
        ///'''''''''''''''''''''''''

        //Binding the Taxonomy
        if (_Type != "quicklinks" && _Type != "forms")
        {
            if (library_data.ContentId != 0)
            {
                TaxonomyBaseData[] data = null;
                ContentAPI m_refcontentapi = new ContentAPI();
                Ektron.Cms.Content.EkContent cref;
                cref = m_refcontentapi.EkContentRef;
                data = cref.ReadAllAssignedCategory(library_data.ContentId);
                ViewTaxonomy.Text = "<fieldset style=\"margin: 10px;\"><legend>Category</legend>";
                ViewTaxonomy.Text += "<table width=\"100%\">";
                ViewTaxonomy.Text += "<tr><td>";
                if ((data != null) && data.Length > 0)
                {
                    foreach (TaxonomyBaseData tax_data in data)
                    {
                        ViewTaxonomy.Text = ViewTaxonomy.Text + "<li>" + tax_data.TaxonomyPath.Remove(0, 1).Replace("\\", ">") + "</li>";
                    }
                }
                else
                {
                    ViewTaxonomy.Text += _MessageHelper.GetMessage("lbl nocatselected");
                }
                ViewTaxonomy.Text += "</td>" + "</tr>" + "</table>" + "</fieldset>";
            }
        }

        // now bind data, possibly with teaser:
        DataView dv = new DataView(dt);
        ViewLibraryItemGrid.DataSource = dv;
        ViewLibraryItemGrid.DataBind();

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "LINK";
        colBound.HeaderStyle.Width = Unit.Empty;
        colBound.HeaderStyle.Height = Unit.Empty;
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        ViewLibraryItemLinkGrid.Columns.Add(colBound);
        ViewLibraryItemLinkGrid.BorderColor = System.Drawing.Color.White;
        dt = new DataTable();
        dt.Columns.Add(new DataColumn("LINK", typeof(string)));

        if (!(library_data == null))
        {
            library_data.FileName = Server.HtmlDecode(library_data.FileName);
            if (library_data.TypeId == 1 || library_data.TypeId == 2)
            {
                library_data.FileName = library_data.FileName.Replace("%", "%25");
                library_data.FileName = library_data.FileName.Replace("#", "%23");
                library_data.FileName = library_data.FileName.Replace("$", "%24");
                library_data.FileName = library_data.FileName.Replace("&", "%26");
                library_data.FileName = library_data.FileName.Replace("^", "%5E");
            }

            dr = dt.NewRow();
            if (library_data.Type == "images")
            {
                Random r = new Random(System.DateTime.Now.Millisecond);
                if (content_data != null)
                {
                    if (content_data.AssetData.Id != "" && content_data.Status == "I")
                    {
                        dr[0] = content_data.Html;
                    }
                    else
                    {
                        dr[0] = "<img src=\"" + library_data.StagingFileName.Replace(" ", "%20") + "?n=" + r.Next(1, 5000) + "\">";
                    }
                }
                else
                {
                    dr[0] = "<img src=\"" + library_data.FileName.Replace(" ", "%20") + "?n=" + r.Next(1, 5000) + "\">";
                }

            }
            else if (library_data.Type == "quicklinks")
            {
                if (Ektron.Cms.Common.EkConstants.IsAssetContentType(library_data.ContentType, true) && library_data.ContentType != Ektron.Cms.Common.EkConstants.CMSContentType_Media)
                {
                    if ((library_data.FileName.ToString().ToLower().IndexOf("javascript:") == -1) && library_data.FileName.ToString().ToLower().IndexOf("downloadasset.aspx") == -1)
                    {
                        library_data.FileName = this._SiteApi.SitePath + library_data.FileName;
                    }
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "&LangType=" + library_data.LanguageId + "\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
                else if ((library_data.FileName.IndexOf("?") + 1) > 0)
                {
                    if (library_data.FileName.ToString().ToLower().IndexOf("downloadasset.aspx") > -1)
                    {
                        dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "&LangType=" + library_data.LanguageId + "\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                    }
                    else
                    {
                        dr[0] = "<a href=\"" + ((library_data.StagingFileName.Replace(" ", "%20").StartsWith(_SitePath)) ? (library_data.StagingFileName.Replace(" ", "%20")) : (((library_data.StagingFileName.Substring(0, 7) != "http://") && (library_data.StagingFileName.Substring(0, 8) != "https://")) ? _SitePath + library_data.StagingFileName.Replace(" ", "%20") : library_data.StagingFileName.Replace(" ", "%20"))) + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                    }
                }
                else
                {
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
            }
            else if (library_data.Type == "forms")
            {
                if ((library_data.FileName.IndexOf("?") + 1) > 0)
                {
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
                else
                {
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
            }
            else if ((library_data.Type == "hyperlinks") && (!library_data.FileName.Contains("http://")) && (!library_data.FileName.Contains("https://")))
            {
                dr[0] = "<a href=\"" + library_data.FileName.Replace(" ", "%20") + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
            }
            else
            {

                dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";

            }
            dt.Rows.Add(dr);
        }

        dv = new DataView(dt);
        ViewLibraryItemLinkGrid.DataSource = dv;
        ViewLibraryItemLinkGrid.DataBind();

        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.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.ContentType = library_data.ContentType;
        m_libraryToolBar.LibraryInfo = library_data;
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        refContentAPI = new ContentAPI();
        refEkContent = refContentAPI.EkContentRef;
        refEkSite = refContentAPI.EkSiteRef;
        ContentMetaData[] metaData = null;
        Ektron.Cms.ContentData originalContent = null;

        ltrEnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea();
        if (ContentID != 0)
        {
            originalContent = refContentAPI.GetContentById(this.ContentID, ResultType);
            if (resultType == ContentAPI.ContentResultType.Staged && originalContent == null)
            {
                originalContent = refContentAPI.GetContentById(this.ContentID, ContentAPI.ContentResultType.Published);
            }
            if (originalContent.FolderId == FolderID)
            {
                metaData = originalContent.MetaData;
            }
        }
        if(metaData == null){
            metaData = refContentAPI.GetMetaDataTypes("id");
        }

        int validCounter = 0;

        if (originalContent != null || ContentID == 0)
        {
            foreach (ContentMetaData cMeta in metaData)
            {
                if (cMeta.Type.ToString() == "ImageSelector")
                {
                    cMeta.Text = cMeta.Text.Replace(SitePath + "assets/", "");
                    cMeta.Text = System.Text.RegularExpressions.Regex.Replace(cMeta.Text, "\\?.*", "");
                }
            }

            StringBuilder sbMetadata = Ektron.Cms.CustomFields.WriteFilteredMetadataForEdit(
                metaData,
                false,
                MetaUpdateString,
                this.FolderID,
                ref validCounter,
                refEkSite.GetPermissions(this.FolderID, 0, "folder"));

            if (!String.IsNullOrEmpty(sbMetadata.ToString()))
            {
                ltrMetadataHTML.Text = sbMetadata.ToString();
                if (sbMetadata.ToString().Contains("<span style=\"color:red\">"))
                   MetadataRequired =  metadataRequired = true;
            }
            else
            {
                ltrMetadataHTML.Text = "<span>"+siteAPI.EkMsgRef.GetMessage("lbl no metadata associated")+"</span>";
            }
        }

        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/jfunct.js", "CommunityJFunctJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/metadata_selectlist.js", "CommunityMetadataSelectListJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/searchfuncsupport.js", "CommunitySearchFuncSupportJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/internCalendarDisplayFuncs.js", "CommunityInternCalendarDisplayFuncsJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/metadata_associations.js", "CommunityMetadataAssociationsJS");
        Ektron.Cms.API.JS.RegisterJSInclude(this, refContentAPI.AppPath + "java/optiontransfer.js", "CommunityOptionTransferJS");

        Ektron.Cms.API.JS.RegisterJSBlock(this, "window.ek_ma_ForceNewWindow = " + ForceNewWindow.ToString().ToLower(), "ek_ma_ForceNewWindow");
    }
示例#5
0
    private StringBuilder CaptureMetadata(long contentId, long folderId)
    {
        StringBuilder metadataOutput = new StringBuilder();
        ContentAPI myContentAPI = new ContentAPI();
        ContentData myContentEditData = new ContentData();
        ContentMetaData[] myContentMetadata;
        string myType = "update";
        int myCounter = 0;
        Ektron.Cms.Site.EkSite myEkSite = new Ektron.Cms.Site.EkSite();

        int ContentLanguage = EkConstants.CONTENT_LANGUAGES_UNDEFINED;

        if (Page.Request.QueryString["LangType"] != null)
        {
            if (Page.Request.QueryString["LangType"] != "")
            {
                ContentLanguage = Convert.ToInt32(Page.Request.QueryString["LangType"]);
                myContentAPI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
            }
            else
            {
                if (myContentAPI.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = Convert.ToInt32(myContentAPI.GetCookieValue("LastValidLanguageID"));
                }
            }
        }
        else
        {
            if (myContentAPI.GetCookieValue("LastValidLanguageID") != "")
            {
                ContentLanguage = Convert.ToInt32(myContentAPI.GetCookieValue("LastValidLanguageID"));
            }
        }

        if (ContentLanguage == EkConstants.CONTENT_LANGUAGES_UNDEFINED)
        {
            myContentAPI.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES;
        }
        else
        {
            myContentAPI.ContentLanguage = ContentLanguage;
        }

        if (contentId != -1)
        {
            myEkSite = myContentAPI.EkSiteRef;
            myContentEditData = myContentAPI.GetContentById(contentId, 0);
            myContentMetadata = myContentEditData.MetaData;

            if (myContentMetadata.Length > 0)
            {
                metadataOutput = Ektron.Cms.CustomFields.WriteFilteredMetadataForEdit(myContentMetadata, false, myType, folderId, ref myCounter, myEkSite.GetPermissions(folderId, 0, "folder"));
                if (metadataOutput.Length > 0)
                {
                    ltrShowMetadata.Text = "<li><a id=\"metadataAnchor\" href=\"#\" onclick=\"dmsMetadataShowHideCategory(\'metadata\');return false;\" title=\"View Metadata\" class=\"selected\">" + myContentAPI.EkMsgRef.GetMessage("metadata text") + "</a></li>";
                }
            }
        }

        return metadataOutput;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        contentAPI = new ContentAPI();
        ekContent = contentAPI.EkContentRef;
        messageHelper = contentAPI.EkMsgRef;

        distributionMode = DistributionWizardHelperMethods.GetModeFromQueryString(Request);

        switch (distributionMode)
        {
            case DistributionWizardEnumerations.Mode.CommunityCopy:
                if (ParseCommunityCopyParameters())
                {
                    long distributionFolderID = (long)Session[DistributionWizardConstants.SESSION_PARAM_DEST_FOLDER_ID];
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_ORIG_CONTENT_ID];

                    ContentData content = contentAPI.GetContentById(
                        distributionContentID,
                        ContentAPI.ContentResultType.Published);

                    if (content != null)
                    {
                        int distributionLanguageID = content.LanguageId;
                        DisplayCommunityCopyMode(content, distributionFolderID);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;
            case DistributionWizardEnumerations.Mode.CommunityRedistribute:
                if (ParseCommunityRedistributeParameters())
                {
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_DEST_CONTENT_ID];

                    ContentData content = null;

                    try
                    {
                        content = contentAPI.GetContentById(
                            distributionContentID,
                            ContentAPI.ContentResultType.Published);
                    }
                    catch
                    {
                        // Exception likely occurred due to the user not being logged in.
                        // Unfortunately, ContentAPI.IsLoggedIn is not reliable enough (still
                        // returns true if user is user is logged out from a different client)
                        // to check in this case.
                    }

                    if (content != null)
                    {
                        long distributionFolderID = content.FolderId;
                        long distributionLanguageID = content.LanguageId;
                        DisplayCommunityRedistributeMode(content, content.FolderId);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;

            case DistributionWizardEnumerations.Mode.CommunityReplace:
                if (ParseCommunityReplaceParameters())
                {
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_DEST_CONTENT_ID];

                    ContentData content = contentAPI.GetContentById(
                        distributionContentID,
                        ContentAPI.ContentResultType.Published);

                    if (content != null)
                    {
                        long distributionFolderID = content.FolderId;
                        long distributionLanguageID = content.LanguageId;
                        DisplayCommunityReplaceMode(content, content.FolderId);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;
            case DistributionWizardEnumerations.Mode.Sharepoint:
                if (ParseSharepointParameters())
                {
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_SHAREPOINT_CONTENT_ID];

                    ContentData content = contentAPI.GetContentById(
                        distributionContentID,
                        ContentAPI.ContentResultType.Published);

                    if (content != null)
                    {
                        long distributionFolderID = content.FolderId;
                        int distributionLanguageID = content.LanguageId;

                        DisplaySharepointMode(content, distributionFolderID);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;
            case DistributionWizardEnumerations.Mode.SharepointRedistribute:
                if (ParseSharepointParameters())
                {
                    long distributionContentID = (long)Session[DistributionWizardConstants.SESSION_PARAM_SHAREPOINT_CONTENT_ID];

                    ContentData content = null;

                    try
                    {
                        content = contentAPI.GetContentById(
                            distributionContentID,
                            ContentAPI.ContentResultType.Published);
                    }
                    catch
                    {
                        // Exception likely occurred due to the user not being logged in.
                        // Unfortunately, ContentAPI.IsLoggedIn is not reliable enough (still
                        // returns true if user is user is logged out from a different client)
                        // to check in this case.
                    }

                    if (content != null)
                    {
                        long distributionFolderID = content.FolderId;
                        int distributionLanguageID = content.LanguageId;

                        DisplaySharepointMode(content, distributionFolderID);
                    }
                    else
                    {
                        DisplayErrorMessage(
                            messageHelper.GetMessage("distribution wizard required parameters"),
                            true);
                    }
                }
                else
                {
                    DisplayErrorMessage(
                        messageHelper.GetMessage("distribution wizard required parameters"),
                        true);
                }
                break;
        }

        RegisterStylesheets();
    }