Exemple #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);
        }
Exemple #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);
        }
Exemple #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();
        }
Exemple #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);
        }
        private void showEdit(IEntity obj)
        {
            EntityInfo entityInfo = Entity.GetInfo(obj);
            Html       html       = new Html();

            html.Code("<form methond=\"post\" class=\"ajaxPostForm\" action=\"" + to(Update, obj.Id) + "\">");

            html.Code(string.Format("<div class='codeCmd'><a href='{0}'>返回列表</a></div>", to(Model) + "?typeName=" + entityInfo.FullName));
            html.Code("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" class='formTable'>");
            foreach (EntityPropertyInfo pInfo in entityInfo.SavedPropertyList)
            {
                if (pInfo.Name.Equals("Id"))
                {
                    continue;
                }

                string str   = this.getPropertyValue(obj, pInfo);
                string style = "";
                if ((pInfo.SaveAttribute == null) || ((pInfo.SaveAttribute != null) && (pInfo.SaveAttribute.Length > 100)))
                {
                    style = "width:400px;";
                }
                string control = Html.TextInput(pInfo.Name, str, style);
                if (pInfo.IsLongText)
                {
                    if (rft.GetAttribute(pInfo.Property, typeof(HtmlTextAttribute)) != null)
                    {
                        control = EditorFactory.NewOne(pInfo.Name, str, "200px", Editor.ToolbarType.Basic).ToString();
                    }
                    else
                    {
                        control = "<div>" + Html.TextArea(pInfo.Name, str, "width:98%; height:80px;") + "</div>";
                    }
                }
                else if (pInfo.IsEntity)
                {
                    string textField = getDropText(pInfo);
                    if (textField.Length > 0)
                    {
                        IList list = ndb.findAll(pInfo.Type);
                        if (list.Count > 0)
                        {
                            IEntity objP = obj.get(pInfo.Name) as IEntity;
                            if (objP != null)
                            {
                                control = Html.DropList(list, pInfo.Name, textField, "Id", objP.Id);
                            }
                        }
                    }
                }
                html.Code(string.Format("<tr><td class=\"mLable\">{0}</td><td>{1} {2}</td></tr>", pInfo.Label, control, this.getErrorInfo(pInfo.Name)));
            }
            html.Code("</td></tr></table>");
            html.Code("<div style=\"margin:5px 10px;\">");
            html.Submit("修改数据");
            html.Code("<input type=\"button\" onclick=\"history.back();\" value=\"返回\" style=\"margin-left:15px;\" />");
            html.HiddenInput("typeName", entityInfo.FullName);
            html.Code("</div>");
            html.FormEnd();
            actionContent(html.ToString());
        }