コード例 #1
0
        protected override void Load(object obj, HtmlNode objNode)
        {
            base.Load(obj, objNode);

            var element = obj as Disk;

            if (element == null)
            {
                return;
            }


            UIUtil.CheckProperties(objNode, "id");
            var target = objNode.GetAttributeValue("target", string.Empty);

            if (string.IsNullOrEmpty(target))
            {
                objNode.SetAttributeValue("getTarget", GetDiskGetTarget());
            }

            if (string.IsNullOrEmpty(element.AssetsPath))
            {
                element.AssetsPath = GetAssetsPath();
            }
            objNode.SetAttributeValue("assetsPath", element.AssetsPath);

            element.Class     = GetClassName(element, objNode);
            element.ProxyCode = GetProxyCode(element, objNode);
        }
コード例 #2
0
        public override void FillHtml(object obj, HtmlNode node, PageBrush brush)
        {
            UIUtil.CheckProperties(node, "id", "type");
            if (node.Attributes["name"] == null)
            {
                node.SetAttributeValue("name", node.GetAttributeValue("id", string.Empty));
            }

            SealedPainter.CreateNodeCode(brush, "div", UIUtil.GetClassName(node, "portlet box green thumbnails"), SealedPainter.GetStyleCode(node), GetProxyCode(obj, node), (pageBrush) =>
            {
                pageBrush.DrawLine("<div class=\"portlet-title\">");
                pageBrush.DrawFormat("<div class=\"caption\"><i class=\"fa fa-cogs\"></i>{0}</div>", GetLabel(node));
                pageBrush.DrawLine();
                pageBrush.DrawLine("<div class=\"tools\"><a href=\"javascript:;\" class=\"collapse\"></a></div>");
                pageBrush.DrawLine("</div>");
                pageBrush.DrawLine("<div class=\"portlet-body\" style=\"overflow: hidden;\">");
                pageBrush.DrawFormat("    <div class=\"note note-info\"><p>{0}</p></div>", GetHelp(node));
                pageBrush.DrawLine();
                pageBrush.DrawLine("    <div class=\"row\" data-name=\"thumbnails\" data-proxy=\"{give:new $$.databind()}\">");
                pageBrush.DrawLine("    <div class=\"col-lg-12 col-auto\" data-proxy=\"{loops:'items',onbind:$$.component.input.thumbnails.itemBind}\">");
                pageBrush.DrawLine("       <div class=\"thumbnail\">");
                pageBrush.DrawLine("           <img src=\"#\" />");
                pageBrush.DrawLine("           <div class=\"caption\">");
                pageBrush.DrawLine("               <h3 class=\"text-center\" data-proxy=\"{binds:{text:'name'}}\"></h3>");
                pageBrush.Draw("               <p class=\"text-center\">");

                if (node.SelectSingleNodeEx("core/upload") != null)
                {
                    pageBrush.Draw("<button class=\"btn red btn-sm thumbnails-btn-upload\">上传原图</button>");
                }
                if (node.SelectSingleNodeEx("core/cropper") != null)
                {
                    pageBrush.Draw("<button class=\"btn green btn-sm thumbnails-btn-cropper\">快捷上传</button>");
                }
                pageBrush.Draw("<button class=\"btn default btn-sm thumbnails-btn-remove\">移除图片</button>");
                pageBrush.DrawLine("</p>");
                pageBrush.DrawLine("           </div>");
                pageBrush.DrawLine("       </div>");
                pageBrush.DrawLine("   </div>");
                pageBrush.DrawLine("   </div>");
                pageBrush.DrawLine("</div>");
            }, () =>
            {
                return(UIUtil.GetProperiesCode(node, "id", "name", "data-name"));
            });

            //StringBuilder code = new StringBuilder();
            //code.AppendLine(segmentHtml);
            FillCropperHtml(obj as SealedControl, node, brush);
            FillUploadHtml(obj as SealedControl, node, brush);
            //return code.ToString();
        }
コード例 #3
0
        protected override void Load(object obj, HtmlNode objNode)
        {
            var tab = obj as Tab;

            if (tab == null)
            {
                return;
            }

            UIUtil.CheckProperties(objNode, "id");
            tab.ProxyCode = this.GetProxyCode(obj, objNode);
            tab.Class     = this.GetClassName(objNode);
            base.Load(obj, objNode);
        }
コード例 #4
0
        public virtual void FillHtml(object obj, HtmlNode node, PageBrush brush)
        {
            UIUtil.CheckProperties(node, "type");
            if (node.Attributes["name"] == null)
            {
                node.SetAttributeValue("name", node.GetAttributeValue("id", string.Empty));
            }

            SealedPainter.CreateNodeCode(brush, "div", UIUtil.GetClassName(node, string.Format("input input-{0} form-group", node.GetAttributeValue("type", string.Empty))), SealedPainter.GetStyleCode(node), GetProxyCode(obj, node), (pageBrush) =>
            {
                FillLabel(node, pageBrush);
                FillBrowseContainer(node, pageBrush);
                FillCoreContainer(obj as SealedControl, node, pageBrush);
                FillHelp(node, pageBrush);
            }, () =>
            {
                return(UIUtil.GetProperiesCode(node, "id", "name", "data-name"));
            });
        }
コード例 #5
0
        protected override void FillCore(SealedControl obj, HtmlNode node, HtmlNode coreNode, PageBrush brush)
        {
            UIUtil.CheckProperties(node, "id");

            brush.DrawFormat("<form data-name=\"edit-files\" class=\"edit-files\" action=\"{0}\" method=\"POST\" enctype=\"multipart/form-data\">", node.GetAttributeValue("target", "#"));
            brush.DrawLine("<input type=\"hidden\" name=\"folderId\">");
            brush.DrawLine("	<div class=\"row fileupload-buttonbar\">");
            brush.DrawLine("		<div class=\"col-lg-7\">");
            if (node.GetAttributeValue("localUpload", "true") == "true")
            {
                brush.DrawLine("			<span class=\"btn btn-sm green fileinput-button\">");
                brush.DrawLine("			<i class=\"fa fa-plus\"></i>");
                brush.DrawLine("			<span>选择文件... </span>");
                brush.DrawLine("			<input type=\"file\" name=\"files[]\" multiple=\"\">");
                brush.DrawLine("			</span>");
                brush.DrawLine("			<button type=\"submit\" class=\"btn btn-sm blue start\">");
                brush.DrawLine("			<i class=\"fa fa-upload\"></i>");
                brush.DrawLine("			<span>开始上传 </span>");
                brush.DrawLine("			</button>");
                brush.DrawLine("			<button type=\"reset\" class=\"btn btn-sm red cancel\">");
                brush.DrawLine("			<i class=\"fa fa-ban\"></i>");
                brush.DrawLine("			<span>移除文件 </span>");
                brush.DrawLine("			</button>");
            }
            if (node.GetAttributeValue("disk", "false") == "true")
            {
                brush.DrawLine("			<button type=\"button\" class=\"btn btn-sm purple fileinput-disk\">");
                brush.DrawLine("			<i class=\"fa fa-folder-open\"></i>");
                brush.DrawLine("			<span>从文件空间中选择 </span>");
                brush.DrawLine("			</button>");
            }

            brush.DrawLine("			<span class=\"fileupload-process\">");
            brush.DrawLine("			</span>");
            brush.DrawLine("		</div>");
            brush.DrawLine("		<div class=\"col-lg-5 fileupload-progress fade\">");
            brush.DrawLine("			<div class=\"progress progress-striped active\" role=\"progressbar\" aria-valuemin=\"0\" aria-valuemax=\"100\">");
            brush.DrawLine("				<div class=\"progress-bar progress-bar-success\" style=\"width:0%;\">");
            brush.DrawLine("				</div>");
            brush.DrawLine("			</div>");
            brush.DrawLine("			<div class=\"progress-extended\">&nbsp;</div>");
            brush.DrawLine("		</div>");
            brush.DrawLine("	</div>");
            brush.DrawLine("	<table role=\"presentation\" class=\"table table-striped clearfix\">");
            brush.DrawLine("	<tbody class=\"files\">");
            brush.DrawLine("	</tbody>");
            brush.DrawLine("	</table>");
            brush.DrawLine("</form>");
            if (node.GetAttributeValue("disk", "false") == "true")
            {
                StringBuilder modal = new StringBuilder();

                modal.AppendLine("<m:modal data-name=\"disk-modal\" size=\"full\" title=\"请选择文件\">");
                modal.AppendLine("<m:disk id=\"" + node.GetAttributeValue("id", string.Empty) + "\" data-name=\"disk\" name=\"disk\" height=\"500px\"></m:disk>");
                modal.AppendLine("<m:modal.footer>");
                modal.AppendLine("<m:button color=\"default\" data-dismiss=\"modal\">取消关闭</m:button>");
                modal.AppendLine("</m:modal.footer>");
                modal.AppendLine("</m:modal>");

                obj.Elements.Render(brush, modal.ToString());
            }
        }
コード例 #6
0
 protected override void FillCore(SealedControl obj, HtmlNode node, HtmlNode coreNode, PageBrush brush)
 {
     UIUtil.CheckProperties(node, "id");
     FillControl(obj, node, coreNode, brush);
 }