2009-03-04 Esteban Sanchez <estebans@artica.es>

* godmode/agentes/module_manager_editor.php: Fixed filter field on
	get_module_components ajax operation and order the results.

	* include/functions.php: Added enterprise_include_once().

	* include/functions_modules.php: Use get_db_all_rows_filter() on
	get_network_component(). Also added fields to this function.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1504 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2009-03-04 11:12:42 +00:00
parent 3a7d93b3b6
commit 30edb7dfd7
4 changed files with 31 additions and 13 deletions

View File

@ -1,3 +1,13 @@
2009-03-04 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/module_manager_editor.php: Fixed filter field on
get_module_components ajax operation and order the results.
* include/functions.php: Added enterprise_include_once().
* include/functions_modules.php: Use get_db_all_rows_filter() on
get_network_component(). Also added fields to this function.
2009-03-03 Evi Vanoost <vanooste@rcbi.rochester.edu>
* general/logon_ok.php: Minor edit in language and colors for warning

View File

@ -37,7 +37,9 @@ if (is_ajax ()) {
$id_module_component = (int) get_parameter ('id_module_component_type');
$components = get_network_components ($id_module_component,
array ('id_module_group' => $id_module_group));
array ('id_group' => $id_module_group,
'order' => 'name ASC'),
array ('id_nc', 'name'));
echo json_encode ($components);
return;

View File

@ -843,6 +843,19 @@ function enterprise_include ($filename) {
return ENTERPRISE_NOT_HOOK;
}
function enterprise_include_once ($filename) {
global $config;
// Load enterprise extensions
$filepath = realpath ($config["homedir"].'/'.ENTERPRISE_DIR.'/'.$filename);
if ($filepath === false)
return ENTERPRISE_NOT_HOOK;
if (file_exists ($filepath)) {
include_once ($filepath);
return true;
}
return ENTERPRISE_NOT_HOOK;
}
//These are wrapper functions for PHP. Don't document them
if (!function_exists ("mb_strtoupper")) {

View File

@ -81,26 +81,19 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent) {
* joined with an AND operator). Examples:
<code>
$components = get_network_components ($id_module, array ('id_module_group', 10));
$components = get_network_components ($id_module, array ('id_module_group', 10));
$components = get_network_components ($id_module, 'id_module_group = 10'));
</code>
* @param mixed Fields to retrieve on each component.
*
* @return array A list of network components matching. Empty array is returned
* if none matches.
*/
function get_network_components ($id_module, $filter = false) {
function get_network_components ($id_module, $filter = false, $fields = false) {
if (empty ($id_module))
return array ();
$where = '';
if (is_array ($filter)) {
$where = format_array_to_where_clause_sql ($filter, 'AND', ' AND ');
}
$sql = sprintf ('SELECT * FROM tnetwork_component
WHERE `id_modulo` = %d %s',
$id_module, $where);
$components = get_db_all_rows_sql ($sql);
$components = get_db_all_rows_filter ('tnetwork_component',
$filter, $fields);
if ($components === false)
return array ();
return $components;