return $evt if $evt;
$logger->activity( "User " . $staff->id .
- " creating a new continer for user " . $bucket->owner );
+ " creating a new container for user " . $bucket->owner );
$bucket->clear_id;
$logger->debug("Creating new container object: " . Dumper($bucket));
return $evt if $evt;
$logger->activity( "User " . $staff->id .
- " deleting continer $bucketid for user " . $bucket->owner );
+ " deleting container $bucketid for user " . $bucket->owner );
my $method = $types{$class} . ".delete";
my $resp = $apputils->simplereq( $svc, $method, $bucketid );
return $evt if $evt;
$logger->activity( "User " . $staff->id .
- " creating continer item " . Dumper($item) . " for user " . $bucket->owner );
+ " creating container item for bucket " . $item->bucket . " and user " . $bucket->owner );
my $method = $types{$class} . "_item.create";
my $resp = $apputils->simplereq( $svc, $method, $item );
return $apputils->simplereq( $svc, $meth, $containerId );
}
+__PACKAGE__->register_method(
+ method => 'container_update',
+ api_name => 'open-ils.actor.container.update',
+ signature => q/
+ Updates the given container item.
+ @param authtoken The login session key
+ @param class The container class
+ @param container The container item
+ @return true on success, 0 on no update, Event on error
+ /
+);
+
+sub container_update {
+ my( $self, $conn, $authtoken, $class, $container ) = @_;
+
+ my( $staff, $target, $dbcontainer, $evt);
+
+ ( $dbcontainer, $evt ) = $apputils->fetch_container($container->id, $class);
+ return $evt if $evt;
+
+ ( $staff, $target, $evt ) = $apputils->checkses_requestor(
+ $authtoken, $dbcontainer->owner, 'UPDATE_CONTAINER' );
+ return $evt if $evt;
+
+ $logger->activity("User " . $staff->id . " updating container ". $container->id);
+
+ my $meth = $types{$class}.".update";
+ return $U->storagereq($meth, $container);
+}
+
+
1;
oils_event_die($resp);
printl("Created new $type bucket with id $resp");
$containers{$type} = $resp;
+
+ $bucket->id($resp);
+ $bucket->pub(1);
+
+ $resp = simplereq($ACTOR,
+ 'open-ils.actor.container.update', $authtoken, $type, $bucket );
+ oils_event_die($resp);
+ printl("Updated container type $type");
}
}
}
+
sub containers_delete {
for my $type (keys %containers) {
my $id = $containers{$type};
var DELETE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.delete';
var FLESH_CONTAINER = 'open-ils.actor:open-ils.actor.container.flesh';
var FLESH_PUBLIC_CONTAINER = 'open-ils.actor:open-ils.actor.container.public.flesh';
+var UPDATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.update';
var FETCH_COPY = 'open-ils.search:open-ils.search.asset.copy.retrieve';
var CHECK_HOLD_POSSIBLE = 'open-ils.circ:open-ils.circ.title_hold.is_possible';
var FETCH_BIBLIO_NOTES = 'open-ils.circ:open-ils.circ.biblio_notes.public.batch.retrieve';
return containerDoRequest( req, callback, args );
}
+function containerUpdate( container, callback, args ) {
+ var req = new Request(UPDATE_CONTAINER, G.user.session, 'biblio', container);
+ return containerDoRequest(req, callback, args);
+}
+
function containerCreateItem( containerId, target, callback, args ) {
var item = new cbrebi();
link.setAttribute('target', '_blank' );
unHideMe(link);
+ link = $n(row, 'myopac_bb_make_unpublished');
+ link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'", true);');
+ unHideMe(link);
+
} else {
unHideMe($n(row, 'myopac_bb_published_no'));
+ var link = $n(row, 'myopac_bb_make_published');
+ link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'");');
+ unHideMe(link);
}
tbody.appendChild(row);
else unHideMe($('myopac_bookbag_table'));
}
+function myOPACMakeBBPublished(bbid, hideme) {
+
+ var bb = fleshedContainers[bbid];
+
+ if(hideme) {
+ if(!confirm($('myopac_make_unpublished_confirm').innerHTML)) return;
+ bb.pub(0);
+ } else {
+ if(!confirm($('myopac_make_published_confirm').innerHTML)) return;
+ bb.pub(1);
+ }
+
+ var result = containerUpdate(bb);
+
+ var code = checkILSEvent(result);
+ if(code) { alertILSEvent(code); return; }
+
+ if(result) alert($('myopac_bb_update_success').innerHTML);
+ myOPACShowBookbags(true);
+}
+
+
+
function myOPACDeleteBookbag(id) {
if( confirm( $('myopac_delete_bookbag_warn').innerHTML ) ) {
var result = containerDelete(id);
<br/>
<table width='100%' class='data_grid data_grid_center hide_me' id='myopac_bookbag_table'>
<thead>
- <tr><td>Name</td><td># Items</td><td>Published</td><td>Delete this bookbag?</td></tr>
+ <tr><td>Name</td><td># Items</td><td>Shared</td><td>Share / Hide</td><td>Delete this bookbag?</td></tr>
</thead>
<tbody id='myopac_bookbag_tbody'>
<tr id='myopac_bookbag_tr'>
<span name='myopac_bb_published_yes' class='hide_me'>Yes</span>
<a name='myopac_bb_published_view' class='classic_link hide_me'>(View)</a>
</td>
+
+ <td>
+ <a name='myopac_bb_make_unpublished' class='classic_link hide_me'>Hide</a>
+ <a name='myopac_bb_make_published' class='classic_link hide_me'>Share</a>
+ </td>
+
<td>
<a class='classic_link' href='javascript:void(0);' name='myopac_container_delete'>Delete</a>
</td>
</tr>
<tr>
<td>
- <span style='padding: 5px;'>Publish this Bookbag</span>
+ <span style='padding: 5px;'>Share this Bookbag</span>
<a class='classic_link' href='javascript:alert($("bb_publish_text").innerHTML);'>(<b>??</b>)</a>
<span>Yes</span> <input type='radio' name='bb_public' id='bb_public_yes'/>
<span>No</span> <input type='radio' name='bb_public' id='bb_public_no' checked='checked'/>
<!--</div>-->
<span id='bb_publish_text' class='hide_me'>
- Publishing a Bookbag means that the contents of the Bookbag will be visible to others.
- To see the public view of a published Bookbag, click the "View" link in the
- "Published" column of the Bookbag list at the top of this page.
+ 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'>
Are you sure you wish to remove this bookbag item?
</span>
+ <span id='myopac_make_published_confirm' class='hide_me'>
+ Sharing this bookbag will allow the contents
+ of the bookback to be seen by others.
+ Are you sure you wish to share this bookbag?
+ </span>
+
+ <span id='myopac_make_unpublished_confirm' class='hide_me'>
+ Are you sure you wish to hide this bookbag?
+ </span>
+
+ <span id='myopac_bb_update_success'>
+ The Bookbag was successfully updated.
+ </span>
+
</div>