mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
- removed Admin >> Manage applications, as setup is the place and tool
to do that (changing something here breaks something in almost all cases) - removed disabled apps from application list in: + edit user + view user + edit group
This commit is contained in:
parent
d5a2b01981
commit
29d273be1a
@ -15,6 +15,15 @@
|
||||
*/
|
||||
class admin_prefs_sidebox_hooks
|
||||
{
|
||||
/**
|
||||
* Functions callable via menuaction
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $public_functions = array(
|
||||
'register_all_hooks' => True
|
||||
);
|
||||
|
||||
/**
|
||||
* hooks to build projectmanager's sidebox-menu plus the admin and preferences sections
|
||||
*
|
||||
@ -53,11 +62,6 @@ class admin_prefs_sidebox_hooks
|
||||
$file['User Groups'] = egw::link('/index.php','menuaction=admin.uiaccounts.list_groups');
|
||||
}
|
||||
|
||||
if (! $GLOBALS['egw']->acl->check('applications_access',1,'admin'))
|
||||
{
|
||||
$file['Applications'] = egw::link('/index.php','menuaction=admin.uiapplications.get_list');
|
||||
}
|
||||
|
||||
if (! $GLOBALS['egw']->acl->check('global_categories_access',1,'admin'))
|
||||
{
|
||||
$file['Global Categories'] = egw::link('/index.php','menuaction=admin.admin_categories.index&appname=phpgw');
|
||||
@ -85,7 +89,7 @@ class admin_prefs_sidebox_hooks
|
||||
|
||||
if (! $GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
||||
{
|
||||
$file['Find and Register all Application Hooks'] = egw::link('/index.php','menuaction=admin.uiapplications.register_all_hooks');
|
||||
$file['Find and Register all Application Hooks'] = egw::link('/index.php','menuaction=admin.admin_prefs_sidebox_hooks.register_all_hooks');
|
||||
}
|
||||
|
||||
if (! $GLOBALS['egw']->acl->check('asyncservice_access',1,'admin'))
|
||||
@ -117,4 +121,22 @@ class admin_prefs_sidebox_hooks
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all hooks
|
||||
*/
|
||||
function register_all_hooks()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
$GLOBALS['egw']->hooks->register_all_hooks();
|
||||
|
||||
if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited
|
||||
{
|
||||
$GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session
|
||||
}
|
||||
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - administration *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class boapplications
|
||||
{
|
||||
var $so;
|
||||
|
||||
function boapplications()
|
||||
{
|
||||
$this->so =& CreateObject('admin.soapplications');
|
||||
}
|
||||
|
||||
function get_list()
|
||||
{
|
||||
return $this->so->get_list();
|
||||
}
|
||||
|
||||
function read($app_name)
|
||||
{
|
||||
return $this->so->read($app_name);
|
||||
}
|
||||
|
||||
function add($data)
|
||||
{
|
||||
return $this->so->add($data);
|
||||
}
|
||||
|
||||
function save($data)
|
||||
{
|
||||
return $this->so->save($data);
|
||||
}
|
||||
|
||||
function exists($app_name)
|
||||
{
|
||||
return $this->so->exists($app_name);
|
||||
}
|
||||
|
||||
function app_order()
|
||||
{
|
||||
return $this->so->app_order();
|
||||
}
|
||||
|
||||
function delete($app_name)
|
||||
{
|
||||
return $this->so->delete($app_name);
|
||||
}
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - administration *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class soapplications
|
||||
{
|
||||
var $db;
|
||||
var $applications_table = 'egw_applications';
|
||||
var $hooks_table = 'egw_hooks';
|
||||
|
||||
function soapplications()
|
||||
{
|
||||
$this->db = clone($GLOBALS['egw']->db);
|
||||
}
|
||||
|
||||
function read($app_name)
|
||||
{
|
||||
$sql = "SELECT * FROM $this->applications_table WHERE app_name='$app_name'";
|
||||
|
||||
$this->db->query($sql,__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
$app_info = array(
|
||||
$this->db->f('app_name'),
|
||||
$GLOBALS['egw_info']['apps'][$this->db->f('app_name')]['title'],
|
||||
$this->db->f('app_enabled'),
|
||||
$this->db->f('app_name'),
|
||||
$this->db->f('app_order')
|
||||
);
|
||||
return $app_info;
|
||||
}
|
||||
|
||||
function get_list()
|
||||
{
|
||||
$this->db->query("SELECT * FROM $this->applications_table WHERE app_enabled != 3",__LINE__,__FILE__);
|
||||
if($this->db->num_rows())
|
||||
{
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
$app = $this->db->f('app_name');
|
||||
$title = @$GLOBALS['egw_info']['apps'][$app]['title'];
|
||||
if (empty($title))
|
||||
{
|
||||
$title = lang($app) == $app.'*' ? $app : lang($app);
|
||||
}
|
||||
$apps[$app] = array(
|
||||
'title' => $title,
|
||||
'name' => $app,
|
||||
'status' => $this->db->f('app_enabled')
|
||||
);
|
||||
}
|
||||
}
|
||||
return $apps;
|
||||
}
|
||||
|
||||
function add($data)
|
||||
{
|
||||
/* Yes, the sequence should work, but after a mass import in setup (new install)
|
||||
it does not work on pg
|
||||
*/
|
||||
$sql = "SELECT MAX(app_id) from $this->applications_table";
|
||||
$this->db->query($sql,__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
$app_id = $this->db->f(0) + 1;
|
||||
$sql = "INSERT INTO $this->applications_table (app_id,app_name,app_enabled,app_order) VALUES("
|
||||
. $app_id . ",'" . addslashes($data['n_app_name']) . "','"
|
||||
. $data['n_app_status'] . "','" . $data['app_order'] . "')";
|
||||
|
||||
$this->db->query($sql,__LINE__,__FILE__);
|
||||
return True;
|
||||
}
|
||||
|
||||
function save($data)
|
||||
{
|
||||
$sql = "UPDATE $this->applications_table SET "
|
||||
. "app_enabled='" . $data['n_app_status'] . "',app_order='" . $data['app_order']
|
||||
. "' WHERE app_name='" . $data['app_name'] . "'";
|
||||
|
||||
$this->db->query($sql,__LINE__,__FILE__);
|
||||
return True;
|
||||
}
|
||||
|
||||
function exists($app_name)
|
||||
{
|
||||
$this->db->query("SELECT COUNT(app_name) FROM $this->applications_table WHERE app_name='" . addslashes($app_name) . "'",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
|
||||
if ($this->db->f(0) != 0)
|
||||
{
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
function app_order()
|
||||
{
|
||||
$this->db->query("SELECT MAX(app_order)+1 FROM $this->applications_table",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
return $this->db->f(0);
|
||||
}
|
||||
|
||||
function delete($app_name)
|
||||
{
|
||||
$this->db->query("DELETE FROM $this->applications_table WHERE app_name='$app_name'",__LINE__,__FILE__);
|
||||
}
|
||||
|
||||
function register_hook($app)
|
||||
{
|
||||
$this->db->query("INSERT INTO $this->hooks_table (hook_appname,hook_location,hook_filename) "
|
||||
. "VALUES ('".$app['app_name']."','".$app['hook']."','hook_".$app['hook'].".inc.php')",__LINE__,__FILE__
|
||||
);
|
||||
}
|
||||
}
|
@ -973,7 +973,9 @@
|
||||
'lang_firstname' => lang('First Name'),
|
||||
'lang_lastlogin' => lang('Last login'),
|
||||
'lang_lastloginfrom' => lang('Last login from'),
|
||||
'lang_expires' => lang('Expires')
|
||||
'lang_expires' => lang('Expires'),
|
||||
'lang_app' => lang('application'),
|
||||
'lang_acl' => lang('enabled'),
|
||||
);
|
||||
|
||||
$t->parse('password_fields','form_logininfo',True);
|
||||
@ -1055,17 +1057,22 @@
|
||||
$i = 0;
|
||||
|
||||
$availableApps = $GLOBALS['egw_info']['apps'];
|
||||
@asort($availableApps);
|
||||
@reset($availableApps);
|
||||
foreach($availableApps as $app => $data)
|
||||
{
|
||||
if ($data['enabled'] && $data['status'] != 2)
|
||||
if (!$data['enabled'] || !$data['status'] || $data['status'] == 3)
|
||||
{
|
||||
$perm_display[$i]['appName'] = $app;
|
||||
$perm_display[$i]['title'] = $data['title'];
|
||||
$i++;
|
||||
unset($availableApps[$app]); // do NOT show disabled apps, or our API (status = 3)
|
||||
}
|
||||
}
|
||||
uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);'));
|
||||
|
||||
foreach($availableApps as $app => $data)
|
||||
{
|
||||
$perm_display[] = array(
|
||||
'appName' => $app,
|
||||
'title' => $data['title'],
|
||||
);
|
||||
}
|
||||
|
||||
// create apps output
|
||||
$apps =& CreateObject('phpgwapi.applications',(int)$_GET['account_id']);
|
||||
@ -1091,7 +1098,7 @@
|
||||
$part2 = '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
$appRightsOutput .= sprintf("<tr bgcolor=\"%s\">$part1$part2</tr>\n",$GLOBALS['egw_info']['theme']['row_on']);
|
||||
$appRightsOutput .= sprintf("<tr class=\"%s\">$part1$part2</tr>\n",$this->nextmatchs->alternate_row_color('',true));
|
||||
}
|
||||
|
||||
$var['permissions_list'] = $appRightsOutput;
|
||||
@ -1190,26 +1197,24 @@
|
||||
'email' => html::input('account_email',$group_repository['account_email'],'',' style="width: 100%;"'),
|
||||
));
|
||||
}
|
||||
reset($GLOBALS['egw_info']['apps']);
|
||||
$sorted_apps = $GLOBALS['egw_info']['apps'];
|
||||
foreach ($sorted_apps as $key => $values) {
|
||||
$sortarray[$key] = strtolower($values['title']);
|
||||
}
|
||||
unset($key); unset($values);
|
||||
@asort($sortarray);
|
||||
@reset($sortarray);
|
||||
|
||||
foreach ($sortarray as $key => $value)
|
||||
$availableApps = $GLOBALS['egw_info']['apps'];
|
||||
foreach($availableApps as $app => $data)
|
||||
{
|
||||
if ($sorted_apps[$key]['enabled'] && $sorted_apps[$key]['status'] != 3)
|
||||
if (!$data['enabled'] || !$data['status'] || $data['status'] == 3)
|
||||
{
|
||||
$perm_display[] = Array(
|
||||
$key,
|
||||
$sorted_apps[$key]['title']
|
||||
);
|
||||
unset($availableApps[$app]); // do NOT show disabled apps, or our API (status = 3)
|
||||
}
|
||||
}
|
||||
unset($key); unset($value);
|
||||
uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);'));
|
||||
|
||||
foreach ($availableApps as $app => $data)
|
||||
{
|
||||
$perm_display[] = Array(
|
||||
$app,
|
||||
$data['title']
|
||||
);
|
||||
}
|
||||
unset($app); unset($data);
|
||||
|
||||
$perm_html = '<td width="35%">'.lang('Application').'</td><td width="15%">'.lang('enabled').' / '.lang('ACL').'</td>';
|
||||
$perm_html = '<tr class="th">'.
|
||||
@ -1513,16 +1518,19 @@
|
||||
$db_perms = $apps->read_account_specific();
|
||||
|
||||
$availableApps = $GLOBALS['egw_info']['apps'];
|
||||
foreach($availableApps as $app => $data)
|
||||
{
|
||||
if (!$data['enabled'] || !$data['status'] || $data['status'] == 3)
|
||||
{
|
||||
unset($availableApps[$app]); // do NOT show disabled apps, or our API (status = 3)
|
||||
}
|
||||
}
|
||||
uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);'));
|
||||
|
||||
$appRightsOutput = '';
|
||||
$i = 0;
|
||||
foreach($availableApps as $app => $data)
|
||||
{
|
||||
if (!$data['enabled'] || $data['status'] == 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$checked = (@$userData['account_permissions'][$app] || @$db_perms[$app]) && $_account_id ? ' checked="1"' : '';
|
||||
$acl_action = self::_acl_action($app,$_account_id,$userData['account_lid'],$options);
|
||||
$part[$i&1] = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s>',
|
||||
@ -1533,14 +1541,14 @@
|
||||
|
||||
if ($i & 1)
|
||||
{
|
||||
$appRightsOutput .= sprintf('<tr bgcolor="%s">%s%s</tr>',$this->nextmatchs->alternate_row_color(), $part[0], $part[1]);
|
||||
$appRightsOutput .= sprintf('<tr class="%s">%s%s</tr>',$this->nextmatchs->alternate_row_color('',true), $part[0], $part[1]);
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
if ($i & 1)
|
||||
{
|
||||
$part[1] = '<td colspan="3"> </td>';
|
||||
$appRightsOutput .= sprintf('<tr bgcolor="%s">%s%s</tr>',$this->nextmatchs->alternate_row_color(), $part[0], $part[1]);
|
||||
$appRightsOutput .= sprintf('<tr class="%s">%s%s</tr>',$this->nextmatchs->alternate_row_color('',true), $part[0], $part[1]);
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
|
@ -1,383 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - administration *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class uiapplications
|
||||
{
|
||||
var $public_functions = array(
|
||||
'get_list' => True,
|
||||
'add' => True,
|
||||
'edit' => True,
|
||||
'delete' => True,
|
||||
'register_all_hooks' => True
|
||||
);
|
||||
|
||||
var $bo;
|
||||
var $nextmatchs;
|
||||
|
||||
function uiapplications()
|
||||
{
|
||||
$this->bo =& CreateObject('admin.boapplications');
|
||||
$this->nextmatchs =& CreateObject('phpgwapi.nextmatchs');
|
||||
}
|
||||
|
||||
function get_list()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('applications_access',1,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
$can_add = !$GLOBALS['egw']->acl->check('applications_access',2,'admin');
|
||||
$can_edit = !$GLOBALS['egw']->acl->check('applications_access',4,'admin');
|
||||
$can_delete = !$GLOBALS['egw']->acl->check('applications_access',8,'admin');
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Installed applications');
|
||||
$GLOBALS['egw']->js->validate_file('jscode','openwindow','admin');
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$GLOBALS['egw']->template->set_file(array('applications' => 'applications.tpl'));
|
||||
$GLOBALS['egw']->template->set_block('applications','list','list');
|
||||
$GLOBALS['egw']->template->set_block('applications','row','row');
|
||||
$GLOBALS['egw']->template->set_block('applications','add','add');
|
||||
|
||||
$start = get_var('start',array('POST','GET'));
|
||||
$sort = $_GET['sort'];
|
||||
$order = $_GET['order'];
|
||||
$offset = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
|
||||
$apps = $this->bo->get_list();
|
||||
$total = count($apps);
|
||||
|
||||
$sort = $sort ? $sort : 'ASC';
|
||||
|
||||
uasort($apps,create_function('$a,$b','return strcasecmp($a[\'title\'],$b[\'title\'])'.($sort != 'ASC' ? '* -1' : '').';'));
|
||||
|
||||
if ($start && $offset)
|
||||
{
|
||||
$limit = $start + $offset;
|
||||
}
|
||||
elseif ($start && !$offset)
|
||||
{
|
||||
$limit = $start;
|
||||
}
|
||||
elseif(!$start && !$offset)
|
||||
{
|
||||
$limit = $total;
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = 0;
|
||||
$limit = $offset;
|
||||
}
|
||||
|
||||
if ($limit > $total)
|
||||
{
|
||||
$limit = $total;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$applications = array();
|
||||
while(list($app,$data) = @each($apps))
|
||||
{
|
||||
if($i >= $start && $i< $limit)
|
||||
{
|
||||
$applications[$app] = $data;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$GLOBALS['egw']->template->set_var('bg_color',$GLOBALS['egw_info']['theme']['bg_color']);
|
||||
$GLOBALS['egw']->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
|
||||
|
||||
$GLOBALS['egw']->template->set_var('sort_title',$this->nextmatchs->show_sort_order($sort,'title','title','/index.php',lang('Title'),'&menuaction=admin.uiapplications.get_list'));
|
||||
$GLOBALS['egw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($total,$start));
|
||||
$GLOBALS['egw']->template->set_var('left',$this->nextmatchs->left('/index.php',$start,$total,'menuaction=admin.uiapplications.get_list'));
|
||||
$GLOBALS['egw']->template->set_var('right',$this->nextmatchs->right('index.php',$start,$total,'menuaction=admin.uiapplications.get_list'));
|
||||
|
||||
$GLOBALS['egw']->template->set_var('lang_edit',lang('Edit'));
|
||||
$GLOBALS['egw']->template->set_var('lang_delete',lang('Delete'));
|
||||
$GLOBALS['egw']->template->set_var('lang_enabled',lang('Enabled'));
|
||||
|
||||
$GLOBALS['egw']->template->set_var('new_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiapplications.add'));
|
||||
$GLOBALS['egw']->template->set_var('lang_note',lang('(To install new applications use<br><a href="setup/" target="setup">Setup</a> [Manage Applications] !!!)'));
|
||||
$GLOBALS['egw']->template->set_var('lang_add',lang('add'));
|
||||
|
||||
foreach($applications as $app)
|
||||
{
|
||||
$tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
||||
|
||||
$GLOBALS['egw']->template->set_var('tr_color',$tr_color);
|
||||
$GLOBALS['egw']->template->set_var('name',$app['title']);
|
||||
|
||||
$GLOBALS['egw']->template->set_var('edit',$can_edit ? '<a href="' . $GLOBALS['egw']->link('/index.php','menuaction=admin.uiapplications.edit&app_name=' . urlencode($app['name'])) . '&start='.$start.'"> ' . lang('Edit') . ' </a>' : ' ');
|
||||
$GLOBALS['egw']->template->set_var('delete',$can_delete ? '<a href="' . $GLOBALS['egw']->link('/index.php','menuaction=admin.uiapplications.delete&app_name=' . urlencode($app['name'])) . '&start='.$start.'"> ' . lang('Delete') . ' </a>' : ' ');
|
||||
|
||||
if ($app['status'])
|
||||
{
|
||||
$status = lang('Yes');
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = '<b>' . lang('No') . '</b>';
|
||||
}
|
||||
$GLOBALS['egw']->template->set_var('status',$status);
|
||||
|
||||
$GLOBALS['egw']->template->parse('rows','row',True);
|
||||
}
|
||||
if ($can_add)
|
||||
{
|
||||
$GLOBALS['egw']->template->parse('addbutton','add');
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->template->set_var('addbutton','');
|
||||
}
|
||||
|
||||
$GLOBALS['egw']->template->pparse('out','list');
|
||||
}
|
||||
|
||||
function display_row($label, $value)
|
||||
{
|
||||
$GLOBALS['egw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
|
||||
$GLOBALS['egw']->template->set_var('label',$label);
|
||||
$GLOBALS['egw']->template->set_var('value',$value);
|
||||
$GLOBALS['egw']->template->parse('rows','row',True);
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('applications_access',2,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
$start = get_var('start',array('POST','GET'));
|
||||
|
||||
$GLOBALS['egw']->template->set_file(array('application' => 'application_form.tpl'));
|
||||
$GLOBALS['egw']->template->set_block('application','form','form');
|
||||
$GLOBALS['egw']->template->set_block('application','row','row');
|
||||
$GLOBALS['egw']->template->set_block('form','delete_button');
|
||||
$GLOBALS['egw']->template->set_var('delete_button','');
|
||||
|
||||
if ($_POST['cancel'])
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start);
|
||||
}
|
||||
|
||||
if ($_POST['save'])
|
||||
{
|
||||
$totalerrors = 0;
|
||||
|
||||
$app_order = $_POST['app_order'] ? $_POST['app_order'] : 0;
|
||||
$n_app_name = chop($_POST['n_app_name']);
|
||||
$n_app_status = $_POST['n_app_status'];
|
||||
|
||||
if ($this->bo->exists($n_app_name))
|
||||
{
|
||||
$error[$totalerrors++] = lang('That application name already exists.');
|
||||
}
|
||||
if (preg_match("/\D/",$app_order))
|
||||
{
|
||||
$error[$totalerrors++] = lang('That application order must be a number.');
|
||||
}
|
||||
if (!$n_app_name)
|
||||
{
|
||||
$error[$totalerrors++] = lang('You must enter an application name.');
|
||||
}
|
||||
|
||||
if (!$totalerrors)
|
||||
{
|
||||
$this->bo->add(array(
|
||||
'n_app_name' => $n_app_name,
|
||||
'n_app_status' => $n_app_status,
|
||||
'app_order' => $app_order
|
||||
));
|
||||
|
||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start);
|
||||
$GLOBALS['egw']->common->egw_exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->template->set_var('error','<p><center>' . $GLOBALS['egw']->common->error_list($error) . '</center><br>');
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // else submit
|
||||
$GLOBALS['egw']->template->set_var('error','');
|
||||
}
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Add new application');
|
||||
$GLOBALS['egw']->js->validate_file('jscode','openwindow','admin');
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$GLOBALS['egw']->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
|
||||
|
||||
$GLOBALS['egw']->template->set_var('hidden_vars','<input type="hidden" name="start" value="'.$start.'">');
|
||||
$GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiapplications.add'));
|
||||
|
||||
$this->display_row(lang('application name'),'<input name="n_app_name" value="' . $n_app_name . '">');
|
||||
|
||||
if(!isset($n_app_status))
|
||||
{
|
||||
$n_app_status = 1;
|
||||
}
|
||||
|
||||
$selected[$n_app_status] = ' selected';
|
||||
$status_html = '<option value="0"' . $selected[0] . '>' . lang('Disabled') . '</option>'
|
||||
. '<option value="1"' . $selected[1] . '>' . lang('Enabled') . '</option>'
|
||||
. '<option value="2"' . $selected[2] . '>' . lang('Enabled - Hidden from navbar') . '</option>'
|
||||
. '<option value="4"' . $selected[4] . '>' . lang('Enabled - Popup Window') . '</option>';
|
||||
$this->display_row(lang('Status'),'<select name="n_app_status">' . $status_html . '</select>');
|
||||
|
||||
if (!$app_order)
|
||||
{
|
||||
$app_order = $this->bo->app_order();
|
||||
}
|
||||
|
||||
$this->display_row(lang('Select which location this app should appear on the navbar, lowest (left) to highest (right)'),'<input name="app_order" value="' . $app_order . '">');
|
||||
|
||||
$GLOBALS['egw']->template->set_var('lang_save_button',lang('Add'));
|
||||
$GLOBALS['egw']->template->set_var('lang_cancel_button',lang('Cancel'));
|
||||
$GLOBALS['egw']->template->pparse('phpgw_body','form');
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('applications_access',4,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
$app_name = get_var('app_name',array('POST','GET'));
|
||||
$start = get_var('start',array('POST','GET'));
|
||||
|
||||
$GLOBALS['egw']->template->set_file(array('application' => 'application_form.tpl'));
|
||||
$GLOBALS['egw']->template->set_block('application','form','form');
|
||||
$GLOBALS['egw']->template->set_block('application','row','row');
|
||||
|
||||
if ($_POST['cancel'])
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start);
|
||||
}
|
||||
|
||||
if ($_POST['delete'])
|
||||
{
|
||||
return $this->delete();
|
||||
}
|
||||
|
||||
if ($_POST['save'])
|
||||
{
|
||||
$totalerrors = 0;
|
||||
|
||||
$app_order = $_POST['app_order'] ? $_POST['app_order'] : 0;
|
||||
$n_app_status = $_POST['n_app_status'];
|
||||
|
||||
if (! $totalerrors)
|
||||
{
|
||||
$this->bo->save(array(
|
||||
'n_app_status' => $n_app_status,
|
||||
'app_order' => $app_order,
|
||||
'app_name' => urldecode($app_name)
|
||||
));
|
||||
|
||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start);
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit application');
|
||||
$GLOBALS['egw']->js->validate_file('jscode','openwindow','admin');
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
if ($totalerrors)
|
||||
{
|
||||
$GLOBALS['egw']->template->set_var('error','<p><center>' . $GLOBALS['egw']->common->error_list($error) . '</center><br>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->template->set_var('error','');
|
||||
list($n_app_name,$n_app_title,$n_app_status,$old_app_name,$app_order) = $this->bo->read($app_name);
|
||||
}
|
||||
$GLOBALS['egw']->template->set_var('hidden_vars','<input type="hidden" name="start" value="'.$start.'">'.
|
||||
'<input type="hidden" name="app_name" value="' . $app_name . '">');
|
||||
$GLOBALS['egw']->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']);
|
||||
$GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiapplications.edit'));
|
||||
|
||||
$this->display_row(lang('application name'), $n_app_name );
|
||||
|
||||
$GLOBALS['egw']->template->set_var('lang_status',lang('Status'));
|
||||
$GLOBALS['egw']->template->set_var('lang_save_button',lang('Save'));
|
||||
$GLOBALS['egw']->template->set_var('lang_cancel_button',lang('Cancel'));
|
||||
$GLOBALS['egw']->template->set_var('lang_delete_button',lang('Delete'));
|
||||
|
||||
$selected[$n_app_status] = ' selected';
|
||||
$status_html = '<option value="0"' . $selected[0] . '>' . lang('Disabled') . '</option>'
|
||||
. '<option value="1"' . $selected[1] . '>' . lang('Enabled') . '</option>'
|
||||
. '<option value="2"' . $selected[2] . '>' . lang('Enabled - Hidden from navbar') . '</option>'
|
||||
. '<option value="4"' . $selected[4] . '>' . lang('Enabled - Popup Window') . '</option>';
|
||||
|
||||
$this->display_row(lang("Status"),'<select name="n_app_status">' . $status_html . '</select>');
|
||||
$this->display_row(lang("Select which location this app should appear on the navbar, lowest (left) to highest (right)"),'<input name="app_order" value="' . $app_order . '">');
|
||||
|
||||
$GLOBALS['egw']->template->set_var('select_status',$status_html);
|
||||
$GLOBALS['egw']->template->pparse('phpgw_body','form');
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('applications_access',8,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
$app_name = get_var('app_name',array('POST','GET'));
|
||||
$start = get_var('start',array('POST','GET'));
|
||||
|
||||
if (!$app_name || $_POST['no'] || $_POST['yes'])
|
||||
{
|
||||
if ($_POST['yes'])
|
||||
{
|
||||
$this->bo->delete($app_name);
|
||||
}
|
||||
$GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiapplications.get_list&start='.$start);
|
||||
}
|
||||
|
||||
$GLOBALS['egw']->template->set_file(array('body' => 'delete_common.tpl'));
|
||||
|
||||
$GLOBALS['egw']->js->validate_file('jscode','openwindow','admin');
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$GLOBALS['egw']->template->set_var('messages',lang('Are you sure you want to delete the application %1 ?',$GLOBALS['egw_info']['apps'][$app_name]['title']));
|
||||
$GLOBALS['egw']->template->set_var('no',lang('No'));
|
||||
$GLOBALS['egw']->template->set_var('yes',lang('Yes'));
|
||||
$GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiapplications.delete'));
|
||||
$GLOBALS['egw']->template->set_var('hidden_vars','<input type="hidden" name="start" value="'.$start.'">'.
|
||||
'<input type="hidden" name="app_name" value="'. urlencode($app_name) . '">');
|
||||
$GLOBALS['egw']->template->pparse('phpgw_body','body');
|
||||
}
|
||||
|
||||
function register_all_hooks()
|
||||
{
|
||||
if ($GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php');
|
||||
}
|
||||
$GLOBALS['egw']->hooks->register_all_hooks();
|
||||
|
||||
if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited
|
||||
{
|
||||
$GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session
|
||||
}
|
||||
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
||||
}
|
||||
}
|
||||
?>
|
@ -60,10 +60,12 @@
|
||||
$GLOBALS['acl_manager']['admin']['applications_access'] = array(
|
||||
'name' => 'Deny access to applications',
|
||||
'rights' => array(
|
||||
/* not usefull --> setup
|
||||
'Applications list' => 1,
|
||||
'Add application' => 2,
|
||||
'Edit application' => 4,
|
||||
'Delete application' => 8,
|
||||
*/
|
||||
'Register application hooks' => 16
|
||||
)
|
||||
); // added and working ralfbecker
|
||||
|
Loading…
Reference in New Issue
Block a user