Пример #1
0
    //SelectCreateContent.aspx?FolderID=0&rmadd=false&LangType=1033&browser=0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        m_refMsg = (new Ektron.Cms.CommonApi()).EkMsgRef;
        m_refMsg = m_refSiteApi.EkMsgRef;
        RegisterResources();
        pleaseSelectMsg = m_refMsg.GetMessage("js select content block");
        try
        {
            m_refCalendarApi = new CalendarAPI(m_refContentApi.RequestInformationRef);
            if (m_refContentApi.UserId == 0 || m_refContentApi.RequestInformationRef.IsMembershipUser == 1)
            {
                Response.Redirect("login.aspx?fromLnkPg=1", false);
                return;
            }
            blnForTasks = false;
            m_refMsg = m_refContentApi.EkMsgRef;
            //Put user code to initialize the page here
            AppPath = m_refContentApi.AppPath;
            AppName = m_refContentApi.AppName;
            CalendarIcon = "<img src=\"" + AppPath + "images/ui/icons/calendarViewDay.png\" alt=\"Calendar Event\" \">";
            ContentIcon = "<img src=\"" + AppPath + "images/ui/icons/contentHtml.png\"  alt=\"" + m_refMsg.GetMessage("generic content") + "\">";
            formsIcon = "<img src=\"" + AppPath + "images/ui/icons/contentForm.png\"  alt=\"" + m_refMsg.GetMessage("generic form") + "\">";
            if (!string.IsNullOrEmpty(Request.QueryString["FolderID"]))
            {
                FolderId = Convert.ToInt64(Request.QueryString["FolderID"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.QueryString["actionName"]))
            {
                actName = Request.QueryString["actionName"];
            }
            if (actName == null)
            {
                actName = "";
            }
            NextPage.Attributes.Add("onclick", "return resetPostback()");
            lnkBtnPreviousPage.Attributes.Add("onclick", "return resetPostback()");
            FirstPage.Attributes.Add("onclick", "return resetPostback()");
            LastPage.Attributes.Add("onclick", "return resetPostback()");

            if (!(Request.QueryString["ItemID"] == null))
            {
                ItemID = Convert.ToInt64(Request.QueryString["ItemID"]);
            }

            if (!(Request.QueryString["ty"] == null))
            {
                callerPage = Request.QueryString["ty"];
            }

            if (!(Request.QueryString["overrideType"] == null))
            {
                if (Request.QueryString["overrideType"] == "content")
                {
                    overrideContentEnum = "content";
                }
                else if (Request.QueryString["overrideType"].ToLower() == "forms")
                {
                    overrideContentEnum = "forms";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select form").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "blog")
                {
                    overrideContentEnum = "blog";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select blog").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "forum")
                {
                    overrideContentEnum = "forum";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select forum").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "calendar")
                {
                    overrideContentEnum = "calendar";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select calendar").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "collection")
                {
                    overrideContentEnum = "collection";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select collection").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "folder")
                {
                    overrideContentEnum = "folder";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select folder").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "calfolder")
                {
                    overrideContentEnum = "calfolder";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select folder").ToString();
                }
            }

            if (!(Request.QueryString["StartingFolderID"] == null))
            {
                StartingFolderId = Convert.ToInt64(Request.QueryString["StartingFolderID"]);
            }

            if (IsBrowserIE())
            {
                notSupportIFrame = "0";
            }
            else
            {
                notSupportIFrame = "1";
            }

            StyleSheetJS.Text = m_refStyle.GetClientScript();
            if (Request.QueryString["rmadd"] == "true")
            {
                bRemoveAddContentBtn = true;
            }
            if (!(Request.QueryString["for_tasks"] == null))
            {
                blnForTasks = System.Convert.ToBoolean("1" == Strings.Trim(Request.QueryString["for_tasks"]));
            }
            else if (!(Request.QueryString["for_wiki"] == null))
            {
                blnForWiki = System.Convert.ToBoolean("1" == Strings.Trim(Request.QueryString["for_wiki"]));
                overrideContentEnum = "folder";
                pleaseSelectMsg = m_refMsg.GetMessage("js select folder").ToString();
            }

            if (overrideContentEnum.Length == 0 || overrideContentEnum == "content")
            {
                Page.Title = AppName + " Select Content";
            }
            else if (overrideContentEnum == "forms")
            {
                Page.Title = AppName + " Select Form";
            }
            else if (overrideContentEnum == "blog")
            {
                Page.Title = AppName + " Select Blog";
            }
            else if (overrideContentEnum == "forum")
            {
                Page.Title = AppName + " Select Forum";
            }
            else if (overrideContentEnum == "calendar")
            {
                Page.Title = AppName + " Select Calendar";
            }
            else if (overrideContentEnum == "collection")
            {
                Page.Title = AppName + " Select Collection";
            }
            else if (overrideContentEnum == "folder")
            {
                Page.Title = AppName + " Select Folder";
            }
            else if (overrideContentEnum == "calfolder")
            {
                Page.Title = AppName + " Select Folder";
            }

            if (!(Request.QueryString["LangType"] == null))
            {
                if (!string.IsNullOrEmpty(Request.QueryString["LangType"]))
                {
                    ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                    m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
                }
                else
                {
                    if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                    {
                        ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                    }
                }
            }
            else
            {
                if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                }
            }
            if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refContentApi.ContentLanguage = ContentLanguage;
            }

            m_refContent = m_refContentApi.EkContentRef;
            gtNavs = m_refContent.GetFolderInfoWithPath(FolderId);
            FolderName = gtNavs["FolderName"];
            folderType = (EkEnumeration.FolderType)Enum.Parse(typeof(EkEnumeration.FolderType), gtNavs["FolderType"].ToString());
            ltr_folderType.Text = (string)(folderType.ToString());
            ParentFolderId = gtNavs["ParentID"];
            fPath = gtNavs["Path"];

            cTmp = new Collection();
            cTmp.Add("name", "OrderBy", null, null);
            cTmp.Add(FolderId, "FolderID", null, null);
            cTmp.Add(FolderId, "ParentID", null, null);
            cFolders = m_refContent.GetAllViewableChildFoldersv2_0(cTmp);
            if (blnForTasks == true)
            {
                cTmp.Add(true, "FilterContentAssetType", null, null);
            }

            if (!(Request.QueryString["action"] == null))
            {
                strPageAction = Request.QueryString["action"];
            }
            // RedirectFromPage: To display only child folders & NOT content.
            if (!(Request.QueryString["from_page"] == null))
            {
                RedirectFromPage = Request.QueryString["from_page"];
            }
            if (RedirectFromPage != "report" && (IsPostBack == false || isPostData.Value != ""))
            {
                FillContentInfo();
            }
            else if (isPostData.Value != "")
            {
                DrawData();
            }
            isPostData.Value = "true";
            if (!(Request.QueryString["report_type"] == null))
            {
                ReportType = Request.QueryString["report_type"];
            }

            SetJsServerVariables();

        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
Пример #2
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refContentApi.EkMsgRef;
            AppImgPath = m_refContentApi.AppImgPath;
            AppPath = m_refContentApi.AppPath;
            m_strPageAction = Request.QueryString["action"];
            object refApi = m_refContentApi as object;
            Utilities.SetLanguage(m_refContentApi);
            //Utilities.SetLanguage(m_refContentApi);
            TaxonomyLanguage = m_refContentApi.ContentLanguage;
            if (TaxonomyLanguage == -1)
            {
                TaxonomyLanguage = m_refContentApi.DefaultContentLanguage;
            }
            if (Request.QueryString["taxonomyid"] != null)
            {
                TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            }
            if (Request.QueryString["parentid"] != null)
            {
                TaxonomyParentId = Convert.ToInt64(Request.QueryString["parentid"]);
            }
            if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "author")
            {
                m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User;
                m_UserType = Ektron.Cms.Common.EkEnumeration.UserTypes.AuthorType;
            }
            else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "member")
            {
                m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User;
                m_UserType = Ektron.Cms.Common.EkEnumeration.UserTypes.MemberShipType;
            }
            else if ((Request.QueryString["type"] != null) && Request.QueryString["type"].ToLower() == "cgroup")
            {
                m_ObjectType = Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup;
            }

            if ((Request.QueryString["contFetchType"] != null) && Request.QueryString["contFetchType"].ToLower() != "")
            {
                contentFetchType = Request.QueryString["contFetchType"];
            }
            m_refContent = m_refContentApi.EkContentRef;
            CalendarIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/calendar.png\" alt=\"Calendar Event\">";
            FormsIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/contentForm.png\" alt=\"Form\">";
            ContentIcon = "<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/contentHtml.png\" alt=\"Content\">";
            pageIcon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/layout.png\" alt=\"Page\">"; //-HC-
            if (this.m_UserType == Ektron.Cms.Common.EkEnumeration.UserTypes.AuthorType)
            {
                UserIcon = "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/user.png\" alt=\"Content\">";
            }
            else
            {
                UserIcon = "<img src=\"" + m_refContentApi.AppPath + "Images/ui/icons/userMembership.png\" alt=\"Content\">";
            }
            if ((Page.IsPostBack && (!string.IsNullOrEmpty(Request.Form[isPostData.UniqueID])) && (m_ObjectType == EkEnumeration.CMSObjectTypes.Content | (m_ObjectType == EkEnumeration.CMSObjectTypes.User & !string.IsNullOrEmpty(Request.Form["itemlist"])) | (m_ObjectType == EkEnumeration.CMSObjectTypes.CommunityGroup & !string.IsNullOrEmpty(Request.Form["itemlist"]) | (m_ObjectType == EkEnumeration.CMSObjectTypes.Folder & !string.IsNullOrEmpty(Request.Form["itemlist"]))))))
            //if (Page.IsPostBack && (Request.Form[isPostData.UniqueID] != "") && (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content || (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User && Request.Form["itemlist"] != "") || (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup && Request.Form["itemlist"] != "")))
                {
                if (m_strPageAction == "additem")
                {
                    TaxonomyRequest item_request = new TaxonomyRequest();
                    item_request.TaxonomyId = TaxonomyId;
                    item_request.TaxonomyIdList = Validate(Request.Form["itemlist"]);
                    if (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User)
                    {
                        item_request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.User;
                    }
                    else if (m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup)
                    {
                        item_request.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Group;
                    }
                    item_request.TaxonomyLanguage = TaxonomyLanguage;
                    m_refContent.AddTaxonomyItem(item_request);
                }
                else if (m_strPageAction == "addfolder")
                {
                    TaxonomySyncRequest sync_request = new TaxonomySyncRequest();
                    sync_request.TaxonomyId = TaxonomyId;
                    sync_request.SyncIdList = Validate(Request.Form["selectedfolder"]); //Validate(Request.Form("itemlist"))
                    //sync_request.SyncRecursiveIdList = Validate(Request.Form("recursiveidlist"))
                    sync_request.TaxonomyLanguage = TaxonomyLanguage;
                    m_refContent.AddTaxonomySyncFolder(sync_request);
                }
                if (Request.QueryString["iframe"] == "true")
                {
                    Response.Write("<script type=\"text/javascript\">parent.CloseChildPage();</script>");
                }
                else
                {
                    Response.Redirect((string) ("taxonomy.aspx?action=view&taxonomyid=" + TaxonomyId));
                }
            }
            else
            {
                FolderId = Convert.ToInt64(Request.QueryString["folderid"]);

                folder_data_col = m_refContent.GetFolderInfoWithPath(FolderId);
                FolderName = folder_data_col["FolderName"].ToString();
                FolderParentId = Convert.ToInt64(folder_data_col["ParentID"].ToString());
                FolderPath = folder_data_col["Path"].ToString();
                folder_request_col = new Collection();
                folder_request_col.Add(FolderId, "ParentID", null, null);
                folder_request_col.Add("name", "OrderBy", null, null);
                folder_data_col = m_refContent.GetAllViewableChildFoldersv2_0(folder_request_col);

                if (m_strPageAction != "additem")
                {
                    if (Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "")
                    {
                        if (Information.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
                        {
                            SelectedContentType = System.Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]);
                            m_refContentApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, SelectedContentType.ToString());
                        }
                    }
                    else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "")
                    {
                        if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]))
                        {
                            SelectedContentType = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]);
                        }
                    }
                    asset_data = m_refContent.GetAssetSuperTypes();
                }
                RegisterResources();
                TaxonomyToolBar();
                if (! Page.IsPostBack || m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.User || m_ObjectType == Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.CommunityGroup)
                {
                    // avoid redisplay when clicking next/prev buttons
                    DisplayPage();
                }
            }
    }