add Required to copy stat cat editor, add User Summary to patron stat cat editor...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Aug 2010 22:28:34 +0000 (22:28 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Aug 2010 22:28:34 +0000 (22:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17084 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js
Open-ILS/xul/staff_client/server/admin/stat_cat_editor.xhtml

index e2609ea..63c894d 100644 (file)
@@ -56,7 +56,7 @@ use base qw/asset/;
 
 __PACKAGE__->table( 'asset_stat_cat' );
 __PACKAGE__->columns( Primary => qw/id/ );
-__PACKAGE__->columns( Essential => qw/owner name opac_visible/ );
+__PACKAGE__->columns( Essential => qw/owner name opac_visible required/ );
 
 #-------------------------------------------------------------------------------
 package asset::stat_cat_entry;
index fd4d28a..a1413ab 100644 (file)
 <!ENTITY staff.server.admin.stat_cat.name "Enter the name: ">
 <!ENTITY staff.server.admin.stat_cat.owning_library "Owning Library: ">
 <!ENTITY staff.server.admin.stat_cat.opac_visibility "OPAC Visibility: ">
+<!ENTITY staff.server.admin.stat_cat.required "Required: ">
+<!ENTITY staff.server.admin.stat_cat.usr_summary "Show in Summary: ">
 <!ENTITY staff.server.admin.stat_cat.on "On">
 <!ENTITY staff.server.admin.stat_cat.off "Off">
 <!ENTITY staff.server.admin.stat_cat.type "Type: ">
 <!ENTITY staff.server.admin.stat_cat.name.label "Statistical Category Name">
 <!ENTITY staff.server.admin.stat_cat.owning_library.label "Owning Library">
 <!ENTITY staff.server.admin.stat_cat.opac_visibility.label "OPAC Visibility">
+<!ENTITY staff.server.admin.stat_cat.required.label "Required">
 <!ENTITY staff.server.admin.stat_cat.usr_summary.label "Show in Summary">
 <!ENTITY staff.server.admin.stat_cat.entries.label "Entries">
 <!ENTITY staff.server.admin.stat_cat.add_entry "Add Entry">
index 992e150..ae896a7 100644 (file)
@@ -140,10 +140,13 @@ function scDraw( type, cats ) {
     hideMe($('sc_none'));
     unHideMe($('sc_table'));
 
-    if(type == 'actor') 
+    if(type == ACTOR) {
         unHideMe($('sc_usr_summary_label'));
-    else
+        hideMe($('sc_required_label'));
+    } else {
+        unHideMe($('sc_required_label'));
         hideMe($('sc_usr_summary_label'));
+    }
 
     scCounter = 0;
     for( var c in cats ) scInsertCat( tbody, cats[c], type );
@@ -168,13 +171,19 @@ function scInsertCat( tbody, cat, type ) {
     else 
         unHideMe($n(row, 'sc_opac_invisible'));
 
-    if(type == 'actor') {
+    if(type == ACTOR) {
         if(isTrue(cat.usr_summary()))
             unHideMe($n(row, 'sc_usr_summary_on'));
         else 
             unHideMe($n(row, 'sc_usr_summary'));
 
+        hideMe($n(row, 'sc_required_td'));
     } else {
+        if(isTrue(cat.required()))
+            unHideMe($n(row, 'sc_required_on'));
+        else 
+            unHideMe($n(row, 'sc_required'));
+
         hideMe($n(row, 'sc_usr_summary_td'));
     }
 
@@ -270,6 +279,20 @@ function scBuildNew() {
     var libSel = $('sc_owning_lib_selector');
     var typeSel = $('sc_type_selector');
     var type = getSelectorVal(typeSel);
+    switch(type) {
+        case ACTOR:
+            hideMe($('required_td1'));
+            hideMe($('required_td2'));
+            unHideMe($('usr_summary_td1'));
+            unHideMe($('usr_summary_td2'));
+        break;
+        case ASSET:
+            hideMe($('usr_summary_td1'));
+            hideMe($('usr_summary_td2'));
+            unHideMe($('required_td1'));
+            unHideMe($('required_td2'));
+        break;
+    }
     var org_list = PERMS[type].create_stat_cat;
     if(org_list.length == 0) { /* no create perms */
         $('sc_new').disabled = true;
@@ -287,11 +310,21 @@ function scNew() {
     var type = getSelectorVal($('sc_type_selector'));
 
     var visible = 0;
+    var required = 0;
+    var usr_summary = 0;
     if( $('sc_make_opac_visible').checked) visible = 1;
+    if( $('sc_make_required').checked) required = 1;
+    if( $('sc_make_usr_summary').checked) usr_summary = 1;
 
     var cat;
-    if( type == ACTOR ) cat = new actsc();
-    if( type == ASSET ) cat = new asc();
+    if( type == ACTOR ) {
+        cat = new actsc();
+        cat.usr_summary( usr_summary );
+    }
+    if( type == ASSET ) {
+        cat = new asc();
+        cat.required( required );
+    }
 
     cat.opac_visible(visible);
     cat.name(name);
@@ -320,11 +353,16 @@ function scEdit( tbody, type, cat ) {
 
     $n(row, 'sc_edit_name').value = cat.name();
 
-    if(type == 'actor') {
+    if(type == ACTOR) {
         var cb = $n(row, 'sc_edit_usr_summary');
         cb.checked = isTrue(cat.usr_summary()); 
+        hideMe($n(row, 'sc_edit_required_td'));
+        unHideMe($n(row, 'sc_edit_usr_summary_td'));
     } else {
+        var cb = $n(row, 'sc_edit_required');
+        cb.checked = isTrue(cat.required()); 
         hideMe($n(row, 'sc_edit_usr_summary_td'));
+        unHideMe($n(row, 'sc_edit_required_td'));
     }
 
     var name = $n(row, 'sc_edit_cancel');
@@ -382,23 +420,22 @@ function scEditGo( type, cat, row, selector ) {
 
     if(!name) return false;
 
-    var isvisible = false;
-    if( cat.opac_visible() != 0 && cat.opac_visible() != '0' ) isvisible = true;
-
     var usr_summary = $n(row, 'sc_edit_usr_summary').checked;
-
-    if( (name == cat.name()) && 
-        (visible == isvisible) && 
-        (newlib == cat.owner()) && 
-        (usr_summary == isTrue(cat.usr_summary())) )
-            return true; 
+    var required = $n(row, 'sc_edit_required').checked;
 
     cat.name( name );
     cat.owner( newlib );
     cat.entries(null);
     cat.opac_visible(0);
     if( visible ) cat.opac_visible(1);
-    cat.usr_summary( (usr_summary) ? 1 : 0 );
+    switch(type) {
+        case ACTOR:
+            cat.usr_summary( (usr_summary) ? 1 : 0 );
+        break;
+        case ASSET:
+            cat.required( (required) ? 1 : 0 );
+        break;
+    }
 
     var req = new Request( SC_UPDATE.replace(/TYPE/,type), session, cat );
     req.send(true);
index e9f6362..c9c1e09 100644 (file)
                         </td>
                     </tr>
                     <tr>
+                        <td id='required_td1'>&staff.server.admin.stat_cat.required;</td>
+                        <td id='required_td2'>    
+                            <span>&staff.server.admin.stat_cat.on;</span>
+                            <input type='radio' name='required' id='sc_make_required'> </input>
+                            <span>&staff.server.admin.stat_cat.off;</span>
+                            <input type='radio' name='required' checked='checked'> </input>
+                        </td>
+                        <td id='usr_summary_td1'>&staff.server.admin.stat_cat.usr_summary;</td>
+                        <td id='usr_summary_td2'>    
+                            <span>&staff.server.admin.stat_cat.on;</span>
+                            <input type='radio' name='usr_summary' id='sc_make_usr_summary'> </input>
+                            <span>&staff.server.admin.stat_cat.off;</span>
+                            <input type='radio' name='usr_summary' checked='checked'> </input>
+                        </td>
+
+                    </tr>
+                    <tr>
                         <td colspan='4'>
                             <input type='submit' value='&staff.server.admin.stat_cat.create.submit;' onclick='scNew();' id='sc_new'/>
                         </td>
                             <td>&staff.server.admin.stat_cat.name.label;</td>
                             <td>&staff.server.admin.stat_cat.owning_library.label;</td>
                             <td>&staff.server.admin.stat_cat.opac_visibility.label;</td>
+                            <td id='sc_required_label'>&staff.server.admin.stat_cat.required.label;</td>
                             <td id='sc_usr_summary_label'>&staff.server.admin.stat_cat.usr_summary.label;</td>
                             <td>&staff.server.admin.stat_cat.entries.label;</td>
                             <td>&staff.server.admin.stat_cat.add_entry;</td>
                                 <span class='hide_me' name='sc_opac_visible'>&staff.server.admin.stat_cat.on;</span> 
                                 <span class='hide_me' name='sc_opac_invisible'>&staff.server.admin.stat_cat.off;</span> 
                             </td>
+                            <td name='sc_required_td'>
+                                <span class='hide_me' name='sc_required_on'>&staff.server.admin.stat_cat.on;</span> 
+                                <span class='hide_me' name='sc_required'>&staff.server.admin.stat_cat.off;</span> 
+                            </td>
                             <td name='sc_usr_summary_td'>
                                 <span class='hide_me' name='sc_usr_summary_on'>&staff.server.admin.stat_cat.on;</span> 
                                 <span class='hide_me' name='sc_usr_summary'>&staff.server.admin.stat_cat.off;</span> 
                         <input type='radio' name='sc_edit_opac_visibility'> </input>
                     </span>
                 </td>
+                <td name='sc_edit_required_td'>
+                    <input type='checkbox' name='sc_edit_required'/>
+                </td>
                 <td name='sc_edit_usr_summary_td'>
                     <input type='checkbox' name='sc_edit_usr_summary'/>
                 </td>