2001-09-14 21:45:06 +02:00
< ? php
2005-10-14 19:03:16 +02:00
/************************************************************************** \
* 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$ */
2001-09-14 21:45:06 +02:00
class uiapplications
{
var $public_functions = array (
'get_list' => True ,
'add' => True ,
'edit' => True ,
2003-04-28 00:26:04 +02:00
'delete' => True ,
'register_all_hooks' => True
2001-09-14 21:45:06 +02:00
);
var $bo ;
var $nextmatchs ;
function uiapplications ()
{
2005-10-14 19:03:16 +02:00
$this -> bo =& CreateObject ( 'admin.boapplications' );
$this -> nextmatchs =& CreateObject ( 'phpgwapi.nextmatchs' );
2001-09-14 21:45:06 +02:00
}
function get_list ()
{
2005-10-14 19:03:16 +02:00
if ( $GLOBALS [ 'egw' ] -> acl -> check ( 'applications_access' , 1 , 'admin' ))
2003-08-28 16:16:30 +02:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' );
2003-08-28 16:16:30 +02:00
}
2005-10-14 19:03:16 +02:00
$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' );
2003-08-28 16:16:30 +02:00
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw_info' ][ 'flags' ][ 'app_header' ] = lang ( 'Admin' ) . ' - ' . lang ( 'Installed applications' );
if ( !@ is_object ( $GLOBALS [ 'egw' ] -> js ))
2004-02-26 10:01:42 +01:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js =& CreateObject ( 'phpgwapi.javascript' );
2004-02-26 10:01:42 +01:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js -> validate_file ( 'jscode' , 'openwindow' , 'admin' );
$GLOBALS [ 'egw' ] -> common -> egw_header ();
2003-08-28 16:16:30 +02:00
echo parse_navbar ();
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' );
2003-08-28 16:16:30 +02:00
$start = get_var ( 'start' , array ( 'POST' , 'GET' ));
$sort = $_GET [ 'sort' ];
$order = $_GET [ 'order' ];
2005-10-14 19:03:16 +02:00
$offset = $GLOBALS [ 'egw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'maxmatchs' ];
2001-09-14 21:45:06 +02:00
$apps = $this -> bo -> get_list ();
$total = count ( $apps );
$sort = $sort ? $sort : 'ASC' ;
2003-09-22 13:14:21 +02:00
uasort ( $apps , create_function ( '$a,$b' , 'return strcasecmp($a[\'title\'],$b[\'title\'])' . ( $sort != 'ASC' ? '* -1' : '' ) . ';' ));
2001-09-14 21:45:06 +02:00
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 ))
{
2003-10-29 05:36:43 +01:00
if ( $i >= $start && $i < $limit )
2001-09-14 21:45:06 +02:00
{
$applications [ $app ] = $data ;
}
$i ++ ;
}
2005-10-14 19:03:16 +02:00
$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' ]);
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' ));
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' ));
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' ));
2001-09-14 21:45:06 +02:00
2003-08-28 16:16:30 +02:00
foreach ( $applications as $app )
2001-09-14 21:45:06 +02:00
{
$tr_color = $this -> nextmatchs -> alternate_row_color ( $tr_color );
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'tr_color' , $tr_color );
$GLOBALS [ 'egw' ] -> template -> set_var ( 'name' , $app [ 'title' ]);
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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>' : ' ' );
2001-09-14 21:45:06 +02:00
if ( $app [ 'status' ])
{
$status = lang ( 'Yes' );
}
else
{
$status = '<b>' . lang ( 'No' ) . '</b>' ;
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'status' , $status );
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> parse ( 'rows' , 'row' , True );
2001-09-14 21:45:06 +02:00
}
2003-08-28 16:16:30 +02:00
if ( $can_add )
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> parse ( 'addbutton' , 'add' );
2003-08-28 16:16:30 +02:00
}
else
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'addbutton' , '' );
2003-08-28 16:16:30 +02:00
}
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> pparse ( 'out' , 'list' );
2001-09-14 21:45:06 +02:00
}
function display_row ( $label , $value )
{
2005-10-14 19:03:16 +02:00
$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 );
2001-09-14 21:45:06 +02:00
}
function add ()
{
2005-10-14 19:03:16 +02:00
if ( $GLOBALS [ 'egw' ] -> acl -> check ( 'applications_access' , 2 , 'admin' ))
2003-08-28 16:16:30 +02:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' );
2003-08-28 16:16:30 +02:00
}
$start = get_var ( 'start' , array ( 'POST' , 'GET' ));
2005-10-14 19:03:16 +02:00
$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' , '' );
2003-08-28 16:16:30 +02:00
if ( $_POST [ 'cancel' ])
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' , 'menuaction=admin.uiapplications.get_list&start=' . $start );
2003-08-28 16:16:30 +02:00
}
2001-09-14 21:45:06 +02:00
2003-08-28 16:16:30 +02:00
if ( $_POST [ 'save' ])
2001-09-14 21:45:06 +02:00
{
$totalerrors = 0 ;
2003-08-28 16:16:30 +02:00
$app_order = $_POST [ 'app_order' ] ? $_POST [ 'app_order' ] : 0 ;
$n_app_name = chop ( $_POST [ 'n_app_name' ]);
$n_app_status = $_POST [ 'n_app_status' ];
2001-09-14 21:45:06 +02:00
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 )
{
2001-09-14 21:53:24 +02:00
$this -> bo -> add ( array (
'n_app_name' => $n_app_name ,
'n_app_status' => $n_app_status ,
'app_order' => $app_order
));
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' , 'menuaction=admin.uiapplications.get_list&start=' . $start );
$GLOBALS [ 'egw' ] -> common -> egw_exit ();
2001-09-14 21:45:06 +02:00
}
else
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'error' , '<p><center>' . $GLOBALS [ 'egw' ] -> common -> error_list ( $error ) . '</center><br>' );
2001-09-14 21:45:06 +02:00
}
}
else
{ // else submit
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'error' , '' );
2001-09-14 21:45:06 +02:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw_info' ][ 'flags' ][ 'app_header' ] = lang ( 'Admin' ) . ' - ' . lang ( 'Add new application' );
if ( !@ is_object ( $GLOBALS [ 'egw' ] -> js ))
2004-02-26 10:01:42 +01:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js =& CreateObject ( 'phpgwapi.javascript' );
2004-02-26 10:01:42 +01:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js -> validate_file ( 'jscode' , 'openwindow' , 'admin' );
$GLOBALS [ 'egw' ] -> common -> egw_header ();
2003-08-28 16:16:30 +02:00
echo parse_navbar ();
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'th_bg' , $GLOBALS [ 'egw_info' ][ 'theme' ][ 'th_bg' ]);
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' ));
2001-09-14 21:45:06 +02:00
$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>'
2004-04-13 09:54:25 +02:00
. '<option value="2"' . $selected [ 2 ] . '>' . lang ( 'Enabled - Hidden from navbar' ) . '</option>'
. '<option value="4"' . $selected [ 4 ] . '>' . lang ( 'Enabled - Popup Window' ) . '</option>' ;
2001-09-14 21:45:06 +02:00
$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 . '">' );
2005-10-14 19:03:16 +02:00
$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' );
2001-09-14 21:45:06 +02:00
}
function edit ()
{
2005-10-14 19:03:16 +02:00
if ( $GLOBALS [ 'egw' ] -> acl -> check ( 'applications_access' , 4 , 'admin' ))
2003-08-28 16:16:30 +02:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' );
2003-08-28 16:16:30 +02:00
}
$app_name = get_var ( 'app_name' , array ( 'POST' , 'GET' ));
$start = get_var ( 'start' , array ( 'POST' , 'GET' ));
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' );
2001-09-14 21:45:06 +02:00
2003-08-28 16:16:30 +02:00
if ( $_POST [ 'cancel' ])
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' , 'menuaction=admin.uiapplications.get_list&start=' . $start );
2003-08-28 16:16:30 +02:00
}
if ( $_POST [ 'delete' ])
{
return $this -> delete ();
}
if ( $_POST [ 'save' ])
2001-09-14 21:45:06 +02:00
{
$totalerrors = 0 ;
2003-08-28 16:16:30 +02:00
$app_order = $_POST [ 'app_order' ] ? $_POST [ 'app_order' ] : 0 ;
$n_app_status = $_POST [ 'n_app_status' ];
2001-09-14 21:45:06 +02:00
if ( ! $totalerrors )
{
$this -> bo -> save ( array (
'n_app_status' => $n_app_status ,
'app_order' => $app_order ,
2004-05-07 18:49:17 +02:00
'app_name' => urldecode ( $app_name )
2001-09-14 21:45:06 +02:00
));
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' , 'menuaction=admin.uiapplications.get_list&start=' . $start );
2001-09-14 21:45:06 +02:00
}
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw_info' ][ 'flags' ][ 'app_header' ] = lang ( 'Admin' ) . ' - ' . lang ( 'Edit application' );
if ( !@ is_object ( $GLOBALS [ 'egw' ] -> js ))
2004-02-26 10:01:42 +01:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js =& CreateObject ( 'phpgwapi.javascript' );
2004-02-26 10:01:42 +01:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js -> validate_file ( 'jscode' , 'openwindow' , 'admin' );
$GLOBALS [ 'egw' ] -> common -> egw_header ();
2003-08-28 16:16:30 +02:00
echo parse_navbar ();
2001-09-14 21:45:06 +02:00
if ( $totalerrors )
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'error' , '<p><center>' . $GLOBALS [ 'egw' ] -> common -> error_list ( $error ) . '</center><br>' );
2001-09-14 21:45:06 +02:00
}
else
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'error' , '' );
2001-09-14 21:45:06 +02:00
list ( $n_app_name , $n_app_title , $n_app_status , $old_app_name , $app_order ) = $this -> bo -> read ( $app_name );
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'hidden_vars' , '<input type="hidden" name="start" value="' . $start . '">' .
2003-08-28 16:16:30 +02:00
'<input type="hidden" name="app_name" value="' . $app_name . '">' );
2005-10-14 19:03:16 +02:00
$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' ));
2001-09-14 21:45:06 +02:00
2004-05-07 18:49:17 +02:00
$this -> display_row ( lang ( 'application name' ), $n_app_name );
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
$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' ));
2001-09-14 21:45:06 +02:00
$selected [ $n_app_status ] = ' selected' ;
$status_html = '<option value="0"' . $selected [ 0 ] . '>' . lang ( 'Disabled' ) . '</option>'
. '<option value="1"' . $selected [ 1 ] . '>' . lang ( 'Enabled' ) . '</option>'
2004-04-13 09:54:25 +02:00
. '<option value="2"' . $selected [ 2 ] . '>' . lang ( 'Enabled - Hidden from navbar' ) . '</option>'
. '<option value="4"' . $selected [ 4 ] . '>' . lang ( 'Enabled - Popup Window' ) . '</option>' ;
2001-09-14 21:45:06 +02:00
$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 . '">' );
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_var ( 'select_status' , $status_html );
$GLOBALS [ 'egw' ] -> template -> pparse ( 'phpgw_body' , 'form' );
2001-09-14 21:45:06 +02:00
}
function delete ()
{
2005-10-14 19:03:16 +02:00
if ( $GLOBALS [ 'egw' ] -> acl -> check ( 'applications_access' , 8 , 'admin' ))
2001-09-14 21:45:06 +02:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' );
2001-09-14 21:45:06 +02:00
}
2003-08-28 16:16:30 +02:00
$app_name = get_var ( 'app_name' , array ( 'POST' , 'GET' ));
$start = get_var ( 'start' , array ( 'POST' , 'GET' ));
if ( ! $app_name || $_POST [ 'no' ] || $_POST [ 'yes' ])
2001-09-14 21:45:06 +02:00
{
2003-08-28 16:16:30 +02:00
if ( $_POST [ 'yes' ])
{
$this -> bo -> delete ( $app_name );
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' , 'menuaction=admin.uiapplications.get_list&start=' . $start );
2001-09-14 21:45:06 +02:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> set_file ( array ( 'body' => 'delete_common.tpl' ));
2001-09-14 21:45:06 +02:00
2005-10-14 19:03:16 +02:00
if ( !@ is_object ( $GLOBALS [ 'egw' ] -> js ))
2004-02-26 10:01:42 +01:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js =& CreateObject ( 'phpgwapi.javascript' );
2004-02-26 10:01:42 +01:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> js -> validate_file ( 'jscode' , 'openwindow' , 'admin' );
$GLOBALS [ 'egw' ] -> common -> egw_header ();
2003-08-28 16:16:30 +02:00
echo parse_navbar ();
2005-10-14 19:03:16 +02:00
$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 . '">' .
2003-08-28 16:16:30 +02:00
'<input type="hidden" name="app_name" value="' . urlencode ( $app_name ) . '">' );
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> template -> pparse ( 'phpgw_body' , 'body' );
2001-09-14 21:45:06 +02:00
}
2003-04-28 00:26:04 +02:00
function register_all_hooks ()
{
2005-10-14 19:03:16 +02:00
if ( $GLOBALS [ 'egw' ] -> acl -> check ( 'applications_access' , 16 , 'admin' ))
2003-08-28 16:16:30 +02:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/index.php' );
2003-08-28 16:16:30 +02:00
}
2005-10-14 19:03:16 +02:00
if ( ! is_object ( $GLOBALS [ 'egw' ] -> hooks ))
2003-04-28 00:26:04 +02:00
{
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> hooks =& CreateObject ( 'phpgwapi.hooks' );
2003-04-28 00:26:04 +02:00
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> hooks -> register_all_hooks ();
2003-04-28 00:26:04 +02:00
2006-04-06 09:53:44 +02:00
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
}
2005-10-14 19:03:16 +02:00
$GLOBALS [ 'egw' ] -> redirect_link ( '/admin/index.php' );
2003-04-28 00:26:04 +02:00
}
2001-09-14 21:45:06 +02:00
}
?>