private string GetUserInformNew(DataElement di, bool IsOnlyNotRead, Aim.Portal.Entity.WebPart bl) { if (di != null) { /*string catalogId = di.GetAttr("CatalogId"); * if (IsOnlyNotRead == false) * { * return GetUserInform(di, bl); * } * * DataForm df = Information.GetInformQueryForm(catalogId); * * //df.SetValue("BelongDeptId","PRO0001I"); * df.SetValue("State", "1"); * df.SetValue("ExpireTimeMin", DateTime.Now.ToString()); * * df.RemoveAttr("PageIndex"); * * Goodway.Data.DataList dlQuery = Information.GetQueryResultList(OAdbAccess, "PublicInformation(ExpireTime,Pictures,HomePagePopup,PopupIds,Attachments,Class,Title,PostDeptName,PostTime,Id)", df, new DataEnum(), this.UserState.UserId); * return GetInformHtml(dlQuery, bl, di);*/ return(""); } else { return("没有权限"); } }
private string GetBlockContent(string action, Aim.Portal.Entity.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.Rule.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); } }
private string GetInformHtml(DataCollection dl, Aim.Portal.Entity.WebPart bl, DataElement di) { StringBuilder sb = new StringBuilder(); /*DateTime nowDate = DateTime.Now; * for (int i = 0; i < dl.GetItemCount(); i++) * { * if (i == int.Parse(bl.RepeatItemCount)) * break; * DataItem diP = dl.GetItem(i); * if (di.GetAttr("Fate") != "" && ((TimeSpan)nowDate.Subtract((DateTime.Parse(diP.GetAttr("PostTime"))))).Days <= Convert.ToInt32(di.GetAttr("Fate"))) * { * sb.AppendFormat("<TABLE width='100%' border='0' style='TABLE-LAYOUT: fixed;BORDER-COLLAPSE: collapse'><TR><TD WIDTH='*'><div class=\"linkdiv\" Title=\"{1}\"><IMG SRC=\"image/new.gif\" WIDTH=\"15\" HEIGHT=\"10\" BORDER=\"0\" ALT=\"\"><a onclick=\"OpenNews('/officeauto/PubInfo/InformView.aspx?FuncType=View&Id={0}');\" href='javascript:void(0);'>{1}</a></div></TD><TD WIDTH='80px' align='center'><div class=\"linkdiv\">{2}</div></TD></TR></TABLE>", diP.GetAttr("Id"), diP.GetAttr("Title"), DateTime.Parse(diP.GetAttr("PostTime")).ToString("yyyy-MM-dd")); * } * else * { * sb.AppendFormat("<TABLE width='100%' border='0' style='TABLE-LAYOUT: fixed;BORDER-COLLAPSE: collapse'><TR><TD WIDTH='*'><div class=\"linkdiv\" Title=\"{1}\"><IMG SRC=\"Blockimages/Icons/sms.gif\" WIDTH=\"15\" HEIGHT=\"10\" BORDER=\"0\" ALT=\"\"><a onclick=\"OpenNews('/officeauto/PubInfo/InformView.aspx?FuncType=View&Id={0}');\" href='javascript:void(0);'>{1}</a></div></TD><TD WIDTH='80px' align='center'><div class=\"linkdiv\">{2}</div></TD></TR></TABLE>", diP.GetAttr("Id"), diP.GetAttr("Title"), DateTime.Parse(diP.GetAttr("PostTime")).ToString("yyyy-MM-dd")); * } * } * sb.Append("<TABLE width='100%' border='0' style='TABLE-LAYOUT: fixed;BORDER-COLLAPSE: collapse'><TR><TD><div align=\"right\" style=\"padding:2px;font-size:12px;\"><a href=\"javascript:OpenCatalogNews('/officeauto/pubinfo/CatalogQuery.aspx?CatalogName=" + di.GetAttr("CatalogName") + "&CatalogId=" + di.GetAttr("CatalogId") + "')\">更多</a></div></TD></TR></TABLE>");*/ return(sb.ToString()); }
//获得图片新闻 private string GetPictureContent(Aim.Portal.Entity.WebPart bl) { StringBuilder sb = new StringBuilder(); // sb.Append("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='100%' height='220px'>"); // sb.Append("<param name='allowScriptAccess' value='sameDomain'><param name='movie' value='BlockImages/bcastr31.swf'><param name='quality' value='high'><param name='bgcolor' value='#ffffff'>"); // sb.Append("<param name='wmode' value='transparent'>"); // sb.Append("<param name='FlashVars' value='bcastr_file=BlockImages/1.jpg|BlockImages/2.jpg|BlockImages/3.jpg|BlockImages/4.jpg|BlockImages/5.jpg&bcastr_link=图1|图2|图3|图4|图5&bcastr_title=1.htm|1.htm|1.htm|1.htm|1.htm'>"); // sb.Append("</object>"); /* * string imgUrl1="http://www.soojs.com/folder/经典广告/焦点/01.jpg"; * string imgtext1="图片新闻01"; * string imgLink1="http://www.goodwaysoft.com"; * string imgUrl2="http://www.soojs.com/folder/经典广告/焦点/02.jpg"; * string imgtext2="图片新闻02"; * string imgLink2="http://www.goodwaysoft.com"; * string imgUrl3="http://www.soojs.com/folder/经典广告/焦点/03.jpg"; * string imgtext3="图片新闻03"; * string imgLink3="http://www.goodwaysoft.com"; * string imgUrl4="http://www.soojs.com/folder/经典广告/焦点/04.jpg"; * string imgtext4="图片新闻04"; * string imgLink4="http://www.goodwaysoft.com"; * string imgUrl5="http://www.goodwaysoft.com/folder/经典广告/焦点/05.jpg"; * string imgtext5="图片新闻05"; * string imgLink5="http://www.goodwaysoft.com"; * * string pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5; * string links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5; * string texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5; */ int focus_width = 240; int focus_height = 200; int text_height = 18; int swf_height = focus_height + text_height; string pics = ""; string links = ""; string texts = ""; /*DbRecord dr = new DbRecord(OAdbAccess, "PublicInformCatalog", bl.BlockKey); * Goodway.Data.DataList dll = Information.GetQueryCatalogList(OAdbAccess, dbAccess, this.UserState.UserId, true); * DataItem di = dll.GetItem("*[@CatalogId='" + bl.BlockKey + "']"); * if (di != null) * { * string catalogId = di.GetAttr("CatalogId"); * DataForm df = Information.GetInformQueryForm(catalogId); * df.SetValue("BelongDeptId", dr["BelongDeptId"]); * df.SetValue("State", "1"); * df.SetValue("ExpireTimeMin", DateTime.Now.ToString()); * df.RemoveAttr("PageIndex"); * //得到所有为上条件的所有信息 * * Goodway.Data.DataList dlQuery = Information.GetQueryResultList(OAdbAccess, "PublicInformation(ExpireTime,Pictures,HomePagePopup,PopupIds,Attachments,Class,Title,PostDeptName,PostTime,Id)", df, new DataEnum(), this.UserState.UserId); * for (int i = 0; i < dlQuery.GetItemCount(); i++) * { * DataItem item = dlQuery.GetItem(i); * pics += string.Format("http://{0}:{1}/officeauto/PubInfo/files/image/{2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, item.GetAttr("Pictures")) + "|"; * links += string.Format("http://{0}:{1}/officeauto/PubInfo/InformView.aspx?Id={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, item.GetAttr("Id")) + "|"; * texts += item.GetAttr("Title") + "|"; * if (i == 4) * break; * } * pics = pics.TrimEnd('|'); * links = links.TrimEnd('|'); * texts = texts.TrimEnd('|'); * * sb.Append("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='" + focus_width.ToString() + "' height='" + swf_height.ToString() + "'>"); * sb.Append("<param name='allowScriptAccess' value='sameDomain'><param name='movie' value='/Portal/BlockImages/focus1.swf'><param name='quality' value='high'><param name='bgcolor' value='#F0F0F0'>"); * sb.Append("<param name='menu' value='false'><param name=wmode value='opaque'>"); * sb.Append("<param name='FlashVars' value='pics=" + pics + "&links=" + links + "&texts=" + texts + "&borderwidth=" + focus_width.ToString() + "&borderheight=" + focus_height.ToString() + "&textheight=" + text_height.ToString() + "'>"); * sb.Append("</object>"); * }*/ return(sb.ToString()); }
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.Entity.WebPart part = Aim.Portal.Entity.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(); }