Changeset 9436

Show
Ignore:
Timestamp:
04/22/08 22:06:38 (3 weeks ago)
Author:
erickson
Message:

Merged revisions 9425,9428,9430-9435 via svnmerge from
svn://svn.open-ils.org/ILS/trunk

........

r9425 | erickson | 2008-04-22 10:36:27 -0400 (Tue, 22 Apr 2008) | 1 line


default estimated hit count to 0 to protect against null counts in the case of a search timeout/failure

........

r9428 | erickson | 2008-04-22 14:01:05 -0400 (Tue, 22 Apr 2008) | 1 line


added support for defining pivot data and label columns

........

r9430 | erickson | 2008-04-22 14:32:12 -0400 (Tue, 22 Apr 2008) | 1 line


added support for taking pivot info from the report def

........

r9431 | miker | 2008-04-22 21:41:36 -0400 (Tue, 22 Apr 2008) | 1 line


move the translation widget out to openils.widget

........

r9432 | miker | 2008-04-22 21:42:25 -0400 (Tue, 22 Apr 2008) | 1 line


move the translation widget out to openils.widget

........

r9433 | miker | 2008-04-22 21:42:49 -0400 (Tue, 22 Apr 2008) | 1 line


OO-ify openils.User

........

r9434 | miker | 2008-04-22 21:45:21 -0400 (Tue, 22 Apr 2008) | 1 line


typo in name

........

r9435 | miker | 2008-04-22 22:03:48 -0400 (Tue, 22 Apr 2008) | 1 line


back-compat global population

........

Location:
branches/acq-experiment
Files:
15 modified
1 copied

Legend:

Unmodified
Added
Removed
  • branches/acq-experiment

    • Property svnmerge-integrated changed from /trunk:1-9414 to /trunk:1-9435
  • branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

    r9385 r9436  
    774774    my $all_results = []; 
    775775    my $page; # current superpage 
    776     my $est_hit_count; 
     776    my $est_hit_count = 0; 
    777777 
    778778    for($page = 0; $page < $SEARCH_PAGES; $page++) { 
  • branches/acq-experiment/Open-ILS/src/reporter/clark-kent.pl

    r9385 r9436  
    1515use OpenSRF::Utils qw/:daemon/; 
    1616use OpenSRF::Utils::JSON; 
    17 #use OpenSRF::Utils::Logger qw/:level/; 
     17use OpenSRF::Utils::Logger qw/$logger/; 
    1818use OpenSRF::System; 
    1919use OpenSRF::AppSession; 
     
    134134 
    135135        my $b = OpenILS::Reporter::SQLBuilder->new; 
    136         $b->register_params( OpenSRF::Utils::JSON->JSON2perl( $r->{report}->{data} ) ); 
     136        my $report_data = OpenSRF::Utils::JSON->JSON2perl( $r->{report}->{data} ); 
     137        $b->register_params( $report_data ); 
    137138 
    138139        $r->{resultset} = $b->parse_report( OpenSRF::Utils::JSON->JSON2perl( $r->{report}->{template}->{data} ) ); 
     140        $r->{resultset}->set_pivot_data($report_data->{__pivot_data}) if $report_data->{__pivot_data}; 
     141        $r->{resultset}->set_pivot_label($report_data->{__pivot_label}) if $report_data->{__pivot_label}; 
     142        $r->{resultset}->set_pivot_default($report_data->{__pivot_default}) if $report_data->{__pivot_default}; 
    139143        $r->{resultset}->relative_time($r->{run_time}); 
    140144        push @reports, $r; 
     
    162166                SQL 
    163167 
     168            $logger->debug('Report SQL: ' . $r->{resultset}->toSQL); 
    164169                $sth = $dbh->prepare($r->{resultset}->toSQL); 
    165170 
  • branches/acq-experiment/Open-ILS/web/conify/global/actor/org_unit.html

    r9378 r9436  
    223223                                                                                </script> 
    224224                                                                        </span> 
    225                                                                         <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_ou" field="name"></span> 
     225                                                                        <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_ou" field="name"></span> 
    226226                                                                </td> 
    227227                                                        </tr> 
  • branches/acq-experiment/Open-ILS/web/conify/global/actor/org_unit.js

    r9373 r9436  
    1717 
    1818dojo.require('fieldmapper.dojoData'); 
    19 dojo.require('openils.I18N'); 
     19dojo.require('openils.widget.TranslatorPopup'); 
    2020dojo.require('dojo.parser'); 
    2121dojo.require('dojo.data.ItemFileWriteStore'); 
  • branches/acq-experiment/Open-ILS/web/conify/global/actor/org_unit_type.html

    r9378 r9436  
    191191                                                                                </script> 
    192192                                                                        </span> 
    193                                                                         <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_type" field="name"></span> 
     193                                                                        <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_type" field="name"></span> 
    194194                                                                </td> 
    195195                                                        </tr> 
     
    204204                                                                                </script> 
    205205                                                                        </span> 
    206                                                                         <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_type" field="opac_label"></span> 
     206                                                                        <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_type" field="opac_label"></span> 
    207207                                                                </td> 
    208208                                                        </tr> 
  • branches/acq-experiment/Open-ILS/web/conify/global/actor/org_unit_type.js

    r9371 r9436  
    1717 
    1818dojo.require('fieldmapper.dojoData'); 
    19 dojo.require('openils.I18N'); 
     19dojo.require('openils.widget.TranslatorPopup'); 
    2020dojo.require('dojo.parser'); 
    2121dojo.require('dojo.data.ItemFileWriteStore'); 
  • branches/acq-experiment/Open-ILS/web/conify/global/config/copy_status.html

    r9377 r9436  
    189189                                                                                                setTimeout( 
    190190                                                                                                        'dojo.query(".status_grid_trans_cell_' + row + '").'+ 
    191                                                                                                                 'instantiate(openils.I18N.translationWidget,{field:"name",'+ 
     191                                                                                                                'instantiate(openils.widget.TranslatorPopup,{field:"name",'+ 
    192192                                                                                                                'targetObject:"window.status_rows['+row+']",unique:"' + row + '"});'+ 
    193193                                                                                                                'status_grid.rowHeightChanged('+row+')', 
  • branches/acq-experiment/Open-ILS/web/conify/global/config/copy_status.js

    r9378 r9436  
    1717 
    1818dojo.require('fieldmapper.dojoData'); 
    19 dojo.require('openils.I18N'); 
     19dojo.require('openils.widget.TranslatorPopup'); 
    2020dojo.require('dojo.parser'); 
    2121dojo.require('dojo.string'); 
  • branches/acq-experiment/Open-ILS/web/conify/global/permission/grp_tree.html

    r9378 r9436  
    267267                                                                                </script> 
    268268                                                                        </span> 
    269                                                                         <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_group" field="name"></span> 
     269                                                                        <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_group" field="name"></span> 
    270270                                                                </td> 
    271271                                                        </tr> 
     
    281281                                                                                ></textarea> 
    282282                                                                        </span> 
    283                                                                         <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_group" field="description"></span> 
     283                                                                        <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_group" field="description"></span> 
    284284                                                                </td> 
    285285                                                        </tr> 
  • branches/acq-experiment/Open-ILS/web/conify/global/permission/grp_tree.js

    r9374 r9436  
    1717 
    1818dojo.require('fieldmapper.dojoData'); 
    19 dojo.require('openils.I18N'); 
     19dojo.require('openils.widget.TranslatorPopup'); 
    2020dojo.require('dojo.parser'); 
    2121dojo.require('dojo.data.ItemFileWriteStore'); 
  • branches/acq-experiment/Open-ILS/web/js/dojo/openils/I18N.js

    r9376 r9436  
    6767        } 
    6868 
    69 //---------------------------------------------------------------- 
    70  
    71     dojo.declare( 
    72                 'openils.I18N.translationWidget', 
    73                 [dijit._Widget, dijit._Templated], 
    74                 { 
    75  
    76                         templateString : "<span dojoAttachPoint='node'><div dojoType='dijit.form.DropDownButton'><span>Translate</span><div id='${field}_translation_${unique}' dojoType='dijit.TooltipDialog' onOpen='openils.I18N.translationWidget.renderTranslationPopup(${targetObject}, \"${field}\", \"${unique}\")' ><div dojoType='dijit.layout.ContentPane'><table><tbody class='translation_tbody_template' style='display:none; visiblity:hidden;'><tr><th>Locale</th><td class='locale'><div class='locale_combobox'></div></td><th>Translation</th><td class='translation'><div class='translation_textbox'></div></td><td><button class='create_button' style='display:none; visiblity:hidden;'>Create</button><button class='update_button' style='display:none; visiblity:hidden;'>Update</button><button class='delete_button' style='display:none; visiblity:hidden;'>Remove</button></td></tr></tbody><tbody class='translation_tbody'></tbody></table></div></div></div></span>", 
    77  
    78                         widgetsInTemplate: true, 
    79                         field : "", 
    80                         targetObject : "", 
    81                         unique : "" 
    82                 } 
    83         ); 
    84  
    85         openils.I18N.translationWidget.renderTranslationPopup = function (obj, field, num) { 
    86                 var node = dojo.byId(field + '_translation_' + num); 
    87  
    88                 var trans_list = openils.I18N.getTranslations( obj, field ); 
    89  
    90                 var trans_template = dojo.query('.translation_tbody_template', node)[0]; 
    91                 var trans_tbody = dojo.query('.translation_tbody', node)[0]; 
    92  
    93                 // Empty it 
    94                 while (trans_tbody.lastChild) trans_tbody.removeChild( trans_tbody.lastChild ); 
    95  
    96                 for (var i in trans_list) { 
    97                         if (!trans_list[i]) continue; 
    98  
    99                         var trans_obj = trans_list[i]; 
    100                         var trans_id = trans_obj.id(); 
    101  
    102                         var trans_row = dojo.query('tr',trans_template)[0].cloneNode(true); 
    103                         trans_row.id = 'translation_row_' + trans_id; 
    104  
    105                         var old_dijit = dijit.byId('locale_' + trans_id); 
    106                         if (old_dijit) old_dijit.destroy(); 
    107  
    108                         old_dijit = dijit.byId('translation_' + trans_id); 
    109                         if (old_dijit) old_dijit.destroy(); 
    110  
    111                         dojo.query('.locale_combobox',trans_row).instantiate( 
    112                                 dijit.form.ComboBox, 
    113                                 { store:openils.I18N.localeStore, 
    114                                   searchAttr:'locale', 
    115                                   lowercase:true, 
    116                                   required:true, 
    117                                   id:'locale_' + trans_id, 
    118                                   value: trans_obj.translation(), 
    119                                   invalidMessage:'Specify locale as {languageCode}_{countryCode}, like en_us', 
    120                                   regExp:'[a-z_]+' 
    121                                 } 
    122                         ); 
    123  
    124                         dojo.query('.translation_textbox',trans_row).instantiate( 
    125                                 dijit.form.TextBox, 
    126                                 { required : true, 
    127                                   id:'translation_' + trans_id, 
    128                                   value: trans_obj.string() 
    129                                 } 
    130                         ); 
    131  
    132                         dojo.query('.update_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( 
    133                                 dijit.form.Button, 
    134                                 { onClick : 
    135                                         (function (trans_id, obj, field) { 
    136                                                 return function () { openils.I18N.translationWidget.updateTranslation(trans_id, obj, field, num) } 
    137                                         })(trans_id, obj, field)  
    138                                 } 
    139                         ); 
    140  
    141                         dojo.query('.delete_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( 
    142                                 dijit.form.Button, 
    143                                 { onClick : 
    144                                         (function (trans_id, obj, field) { 
    145                                                 return function () { openils.I18N.translationWidget.removeTranslation(trans_id, obj, field, num) } 
    146                                         })(trans_id, obj, field)  
    147                                 } 
    148                         ); 
    149  
    150                         trans_tbody.appendChild( trans_row ); 
    151                 } 
    152  
    153                 old_dijit = dijit.byId('i18n_new_locale_' + obj.classname + '.' + field + num); 
    154                 if (old_dijit) old_dijit.destroy(); 
    155  
    156                 old_dijit = dijit.byId('i18n_new_translation_' + obj.classname + '.' + field + num); 
    157                 if (old_dijit) old_dijit.destroy(); 
    158  
    159                 trans_row = dojo.query('tr',trans_template)[0].cloneNode(true); 
    160  
    161                 dojo.query('.locale_combobox',trans_row).instantiate( 
    162                         dijit.form.ComboBox, 
    163                         { store:openils.I18N.localeStore, 
    164                           searchAttr:'locale', 
    165                           id:'i18n_new_locale_' + obj.classname + '.' + field + num, 
    166                           lowercase:true, 
    167                           required:true, 
    168                           invalidMessage:'Specify locale as {languageCode}_{countryCode}, like en_us', 
    169                           regExp:'[a-z_]+' 
    170                         } 
    171                 ); 
    172  
    173                 dojo.query('.translation_textbox',trans_row).addClass('new_translation').instantiate( 
    174                         dijit.form.TextBox, 
    175                         { required : true, 
    176                           id:'i18n_new_translation_' + obj.classname + '.' + field + num 
    177                         } 
    178                 ); 
    179  
    180                 dojo.query('.create_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( 
    181                         dijit.form.Button, 
    182                         { onClick : function () { openils.I18N.translationWidget.createTranslation( obj, field, num) } } 
    183                 ); 
    184  
    185                 trans_tbody.appendChild( trans_row ); 
    186         } 
    187  
    188         openils.I18N.translationWidget.updateTranslation = function (trans_id, obj, field, num) { 
    189                 return openils.I18N.translationWidget.changeTranslation('update', trans_id, obj, field, num); 
    190         } 
    191          
    192         openils.I18N.translationWidget.removeTranslation = function (trans_id, obj, field, num) { 
    193                 return openils.I18N.translationWidget.changeTranslation('delete', trans_id, obj, field, num); 
    194         } 
    195          
    196         openils.I18N.translationWidget.changeTranslation = function (method, trans_id, obj, field, num) { 
    197          
    198                 var trans_obj = new i18n().fromHash({ 
    199                         ischanged : method == 'update' ? 1 : 0, 
    200                         isdeleted : method == 'delete' ? 1 : 0, 
    201                         id : trans_id, 
    202                         fq_field : obj.classname + '.' + field, 
    203                         identity_value : obj.id(), 
    204                         translation : dijit.byId('locale_' + trans_id).getValue(), 
    205                         string : dijit.byId('translation_' + trans_id).getValue() 
    206                 }); 
    207          
    208                 openils.I18N.translationWidget.writeTranslation(method, trans_obj, obj, field, num); 
    209         } 
    210          
    211         openils.I18N.translationWidget.createTranslation = function (obj, field, num) { 
    212                 var node = dojo.byId(field + '_translation_' + num); 
    213          
    214                 var trans_obj = new i18n().fromHash({ 
    215                         isnew : 1, 
    216                         fq_field : obj.classname + '.' + field, 
    217                         identity_value : obj.id(), 
    218                         translation : dijit.byId('i18n_new_locale_' + obj.classname + '.' + field + num).getValue(), 
    219                         string : dijit.byId('i18n_new_translation_' + obj.classname + '.' + field + num).getValue() 
    220                 }); 
    221          
    222                 openils.I18N.translationWidget.writeTranslation('create', trans_obj, obj, field, num); 
    223         } 
    224          
    225         openils.I18N.translationWidget.writeTranslation = function (method, trans_obj, obj, field, num) { 
    226          
    227                 OpenSRF.CachedClientSession('open-ils.permacrud').request({ 
    228                         method : 'open-ils.permacrud.' + method + '.i18n', 
    229                         timeout: 10, 
    230                         params : [ ses, trans_obj ], 
    231                         onerror: function (r) { 
    232                                 //highlighter.editor_pane.red.play(); 
    233                                 if (status_update) status_update( 'Problem saving translation for ' + obj[field]() ); 
    234                         }, 
    235                         oncomplete : function (r) { 
    236                                 var res = r.recv(); 
    237                                 if ( res && res.content() ) { 
    238                                         //highlighter.editor_pane.green.play(); 
    239                                         if (status_update) status_update( 'Saved changes to translation for ' + obj[field]() ); 
    240          
    241                                         if (method == 'delete') { 
    242                                                 dojo.NodeList(dojo.byId('translation_row_' + trans_obj.id())).orphan(); 
    243                                         } else if (method == 'create') { 
    244                                                 var node = dojo.byId(field + '_translation_' + num); 
    245                                                 dijit.byId('i18n_new_locale_' + obj.classname + '.' + field + num).setValue(null); 
    246                                                 dijit.byId('i18n_new_translation_' + obj.classname + '.' + field + num).setValue(null); 
    247                                                 openils.I18N.translationWidget.renderTranslationPopup(obj, field, num); 
    248                                         } 
    249          
    250                                 } else { 
    251                                         //highlighter.editor_pane.red.play(); 
    252                                         if (status_update) status_update( 'Problem saving translation for ' + obj[field]() ); 
    253                                 } 
    254                         }, 
    255                 }).send(); 
    256         } 
    257  
    25869} 
    25970 
  • branches/acq-experiment/Open-ILS/web/js/dojo/openils/User.js

    r9403 r9436  
    1919    dojo._hasResource["openils.User"] = true; 
    2020    dojo.provide("openils.User"); 
     21    dojo.require("DojoSRF"); 
    2122    dojo.require('openils.Event'); 
    2223    dojo.require('fieldmapper.Fieldmapper'); 
    2324 
    24     dojo.declare('openils.User', null, {}); 
    25  
    26     openils.User.user = null; 
    27     openils.User.authtoken = null; 
    28     openils.User.authtime = null; 
    29  
    30     var ses = new OpenSRF.ClientSession('open-ils.auth'); 
    31  
    32     openils.User.getBySession = function(onComplete) { 
    33         var req = ses.request('open-ils.auth.session.retrieve', openils.User.authtoken); 
    34         if(onComplete) { 
     25    dojo.declare('openils.User', null, { 
     26 
     27        user : null, 
     28        username : null, 
     29        passwd : null, 
     30        login_type : 'opac', 
     31        location : null, 
     32        authtoken : null, 
     33        authtime : null, 
     34     
     35        constructor : function ( kwargs ) { 
     36            this.id = kwargs.id; 
     37            this.user = kwargs.user; 
     38            this.passwd = kwargs.passwd; 
     39            this.authtoken = kwargs.authtoken || openils.User.authtoken; 
     40            this.authtime = kwargs.authtime || openils.User.authtime; 
     41            this.login_type = kwargs.login_type; 
     42            this.location = kwargs.location; 
     43 
     44            if (this.authtoken) this.getBySession(); 
     45            else if (this.id && this.authtoken) this.user = this.getById( this.id ); 
     46            else if (kwargs.login) this.login(); 
     47 
     48        }, 
     49 
     50        getBySession : function(onComplete) { 
     51            var _u = this; 
     52            var req = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.session.retrieve', _u.authtoken); 
     53            if(onComplete) { 
     54                req.oncomplete = function(r) { 
     55                    var user = r.recv().content(); 
     56                    _u.user = user; 
     57                                        if (!openils.User.user) !openils.User.user = _u.user; 
     58                    if(onComplete) 
     59                        onComplete(user); 
     60                } 
     61                req.send(); 
     62            } else { 
     63                req.timeout = 10; 
     64                req.send(); 
     65                return _u.user = req.recv().content(); 
     66            } 
     67        }, 
     68     
     69        getById : function(id, onComplete) { 
     70            var req = OpenSRF.CachedClientSession('open-ils.actor').request('open-ils.actor.user.retrieve', this.authtoken, id); 
     71            if(onComplete) { 
     72                req.oncomplete = function(r) { 
     73                    var user = r.recv().content(); 
     74                    onComplete(user); 
     75                } 
     76                req.send(); 
     77            } else { 
     78                req.timeout = 10; 
     79                req.send(); 
     80                return req.recv().content(); 
     81            } 
     82        }, 
     83     
     84     
     85        /** 
     86         * Logs in, sets the authtoken/authtime vars, and fetches the logged in user 
     87         */ 
     88        login : function(args, onComplete) { 
     89            var _u = this; 
     90 
     91            if (!args) args = {}; 
     92            if (!args.username) args.username = _u.username; 
     93            if (!args.passwd) args.passwd = _u.passwd; 
     94            if (!args.type) args.type = _u.login_type; 
     95            if (!args.location) args.location = _u.location; 
     96 
     97            var initReq = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.authenticate.init', args.username); 
     98     
     99            initReq.oncomplete = function(r) { 
     100                var seed = r.recv().content();  
     101                alert(seed); 
     102                var loginInfo = { 
     103                    password : hex_md5(seed + hex_md5(args.passwd)),  
     104                    type : args.type, 
     105                    org : args.location, 
     106                }; 
     107     
     108                var authReq = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.authenticate.complete', loginInfo); 
     109                authReq.oncomplete = function(rr) { 
     110                    var data = rr.recv().content(); 
     111                    _u.authtoken = data.payload.authtoken; 
     112                                        if (!openils.User.authtoken) !openils.User.authtoken = _u.authtoken; 
     113                    _u.authtime = data.payload.authtime; 
     114                                        if (!openils.User.authtime) !openils.User.authtime = _u.authtime; 
     115                    _u.getBySession(onComplete); 
     116                } 
     117                authReq.send(); 
     118            } 
     119     
     120            initReq.send(); 
     121        }, 
     122     
     123        /** 
     124         * Returns a list of the "highest" org units where the user 
     125         * has the given permission. 
     126         */ 
     127        getPermOrgList : function(perm, onload) { 
     128     
     129            var req = OpenSRF.CachedClientSession('open-ils.actor').request( 
     130                'open-ils.actor.user.work_perm.highest_org_set', 
     131                this.authtoken, perm); 
     132     
    35133            req.oncomplete = function(r) { 
    36                 var user = r.recv().content(); 
    37                 openils.User.user = user; 
    38                 if(onComplete) 
    39                     onComplete(user); 
    40             } 
     134                org_list = r.recv().content(); 
     135                onload(org_list); 
     136            } 
     137     
    41138            req.send(); 
    42         } else { 
    43             req.timeout = 10; 
    44             req.send(); 
    45             return openils.User.user = req.recv().content(); 
     139        }, 
     140     
     141        /** 
     142         * Builds a dijit.Tree using the orgs where the user has the requested permission 
     143         * @param perm The permission to check 
     144         * @param domId The DOM node where the tree widget should live 
     145         * @param onClick If defined, this will be connected to the tree widget for 
     146         * onClick events 
     147         */ 
     148        buildPermOrgTreePicker : function(perm, domId, onClick) { 
     149 
     150            dojo.require('dojo.data.ItemFileReadStore'); 
     151            dojo.require('dijit.Tree');