Пример #1
0
    protected void Page_Load(System.Object sender, System.EventArgs e)
    {
        ApplicationAPI AppUI = new ApplicationAPI();
        EkContent cContObj = new EkContent(AppUI.RequestInformationRef);
        taskObj = new EkTask(AppUI.RequestInformationRef);
        long cid;
        string[] tasksArray;
        int lCounter;
        string RefType;
        long CurrentUserID;
        string AppPath;
        string AppImgPath;
        string SitePath;
        string AppeWebPath;
        long CommentKeyId = 0;
        long CommentId = 0;
        string Action;
        object ActionType;
        object IsMac;
        object platform;
        bool Flag;
        object retVal;
        object CommentText;
        object NS4;
        object OrderBy;
        object iMaxContLength;
        object localeFileString;
        object var1;
        object var2;
        string taskIDs;
        object height;
        object width;
        int EnableMultilingual;
        int ContentLanguage;
        Ektron.Cms.Common.EkMessageHelper MsgHelper;
        System.Text.StringBuilder sbScript = new System.Text.StringBuilder();

        MsgHelper = AppUI.EkMsgRef;
        AppPath = AppUI.AppPath;
        AppImgPath = AppUI.AppImgPath;
        SitePath = AppUI.SitePath;
        AppeWebPath = AppUI.AppeWebPath;
        AppPath = AppUI.AppPath;
        AppName = AppUI.AppName;
        EnableMultilingual = AppUI.EnableMultilingual;
        ContentLanguage = 1033; //set default value
        if (!Utilities.ValidateUserLogin())
        {
            return;
        }
        if (Convert.ToBoolean(AppUI.RequestInformationRef.IsMembershipUser))
        {
            Response.Redirect("reterror.aspx?info=" + MsgHelper.GetMessage("msg login cms user"), false);
            return;
        }
        if (!string.IsNullOrEmpty(Request.QueryString["LangType"]))
        {
            ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
            AppUI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
        }
        else
        {
            if (!string.IsNullOrEmpty(AppUI.GetCookieValue("LastValidLanguageID")))
            {
                ContentLanguage = Convert.ToInt32(AppUI.GetCookieValue("LastValidLanguageID"));
            }
        }

        platform = Request.ServerVariables["HTTP_USER_AGENT"];
        if (platform.ToString().IndexOf("Windows") + 1 > 0)
        {
            IsMac = 0;
        }
        else
        {
            IsMac = 1;
        }

        RefType = "T";
        Flag = false;
        iMaxContLength = 65000;
        localeFileString = "0000";
        var1 = Request.ServerVariables["SERVER_NAME"];
        if (!string.IsNullOrEmpty(Request.QueryString["commentkey_id"]))
        {
            CommentKeyId = Convert.ToInt64(Request.QueryString["commentkey_id"]);
        }
        Action = Request.QueryString["action"];
        ActionType = Request.QueryString["ty"];
        OrderBy = Request.QueryString["orderby"];
        cid = Convert.ToInt64(Request.QueryString["id"]);
        if (!string.IsNullOrEmpty(Request.QueryString["Comment_Id"]))
        {
            CommentId = Convert.ToInt64(Request.QueryString["Comment_Id"]);
        }
        if (!string.IsNullOrEmpty((Request.QueryString["height"])))
        {
            height = Convert.ToDouble(Request.QueryString["height"]);
        }
        if (!string.IsNullOrEmpty((Request.QueryString["width"])))
        {
            width = Convert.ToDouble(Request.QueryString["width"]);
        }
        lCounter = 0;
        CurrentUserID = AppUI.UserId;

        ltrComments.Text = MsgHelper.GetMessage("lbl task comment") + ":";
        if (Request.QueryString["action"] != null && Request.QueryString["action"].ToString().ToLower() == "declinecontentaction")
            ltrComments.Text = MsgHelper.GetMessage("reason to decline");

        cContObj = AppUI.EkContentRef;

        if (Request.ServerVariables["http_user_agent"].ToString().IndexOf("Mozilla") + 1 > 0 && Request.ServerVariables["http_user_agent"].ToString().IndexOf("4.7") + 1 > 0 && Request.ServerVariables["http_user_agent"].ToString().IndexOf("GECKO") < 0)
        {
            NS4 = true;
        }
        else
        {
            NS4 = false;
        }

        var2 = cContObj.GetEditorVariablev2_0(0, "tasks");
        ctlEditor.Validate();
        if (Action == "Add" && ctlEditor.IsValid)
        {
            CommentText = this.ctlEditor.Content;
            if (cid != 0)
            {
                //Get all tasks associated with the content and add same comment
                taskObj = AppUI.EkTaskRef;
                object strStates;
                strStates = EkEnumeration.TaskState.NotStarted.ToString() + "," + EkEnumeration.TaskState.Active.ToString() + "," + EkEnumeration.TaskState.AwaitingData.ToString() + "," + EkEnumeration.TaskState.OnHold.ToString() + "," + EkEnumeration.TaskState.Pending.ToString() + "," + EkEnumeration.TaskState.Reopened.ToString();
                taskIDs = taskObj.GetTaskIDs(cid, strStates, -1, (int)EkEnumeration.CMSTaskItemType.TasksByStateAndContentID);

                if (taskIDs != "")
                {
                    tasksArray = Strings.Split(taskIDs.ToString(), ",", -1, 0);
                    while (lCounter <= (tasksArray.Length - 1))
                    {
                        retVal = cContObj.AddComment(Convert.ToInt64(CommentKeyId), Convert.ToInt64(CommentId), Convert.ToInt64(tasksArray.GetValue(lCounter)), RefType, CurrentUserID, Strings.Replace(CommentText.ToString(), "\'", "\'\'", 1, -1, 0));
                        lCounter++;
                    }
                }

            }
            Flag = true;
        }
        if (true == Flag)
        {
            sbScript.Append("<script language=\"JavaScript\" type=\"text/javascript\">" + "\r\n");
            sbScript.Append("<!--");
            sbScript.Append("if (IsBrowserIE())");
            sbScript.Append("{");
            sbScript.Append("   parent.ReturnChildValue(\"action=\" + document.getElementById(\"actionName\").value + \"&id=\" + document.getElementById(\"cid\").value + \"&fldid=\" + document.getElementById(\"fldid\").value + \"&page=\" + document.getElementById(\"page\").value );");
            sbScript.Append("}");
            sbScript.Append("else");
            sbScript.Append("{");
            sbScript.Append("   top.opener.ReturnChildValue(\"action=\" + document.getElementById(\"actionName\").value + " + ID == " + document.getElementById(\"cid\").value + \"&fldid=\" + document.getElementById(\"fldid\").value + \"&page=\" + document.getElementById(\"page\").value );");
            sbScript.Append("   close();");
            sbScript.Append("}");
            sbScript.Append("//-->");
            sbScript.Append("</script>" + "\r\n");
            ClosePanel.Text = sbScript.ToString();
        }

        if ((Request.QueryString["action"]) == "Add")
        {
            actionName.Value = Request.QueryString["actionName"];
        }
        else
        {
            actionName.Value = Request.QueryString["action"];
        }

        this.ctlEditor.AllowFonts = true;
        ctlEditor.ErrorMessage = MsgHelper.GetMessage("content size exceeded");
        ctlEditor.ValidationExpression = Utilities.BuildRegexToCheckMaxLength(System.Convert.ToInt32(iMaxContLength));
    }
Пример #2
0
    private void InitEnvironment()
    {
        m_strCmdAction = EkFunctions.HtmlEncode(Request.QueryString["Action"]);
            m_strActionType = EkFunctions.HtmlEncode(Request.QueryString["ty"]);
            m_iCommentKeyId = System.Convert.ToInt64(Request["commentkey_id"]);
            m_iCommentId = System.Convert.ToInt64(Request["Comment_Id"]);
            m_strCommentType = EkFunctions.HtmlEncode(Request["comment_type"]);
            m_strOrderBy = EkFunctions.HtmlEncode(Request["orderby"]);
            m_iRefId = System.Convert.ToInt64(Request["ref_id"]);
            m_strRefType = EkFunctions.HtmlEncode(Request["ref_type"]);
            m_strEditorName = EkFunctions.HtmlEncode(Request["editorName"]);
            m_strAppeWebPath = "";
            m_strLocaleFileString = "0000";
            m_objAppUI = new ApplicationAPI();
            m_objContentObj1 = m_objAppUI.EkContentRef;

            m_strAppeWebPath = m_objAppUI.ApplicationPath + m_objAppUI.AppeWebPath;

            if (Request["LangType"] != "")
            {
                m_iContentLanguage = Convert.ToInt32(Request["LangType"]);
                m_objAppUI.SetCookieValue("LastValidLanguageID", m_iContentLanguage.ToString());
            }
            else
            {
                if (m_objAppUI.GetCookieValue("LastValidLanguageID") != "")
                {
                    m_iContentLanguage = int.Parse(m_objAppUI.GetCookieValue("LastValidLanguageID"));
                }
            }

            m_objAppUI.ContentLanguage = m_iContentLanguage;
            m_objContentObj1 = m_objAppUI.EkContentRef;
            m_iCurrentUserId = m_objAppUI.UserId;
            m_strAppeWebPath = m_objAppUI.ApplicationPath + m_objAppUI.AppeWebPath;
            m_strServerName = Request.ServerVariables["SERVER_NAME"];
            this.Page.Title = m_objAppUI.AppName + " Comments";

            m_strvar2 = m_objContentObj1.GetEditorVariablev2_0(0, "tasks");

            if ((Strings.UCase(Request.ServerVariables["http_user_agent"])).IndexOf("MOZILLA") > -1 && (Strings.UCase(Request.ServerVariables["http_user_agent"])).IndexOf("4.7") > -1 && (!(Strings.UCase(Request.ServerVariables["http_user_agent"]).IndexOf("GECKO") > -1)))
            {
              m_bNS4 = true;
            }
            else
            {
                m_bNS4 = false;
            }
    }
Пример #3
0
    private void Display_AddSubscriptionMessage()
    {
        jsSetActionFunction.Text = SetActionClientScript();
        m_refContent = m_refSiteAPI.EkContentRef;
        var2 = m_refContent.GetEditorVariablev2_0(0, "tasks");
        AutoNav.Text = "";
        InitializedrpType();
        TR_ViewSubscription.Visible = false;
        TR_AddEditSubscription.Visible = true;
        ctlEditor.Content = "";
        TD_SubscriptionID.Visible = false;

        //----- Show the default checkbox for new validation email message.
        if (m_strPageMode == "userprop" || m_strPageMode == "forum" || m_strPageMode == "commerce")
        {
            ltrDefaultAddEdit.Text = m_refMsg.GetMessage("Default label");
            tr_default.Visible = true;
            chkDefaultAddEdit.Checked = false;
            chkDefaultAddEdit.Enabled = true;
        }
        else
        {
            tr_default.Visible = false;
            chkDefaultAddEdit.Checked = false;
            chkDefaultAddEdit.Enabled = false;
        }

        //only friendInvite, SiteInvite supports subject right now.
        EkEnumeration.EmailMessageTypes currentlySelected = (EkEnumeration.EmailMessageTypes)Enum.Parse(typeof(EkEnumeration.EmailMessageTypes), drpTypeAddEdit.Items[0].Value);
        if ((
            !(this.m_strPageMode == "forum" || this.m_strPageMode == "commerce")) &&
            !ShowSubject(currentlySelected)
            )
        {
            rowSubject.Style.Add("display", "none");
        }

        AddSubscriptionToolBar();
    }
Пример #4
0
    private void Display_EditSubscriptionMessage()
    {
        jsSetActionFunction.Text = SetActionClientScript();
        m_refContent = m_refSiteAPI.EkContentRef;
        var2 = m_refContent.GetEditorVariablev2_0(0, "tasks");
        AutoNav.Text = "";
        InitializedrpType();
        TR_ViewSubscription.Visible = false;
        TR_AddEditSubscription.Visible = true;
        if (!(Request.QueryString["id"] == null))
        {
            m_intSubscriptionId = Convert.ToInt64(Request.QueryString["id"]);
        }

        subscriptionmessage_data = m_refContApi.GetSubscriptionMessageById(m_intSubscriptionId);
        txtName.Text = subscriptionmessage_data.Title;
        ltrAddEditID.Text = subscriptionmessage_data.Id.ToString() + "<input type=\"hidden\" name=\"subscriptionID\" value=\"" + subscriptionmessage_data.Id.ToString() + "\"/>";
        txtSubject.Text = subscriptionmessage_data.Subject;
        ctlEditor.Content = subscriptionmessage_data.Text;
        drpTypeAddEdit.SelectedValue = subscriptionmessage_data.Type.GetHashCode().ToString();

        //----- Show the default checkbox if this is a validation email message.  Also check the box according
        //----- to what is set in the database.  If this is the default message check the box.
        if (subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.Verification || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.FriendInvitation || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.SiteInvitation || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.GroupInvitation || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.ForumPost || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.NewForumTopic || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.ReportForumPost || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.NewModeratedForumTopic || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.PrivateMessage || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.BlogComment || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.UserJournalComment || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.BlogPost || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.GroupBlogPost || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.UserJournalPost || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.ResetPassword || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.RequestResetPassword || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.GroupBlogComment || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.ModeratedBlogComment || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.OrderCancelled || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.OrderReceived || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.OrderShipped || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.OrderCompleted || subscriptionmessage_data.Type == Ektron.Cms.Common.EkEnumeration.EmailMessageTypes.OrderReceivedToAdmin)
        {
            ltrDefaultAddEdit.Text = m_refMsg.GetMessage("Default label");
            tr_default.Visible = true;
            if (subscriptionmessage_data.DefaultMessage == 1)
            {
                chkDefaultAddEdit.Checked = true;
                chkDefaultAddEdit.Enabled = false;
            }
            else
            {
                chkDefaultAddEdit.Checked = false;
                chkDefaultAddEdit.Enabled = true;
            }
        }
        else
        {
            tr_default.Visible = false;
        }

        //only friendInvite, SiteInvite supports subject right now.
        if (!ShowSubject(subscriptionmessage_data.Type))
        {
            rowSubject.Style.Add("display", "none");
        }

        EditSubscriptionToolBar();
    }
Пример #5
0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        PermissionData security_lib_data;
            string strBrowserCode = "";
            if (Request.Browser.Type.IndexOf("IE") != -1)
            {
                _IsBrowserIE = true;
            }
            if (!String.IsNullOrEmpty(Request.QueryString["type"]))
            {
                _IsProduct = System.Convert.ToBoolean(Request.QueryString["type"].ToLower() == "product");
            }
            _MessageHelper = _ContentApi.EkMsgRef;
            _EkContent = _ContentApi.EkContentRef;
            if (_EkContent.IsAllowed(0, 0, "users", "IsLoggedIn", 0) == false || _EkContent.IsAllowed(0, 0, "users", "IsAdmin", 0) == false)
            {
                if ((_IsProduct && ! _EkContent.IsARoleMember(Convert.ToInt64(EkEnumeration.CmsRoleIds.CommerceAdmin), _EkContent.RequestInformation.UserId, false)) || (! _IsProduct && ! _EkContent.IsARoleMember(Convert.ToInt64(EkEnumeration.CmsRoleIds.AdminXmlConfig), _EkContent.RequestInformation.UserId, false)))
                    {
                    Utilities.ShowError(_MessageHelper.GetMessage("com: user does not have permission"));
                }
            }

            RegisterResources();
            StyleSheetJS.Text = _StyleHelper.GetClientScript();

            _CurrentUserId = _ContentApi.UserId;
            _ContentLanguage = _ContentApi.ContentLanguage;
            _AppImgPath = _ContentApi.AppImgPath;
            _AppImgPath = _ContentApi.AppPath;
            _SitePath = _ContentApi.SitePath;
            _AppeWebPath = _ContentApi.ApplicationPath + _ContentApi.AppeWebPath;
            _AppName = _ContentApi.AppName;
            _Id = Convert.ToInt64(Request.QueryString["id"]);
            _PageAction = Request.QueryString["action"];
            _Var1 = Request.ServerVariables["SERVER_NAME"];
            _LanguageData = (new SiteAPI()).GetLanguageById(_ContentLanguage);
            _Var2 = _EkContent.GetEditorVariablev2_0(_Id, _PageAction);
            if (_LanguageData != null)
            {
                _LocaleFileNumber = Convert.ToString(_LanguageData.Id);
                strBrowserCode = _LanguageData.BrowserCode;
            }

            Page.Title = _AppName + " " + _MessageHelper.GetMessage("edit content page title") + " \"" + Ektron.Cms.CommonApi.GetEcmCookie()["username"] + "\"";
            _LocaleFileString = GetLocaleFileString(_LocaleFileNumber);

            SiteAPI refSiteApi = new SiteAPI();
            SettingsData settings_data;
            settings_data = refSiteApi.GetSiteVariables(refSiteApi.UserId);
            _AppLocaleString = GetLocaleFileString(settings_data.Language);

            _SelectedEditControl = "eWebEditPro";
            bool bIsMac = false;
            try
            {
                if (Request.Browser.Platform.IndexOf("Win") == -1)
                {
                    bIsMac = true;
                }
                if (bIsMac)
                {
                    _SelectedEditControl = "ContentDesigner";
                }
                else
                {
                    if (ConfigurationManager.AppSettings["ek_DataDesignControl"] != null)
                    {
                        _SelectedEditControl = (string) (ConfigurationManager.AppSettings["ek_DataDesignControl"].ToString());
                    }
                }
            }
            catch (Exception)
            {
                _SelectedEditControl = "ContentDesigner";
            }

            if (_SelectedEditControl == "eWebEditPro")
            {
                EditorJS.Text = Utilities.EditorScripts(_Var2, _AppeWebPath, strBrowserCode);
            }
            else
            {
                EditorJS.Text = "";
            }

            security_lib_data = _ContentApi.LoadPermissions(_Id, "folder", 0);
            _UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib;

            _EditAction = Request.QueryString["editaction"];
            if (!(Page.IsPostBack))
            {
                if (_EditAction == "cancel")
                {
                    //do nothing
                }
                else
                {
                    DisplayControl();
                }

            }
            else
            {
                UpdateEditDesign();
            }
            jsAppeWebPath.Text = _AppeWebPath;
            jsAppLocaleString.Text = _AppLocaleString;
            jsSitePath.Text = _SitePath;
            jsPath.Text = Strings.Replace(_Path, "\\", "\\\\", 1, -1, 0);
            jsTitle.Text = _MessageHelper.GetMessage("generic title label");
            jsXmlStyle.Text = _MessageHelper.GetMessage("lbl select style for xml design");
            jsInputTmpStyleSheet.Text = "<input type=\"text\" maxlength=\"255\" size=\"45\" value=\"" + _StyleSheet + "\" name=\"stylesheet\" id=\"stylesheet\" onchange=\"SetStyleSheetFromInput();\" />";
            jsTmpStyleSheet.Text = _StyleSheet;
            jshdnContentLanguage.Text = "<input type=\"hidden\" name=\"content_language\" value=\"" + _ContentLanguage + "\"/>";
            jshdnMaxContLength.Text = "<input type=\"hidden\" name=\"maxcontentsize\" value=\"" + _MaxContLength + "\"/>";
            jshdnXml_id.Text = "<input type=\"hidden\" name=\"xml_collection_id\" value=\"" + _XmlId + "\"/>";
            jshdnIndex_cms.Text = "<input type=\"hidden\" name=\"index_cms\" value=\"" + _IndexCms + "\"/>";
            jshdniSegment.Text = "<input type=\"hidden\" name=\"numberoffields\" value=\"" + _Segment + "\"/>";
            jsMaxContLength.Text = _MaxContLength.ToString();
            jsEditorMsg.Text = _MessageHelper.GetMessage("lbl wait editor not loaded");
            sContentInvalid.Text = _MessageHelper.GetMessage("msg content invalid");
            sDesignIncompatible.Text = _MessageHelper.GetMessage("msg design incompatible");
            sContinue.Text = _MessageHelper.GetMessage("msg wish to continue");
            sWarnOnUnload.Text = _MessageHelper.GetMessage("js: alert confirm close no save");
    }