Skip to content

Commit

Permalink
Improvements to filter terminology and display (respects linked optio…
Browse files Browse the repository at this point in the history
…n sorting order)
  • Loading branch information
jegelstaff committed Nov 9, 2024
1 parent 5ff8061 commit 5ad3cb6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
13 changes: 11 additions & 2 deletions modules/formulize/include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4515,7 +4515,7 @@ function buildFilter($id, $element_identifier, $defaultText="", $formDOMId="", $
$checked = strstr($_POST[$id], $checkboxOption) ? "checked" : "";
$selected = $_POST[$id] === 'qsf_0_{BLANK}' ? "selected" : "";
}
$filter .= $multi ? " <label for='".$multiIdCounter."_".$id."'><input type='checkbox' name='".$multiIdCounter."_".$id."' id='".$multiIdCounter."_".$id."' class='$id' value='ORSET$multiCounter={BLANK}//' $checked onclick=\"if(jQuery(this).attr('checked')) { jQuery('#".$id."_hiddenMulti').val(jQuery('#".$id."_hiddenMulti').val()+'".$checkboxOption."'); } else { jQuery('#".$id."_hiddenMulti').val(jQuery('#".$id."_hiddenMulti').val().replace('".$checkboxOption."', '')); } jQuery('#1_".$id."').removeAttr('checked'); jQuery('#apply-button-".$id."').show(200);\">&nbsp;{BLANK}</label><br/>\n" : "<option value=\"qsf_".$counter."_{BLANK}\" $selected>{BLANK}</option>\n";
$filter .= $multi ? " <label for='".$multiIdCounter."_".$id."'><input type='checkbox' name='".$multiIdCounter."_".$id."' id='".$multiIdCounter."_".$id."' class='$id' value='ORSET$multiCounter={BLANK}//' $checked onclick=\"if(jQuery(this).attr('checked')) { jQuery('#".$id."_hiddenMulti').val(jQuery('#".$id."_hiddenMulti').val()+'".$checkboxOption."'); } else { jQuery('#".$id."_hiddenMulti').val(jQuery('#".$id."_hiddenMulti').val().replace('".$checkboxOption."', '')); } jQuery('#1_".$id."').removeAttr('checked'); jQuery('#apply-button-".$id."').show(200);\">&nbsp;"._SHOW_BLANKS."</label><br/>\n" : "<option value=\"qsf_".$counter."_{BLANK}\" $selected>"._SHOW_BLANKS."</option>\n";
}
} else {
// not a filter for core use on list of entries screen, so if multi, set default text to "Any", otherwise use the "Choose an option" default, unless the user has specified something
Expand Down Expand Up @@ -4645,7 +4645,16 @@ function buildFilter($id, $element_identifier, $defaultText="", $formDOMId="", $
$select_column = trim($select_column, ",");
}

if ($dataResult = $xoopsDB->query("SELECT $select_column, t1.entry_id FROM ".$xoopsDB->prefix("formulize_".$sourceFormObject->getVar('form_handle'))." as t1 $limitConditionTable $extra_clause $conditionsfilter $conditionsfilter_oom $limitConditionWhere ORDER BY t1.`$source_element_handle`")) {
// setup the sort order based on ele_value[12], which is an element id number
$sortOrder = $ele_value[15] == 2 ? " DESC" : "ASC";
if($ele_value[12]=="none" OR !$ele_value[12]) {
$sortOrderClause = " ORDER BY t1.`$source_element_handle` $sortOrder";
} else {
list($sortHandle) = convertElementIdsToElementHandles(array($ele_value[12]), $sourceFormObject->getVar('id_form'));
$sortOrderClause = " ORDER BY t1.`$sortHandle` $sortOrder";
}

if ($dataResult = $xoopsDB->query("SELECT $select_column, t1.entry_id FROM ".$xoopsDB->prefix("formulize_".$sourceFormObject->getVar('form_handle'))." as t1 $limitConditionTable $extra_clause $conditionsfilter $conditionsfilter_oom $limitConditionWhere $sortOrderClause")) {
$useValue = 'entryid';
if(count($linked_columns)>1) {
$linked_column_count = count((array) $linked_columns);
Expand Down
3 changes: 2 additions & 1 deletion modules/formulize/language/english/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,11 @@
define("_AM_FORMULIZE_PREVIOUS_OPTION", "Use a previous answer:");
define("_formulize_VALUE_WILL_BE_CALCULATED_AFTER_SAVE","This will be determined after the form is saved");

define("_formulize_QSF_DefaultText", "Any");
define("_formulize_QSF_DefaultText", "Show all");
define("_formulize_QDR_to", "to");
define("_formulize_QDR_go", "Go");
define("_formulize_BLANK_KEYWORD", "{BLANK}");
define("_SHOW_BLANKS", "Show Blanks");

define("_formulize_ERROR_IN_LEFTRIGHT", "There appears to be an error in the PHP code that generates the text for this space. Please notify the webmaster.");

Expand Down
4 changes: 3 additions & 1 deletion modules/formulize/language/french/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@
define("_formulize_PUBLISHINGOPTIONS", "Options de publication :");
define("_formulize_PUBLISHNOVE", "enlever 'Visualiser cette entrée' des liens du rapport (aussi les utilisateurs ne pourront plus voir les détails de chaque entrée).");
define("_formulize_PUBLISHREPORT", "Publier ce rapport à l'intention des autres utilisateurs.");
define("_formulize_QSF_DefaultText", "Tout");
define("_formulize_QSF_DefaultText", "Afficher toutes");
define("_formulize_QUERYCONTROLS", "Contrôles des requêtes");
define("_formulize_RELENTRIES", "Related Entries:");
define("_formulize_REPORT_OFF", "Désactiver le mode rapport");
Expand Down Expand Up @@ -625,4 +625,6 @@
define("_formulize_FROM", "De :");
define("_formulize_TO", "À :");

define("_SHOW_BLANKS", "Afficher les blancs");

include_once XOOPS_ROOT_PATH.'/modules/formulize/language/english/main.php';

0 comments on commit 5ad3cb6

Please sign in to comment.