ability to mark resource-categories to be used for locations or rooms, destinction is required for CalDAV

This commit is contained in:
Ralf Becker 2011-10-13 06:21:46 +00:00
parent 5cf9f585c2
commit 01e92100c4
6 changed files with 42 additions and 31 deletions

View File

@ -24,7 +24,7 @@ class resources_bo
/** /**
* Instance of resources so object * Instance of resources so object
* *
* @var so_resources * @var resources_so
*/ */
var $so; var $so;
/** /**

View File

@ -28,8 +28,8 @@ class ui_acl
function ui_acl() function ui_acl()
{ {
$this->bo =& createobject('resources.bo_acl',True); $this->bo = createobject('resources.bo_acl',True);
$this->nextmatchs =& createobject('phpgwapi.nextmatchs'); $this->nextmatchs = createobject('phpgwapi.nextmatchs');
$this->start = $this->bo->start; $this->start = $this->bo->start;
$this->query = $this->bo->query; $this->query = $this->bo->query;
$this->order = $this->bo->order; $this->order = $this->bo->order;
@ -46,10 +46,10 @@ class ui_acl
if ($_POST['btnDone']) if ($_POST['btnDone'])
{ {
$GLOBALS['egw']->redirect_link('/admin/index.php'); egw::redirect_link('/admin/index.php');
} }
$GLOBALS['egw']->common->egw_header(); common::egw_header();
echo parse_navbar(); echo parse_navbar();
if ($_POST['btnSave']) if ($_POST['btnSave'])
@ -59,6 +59,7 @@ class ui_acl
$this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id], $this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id],
$_POST['inputcalread'][$cat_id],$_POST['inputcalbook'][$cat_id],$_POST['inputadmin'][$cat_id]); $_POST['inputcalread'][$cat_id],$_POST['inputcalbook'][$cat_id],$_POST['inputadmin'][$cat_id]);
} }
config::save_value('location_cats', implode(',', $_POST['location_cats']), 'resources');
} }
$template =& CreateObject('phpgwapi.Template',EGW_APP_TPL); $template =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
$template->set_file(array('acl' => 'acl.tpl')); $template->set_file(array('acl' => 'acl.tpl'));
@ -74,7 +75,8 @@ class ui_acl
'lang_calread' => lang('Read Calendar permissions'), 'lang_calread' => lang('Read Calendar permissions'),
'lang_calbook' => lang('Direct booking permissions'), 'lang_calbook' => lang('Direct booking permissions'),
'lang_implies_book' => lang('implies booking permission'), 'lang_implies_book' => lang('implies booking permission'),
'lang_cat_admin' => lang('Categories admin') 'lang_cat_admin' => lang('Categories admin'),
'lang_locations_rooms' => lang('Locations / rooms'),
)); ));
$left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.ui_acl.acllist'); $left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.ui_acl.acllist');
@ -91,23 +93,28 @@ class ui_acl
'query' => $this->query, 'query' => $this->query,
)); ));
@reset($this->bo->cats); if ($this->bo->cats)
while (list(,$cat) = @each($this->bo->cats))
{ {
$this->rights = $this->bo->get_rights($cat['id']); $config = config::read('resources');
$location_cats = $config['location_cats'] ? explode(',', $config['location_cats']) : array();
foreach($this->bo->cats as $cat)
{
$this->rights = $this->bo->get_rights($cat['id']);
$tr_color = $this->nextmatchs->alternate_row_color($tr_color); $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
$template->set_var(array( $template->set_var(array(
'tr_color' => $tr_color, 'tr_color' => $tr_color,
'catname' => $cat['name'], 'catname' => $cat['name'],
'catid' => $cat['id'], 'catid' => $cat['id'],
'read' => $this->selectlist(EGW_ACL_READ), 'read' => $this->selectlist(EGW_ACL_READ),
'write' => $this->selectlist(EGW_ACL_ADD), 'write' => $this->selectlist(EGW_ACL_ADD),
'calread' => $this->selectlist(EGW_ACL_CALREAD), 'calread' => $this->selectlist(EGW_ACL_CALREAD),
'calbook' =>$this->selectlist(EGW_ACL_DIRECT_BOOKING), 'calbook' =>$this->selectlist(EGW_ACL_DIRECT_BOOKING),
'admin' => '<option value="" selected="1">'.lang('choose categories admin').'</option>'.$this->selectlist(EGW_ACL_CAT_ADMIN,true) 'admin' => '<option value="" selected="1">'.lang('choose categories admin').'</option>'.$this->selectlist(EGW_ACL_CAT_ADMIN,true),
)); 'location_checked' => in_array($cat['id'], $location_cats) ? 'checked="1"' : '',
$template->parse('Cblock','cat_list',True); ));
$template->parse('Cblock','cat_list',True);
}
} }
$template->pfp('out','acl',True); $template->pfp('out','acl',True);
} }
@ -140,7 +147,7 @@ class ui_acl
{ {
$selectlist .= ' selected="selected"'; $selectlist .= ' selected="selected"';
} }
$selectlist .= '>' . $GLOBALS['egw']->common->display_fullname($account['account_lid'],$account['account_firstname'], $selectlist .= '>' . common::display_fullname($account['account_lid'],$account['account_firstname'],
$account['account_lastname'],$account['account_id']) . '</option>' . "\n"; $account['account_lastname'],$account['account_id']) . '</option>' . "\n";
} }
} }
@ -150,6 +157,6 @@ class ui_acl
function deny() function deny()
{ {
echo '<p><center><b>'.lang('Access not permitted').'</b></center>'; echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
$GLOBALS['egw']->common->egw_exit(True); common::egw_exit(True);
} }
} }

View File

@ -18,7 +18,7 @@ category: resources de Kategorie
check all resources de Alle auswählen check all resources de Alle auswählen
choose categories admin resources de Wählen Sie einen Verwalter für diese Kategorie choose categories admin resources de Wählen Sie einen Verwalter für diese Kategorie
clear selection resources de Auswahl löschen clear selection resources de Auswahl löschen
configure access permissions resources de Zugangseinstellungen konfigurieren configure access permissions admin de Zugangseinstellungen konfigurieren
create new accessory for this resource resources de Neues Zubehör zu dieser Ressource hinzufügen create new accessory for this resource resources de Neues Zubehör zu dieser Ressource hinzufügen
create new links resources de Neue Verknüpfung erstellen create new links resources de Neue Verknüpfung erstellen
delete selected resources resources de Ausgewählte Ressourcen löschen delete selected resources resources de Ausgewählte Ressourcen löschen
@ -49,6 +49,7 @@ links resources de Verknüpfungen
location resources de Lagerort location resources de Lagerort
location of resource resources de Lagerort der Ressource location of resource resources de Lagerort der Ressource
location: resources de Lagerort: location: resources de Lagerort:
locations / rooms resources de Orte / Räume
name of resource resources de Name der Ressource name of resource resources de Name der Ressource
name: resources de Name: name: resources de Name:
no description available resources de Keine Beschreibung vorhanden no description available resources de Keine Beschreibung vorhanden
@ -95,6 +96,5 @@ web-site for this resource resources de Ausführliche Beschreibung der Ressource
where to find this resource? resources de Wo findet man diese Ressource? where to find this resource? resources de Wo findet man diese Ressource?
which category does this resource belong to? resources de Zu welcher Kategorie gehört diese Ressource? which category does this resource belong to? resources de Zu welcher Kategorie gehört diese Ressource?
write permissions resources de Schreiberechtigung write permissions resources de Schreiberechtigung
you are not permitted to edit this reource! resources de Sie haben keine Erlaubnis diese Ressource zu bearbeiten
you are not permitted to get information about this resource! resources de Sie haben keine Erlaubnis sich informationen über diese Ressource anzuschauen you are not permitted to get information about this resource! resources de Sie haben keine Erlaubnis sich informationen über diese Ressource anzuschauen
you chose more resources than available resources de Sie haben mehr Ressourcen ausgewählt als verfügbar sind you chose more resources than available resources de Sie haben mehr Ressourcen ausgewählt als verfügbar sind

View File

@ -60,6 +60,7 @@ links resources en Links
location resources en Location location resources en Location
location of resource resources en Location of resource location of resource resources en Location of resource
location: resources en Location: location: resources en Location:
locations / rooms resources en Locations / rooms
long description resources en Long description long description resources en Long description
manage mapping resources en Manage mapping manage mapping resources en Manage mapping
name of resource resources en Name of resource name of resource resources en Name of resource

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* eGroupWare - resources * eGroupWare - resources
* http://www.egroupware.org * http://www.egroupware.org
* *
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package resources * @package resources
@ -14,6 +14,9 @@ $resources_table_prefix = 'egw_resources';
// Add a general category for resources // Add a general category for resources
$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'General resources','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__); $GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'General resources','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__);
$cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id'); $cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id');
$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->cats_table,array('cat_parent' => 0, 'cat_owner' => categories::GLOBAL_ACCOUNT,'cat_access' => 'public','cat_appname' => 'resources','cat_name' => 'Locations','cat_description' => 'This category has been added by setup','last_mod' => time()),false,__LINE__,__FILE__);
$locations_cat_id = $GLOBALS['egw_setup']->db->get_last_insert_id($GLOBALS['egw_setup']->cats_table,'cat_id');
config::save_value('location_cats', $locations_cat_id, 'resources');
// Give default group all rights to this general cat // Give default group all rights to this general cat
$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
@ -21,8 +24,7 @@ $GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup);
$GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399); $GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399);
// Add two rooms to give user an idea of what resources is... // Add two rooms to give user an idea of what resources is...
$oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 1',$cat_id,1,'cat_src',-1)"); $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 1',$locations_cat_id,1,'cat_src',-1)");
$oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 2',$cat_id,1,'cat_src',-1)"); $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Meeting room 2',$locations_cat_id,1,'cat_src',-1)");
$res_id = $oProc->m_odb->get_last_insert_id($resources_table_prefix,'res_id'); $res_id = $oProc->m_odb->get_last_insert_id($resources_table_prefix,'res_id');
$oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Fixed Beamer',$cat_id,0,'cat_src',$res_id)"); $oProc->query("INSERT INTO {$resources_table_prefix} (name,cat_id,bookable,picture_src,accessory_of) VALUES ( 'Fixed Beamer',$cat_id,0,'cat_src',$res_id)");

View File

@ -33,8 +33,9 @@
<!-- BEGIN cat_list --> <!-- BEGIN cat_list -->
<tr bgcolor="{tr_color}"> <tr bgcolor="{tr_color}">
<td> <td>
{catname}<input type="hidden" name="catids[]" value="{catid}" /><br> &nbsp;{catname}<input type="hidden" name="catids[]" value="{catid}" /><br>
<select name="inputadmin[{catid}][]">{admin}</select> <select name="inputadmin[{catid}][]">{admin}</select><br>
<label><input type="checkbox" value="{catid}" name="location_cats[]" {location_checked} /> {lang_locations_rooms}</label>
</td> </td>
<td align="center"><select multiple="multiple" size="5" name="inputread[{catid}][]">{read}</select></td> <td align="center"><select multiple="multiple" size="5" name="inputread[{catid}][]">{read}</select></td>
<td align="center"><select multiple="multiple" size="5" name="inputwrite[{catid}][]">{write}</select></td> <td align="center"><select multiple="multiple" size="5" name="inputwrite[{catid}][]">{write}</select></td>