Support for most of the actions on lists and bookbags
[evergreen-equinox.git] / Open-ILS / web / templates / default / opac / myopac / lists.tt2
index 3da5062..85cf1c0 100644 (file)
         [% INCLUDE "default/opac/parts/anon_list.tt2" %]
         [% IF ctx.bookbags.size %]
         <div id='acct_lists_prime'>
+            [% FOR bbag IN ctx.bookbags %]
             <div id='acct_list_template'>
                 <div style="width:100%">
-                    <div style="float:left;font-weight:bold;padding-top:5px;" name='list_name'></div>
-
-                    <div style="float:left;padding:5px 0px 0px 10px;">
-
-                        <a target='_blank' name='share_list_rss' class='hide_me'><img 
-                            alt="[% l('RSS Feed') %]" border="0" src="[% ctx.media_prefix %]/images/small-rss.png"
-                            title="[% l('You are sharing this list') %]"/></a>
-                    </div>
-                    <div style="float:left;padding:5px 0px 0px 10px;">
-                        <a href="#" name="share_list_link">[% l('Share') %]</a>
-                    </div>
-                    <div style="float:left;padding:5px 0px 0px 10px;">
-                        <a href="#" name="remove_list">[% l('Remove') %]</a>
+                    <div class="bookbag-name">[% bbag.name %]</div>
+                    <div class="bookbag-share">
+                        [% IF bbag.pub == 't'; # XXX TODO %]
+                        <!-- <a target='_blank' name='share_list_rss'><img
+                            alt="[% l('RSS Feed') %]" border="0"
+                            src="[% ctx.media_prefix %]/images/small-rss.png"
+                            title="[% l('You are sharing this list') %]" /></a> -->
+                        [% END %]
                     </div>
+                    <form action="[% ctx.opac_root %]/myopac/list/update"
+                        method="POST">
+                        <div class="bookbag-share">
+                            <input type="hidden" name="list" value="[% bbag.id %]" />
+                            [% IF bbag.pub != 't' %]
+                            <input type="hidden" name="action" value="show" />
+                            <input type="submit" value="[% l('Share') %]" />
+                            [% ELSE %]
+                            <input type="hidden" name="action" value="hide" />
+                            <input type="submit" value="[% l('Hide') %]" />
+                            [% END %]
+                        </div>
+                    </form>
+                    <form action="[% ctx.opac_root %]/myopac/list/update"
+                        method="POST">
+                        <div class="bookbag-share">
+                            <input type="hidden" name="list" value="[% bbag.id %]" />
+                            <input type="hidden" name="action" value="delete" />
+                            <input type="submit" value="[% l('Delete List') %]" />
+                        </div>
+                    </form>
                     <div class="clear-both pad-bottom-five"></div>
                 </div>
-                <table id="acct_list_header" cellpadding='0' cellspacing='0' border='0'>
-                    <tr>
-                        <td width="1%" style="padding-left:10px;">
-                            <input type="checkbox" id="check_all_list" />
-                        </td>
-                        <td width="98%" style="padding-left:5px;">Title</td>
-                        <td width="1%">
-                            <select class="opac-auto-179" name="list_actions">
-                                <option value="0">[% l('-- Actions for this list --') %]</option>
-                                <option value="hold">[% l('Place Hold') %]</option>
-                                <option value="remove">[% l('Remove Items') %]</option>
-                            </select>
-                        </td>
-                    </tr>
-                </table>
-                <table cellpadding='0' cellspacing='5' border='0'
-                    width='91%' style='margin-left:5px;margin-top:5px;'>
-                    <tbody name='list_tbody'></tbody>
+                <form action="[% ctx.opac_root %]/myopac/list/update"
+                    method="POST">
+                <input type="hidden" name="list" value="[% bbag.id %]" />
+                <table cellpadding='0' cellspacing='0' border='0'>
+                    <thead id="acct_list_header">
+                        <tr>
+                            <td width="1%" style="padding-left: 10px;">
+                                <input type="checkbox" />
+                            </td>
+                            <td width="49%" style="padding-left: 5px;">[% l('Title') %]</td>
+                            <td width="49%">[% l('Author(s)') %]</td>
+                            <td width="1%" class="nowrap">
+                                <select class="opac-auto-179" name="action">
+                                    <option>[% l('-- Actions for this list --') %]</option>
+                                    <!-- XXX not ready yet<option value="hold">[% l('Place Hold') %]</option> -->
+                                    <option value="del_item">[% l('Remove Items') %]</option>
+                                </select>
+                                <input type="submit" value="[% l('Go') %]" />
+                            </td>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        [% UNLESS bbag.items.size %]
+                        <tr><td colspan="4" class="opac-auto-171 opac-auto-097">
+                            [% l("This list contains no items.") %]
+                        </td></tr>
+                        [% END %]
+                        [% FOR item IN bbag.items;
+                            item_id = item.id;
+                            attrs = {marc_xml => ctx.bookbags_marc_xml.$item_id};
+                            PROCESS get_marc_attrs args=attrs %]
+                        <tr>
+                            <td class="opac-auto-097b" style="padding-left: 10px;"><input type="checkbox" name="del_item" value="[% item_id %]" /></td>
+                            <td class="opac-auto-097b" style="padding-left: 5px;">[% attrs.title %]</td>
+                            <td class="opac-auto-097b">[% attrs.author %]</td>
+                        </tr>
+                        [% END %]
+                    </tbody>
                 </table>
+                </form>
                 <br /><br />
             </div>
+            [% END %]
         </div>
         [% END %]
     </div>
     </div>
     <div style='text-align: center; font-weight: bold;' 
         class='hide_me' id='myopac_bookbags_none'>[% l("You have not created any bookbags") %]</div>
-    <table width='100%' class='data_grid data_grid_center hide_me'
-        id='myopac_bookbag_table'>
-        <thead>
-            <tr>
-                <td>[% l("Name") %]</td>
-                <td>[% l("# Items") %]</td>
-                <td>[% l("Shared") %]</td>
-                <td>[% l("Share / Hide") %]</td>
-                <td>[% l("Delete this bookbag?") %]</td>
-            </tr>
-        </thead>
-        <tbody id='myopac_bookbag_tbody'>
-            <tr>
-                <td>
-                    <a href='#' class='classic_link' name='myopac_expand_bookbag'> </a>
-                </td>
-                <td>
-                    <span name='myopac_bookbag_item_count'> </span>
-                    <span>[% l("Items") %]</span>
-                </td>
-                <td>
-                    <span name='myopac_bb_published_no' class='hide_me'>[% l("No") %]</span>
-                    <span name='myopac_bb_published_yes' class='hide_me'>[% l("Yes") %]</span>
-                    <a class='classic_link hide_me'>[% l("(View)") %]</a>
-
-                    <a class='unadorned_link hide_me'><img 
-                        alt="[% l('RSS Feed') %]" border="0"
-                        src="[% ctx.media_prefix %]/images/small-rss.png" title="[% l("ATOM Feed") %]" />
-                    </a>
-                </td>
-                <td>
-                    <a class='classic_link hide_me'>[% l("Hide") %]</a>
-                    <a class='classic_link hide_me'>[% l("Share this Bookbag") %]</a>
-                </td>
-                <td>
-                    <a class='classic_link' href='#'>[% l("Delete") %]</a>
-                </td>
-            </tr>
-        </tbody>
-    </table>
     <div style='width: 99%; text-align: center'>
         <b id='myopac_bookbag_items_name'> </b>
     </div>
-    <div class='hide_me'
-        style='width:100%; text-align:center; font-weight:700; margin-top:10px;'
-        id='myopac_bookbag_no_items'>
-        [% l("The selected bookbag contains no items...") %]
-    </div>
-    <table width='100%' class='hide_me data_grid data_grid_center'
-        id='myopac_bookbag_items_table'>
-        <thead> 
-            <tr>
-                <td>[% l("Title") %]</td>
-                <td>[% l("Authors") %]</td>
-                <td>[% l("Remove this item?") %]</td>
-            </tr> 
-        </thead>
-        <tbody id='myopac_bookbag_items_tbody'>
-            <tr id='myopac_bookbag_items_row'>
-                <td>
-                    <a name='myopac_bookbag_items_title' class='classic_link'> </a>
-                </td>
-                <td name='myopac_bookbag_items_author'></td>
-                <td>
-                    <a name='myopac_bookbag_items_remove' class='classic_link'>[% l("remove") %]</a>
-                </td>    
-            </tr>
-        </tbody>
-    </table>
     <span id='bb_publish_text' class='hide_me'>[% l("Sharing a Bookbag means that the contents of the Bookbag will be visible to others.  To see the public view of a shared Bookbag, click the \"View\" link in the \"Shared\" column of the Bookbag list at the top of this page.") %]</span>
     <span id='myopac_remove_bb_item_confirm' class='hide_me'>
         [% l("Are you sure you wish to remove this bookbag item?") %]
         [% l("Bookbag successfully updated") %]
     </span>
 </div>
-<div style="margin-top: 6px;margin-left:20px;width:250px;padding:5px;" id="mylist_div">
-
-    <!-- new list creation -->
-    <div style="padding-bottom: 7px;">
-        <h2 style="font-weight:normal;">[% l('Create new list') %]</h2>
-        [% l('Enter the name of the new list:') %]<br/>
-        <input type="text" id="mylist_new" />
-    </div>
-
-    <table cellpadding="0" cellspacing="10" border="0">
-        <tr>
-            <td>
-                [% l('Share this list?') %]
-                <a href="#"><img alt="[% l('Sharing Help') %]"
-                    src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
-            </td>
-            <td>
-                <input type="radio" value="0" name="shareList" checked="checked" />[% l('No') %]
-                <br/>
-                <input type="radio" value="1" name="shareList"/>[% l('Yes') %]
-            </td>
-        </tr>
-    </table>
-    <a href="#"><img alt="[% l('Submit') %]" src="[% ctx.media_prefix %]/images/btnSubmit.png"/></a>
-    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-    <a href="#"><img alt="[% l('Cancel') %]" src="[% ctx.media_prefix %]/images/btnCancel.png" /></a>
+<!-- new list creation -->
+<form action="[% ctx.opac_root %]/myopac/list/update" method="POST" id="create_form">
+<div style="padding-bottom: 7px;">
+    <h2>[% l('Create new list') %]</h2><a name="createnewlist"></a>
+    [% l('Enter the name of the new list:') %]<br/>
+    <input type="hidden" name="action" value="create" />
+    <input type="text" name="name" />
 </div>
+
+<table cellpadding="0" cellspacing="10" border="0">
+    <tr>
+        <td>
+            [% l('Share this list?') %]
+            <a href="#"><img alt="[% l('Sharing Help') %]"
+                src="[% ctx.media_prefix %]/images/question-mark.png" /></a>
+        </td>
+        <td>
+            <input type="radio" value="0" name="shared" id="shared_0" checked="checked" /><label for="shared_0">[% l('No') %]</label>
+            <br/>
+            <input type="radio" value="1" name="shared" id="shared_1"/><label for="shared_1">[% l('Yes') %]</label>
+        </td>
+    </tr>
+</table>
+<input type="image" alt="[% l('Submit') %]" src="[% ctx.media_prefix %]/images/btnSubmit.png"/>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="javascript:void(0);"
+    onclick="document.getElementById('create_form').reset(); return false"><img
+    alt="[% l('Cancel') %]"
+    src="[% ctx.media_prefix %]/images/btnCancel.png" /></a>
+</form>
 [% END %]