Ejemplo n.º 1
0
        /// <summary>
        /// 编辑器
        /// </summary>
        /// <param name="varName">模板中的变量名称</param>
        /// <param name="propertyName">需要编辑的属性名称</param>
        /// <param name="propertyValue">需要编辑的内容</param>
        /// <param name="height">编辑器高度(必须手动指定px单位)</param>
        /// <param name="toolbar">工具栏类型:基本按钮或全部按钮</param>
        protected void editor(String varName, String propertyName, String propertyValue, String height, Editor.ToolbarType toolbar)
        {
            String currentEditorKey = "currentEditor";

            List <String> editorList = ctx.GetItem(currentEditorKey) as List <String>;

            if (editorList != null && editorList.Contains(propertyName))
            {
                throw new Exception(lang("exEditorNameUnique"));
            }

            IEditor ed = EditorFactory.NewOne(propertyName, propertyValue, height, toolbar);

            ed.AddUploadUrl(ctx);
            if (editorList != null && editorList.Count > 0)
            {
                ed.IsUnique = false;
            }
            set(varName, ed);

            if (editorList == null)
            {
                editorList = new List <string>();
            }
            editorList.Add(propertyName);
            ctx.SetItem(currentEditorKey, editorList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 编辑器,包括全部的工具栏
        /// </summary>
        /// <param name="propertyName">属性名称(也是编辑器名称)</param>
        /// <param name="propertyValue">需要被编辑的内容</param>
        /// <param name="height">编辑器高度(必须手动指定px单位)</param>
        protected void editorFull(String propertyName, String propertyValue, String height)
        {
            IEditor ed = EditorFactory.NewOne(propertyName, propertyValue, height, Editor.ToolbarType.Full);

            ed.AddUploadUrl(ctx);
            set("Editor", ed);
        }
Ejemplo n.º 3
0
        private void bindFormNew(ForumTopic topic, ForumPost lastPost, IBlock formBlock)
        {
            User user = ctx.viewer.obj as User;

            if (strUtil.HasText(user.Pic))
            {
                formBlock.Set("currentUser", "<img src=\"" + user.PicM + "\"/>");
            }
            else
            {
                formBlock.Set("currentUser", user.Name);
            }

            formBlock.Set("post.ReplyActionUrl", to(new Users.PostController().Create) + "?boardId=" + topic.ForumBoard.Id);
            formBlock.Set("post.ReplyTitle", "re:" + topic.Title);
            formBlock.Set("post.TopicId", topic.Id);
            formBlock.Set("post.ParentId", lastPost.Id);
            formBlock.Set("forumBoard.Id", topic.ForumBoard.Id);

            IEditor ed = EditorFactory.NewOne("Content", "", "150px", Editor.ToolbarType.Basic);

            ed.AddUploadUrl(ctx);

            formBlock.Set("Editor", ed);

            formBlock.Set("currentPageId", ctx.route.page);

            formBlock.Next();
        }
Ejemplo n.º 4
0
        //-------------------------------------- 控件 ----------------------------------------------

        /// <summary>
        /// 编辑器,工具栏只包括基本按钮
        /// </summary>
        /// <param name="propertyName">属性名称(也是编辑器名称)</param>
        /// <param name="propertyValue">需要被编辑的内容</param>
        /// <param name="height">编辑器高度(必须手动指定px单位)</param>
        protected void editor(String propertyName, String propertyValue, String height)
        {
            if (ctx.route.isAdmin)
            {
                editorFull(propertyName, propertyValue, height);
                return;
            }

            IEditor ed = EditorFactory.NewOne(propertyName, propertyValue, height, Editor.ToolbarType.Basic);

            ed.AddUploadUrl(ctx);
            set("Editor", ed);
        }