From 2330698b3c20ddd4d33e90edf4c34a313b1abe53 Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 8 Sep 2010 20:02:19 +0000 Subject: [PATCH] Backport 17516, 17517, 17522, 17523: Allows us to create an /openils/var/web/css/skin/default/register_custom.css file containing local CSS for styling the patron editor. Example: TR[fmfield=ident_type] { display: none; } /* be sure to set the ui.patron.default_ident_type setting */ TR[fmfield=ident_value2] { border: solid thick red; font-size: x-large; } TR[fmfield=barred] { display: none; } TR[fmfield=country] { display: none; } /* be sure to set the ui.patron.default_country setting */ TR[fmfield=master_account] { display: none; } TR[fmfield=alert_message] { display: none; } TR[fmfield=ident_value] { z-index: -1; } TR[stat_cat_id='1'] { border: solid thick red; font-size: x-large; } git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@17524 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 34 +++++++++ ....data.org-setting-ui.patron.editor_defaults.sql | 36 +++++++++ Open-ILS/web/css/skin/default/register.css | 83 +++++++++++++++++++++ Open-ILS/web/js/ui/default/actor/user/register.js | 14 +++- .../web/templates/default/actor/user/register.tt2 | 85 +--------------------- 6 files changed, 168 insertions(+), 86 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql create mode 100644 Open-ILS/web/css/skin/default/register.css diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 1ae8bdb12b..e22dd35d0c 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0387'); -- gmc +INSERT INTO config.upgrade_log (version) VALUES ('0388'); -- phasefx CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index d3278f9088..d26928de41 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -6842,3 +6842,37 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) 'bool' ); +-- 0388.data.org-setting-ui.patron.editor_defaults.sql + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, fm_class ) VALUES ( + 'ui.patron.default_ident_type', + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'GUI: Default Ident Type for Patron Registration', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'This is the default Ident Type for new users in the patron editor.', + 'coust', + 'description'), + 'link', + 'cit' +); + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES ( + 'ui.patron.default_country', + oils_i18n_gettext( + 'ui.patron.default_country', + 'GUI: Default Country for New Addresses in Patron Editor', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_country', + 'This is the default Country for new addresses in the patron editor.', + 'coust', + 'description'), + 'string' +); + + diff --git a/Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql b/Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql new file mode 100644 index 0000000000..b291be9afe --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql @@ -0,0 +1,36 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0388'); -- phasefx + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, fm_class ) VALUES ( + 'ui.patron.default_ident_type', + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'GUI: Default Ident Type for Patron Registration', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'This is the default Ident Type for new users in the patron editor.', + 'coust', + 'description'), + 'link', + 'cit' +); + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES ( + 'ui.patron.default_country', + oils_i18n_gettext( + 'ui.patron.default_country', + 'GUI: Default Country for New Addresses in Patron Editor', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_country', + 'This is the default Country for new addresses in the patron editor.', + 'coust', + 'description'), + 'string' +); + +COMMIT; diff --git a/Open-ILS/web/css/skin/default/register.css b/Open-ILS/web/css/skin/default/register.css new file mode 100644 index 0000000000..2aa2e14178 --- /dev/null +++ b/Open-ILS/web/css/skin/default/register.css @@ -0,0 +1,83 @@ +@import url("register_custom.css"); + +/* XXX Move me into the CSS tree XXX */ + +#uedit-tbody tr td { + padding: 5px; + text-align: left; +} + + +#uedit-save-div { + position: fixed; + top:40px; + right:30px; + width:300px; + border:2px solid #d9e8f9; + -moz-border-radius: 10px; + font-weight: bold; + padding: 12px; + text-align:center; + vertical-align:middle; +} + +#uedit-help-div { + position: fixed; + top:124px; + right:30px; + width:300px; + border:2px dashed #d9e8f9; + -moz-border-radius: 10px; + font-weight: bold; + padding: 20px; +} + +#uedit-dupe-div { + position: fixed; + top:124px; + right:30px; + width:300px; + border:2px dashed #d9e8f9; + -moz-border-radius: 10px; + font-weight: bold; + padding: 20px; +} + +.uedit-help { + width: 25px; + border:1px solid #e0e0e0; + text-align:center; + vertical-align:middle; +} +.divider td { + min-height:10px; + background-color: #e0e0e0; +} + +.divider span { padding: 0px 5px 0px 5px; } + +.newaddr-row td { + text-align: right; + border-top:1px dashed #d9e8f9; +} +.newaddr-row td:last-child { + border-right:1px dashed #d9e8f9; +} + +.pending-addr-row td { border:1px solid #aaa; } + +.uedit-addr-del-button {margin-left: 10px; color:red;} + +.dijitTextBoxFocused, .dijitFocused { border:1px dashed #3e3e3e; color: #303030; font-weight:bold;} + +.hide-non-required tr:not([required]) { + visibility:hidden; + display:none; +} + +#require-toggle { + margin-top:10px; + margin-bottom:-5px; +} + + diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 44bb3f1186..b1aea17280 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -82,6 +82,8 @@ function load() { 'global.juvenile_age_threshold', 'patron.password.use_phone', 'ui.patron.default_inet_access_level', + 'ui.patron.default_ident_type', + 'ui.patron.default_country', 'circ.holds.behind_desk_pickup_supported', 'circ.patron_edit.clone.copy_address' ]); @@ -454,6 +456,9 @@ function loadStatCats() { var stat = statCats[idx]; var row = statCatTemplate.cloneNode(true); row.id = 'stat-cat-row-' + idx; + row.setAttribute('stat_cat_owner',stat.owner()); + row.setAttribute('stat_cat_name',stat.name()); + row.setAttribute('stat_cat_id',stat.id()); tbody.appendChild(row); getByName(row, 'name').innerHTML = stat.name(); var valtd = getByName(row, 'widget'); @@ -520,6 +525,8 @@ function fleshFMRow(row, fmcls, args) { var wclass = row.getAttribute('wclass'); var wstyle = row.getAttribute('wstyle'); var wconstraints = row.getAttribute('wconstraints'); + /* use CSS to set the zindex for widgets you want to disable. */ + var disabled = dojo.style(row, 'zIndex') == -1 ? true : false; var isPasswd2 = (fmfield == 'passwd2'); if(isPasswd2) fmfield = 'passwd'; @@ -549,7 +556,6 @@ function fleshFMRow(row, fmcls, args) { wtd.appendChild(span); var fmObject = null; - var disabled = false; switch(fmcls) { case 'au' : fmObject = patron; break; case 'ac' : fmObject = patron.card(); break; @@ -1003,6 +1009,7 @@ function uEditNewPatron() { patron.card(card); patron.cards([card]); patron.net_access_level(orgSettings['ui.patron.default_inet_access_level'] || 1); + patron.ident_type(orgSettings['ui.patron.default_ident_type']); patron.stat_cat_entries([]); patron.survey_responses([]); patron.addresses([]); @@ -1060,6 +1067,7 @@ function _uEditSave(doClone) { addr.id(w._addr); addr.isnew(1); addr.usr(patron.id()); + addr.country(orgSettings['ui.patron.default_country']); var t = patron.addresses(); if (!t) { t = []; } t.push(addr); @@ -1208,6 +1216,10 @@ function uEditNewAddr(evt, id, mkLinks) { if(id < 0 && row.getAttribute('fmfield') == 'valid') widget.widget.attr('value', true); + // make new addresses use the org setting for default country + if(id < 0 && row.getAttribute('fmfield') == 'country') + widget.widget.attr('value',orgSettings['ui.patron.default_country']); + } else if(row.getAttribute('name') == 'uedit-addr-pending-row') { // if it's a pending address, show the 'approve' button diff --git a/Open-ILS/web/templates/default/actor/user/register.tt2 b/Open-ILS/web/templates/default/actor/user/register.tt2 index a3ad7d7847..b843e8ce80 100644 --- a/Open-ILS/web/templates/default/actor/user/register.tt2 +++ b/Open-ILS/web/templates/default/actor/user/register.tt2 @@ -1,90 +1,7 @@ [% ctx.page_title = 'User Editor' %] [% WRAPPER default/base.tt2 %] - - +