diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php
index c7a3d34cd0..7b0f9cc0f5 100644
--- a/timesheet/inc/class.timesheet_ui.inc.php
+++ b/timesheet/inc/class.timesheet_ui.inc.php
@@ -85,6 +85,8 @@ class timesheet_ui extends timesheet_bo
'ts_owner' => $GLOBALS['egw_info']['user']['account_id'],
'cat_id' => (int) $_REQUEST['cat_id'],
'ts_status'=> $GLOBALS['egw_info']['user']['preferences']['timesheet']['predefined_status'],
+ 'ts_project' => $_REQUEST['ts_project'],
+ 'ts_title_blur' => $_REQUEST['ts_project'],
);
}
$matches = null;
@@ -97,7 +99,10 @@ class timesheet_ui extends timesheet_bo
$only_admin_edit = true;
$msg = lang('only Admin can edit this status');
}
- $this->data['ts_project_blur'] = $this->data['pm_id'] ? Link::title('projectmanager', $this->data['pm_id']) : '';
+ if(!$this->data['ts_project_blur'])
+ {
+ $this->data['ts_project_blur'] = $this->data['pm_id'] ? Link::title('projectmanager', $this->data['pm_id']) : '';
+ }
}
else
{
@@ -976,8 +981,7 @@ class timesheet_ui extends timesheet_bo
*/
'add' => array(
'caption' => 'Add',
- 'url' => 'menuaction=timesheet.timesheet_ui.edit',
- 'popup' => Link::get_registry('timesheet', 'add_popup'),
+ 'onExecute' => 'javaScript:app.timesheet.add_action_handler',
'group' => $group,
),
'cat' => Etemplate\Widget\Nextmatch::category_action(
diff --git a/timesheet/js/app.js b/timesheet/js/app.js
index 715bd98664..4a54d8596c 100644
--- a/timesheet/js/app.js
+++ b/timesheet/js/app.js
@@ -102,6 +102,60 @@ app.classes.timesheet = AppJS.extend(
}
},
+ /**
+ * Wrapper so add action in the context menu can pass current
+ * filter values into new edit dialog
+ *
+ * @see add_with_extras
+ *
+ * @param {egwAction} action
+ * @param {egwActionObject[]} selected
+ */
+ add_action_handler: function(action, selected)
+ {
+ var nm = action.getManager().data.nextmatch || false;
+ if(nm)
+ {
+ this.add_with_extras(nm);
+ }
+ },
+
+ /**
+ * Opens a new edit dialog with some extra url parameters pulled from
+ * nextmatch filters.
+ *
+ * @param {et2_widget} widget Originating/calling widget
+ */
+ add_with_extras: function(widget)
+ {
+ var nm = widget.getRoot().getWidgetById('nm');
+ var nm_value = nm.getValue() || {};
+
+ var extras = {};
+ if(nm_value.cat_id)
+ {
+ extras.cat_id = nm_value.cat_id;
+ }
+
+ if(nm_value.col_filter && nm_value.col_filter.linked)
+ {
+ var split = nm_value.col_filter.linked.split(':') || '';
+ extras.link_app = split[0] || '';
+ extras.link_id = split[1] || '';
+ }
+ if(nm_value.col_filter && nm_value.col_filter.pm_id)
+ {
+ extras.link_app = 'projectmanager';
+ extras.link_id = nm_value.col_filter.pm_id;
+ }
+ else if (nm_value.col_filter && nm_value.col_filter.ts_project)
+ {
+ extras.ts_project = nm_value.col_filter.ts_project;
+ }
+
+ egw.open('','timesheet','add',extras);
+ },
+
/**
* Change handler for project selection to set empty ts_project string, if project get deleted
*
diff --git a/timesheet/templates/default/index.xet b/timesheet/templates/default/index.xet
index fc56186632..638b361d4b 100644
--- a/timesheet/templates/default/index.xet
+++ b/timesheet/templates/default/index.xet
@@ -11,7 +11,7 @@
-
+