Ejemplo n.º 1
0
 void marc_viewer_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (m_commentViewer != null)
     {
         this.MainForm.AppInfo.UnlinkFormState(m_commentViewer);
         this.m_commentViewer = null;
     }
 }
Ejemplo n.º 2
0
        void DoViewComment(bool bOpenWindow)
        {
            string strError = "";
            string strHtml = "";
            string strXml = "";

            // 优化,避免无谓地进行服务器调用
            if (bOpenWindow == false)
            {
                if (this.MainForm.PanelFixedVisible == false
                    && (m_commentViewer == null || m_commentViewer.Visible == false))
                    return;
            }

            string strMARC = this.GetMarc();    // this.m_marcEditor.Marc;

            // 获得书目记录XML格式
            int nRet = this.GetBiblioXml(
                "", // 迫使从记录路径中看marc格式
                true,   // 包含资源ID
                out strXml,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            string strFragmentXml = "";
            nRet = MarcUtil.LoadXmlFragment(strXml,
                out strFragmentXml,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (this.m_strActiveCatalogingRules != "<不过滤>")
            {
                // 按照编目规则过滤
                // 获得一个特定风格的 MARC 记录
                // parameters:
                //      strStyle    要匹配的style值。如果为null,表示任何44值都匹配,实际上效果是去除$4并返回全部字段内容
                // return:
                //      0   没有实质性修改
                //      1   有实质性修改
                nRet = MarcUtil.GetMappedRecord(ref strMARC,
                    this.m_strActiveCatalogingRules);
            }

            // 2015/1/3
            string strCoverImageFragment = BiblioSearchForm.GetCoverImageHtmlFragment(
this.BiblioRecPath,
strMARC);
            string strIsbnImageFragment = BiblioSearchForm.GetIsbnImageHtmlFragment(strMARC, this.MarcSyntax);

            strHtml = MarcUtil.GetHtmlOfMarc(strMARC,
                strFragmentXml,
                strCoverImageFragment + strIsbnImageFragment,
                false);
            string strFilterTitle = "";
            if (this.m_strActiveCatalogingRules != "<不过滤>")
            {
                if (string.IsNullOrEmpty(this.m_strActiveCatalogingRules) == true)
                    strFilterTitle = "过滤掉命令字符(保留全部编目规则)";
                else
                    strFilterTitle = "按编目规则 '" + this.m_strActiveCatalogingRules + "' 过滤";

                strFilterTitle = "<div class='cataloging_rule_title'>" + strFilterTitle + "</div>";
            }

            // TODO: 如果有改变,则显示先后对照?
            strHtml = "<html>" +
    GetHeadString() +
    "<body>" +
    strFilterTitle +
    strHtml +
    GetTimestampHtml(this.BiblioTimestamp) +
    "</body></html>";
            bool bNew = false;
            if (this.m_commentViewer == null
                || (bOpenWindow == true && this.m_commentViewer.Visible == false))
            {
                m_commentViewer = new CommentViewerForm();
                MainForm.SetControlFont(m_commentViewer, this.Font, false);
                bNew = true;
            }

            m_commentViewer.MainForm = this.MainForm;  // 必须是第一句

            if (bNew == true)
                m_commentViewer.InitialWebBrowser();

            m_commentViewer.Text = "MARC内容 '" + this.BiblioRecPath + "'";
            m_commentViewer.HtmlString = strHtml;
            m_commentViewer.XmlString = strXml;
            m_commentViewer.FormClosed -= new FormClosedEventHandler(marc_viewer_FormClosed);
            m_commentViewer.FormClosed += new FormClosedEventHandler(marc_viewer_FormClosed);
            // this.MainForm.AppInfo.LinkFormState(m_viewer, "comment_viewer_state");
            // m_viewer.ShowDialog(this);
            // this.MainForm.AppInfo.UnlinkFormState(m_viewer);
            if (bOpenWindow == true)
            {
                if (m_commentViewer.Visible == false)
                {
                    this.MainForm.AppInfo.LinkFormState(m_commentViewer, "marc_viewer_state");
                    m_commentViewer.Show(this);
                    m_commentViewer.Activate();

                    this.MainForm.CurrentPropertyControl = null;
                }
                else
                {
                    if (m_commentViewer.WindowState == FormWindowState.Minimized)
                        m_commentViewer.WindowState = FormWindowState.Normal;
                    m_commentViewer.Activate();
                }
            }
            else
            {
                if (m_commentViewer.Visible == true)
                {

                }
                else
                {
                    if (this.MainForm.CurrentPropertyControl != m_commentViewer.MainControl)
                        m_commentViewer.DoDock(false); // 不会自动显示FixedPanel
                }
            }
            return;
        ERROR1:
            MessageBox.Show(this, "DoViewComment() 出错: " + strError);
        }
Ejemplo n.º 3
0
        void _doViewComment(bool bOpenWindow)
        {
            string strError = "";
            string strHtml = "";
            // string strXml = "";

            // 优化,避免无谓地进行服务器调用
            if (bOpenWindow == false)
            {
                if (this.MainForm.PanelFixedVisible == false
                    && (m_commentViewer == null || m_commentViewer.Visible == false))
                    return;
                // 2013/3/7
                if (this.MainForm.CanDisplayItemProperty() == false)
                    return;
            }

            if (this.m_biblioTable == null
                || this._listviewRecords.SelectedItems.Count != 1)
            {
                if (this.m_commentViewer != null)
                    this.m_commentViewer.Clear();
                return;
            }

            ListViewItem item = this._listviewRecords.SelectedItems[0];
#if NO
            string strRecPath = this._listviewRecords.SelectedItems[0].Text;
            if (string.IsNullOrEmpty(strRecPath) == true)
            {
                if (this.m_commentViewer != null)
                    this.m_commentViewer.Clear();
                return;
            }
#endif

            // BiblioInfo info = (BiblioInfo)this.m_biblioTable[strRecPath];
            BiblioInfo info = null;
            int nRet = GetBiblioInfo(
                true,
                item,
                out info,
                out strError);
            if (info == null)
            {
                if (this.m_commentViewer != null)
                    this.m_commentViewer.Clear();
                return;
            }


            string strXml = "";
            string strHtml2 = "";

            if (nRet == -1)
            {
                strHtml2 = HttpUtility.HtmlEncode(strError);
            }
            else
            {
                nRet = GetXmlHtml(info,
                    out strXml,
                    out strHtml2,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }

            strHtml = "<html>" +
    GetHeadString() +
    "<body>" +
    strHtml2 +
    EntityForm.GetTimestampHtml(info.Timestamp) +
    "</body></html>";

            bool bNew = false;
            if (this.m_commentViewer == null
                || (bOpenWindow == true && this.m_commentViewer.Visible == false))
            {
                m_commentViewer = new CommentViewerForm();
                MainForm.SetControlFont(m_commentViewer, this.Font, false);
                bNew = true;
            }

            m_commentViewer.MainForm = this.MainForm;  // 必须是第一句

            if (bNew == true)
                m_commentViewer.InitialWebBrowser();

            m_commentViewer.Text = "MARC内容 '" + info.RecPath + "'";
            m_commentViewer.HtmlString = strHtml;
            m_commentViewer.XmlString = strXml; //  MergeXml(strXml1, strXml2);
            m_commentViewer.FormClosed -= new FormClosedEventHandler(marc_viewer_FormClosed);
            m_commentViewer.FormClosed += new FormClosedEventHandler(marc_viewer_FormClosed);
            // this.MainForm.AppInfo.LinkFormState(m_viewer, "comment_viewer_state");
            // m_viewer.ShowDialog(this);
            // this.MainForm.AppInfo.UnlinkFormState(m_viewer);
            if (bOpenWindow == true)
            {
                if (m_commentViewer.Visible == false)
                {
                    this.MainForm.AppInfo.LinkFormState(m_commentViewer, "marc_viewer_state");
                    m_commentViewer.Show(this);
                    m_commentViewer.Activate();

                    this.MainForm.CurrentPropertyControl = null;
                }
                else
                {
                    if (m_commentViewer.WindowState == FormWindowState.Minimized)
                        m_commentViewer.WindowState = FormWindowState.Normal;
                    m_commentViewer.Activate();
                }
            }
            else
            {
                if (m_commentViewer.Visible == true)
                {

                }
                else
                {
                    if (this.MainForm.CurrentPropertyControl != m_commentViewer.MainControl)
                        m_commentViewer.DoDock(false); // 不会自动显示FixedPanel
                }
            }
            return;
        ERROR1:
            MessageBox.Show(this, "DoViewComment() 出错: " + strError);
        }
Ejemplo n.º 4
0
        void DoViewOperlog(bool bOpenWindow)
        {
            string strError = "";
            string strHtml = "";
            string strXml = "";

            // 优化,避免无谓地进行服务器调用
            if (bOpenWindow == false)
            {
                if (this.MainForm.PanelFixedVisible == false
                    && (m_operlogViewer == null || m_operlogViewer.Visible == false))
                    return;
            }

            if (this.listView_records.SelectedItems.Count != 1)
            {
                // 2012/10/2
                if (this.m_operlogViewer != null)
                    this.m_operlogViewer.Clear();

                return;
            }

            ListViewItem item = this.listView_records.SelectedItems[0];
            string strFilename = ListViewUtil.GetItemText(item, COLUMN_FILENAME);
            string strIndex = ListViewUtil.GetItemText(item, COLUMN_INDEX);

            // 从服务器获得
            // return:
            //      -1  出错
            //      0   正常
            //      1   用户中断
            int nRet = GetXml(item,
    out strXml,
    out strError);
            if (nRet == 1)
                return;
            if (nRet == -1)
            {
                goto ERROR1;
            }
            else
            {

                // 创建解释日志记录内容的 HTML 字符串
                // return:
                //      -1  出错
                //      0   成功
                //      1   未知的操作类型
                nRet = GetHtmlString(strXml,
                    true,
                    out strHtml,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
                if (nRet == 1)
                    strHtml = strError;
            }

            bool bNew = false;
            if (this.m_operlogViewer == null
                || (bOpenWindow == true && this.m_operlogViewer.Visible == false))
            {
                m_operlogViewer = new CommentViewerForm();
                MainForm.SetControlFont(m_operlogViewer, this.Font, false);
                m_operlogViewer.SuppressScriptErrors = this.MainForm.SuppressScriptErrors;
                bNew = true;
            }

            m_operlogViewer.MainForm = this.MainForm;  // 必须是第一句

            if (bNew == true)
                m_operlogViewer.InitialWebBrowser();

            m_operlogViewer.Text = "日志记录 '" + strFilename + " : " + strIndex + "'";
            m_operlogViewer.HtmlString = (string.IsNullOrEmpty(strHtml) == true ? NOTSUPPORT : strHtml);
            m_operlogViewer.XmlString = strXml;
            m_operlogViewer.FormClosed -= new FormClosedEventHandler(m_viewer_FormClosed);
            m_operlogViewer.FormClosed += new FormClosedEventHandler(m_viewer_FormClosed);

            if (bOpenWindow == true)
            {
                if (m_operlogViewer.Visible == false)
                {
                    this.MainForm.AppInfo.LinkFormState(m_operlogViewer, "operlog_viewer_state");
                    m_operlogViewer.Show(this);
                    m_operlogViewer.Activate();

                    this.MainForm.CurrentPropertyControl = null;
                }
                else
                {
                    if (m_operlogViewer.WindowState == FormWindowState.Minimized)
                        m_operlogViewer.WindowState = FormWindowState.Normal;
                    m_operlogViewer.Activate();
                }
            }
            else
            {
                if (m_operlogViewer.Visible == true)
                {

                }
                else
                {
                    if (this.MainForm.CurrentPropertyControl != m_operlogViewer.MainControl)
                        m_operlogViewer.DoDock(false); // 不会自动显示FixedPanel
                }
            }
            return;
        ERROR1:
            MessageBox.Show(this, "DoViewOperlog() 出错: " + strError);
        }
Ejemplo n.º 5
0
        void DoViewOperlog(bool bOpenWindow)
        {
            string strError = "";
            string strHtml = "";
            string strXml = "";
            int nRet = 0;

            // 优化,避免无谓地进行服务器调用
            if (bOpenWindow == false)
            {
                if (this.MainForm.PanelFixedVisible == false
                    && (m_operlogViewer == null || m_operlogViewer.Visible == false))
                    return;
            }

            ListView list = null;
            if (this.listView_amerced.Focused == true)
                list = this.listView_amerced;
            else if (this.listView_overdues.Focused == true)
                list = this.listView_overdues;
            else
                list = null;

            if (list == null || list.SelectedItems.Count != 1)
            {
                // 2012/10/2
                if (this.m_operlogViewer != null)
                    this.m_operlogViewer.Clear();

                return;
            }

            ListViewItem item = list.SelectedItems[0];
            string strTitle = "";
            {

                // 创建解释事项内容的 HTML 字符串
                nRet = GetHtmlString(item,
                    out strTitle,
                    out strHtml,
                    out strXml,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }

            bool bNew = false;
            if (this.m_operlogViewer == null
                || (bOpenWindow == true && this.m_operlogViewer.Visible == false))
            {
                m_operlogViewer = new CommentViewerForm();
                MainForm.SetControlFont(m_operlogViewer, this.Font, false);
                m_operlogViewer.SuppressScriptErrors = this.MainForm.SuppressScriptErrors;
                bNew = true;
            }

            m_operlogViewer.MainForm = this.MainForm;  // 必须是第一句

            if (bNew == true)
                m_operlogViewer.InitialWebBrowser();

            m_operlogViewer.Text = strTitle;
            m_operlogViewer.HtmlString = (string.IsNullOrEmpty(strHtml) == true ? NOTSUPPORT : strHtml);
            m_operlogViewer.XmlString = strXml;
            m_operlogViewer.FormClosed -= new FormClosedEventHandler(m_viewer_FormClosed);
            m_operlogViewer.FormClosed += new FormClosedEventHandler(m_viewer_FormClosed);

            if (bOpenWindow == true)
            {
                if (m_operlogViewer.Visible == false)
                {
                    this.MainForm.AppInfo.LinkFormState(m_operlogViewer, "operlog_viewer_state");
                    m_operlogViewer.Show(this);
                    m_operlogViewer.Activate();

                    this.MainForm.CurrentPropertyControl = null;
                }
                else
                {
                    if (m_operlogViewer.WindowState == FormWindowState.Minimized)
                        m_operlogViewer.WindowState = FormWindowState.Normal;
                    m_operlogViewer.Activate();
                }
            }
            else
            {
                if (m_operlogViewer.Visible == true)
                {

                }
                else
                {
                    if (this.MainForm.CurrentPropertyControl != m_operlogViewer.MainControl)
                        m_operlogViewer.DoDock(false); // 不会自动显示FixedPanel
                }
            }
            return;
        ERROR1:
            MessageBox.Show(this, "DoViewOperlog() 出错: " + strError);
        }