X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=plugins.php;h=1c0a076bb2a18bdfe2ca6f9c6b5360a500abe072;hb=1e3383a77ff48e718b9571d323acc3e90170784d;hp=e036c17381e41410939effe6c1afdb2f8e975cc8;hpb=0c28ebb2ecb192d9d1976d86de7d1f24f109171d;p=timetracker.git diff --git a/plugins.php b/plugins.php index e036c173..1c0a076b 100644 --- a/plugins.php +++ b/plugins.php @@ -34,24 +34,9 @@ if (!ttAccessAllowed('manage_features')) { header('Location: access_denied.php'); exit(); } -if ($request->isPost()) { - $groupChanged = $request->getParameter('group_changed'); // Reused in multiple places below. - if ($groupChanged && !($user->can('manage_subgroups') && $user->isGroupValid($request->getParameter('group')))) { - header('Location: access_denied.php'); // Group changed, but no rght or wrong group id. - exit(); - } -} // End of access checks. -// Determine group for which we display this page. -if ($request->isPost() && $groupChanged) { - $group_id = $request->getParameter('group'); - $user->setOnBehalfGroup($group_id); -} else { - $group_id = $user->getGroup(); -} - -if ($request->isPost() && $request->getParameter('btn_save')) { +if ($request->isPost()) { // Plugins that user wants to save for the current group. $cl_charts = $request->getParameter('charts'); $cl_clients = $request->getParameter('clients'); @@ -66,6 +51,10 @@ if ($request->isPost() && $request->getParameter('btn_save')) { $cl_quotas = $request->getParameter('quotas'); $cl_week_view = $request->getParameter('week_view'); $cl_work_units = $request->getParameter('work_units'); + $cl_approval = $request->getParameter('approval'); + $cl_timesheets = $request->getParameter('timesheets'); + $cl_templates = $request->getParameter('templates'); + $cl_attachments = $request->getParameter('attachments'); } else { // Note: we get here in get, and also in post when group changes. // Which plugins do we have enabled in currently selected group? @@ -83,24 +72,14 @@ if ($request->isPost() && $request->getParameter('btn_save')) { $cl_quotas = in_array('mq', $plugins); $cl_week_view = in_array('wv', $plugins); $cl_work_units = in_array('wu', $plugins); + $cl_approval = in_array('ap', $plugins); + $cl_timesheets = in_array('ts', $plugins); + $cl_templates = in_array('tp', $plugins); + $cl_attachments = in_array('at', $plugins); } $form = new Form('pluginsForm'); -// Group dropdown. -if ($user->can('manage_subgroups')) { - $groups = $user->getGroupsForDropdown(); - if (count($groups) > 1) { - $form->addInput(array('type'=>'combobox', - 'onchange'=>'document.pluginsForm.group_changed.value=1;document.pluginsForm.submit();', - 'name'=>'group', - 'style'=>'width: 250px;', - 'value'=>$group_id, - 'data'=>$groups, - 'datakeys'=>array('id','name'))); - $form->addInput(array('type'=>'hidden','name'=>'group_changed')); - $smarty->assign('group_dropdown', 1); - } -} + // Plugin checkboxes. $form->addInput(array('type'=>'checkbox','name'=>'charts','value'=>$cl_charts)); $form->addInput(array('type'=>'checkbox','name'=>'clients','value'=>$cl_clients,'onchange'=>'handlePluginCheckboxes()')); @@ -115,15 +94,17 @@ $form->addInput(array('type'=>'checkbox','name'=>'locking','value'=>$cl_locking, $form->addInput(array('type'=>'checkbox','name'=>'quotas','value'=>$cl_quotas,'onchange'=>'handlePluginCheckboxes()')); $form->addInput(array('type'=>'checkbox','name'=>'week_view','value'=>$cl_week_view,'onchange'=>'handlePluginCheckboxes()')); $form->addInput(array('type'=>'checkbox','name'=>'work_units','value'=>$cl_work_units,'onchange'=>'handlePluginCheckboxes()')); +$form->addInput(array('type'=>'checkbox','name'=>'approval','value'=>$cl_approval)); +$form->addInput(array('type'=>'checkbox','name'=>'timesheets','value'=>$cl_timesheets)); +$form->addInput(array('type'=>'checkbox','name'=>'templates','value'=>$cl_templates,'onchange'=>'handlePluginCheckboxes()')); +$form->addInput(array('type'=>'checkbox','name'=>'attachments','value'=>$cl_attachments,'onchange'=>'handlePluginCheckboxes()')); + // Submit button. $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save'))); -if ($request->isPost() && $request->getParameter('btn_save')) { +if ($request->isPost()) { // Note: we get here when the Save button is clicked. - // We update plugin list for the currently selected group. - // - // We don't get here if group changed in post. - // In this case the page is simply re-displayed for new group. + // We update plugin list for the current group. // Prepare plugins string. if ($cl_charts) @@ -152,6 +133,14 @@ if ($request->isPost() && $request->getParameter('btn_save')) { $plugins .= ',wv'; if ($cl_work_units) $plugins .= ',wu'; + if ($cl_approval) + $plugins .= ',ap'; + if ($cl_timesheets) + $plugins .= ',ts'; + if ($cl_templates) + $plugins .= ',tp'; + if ($cl_attachments) + $plugins .= ',at'; // Recycle week view plugin options as they are not configured on this page. $existing_plugins = explode(',', $user->getPlugins()); @@ -174,6 +163,7 @@ if ($request->isPost() && $request->getParameter('btn_save')) { $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="handlePluginCheckboxes();"'); +$smarty->assign('user_exists', $user->exists()); $smarty->assign('title', $i18n->get('title.plugins')); $smarty->assign('content_page_name', 'plugins.tpl'); $smarty->display('index.tpl');