- Always use chosen for calendar resource select

- Change sidebox/context add resource to always add a resource, never an accessory
- Fix link to calendar (planner) to open in calendar app/tab
This commit is contained in:
Nathan Gray 2012-12-05 19:25:32 +00:00
parent 661572206c
commit d14337da40
4 changed files with 13 additions and 10 deletions

View File

@ -34,6 +34,7 @@ class resources_hooks
{ {
$file['Add resource'] = "javascript:egw_openWindowCentered2('".egw::link('/index.php',array( $file['Add resource'] = "javascript:egw_openWindowCentered2('".egw::link('/index.php',array(
'menuaction' => 'resources.resources_ui.edit', 'menuaction' => 'resources.resources_ui.edit',
'accessory_of' => -1
),false)."','_blank',800,600,'yes')"; ),false)."','_blank',800,600,'yes')";
} }
display_sidebox($appname,$title,$file); display_sidebox($appname,$title,$file);

View File

@ -211,7 +211,7 @@ class resources_ui
), ),
'add' => array( 'add' => array(
'caption' => 'New resource', 'caption' => 'New resource',
'url' => 'menuaction=resources.resources_ui.edit', 'url' => 'menuaction=resources.resources_ui.edit&accessory_of=-1',
'popup' => egw_link::get_registry('resources', 'add_popup'), 'popup' => egw_link::get_registry('resources', 'add_popup'),
'group' => $group, 'group' => $group,
), ),
@ -308,7 +308,6 @@ class resources_ui
switch($action) switch($action)
{ {
case 'view-calendar': case 'view-calendar':
echo "window.location = '".egw::link('/index.php',$url_params);
$resource_ids = array(0); $resource_ids = array(0);
$url_params = array( $url_params = array(
'menuaction' => 'calendar.calendar_uiviews.planner', 'menuaction' => 'calendar.calendar_uiviews.planner',
@ -320,7 +319,7 @@ class resources_ui
} }
$url_params['owner'] = implode(',',$resource_ids); $url_params['owner'] = implode(',',$resource_ids);
$success = count($resource_ids); $success = count($resource_ids);
egw_framework::set_onload("window.location = '".egw::link('/index.php',$url_params).'\';'); egw_framework::set_onload('window.location.href = "'.egw::link('/index.php',$url_params,'calendar').'"');
$action_msg = lang('view calendar'); $action_msg = lang('view calendar');
break; break;
case 'book': case 'book':
@ -693,7 +692,7 @@ class resources_ui
} }
} }
// add already selected single resources to the selectbox, eg. call of the resource-calendar from the resources app // add already selected single resources to the selectbox, eg. call of the resource-calendar from the resources app
$resources = array('r0' => lang('none')); $resources = array();
$res_ids = array(); $res_ids = array();
foreach($owners as $key => $owner) foreach($owners as $key => $owner)
{ {
@ -703,6 +702,7 @@ class resources_ui
$selected[] = $owner; $selected[] = $owner;
} }
} }
// Take out resources not allowed by perms, above // Take out resources not allowed by perms, above
$res_ids = array_intersect($res_ids,$allowed_list); $res_ids = array_intersect($res_ids,$allowed_list);
if (count($res_ids)) if (count($res_ids))
@ -719,13 +719,15 @@ class resources_ui
$selected, $selected,
array_merge($resources,$res_cats), array_merge($resources,$res_cats),
$no_lang=true, $no_lang=true,
$options='style="width: 100%;" onchange="load_cal(\''. $options='data-placeholder="'.lang('select resources').'" style="width: 100%;" onchange="load_cal(\''.
egw::link('/index.php',$param,false).'\',\'uical_select_resource\',true);" id="uical_select_resource"', egw::link('/index.php',$param,false).'\',\'uical_select_resource\',true);" id="uical_select_resource"',
$multiple=count($selected) ? 4 : 0 $multiple=4,
true
); );
return array( return array(
array( array(
'text' => $selectbox, // Add some jQuery to make sure dropdown is displayed
'text' => $selectbox . "<script>\$j('select[name=\"owner\[\]\"]').parent('td').css('overflow','visible').parents('div.divSidebox').css('overflow','visible');</script>",
'no_lang' => True, 'no_lang' => True,
'link' => False 'link' => False
) )

File diff suppressed because one or more lines are too long

View File

@ -104,7 +104,7 @@
<description/> <description/>
</row> </row>
<row> <row>
<button align="center" statustext="Show calendar of resource" label="Show calendar of resource" id="calendar[$cont[res_id]]" onclick="location=egw::link('/index.php','menuaction=calendar.calendar_uiviews.planner&amp;sortby=user&amp;owner=0,r$cont[res_id]'); return false;" image="calendar/planner" ro_image="trans16x16"/> <button align="center" statustext="Show calendar of resource" label="Show calendar of resource" id="calendar[$cont[res_id]]" onclick="location=egw::link('/index.php','menuaction=calendar.calendar_uiviews.planner&amp;sortby=user&amp;owner=0,r$cont[res_id]','calendar'); return false;" image="calendar/planner" ro_image="trans16x16"/>
<button align="center" statustext="Delete this entry" label="Delete" id="delete[$cont[res_id]]" onclick="return confirm('Delete this entry');" image="delete" ro_image="trans16x16"/> <button align="center" statustext="Delete this entry" label="Delete" id="delete[$cont[res_id]]" onclick="return confirm('Delete this entry');" image="delete" ro_image="trans16x16"/>
<button align="center" statustext="View accessories for this resource" label="View accessories for this resource" id="view_acc[$cont[res_id]]" image="view_acc" ro_image="trans16x16"/> <button align="center" statustext="View accessories for this resource" label="View accessories for this resource" id="view_acc[$cont[res_id]]" image="view_acc" ro_image="trans16x16"/>
<checkbox align="right" id="checkbox[]" options="$cont[res_id]"/> <checkbox align="right" id="checkbox[]" options="$cont[res_id]"/>