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));
        }
    }
Exemple #2
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);
        }
    }