Preparing to branch off of user/vlewis/lp1437122-not_possible_to_set_workstation_preferences
Signed-off-by: Victoria Lewis <vlewis@catalystitservices.com>
modified: ../../../../../../src/templates/opac/parts/org_selector.tt2
modified: ../../../../../../src/templates/staff/admin/workstation/index.tt2
new file: ../../../../../../src/templates/staff/admin/workstation/t_search_prefs.tt2
modified: ../../../../../../src/templates/staff/admin/workstation/t_splash.tt2
modified: ../admin/workstation/app.js
BLOCK build_org_selector;
node_stack = [{org => org_unit || ctx.aouct_tree || ctx.aou_tree}];
- inherited_vis = ctx.get_cgf('opac.org_unit.non_inherited_visibility').enabled == 'f';
+ inherited_vis = ctx.get_cgf('opac.org_unit.non_inherited_visibility').enabled == 'f'; #get configuration 'opac.org_unit's option for non-inherited visibility and disable it(f)
IF !name;
- name = loc_name;
+ name = loc_name; #If name doesn't exist, set it to loc_name - Defined in misc_util.tt2 get_library
END;
IF !value;
- value = loc_value;
+ value = loc_value;#If value doesn't exist, set it to loc_value - Defined in misc_util.tt2 get_library
END;
# if the selected org unit is out of hiding scope,
name='[% name %]'>
[%-
WHILE node_stack.size > 0;
- node = node_stack.pop();
- org_unit = node.org;
- loc_grp = node.loc_grp;
- ou_id = org_unit.id;
+ node = node_stack.pop(); #node becomes the popped node stack
+ org_unit = node.org; #org_unit becomes node's org
+ loc_grp = node.loc_grp; #loc_grp(location) becomes the node_stack's array?
+ ou_id = org_unit.id; #ou_id shorthand for org_unit.id
css_class = '';
- disabled = '';
+ disabled = ''; #clear css_class, disabled, and selected
selected = '';
- visible = org_unit.opac_visible == 't';
+ visible = org_unit.opac_visible == 't'; #enable visibility for org_unit's opac_visible option
# org and all children are invisible.
NEXT IF !visible AND inherited_vis AND !ctx.is_staff;
END;
# add the child org units
+ # Allows child org_units to be displayed
FOR child IN org_unit.children.reverse;
node_stack.push({org => child});
END;
SET pad_depth = pad_depth + 1 IF loc_grp;
# determine the depth by calculating the distance from the root
+ # This gives the Search Library dropdown its child-parent padding
porg = ctx.get_aou(org_unit.parent_ou);
WHILE porg;
SET pad_depth = pad_depth + 1 IF porg.opac_visible == 't' OR ctx.is_staff;
porg = ctx.get_aou(porg.parent_ou);
END;
-
+
pad_depth = pad_depth * 2;
- display_name = loc_grp ? loc_grp.name : org_unit.name %]
+ display_name = loc_grp ? loc_grp.name : org_unit.name #If there is a loc_grp, use loc_grp.name. Otherwise use org_unit.name?
+ %]
<option value='[% node_value %]' [% selected %] [% disabled %] [% css_class %]>
- [% ' ' FOR [0..pad_depth]; display_name | html %]
+ [% ' ' FOR [0..pad_depth]; display_name | html %]
</option>
[%- END %]
<div ng-view></div>
[% END %]
+
+
+
+
--- /dev/null
+[% PROCESS "opac/parts/header.tt2";
+ PROCESS "opac/parts/org_selector.tt2";
+ WRAPPER "opac/parts/myopac/prefs_base.tt2";
+ myopac_page = "prefs";
+ prefs_page = 'prefs_settings' %]
+
+ <h3 class="sr-only">[% l('Search and History Preferences') %]</h3>
+
+ <form method='post'>
+
+ <table class="full-width data_grid" id="acct_search_main"
+ title="[% l('Search and History Preferences') %]">
+ <tbody>
+
+ [% IF ctx.updated_user_settings %]
+ <tr><td colspan='2'>
+ <div class='renew-summary'>
+ [% l('Account Successfully Updated') %]
+ </div>
+ </td></tr>
+ [% END %]
+
+ [%- setting = 'opac.hits_per_page' -%]
+ <tr >
+ <td width='20%'><label for='[% setting %]'>[% l("Search hits per page") %]</label></td>
+ <td>
+ <select id='[% setting %]' name='[% setting %]'>
+ [% UNLESS ctx.user_setting_map.$setting;
+ ctx.user_setting_map.$setting = 10;
+ END;
+ FOR val IN [5, 8, 10, 15, 20, 25, 50] %]
+ <option value='[% val | uri %]'
+ [% IF ctx.user_setting_map.$setting == val %]
+ selected='selected'[% END %]>[% val | html %]</option>
+ [% END %]
+ </select>
+ <a href="#"><img alt="[% l('Search Hits Help') %]"
+ src="[% ctx.media_prefix %]/images/question-mark.png"
+ /></a>
+ </td>
+ </tr>
+ [%- setting = 'opac.default_search_location'; -%]
+ <tr >
+ <td width='20%'><label for='[% setting %]'>[% l("Preferred search location") %]</label></td>
+ <td>
+ [%- thang = ctx.user.home_ou.id;
+ IF ctx.user_setting_map.$setting;
+ thang = ctx.user_setting_map.$setting;
+ END;
+ id = setting;
+ INCLUDE build_org_selector name=setting value=thang;
+ %]
+ </td>
+ </tr>
+ [%- setting = 'opac.default_pickup_location'; -%]
+ <tr>
+ <td width='20%'><label for='[% setting %]'>[% l("Preferred pickup location") %]</label></td>
+ <td>
+ [%- thang = ctx.user.home_ou.id;
+ IF ctx.user_setting_map.$setting;
+ thang = ctx.user_setting_map.$setting;
+ END;
+ id = setting;
+ INCLUDE build_org_selector name=setting value=thang can_have_vols_only=1;
+ %]
+ </td>
+ </tr>
+ [%- setting = 'history.circ.retention_start' -%]
+ <tr>
+ [% circ_name = l('Keep history of checked out items?') %]
+ <td><label for='[% setting %]'>[% circ_name%]</label></td>
+ <td>
+ <input id='[% setting %]' name='[% setting %]'
+ type="checkbox" title="[% circ_name %]"
+ [% IF ctx.user_setting_map.$setting; %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [%- setting = 'history.hold.retention_start' -%]
+ <tr>
+ [% hold_name = l('Keep history of holds?') %]
+ <td><label for='[% setting %]'>[% hold_name %]</label></td>
+ <td>
+ <input id='[% setting %]' name='[% setting %]'
+ type="checkbox" title="[% hold_name %]"
+ [% IF ctx.user_setting_map.$setting; %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [%- setting = 'opac.temporary_list_no_warn' -%]
+ <tr>
+ [% skip_warn = l('Skip warning when adding to temporary book list?') %]
+ <td><label for='[% setting %]'>[% skip_warn %]</label></td>
+ <td>
+ <input id='[% setting %]' name='[% setting %]'
+ type="checkbox" title="[% skip_warn %]"
+ [% IF ctx.user_setting_map.$setting %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [%- setting = 'circ.holds_behind_desk'; IF ctx.behind_desk_supported -%]
+ <tr>
+ [% behind_desk = l('Pickup holds from behind the desk when possible?') %]
+ <td><label for='[% setting %]'>[% behind_desk %]</label></td>
+ <td>
+ <input id='[% setting %]' name='[% setting %]'
+ type="checkbox" title="[% behind_desk %]"
+ [% IF ctx.user_setting_map.$setting %] checked='checked' [% END %]/>
+ </td>
+ </tr>
+ [% END %]
+
+ <!--
+ <tr>
+ <td><label for='prefs_def_font'>[% l("Default Font Size") %]</label></td>
+ <td>
+ <select id='prefs_def_font'>
+ <option value='regular'>[% l("Regular Font") %]</option>
+ <option value='large'>[% l("Large Font") %]</option>
+ </select>
+ </td>
+ </tr>
+ -->
+
+ </tbody>
+ </table>
+ <input type="submit" value="[% l('Save') %]" class="opac-button"/>
+ </form>
+ [% INCLUDE "opac/parts/myopac/prefs_hints.tt2" %]
+[% END %]
</div>
</div>
</div>
+
+ <div class="row new-entry">
+ <div class="col-md-6">
+ <span class="glyphicon glyphicon-search"></span>
+ <a target="self" href="./admin/workstation/search/prefs">
+ [% l('Set Search Preferences') %]
+ </a>
+ </div>
+ </div>
<div class="row new-entry">
<div class="col-md-6">
controller: 'StoredPrefsCtrl',
resolve : resolver
});
+
+ $routeProvider.when('/admin/workstation/search/prefs', {
+ templateUrl: './admin/workstation/t_search_prefs',
+ controller: 'SearchPrefsCtrl',
+ resolve : resolver
+ });
// default page
var allWorkstations = [];
var permMap = {};
$scope.contextOrg = egCore.org.get(egCore.auth.user().ws_ou());
-
egCore.perm.hasPermAt('REGISTER_WORKSTATION', true)
.then(function(orgList) {
// fetch the stored WS info
egCore.hatch.getItem('eg.workstation.all')
.then(function(all) {
- allWorkstations = all || [];
+ allWorkstations = all || [];
$scope.workstations =
allWorkstations.map(function(w) { return w.name });
return egCore.hatch.getItem('eg.workstation.default');
'eg.hatch.url', $scope.hatchURL);
}
}])
+/*
+ * Search Preferences Controller
+ */
+.controller('SearchPrefsCtrl',
+ ['$scope','$window','$location', 'egCore', 'egOrg','egConfirmDialog', 'egAuth',
+function($scope , $window , $location, egCore, egOrg, egConfirmDialog, egAuth) {
+ console.log('SearchPrefsCtrl');
+ $scope.setContext = function(ctx) {
+ $scope.context = ctx;
+ $scope.isTestView = false;
+ $scope.actionPending = false;
+ }
+ //-----UI.js import
+ // avoid linking the full fleshed tree to the scope by
+ // tossing in a flattened list. -- Does this work as intended?
+ $scope.orgList = egOrg.list().map(function(org) {
+ return {
+ id : org.id(),
+ shortname : org.shortname(), //ex. CONS for example consortium
+ depth : org.ou_type().depth() //depth of the org unit
+ }
+ });
+ $scope.getSelectedName = function() {
+ if ($scope.selected)
+ return $scope.selected.shortname();
+ return $scope.label;
+ }
+
+ $scope.orgChanged = function(org) {
+ $scope.selected = egOrg.get(org.id);
+ if ($scope.onchange) $scope.onchange($scope.selected);
+ }
+
+ if (!$scope.selected)
+ $scope.selected = egOrg.get(egAuth.user().ws_ou());
+ //-----End of UI.js import
+
+ // ---------------------
+ // Hatch Configs
+ $scope.hatchURL = egCore.hatch.hatchURL();
+ $scope.hatchRequired =
+ egCore.hatch.getLocalItem('eg.hatch.required');
+
+ $scope.updateHatchRequired = function() {
+ egCore.hatch.setLocalItem(
+ 'eg.hatch.required', $scope.hatchRequired);
+ }
+
+ $scope.updateHatchURL = function() {
+ egCore.hatch.setLocalItem(
+ 'eg.hatch.url', $scope.hatchURL);
+ }
+
+
+}])
.controller('PrintConfigCtrl',
['$scope','egCore',