Exemple #1
0
    private void Process_CheckInContent()
    {
        string strCallBackPage = "";
        Ektron.Cms.Content.EkContent m_refContent;
        long m_intId;
        StyleHelper m_refStyle = new StyleHelper();
        string AssetFileName = "";
        int contentType = 0;
        try
        {
            m_refContent = m_refContentApi.EkContentRef;
            m_intId = Convert.ToInt64(Request.QueryString["id"].ToString());
            if (!String.IsNullOrEmpty(Request.QueryString["content_type"]))
            {
                contentType = Convert.ToInt32(Request.QueryString["content_type"].ToString());
            }

            switch (contentType)
            {
                case Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry:
                    m_refCatalog = new Ektron.Cms.Commerce.CatalogEntry(m_refContentApi.RequestInformationRef);
                    Ektron.Cms.Commerce.EntryData entry = m_refCatalog.GetItemEdit(m_intId, m_refContentApi.RequestInformationRef.ContentLanguage, false);
                    if ((entry != null) && (entry.LastEditorId != m_refContentApi.RequestInformationRef.UserId) && (entry.Status == "O"))
                    {
                        m_refCatalog.TakeOwnershipForAdminCheckIn(m_intId, m_refContentApi.RequestInformationRef.UserId, null);
                    }
                    m_refCatalog.UpdateAndCheckIn(entry);
                    break;
                default:
                    if (!string.IsNullOrEmpty(Request.QueryString["asset_assetfilename"]))
                    {
                        AssetFileName = Request.QueryString["asset_assetfilename"];
                    }
                    ContentData contData = m_refContentApi.GetContentById(m_intId, ContentAPI.ContentResultType.Staged);
                    if ((contData != null) && (contData.UserId != m_refContentApi.RequestInformationRef.UserId) && (contData.Status == "O"))
                    {
                        m_refContent.TakeOwnershipForAdminCheckIn(m_intId);
                    }

                    if ((!string.IsNullOrEmpty(Request.QueryString["content_type"])) && (int.TryParse(Request.QueryString["content_type"], out contentType)) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(contentType, true)))                    {
                        ContentEditData cEditData = m_refContentApi.GetContentForEditing(m_intId);
                        cEditData.FileChanged = false;
                        m_refContentApi.SaveContent(cEditData);
                    }

                    m_refContent.CheckIn(m_intId, AssetFileName);
                    break;
            }
            strCallBackPage = m_refStyle.getCallBackupPage("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId);
            Response.Redirect(strCallBackPage, false);
        }
        catch (Exception ex)
        {
            Utilities.ShowError(EkFunctions.UrlEncode(ex.Message));
        }
    }
    private void PopulateFolderGridData()
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        string BlogFolderParm = (string)(m_bBlockBlogFolders ? "1" : "0");
        string currentFolderCheckbox = "";

        colBound.DataField = "ITEM1";
        colBound.HeaderText = "";
        colBound.ItemStyle.CssClass = "label";
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Height = Unit.Percentage(0);
        ContentGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ITEM2";
        colBound.HeaderText = "";
        colBound.ItemStyle.CssClass = "label";
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Height = Unit.Percentage(0);
        ContentGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ITEM3";
        colBound.HeaderText = "";
        colBound.ItemStyle.CssClass = "label";
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Height = Unit.Percentage(0);
        ContentGrid.Columns.Add(colBound);

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("ITEM1", typeof(string)));
        dt.Columns.Add(new DataColumn("ITEM2", typeof(string)));
        dt.Columns.Add(new DataColumn("ITEM3", typeof(string)));

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("alt select sub folders by navigating") + ":";
        dr[1] = "remove-item";
        dr[2] = "remove-item";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = "";
        dr[1] = "remove-item";
        dr[2] = "remove-item";
        dt.Rows.Add(dr);

        if ("siteupdateactivity" == strPageAction)
        {
            dr = dt.NewRow();
            dr[0] = "<input type=\"checkbox\" id=\"selectall\" name=\"selectall\" onclick=\"checkAll();\"/>" + m_refMsg.GetMessage("generic select all msg");
            dr[1] = "remove-item";
            dr[2] = "remove-item";
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<input type=\"checkbox\" name=\"allsubfolders\" id=\"allsubfolders\"";
            if (m_bSubFolder)
            {
                dr[0] = dr[0] + " checked";
            }
            dr[0] = dr[0] + "/>" + m_refMsg.GetMessage("lbl include sub-folders");
            dr[1] = "remove-item";
            dr[2] = "remove-item";
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "";
            dr[1] = "remove-item";
            dr[2] = "remove-item";
            dt.Rows.Add(dr);

            currentFolderCheckbox = "<input type=\"checkbox\" id = \"selectedfolder\" name=\"selectedfolder\" value=\"" + FolderId + "\" />&nbsp;" + "<input type=\"hidden\" id=\"selfolder" + FolderId + "\" value=\"" + FolderName + "\" />&nbsp;" + "<input type=\"hidden\" id=\"rootFolder\" value=\"" + FolderId + "\" />&nbsp;";
        }

        dr = dt.NewRow();
        dr[0] = "" + m_refMsg.GetMessage("lbl Selected Folder") + "<span class=\"selectedContent\">" + currentFolderCheckbox + fPath + "</span>";
        dr[1] = "remove-item";
        dr[2] = "remove-item";
        dt.Rows.Add(dr);

        if ((FolderId != 0 && (int)gtNavs["FolderType"] != 2) || (strRedirectFromReport == "report"))
        {
            dr = dt.NewRow();
            if ((string)(strRedirectFromReport) == "report")
            {
                if (FolderId != 0)
                {
                    dr[0] = "<a href=# onclick=\"RecursiveSubmit(" + ParentFolderId + ",&quot;" + BlogFolderParm + "&quot;,&quot;report&quot;,&quot;" + strPageAction + "&quot;);return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\"><img src=\"" + AppPath + "images/ui/icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" align=\"absbottom\"></a><a href=# onclick=\"RecursiveSubmit(" + ParentFolderId + ",&quot;" + BlogFolderParm + "&quot;,&quot;report&quot;,&quot;" + strPageAction + "&quot;);return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\">..</a>";
                }
                else
                {
                    if ("siteupdateactivity" == strPageAction)
                    {
                        // SiteUpdateReport: don't show up-folder button if already at root:
                        dr[0] = "";
                    }
                    else
                    {
                        dr[0] = "<a href=# onclick=\"return SaveSelCreateContent(&quot;" + strPageAction + "&quot;,&quot;0&quot;);return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\"><img src=\"" + AppPath + "images/ui/icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" align=\"absbottom\"></a><a href=# onclick=\"return SaveSelCreateContent(&quot;" + strPageAction + "&quot;,&quot;0&quot;);return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\">..</a>";
                    }
                }
            }
            else
            {
                dr[0] = "<a href=# onclick=\"RecursiveSubmit(" + ParentFolderId + ",&quot;" + BlogFolderParm + "&quot;,&quot;&quot;,&quot;&quot;,&quot;Folder&quot;" + ");return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\"><img src=\"" + AppPath + "images/ui/icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" align=\"absbottom\"></a><a href=# onclick=\"RecursiveSubmit(" + ParentFolderId + ",&quot;" + BlogFolderParm + "&quot;,&quot;&quot;,&quot;&quot;,&quot;Folder&quot;" + ");return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\">..</a>";
            }

            dr[1] = "&nbsp;";
            dr[2] = "&nbsp;";
            dt.Rows.Add(dr);
        }

        string folder_image = "";

        if (!String.IsNullOrEmpty(FolderType))
        {
            FolderType = Request.QueryString["FolderType"];
        }
        if (!String.IsNullOrEmpty(FolderType))
        {
            if (FolderType == "9")
            {
                System.Collections.Generic.List<Ektron.Cms.Commerce.CatalogData> catalogData = new System.Collections.Generic.List<Ektron.Cms.Commerce.CatalogData>();
                Ektron.Cms.Commerce.CatalogEntry CatalogManager = new Ektron.Cms.Commerce.CatalogEntry(m_refContentApi.RequestInformationRef);

                catalogData = CatalogManager.GetCatalogList(1, 1);

                folder_image = m_refContentApi.AppPath + "images/ui/icons/tree/folderGreenExpanded.png";
                for (int catalogFolders = 0; catalogFolders <= catalogData.Count - 1; catalogFolders++)
                {
                    dr = dt.NewRow();
                    FolderId = catalogData[catalogFolders].Id;
                    gtNavs = m_refContent.GetFolderInfoWithPath(FolderId);
                    string Path = (string)(gtNavs["Path"]);
                    Path = Path.Replace("\\", "\\\\");
                    dr[0] += "<a href=# onclick=\"SelectCatalog(\'" + catalogData[catalogFolders].Id + "\',\'" + Path + "\');return false;\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\"><img src=\"" + folder_image + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" align=\"absbottom\"></a><a href=# onclick=\"SelectCatalog(\'" + catalogData[catalogFolders].Id + "\',\'" + Path + "\');return false;\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\">" + catalogData[catalogFolders].Name + "</a>";
                    dt.Rows.Add(dr);
                }
            }

        }
        else
        {
            bool bGo = false;
            foreach (Collection folder in (IEnumerable)cFolders)
            {
                bGo = false;
                int __foldertype = (int)folder["FolderType"];
                // Do not show blog type folders when they're explicitly unwanted:
                if (m_bBlockBlogFolders)
                {

                    if (__foldertype == 0 || __foldertype == 2 || __foldertype == 6 || __foldertype == 8)
                        bGo = true;
                    else
                        bGo = false;
                }
                else
                {
                    if (__foldertype == 0 || __foldertype == 1 || __foldertype == 6 || __foldertype == 8 || __foldertype == 9)
                        bGo = true;
                    else
                        bGo = false;
                }
                if (bGo)
                {
                    dr = dt.NewRow();
                    folder_image = AppPath + "images/ui/icons/folder.png";
                    if (__foldertype == 6)
                    {
                        folder_image = AppPath + "images/ui/icons/folderCommunity.png";
                    }
                    else if (__foldertype == 9)
                    {
                        folder_image = AppPath + "images/ui/icons/folderGreen.png";
                    }
                    else if (__foldertype == 8)
                    {
                        folder_image = AppPath + "images/ui/icons/tree/folderCalendarClosed.png";
                    }

                    if ((string)(strRedirectFromReport) == "report")
                    {
                        if ("siteupdateactivity" == strPageAction)
                        {
                            dr[0] = "<input type=\"checkbox\" name=\"selectedfolder\" value=\"" + folder["id"] + "\" >";
                            dr[0] = dr[0] + "<input type=\"hidden\" id=\"selfolder" + folder["id"] + "\" value=\"" + folder["Name"] + "\" >";
                        }
                        dr[0] += "<a href=# onclick=\"RecursiveSubmit(" + folder["id"] + ",&quot;" + BlogFolderParm + "&quot;,&quot;report&quot;,&quot;" + strPageAction + "&quot;);\"return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\">" + "<img src=\"" + folder_image + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" align=\"absbottom\"></a><a href=# onclick=\"RecursiveSubmit(" + folder["id"] + ",&quot;" + BlogFolderParm + "&quot;,&quot;report&quot;,&quot;" + strPageAction + "&quot;);\"return false;\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\">" + folder["Name"] + "</a>";
                    }
                    else
                    {
                        dr[0] = "<a href=# onclick=\"RecursiveSubmit(" + folder["id"] + ",&quot;" + BlogFolderParm + "&quot;,&quot;&quot;,&quot;&quot;,&quot;Folder&quot;" + ");return false;\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\"><img src=\"" + folder_image + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" align=\"absbottom\"></a><a href=# onclick=\"RecursiveSubmit(" + folder["id"] + ",&quot;" + BlogFolderParm + "&quot;,&quot;&quot;,&quot;&quot;,&quot;Folder&quot;" + ");return false;\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\">" + folder["Name"] + "</a>";
                    }

                    dr[1] = "&nbsp;";
                    dr[2] = "&nbsp;";
                    dt.Rows.Add(dr);
                }
            }
        }
        DataView dv = new DataView(dt);
        ContentGrid.DataSource = dv;
        ContentGrid.DataBind();
    }
Exemple #3
0
    private void Process_DoSubmit()
    {
        string strCallBackPage = "";
        Ektron.Cms.Content.EkTask m_refTask;
        SettingsData settings_data;
        string strTaskName = "";
        bool IsAlreadyCreated = false;
        Ektron.Cms.Content.EkContent m_refContent;
        long m_intId;
        StyleHelper m_refStyle = new StyleHelper();
        long CurrentUserId;
        long contentType = 0;
        try
        {
            m_intId = Convert.ToInt64(Request.QueryString["id"].ToString());
            m_refContent = m_refContentApi.EkContentRef;
            CurrentUserId = m_refContentApi.UserId;
            m_refTask = m_refContentApi.EkTaskRef;
            if (Convert.ToString(m_intId) != "")
            {
                settings_data = (new SiteAPI()).GetSiteVariables(CurrentUserId);
                contentType = m_refContent.GetContentType(m_intId);

                switch (contentType)
                {
                    case Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry:
                        m_refCatalog = new Ektron.Cms.Commerce.CatalogEntry(m_refContentApi.RequestInformationRef);
                        Ektron.Cms.Commerce.EntryData entry = m_refCatalog.GetItemEdit(m_intId, m_refContentApi.RequestInformationRef.ContentLanguage, false);
                        m_refCatalog.Publish(entry, null);
                        break;
                    default:
                        long PreapprovalGroupID;
                        Collection cPreApproval = new Collection();
                        cPreApproval = m_refContent.GetFolderPreapprovalGroup(Convert.ToInt64(Request.QueryString["fldid"].ToString()));
                        PreapprovalGroupID = System.Convert.ToInt32(cPreApproval["UserGroupID"]);

                        if (PreapprovalGroupID > 0)
                        {
                            if (ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) //1 removed with ALL_CONTENT_LANGUAGES
                            {
                                strTaskName = (string)(Request.Form["content_title"] + m_intId + "_Task");
                            }
                            else
                            {
                                strTaskName = (string)(Request.Form["content_title"] + m_intId + "_Task" + ContentLanguage);
                            }
                            m_refTask.ContentLanguage = ContentLanguage;
                            m_refTask.LanguageID = ContentLanguage;
                            IsAlreadyCreated = m_refTask.IsTaskAlreadyCreated(m_intId);
                            if (IsAlreadyCreated == false)
                            {
                                m_refTask.LanguageID = ContentLanguage;
                                m_refTask.TaskTitle = strTaskName; // Task name would be contentname + content id + _Task
                                m_refTask.AssignToUserGroupID = PreapprovalGroupID; //Assigned to group defined by gtTaskAssignGroup
                                m_refTask.AssignedByUserID = CurrentUserId.ToString(); //Assigned by person creating the task
                                m_refTask.State = "1"; //Not started
                                m_refTask.ContentID = m_intId; //Content m_intId of the content being created
                                m_refTask.Priority = EkEnumeration.TaskPriority.Normal; //Normal
                                m_refTask.CreatedByUserID = CurrentUserId; //If task hops this will always be created user
                                m_refTask.AddTask();
                                m_refContent.SetContentState(m_intId, "T");
                            }
                            else
                            {
                                m_refContent.SubmitForPublicationv2_0(m_intId, Convert.ToInt64(Request.QueryString["fldid"].ToString()), "");
                            }
                        }
                        else
                        {
                            m_refContent.SubmitForPublicationv2_0(m_intId, Convert.ToInt64(Request.QueryString["fldid"].ToString()), "");
                        }
                        break;
                }
            }
            strCallBackPage = m_refStyle.getCallBackupPage("content.aspx?LangType=" + ContentLanguage + "&action=View&id=" + m_intId + "&fldid=" + Request.QueryString["fldid"]);
            Response.Redirect(strCallBackPage, false);
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
    public string getContentTypeIcon(Ektron.Cms.Common.ContentBase objCont)
    {
        try
        {
            int ContentTypeID;
            string strAssetIcon;
            Ektron.Cms.Common.ContentBase contentObj;

            contentObj = (Ektron.Cms.Common.ContentBase)objCont;

            ContentTypeID = System.Convert.ToInt32(objCont.ContentType);
            if (ContentTypeID == 2)
            {
                return (formsIcon);
            }
            else if (ContentTypeID > Ektron.Cms.Common.EkConstants.ManagedAsset_Min && ContentTypeID < Ektron.Cms.Common.EkConstants.ManagedAsset_Max)
            {
                try
                {
                    strAssetIcon = (string)objCont.AssetInfo.ImageUrl;
                    strAssetIcon = "<img src=\"" + strAssetIcon + "\" alt=\"Asset\">";
                    return (strAssetIcon);
                }
                catch (Exception)
                {
                    return ("<img src=\"" + AppPath + "images/ui/icons/filetypes/file.png\" alt=\"Content\" />");
                }
            }
            else if (ContentTypeID == 3333)
            {
                Ektron.Cms.Commerce.CatalogEntry catalogEntry = new Ektron.Cms.Commerce.CatalogEntry();
                catalogEntry.RequestInformation = m_refContent.RequestInformation;
                Ektron.Cms.Commerce.EntryData catalogEntryData;

                catalogEntryData = catalogEntry.GetItem(contentObj.Id, long.Parse(contentObj.Language.ToString()));
                return ("<img title=\"" + catalogEntryData.Title + "\" src=\"" + GetProductIcon(catalogEntryData.EntryType) + "\" alt=\"" + catalogEntryData.Title + "\" />");
            }
            else
            {
                if (Convert.ToInt32(objCont.ContentSubType) == 1)
                {
                    return (pageIcon);
                }
                else if (Convert.ToInt32(objCont.ContentSubType) == 2)
                {
                    return (WebEventIcon);
                }
                return (ContentIcon);
            }
        }
        catch (Exception)
        {
            return (ContentIcon);
        }
    }