Tpac: ability to edit name, description of bookbags later
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 16 Nov 2011 14:48:11 +0000 (09:48 -0500)
committerDan Scott <dscott@laurentian.ca>
Wed, 30 Nov 2011 19:17:20 +0000 (14:17 -0500)
You could already name and describe when creating them, and now you can
edit that later.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/templates/opac/myopac/lists.tt2
Open-ILS/web/css/skin/default/opac/style.css

index e97f499..48a07d8 100644 (file)
@@ -1334,6 +1334,16 @@ sub load_myopac_update_password {
     return $self->generic_redirect($url);
 }
 
+sub _update_bookbag_metadata {
+    my ($self, $bookbag) = @_;
+
+    $bookbag->name($self->cgi->param("name"));
+    $bookbag->description($self->cgi->param("description"));
+
+    return 1 if $self->editor->update_container_biblio_record_entry_bucket($bookbag);
+    return 0;
+}
+
 sub load_myopac_bookbags {
     my $self = shift;
     my $e = $self->editor;
@@ -1376,6 +1386,24 @@ sub load_myopac_bookbags {
             return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
         }
 
+        if ($self->cgi->param("action") eq "editmeta") {
+            if (!$self->_update_bookbag_metadata($bookbag))  {
+                $e->rollback;
+                return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+            } else {
+                $e->commit;
+                my $url = $self->ctx->{opac_root} . '/myopac/lists?id=' .
+                    $bookbag->id;
+
+                # Keep it if we've got it
+                if ($self->cgi->param("sort")) {
+                    $url .= ";sort=" . $self->cgi->param("sort");
+                }
+
+                return $self->generic_redirect($url);
+            }
+        }
+
         my $query = $self->_prepare_bookbag_container_query(
             $bookbag->id, $sorter, $modifier
         );
index 76c9e5b..20d9ec1 100644 (file)
         </div>
         [% IF CGI.param("id") == bbag.id %]
         <div class="bookbag-specific">
-            <form method="GET">
-                <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
-                [% INCLUDE "opac/parts/filtersort.tt2"
-                    value=CGI.param('sort') mode='bookbag' %]
-                <input type="hidden" name="id"
-                    value="[% CGI.param('id') | html %]" />
-                <input type="submit" value="[% l('Sort') %]" />
-            </form>
+            <div class="sort">
+                <form method="GET">
+                    <label for="opac.result.sort">[% l("Sort list items by: ") %]</label>
+                    [% INCLUDE "opac/parts/filtersort.tt2"
+                        value=CGI.param('sort') mode='bookbag' %]
+                    <input type="hidden" name="id"
+                        value="[% CGI.param('id') | html %]" />
+                    <input type="submit" value="[% l('Sort') %]" />
+                </form>
+            </div>
+            <div class="meta">
+                <form method="POST">
+                    <input type="hidden" name="id" value="[% bbag.id %]" />
+                    <input type="hidden" name="action" value="editmeta" />
+                    <input type="hidden" name="sort" value="[% CGI.param('sort') | html %]" />
+                    <table id="bbag-name-desc-form">
+                        <tr>
+                            <th>
+                                <label for="bbag-edit-name">[% l('Name:') %]</label>
+                            </th>
+                            <td>
+                                <input name="name" type="text"
+                                    value="[% bbag.name | html %]"
+                                    id="bbag-edit-name" />
+                            </td>
+                            <td rowspan="2" class="saver">
+                                [% l("Save changes to name or description?") %]<br />
+                                <input type="submit" value="[% l('Save') %]" />
+                            </td>
+                        </tr>
+                        <tr>
+                            <th><label for="bbag-edit-description">[% l('Description:') %]</label></th>
+                            <td>
+                                <textarea name="description"
+                                    id="bbag-edit-description">[% bbag.description | html %]</textarea>
+                            </td>
+                        </tr>
+                    </table>
+                </form>
+            </div>
         </div>
+        <br class="clear-both" />
         <form action="[% ctx.opac_root %]/myopac/list/update" method="POST">
         <input type="hidden" name="list" value="[% bbag.id %]" />
         <input type="hidden" name="sort" value="[% CGI.param('sort') | uri %]" />
index e81b9d6..6433166 100644 (file)
@@ -1157,10 +1157,17 @@ a.opac-button {
 h2.bookbag-name { margin-bottom: 0em; padding-bottom: 0em; }
 .bookbag-share .fixed { min-width: 4em; }
 .bookbag-specific { margin-left: 1em; }
+.bookbag-specific div.sort { float: left; width: 45%; text-align: left; }
+.bookbag-specific div.meta { float: right; width: 54%; text-align: right; }
+#bbag-name-desc-form tr th { vertical-align: middle; }
+#bbag-name-desc-form .saver { vertical-align: middle; text-align: center; }
 .bookbag-description {
     padding-top: 0em;
     font-style: italic;
 }
+#bbag-edit-description { width: 20em; }
+#bbag-edit-name { width: 20em; }
+textarea { font-family: sans-serif; }
 table.bookbag-specific {
     border-right: 1px solid #999;
     border-bottom: 1px solid #666;