// 新创建内容行
        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);
            }

            // 左侧文字
            LiteralControl literal = new LiteralControl();
            literal.Text = "<tr class='contentup'><td class='no' rowspan='2'>";
            line.Controls.Add(literal);

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

            CheckBox checkbox = new CheckBox();
            checkbox.ID = "line" + Convert.ToString(nLineNo) + "_checkbox";
            line.Controls.Add(checkbox);

            literal = new LiteralControl();
            literal.Text = "</td><td class='path'>";
            line.Controls.Add(literal);

            // 记录标题
            Panel title = new Panel();
            title.ID = "line" + Convert.ToString(nLineNo) + "_title";
            title.CssClass = "title";
            line.Controls.Add(title);

            // 路径
            HyperLink hyper = new HyperLink();
            hyper.ID = "line" + Convert.ToString(nLineNo) + "_path";
            hyper.CssClass = "path";
            hyper.ToolTip = "书目记录路径";
            line.Controls.Add(hyper);

            literal = new LiteralControl();
            literal.Text = "</td></tr><tr class='contentdown'><td class='content'>";
            line.Controls.Add(literal);

            // 内容
            literal = new LiteralControl();
            literal.ID = "line" + Convert.ToString(nLineNo) + "_content";
            line.Controls.Add(literal);

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

            // 必要的控件
            BiblioControl bibliocontrol = new BiblioControl();
            bibliocontrol.ID = "line" + Convert.ToString(nLineNo) + "_biblio";
            line.Controls.Add(bibliocontrol);

            MarcControl marccontrol = new MarcControl();
            marccontrol.ID = "line" + Convert.ToString(nLineNo) + "_marc";
            line.Controls.Add(marccontrol);

            /*
            literal = new LiteralControl();
            sep.Text = "<div class='sep'>";
            this.Controls.Add(sep);
             * */

            ItemsControl itemscontrol = new ItemsControl();
            itemscontrol.ID = "line" + Convert.ToString(nLineNo) + "_items";
            line.Controls.Add(itemscontrol);

            /*
            literal = new LiteralControl();
            sep.Text = "<div class='sep'>";
            this.Controls.Add(sep);
             * */

            CommentsControl commentscontrol = new CommentsControl();
            commentscontrol.MinimizeNewReviewEdtior = this.MinimizeNewReviewEdtior;
            commentscontrol.ID = "line" + Convert.ToString(nLineNo) + "_comments";
            commentscontrol.WantFocus -= new WantFocusEventHandler(commentscontrol_WantFocus);
            commentscontrol.WantFocus += new WantFocusEventHandler(commentscontrol_WantFocus);
            line.Controls.Add(commentscontrol);

            ItemControl itemcontrol = new ItemControl();
            itemcontrol.ID = "line" + Convert.ToString(nLineNo) + "_item";
            line.Controls.Add(itemcontrol);

            CommentControl commentcontrol = new CommentControl();
            commentcontrol.ID = "line" + Convert.ToString(nLineNo) + "_comment";
            line.Controls.Add(commentcontrol);
            /*
            literal = new LiteralControl();
            literal.Text = "</td><td width='10%'>";
            line.Controls.Add(literal);

            // 操作
            literal = new LiteralControl();
            literal.ID = "line" + Convert.ToString(nLineNo) + "_oper";
            line.Controls.Add(literal);
             */

            literal = new LiteralControl();
            literal.Text = "</td></tr>";
            line.Controls.Add(literal);

            return line;
        }
Beispiel #2
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;
        }
Beispiel #3
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);
        }
Beispiel #4
0
        void SetLineClassAndControlActive()
        {
            List <int> editmode_commentcontrol_lineindexes = new List <int>();
            List <int> editmode_bibliocontrol_lineindexes  = new List <int>();

            for (int i = 0; i < this.PageMaxLines; i++)
            {
                // 为每个checkbox设置正确的class
                CheckBox checkbox = (CheckBox)this.FindControl("line" + Convert.ToString(i) + "_checkbox");
                Debug.Assert(checkbox != null, "");

                LiteralControl line_class = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_class");
                if (checkbox.Checked == true)
                {
                    line_class.Text = " selected";
                }
                else
                {
                    line_class.Text = "";
                }

                // 检查是否出现编辑状态的CommentControl
                CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");
                if (String.IsNullOrEmpty(commentcontrol.EditAction) == false)
                {
                    editmode_commentcontrol_lineindexes.Add(i);
                }

                // 检查是否出现编辑状态的BiblioControl
                BiblioControl bibliocontrol = (BiblioControl)this.FindControl("line_" + i.ToString() + "_bibliocontrol");
                if (String.IsNullOrEmpty(bibliocontrol.EditAction) == false)
                {
                    editmode_bibliocontrol_lineindexes.Add(i);
                }
            }

            if (editmode_commentcontrol_lineindexes.Count
                + editmode_bibliocontrol_lineindexes.Count > 0)
            {
                // 为每行的CommentControl和BiblioControl控件设置Active
                for (int i = 0; i < this.PageMaxLines; i++)
                {
                    CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");
                    if (editmode_commentcontrol_lineindexes.IndexOf(i) == -1)
                    {
                        // 普通行
                        commentcontrol.Active = false;
                    }
                    else
                    {
                        // 编辑状态的行
                        commentcontrol.Active = true;
                    }

                    BiblioControl bibliocontrol = (BiblioControl)this.FindControl("line_" + Convert.ToString(i) + "_bibliocontrol");
                    if (editmode_bibliocontrol_lineindexes.IndexOf(i) == -1)
                    {
                        // 普通行
                        bibliocontrol.Active = false;
                    }
                    else
                    {
                        // 编辑状态的行
                        bibliocontrol.Active = true;
                    }

                    /*
                     * BiblioControl bibliocontrol = (BiblioControl)this.FindControl("line_" + i.ToString() + "_bibliocontrol");
                     * bibliocontrol.Active = false;
                     * */
                }

                // 禁止整个底部的命令按钮
                this.EnableCmdButtons(false);
            }
            else
            {
                // 为每行的CommentControl和BiblioControl控件设置Active=true
                for (int i = 0; i < this.PageMaxLines; i++)
                {
                    CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");
                    commentcontrol.Active = true;

                    BiblioControl bibliocontrol = (BiblioControl)this.FindControl("line_" + Convert.ToString(i) + "_bibliocontrol");
                    bibliocontrol.Active = true;
                }

                this.EnableCmdButtons(true);
            }
        }
Beispiel #5
0
        protected override void Render(HtmlTextWriter writer)
        {
            int    nRet     = 0;
            string strError = "";

            OpacApplication app         = (OpacApplication)this.Page.Application["app"];
            SessionInfo     sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            bool bManager = false;

            if (String.IsNullOrEmpty(sessioninfo.UserID) == true ||
                StringUtil.IsInList("managecomment", sessioninfo.RightsOrigin) == false)
            {
                bManager = false;
            }
            else
            {
                bManager = true;
            }

            LoginState loginstate = GlobalUtil.GetLoginState(this.Page);

            bool bReader = false;

            if (sessioninfo.ReaderInfo != null &&
                sessioninfo.IsReader == true && loginstate != LoginState.Public)
            {
                bReader = true;
            }

            if (bManager == false)
            {
                Button delete_button = (Button)this.FindControl("delete_button");
                delete_button.Visible = false;

                Button open_modify_state_button = (Button)this.FindControl("open_modify_state_button");
                open_modify_state_button.Visible = false;

                Button selectall_button = (Button)this.FindControl("selectall_button");
                selectall_button.Visible = false;

                Button unselectall_button = (Button)this.FindControl("unselectall_button");
                unselectall_button.Visible = false;
            }

            /*
             * if (sessioninfo.Account == null)
             * {
             *  // 临时的SessionInfo对象
             *  SessionInfo temp_sessioninfo = new SessionInfo(app);
             *
             *  // 模拟一个账户
             *  Account account = new Account();
             *  account.LoginName = "opac_column";
             *  account.Password = "";
             *  account.Rights = "getbibliosummary";
             *
             *  account.Type = "";
             *  account.Barcode = "";
             *  account.Name = "opac_column";
             *  account.UserID = "opac_column";
             *  account.RmsUserName = app.ManagerUserName;
             *  account.RmsPassword = app.ManagerPassword;
             *
             *  temp_sessioninfo.Account = account;
             *  sessioninfo = temp_sessioninfo;
             * }
             * */

            bool    bUseBiblioSummary = false; // 使用书目摘要(否则就是详细书目格式)
            bool    bDitto            = true;  // 书目 同上...
            XmlNode nodeBookReview    = app.WebUiDom.DocumentElement.SelectSingleNode("bookReview");

            if (nodeBookReview != null)
            {
                DomUtil.GetBooleanParam(nodeBookReview,
                                        "ditto",
                                        true,
                                        out bDitto,
                                        out strError);
                DomUtil.GetBooleanParam(nodeBookReview,
                                        "useBiblioSummary",
                                        false,
                                        out bUseBiblioSummary,
                                        out strError);
            }

            int nPageNo = this.StartIndex / this.PageMaxLines;

            SetTitle(String.IsNullOrEmpty(this.Title) == true ? this.GetString("栏目") : this.Title);

            SetResultInfo();

            if (this.CommentColumn == null ||
                this.CommentColumn.Opened == false)
            {
                this.SetDebugInfo("errorinfo", "尚未创建栏目缓存...");
            }

            if (this.CommentColumn != null)
            {
                LibraryChannel channel = sessioninfo.GetChannel(true);
                app.m_lockCommentColumn.AcquireReaderLock(app.m_nCommentColumnLockTimeout);
                try
                {
                    string strPrevBiblioRecPath = "";

                    for (int i = 0; i < this.PageMaxLines; i++)
                    {
                        PlaceHolder line = (PlaceHolder)this.FindControl("line" + Convert.ToString(i));
                        if (line == null)
                        {
                            PlaceHolder insertpoint = (PlaceHolder)this.FindControl("insertpoint");
                            PlaceHolder content     = (PlaceHolder)this.FindControl("content");

                            line = this.NewContentLine(content, i, insertpoint);
                        }

                        LiteralControl no          = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_no");
                        HyperLink      pathcontrol = (HyperLink)this.FindControl("line" + Convert.ToString(i) + "_path");
                        // LiteralControl contentcontrol = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_content");
                        CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");

                        LiteralControl bibliosummarycontrol = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_bibliosummary");
                        HyperLink      bibliorecpathcontrol = (HyperLink)this.FindControl("line" + Convert.ToString(i) + "_bibliorecpath");
                        Button         newreview            = (Button)this.FindControl("line" + Convert.ToString(i) + "_newreview");
                        PlaceHolder    biblioinfo_holder    = (PlaceHolder)this.FindControl("line" + Convert.ToString(i) + "_biblioinfo_holder");
                        BiblioControl  bibliocontrol        = (BiblioControl)this.FindControl("line_" + i.ToString() + "_bibliocontrol");

                        CheckBox checkbox = (CheckBox)this.FindControl("line" + Convert.ToString(i) + "_checkbox");
                        if (bManager == false)
                        {
                            checkbox.Visible = false;
                        }

                        int index = this.StartIndex + i;
                        if (index >= this.CommentColumn.Count)
                        {
                            checkbox.Visible       = false;
                            commentcontrol.Visible = false;
                            bibliocontrol.Visible  = false;
                            continue;
                        }
                        TopArticleItem record = (TopArticleItem)this.CommentColumn[index];

                        // 序号
                        string strNo = "&nbsp;";
                        strNo = Convert.ToString(i + this.StartIndex + 1);

                        no.Text = "<div>" + strNo + "</div>";

                        // 路径
                        string strPath = record.Line.m_strRecPath;

                        // 2012/7/11
                        commentcontrol.RecPath = app.GetLangItemRecPath(
                            "comment",
                            this.Lang,
                            strPath);

                        byte[] timestamp = null;
                        string strXml    = "";
                        // return:
                        //      -1  出错
                        //      0   没有找到
                        //      1   找到
                        nRet = commentcontrol.GetRecord(
                            app,
                            null,   // sessioninfo,
                            channel,
                            strPath,
                            out strXml,
                            out timestamp,
                            out strError);
                        if (nRet == -1)
                        {
                            goto ERROR1;
                        }
                        if (nRet == 0)
                        {
                        }

                        string strBiblioRecPath = "";
                        if (string.IsNullOrEmpty(strXml) == false)
                        {
                            string strParentID = "";
                            nRet = CommentControl.GetParentID(strXml,
                                                              out strParentID,
                                                              out strError);
                            if (nRet == -1)
                            {
                                goto ERROR1;
                            }

                            strBiblioRecPath = CommentControl.GetBiblioRecPath(
                                app,
                                strPath,
                                strParentID);
                        }
                        else
                        {
                            strBiblioRecPath = "";
                        }

                        //
                        if (bManager == true || bReader == true)
                        {
                            string strUrl = "./book.aspx?BiblioRecPath="
                                            + HttpUtility.UrlEncode(strBiblioRecPath)
                                            + "&CommentRecPath="
                                            + HttpUtility.UrlEncode(strPath)
                                            + "#newreview";
                            newreview.OnClientClick = "window.open('" + strUrl + "','_blank'); return cancelClick();";
                            // newreview.ToolTip = this.GetString("创建新的评注, 属于书目记录") + ":" + strBiblioRecPath;
                            // newreview.Attributes.Add("target", "_blank");
                            newreview.Visible = true;
                        }
                        else
                        {
                            newreview.Visible = false;
                        }

                        if (string.IsNullOrEmpty(strBiblioRecPath) == true)
                        {
                            biblioinfo_holder.Controls.Add(new LiteralControl("<div class='ditto'>" + this.GetString("无法定位书目记录") + "</div>"));
                            bibliocontrol.Visible = false;
                        }
                        else if (bDitto == true &&
                                 strBiblioRecPath == strPrevBiblioRecPath)
                        {
                            biblioinfo_holder.Controls.Add(new LiteralControl("<div class='ditto'>" + this.GetString("同上") + "</div>"));
                            bibliocontrol.Visible = false;
                        }
                        else
                        {
                            if (bUseBiblioSummary == true)
                            {
                                // 获得摘要
                                string strBarcode             = "@bibliorecpath:" + strBiblioRecPath;
                                string strSummary             = "";
                                string strOutputBiblioRecPath = "";
                                long   lRet = //sessioninfo.Channel.
                                              channel.GetBiblioSummary(
                                    null,
                                    strBarcode,
                                    null,
                                    null,
                                    out strOutputBiblioRecPath,
                                    out strSummary,
                                    out strError);
                                if (lRet == -1 || lRet == 0)
                                {
                                    strSummary = strError;
                                }

                                bibliosummarycontrol.Text = strSummary;
                                bibliocontrol.Visible     = false;
                            }
                            else
                            {
                                bibliocontrol.RecPath = strBiblioRecPath;
                                bibliocontrol.Visible = true;
                            }
                        }

                        strPrevBiblioRecPath = strBiblioRecPath;
                    }
                }
                finally
                {
                    app.m_lockCommentColumn.ReleaseReaderLock();
                    sessioninfo.ReturnChannel(channel);
                }
            }
            else
            {
                // 显示空行
                for (int i = 0; i < this.PageMaxLines; i++)
                {
                    PlaceHolder line = (PlaceHolder)this.FindControl("line" + Convert.ToString(i));
                    if (line == null)
                    {
                        continue;
                    }

                    CheckBox checkbox = (CheckBox)this.FindControl("line" + Convert.ToString(i) + "_checkbox");
                    checkbox.Visible = false;

                    CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");
                    commentcontrol.Visible = false;

                    BiblioControl bibliocontrol = (BiblioControl)this.FindControl("line_" + i.ToString() + "_bibliocontrol");
                    bibliocontrol.Visible = false;
                }
            }

            this.SetLineClassAndControlActive();
            base.Render(writer);
            return;

ERROR1:
            this.SetDebugInfo("errorinfo", strError);
            base.Render(writer);
        }