From 49cd1e272071c19a9e6df90a8f68f3a4faaa5d3a Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Thu, 22 Jul 2010 22:20:17 +0000 Subject: [PATCH] BUGFIX: the autoselection on linking sidebar for downloads did not work properly: the item would not be selected when the user clicked a link in the editor. Only numeric IDs were permitted, but the TreeDropdownField now supports other columns as IDs too, so enabled that for autoselection. BUGFIX: asset search would fail - typo in request var and the sql query had unnecessarily escaped quotes git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@108351 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TreeDropdownField.php | 4 ++-- javascript/TreeSelectorField.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index 1f96e4382..1cfd9fbfb 100755 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -222,7 +222,7 @@ class TreeDropdownField extends FormField { if( isset($_REQUEST['forceValue']) || $this->value ) { $forceValue = ( isset($_REQUEST['forceValue']) ? $_REQUEST['forceValue'] : $this->value); if(($values = preg_split('/,\s*/', $forceValue)) && count($values)) foreach($values as $value) { - if(!is_numeric($value)) continue; + if(!$value) continue; $obj->markToExpose($this->objectForKey($value)); } @@ -274,7 +274,7 @@ class TreeDropdownField extends FormField { $this->searchIds[$row->ID] = true; } while (!empty($parents)) { - $res = DB::query('SELECT "ParentID", "ID" FROM \"' . $this->sourceObject . '\" WHERE "ID" in ('.implode(',',array_keys($parents)).')'); + $res = DB::query('SELECT "ParentID", "ID" FROM "' . $this->sourceObject . '" WHERE "ID" in ('.implode(',',array_keys($parents)).')'); $parents = array(); foreach($res as $row) { diff --git a/javascript/TreeSelectorField.js b/javascript/TreeSelectorField.js index 60821ea00..dabf49893 100755 --- a/javascript/TreeSelectorField.js +++ b/javascript/TreeSelectorField.js @@ -188,7 +188,7 @@ TreeDropdownField.prototype = { }, ajaxGetTree: function(after) { - var ajaxURL = this.buildURL('tree?forceValues=' + this.inputTag.value); + var ajaxURL = this.buildURL('tree?forceValue=' + this.inputTag.value); var secId = jQuery(':input[name=SecurityID]'); ajaxURL += secId.length ? '&SecurityID=' + secId.val() : ''; var localeField = jQuery(this.ownerForm()).find(':input[name=locale],:input[name=Locale]');