コード例 #1
0
        private void LoadCommentsSection()
        {
            CommentControl cc = new CommentControl();

            cc.LoadByUserId(userId);
            cc.LoadControls(ListView_Comments);
        }
コード例 #2
0
        // 按下修改状态按钮。修改所选评注记录的状态
        void modify_state_button_Click(object sender, EventArgs e)
        {
            string strError      = "";
            int    nCount        = 0; // 做了多少个事项
            int    nChangedCount = 0; // 真正发生了修改的事项个数

            string strAddList    = GetAddList();
            string strRemoveList = GetRemoveList();

            for (int i = 0; i < this.PageMaxLines; i++)
            {
                CheckBox checkbox = (CheckBox)this.FindControl("line" + Convert.ToString(i) + "_checkbox");
                Debug.Assert(checkbox != null, "");

                if (checkbox.Checked == false)
                {
                    continue;
                }

                CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");
                if (String.IsNullOrEmpty(commentcontrol.CommentRecPath) == true)
                {
                    continue;
                }

                // 修改评注的状态
                // return:
                //       -1  出错
                //      0   没有发生修改
                //      1   发生了修改
                int nRet = commentcontrol.ChangeState(
                    strAddList,
                    strRemoveList,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                if (nRet == 1)
                {
                    nChangedCount++;
                }

                nCount++;
            }

            if (nCount == 0)
            {
                strError = "尚未选择要修改状态的事项...";
                goto ERROR1;
            }

            ClearAllChecked();
            this.SetDebugInfo("共修改了 " + nChangedCount.ToString() + " 个评注记录的状态");
            return;

ERROR1:
            this.SetDebugInfo("errorinfo", strError);
        }
コード例 #3
0
ファイル: HotPage.xaml.cs プロジェクト: batkiz/Jandan.UWP
        private void DuanViewComment_Click(object sender, RoutedEventArgs e)
        {
            var b  = sender as Button;
            var bp = b.DataContext as BoringPic;

            CommentControl.Update(bp.PicID);
            DuanSplitView.IsPaneOpen = true;
            CommentControl.SetFocus();
        }
コード例 #4
0
ファイル: HotPage.xaml.cs プロジェクト: batkiz/Jandan.UWP
        private void Duan_Tucao_Click(object sender, RoutedEventArgs e)
        {
            var b    = sender as Button;
            var duan = b.DataContext as Duan;

            CommentControl.Update(duan.DuanID);
            DuanSplitView.IsPaneOpen = true;
            CommentControl.SetFocus();
        }
コード例 #5
0
 public DataAccess()
 {
     autentification = new Autentefication();
     projectControl  = new ProjectControl();
     taskControl     = new TaskControl();
     commentControl  = new CommentControl();
     accountControl  = new AccountControl();
     statusControl   = new StatusControl();
     historyControl  = new HistoryControl();
 }
コード例 #6
0
 public void DeleteComment(string id)
 {
     try
     {
         CommentControl.GetInstance().DeleteComment(id, GetServiceUserEmail());
     }catch (InvalidOperationException)
     {
         throw new WebFaultException <string>("Can not delete other people's comments", HttpStatusCode.Unauthorized);
     }
 }
コード例 #7
0
        public void TestGetAdComments()
        {
            var author = "*****@*****.**";
            Ad  ad     = control.PostAd(author, "Unit Test", "Should not matter what I type here.", "Aalborg", AdType.Buying);

            CommentControl.GetInstance().PostComment(ad.Id, "Test comment", "*****@*****.**");
            var results = control.GetComments(0, 64, ad.Id);

            Assert.IsTrue(results.Count == 0);
            control.DeleteAd(ad.Id, author);
        }
コード例 #8
0
 private void LoadComments()
 {
     comments.Controls.Clear();
     if (discussion != null)
     {
         foreach (DiscussionComment c in discussion.Comments)
         {
             CommentControl comment = (CommentControl)LoadControl("UserControls/CommentControl.ascx");
             comment.Comment = c;
             comments.Controls.Add(comment);
         }
     }
 }
コード例 #9
0
        /// <summary>
        /// Init comment and workflow history controls.
        /// </summary>
        private void InitCommentAndWorkflowHistoryControls()
        {
            var listOfCommentControls = this.GetAllControlsOfType <CommentControl>().ToList();

            if (listOfCommentControls != null && listOfCommentControls.Count > 0)
            {
                this.commentBoxControlObject = listOfCommentControls[0];
            }

            var listOfWorkflowHistoryControls = this.GetAllControlsOfType <WorkflowHistoryControl>().ToList();

            if (listOfWorkflowHistoryControls != null && listOfWorkflowHistoryControls.Count > 0)
            {
                this.workflowHistoryControlObject = listOfWorkflowHistoryControls[0];
            }
        }
コード例 #10
0
        public TroopCompositionEditor(TroopComposition troopComposition)
            : base(troopComposition)
        {
            this.Text = "Troop Composition Editor";
            this.individualSelector             = new IndividualSelector(this.persistentObject.Individual);
            this.troopVisitSelector             = new TroopVisitSelector(troopComposition.TroopVisit);
            this.troopCompositionStatusSelector = new TroopCompositionStatusSelector(troopComposition.Status);
            this.timeControl    = new TimeControl(troopComposition.Time);
            this.commentControl = new CommentControl(troopComposition.Comments);

            this.propertyPanel.Controls.Add(individualSelector);
            this.propertyPanel.Controls.Add(troopVisitSelector);
            this.propertyPanel.Controls.Add(troopCompositionStatusSelector);
            this.propertyPanel.Controls.Add(timeControl);
            this.propertyPanel.Controls.Add(commentControl);
        }
コード例 #11
0
ファイル: ControllerMain.cs プロジェクト: TeVeVe/Ict4Events-B
        private void FillFeedPost()
        {
            IEnumerable <FeedPost> feedPosts = FeedPost.Select();

            View.CommentSection.FlowLayoutPanel.Controls.Clear();

            foreach (FeedPost feedPost in feedPosts)
            {
                var cc = new CommentControl();
                cc.LabelNaam.Text =
                    UserAccount.Select("UserAccountID = " + feedPost.UserAccount).FirstOrDefault().Username;
                cc.LabelContent.Text = feedPost.Content;

                Debug.WriteLine(feedPost.Content);

                View.CommentSection.Add(cc);
            }
        }
コード例 #12
0
        // 按下删除按钮。删除所选择的若干个评注记录
        // TODO: 当最后一页全部删空以后,显示是不是会有问题?
        void delete_button_Click(object sender, EventArgs e)
        {
            string strError = "";
            int    nCount   = 0; // 做了多少个事项

            for (int i = 0; i < this.PageMaxLines; i++)
            {
                CheckBox checkbox = (CheckBox)this.FindControl("line" + Convert.ToString(i) + "_checkbox");
                Debug.Assert(checkbox != null, "");

                if (checkbox.Checked == false)
                {
                    continue;
                }

                CommentControl commentcontrol = (CommentControl)this.FindControl("line" + Convert.ToString(i) + "_comment");
                if (String.IsNullOrEmpty(commentcontrol.CommentRecPath) == true)
                {
                    continue;
                }

                // 删除一个评注记录
                int nRet = commentcontrol.Delete(
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                nCount++;
            }

            if (nCount == 0)
            {
                strError = "尚未选择要删除的事项...";
                goto ERROR1;
            }

            ClearAllChecked();
            return;

ERROR1:
            this.SetDebugInfo("errorinfo", strError);
        }
コード例 #13
0
        private void FillCommentSection()
        {
            if (_file.Id != 0)
            {
                View.CommentSection.FlowLayoutPanel.Controls.Clear();
                IEnumerable <Comment> comments = Comment.Select("FILEID =" + _file.Id);

                foreach (Comment comment in comments)
                {
                    Debug.WriteLine(comment.Content);
                    var cc = new CommentControl();
                    cc.LabelNaam.Text =
                        UserAccount.Select("UserAccountID = " + comment.UserAccountId).FirstOrDefault().Username;
                    cc.LabelContent.Text = comment.Content;

                    View.CommentSection.Add(cc);
                }
            }
        }
コード例 #14
0
 private void DuanSplitView_PaneClosed(SplitView sender, object args)
 {
     CommentControl.ClearResponse();
 }
コード例 #15
0
 public AddCommentCommand(FlowAreaControl areaControl, double posX, double posY)
 {
     this.areaControl = areaControl;
     CommentControl   = areaControl.CreateComment();
     CommentControl.CurrentComment.Position = new Point(posX, posY);
 }
コード例 #16
0
        void submit_button_Click(object sender, EventArgs e)
        {
            string strError = "";

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

            string strCreator = sessioninfo.UserID;

            // 先创建一条书目记录
            TextBox biblio_title     = (TextBox)this.FindControl("edit_biblio_title");
            TextBox biblio_author    = (TextBox)this.FindControl("edit_biblio_author");
            TextBox biblio_publisher = (TextBox)this.FindControl("edit_biblio_publisher");
            TextBox biblio_isbn      = (TextBox)this.FindControl("edit_biblio_isbn");
            TextBox biblio_price     = (TextBox)this.FindControl("edit_biblio_price");
            TextBox biblio_summary   = (TextBox)this.FindControl("edit_biblio_summary");

            // 检查必备字段
            if (String.IsNullOrEmpty(biblio_title.Text) == true)
            {
                strError = "尚未输入书名/刊名";
                goto ERROR1;
            }

            DropDownList store_dbname = (DropDownList)this.FindControl("store_dbname");

            string strBiblioDbName = store_dbname.SelectedValue;

            if (String.IsNullOrEmpty(strBiblioDbName) == true)
            {
                strError = "尚未选定目标库";
                goto ERROR1;
            }

            string strBiblioRecPath = "";
            string strMarcSyntax    = "";
            string strMARC          = "";

            // 得到目标书目库的MARC格式
            ItemDbCfg cfg = app.GetBiblioDbCfg(strBiblioDbName);

            if (cfg == null)
            {
                strError = "目标库 '" + strBiblioDbName + "' 不是系统定义的的书目库";
                goto ERROR1;
            }

            strMarcSyntax = cfg.BiblioDbSyntax;

            int nRet = BuildBiblioRecord(
                strMarcSyntax,
                biblio_title.Text,
                biblio_author.Text,
                biblio_publisher.Text,
                biblio_isbn.Text,
                biblio_price.Text,
                biblio_summary.Text,
                strCreator,
                out strMARC,
                out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            // 保存
            // 将MARC格式转换为XML格式
            nRet = MarcUtil.Marc2Xml(
                strMARC,
                strMarcSyntax,
                out string strXml,
                out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }

#if NO
            SessionInfo temp_sessioninfo = new SessionInfo(app);
            temp_sessioninfo.UserID   = app.ManagerUserName;
            temp_sessioninfo.Password = app.ManagerPassword;
            temp_sessioninfo.IsReader = false;
#endif

            string strOutputBiblioRecPath = "";

            LibraryChannel channel = sessioninfo.GetChannel(true);
            try
            {
                strBiblioRecPath = strBiblioDbName + "/?";


                long lRet = // temp_sessioninfo.Channel.
                            channel.SetBiblioInfo(
                    null,
                    "new",
                    strBiblioRecPath,
                    "xml",
                    strXml,
                    null,
                    "",
                    out strOutputBiblioRecPath,
                    out byte[] baOutputTimestamp,
                    out strError);
                if (lRet == -1)
                {
                    strError = "创建书目记录发生错误: " + strError;
                    goto ERROR1;
                }
            }
            finally
            {
#if NO
                temp_sessioninfo.CloseSession();
                temp_sessioninfo = null;
#endif
                sessioninfo.ReturnChannel(channel);
            }

            // 清除每个输入域的内容
            biblio_title.Text     = "";
            biblio_author.Text    = "";
            biblio_publisher.Text = "";
            biblio_isbn.Text      = "";
            biblio_summary.Text   = "";
            biblio_price.Text     = "";

            strBiblioRecPath = strOutputBiblioRecPath;

            CommentControl commentcontrol = (CommentControl)this.FindControl("commentcontrol");
            // 创建评注记录
            if (String.IsNullOrEmpty(commentcontrol.EditTitle) == false ||
                String.IsNullOrEmpty(commentcontrol.EditContent) == false)
            {
                string strWarning = "";
                commentcontrol.BiblioRecPath = strBiblioRecPath;

                nRet = commentcontrol.DoSubmit(
                    out strWarning,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
                if (String.IsNullOrEmpty(strWarning) == false)
                {
                    this.SetDebugInfo("warninginfo", strWarning);
                }
            }

            string strUrl = "./book.aspx?bibliorecpath="
                            + HttpUtility.UrlEncode(strBiblioRecPath);
            string strText = "新的荐购书目记录创建成功。点击此处可查看:<a href='"
                             + strUrl
                             + "' target='_blank'>"
                             + strUrl
                             + "</a>";
            SetInfo(strText);
            this.SetDebugInfo("succeedinfo", strText);
            return;

ERROR1:
            SetDebugInfo("errorinfo", strError);
        }
コード例 #17
0
        void CreateInputLine(PlaceHolder line)
        {
            line.Controls.Clear();

            line.Controls.Add(new LiteralControl("<tr class='inputline'><td colspan='2'>"));

            PlaceHolder edit_holder = new PlaceHolder();

            edit_holder.ID = "edit_holder";
            line.Controls.Add(edit_holder);

            edit_holder.Controls.Add(new LiteralControl("<table class='edit'>"));


            // 存储库
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            LiteralControl literal = new LiteralControl();

            literal.Text = this.GetString("存储库");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            // DropDown
            DropDownList store_dbname = new DropDownList();

            store_dbname.ID = "store_dbname";
            // store_dbname.Width = new Unit("100%");
            store_dbname.CssClass = "store_dbname";
            edit_holder.Controls.Add(store_dbname);

            OpacApplication app     = (OpacApplication)this.Page.Application["app"];
            List <string>   dbnames = app.GetOrderRecommendStoreDbNames();

            store_dbname.Items.Clear();
            if (dbnames.Count > 0)
            {
                for (int i = 0; i < dbnames.Count; i++)
                {
                    store_dbname.Items.Add(dbnames[i]);
                }
            }
            else
            {
                // 还没有定义 读者新书目 存储库

                LiteralControl comment = new LiteralControl();
                comment.ID   = "comment";
                comment.Text = "<span class='comment'>还没有定义任何角色名为 'orderRecommendStore' 的读者创建新书目存储库...</span>";
                edit_holder.Controls.Add(comment);
            }

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));


            // 题名
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            literal      = new LiteralControl();
            literal.Text = this.GetString("题名");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            TextBox edit_biblio_title = new TextBox();

            edit_biblio_title.Text     = "";
            edit_biblio_title.ID       = "edit_biblio_title";
            edit_biblio_title.CssClass = "biblio_title";
            edit_holder.Controls.Add(edit_biblio_title);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));


            // 责任者
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            literal      = new LiteralControl();
            literal.Text = this.GetString("责任者");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            TextBox edit_biblio_author = new TextBox();

            edit_biblio_author.Text     = "";
            edit_biblio_author.ID       = "edit_biblio_author";
            edit_biblio_author.CssClass = "biblio_author";
            edit_holder.Controls.Add(edit_biblio_author);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));

            // 出版者
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            literal      = new LiteralControl();
            literal.Text = this.GetString("出版者");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            TextBox edit_biblio_publisher = new TextBox();

            edit_biblio_publisher.Text     = "";
            edit_biblio_publisher.ID       = "edit_biblio_publisher";
            edit_biblio_publisher.CssClass = "biblio_publisher";
            edit_holder.Controls.Add(edit_biblio_publisher);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));

            // ISBN/ISSN
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            literal      = new LiteralControl();
            literal.Text = this.GetString("ISBN/ISSN");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            TextBox edit_biblio_isbn = new TextBox();

            edit_biblio_isbn.Text     = "";
            edit_biblio_isbn.ID       = "edit_biblio_isbn";
            edit_biblio_isbn.CssClass = "biblio_isbn";
            edit_holder.Controls.Add(edit_biblio_isbn);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));

            // 价格
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            literal      = new LiteralControl();
            literal.Text = this.GetString("价格");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            TextBox edit_biblio_price = new TextBox();

            edit_biblio_price.Text     = "";
            edit_biblio_price.ID       = "edit_biblio_price";
            edit_biblio_price.CssClass = "biblio_price";
            edit_holder.Controls.Add(edit_biblio_price);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));


            // 摘要
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='left'>"));

            literal      = new LiteralControl();
            literal.Text = this.GetString("摘要");    //
            edit_holder.Controls.Add(literal);

            edit_holder.Controls.Add(new LiteralControl("</td><td>"));

            TextBox edit_biblio_summary = new TextBox();

            edit_biblio_summary.Text     = "";
            edit_biblio_summary.ID       = "edit_biblio_summary";
            edit_biblio_summary.CssClass = "biblio_summary";
            edit_biblio_summary.TextMode = TextBoxMode.MultiLine;
            edit_holder.Controls.Add(edit_biblio_summary);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));

            // 提示文字
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='description' colspan='2'>"));

            LiteralControl description = new LiteralControl();

            description.ID   = "edit_description";
            description.Text = this.GetString("还可详细阐述您的推荐意见如下(可选)") + ":";
            edit_holder.Controls.Add(description);

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));

            // CommentControl
            edit_holder.Controls.Add(new LiteralControl("<tr><td class='comment' colspan='2'>"));

            CommentControl commentcontrol = new CommentControl();

            commentcontrol.ID = "commentcontrol";
            edit_holder.Controls.Add(commentcontrol);
            commentcontrol.EditAction                    = "new";
            commentcontrol.ButtonSubmit.Visible          = false;
            commentcontrol.ButtonCancel.Visible          = false;
            commentcontrol.EditType                      = "订购征询";
            commentcontrol.OrderSuggestionHolder.Visible = false;
            commentcontrol.EditDescription.Visible       = false;

            edit_holder.Controls.Add(new LiteralControl("</td></tr>"));


            // 提交
            edit_holder.Controls.Add(new LiteralControl("<tr><td colspan='2'>"));

            Button submit_button = new Button();

            submit_button.ID     = "submit_button";
            submit_button.Text   = this.GetString("提交");
            submit_button.Click += new EventHandler(submit_button_Click);
            edit_holder.Controls.Add(submit_button);

            edit_holder.Controls.Add(new LiteralControl("</td></tr></table>"));

            line.Controls.Add(new LiteralControl("</td></tr>"));
        }
コード例 #18
0
 public void PostComment(string adId, string content)
 {
     CommentControl.GetInstance().PostComment(adId, content,
                                              GetServiceUserEmail());
 }
コード例 #19
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);
        }
コード例 #20
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);
        }
コード例 #21
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);
            }
        }