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 (from r108351)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112720 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-18 22:50:30 +00:00
parent 2262f3f25e
commit b90e3a680c
2 changed files with 3 additions and 3 deletions

View File

@ -220,7 +220,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));
}
@ -272,7 +272,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) {

View File

@ -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('[@name=SecurityID]');
ajaxURL += secId.length ? '&SecurityID=' + secId.val() : '';
var localeField = jQuery(this.ownerForm()).find(':input[name=locale],:input[name=Locale]');