Esempio n. 1
0
        // 新创建内容行
        PlaceHolder NewContentLine(Control content,
            int nLineNo,
            Control insertpos)
        {
            PlaceHolder line = new PlaceHolder();
            line.ID = "line" + Convert.ToString(nLineNo);

            if (insertpos != null)
            {
                int index = content.Controls.IndexOf(insertpos);
                content.Controls.AddAt(index, line);
            }
            else
            {
                content.Controls.Add(line);
            }

            // 左侧文字
            AutoIndentLiteral auto_literal = new AutoIndentLiteral();
            auto_literal.Text = "<%begin%><tr class='content'><%begin%><td class='no";  // contentup
            line.Controls.Add(auto_literal);

            LiteralControl line_class = new LiteralControl();
            line_class.ID = "line" + Convert.ToString(nLineNo) + "_class";
            line.Controls.Add(line_class);

            line.Controls.Add(new LiteralControl("' >"));   // rowspan='2'

            // 序号
            LiteralControl literal = new LiteralControl();
            literal.ID = "line" + Convert.ToString(nLineNo) + "_no";
            line.Controls.Add(literal);

            // checkbox
            CheckBox checkbox = new CheckBox();
            checkbox.ID = "line" + Convert.ToString(nLineNo) + "_checkbox";
            checkbox.CssClass = "comment_checkbox";
            checkbox.Attributes.Add("onclick", "onColumnCheckboxClick(this);");
            line.Controls.Add(checkbox);

            auto_literal = new AutoIndentLiteral();
            auto_literal.Text = "<%end%></td>"; // "<%begin%><td class='path'>";
            line.Controls.Add(auto_literal);

            auto_literal = new AutoIndentLiteral();
            auto_literal.Text = "<%begin%><td class='review'>";
            line.Controls.Add(auto_literal);

            // 一个评注
            CommentControl comment = new CommentControl();
            comment.ID = "line" + Convert.ToString(nLineNo) + "_comment";
            comment.WantFocus -= new WantFocusEventHandler(commentcontrol_WantFocus);
            comment.WantFocus += new WantFocusEventHandler(commentcontrol_WantFocus);
            line.Controls.Add(comment);

            auto_literal = new AutoIndentLiteral();
            auto_literal.Text = "<%end%></td><%begin%><td class='biblio'>";
            line.Controls.Add(auto_literal);

            // 书目摘要
            literal = new LiteralControl();
            literal.ID = "line" + Convert.ToString(nLineNo) + "_bibliosummary";
            line.Controls.Add(literal);

            // 创建新评注
            Button newreview = new Button();
            newreview.Text = this.GetString("新评注");
            newreview.ID = "line" + Convert.ToString(nLineNo) + "_newreview";
            newreview.CssClass = "newreview";
            newreview.ToolTip = this.GetString("为按钮下方的书目记录创建一条新评注");
            newreview.Visible = false;
            line.Controls.Add(newreview);

            PlaceHolder biblioinfo_holder = new PlaceHolder();
            biblioinfo_holder.ID = "line" + Convert.ToString(nLineNo) + "_biblioinfo_holder";
            line.Controls.Add(biblioinfo_holder);

            BiblioControl bibliocontrol = new BiblioControl();
            bibliocontrol.ID = "line_" + nLineNo.ToString() + "_bibliocontrol";
            bibliocontrol.WantFocus -= new WantFocusEventHandler(bibliocontrol_WantFocus);
            bibliocontrol.WantFocus += new WantFocusEventHandler(bibliocontrol_WantFocus);
            biblioinfo_holder.Controls.Add(bibliocontrol);

            auto_literal = new AutoIndentLiteral();
            auto_literal.Text = "<%end%></td><%end%></tr>";
            line.Controls.Add(auto_literal);
            return line;
        }
Esempio n. 2
0
        void CreateTopRightTable()
        {
            // 表格开始
            AutoIndentLiteral literal = new AutoIndentLiteral();
            literal.Text = "<%begin%><table class='toprightcmd'>"
                + "<%begin%><tr class='toprightcmd'>";
            this.Controls.Add(literal);

            // login
            PlaceHolder loginholder = new PlaceHolder();
            loginholder.ID = "loginholder";
            this.Controls.Add(loginholder);

            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td nowrap>";
            loginholder.Controls.Add(literal);

            string strLang = Thread.CurrentThread.CurrentUICulture.Name;

            HyperLink hyper = new HyperLink();
            hyper.ID = "login";
            hyper.Text = this.GetString("登录");
            hyper.NavigateUrl = GetLoginUrl();
#if NO
            hyper.NavigateUrl = "./login.aspx";    // "./login.aspx?lang=" + strLang;
            if (this.Dp2Sso == "first")
            {
                hyper.NavigateUrl += "?dp2sso=first&redirect=" + HttpUtility.UrlEncode(this.Page.Request.RawUrl);
            }
#endif

            loginholder.Controls.Add(hyper);
            

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            loginholder.Controls.Add(literal);


            // logout
            PlaceHolder logoutholder = new PlaceHolder();
            logoutholder.ID = "logoutholder";
            this.Controls.Add(logoutholder);

            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td nowrap>";
            logoutholder.Controls.Add(literal);


            hyper = new HyperLink();
            hyper.ID = "logout";
            hyper.Text = this.GetString("登出");
            hyper.NavigateUrl = "./login.aspx?action=logout";   //  "./login.aspx?action=logout&lang=" + strLang;
            if (this.Dp2Sso == "first")
            {
                hyper.NavigateUrl += "&redirect=" + HttpUtility.UrlEncode(this.Page.Request.RawUrl);
            }
            logoutholder.Controls.Add(hyper);

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            logoutholder.Controls.Add(literal);


            // 刷新
            PlaceHolder refreshholder = new PlaceHolder();
            refreshholder.ID = "refreshholder";
            this.Controls.Add(refreshholder);

            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td nowrap>";
            refreshholder.Controls.Add(literal);

            LinkButton refreshbutton = new LinkButton();
            refreshbutton.Text = this.GetString("刷新");
            refreshbutton.Click += new EventHandler(refreshbutton_Click);
            refreshholder.Controls.Add(refreshbutton);

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            refreshholder.Controls.Add(literal);

            ////

            // 馆代码
            PlaceHolder librarycodeholder = new PlaceHolder();
            librarycodeholder.ID = "librarycodeholder";
            this.Controls.Add(librarycodeholder);

            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td nowrap>";
            librarycodeholder.Controls.Add(literal);

            DropDownList librarycodelist = new DropDownList();
            librarycodelist.ID = "librarycodelist";
            //librarycodelist.Width = new Unit("100%");
            librarycodelist.AutoPostBack = true;
            librarycodelist.CssClass = "librarycodelist";
            librarycodelist.SelectedIndexChanged += new EventHandler(librarycodelist_SelectedIndexChanged);
            librarycodeholder.Controls.Add(librarycodelist);

            if (this.Page.IsPostBack == false)
            {
                OpacApplication app = (OpacApplication)this.Page.Application["app"];
                List<string> codes = app.GetAllLibraryCodes();

                // 限定馆代码
                string strLimit = app.LimitWebUiLibraryCode;
                if (string.IsNullOrEmpty(strLimit) == true)
                    codes = app.GetAllLibraryCodes();
                else
                    codes = StringUtil.SplitList(strLimit);

                if (codes.Count > 0)
                    FillLibraryCodeList(librarycodelist,
                        codes,
                        string.IsNullOrEmpty(strLimit));
                else
                {
                    librarycodeholder.Visible = false;
                }
            }

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            librarycodeholder.Controls.Add(literal);

            ////


            // UI语言
            PlaceHolder langholder = new PlaceHolder();
            langholder.ID = "langholder";
            this.Controls.Add(langholder);

            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td nowrap>";
            langholder.Controls.Add(literal);

            CreateLangList(langholder);

            /*
            DropDownList list = new DropDownList();
            list.ID = "langlist";
            //list.Width = new Unit("100%");
            list.AutoPostBack = true;
            list.CssClass = "lang";
            // list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
            langholder.Controls.Add(list);
             * */

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            langholder.Controls.Add(literal);

            // FillLangList(list);

            /*
            // 内容
            literal = new LiteralControl();
            literal.Text = "<td>登录</td>"
                + "<td>登出</td>"
                + "<td>刷新</td>";
            this.Controls.Add(literal);
             * */

            /*
            // 登录
            linkbutton = new LinkButton();
            linkbutton.ID = "login";
            linkbutton.Text = "登录";
            linkbutton.Click +=new EventHandler(loginButton_Click);
            this.Controls.Add(linkbutton);

            // 登出
            linkbutton = new LinkButton();
            linkbutton.ID = "logout";
            linkbutton.Text = "登出";
            linkbutton.Click += new EventHandler(logoutButton_Click);
            this.Controls.Add(linkbutton);

             * */


            // 表格结束
            literal = new AutoIndentLiteral();
            literal.Text = "<%end%></tr>"
            + "<%end%></table>";
            this.Controls.Add(literal);
        }
Esempio n. 3
0
        void CreateColumns()
        {
            // 获得配置参数
            OpacApplication app = (OpacApplication)this.Page.Application["app"];
            /*
             * 
	<titleBarControl>
		<leftAnchor lang='zh'>
			<a href="http://dp2003.com">图书馆主页</a>
		</leftAnchor>
		<leftAnchor lang='en'>
			<a href="http://dp2003.com">Library Homepage</a>
		</leftAnchor>        ...
             */
            string strLeftHtml = "";
            // XmlNode nodeLeftAnchor = app.WebUiDom.DocumentElement.SelectSingleNode("titleBarControl/leftAnchor");
            XmlNode parent = app.WebUiDom.DocumentElement.SelectSingleNode("titleBarControl");
            if (parent != null)
            {
                // 从一个元素的下级的多个<strElementName>元素中, 提取语言符合的XmlNode
                // parameters:
                //      bReturnFirstNode    如果找不到相关语言的,是否返回第一个<strElementName>
                XmlNode nodeLeftAnchor = DomUtil.GetLangedNode(
                    this.Lang,
                    parent,
                    "leftAnchor");
                if (nodeLeftAnchor != null)
                {
                    strLeftHtml = nodeLeftAnchor.InnerXml;
                }
            }

            // 左边第一个
            AutoIndentLiteral literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td class='left'>"
                + strLeftHtml
                + "</td>";
            this.Controls.Add(literal);

            // bool bPublic = IsPublic();
            LoginState loginstate = GlobalUtil.GetLoginState(this.Page);

            // if (this.CurrentColumn != TitleColumn.None)
            {

                string strClass = "normal";

                HyperLink hyperlink = null;

                if (loginstate == LoginState.Librarian
                    && this.ReaderBarcode != "")
                {

                    // 其余栏目

                    // 读者的综合信息
                    if (this.CurrentColumn == TitleColumn.ReaderInfo)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "ReaderInfo";
                    hyperlink.Text = this.GetString("读者")
                        + " " + this.ReaderBarcode;
                    hyperlink.NavigateUrl = "./readerinfo.aspx?barcode=" + this.ReaderBarcode;
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }

                if (loginstate == LoginState.Reader)
                {

                    // 其余栏目

                    // 借阅信息
                    if (this.CurrentColumn == TitleColumn.BorrowInfo)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "BorrowInfo";
                    hyperlink.Text = this.GetString("借阅信息");
                    hyperlink.NavigateUrl = "./borrowinfo.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }

                if (loginstate == LoginState.Reader)
                {

                    // 预约
                    if (this.CurrentColumn == TitleColumn.ReservationInfo)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "ReservationInfo";
                    hyperlink.Text = this.GetString("预约");
                    hyperlink.NavigateUrl = "./reservationinfo.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }
#if NO
                if (loginstate == LoginState.Reader)
                {
                    // 违约
                    if (this.CurrentColumn == TitleColumn.FellBackInfo)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "FellBackInfo";
                    hyperlink.Text = this.GetString("违约_and_交费");   // "违约/交费"
                    hyperlink.NavigateUrl = "./fellbackinfo.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }
#endif

#if NO
                if (loginstate == LoginState.Reader)
                {
                    // 借阅历史
                    if (this.CurrentColumn == TitleColumn.BorrowHistory)
                        strClass = "active";
                    else
                        strClass = "normal";

                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "BorrowHistory";
                    hyperlink.Text = this.GetString("借阅历史");
                    hyperlink.NavigateUrl = "./borrowhistory.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }
#endif

                // 检索
                if (this.CurrentColumn == TitleColumn.Search)
                    strClass = "active";
                else
                    strClass = "normal";

                literal = new AutoIndentLiteral();
                literal.Text = "<%normal%><td class='" + strClass + "'>";
                this.Controls.Add(literal);

                hyperlink = new HyperLink();
                hyperlink.ID = "Search";
                hyperlink.Text = this.GetString("检索");
                hyperlink.NavigateUrl = "./searchbiblio.aspx";
                this.Controls.Add(hyperlink);

                literal = new AutoIndentLiteral();
                literal.Text = "</td>";
                this.Controls.Add(literal);

                // 浏览
                string strAspx = this.Page.Server.MapPath("./browse.aspx");
                string strBrowseXml = app.DataDir + "/browse/browse.xml";
                string strSidebarXml = app.DataDir + "/browse/browse_sidebar.xml";

                if (File.Exists(strAspx) == true
                    && File.Exists(strBrowseXml) == true)
                {
                    if (this.CurrentColumn == TitleColumn.Browse)
                        strClass = "active";
                    else
                        strClass = "normal";

                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "browse";
                    hyperlink.Text = this.GetString("浏览");
                    hyperlink.NavigateUrl = "./browse.aspx?datafile=browse.xml";
                    if (File.Exists(strSidebarXml) == true)
                        hyperlink.NavigateUrl += "&sidebar=browse_sidebar.xml";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);
                }

                // 书评
                bool bEnableBookReview = true;
                strAspx = this.Page.Server.MapPath("./column.aspx");
                XmlNode nodeBookReview = app.WebUiDom.DocumentElement.SelectSingleNode("bookReview");
                if (nodeBookReview != null)
                {
                    string strError = "";
                    DomUtil.GetBooleanParam(nodeBookReview,
                        "enable",
                        true,
                        out bEnableBookReview,
                        out strError);
                }

                if (File.Exists(strAspx) == true
                    && bEnableBookReview == true)
                {
                    if (this.CurrentColumn == TitleColumn.BookReview)
                        strClass = "active";
                    else
                        strClass = "normal";

                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "bookReview";
                    hyperlink.Text = this.GetString("书评");
                    hyperlink.NavigateUrl = "./column.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);
                }

                if (loginstate == LoginState.Librarian
                    || loginstate == LoginState.Reader)
                {

                    // 消息
                    if (this.CurrentColumn == TitleColumn.Message)
                        strClass = "active";
                    else
                        strClass = "normal";

                    // 这里可以做适当cache
                    int nUnreadCount = 0;

#if NO
                    if (this.GetInboxUnreadCount != null)
                    {
                        GetInboxUnreadCountEventArgs e = new GetInboxUnreadCountEventArgs();

                        this.GetInboxUnreadCount(this, e);
                        nUnreadCount = e.UnreadCount;
                    }

                    // 2007/7/7
                    // 如果和曾经记忆的不同
                    if (nUnreadCount != this.UnreadMessageCount)
                    {
                        SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];
                        // 触发清除读者记录缓存
                        // 这样做的目的是,假如读者接到了通知信件,那可能是读者记录发生了改变(例如预约到书等),这里及时清除缓存,能确保读者读到的信件和预约状态等显示保持同步,防止出现迷惑读者的信息新旧状态不同的情况
                        // 当然,页面上的Refresh命令也能起到同样的作用
                        if (sessioninfo != null)
                            sessioninfo.Clear();

                        // 记忆新值
                        this.UnreadMessageCount = nUnreadCount;
                    }
#endif

                    string strText = this.GetString("消息");

                    if (nUnreadCount != 0)
                        strText += "(" + nUnreadCount.ToString() + ")";


                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + " messagecolumn'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "Message";
                    hyperlink.Text = strText;
                    hyperlink.NavigateUrl = "./mymessage.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }

                if (loginstate == LoginState.Reader)
                {
                    // 我的书架
                    if (this.CurrentColumn == TitleColumn.MyBookShelf)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "MyBookShelf";
                    hyperlink.Text = this.GetString("我的书架");
                    hyperlink.NavigateUrl = "./mybookshelf.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);
                }

                if (loginstate == LoginState.Reader)
                {

                    // 个人信息
                    if (this.CurrentColumn == TitleColumn.PersonalInfo)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "PersonalInfo";
                    hyperlink.Text = this.GetString("个人信息");
                    hyperlink.NavigateUrl = "./PersonalInfo.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);

                }

                // 统计信息
                XmlNode nodeStatisColumn = app.WebUiDom.DocumentElement.SelectSingleNode("titleBarControl/statisColumn");
                string strStatisColumnVisible = "";
                if (nodeStatisColumn == null)
                {
                    // 元素缺乏时的缺省值
                    strStatisColumnVisible = "reader,librarian";
                }
                else
                {
                    // 一旦元素具备,就没有缺省值了
                    strStatisColumnVisible = DomUtil.GetAttr(nodeStatisColumn, "visible");
                }

                if (StringUtil.IsInList("all", strStatisColumnVisible) == true
                    || (loginstate == LoginState.Librarian && StringUtil.IsInList("librarian", strStatisColumnVisible) == true)
                    || (loginstate == LoginState.Reader && StringUtil.IsInList("reader", strStatisColumnVisible) == true)
                    || (loginstate == LoginState.Public && StringUtil.IsInList("public", strStatisColumnVisible) == true)
                    || (loginstate == LoginState.NotLogin && StringUtil.IsInList("notlogin", strStatisColumnVisible) == true)
                    )
                {

                    if (this.CurrentColumn == TitleColumn.Statis)
                        strClass = "active";
                    else
                        strClass = "normal";

                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "Statis";
                    hyperlink.Text = this.GetString("统计信息");
                    hyperlink.NavigateUrl = "./statis.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);
                }

                if (loginstate == LoginState.Librarian
&& String.IsNullOrEmpty(this.ReaderBarcode) == true)
                {

                    // 工作人员的管理功能
                    if (this.CurrentColumn == TitleColumn.Management)
                        strClass = "active";
                    else
                        strClass = "normal";
                    literal = new AutoIndentLiteral();
                    literal.Text = "<%normal%><td class='" + strClass + "'>";
                    this.Controls.Add(literal);

                    hyperlink = new HyperLink();
                    hyperlink.ID = "Management";
                    hyperlink.Text = this.GetString("管理");
                    hyperlink.NavigateUrl = "./management.aspx";
                    this.Controls.Add(hyperlink);

                    literal = new AutoIndentLiteral();
                    literal.Text = "</td>";
                    this.Controls.Add(literal);
                }
            }

            // 右端占据空格的栏目
            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td class='right'>";
            this.Controls.Add(literal);

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            this.Controls.Add(literal);

        }
Esempio n. 4
0
        protected override void CreateChildControls()
        {
            // 总表格开始
            AutoIndentLiteral literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><!-- TitleBarControl 开始-->"
                + "<%begin%><table id='outerframe' class='body' border='0' cellpadding='0' cellspacing='0'>";
            this.Controls.Add(literal);

            // 标题图像表格 开始
            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><!-- 标题图像 -->"
                + "<%begin%><tr><td>"
                + "<%begin%><table class='title'>"  // 这个<table>本类自己管辖了
                + "<%begin%><tr class='title'>";
            this.Controls.Add(literal);

#if AUTO_RELOGIN
            // 用于重新登录的信息
            HiddenField relogin = new HiddenField();
            relogin.ID = "relogin";
            relogin.Value = "";
            this.Controls.Add(relogin);
#endif

            // 获得配置参数
            OpacApplication app = (OpacApplication)this.Page.Application["app"];


            // 左
            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td class='left'>";
            this.Controls.Add(literal);

            LiteralControl lefthtml = new LiteralControl();
            lefthtml.ID = "lefthtml";
            this.Controls.Add(lefthtml);


            // 中
            literal = new AutoIndentLiteral();
            literal.Text = "</td> <%normal%><td class='center'>";
            this.Controls.Add(literal);

            LiteralControl debug___info = new LiteralControl();
            debug___info.ID = "debug___info";
            this.Controls.Add(debug___info);

            LiteralControl centerhtml = new LiteralControl();
            centerhtml.ID = "centerhtml";
            this.Controls.Add(centerhtml);

            literal = new AutoIndentLiteral();
            literal.Text = "</td>";
            this.Controls.Add(literal);


            // 右
            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><td class='right'>";
            this.Controls.Add(literal);

            // 右上角的命令小表格
            CreateTopRightTable();

            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%></td>";
            this.Controls.Add(literal);


            // 标题图像表格 结束
            literal = new AutoIndentLiteral();
            literal.Text = "<%end%></tr>"
                + "<%end%></table>"
                + "<%end%></td></tr>";
            this.Controls.Add(literal);

            // 栏目条表格 开始
            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><!-- 栏目条 -->"
                + "<%begin%><tr><td>"
                + "<%begin%><table class='columnbar'>"
                + "<%begin%><tr class='columnbar'>";
            this.Controls.Add(literal);


            // 各个栏目
            CreateColumns();

            // 栏目条表格 结束
            literal = new AutoIndentLiteral();
            literal.Text = "<%end%></tr>"
                + "<%end%></table>"
                + "<%end%></td></tr>";
            this.Controls.Add(literal);

            // 主体内容开始
            literal = new AutoIndentLiteral();
            literal.Text = "<%normal%><!-- 主体内容 -->"
                + "<%begin%><tr class='main'><td class='main'>"
                + "<%normal%><!-- TitleBarControl 结束 -->";
            this.Controls.Add(literal);

        }
Esempio n. 5
0
        // 新创建内容行
        PlaceHolder NewContentLine(Control content,
                                   int nLineNo,
                                   Control insertpos)
        {
            PlaceHolder line = new PlaceHolder();

            line.ID = "line" + Convert.ToString(nLineNo);

            if (insertpos != null)
            {
                int index = content.Controls.IndexOf(insertpos);
                content.Controls.AddAt(index, line);
            }
            else
            {
                content.Controls.Add(line);
            }

            // 左侧文字
            AutoIndentLiteral auto_literal = new AutoIndentLiteral();

            auto_literal.Text = "<%begin%><tr class='content'><%begin%><td class='no";  // contentup
            line.Controls.Add(auto_literal);

            LiteralControl line_class = new LiteralControl();

            line_class.ID = "line" + Convert.ToString(nLineNo) + "_class";
            line.Controls.Add(line_class);

            line.Controls.Add(new LiteralControl("' >"));   // rowspan='2'

            // 序号
            LiteralControl literal = new LiteralControl();

            literal.ID = "line" + Convert.ToString(nLineNo) + "_no";
            line.Controls.Add(literal);

            // checkbox
            CheckBox checkbox = new CheckBox();

            checkbox.ID       = "line" + Convert.ToString(nLineNo) + "_checkbox";
            checkbox.CssClass = "comment_checkbox";
            checkbox.Attributes.Add("onclick", "onColumnCheckboxClick(this);");
            line.Controls.Add(checkbox);

            auto_literal      = new AutoIndentLiteral();
            auto_literal.Text = "<%end%></td>"; // "<%begin%><td class='path'>";
            line.Controls.Add(auto_literal);

            auto_literal      = new AutoIndentLiteral();
            auto_literal.Text = "<%begin%><td class='review'>";
            line.Controls.Add(auto_literal);

            // 一个评注
            CommentControl comment = new CommentControl();

            comment.ID         = "line" + Convert.ToString(nLineNo) + "_comment";
            comment.WantFocus -= new WantFocusEventHandler(commentcontrol_WantFocus);
            comment.WantFocus += new WantFocusEventHandler(commentcontrol_WantFocus);
            line.Controls.Add(comment);

            auto_literal      = new AutoIndentLiteral();
            auto_literal.Text = "<%end%></td><%begin%><td class='biblio'>";
            line.Controls.Add(auto_literal);

            // 书目摘要
            literal    = new LiteralControl();
            literal.ID = "line" + Convert.ToString(nLineNo) + "_bibliosummary";
            line.Controls.Add(literal);

            // 创建新评注
            Button newreview = new Button();

            newreview.Text     = this.GetString("新评注");
            newreview.ID       = "line" + Convert.ToString(nLineNo) + "_newreview";
            newreview.CssClass = "newreview";
            newreview.ToolTip  = this.GetString("为按钮下方的书目记录创建一条新评注");
            newreview.Visible  = false;
            line.Controls.Add(newreview);

            PlaceHolder biblioinfo_holder = new PlaceHolder();

            biblioinfo_holder.ID = "line" + Convert.ToString(nLineNo) + "_biblioinfo_holder";
            line.Controls.Add(biblioinfo_holder);

            BiblioControl bibliocontrol = new BiblioControl();

            bibliocontrol.ID         = "line_" + nLineNo.ToString() + "_bibliocontrol";
            bibliocontrol.WantFocus -= new WantFocusEventHandler(bibliocontrol_WantFocus);
            bibliocontrol.WantFocus += new WantFocusEventHandler(bibliocontrol_WantFocus);
            biblioinfo_holder.Controls.Add(bibliocontrol);

            auto_literal      = new AutoIndentLiteral();
            auto_literal.Text = "<%end%></td><%end%></tr>";
            line.Controls.Add(auto_literal);
            return(line);
        }