Ejemplo n.º 1
0
    private void Display_MetadataTab(EntryData versionData)
    {
        StringBuilder sbAttrib = new StringBuilder();
            StringBuilder sbResult = new StringBuilder();
            string strResult;
            string strAttrResult;
            string strImage = "";
            ProductTypeApi prod_type_API = new ProductTypeApi();
            ProductTypeData prod_type_data = null;

            EnhancedMetadataScript.Text = CustomFields.GetEnhancedMetadataScript().Replace("src=\"java/", "src=\"../java/");
            EnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea();

            if (prod_type_data == null)
            {
                prod_type_data = prod_type_API.GetItem(versionData.ProductType.Id);
            }

            if (versionData.Metadata.Count > 0 || prod_type_data.Attributes.Count > 0)
            {

                m_refSite = new Ektron.Cms.Site.EkSite(this.m_refContentApi.RequestInformationRef);
                Hashtable hPerm = m_refSite.GetPermissions(m_iFolder, 0, "folder");
                sbResult.Append(Ektron.Cms.CustomFields.WriteFilteredMetadataForView(versionData.Metadata.ToArray(), versionData.FolderId, false).Trim());
                if (prod_type_data != null)
                {
                    sbAttrib.Append(CustomFields.WriteFilteredAttributesForView(versionData.Attributes, prod_type_data.Id, false,prod_type_data.Attributes));
                }

            }

            if (m_sEditAction == "update")
            {
                strImage = versionData.Image;
                string strThumbnailPath = versionData.ImageThumbnail;
                if (versionData.ImageThumbnail == "")
                {
                    strThumbnailPath = m_refContentApi.AppImgPath + "spacer.gif";
                }
                else if (catalog_data.IsDomainFolder == true)
                {

                }
                else
                {
                    strThumbnailPath = m_refContentApi.SitePath + strThumbnailPath;
                }
                sbResult.Append("<fieldset><legend>Image Data:</legend><table><tr><td class=\"label\" align=\"left\">Image:</td><td><span id=\"sitepath\"" + this.m_refContentApi.SitePath + "</span><input type=\"textbox\" size=\"30\" readonly=\"true\" id=\"content_image\" name=\"content_image\" value=\"" + strImage + "\" /></td></tr><tr><td colomnspan=\"2\"><img id=\"content_image_thumb\" src=\"" + strThumbnailPath + "\" /></td></tr></table></fieldset>");
            }
            else
            {
                sbResult.Append("<fieldset><legend>Image Data:</legend><table><tr><td class=\"label\" align=\"left\">Image:</td><td><span id=\"sitepath\"" + this.m_refContentApi.SitePath + "</span><input type=\"textbox\" size=\"30\" readonly=\"true\" id=\"content_image\" name=\"content_image\" value=\"" + strImage + "\" /></td></tr><tr><td colomnspan=\"2\"><img id=\"content_image_thumb\" src=\"" + m_refContentApi.AppImgPath + "spacer.gif\" /></td></tr></table></fieldset>");
            }
            strAttrResult = (string) (sbAttrib.ToString().Trim());
            strResult = sbResult.ToString().Trim();
            strResult = Util_FixPath(strResult);

            MetaDataValue.Text = strResult;
            ltr_attrib.Text = strAttrResult;
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        RegisterResources();

        Collection cFolders = null;
        long subfolderid = -1;
        long locID = -1;
        long backID = -1;
        Collection cRecursive = null;
        bool rec = false;
        bool CanCreateContent = false;
        string AddType = "";
        string MenuTitle = "";
        string CachedId = "";
        bool canTraverse = true;

        CurrentUserID = AppUI.UserId;
        AppImgPath = AppUI.AppImgPath;
        AppPath = AppUI.AppPath;
        sitePath = AppUI.SitePath;
        MsgHelper = AppUI.EkMsgRef;

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

        folderId = Convert.ToInt64(Request.QueryString["folderid"]);
        mpID = Convert.ToInt64(Request.QueryString["parentid"]);
        maID = Convert.ToInt64(Request.QueryString["ancestorid"]);
        if (!string.IsNullOrEmpty(Request.QueryString["SelTaxonomyID"]))
        {
            selTaxID = Convert.ToInt64(Request.QueryString["SelTaxonomyID"]);
        }

        if (CommonApi.GetEcmCookie().HasKeys)
        {
            CurrentUserID = Convert.ToInt64(CommonApi.GetEcmCookie()["user_id"]);
        }
        else
        {
            CurrentUserID = 0;
        }

        AddType = Strings.LCase(Request.QueryString["addto"]);
        if (string.IsNullOrEmpty(AddType))
        {
            AddType = "collection";
        }
        nID = Convert.ToInt64(Request.QueryString["nid"]);
        subfolderid = Convert.ToInt64(Request.QueryString["subfolderid"]);
        if ( !string.IsNullOrEmpty(Request.QueryString["cacheidentifier"]))
        {
            CachedId = "&cacheidentifier=" + Request.QueryString["cacheidentifier"];
        }
        if (subfolderid > 0)
        {
            locID = subfolderid;
        }
        else
        {
            locID = folderId;
        }

        gtObj = AppUI.EkContentRef;
        SiteObj = AppUI.EkSiteRef;
        cPerms = SiteObj.GetPermissions(locID, 0, "folder");
        canTraverse = Convert.ToBoolean(cPerms["TransverseFolder"]);
        if (ErrorString != "")
        {
            CanCreateContent = false;
        } else
        {
            CanCreateContent = Convert.ToBoolean(cPerms["Add"]);
        }

        if (AddType == "menu" || AddType == "submenu")
        {
            cRecursive = gtObj.GetMenuByID(nID, 0,false);
            if (string.IsNullOrEmpty(ErrorString))
            {
                if (cRecursive.Count > 0)
                {
                    MenuTitle = cRecursive["MenuTitle"].ToString();
                    rec = Convert.ToBoolean(cRecursive["Recursive"]);
                }
            }
        }
        else
        {
            cRecursive = gtObj.GetEcmCollectionByID(nID, false, false, ref ErrorString, true, false, true);
            if (string.IsNullOrEmpty(ErrorString))
            {
                if (cRecursive.Count > 0)
                {
                    CollectionTitle = cRecursive["CollectionTitle"].ToString();
                    rec = Convert.ToBoolean(cRecursive["Recursive"]);
                }
            }
            else
            {
                pnlError.Visible = true;
                pnlPage.Visible = false;
            }
        }
        if (!canTraverse)
        {
            rec = false;
        }
        if (rec && ErrorString == "")
        {
            cTmp = new Collection();
            cTmp.Add(Convert.ToInt64(locID), "ParentID",null,null);
            cTmp.Add("name", "OrderBy",null,null);
            cFolders = gtObj.GetAllViewableChildFoldersv2_0(cTmp);
        }
        if (ErrorString == "")
        {
            gtNavs = gtObj.GetFolderInfov2_0(locID);

            if(gtNavs.Count > 0)
            {
                FolderName = gtNavs["FolderName"].ToString();
                backID = Convert.ToInt64(gtNavs["ParentID"]);
            }

        }
        StringBuilder sb = new StringBuilder();
        //ToolBar
        sb.Append("<table width=\"100%\">").Append(Environment.NewLine);
        if(rec)
        {
            if(locID != 0)
            {
                sb.Append("<tr>").Append(Environment.NewLine);
                sb.Append("  <td>").Append(Environment.NewLine);
                sb.Append("     <a href=\"collectiontree.aspx?nId=").Append(nID).Append("&folderid=").Append(folderId).Append("&subfolderid=").Append(backID).Append("&addto=").Append(AddType).Append("&parentid=").Append(mpID).Append("&ancestorid=").Append(maID).Append("&SelTaxonomyID=").Append(selTaxID).Append("\" ").Append(Environment.NewLine);
                sb.Append("         title=\"").Append(MsgHelper.GetMessage("alt: generic previous dir text")).Append("\" > ").Append(Environment.NewLine);
                sb.Append("        <img src=\"").Append(AppPath + "images/UI/Icons/folderUp.png").Append("\" title=\"").Append(MsgHelper.GetMessage("alt: generic previous dir text")).Append("\"  alt=\"").Append(MsgHelper.GetMessage("alt: generic previous dir text")).Append("\" align=\"absbottom\"/>..").Append(Environment.NewLine);
                sb.Append("     </a>").Append(Environment.NewLine);
                sb.Append("  </td>").Append(Environment.NewLine);
                sb.Append("  <td>&nbsp;</td>").Append(Environment.NewLine);
                sb.Append("  <td>&nbsp;</td>").Append(Environment.NewLine);
                sb.Append("</tr>").Append(Environment.NewLine);
           }

            foreach( Collection folder in cFolders)
            {
                if(Convert.ToInt32(folder["FolderType"]) <= 1)
                {
                    sb.Append("<tr>").Append(Environment.NewLine);
                    sb.Append("    <td nowrap=\"true\">").Append(Environment.NewLine);
                    sb.Append("         <a href=\"collectiontree.aspx?nId=").Append(nID).Append("&folderid=").Append(folderId).Append("&subfolderid=").Append(folder["ID"]).Append("&addto=").Append(AddType).Append("&parentid=").Append(mpID).Append("&ancestorid=").Append(maID).Append("&SelTaxonomyID=").Append(selTaxID).Append("\" ").Append(Environment.NewLine);
                    sb.Append("           title=\"").Append(MsgHelper.GetMessage("alt: generic view folder content text")).Append("\">").Append(Environment.NewLine);
                    sb.Append("         <img src=\"").Append(AppImgPath).Append(Convert.ToInt32(folder["FolderType"]) == 1 ? "folders/blogfolderopen.gif": "folderclosed_1.gif").Append("\" title=\"").Append(MsgHelper.GetMessage("alt: generic view folder content text")).Append("\" alt=\"").Append(MsgHelper.GetMessage("alt: generic view folder content text")).Append("\" align=\"absbottom\"/>").Append(folder["Name"]).Append(Environment.NewLine);
                    sb.Append("     </a>").Append(Environment.NewLine);
                    sb.Append("  </td>").Append(Environment.NewLine);
                    sb.Append("  <td>&nbsp;</td>").Append(Environment.NewLine);
                    sb.Append("  <td>&nbsp;</td>").Append(Environment.NewLine);
                    sb.Append("</tr>").Append(Environment.NewLine);
                }
            }
        }

         sb.Append("<tr>").Append(Environment.NewLine);
         sb.Append("    <td align=\"center\" colspan=\"3\">").Append(Environment.NewLine);
         sb.Append("       <hr/>").Append(Environment.NewLine);
         sb.Append("    </td>").Append(Environment.NewLine);
         sb.Append("</tr>").Append(Environment.NewLine);

          sb.Append("<tr>").Append(Environment.NewLine);
         sb.Append("    <td align=\"center\" colspan=\"3\">").Append(Environment.NewLine);
         sb.Append("       First Pick the folder").Append(Environment.NewLine);
         sb.Append("    </td>").Append(Environment.NewLine);
         sb.Append("</tr>").Append(Environment.NewLine);

         sb.Append("<tr>").Append(Environment.NewLine);
         sb.Append("    <td align=\"center\" colspan=\"3\">").Append(Environment.NewLine);
         if(AddType == "submenu")
             sb.Append("    <input name=\"next\" type=\"button\" value=\"Next...\" onclick=\"javascript:location.href='collections.aspx?action=AddSubMenu&LangType=").Append(ContentLanguage).Append("&folderid=").Append(locID).Append("&nId=").Append(nID).Append("&parentid=").Append(mpID).Append("&ancestorid=").Append(maID).Append("&SelTaxonomyID=").Append(selTaxID).Append("'\" />").Append(Environment.NewLine);
         else
             sb.Append("    <input name=\"next\" type=\"button\" value=\"Next...\" onclick=\"javascript:location.href='editarea.aspx?LangType=").Append(ContentLanguage).Append("&type=add&id=").Append(locID).Append("&SelTaxonomyID=").Append(selTaxID).Append("&mycollection=").Append(nID).Append("&addto=").Append(AddType).Append(CachedId).Append("'\" />").Append(Environment.NewLine);
         sb.Append("    </td>").Append(Environment.NewLine);
         sb.Append("</tr>").Append(Environment.NewLine);

         sb.Append("</table>").Append(Environment.NewLine);
         ltrPage.Text  = sb.ToString();
    }
Ejemplo n.º 3
0
    private void Display_MetadataTab()
    {
        StringBuilder sbAttrib = new StringBuilder();
        StringBuilder sbResult = new StringBuilder();
        string strResult;
        string strAttrResult;
        string strImage = "";

        EnhancedMetadataScript.Text = CustomFields.GetEnhancedMetadataScript().Replace("src=\"java/", "src=\"../java/");
        EnhancedMetadataArea.Text = CustomFields.GetEnhancedMetadataArea();
        if ((meta_data != null) || (prod_type_data != null))
        {
            m_refSite = new Ektron.Cms.Site.EkSite(this.m_refContentApi.RequestInformationRef);
            Hashtable hPerm = m_refSite.GetPermissions(m_iFolder, 0, "folder");

            if (prod_type_data != null)
            {
                sbAttrib.Append(CustomFields.WriteFilteredAttributesForView(entry_edit_data.Attributes, prod_type_data.Id, false,prod_type_data.Attributes));
            }
        }
        if (m_sEditAction == "update")
        {
            strImage = entry_edit_data.Image;
            string strThumbnailPath = entry_edit_data.ImageThumbnail;
            if (entry_edit_data.ImageThumbnail == "")
            {
                strThumbnailPath = m_refContentApi.AppImgPath + "spacer.gif";
            }
            else if (catalog_data.IsDomainFolder == true)
            {
                strThumbnailPath = entry_edit_data.ImageThumbnail;
            }
            else
            {
                strThumbnailPath = m_refContentApi.SitePath + strThumbnailPath;
            }
        }
        strAttrResult = (string)(sbAttrib.ToString().Trim());
        strAttrResult = strAttrResult.Replace("src=\"java/", "src=\"../java/");
        strAttrResult = strAttrResult.Replace("src=\"images/", "src=\"../images/");

        strResult = sbResult.ToString().Trim();
        strResult = Util_FixPath(strResult);
        strResult = strResult.Replace("src=\"java/", "src=\"../java/");
        strResult = strResult.Replace("src=\"images/", "src=\"../images/");

        ltr_attrib.Text = strAttrResult;
    }
Ejemplo n.º 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");
    }