- fixed selectwidget due to id -> res_id problems

- added book multiple functionality
- prevent booking of non-bookable resources
This commit is contained in:
Cornelius Weiß 2005-07-01 15:01:07 +00:00
parent 14d38f1667
commit 736ca322fe
4 changed files with 37 additions and 12 deletions

View File

@ -269,14 +269,14 @@ class bo_resources
/**
* returns status for a new calendar entry depending on resources ACL
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* @param int/array $res_id single id or array $num => $res_id
* @param int $res_id single id
* @return array
*/
function get_calendar_new_status($res_id)
{
$cat_id = $this->so->get_value('cat_id',$res_id);
$cat_admin = $this->acl->get_cat_admin($cat_id);
return $this->acl->is_permitted($cat_id,EGW_ACL_DIRECT_BOOKING) ? A : U;
$data = $this->so->search(array('res_id' => $res_id),'res_id,cat_id,bookable');
if($data[0]['bookable'] == 0) return 'x';
return $this->acl->is_permitted($data[0]['cat_id'],EGW_ACL_DIRECT_BOOKING) ? A : U;
}
/**

View File

@ -73,7 +73,7 @@
{
foreach(ExecMethod('resources.bo_resources.get_calendar_info',$value) as $data)
{
$sel_options[$data['id']] = $data['name'];
$sel_options[$data['res_id']] = $data['name'];
}
$tpl->set_cell_attribute('resources','sel_options',$sel_options);
}

View File

@ -51,7 +51,7 @@ class ui_resources
*/
function index($content='')
{
// _debug_array($content);
// _debug_array($content);
if (is_array($content))
{
$sessiondata = $content['nm'];
@ -122,6 +122,31 @@ class ui_resources
$no_button['back'] = true;
$no_button['add_sub'] = true;
$GLOBALS['egw_info']['flags']['app_header'] = lang('resources');
$GLOBALS['egw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\">
function js_btn_book_selected(form)
{
resources = '';
for (f=0; f < form.elements.length; f++)
{
element = form.elements[f];
if(element.name == 'exec[nm][rows][checkbox][]' && element.checked)
{
if(resources.length > 0)
{
resources += ',';
}
resources += 'r' + element.value;
}
}
if(resources.length == 0)
{
alert('". lang('No resources selected'). "');
return false;
}
return resources;
}
</script>";
if($content['nm']['view_accs_of'])
{
@ -217,7 +242,7 @@ class ui_resources
$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
}
// $content['general|page|pictures|links|calendar'] = 'resources.edit_tabs.page'; //debug
$content['general|page|pictures|links'] = 'resources.edit_tabs.page'; //debug
$no_button = array(); // TODO: show delete button only if allowed to delete resource
$preserv = $content;
$this->tmpl->read('resources.edit');

File diff suppressed because one or more lines are too long