Example #1
0
 private string GetUserInformNew(DataElement di, bool IsOnlyNotRead, Aim.Portal.Model.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("没有权限");
     }
 }
        //获取单个块的html
        public static string GetOneBlockHtmls(string blockId, string userId)
        {
            string  blockHtmls     = "";
            string  BlockBeginHtml = "<DIV class=\"drag_div\" id=\"drag_{0}\" style=\"BORDER-COLOR: {1}; BACKGROUND: #fff;Height:{2}\">";
            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='/Modules/WebPart/loading.gif'><SPAN id='loadeditortext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<DIV class='drag_content' style='background-color:{2}' id='drag_content_{0}'>
							<DIV id='loadcontentid_{0}' style='WIDTH: 100px'><IMG src='/Modules/WebPart/loading.gif'><SPAN id='loadcontenttext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<SCRIPT>{1}</SCRIPT>
					</DIV>
				</DIV>"                ;
            WebPart bl             = WebPart.Find(blockId);

            blockHtmls += string.Format(BlockBeginHtml, blockId, bl.ColorValue, bl.DefaultHeight);
            WebPartExt wb = new WebPartExt(bl, userId);

            blockHtmls += wb.GetHeadHtml();
            //是否延时加载
            if (bl.DelayLoadSecond.ToString().Trim() != "0")
            {
                blockHtmls += string.Format(BlockEndHtml, blockId, "window.setTimeout(\"loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "')\"," + Convert.ToString(bl.DelayLoadSecond * 1000) + ");", bl.ContentColor);
            }
            else
            {
                blockHtmls += string.Format(BlockEndHtml, blockId, "loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "');", bl.ContentColor);
            }
            return(blockHtmls);
        }
Example #3
0
        public static string GetCols(string col, string width, int i, DataCollection list, string userId)
        {
            string blockHtmls     = "";
            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;Height:{2}\">";
            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='/Modules/WebPart/loading.gif'><SPAN id='loadeditortext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<DIV class='drag_content' id='drag_content_{0}' style='background-color:{2}'>
							<DIV id='loadcontentid_{0}' style='WIDTH: 100px'><IMG src='/Modules/WebPart/loading.gif'><SPAN id='loadcontenttext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
					</DIV>
				</DIV>
                <SCRIPT>{1}</SCRIPT>";

            blockHtmls += string.Format(colBeginHtml, Convert.ToString(i + 1), width);
            string[] blockIds = col.Split(',');
            //每列的各块

            foreach (string blockId in blockIds)
            {
                if (blockId != "" && WebPart.Exists <String>(blockId))
                {
                    WebPart bl = WebPart.Find(blockId);
                    //读取模版中实例化参数
                    DataElement item = list.GetElement("Id", blockId);
                    if (item != null)
                    {
                        bl.BlockKey         = item.GetAttr("BlockKey");
                        bl.BlockImage       = item.GetAttr("BlockImage");
                        bl.BlockTitle       = item.GetAttr("BlockTitle");
                        bl.BlockType        = item.GetAttr("BlockType");
                        bl.ColorValue       = item.GetAttr("ColorValue");
                        bl.Color            = item.GetAttr("Color");
                        bl.RepeatItemCount  = int.Parse(item.GetAttr("RepeatItemCount"));
                        bl.RepeatItemLength = int.Parse(item.GetAttr("RepeatItemLength"));
                        bl.DelayLoadSecond  = int.Parse(item.GetAttr("DelayLoadSecond"));
                    }
                    blockHtmls += string.Format(BlockBeginHtml, blockId, bl.ColorValue, bl.DefaultHeight);
                    WebPartExt wb = new WebPartExt(bl, userId);
                    blockHtmls += wb.GetHeadHtml();
                    //是否延时加载
                    if (bl.DelayLoadSecond.ToString().Trim() != "0")
                    {
                        blockHtmls += string.Format(BlockEndHtml, blockId, "window.setTimeout(\"loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "')\"," + Convert.ToString(bl.DelayLoadSecond * 1000) + ");" + "\n" + bl.RelateScript, bl.ContentColor);
                    }
                    else
                    {
                        blockHtmls += string.Format(BlockEndHtml, blockId, "loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "');" + "\n" + bl.RelateScript, bl.ContentColor);
                    }
                }
            }
            blockHtmls += string.Format(colEndHtml, Convert.ToString(i + 1));
            return(blockHtmls);
        }
        private void Asyn()
        {
            Aim.Portal.Model.WebPart part = null;
            //if (Aim.Portal.Model.WebPart.FindAll(Expression.Eq("BlockKey", Aim.Utilities.Tool.GetPYString(type.TypeName))).Length > 0)
            //{
            //    part = Aim.Portal.Model.WebPart.FindFirst(Expression.Eq("BlockKey", Aim.Utilities.Tool.GetPYString(type.TypeName)));
            //}FindAll("FROM WebPart as ent where RepeatDataDataSql is not null and Id!='8eb3ebd5-74f0-4909-89b2-2b0c715eae23'").FirstOrDefault();
            //else
            //{
            part = new Aim.Portal.Model.WebPart();
            //直接用院内新闻作为模板这个是院内新闻的WebPartId f8fc2786-3707-4dd5-b7bf-3c26a47e4e7a
            Aim.Portal.Model.WebPart partOld = Aim.Portal.Model.WebPart.Find("f8fc2786-3707-4dd5-b7bf-3c26a47e4e7a");
            part = DataHelper.MergeData <Aim.Portal.Model.WebPart>(part, partOld);
            //}
            string sql = @"declare @path varchar(300)
                        select @path=g.Path from SysGroup g inner join sysusergroup ug on ug.GroupId=g.GroupId 
                        where UserId='[UserId]'
                        select top 6 n.Id,n.Title,Convert(varchar(10),n.PostTime,20) as NewTime, PostTime from News n 
                        inner join NewsType nt on nt.Id=n.TypeId 
                        where TypeId='{0}' 
                        and State='2' and isnull(ExpireTime,'2099-01-01')>=getdate()
                        and (charindex('[UserId]',n.ReceiveUserId)>0 or charindex('[UserId]',nt.AllowQueryId)>0 or 
                        exists (select Id from Competence c where c.Ext1=n.Id and charindex(PId,@path)>0)
                        or exists (select Id from Competence c where c.Ext1=nt.Id and charindex(PId,@path)>0))
                        order by PostTime desc";

            part.RepeatDataDataSql = string.Format(sql, type.Id);
            part.AllowUserIds      = type.AllowQueryId;
            part.HeadHtml          = @"<DIV id='drag_title_[Id]' style='BACKGROUND-Color: #D0DDF1;WIDTH: 100%; HEIGHT: 20px'>
                        <TABLE cellSpacing=0 cellPadding=0 width='100%' border=0>
                        <INPUT id='blocktypevalue_[Id]' type='hidden' value='37' name='blocktypevalue_[Id]'><TR><TD></TD><TD>          
                        <DIV id='drag_[Id]_h' style='WIDTH: 100%; HEIGHT: 30px;FONT-WEIGHT: bold;line-height:30px'><SPAN class='title-1-l'  id='drag_text_[Id]' 
                        style='padding-left:5px'><table height=100% style='FONT-WEIGHT: bold;'><tr><td valign=center><IMG id='drag_img_[Id]' 
                        src='/Modules/WebPart/Icons/gif-0856.gif'></td><td valign=center>[BlockTitle]</td></tr></table></SPAN></DIV></TD>              
                        <TD onmousemove=switchOptionImg('[Id]',1) style='WIDTH: 120px;' onmouseout=switchOptionImg('[Id]',0)
                        align='right'><SPAN class='title-1-r'><IMG class='imglinkgray' id='drag_switch_img_[Id]' title='展开/隐藏' onclick=switchDrag('drag_switch_[Id]',this)
                        src='/Modules/WebPart/open.gif'> <IMG class='imglinkgray' id='drag_refresh_img_[Id]' title='刷新' 
                        onclick=resetDragContent('[Id]');loadDragContent('[Id]','[RepeatItemCount]');
                        src='/Modules/WebPart/refresh.gif'> <IMG class='imglinkgray' id='drag_edit_img_[Id]' title='编辑' onclick=modifyBlock('[Id]')
                        src='/Modules/WebPart/edit.gif'> <IMG class='imglinkgray' id='drag_delete_img_[Id]' title='删除' onclick=delDragDiv('[Id]')
                        src='/Modules/WebPart/closetab.gif'>&nbsp;&nbsp;<img SRC='/Modules/webPart/Icons/More.png' style='vertical-align:bottom;'  
                        onclick={0}window.open('/Modules/PubNews/NewsCreateList.aspx?op=r&TypeId={1}','_blank','width=1000,height=500');{0}/></SPAN>
                        </TD> </TR> </TABLE></DIV>"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ;
            part.HeadHtml          = string.Format(part.HeadHtml, '"', type.Id);
            part.AllowUserNames    = type.AllowQueryName;
            part.DeptId            = type.BelongDeptId;
            part.DeptName          = type.BelongDeptName;
            part.BlockKey          = Aim.Utilities.Tool.GetPYString(type.TypeName);
            part.BlockName         = type.TypeName;
            part.BlockTitle        = type.TypeName;
            part.RepeatItemCount   = 5;
            if (type.BelongDeptId != null && type.BelongDeptId != "")
            {
                part.BlockType = "DeptPortal";
            }
            part.Save();
        }
Example #5
0
        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)
        {
            SearchCriterion.SetOrder("BlockType");
            if (!string.IsNullOrEmpty(this.RequestData.Get <string>("BlockType")))
            {
                ents = WebPartRule.FindAll(SearchCriterion, Expression.Eq("BlockType", this.RequestData.Get <string>("BlockType")));
            }
            else
            {
                ents = WebPartRule.FindAll(SearchCriterion, Expression.Eq("BlockType", "portal"));
            }

            this.PageState.Add("WebPartList", ents);
            this.PageState.Add("BlockType", SysEnumeration.GetEnumDict("BlockType"));

            Aim.Portal.Model.WebPart ent = null;
            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
                ent = this.GetPostedData <Aim.Portal.Model.WebPart>();
                ent.Create();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                ent = this.GetMergedData <Aim.Portal.Model.WebPart>();
                ent.Update();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Aim.Portal.Model.WebPart>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                IList <object> idList = RequestData.GetList <object>("IdList");

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        WebPartRule.BatchRemoveByPrimaryKeys(idList);
                    }
                }
                break;
            }
        }
        //获取单个块的html
        public static string GetOneBlockHtmls(string userId, string blockId, string blockType)
        {
            string blockHtmls     = "";
            string BlockBeginHtml = "<DIV class=\"drag_div\" id=\"drag_{0}\" style=\"BORDER-COLOR: {1}; BACKGROUND: #fff;Height:{2}\">";
            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='/Modules/WebPart/loading.gif'><SPAN id='loadeditortext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<DIV class='drag_content' id='drag_content_{0}' style='background-color:{2}'>
							<DIV id='loadcontentid_{0}' style='WIDTH: 100px'><IMG src='/Modules/WebPart/loading.gif'><SPAN id='loadcontenttext_{0}' style='COLOR: #333'></SPAN></DIV>
						</DIV>
						<SCRIPT>{1}</SCRIPT>
					</DIV>
				</DIV>"                ;

            if (blockId != "")
            {
                WebPart         bl          = WebPart.Find(blockId);
                WebPartTemplate dr          = WebPartTemplate.FindAllByProperties("UserId", userId, "IsDefault", "T", "BlockType", blockType)[0];
                string          templateXml = dr.TemplateXml;
                DataCollection  list        = new DataCollection(templateXml);
                DataElement     item        = list.GetElement("Id", blockId);
                if (item != null)
                {
                    bl.BlockKey         = item.GetAttr("BlockKey");
                    bl.BlockImage       = item.GetAttr("BlockImage");
                    bl.BlockTitle       = item.GetAttr("BlockTitle");
                    bl.BlockType        = item.GetAttr("BlockType");
                    bl.ColorValue       = item.GetAttr("ColorValue");
                    bl.Color            = item.GetAttr("Color");
                    bl.RepeatItemCount  = int.Parse(item.GetAttr("RepeatItemCount"));
                    bl.RepeatItemLength = int.Parse(item.GetAttr("RepeatItemLength"));
                    bl.DelayLoadSecond  = int.Parse(item.GetAttr("DelayLoadSecond"));
                }
                blockHtmls += string.Format(BlockBeginHtml, blockId, bl.ColorValue, bl.DefaultHeight);
                WebPartExt wb = new WebPartExt(bl, userId);
                blockHtmls += wb.GetHeadHtml();
                //是否延时加载
                if (bl.DelayLoadSecond.ToString().Trim() != "0")
                {
                    blockHtmls += string.Format(BlockEndHtml, blockId, "window.setTimeout(\"loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "')\"," + Convert.ToString(bl.DelayLoadSecond * 1000) + ");", bl.ContentColor);
                }
                else
                {
                    blockHtmls += string.Format(BlockEndHtml, blockId, "loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "');", bl.ContentColor);
                }
            }
            return(blockHtmls);
        }
        private string GetUserInform(DataElement di, Aim.Portal.Model.WebPart bl)
        {
            /*string catalogId = di.GetAttr("CatalogId");
            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 "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Aim.Portal.Model.WebPart usr = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                usr = this.GetMergedData <Aim.Portal.Model.WebPart>();
                usr.SaveAndFlush();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
            case RequestActionEnum.Copy:
                usr          = this.GetPostedData <Aim.Portal.Model.WebPart>();
                usr.IsHidden = "0";
                usr.CreateAndFlush();
                if (RequestAction == RequestActionEnum.Copy)
                {
                    this.SetMessage("复制成功!");
                }
                else
                {
                    this.SetMessage("新建成功!");
                }
                break;

            case RequestActionEnum.Delete:
                usr = this.GetTargetData <Aim.Portal.Model.WebPart>();
                usr.DeleteAndFlush();
                this.SetMessage("删除成功!");
                return;

                break;

            case RequestActionEnum.Default:
                break;
            }

            if (this.Request["Id"] != null)
            {
                Aim.Portal.Model.WebPart user = Aim.Portal.Model.WebPart.Find(this.Request["Id"]);
                this.SetFormData(user);
            }
            this.PageState.Add("BlockType", SysEnumeration.GetEnumDict("BlockType"));
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ents = WebPartRule.FindAll(SearchCriterion);

            this.PageState.Add("WebPartList", ents);

            Aim.Portal.Model.WebPart ent = null;
            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
                ent = this.GetPostedData <Aim.Portal.Model.WebPart>();
                ent.Create();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                ent = this.GetMergedData <Aim.Portal.Model.WebPart>();
                ent.Update();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Aim.Portal.Model.WebPart>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Execute:
                DataHelper.ExecSql(" delete from WebPartTemplate where isnull(UserID,'')<>'' and IsDefault='T' and BlockType='Portal'");
                break;

            case RequestActionEnum.Custom:
                IList <object> idList = RequestData.GetList <object>("IdList");

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        WebPartRule.BatchRemoveByPrimaryKeys(idList);
                    }
                }
                break;
            }
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ents = WebPartRule.FindAll(SearchCriterion);
            this.PageState.Add("WebPartList", ents);

            Aim.Portal.Model.WebPart ent = null;
            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
                ent = this.GetPostedData <Aim.Portal.Model.WebPart>();
                ent.Create();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                ent = this.GetMergedData <Aim.Portal.Model.WebPart>();
                ent.Update();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Aim.Portal.Model.WebPart>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                IList <object> idList = RequestData.GetList <object>("IdList");

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        WebPartRule.BatchRemoveByPrimaryKeys(idList);
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
 private string GetInformHtml(DataCollection dl, Aim.Portal.Model.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();
 }
        //添加新模块了,保存主页个人模版
        public static void UpdateAfterAddNewOneBlock(string userId, string blockId, string blockType, string templateId, string isManage)
        {
            WebPartTemplate dr = GetWebPartTemplateRecord(userId, blockType, templateId, isManage);
            //DbRecord dr = new DbRecord(daAccess,"DoorTemplate","UserId",userId,"IsDefault","T","BlockType",blockType);
            string         tempXml = dr.TemplateXml;
            DataCollection list    = new DataCollection(tempXml);
            WebPart        bl      = WebPart.Find(blockId);
            DataElement    item    = list.NewElement();

            item.SetAttr("Id", bl.Id);
            item.SetAttr("BlockTitle", bl.BlockTitle);
            item.SetAttr("BlockKey", bl.BlockKey);
            item.SetAttr("BlockImage", bl.BlockImage);
            item.SetAttr("RepeatItemCount", bl.RepeatItemCount.Value.ToString());
            item.SetAttr("RepeatItemLength", bl.RepeatItemLength.Value.ToString());
            item.SetAttr("Color", bl.Color);
            item.SetAttr("ColorValue", bl.ColorValue);
            item.SetAttr("DelayLoadSecond", bl.DelayLoadSecond.Value.ToString());
            dr.TemplateXml    = list.ToString();
            dr.TemplateString = dr.TemplateString + "," + blockId;
            dr.Update();
        }
 public WebPartExt(WebPart webpart, string userid)
 {
     WebPart = webpart;
     UserId  = userid;
 }
Example #15
0
        //获得图片新闻
        private string GetPictureContent(Aim.Portal.Model.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());
        }
Example #16
0
        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();
        }
 public WebPartExt(WebPart webpart)
 {
     WebPart = webpart;
 }