def print_pending_hold_requests_information(req, ln):
    """
    Create a printable format with all the information about all
    pending hold requests.
    """

    _ = gettext_set_language(ln)

    requests = db.get_pdf_request_data('pending')

    req.content_type = "text/html"
    req.send_http_header()

    out = """<table style='width:100%; margin:auto; max-width: 1024px;'>"""
    out += """
                   <tr>
                     <td><img src="%s/img/CERN_CDS_logo.png"></td>
                   </tr>
                  </table><br />""" % (CFG_SITE_URL)
    out += """<table style='color: #79d; font-size: 82%; width:95%; margin:auto; max-width: 1024px;'>"""

    out += """ <tr><td align="center"><h2><strong>%s</strong></h2></td></tr>""" % (_("List of pending hold requests"))

    out += """ <tr><td align="center"><strong>%s</strong></td></tr>""" % (time.ctime())

    out += """</table><br/>"""

    out += """<table style='color: #79d; font-size: 82%; width:95%; margin:auto; max-width: 1024px;'>"""

    out += """<tr>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                  </tr>
                       """ % (_("Borrower"),
                              _("Item"),
                              _("Library"),
                              _("Location"),
                              _("From"),
                              _("To"),
                              _("Request date"))

    for (recid, borrower_name, library_name, location, date_from, date_to, request_date) in requests:

        out += """<tr style='color: black;'>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                      </tr>
                         """ % (borrower_name, book_title_from_MARC(recid), library_name,
                                location, date_from, date_to, request_date)

    out += """</table>
              <br />
              <br />
                  <table style='color: #79d; font-size: 82%; width:95%; margin:auto; max-width: 1024px;'>
                  <tr>
                    <td>
                      <input type=button value='Back' onClick="history.go(-1)"
                      style='color: #fff; background: #36c; font-weight: bold;'>

                      <input type="button" onClick='window.print()'
                      value='Print' style='color: #fff; background: #36c; font-weight: bold;'>
                    </td>
                  </tr>
                  </table>"""

    req.write("<html>")
    req.write(out)
    req.write("</html>")

    return "\n"
示例#2
0
def print_pending_hold_requests_information(req, ln):
    """
    Create a printable format with all the information about all
    pending hold requests.
    """

    _ = gettext_set_language(ln)

    requests = db.get_pdf_request_data(CFG_BIBCIRCULATION_REQUEST_STATUS_PENDING)

    req.content_type = "text/html"
    req.send_http_header()

    out = """<table style='width:100%; margin:auto; max-width: 1024px;'>"""
    out += """
                   <tr>
                     <td><img src="%s/img/CERN_CDS_logo.png"></td>
                   </tr>
                  </table><br />""" % (CFG_SITE_URL)
    out += """<table style='color: #79d; font-size: 82%;
                     width:95%; margin:auto; max-width: 1024px;'>"""

    out += """  <tr>
                    <td align="center"><h2><strong>%s</strong></h2></td>
                </tr>""" % (_("List of pending hold requests"))

    out += """  <tr>
                    <td align="center"><strong>%s</strong></td>
                </tr>""" % (time.ctime())

    out += """</table><br/>"""

    out += """<table style='color: #79d; font-size: 82%;
                     width:95%; margin:auto; max-width: 1024px;'>"""

    out += """<tr>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                       <td><strong>%s</strong></td>
                  </tr>
                       """ % (_("Borrower"),
                              _("Item"),
                              _("Library"),
                              _("Location"),
                              _("From"),
                              _("To"),
                              _("Request date"))

    for (recid, borrower_name, library_name, location,
         date_from, date_to, request_date) in requests:

        out += """<tr style='color: black;'>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                         <td class="bibcirccontent">%s</td>
                      </tr>
                         """ % (borrower_name, book_title_from_MARC(recid),
                                library_name, location, date_from, date_to,
                                request_date)

    out += """</table>
              <br />
              <br />
                  <table style='color: #79d; font-size: 82%;
                  width:95%; margin:auto; max-width: 1024px;'>
                  <tr>
                    <td>
                      <input type=button value='Back' onClick="history.go(-1)"
                             style='color: #fff; background: #36c;
                             font-weight: bold;'>

                      <input type="button" onClick='window.print()'
                      value='Print' style='color: #fff;
                                background: #36c; font-weight: bold;'>
                    </td>
                  </tr>
                  </table>"""

    req.write("<html>")
    req.write(out)
    req.write("</html>")

    return "\n"