Merge remote branch 'esi/template-toolkit-opac' into template-toolkit-opac-master...
authorBill Erickson <berick@esilibrary.com>
Thu, 4 Aug 2011 19:41:32 +0000 (15:41 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 4 Aug 2011 19:41:32 +0000 (15:41 -0400)
1  2 
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/src/templates/default/opac/myopac/holds/edit.tt2
Open-ILS/src/templates/default/opac/parts/filtersort.tt2
Open-ILS/src/templates/default/opac/parts/org_selector.tt2

index 53e12c9,0000000..2fda76c
mode 100644,000000..100644
--- /dev/null
@@@ -1,117 -1,0 +1,111 @@@
-     hold = 0;
-     FOR h IN ctx.holds;
-         IF h.hold.hold.id == CGI.param('id');
-             hold = h;
-             ahr = hold.hold.hold;
-             attrs = {marc_xml => hold.marc_xml};
-             PROCESS get_marc_attrs args=attrs;
-             hold.human_status = PROCESS get_hold_status hold=hold;
 +[%  PROCESS "default/opac/parts/header.tt2";
 +    PROCESS "default/opac/parts/misc_util.tt2";
 +    PROCESS "default/opac/parts/org_selector.tt2";
 +    WRAPPER "default/opac/parts/base.tt2" +
 +        "default/opac/parts/myopac/base.tt2";
 +    myopac_page = "holds"; # in this case, just for tab coloring.
 +
-             # Do this up front to avoid verbosity later
-             expire_time = ahr.expire_time ? date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT) : '';
-             thaw_date = ahr.thaw_date ? date.format(ctx.parse_datetime(ahr.thaw_date), DATE_FORMAT) : '';
-             LAST;
-         END;
-     END;
++    hold = ctx.holds.0;
++    ahr = hold.hold.hold;
++    attrs = {marc_xml => hold.marc_xml};
++    PROCESS get_marc_attrs args=attrs;
++    hold.human_status = PROCESS get_hold_status hold=hold;
 +
++    # Do this up front to avoid verbosity later
++    expire_time = ahr.expire_time ? date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT) : '';
++    thaw_date = ahr.thaw_date ? date.format(ctx.parse_datetime(ahr.thaw_date), DATE_FORMAT) : '';
 +%]
 +<div class="pad-bottom-five">
 +    <div class="header_middle">
 +        <span id="acct_holds_header float-left">[% l('Editing Hold') %]</span>
 +        &nbsp; &nbsp; &nbsp; &nbsp;
 +        <a href="[% ctx.opac_root %]/myopac/holds">[% l('List all holds') %]</a>
 +    </div>
 +    <div id="hold_editor">
 +        [% IF hold %]
 +            <h1>[% attrs.title %]</h1>
 +            <h2>[% attrs.author %]</h2>
 +            [% IF attrs.format_icon %]<p>
 +                <strong>[% l('Format:') %]</strong>
 +                <img src="[% ctx.media_prefix %]/images/[% attrs.format_icon %]" alt="[% attrs.format %]" title="[% attrs.title %]" />
 +            </p>[% END %]
 +            <p>
 +                <strong>[% l('Status') %]</strong>: [% hold.human_status %]
 +            </p>
 +            <form method="POST">
 +                <table id="hold_editor_table">
 +                    <tr>
 +                        <th>
 +                            <input type="hidden" name="action" value="edit" />
 +                            <input type="hidden" name="hold_id"
 +                                value="[% ahr.id %]" />
 +                            [% l('Pickup library') %]
 +                        </th>
 +                        <td>
 +                            [% PROCESS build_org_selector
 +                                name='pickup_lib' value=ahr.pickup_lib %]
 +                        </td>
 +                    </tr>
 +                    <tr>
 +                        <th>
 +                            [% l('Cancel unless filled by') %]
 +                        </th>
 +                        <td>
 +                            <input type="text" name="expire_time"
 +                                value="[% expire_time | html %]" />
 +                        </td>
 +                        <td class="fmt-note">
 +                            <em>[% l('Enter date in MM/DD/YYYY format') %]</em>
 +                            <!-- XXX TODO pick out a minimal, simple, reliable
 +                            calendar widget that's not part of some giant,
 +                            bloated framework and doesn't do anything at onload.
 +                            -->
 +                        </td>
 +                    </tr>
 +                    <tr>
 +                        <th>
 +                            [% l('Active?') %]
 +                        </th>
 +                        <td>
 +                            <select name="frozen">
 +                                <option value="f"[% ahr.frozen == 't' ? '' :' selected="selected"' %]>
 +                                    [% l('Yes, this hold is active now') %]
 +                                </option>
 +                                <option value="t"[% ahr.frozen == 't' ? ' selected="selected"' : '' %]>
 +                                    [% l('No, this hold is suspended') %]
 +                                </option>
 +                            </select>
 +                        </td>
 +                    </tr>
 +                    <tr>
 +                        <th>
 +                            [% l('If suspended, activate on') %]
 +                        </th>
 +                        <td>
 +                            <input type="text" name="thaw_date"
 +                                value="[% thaw_date | html %]" />
 +                        </td>
 +                        <td class="fmt-note">
 +                            <em>[% l('Enter date in MM/DD/YYYY format') %]</em>
 +                        </td>
 +                    </tr>
 +                    <tr>
 +                        <td colspan="2" class="hold-editor-controls">
 +                            <input type="image"
 +                                src="[% ctx.media_prefix %]/images/btnSubmit.png"
 +                                alt="[% l('Submit') %]"
 +                                title="[% l('Submit') %]" />
 +                            <a href="[% ctx.opac_root %]/myopac/holds"><img
 +                                src="[% ctx.media_prefix %]/images/btnCancel.png"
 +                                alt="[% l('Cancel') %]"
 +                                title="[% l('Cancel') %]" /></a>
 +                        </td>
 +                    </tr>
 +                </table>
 +            </form>
 +        [% ELSE;
 +            l('Hold not found');
 +        END %]
 +    </div>
 +</div>
 +[% END %]
index 795b179,0000000..428626c
mode 100644,000000..100644
--- /dev/null
@@@ -1,15 -1,0 +1,15 @@@
-         <option value='title'[% value == 'title' ? ' selected="selected"' : '' %]>[% l("Title: A to Z") %]</option>
-         <option value='title.desc'[% value == 'title.desc' ? ' selected="selected"' : '' %]>[% l("Title: Z to A") %]</option>
 +<select class="results_header_sel" id='opac.result.sort' name="sort">
 +    <option value=''>[% l("Sort by Relevance") %]</option>
 +    <optgroup label='[% l("Sort by Title") %]'>
-         <option value='author'[% value == 'author' ? ' selected="selected"' : '' %]>[% l("Author: A to Z") %]</option>
-         <option value='author.desc'[% value == 'author.desc' ? ' selected="selected"' : '' %]>[% l("Author: Z to A") %]</option>
++        <option value='titlesort'[% value == 'titlesort' ? ' selected="selected"' : '' %]>[% l("Title: A to Z") %]</option>
++        <option value='titlesort.desc'[% value == 'titlesort.desc' ? ' selected="selected"' : '' %]>[% l("Title: Z to A") %]</option>
 +    </optgroup>
 +    <optgroup label='[% l("Sort by Author") %]'>
++        <option value='authorsort'[% value == 'authorsort' ? ' selected="selected"' : '' %]>[% l("Author: A to Z") %]</option>
++        <option value='authorsort.desc'[% value == 'authorsort.desc' ? ' selected="selected"' : '' %]>[% l("Author: Z to A") %]</option>
 +    </optgroup>
 +    <optgroup label='[% l("Sort by Publication Date") %]'>
 +        <option value='pubdate.desc'[% value == 'pubdate.desc' ? ' selected="selected"' : '' %]>[% l("Date: Newest to Oldest") %]</option>
 +        <option value='pubdate'[% value == 'pubdate' ? ' selected="selected"' : '' %]>[% l("Date: Oldest to Newest") %]</option>
 +    </optgroup>
 +</select>
index 3a203f6,0000000..52500f0
mode 100644,000000..100644
--- /dev/null
@@@ -1,33 -1,0 +1,31 @@@
-         IF can_have_vols_only;
-             IF walker.ou_type.can_have_vols != 't';
-                 disabled = 'disabled="disabled"';
-             ELSIF walker.id == value;
-                 selected = 'selected="selected"';
-             END;
 +[%
 +    BLOCK build_org_selector_options;
 +        disabled = '';
 +        selected = '';
++        IF can_have_vols_only AND walker.ou_type.can_have_vols != 't';
++            disabled = 'disabled="disabled"';
++        ELSIF walker.id == value;
++            selected = 'selected="selected"';
 +        END;
 +%]
 +        <option value='[% walker.id %]' [% selected %] [% disabled %]>
 +            [%
 +                pad = walker.ou_type.depth * 2;
 +                FOR idx IN [0..pad]; '&nbsp;'; END;
 +                walker.name;
 +            %]
 +        </option>
 +        [%  FOR child IN walker.children;
 +            PROCESS build_org_selector_options walker=child value=value;
 +        END;
 +    END;
 +
 +    # XXX TODO probably put this BLOCK somewhere else so it can be used widely.
 +    # Org Unit Selector Widget :
 +    #   PROCESS build_org_selector id='selector-id' name='selector-name'
 +    BLOCK build_org_selector;
 +%]
 +    <select [% IF id %] id='[% id %]' [% END %] name='[% name %]'>
 +    [% PROCESS build_org_selector_options walker=(org_unit || ctx.aou_tree) value=value %]
 +    </select>
 +[%  END %]