private string GetBlockContent(string action, Aim.Portal.Model.WebPart part, WebPartExt bl) { try { bl.UserId = UserInfo == null?"":UserInfo.UserID; //特殊Block直接输出html //比如获取我的头像 switch (bl.WebPart.BlockKey) { case "MyHead": return(GetPhotoContent()); case "Weather": return(GetWeatherContent()); case "RssNews": return(GetSummaryContent()); //case "PictureNews": // return GetPictureContent(bl); case "Vote": return(GetVoteContent()); case "ProjectProgressHome": return(GetPics()); default: { if (bl.WebPart.BlockKey.Length == 36) { //News[] news = News //Goodway.Data.DataList dll = Information.GetQueryCatalogList(OAdbAccess, dbAccess, this.UserState.UserId, true); //DataItem di = dll.GetItem("*[@CatalogId='" + bl.BlockKey + "']"); //return GetUserInformNew(di, true, bl); } break; } } //list型block需要传入数据源datalist的在代理里添加即可 if (part.RepeatDataDataSql.Trim() == "") { bl.GetSourceEvent += new Aim.Portal.Model.WebPartExt.GetSourceListEventHandler(bl_GetSourceEvent); } if (part.RepeatItemTemplate.ToLower().IndexOf("</iframe>") >= 0) { return(part.RepeatItemTemplate); } return(bl.GetContentHtml() + bl.GetFootHtml()); } catch (Exception dpe) { return(dpe.Message); } }
protected void Page_Load(object sender, EventArgs e) { string userId = UserInfo != null ? UserInfo.UserID : ""; string reqAction = this.Request["Param"]; switch (reqAction) { //获取各个块内容 case "GetContent": string blockId = this.Request["BlockId"]; Aim.Portal.Model.WebPart part = Aim.Portal.Model.WebPart.Find(blockId); WebPartExt bl = new WebPartExt(part, blockId); part.RepeatItemCount = int.Parse(this.Request["Count"]); content = GetBlockContent(reqAction, part, bl); break; case "GetAllBlock": content = WebPartRule.GetAllBlockNames(userId, this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"], ActiveRecordMediator.GetSessionFactoryHolder().CreateSession(typeof(ActiveRecordBase)).Connection.Database); break; case "GetOneNew": content = WebPartRule.GetOneBlockHtmls(this.Request["BlockId"], userId); WebPartRule.UpdateAfterAddNewOneBlock(userId, this.Request["BlockId"], this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"]); break; case "DeleteBlock": WebPartRule.DeleteBlockFromTemplate(userId, this.Request["BlockId"], this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"]); break; case "SaveOrder": //保存页面布局 string orders = this.Request["Orders"]; WebPartRule.SaveGetBlocks(userId, orders, this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"]); break; case "BlockParam": content = WebPartRule.GetUserBlock(userId, this.Request["BlockId"], this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"]); break; case "BlockUpdate": string blocktitle = this.Request["blocktitle"]; string blockrow = this.Request["blockrow"]; string subjectlength = this.Request["subjectlength"]; string blocktpl = this.Request["blocktpl"]; string blockcolorvalue = Server.HtmlDecode(this.Request["colorvalue"]); string blockid = this.Request["blockid"]; WebPartRule.UpdateUserBlock(userId, blockid, blocktitle, blockrow, subjectlength, blocktpl, blockcolorvalue, this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"]); break; case "GetOneOld": content = WebPartRule.GetOneBlockHtmls(userId, this.Request["BlockId"], this.Request["BlockType"]); 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"]; WebPartRule.ChangeColumns(userId, columns, templateString, this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"], 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"]; WebPartRule.ChangeColumnsWidth(userId, columns1, this.Request["BlockType"], this.Request["TemplateId"], this.Request["IsManage"], layout11, layout21, layout31, layout41); break; case "Reset": content = Reset(); break; default: content = ""; break; #region 主页功能部分 /* * case "SetGlobalColor": * Block.SetGlobalColor(this.UserState.UserId, this.Request["Color"], Server.HtmlDecode(this.Request["ColorValue"]), this.Request["BlockType"], this.RequestDs["TemplateId", ""], this.RequestDs["IsManage", ""]); * this.SysColor = this.Request["Color"]; * break; * case "GetIcons": * content = Block.GetIcons(); * break; * case "SetIcon": * Block.SetIcon(this.UserState.UserId, this.Request["BlockId"], this.Request["BlockType"], this.Request["BlockImg"], this.RequestDs["TemplateId", ""], this.RequestDs["IsManage", ""]); * break; * case "MyRss": * content = MyRss(); * break; */ #endregion case "Menu": string appId = this.Request["AppId"]; InitSubMenu(appId); break; } Response.Write(content); Response.End(); }