2009-08-27 Miguel de Dios <miguel.dedios@artica.es>

* index.php: add comments for more readable.
	* include/functions_extensions.php, extensions/update_manager.php,
	extensions/hello, extensions/hello/icon.png, extensions/hello.php,
	operation/menu.php, godmode/menu.php: change the mecanic to add extensions
	into menu, now you can add extension with icon and into the submenu in any
	position of submenu. Change the example "hello" for to show as be.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1885 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-08-27 16:57:19 +00:00
parent 04b7011e0d
commit af855daa52
8 changed files with 76 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2009-08-27 Miguel de Dios <miguel.dedios@artica.es>
* index.php: add comments for more readable.
* include/functions_extensions.php, extensions/update_manager.php,
extensions/hello, extensions/hello/icon.png, extensions/hello.php,
operation/menu.php, godmode/menu.php: change the mecanic to add extensions
into menu, now you can add extension with icon and into the submenu in any
position of submenu. Change the example "hello" for to show as be.
2009-08-26 Miguel de Dios <miguel.dedios@artica.es>
* operation/extensions.php, godmode/extensions.php: fix hidden bug that show

View File

@ -20,9 +20,21 @@ function hello_extension_main () {
echo "This is a sample of minimal extension";
}
function test() {
echo "<h1>TEST</h1>";
}
/* This adds a option in the operation menu */
add_operation_menu_option ('Hello plugin!');
//add_operation_menu_option ('Hello plugin!');
add_godmode_menu_option (__('Hello plugin'), 'PM','gagente',"hello/icon.png");
/**
* 'estado' is a option of menu you can see in 'operation/menu.php'
*/
add_operation_menu_option(__('Hello plugin'), 'estado',"hello/icon.png");
/* This sets the function to be called when the extension is selected in the operation menu */
add_extension_main_function ('hello_extension_main');
add_extension_godmode_function('prueba');
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

View File

@ -119,7 +119,7 @@ function pandora_update_manager_godmode () {
}
add_operation_menu_option (__('Update manager'));
add_godmode_menu_option (__('Update manager settings'), 'PM');
add_godmode_menu_option (__('Update manager settings'), 'PM','gagente');
add_extension_main_function ('pandora_update_manager_main');
add_extension_godmode_function ('pandora_update_manager_godmode');
add_extension_login_function ('pandora_update_manager_login');

View File

@ -208,6 +208,17 @@ if (give_acl ($config['id_user'], 0, "PM")) {
$sub[$extmenu["sec2"]]["text"] = $extmenu["name"];
$sub[$extmenu["sec2"]]["refr"] = 0;
if (array_key_exists('fatherId',$extmenu)) {
if (strlen($extmenu['fatherId']) > 0) {
$menu[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["text"] = __($extmenu['name']);
$menu[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["refr"] = 60;
$menu[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["icon"] = $extmenu['icon'];
$menu[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["sec"] = 'gextensions';
$menu[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["extension"] = true;
$menu[$extmenu['fatherId']]['hasExtensions'] = true;
}
}
}
$menu["gextensions"]["sub"] = $sub;

View File

@ -79,7 +79,8 @@ function is_extension ($page) {
}
/**
* TODO: Document extensions
* Scan the EXTENSIONS_DIR or ENTERPRISE_DIR.'/'.EXTENSIONS_DIR for search
* the files extensions.
*
* @param bool $enterprise
*/
@ -128,7 +129,7 @@ function get_extensions ($enterprise = false) {
}
/**
* Load the basic configurations of extension and add extensions into menu.
* TODO: Document extensions
*
* @param array $extensions
*/
@ -145,9 +146,11 @@ function load_extensions ($extensions) {
/**
* TODO: Document extensions
*
* @param string $name
* @param string name
* @param string fatherId
* @param string icon
*/
function add_operation_menu_option ($name) {
function add_operation_menu_option ($name, $fatherId = null, $icon = null) {
global $config;
global $extension_file;
@ -157,16 +160,20 @@ function add_operation_menu_option ($name) {
$option_menu['name'] = substr ($name, 0, 15);
$extension = &$config['extensions'][$extension_file];
$option_menu['sec2'] = $extension['dir'].'/'.substr ($extension_file, 0, -4);
$option_menu['fatherId'] = $fatherId;
$option_menu['icon'] = $icon;
$extension['operation_menu'] = $option_menu;
}
/**
* TODO: Document extensions
*
* @param string $name
* @param string $acl
* @param string name
* @param string acl
* @param string fatherId
* @param string icon
*/
function add_godmode_menu_option ($name, $acl) {
function add_godmode_menu_option ($name, $acl,$fatherId = null, $icon = null) {
global $config;
global $extension_file;
@ -177,6 +184,8 @@ function add_godmode_menu_option ($name, $acl) {
$option_menu['name'] = substr ($name, 0, 15);
$extension = &$config['extensions'][$extension_file];
$option_menu['sec2'] = $extension['dir'].'/'.substr ($extension_file, 0, -4);
$option_menu['fatherId'] = $fatherId;
$option_menu['icon'] = $icon;
$extension['godmode_menu'] = $option_menu;
}

View File

@ -61,6 +61,9 @@ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) {
include (ENTERPRISE_DIR."/load_enterprise.php");
}
/**
* Load the basic configurations of extension and add extensions into menu.
*/
load_extensions ($config['extensions']);
if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {

View File

@ -199,5 +199,27 @@ if (give_acl ($config['id_user'], 0, "AR")) {
}
}
/**
* Add the extensions
*/
//debugPrint($config['extensions']);
foreach($config['extensions'] as $extension) {
$operationModeMenu = $extension['operation_menu'];
if ($operationModeMenu == null)
continue;
if (array_key_exists('fatherId',$operationModeMenu)) {
if (strlen($operationModeMenu['fatherId']) > 0) {
$menu[$operationModeMenu['fatherId']]['sub'][$operationModeMenu['sec2']]["text"] = __($operationModeMenu['name']);
$menu[$operationModeMenu['fatherId']]['sub'][$operationModeMenu['sec2']]["refr"] = 60;
$menu[$operationModeMenu['fatherId']]['sub'][$operationModeMenu['sec2']]["icon"] = $operationModeMenu['icon'];
$menu[$operationModeMenu['fatherId']]['sub'][$operationModeMenu['sec2']]["sec"] = 'extensions';
$menu[$operationModeMenu['fatherId']]['sub'][$operationModeMenu['sec2']]["extension"] = true;
$menu[$operationModeMenu['fatherId']]['hasExtensions'] = true;
}
}
}
print_menu ($menu);
?>