protected override void RenderContents(HtmlTextWriter output) { string strLeftHtml = ""; string strRightHtml = ""; string strTopHtml = ""; string strBottomHtml = ""; GetCustomHtml(out strLeftHtml, out strRightHtml, out strTopHtml, out strBottomHtml); int nParentCount = GetParentCount(); output.Indent += nParentCount; // 主体内容结束 NormalIndentor.Write(output, -1); output.Write("<!-- FooterBarControl 开始 -->"); EndIndentor.Write(output); output.Write("</td></tr>"); // 底部图像表格 开始 NormalIndentor.Write(output); output.Write("<!-- 底部图像开始 -->"); BeginIndentor.Write(output); output.Write("<tr><td>"); BeginIndentor.Write(output); output.Write("<table class='footer'>"); BeginIndentor.Write(output); output.Write("<tr class='footer'>"); // 左 NormalIndentor.Write(output); output.Write("<td class='left'>" + strLeftHtml + "</td>"); // 中 NormalIndentor.Write(output); #if NO output.Write("<td class='middle'>" + this.GetString("dp2图书馆集成系统") + " V2 - " + this.GetString("版权所有") + " © 2006-2015 <a href='http://dp2003.com'>" + this.GetString("数字平台(北京)软件有限责任公司") + "</a>" + "</td>"); #endif OpacApplication app = (OpacApplication)this.Page.Application["app"]; output.Write("<td class='middle'>" + strTopHtml + this.GetString("dp2图书馆集成系统") + " V3 - <a href='https://github.com/DigitalPlatform/dp2'>" + "开源的图书馆管理系统" + strBottomHtml + "</td>"); // 右 NormalIndentor.Write(output); output.Write("<td class='right'>" + strRightHtml + "</td>"); EndIndentor.Write(output); output.Write("</tr>"); EndIndentor.Write(output); output.Write("</table>"); EndIndentor.Write(output); output.Write("</td></tr>"); NormalIndentor.Write(output); output.Write("<!-- 底部图像结束 -->"); // 总表格结束 EndIndentor.Write(output); output.Write("</table>"); NormalIndentor.Write(output); output.Write("<!-- FooterBarControl 结束 -->"); if (string.IsNullOrEmpty(app.OutgoingQueue) == false) { output.Write("<center><br/><br/><div><img src='" + MyWebPage.GetStylePath(app, "qrcode_ilovelibrary_258.jpg") + "'></img><br/><br/>用微信“扫一扫”,关注“我爱图书馆”公众号,可获得超期、借书还书等微信消息通知<br/><br/><br/><br/></div></center>"); } output.Indent -= nParentCount; }
void CreateStyleLines() { OpacApplication app = (OpacApplication)this.Page.Application["app"]; if (app == null) { return; } string strStyleRoot = this.Page.Server.MapPath("./style"); // 左侧文字 // LiteralControl literal = null; DirectoryInfo root = new DirectoryInfo(strStyleRoot); if (root.Exists == false) { strStyleRoot = Path.Combine(app.DataDir, "style"); root = new DirectoryInfo(strStyleRoot); if (root.Exists == false) { return; } } DirectoryInfo[] dis = root.GetDirectories(); Array.Sort(dis, new DirectoryInfoCompare()); for (int i = 0; i < dis.Length; i++) { // 2015/1/26 string strTotalFileName = Path.Combine(dis[i].FullName, "total.jpg"); if (File.Exists(strTotalFileName) == false) { continue; } string strDirName = dis[i].Name; // imagebutton ImageButton imagebutton = new ImageButton(); /* * if (strReaderStyleDir == strDirName) * imagebutton.CssClass = "selected"; * else * imagebutton.CssClass = "unselected"; * */ // 这里暂时设置成这样,待Render阶段再把选定的一个设置为"selected" imagebutton.CssClass = "unselected"; imagebutton.ID = strDirName; imagebutton.ImageUrl = MyWebPage.GetStylePath(app, strDirName + "/total.jpg"); imagebutton.Click += new ImageClickEventHandler(imagebutton_Click); this.Controls.Add(imagebutton); } return; /* * ERROR1: * return; * */ }
protected override void Render(HtmlTextWriter output) { if (this.RecPath == "") { output.Write("尚未指定记录路径"); return; } int nRet = 0; long lRet = 0; string strError = ""; // string strOutputPath = ""; 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; } PlaceHolder inputline = (PlaceHolder)this.FindControl("inputline"); PlaceHolder cmdline = (PlaceHolder)this.FindControl("cmdline"); if (bManager == false) { cmdline.Visible = false; } string strBiblioState = ""; #if NO string strBiblioXml = ""; // 获得书目XML { byte[] timestamp = null; string[] formats = new string[1]; formats[0] = "xml"; string[] results = null; lRet = sessioninfo.Channel.GetBiblioInfos( null, this.RecPath, formats, out results, out timestamp, out strError); if (lRet == -1) { strError = "获得种记录 '" + this.RecPath + "' 时出错: " + strError; goto ERROR1; } if (results == null || results.Length < 1) { strError = "results error "; goto ERROR1; } strBiblioXml = results[0]; this.Timestamp = ByteArray.GetHexTimeStampString(timestamp); this.BiblioRecPath = this.RecPath; } string strMarc = ""; // 转换为MARC { string strOutMarcSyntax = ""; // 将MARCXML格式的xml记录转换为marc机内格式字符串 // parameters: // bWarning ==true, 警告后继续转换,不严格对待错误; = false, 非常严格对待错误,遇到错误后不继续转换 // strMarcSyntax 指示marc语法,如果=="",则自动识别 // strOutMarcSyntax out参数,返回marc,如果strMarcSyntax == "",返回找到marc语法,否则返回与输入参数strMarcSyntax相同的值 nRet = MarcUtil.Xml2Marc(strBiblioXml, true, "", // this.CurMarcSyntax, out strOutMarcSyntax, out strMarc, out strError); if (nRet == -1) { goto ERROR1; } } #endif bool bAjax = true; if (this.DisableAjax == true) { bAjax = false; } else { if (app != null && app.WebUiDom != null && app.WebUiDom.DocumentElement != null) { XmlNode nodeBiblioControl = app.WebUiDom.DocumentElement.SelectSingleNode( "biblioControl"); if (nodeBiblioControl != null) { DomUtil.GetBooleanParam(nodeBiblioControl, "ajax", true, out bAjax, out strError); } } } string strMarc = ""; if (string.IsNullOrEmpty(this.m_strMARC) == true) { nRet = PrepareBiblioRecord(out strError); if (nRet == -1) { goto ERROR1; } strMarc = this.m_strMARC; } strBiblioState = MarcDocument.GetFirstSubfield(strMarc, "998", "s"); // 状态 string strOriginCreator = MarcDocument.GetFirstSubfield(strMarc, "998", "z"); bool bReaderCreate = false; if (StringUtil.IsInList("读者创建", strBiblioState) == true) { bReaderCreate = true; } // 不是读者创建的记录,就不让在这里修改状态 if (bReaderCreate == false) { cmdline.Visible = false; } bool bDisplayOriginContent = false; if (StringUtil.IsInList("审查", strBiblioState) == false && StringUtil.IsInList("屏蔽", strBiblioState) == false) { bDisplayOriginContent = true; } // 管理员和作者本人都能看到被屏蔽的内容 if (bManager == true || strOriginCreator == sessioninfo.UserID) { bDisplayOriginContent = true; } string strBiblio = ""; if (bDisplayOriginContent == true) { if (bAjax == true) { strBiblio = "<div class='pending'>biblio_html:" + HttpUtility.HtmlEncode(this.RecPath) + "</div>"; } else { strBiblio = this.m_strOpacBiblio; #if NO string strBiblioDbName = ResPath.GetDbName(this.RecPath); // 需要从内核映射过来文件 string strLocalPath = ""; nRet = app.MapKernelScriptFile( null, // sessioninfo, strBiblioDbName, "./cfgs/opac_biblio.fltx", // OPAC查询固定认这个角色的配置文件,作为公共查询书目格式创建的脚本。而流通前端,创建书目格式的时候,找的是loan_biblio.fltx配置文件 out strLocalPath, out strError); if (nRet == -1) { goto ERROR1; } // 将种记录数据从XML格式转换为HTML格式 Hashtable result_params = null; // 2006/11/28 changed string strFilterFileName = strLocalPath; // app.CfgDir + "\\biblio.fltx"; nRet = app.ConvertBiblioXmlToHtml( strFilterFileName, strBiblioXml, this.RecPath, out strBiblio, out result_params, out strError); if (nRet == -1) { goto ERROR1; } // TODO: Render的时候设置,已经晚了半拍 // 要想办法在全部Render前得到题名和进行设置 if (this.AutoSetPageTitle == true && result_params != null) { string strTitle = (string)result_params["title"]; if (string.IsNullOrEmpty(strTitle) == false) { this.Page.Title = strTitle; } } /* * string strPrefix = ""; * if (this.Wrapper == true) * strPrefix = this.GetPrefixString("书目信息", "content_wrapper") + "<div class='biblio_wrapper'>"; + + string strPostfix = ""; + if (this.Wrapper == true) + strPostfix = "</div>" + this.GetPostfixString(); * */ /* * LiteralControl literal = (LiteralControl)FindControl("biblio"); * literal.Text = strPrefix + strBiblio + strPostfix; * */ // strBiblio = strPrefix + strBiblio + strPostfix; #endif } } // 屏蔽等状态显示 string strResult = ""; string strImage = ""; if (StringUtil.IsInList("精品", strBiblioState) == true) { strImage = "<img src='" + MyWebPage.GetStylePath(app, "valuable.gif") + "'/>"; strResult += "<div class='valuable' title='精品'>" + strImage + this.GetString("精品") + "</div>"; } if (StringUtil.IsInList("锁定", strBiblioState) == true) { strImage = "<img src='" + MyWebPage.GetStylePath(app, "locked.gif") + "'/>"; strResult += "<div class='locked' title='锁定'>" + strImage + this.GetString("锁定") + "</div>"; } string strDisplayState = ""; if (StringUtil.IsInList("审查", strBiblioState) == true) { strImage = "<img src='" + MyWebPage.GetStylePath(app, "censor.gif") + "'/>"; strDisplayState = this.GetString("审查"); } if (StringUtil.IsInList("屏蔽", strBiblioState) == true) { strImage = "<img src='" + MyWebPage.GetStylePath(app, "disable.gif") + "'/>"; if (String.IsNullOrEmpty(strDisplayState) == false) { strDisplayState += ","; } strDisplayState += this.GetString("屏蔽"); } if (String.IsNullOrEmpty(strDisplayState) == false) { strResult += "<div class='forbidden' title='" + this.GetString("屏蔽原因") + "'>" + strImage + string.Format(this.GetString("本书目记录目前为X状态"), strDisplayState) + (strOriginCreator == sessioninfo.UserID ? "," + this.GetString("其他人(非管理员)看不到下列内容") : "") + "</div>"; } if (String.IsNullOrEmpty(strResult) == false) { strResult = "<div class='biblio_state'>" + strResult + "</div>"; } if (this.EditAction == "changestate") { inputline.Visible = true; SetStateValueToControls(strBiblioState); cmdline.Visible = false; // 在编辑态,命令条就不要出现了 } else { inputline.Visible = false; } if (this.Active == false) { cmdline.Visible = false; inputline.Visible = false; // 即便在编辑态也要加以压抑 } string strClass = "biblio"; if ((String.IsNullOrEmpty(strResult) == false || inputline.Visible == true) && this.Wrapper == false) { strClass += " frame-border"; } LiteralControl outer_class = (LiteralControl)this.FindControl("outer_class"); outer_class.Text = strClass; // output.Write(strBiblio); LiteralControl literal = (LiteralControl)FindControl("biblio"); // literal.Text = "<div class='"+strClass+"'>" + strResult + strBiblio + "</biblio>"; literal.Text = strResult + strBiblio; base.Render(output); return; ERROR1: output.Write(strError); }