From 982e5117f15926441f694fa3f46ef87a4c1010e1 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 6 Apr 2010 13:53:51 -0700 Subject: [PATCH] Fix shortcut hoverhelp, javascript, and criteria builder usability. Fixes bug #11516 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Shortcut.pm | 30 ++++++++++----------- lib/WebGUI/i18n/English/Asset_Shortcut.pm | 6 ++--- www/extras/wobject/Shortcut/querybuilder.js | 19 ++++++++++++- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 40f1f482f..a6d600302 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -18,6 +18,7 @@ - fixed #11513: white text, broken account mgmt - fixed #11514: Added JS-type cancel button to edit view of WebGUI::Asset::Post (Bernd Kalbfuß-Zimmermann) - fixed #11469: Survey Ruler + - fixed #11516: Shortcut Asset: Properties panel messed up in edit view 7.9.1 - fixed #11464: blank page after setting posts per page in Collaboration System to 0 (zero) diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 3fdc4a18a..ccc851018 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -65,7 +65,7 @@ sub _drawQueryBuilder { "AND" => $i18n->get("AND"), "OR" => $i18n->get("OR")}, value=>["OR"], - extras=>'class="qbselect"', + extras=>'class="qbselect" '. $self->{_disabled}, } ); @@ -87,7 +87,7 @@ sub _drawQueryBuilder { name=>$opFieldName, uiLevel=>5, options=>$operator{$fieldType}, - extras=>'class="qbselect"' + extras=>'class="qbselect" '. $self->{_disabled}, }); # The value select field my $valFieldName = "val_field".$i; @@ -96,13 +96,14 @@ sub _drawQueryBuilder { fieldType=>$fieldType, name=>$valFieldName, uiLevel=>5, - extras=>qq/title="$fields->{$field}{description}" class="qbselect"/, + extras=>qq/title="$fields->{$field}{description}" class="qbselect" /. $self->{_disabled}, options=>$options, ); # An empty row $output .= qq||; # Table row with field info + my $disabled = $self->{_disabled}; $output .= qq|

$fieldLabel

@@ -114,7 +115,11 @@ sub _drawQueryBuilder { +<<<<<<< HEAD:lib/WebGUI/Asset/Shortcut.pm +======= + +>>>>>>> f32f209... Fix shortcut hoverhelp, javascript, and criteria builder usability. Fixes bug #11516:lib/WebGUI/Asset/Shortcut.pm |; $i++; @@ -310,19 +315,12 @@ sub getEditForm { ); if($self->session->setting->get("metaDataEnabled")) { $tabform->getTab("properties")->yesNo( - -name=>"shortcutByCriteria", - -value=>$self->getValue("shortcutByCriteria"), - -label=>$i18n->get("Shortcut by alternate criteria"), - -hoverHelp=>$i18n->get("Shortcut by alternate criteria description"), - -extras=>q|onchange=" - if (this.form.shortcutByCriteria[0].checked) { - this.form.resolveMultiples.disabled=false; - this.form.shortcutCriteria.disabled=false; - } else { - this.form.resolveMultiples.disabled=true; - this.form.shortcutCriteria.disabled=true; - }"| - ); + -name => "shortcutByCriteria", + -value => $self->getValue("shortcutByCriteria"), + -label => $i18n->get("Shortcut by alternate criteria"), + -hoverHelp=> $i18n->get("Shortcut by alternate criteria description"), + -extras => q|onchange="wgCriteriaDisable(this.form, this.form.shortcutByCriteria[0].checked)"|, + ); $tabform->getTab("properties")->yesNo( -name=>"disableContentLock", -value=>$self->getValue("disableContentLock"), diff --git a/lib/WebGUI/i18n/English/Asset_Shortcut.pm b/lib/WebGUI/i18n/English/Asset_Shortcut.pm index f45a3d311..bc489f1c4 100644 --- a/lib/WebGUI/i18n/English/Asset_Shortcut.pm +++ b/lib/WebGUI/i18n/English/Asset_Shortcut.pm @@ -106,9 +106,9 @@ Most Recent will select the most recent asset that matches the shortcut criteria }, 'Criteria description' => { - message => q|A statement to determine what to mirror, in the form of "color = blue and weight != heavy". Multiple expressions may be joined with "and" and "or".
-A property or value must be quoted if it contains spaces. Feel free to use the criteria builder to build your statements.|, - lastUpdated => 1167190118, + message => q|A statement to determine what to mirror, in the form of "color = blue and weight != heavy". Multiple expressions may be joined with "and" and "or". A property or value must be quoted if it contains spaces.
+The statement may be entered by hand, or it can be built graphically using the Criteria builder. For each criteria that you want to enter, select the value for the metadata field and the operator. Then, use the conjunction field to choose how it works with the other criteria, and hit the Add button for the field you want to add.|, + lastUpdated => 1270581368, }, diff --git a/www/extras/wobject/Shortcut/querybuilder.js b/www/extras/wobject/Shortcut/querybuilder.js index 92111d715..ada94e8a7 100644 --- a/www/extras/wobject/Shortcut/querybuilder.js +++ b/www/extras/wobject/Shortcut/querybuilder.js @@ -1,12 +1,29 @@ +function wgCriteriaDisable ( form, toDisable ) { + var new_state = toDisable ? false : true; + var elements = YAHOO.util.Dom.getElementsByClassName('qbselect'); + var buttons = YAHOO.util.Dom.getElementsByClassName('qbButton'); + form.resolveMultiples.disabled = new_state; + form.shortcutCriteria.disabled = new_state; + for(idx=0; idx < elements.length; idx++) { + elements[idx].disabled = new_state; + } + for(idx=0; idx < buttons.length; idx++) { + buttons[idx].disabled = new_state; + } +} + function addCriteria ( fieldname, opform, valform ) { var form = opform.form; var operator = getValue(opform); var value = getValue(valform); var criteria = form.shortcutCriteria.value; var conjunction = ""; + if (form.shortcutCriteria.disabled == true) { + return; + } if(! /^\s*$/.test(criteria)) { conjunction = " " + getValue(form.conjunction) + " "; - } + } //handle quotes if(/\s+/.test(fieldname)) { fieldname = '"' + fieldname + '"';