1 var RETRIEVE_CL = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all';
2 var CREATE_CL = 'open-ils.circ:open-ils.circ.copy_location.create';
3 var UPDATE_CL = 'open-ils.circ:open-ils.circ.copy_location.update';
4 var DELETE_CL = 'open-ils.circ:open-ils.circ.copy_location.delete';
11 'CREATE_COPY_LOCATION',
12 'UPDATE_COPY_LOCATION',
13 'DELETE_COPY_LOCATION',
16 function clEditorInit() {
18 session = cgi.param('ses');
19 if(!session) throw "User session is not defined!";
21 $('user').appendChild(text(USER.usrname()));
22 YES = $('yes').innerHTML;
23 NO = $('no').innerHTML;
24 setTimeout( function() {
25 fetchHighestPermOrgs( SESSION, USER.id(), myPerms ); clGo(); }, 20 );
29 function clHoldMsg() {
30 alert($('cl_hold_msg').innerHTML);
34 var req = new Request(RETRIEVE_CL, SESSION, USER.home_ou());
42 var cls = r.getResultObject();
43 if(checkILSEvent(cls)) throw cls;
45 var tbody = $('cl_tbody');
47 rowTemplate = tbody.removeChild($('cl_row'));
48 removeChildren(tbody);
50 cls = cls.sort( function(a,b) {
51 if( a.name().toLowerCase() > b.name().toLowerCase() ) return 1;
52 if( a.name().toLowerCase() < b.name().toLowerCase() ) return -1;
58 var row = rowTemplate.cloneNode(true);
59 clBuildRow( tbody, row, cl );
60 tbody.appendChild(row);
64 function clBuildRow( tbody, row, cl ) {
65 $n( row, 'cl_name').appendChild(text(cl.name()));
66 $n( row, 'cl_owner').appendChild(text(findOrgUnit(cl.owning_lib()).name()));
67 $n( row, 'cl_holdable').appendChild(text( (cl.holdable()) ? YES : NO ) );
68 $n( row, 'cl_visible').appendChild(text( (cl.opac_visible()) ? YES : NO ) );
69 $n( row, 'cl_circulate').appendChild(text( (cl.circulate()) ? YES : NO ) );
70 $n( row, 'cl_edit').onclick = function() { clEdit( cl, tbody, row ); };
73 function clEdit( cl, tbody, row ) {
75 cleanTbody(tbody, 'edit');
76 var r = $('cl_new').cloneNode(true);
77 r.setAttribute('edit','1');
79 var name = $n(r, 'cl_new_name');
80 name.setAttribute('size', cl.name().length + 3);
81 name.value = cl.name();
83 $n(r, 'cl_new_owner').appendChild(text(findOrgUnit(cl.owning_lib()).name()));
85 var yhold = $n( $n(r,'cl_new_holdable_yes'), 'cl_new_holdable');
86 var nhold = $n( $n(r,'cl_new_holdable_no'), 'cl_new_holdable');
87 var yvis = $n( $n(r,'cl_new_visible_yes'), 'cl_new_visible');
88 var nvis = $n( $n(r,'cl_new_visible_no'), 'cl_new_visible');
89 var ycirc = $n( $n(r,'cl_new_circulate_yes'), 'cl_new_circulate');
90 var ncirc = $n( $n(r,'cl_new_circulate_no'), 'cl_new_circulate');
92 if(cl.holdable()) yhold.checked = true;
93 else nhold.checked = true;
94 if(cl.opac_visible()) yvis.checked = true;
95 else nvis.checked = true;
96 if(cl.circulate()) ycirc.checked = true;
97 else ncirc.checked = true;
99 $n(r, 'cl_new_cancel').onclick = function(){cleanTbody(tbody,'edit');}
100 $n(r, 'cl_new_commit').onclick = function(){clEditCommit( tbody, cl ); }
102 insRow(tbody, row, r);
107 function clEditCommit( tbody, cl ) {
108 alert("committing: " + cl.id());
109 cleanTbody(tbody,'edit');