Exemple #1
0
        //获取单个块的html
        public static string GetOneBlockHtmls(string blockId)
        {
            Dictionary <string, object> dicBlock = new Dictionary <string, object>();
            StringBuilder blockHtmls             = new StringBuilder();
            string        BlockBeginHtml         = "<DIV class=\"drag_div\" id=\"drag_{0}\" style=\"BORDER-COLOR: {1}; BACKGROUND: #fff;\">";
            string        BlockEndHtml           = @"<DIV id='drag_switch_{0}'>
						<DIV class='drag_editor' id='drag_editor_{0}' style='DISPLAY: none'>
							<DIV id='loadeditorid_{0}' style='WIDTH: 100px'><IMG src='/Portal/Door/image/loading.gif'><SPAN id='loadeditortext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<DIV class='drag_content' id='drag_content_{0}'>
							<DIV id='loadcontentid_{0}' style='WIDTH: 100px'><IMG src='/Portal/Door/image/loading.gif'><SPAN id='loadcontenttext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
					</DIV>
				</DIV>"                ;
            BaseBlock     bl = new BaseBlock(blockId);

            if (bl.Entity == null)
            {
                return("");
            }
            blockHtmls.Append(string.Format(BlockBeginHtml, blockId, bl.Entity.ColorValue));
            blockHtmls.Append(bl.GetHeadHtml());
            blockHtmls.Append(string.Format(BlockEndHtml, blockId));
            dicBlock["Html"]            = blockHtmls.ToString();
            dicBlock["DelayLoadSecond"] = bl.Entity.DelayLoadSecond.Value;
            dicBlock["RepeatItemCount"] = bl.Entity.RepeatItemCount;
            dicBlock["RelateScript"]    = bl.Entity.RelateScript;
            return(JsonHelper.ToJson(dicBlock));
        }
Exemple #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            string reqAction = this.Request["Param"];

            switch (reqAction)
            {
            //获取各个块内容
            case "GetContent":
                string    blockId = this.Request["BlockId"];
                BaseBlock bl      = new BaseBlock(blockId);
                content = GetBlockContent(bl);
                break;

                #region 主页功能部分
            case "SaveOrder":    //保存页面布局
                string orders = this.Request["Orders"];
                BaseBlock.SaveGetBlocks(orders, this.Request["TemplateId"]);
                break;

            case "GetAllBlock":
                content = BaseBlock.GetAllBlockNames(this.Request["BlockType"], this.Request["TemplateId"]);
                break;

            case "GetOneNew":
                content = BaseBlock.GetOneBlockHtmls(this.Request["BlockId"]);
                BaseBlock.UpdateAfterAddNewOneBlock(this.Request["BlockId"], this.Request["TemplateId"]);
                break;

            case "DeleteBlock":
                BaseBlock.DeleteBlockFromBaseTemplate(this.Request["BlockId"], this.Request["TemplateId"]);
                break;

            case "ChangeColumns":
                string columns        = this.Request["Columns"];
                string layout1        = this.Request["layout1"];
                string layout2        = this.Request["layout2"];
                string layout3        = this.Request["layout3"];
                string layout4        = this.Request["layout4"];
                string templateString = this.Request["TemplateString"];
                BaseBlock.SaveChangeColumns(columns, templateString, this.Request["TemplateId"], layout1, layout2, layout3, layout4);
                break;

            case "ChangeWidth":
                string columns1 = this.Request["Columns"];
                string layout11 = this.Request["layout1"];
                string layout21 = this.Request["layout2"];
                string layout31 = this.Request["layout3"];
                string layout41 = this.Request["layout4"];
                BaseBlock.ChangeColumnsWidth(columns1, this.Request["TemplateId"], layout11, layout21, layout31, layout41);
                break;
                //case "Reset":
                //    BaseBlock.ResetBlocks(UserID,this.Request["TemplateId"]);
                //    break;
                #endregion
            }
            Response.Write(content);
            Response.End();
        }
Exemple #3
0
 private string GetFrameContent(BaseBlock bl)
 {
     if (bl != null)
     {
         return(bl.RepeatItemTemplate + bl.GetFootHtml());
     }
     else
     {
         return(string.Empty);
     }
 }
Exemple #4
0
        public static string GetCols(string col, string width, int i)
        {
            StringBuilder blockHtmls     = new StringBuilder();
            string        colBeginHtml   = "<DIV class=\"col_div\" id=\"col_{0}\" style=\"WIDTH: {1}\">";
            string        colEndHtml     = @"<DIV class='drag_div no_drag' id='col_{0}_hidden_div'>
					<DIV id='col_{0}_hidden_div_h'></DIV>
				</DIV></DIV>"                ;
            string        BlockBeginHtml = "<DIV class=\"drag_div\" id=\"drag_{0}\" style=\"BORDER-COLOR: {1}; BACKGROUND: #fff;\">";
            string        BlockEndHtml   = @"<DIV id='drag_switch_{0}'>
						<DIV class='drag_editor' id='drag_editor_{0}' style='DISPLAY: none'>
							<DIV id='loadeditorid_{0}' style='WIDTH: 100px'><IMG src='/Portal/Door/image/loading.gif'><SPAN id='loadeditortext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<DIV class='drag_content' id='drag_content_{0}'>
							<DIV id='loadcontentid_{0}' style='WIDTH: 100px'><IMG src='/Portal/Door/image/loading.gif'><SPAN id='loadcontenttext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<SCRIPT id='{0}' type='text/javascript'>{1}</SCRIPT>
					</DIV>
				</DIV>"                ;

            blockHtmls.Append(string.Format(colBeginHtml, Convert.ToString(i), width));
            string[] blockIds = col.Split(',');
            //每列的各块
            foreach (string blockId in blockIds)
            {
                if (blockId != "")
                {
                    BaseBlock bl = new BaseBlock(blockId);
                    if (bl.Entity == null)
                    {
                        continue;
                    }

                    blockHtmls.Append(string.Format(BlockBeginHtml, blockId, bl.Entity.ColorValue));

                    blockHtmls.Append(bl.GetHeadHtml());
                    //是否延时加载
                    if (bl.Entity.DelayLoadSecond.Value > 0)
                    {
                        blockHtmls.Append(string.Format(BlockEndHtml, blockId, "window.setTimeout(\"loadDragContent('" + blockId + "','" + bl.Entity.RepeatItemCount + "')\"," + Convert.ToString(bl.Entity.DelayLoadSecond.Value * 1000) + ");\n" + bl.Entity.RelateScript));
                    }
                    else
                    {
                        blockHtmls.Append(string.Format(BlockEndHtml, blockId, "loadDragContent('" + blockId + "','" + bl.Entity.RepeatItemCount + "');\n" + bl.Entity.RelateScript));
                    }
                }
            }
            blockHtmls.Append(string.Format(colEndHtml, Convert.ToString(i)));
            return(blockHtmls.ToString());
        }
Exemple #5
0
        private string GetBlockContent(BaseBlock bl)
        {
            try
            {
                //特殊Block直接输出html
                switch (bl.BlockKey)
                {
                case "MyHead":    //头像
                    return(GetPhotoContent());

                case "Weather":    //天气
                    return(GetWeatherContent());

                case "Frame":    //图片新闻
                    return(GetFrameContent(bl));

                case "AuditTask":
                    return(GetAuditTaskContent(bl));

                case "AuditedTask":
                    return(GetAuditedTaskContent(bl));

                case "DesignTask":
                    return(GetDesignTaskContent(bl));

                default:
                {
                    //如果是[Delegate]类型则自定义
                    if (bl.RepeatDataDataSql != null && bl.RepeatDataDataSql.StartsWith("["))
                    {
                        bl.GetServiceData += new GetServiceHandler(bl_GetServiceData);
                    }

                    return(bl.GetContentHtml() + bl.GetFootHtml());
                }
                }
            }
            catch (Exception dpe)
            {
                LogWriter.Error(dpe);

                return(dpe.Message);
            }
        }
Exemple #6
0
        private string GetAuditTaskContent(BaseBlock bl)
        {
            string preYear = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd");

            string sql = @"select S_WF_InsTaskExec.ID,S_WF_InsTask.TaskName,FormUrl,FormInstanceID,S_WF_InsTaskExec.CreateTime,FormWidth,FormHeight 
from S_WF_InsTaskExec join S_WF_InsTask on ExecTime is null and ExecUserID='{0}' and S_WF_InsTask.Type in('Normal','Inital') and (WaitingRoutings='' or WaitingRoutings is null) and (WaitingSteps='' or WaitingSteps is null) and (S_WF_InsTaskExec.CreateTime >= {1} ) and S_WF_InsTask.ID=InsTaskID 
join S_WF_InsFlow on S_WF_InsFlow.Status='Processing' and S_WF_InsFlow.ID=S_WF_InsTask.InsFlowID join S_WF_InsDefFlow on S_WF_InsFlow.InsDefFlowID=S_WF_InsDefFlow.ID  order by S_WF_InsTaskExec.CreateTime desc";

            sql = string.Format(sql, FormulaHelper.UserID,
                                Config.Constant.IsOracleDb ? string.Format("to_date('{0}','yyyy-MM-dd')", preYear) : string.Format("'{0}'", preYear)
                                );

            string template = bl.RepeatItemTemplate;
            string html     = "";

            SQLHelper helper = SQLHelper.CreateSqlHelper("WorkFlow");
            int       iCount = 8;

            if (bl.RepeatItemCount != null)
            {
                iCount = bl.RepeatItemCount.Value;
            }
            DataTable source = helper.ExecuteDataTable(sql, 0, iCount, CommandType.Text);

            if (source != null && source.Rows.Count > 0)
            {
                foreach (DataRow dr in source.Rows)
                {
                    string          item = template;
                    Regex           rg   = new Regex("\\[[^][]*\\]", RegexOptions.Multiline);
                    MatchCollection mtc  = rg.Matches(template);
                    foreach (Match mt in mtc)
                    {
                        item = item.Replace(mt.Value, dr[mt.Value.Substring(1, mt.Value.Length - 2)].ToString());
                    }
                    html += item;
                }
            }

            html += bl.GetFootHtml();

            return(html);
        }
Exemple #7
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (this.Request["BlockType"] != null)
            {
                this.BaseType = this.Request["BlockType"];
            }
            SQLHelper sqlHelper = SQLHelper.CreateSqlHelper(ConnEnum.Base);
            DataTable dt        = sqlHelper.ExecuteDataTable("select ID from S_P_DoorBaseTemplate where ID='" + this.Request["TemplateId"] + "'");

            if (dt != null && dt.Rows.Count > 0)
            {
                this.TemplateID = dt.Rows[0]["ID"].ToString();
                Html            = BaseBlock.GetBlocks(ref LayoutType, "Portal", this.TemplateID);
                if (Html == "F")
                {
                    Html = StaticHTML();
                }
            }
        }
Exemple #8
0
        private string GetAuditedTaskContent(BaseBlock bl)
        {
            string sql = @"select FormUrl,FormWidth,FormHeight,FormInstanceID,S_WF_InsTaskExec.ID,S_WF_InsTask.TaskName,S_WF_InsTaskExec.ExecTime from S_WF_InsTaskExec join S_WF_InsTask on ExecTime is not null and ExecUserID='{0}' and S_WF_InsTask.Type in ('Normal','Inital') and S_WF_InsTask.ID=InsTaskID join S_WF_InsFlow on S_WF_InsFlow.ID=S_WF_InsTask.InsFlowID join S_WF_InsDefFlow on S_WF_InsDefFlow.ID=S_WF_InsFlow.InsDefFlowID order by S_WF_InsTaskExec.ExecTime desc";

            sql = string.Format(sql, FormulaHelper.UserID);

            string template = bl.RepeatItemTemplate;
            string html     = "";

            SQLHelper helper = SQLHelper.CreateSqlHelper("WorkFlow");
            int       iCount = 8;

            if (bl.RepeatItemCount != null)
            {
                iCount = bl.RepeatItemCount.Value;
            }
            DataTable source = helper.ExecuteDataTable(sql, 0, iCount, CommandType.Text);

            if (source != null && source.Rows.Count > 0)
            {
                foreach (DataRow dr in source.Rows)
                {
                    string          item = template;
                    Regex           rg   = new Regex("\\[[^][]*\\]", RegexOptions.Multiline);
                    MatchCollection mtc  = rg.Matches(template);
                    foreach (Match mt in mtc)
                    {
                        item = item.Replace(mt.Value, dr[mt.Value.Substring(1, mt.Value.Length - 2)].ToString());
                    }
                    html += item;
                }
            }

            html += bl.GetFootHtml();

            return(html);
        }