[2010-12-07 14:57:47] Rev:645 | 3 files Modified

gustavo: Changing the reassign comboBox behavior adding the auto-complete feature.
--------------------------------------------------------------------------------
1. M /trunk/workflow/engine/templates/cases/reassignList.js
2. M /trunk/workflow/engine/templates/cases/casesList.js
3. M /trunk/workflow/engine/methods/cases/proxyReassignUsersList.php
This commit is contained in:
Erik Amaru Ortiz
2010-12-09 14:03:27 +00:00
parent 3d9d4a5a38
commit a8e94216ff
3 changed files with 57 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
<?php <?php
$callback = isset($_POST['callback']) ? $_POST['callback'] : 'stcCallback1001'; $callback = isset($_POST['callback']) ? $_POST['callback'] : 'stcCallback1001';
$query = isset($_POST['query']) ? $_POST['query'] : '';
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'DESC'; $dir = isset($_POST['dir']) ? $_POST['dir'] : 'DESC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : ''; $sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$start = isset($_POST['start']) ? $_POST['start'] : '0'; $start = isset($_POST['start']) ? $_POST['start'] : '0';
@@ -11,8 +12,47 @@
$status = isset($_POST['status']) ? strtoupper($_POST['status']) : ''; $status = isset($_POST['status']) ? strtoupper($_POST['status']) : '';
$action = isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : 'todo'); $action = isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : 'todo');
$type = isset($_GET['type']) ? $_GET['type'] : (isset($_POST['type']) ? $_POST['type'] : 'extjs'); $type = isset($_GET['type']) ? $_GET['type'] : (isset($_POST['type']) ? $_POST['type'] : 'extjs');
$user = isset($_POST['user']) ? $_POST['user'] : '';
function array_sort($array, $on, $order=SORT_ASC, $query='')
{
$new_array = array();
$sortable_array = array();
if (count($array) > 0) {
foreach ($array as $k => $v) {
if (is_array($v)) {
foreach ($v as $k2 => $v2) {
if ($k2 == $on) {
$sortable_array[$k] = $v2;
}
}
} else {
$sortable_array[$k] = $v;
}
}
switch ($order) {
case SORT_ASC:
asort($sortable_array);
break;
case SORT_DESC:
arsort($sortable_array);
break;
}
foreach ($sortable_array as $k => $v) {
if ($query==''){
$new_array[] = $array[$k];
} else {
$pos1 = stripos($array[$k]['userFullname'], $query);
if ($pos1!==false&&$pos1==0){
$new_array[] = $array[$k];
}
}
}
}
return $new_array;
}
// $APP_UIDS = explode(',', $_POST['APP_UID']); // $APP_UIDS = explode(',', $_POST['APP_UID']);
$appUid = isset($_POST['application']) ? $_POST['application'] : ''; $appUid = isset($_POST['application']) ? $_POST['application'] : '';
@@ -73,5 +113,6 @@
// $oTmp = new stdClass(); // $oTmp = new stdClass();
// $oTmp->items = $aUsersInvolved; // $oTmp->items = $aUsersInvolved;
$result = array(); $result = array();
$aUsersInvolved = array_sort($aUsersInvolved,'userFullname',SORT_ASC, $query);
$result['data'] = $aUsersInvolved; $result['data'] = $aUsersInvolved;
print G::json_encode( $result ) ; print G::json_encode( $result ) ;

View File

@@ -1306,8 +1306,9 @@ var gridForm = new Ext.FormPanel({
} }
} }
comboUsersToReassign.clearValue(); comboUsersToReassign.clearValue();
storeUsersToReassign.removeAll();
storeUsersToReassign.setBaseParam('application',application); storeUsersToReassign.setBaseParam('application',application);
storeUsersToReassign.load(); //storeUsersToReassign.load();
//alert(record.USERS); //alert(record.USERS);
} // Allow rows to be rendered. } // Allow rows to be rendered.
} }

View File

@@ -55,10 +55,18 @@
// create the combo instance // create the combo instance
var comboUsersToReassign = new Ext.form.ComboBox({ var comboUsersToReassign = new Ext.form.ComboBox({
//typeAhead : true, width : 280,
fieldLabel : 'Reassign to', boxMaxWidth : 180,
editable : true,
forceSelection: false,
minChars : 2,
valueField : 'userId',
displayField : 'userFullname',
selectOnFocus : true,
typeAhead : true,
autocomplete : true,
mode : 'remote',
triggerAction : 'all', triggerAction : 'all',
width : '150',
//lazyRender : true, //lazyRender : true,
// store : new Ext.data.Store(), // store : new Ext.data.Store(),
store : storeUsersToReassign, store : storeUsersToReassign,
@@ -69,9 +77,8 @@
row.set('APP_REASSIGN_USER', record.get('userFullname')); row.set('APP_REASSIGN_USER', record.get('userFullname'));
this.setValue(record.get('userFullname')); this.setValue(record.get('userFullname'));
} }
}, }
valueField : 'userId',
displayField : 'userFullname'
}); });
//alert (this.fields.); //alert (this.fields.);