Skip to content

Commit

Permalink
These changes will break the constrains introduced by the
Browse files Browse the repository at this point in the history
default workflow.  We assume the workflow will be customized to
remove set ownere operation for reassign and accept actions.
  • Loading branch information
seanchen committed Jan 29, 2013
1 parent 1110cf7 commit 562c4ea
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
14 changes: 14 additions & 0 deletions wp-trac-client/actions.php
@@ -1,4 +1,5 @@
<?php
global $current_user;
/**
* a convenient function to handle form post.
*/
Expand All @@ -10,6 +11,15 @@ function wptc_form_submit() {
return;
}

if(!is_user_logged_in()) {

// user not logged in!
// TODO: error message
return;
}

// TODO: validate the reassign action

$comment =
wptc_widget_clean_textarea($_POST['wikicomment']);
$id = $_POST['id'];
Expand Down Expand Up @@ -82,6 +92,9 @@ function wptc_analyze_workflow_action() {
break;
case 'accept':
$attributes['status'] = 'accepted';
global $current_user;
// set owner to self.
$attributes['owner'] = $current_user->user_login;
break;
case 'resolve':
// resove to a resolution.
Expand All @@ -92,6 +105,7 @@ function wptc_analyze_workflow_action() {
case 'reassign':
// reassign to another person.
$attributes['status'] = 'assigned';
// set owner to selected user.
$attributes['owner'] =
$_POST['action_reassign_reassign_owner'];
break;
Expand Down
4 changes: 2 additions & 2 deletions wp-trac-client/templates/page-ticket-details.php
Expand Up @@ -51,11 +51,11 @@
<?php
// =========================================================
// debug message...
$DEBUG = False;
$DEBUG = True;
if ($DEBUG) {
global $post, $current_blog;
// dump the change log
$ticket = wptc_get_ticket($ticket_id);
$ticket = wptc_get_ticket_actions($ticket_id);
echo '<pre>';
var_dump($ticket);
echo '</pre>';
Expand Down
11 changes: 9 additions & 2 deletions wp-trac-client/widgets.php
Expand Up @@ -472,10 +472,17 @@ function wptc_widget_action_reassign($action) {
//$options = wptc_widget_options_html($fields[2], $fields[1]);
// the resolve is a select element.
// it will be disabled untile the radio button is selected.

// The following is the right one for default workflow,
// which has the **set_owner** operation for reassign
// action.
// <select name="{$fields[0]}" id="{$fields[0]}" disabled="">
// {$options}
// </select>
$select = <<<EOT
to
<input name="action_reassign_reassign_owner" id="action_reassign_reassign_owner" disabled="">
{$options}
<input name="action_reassign_reassign_owner"
id="action_reassign_reassign_owner" disabled="">
EOT;

return apply_filters('wptc_widget_action_reassign', $select);
Expand Down

0 comments on commit 562c4ea

Please sign in to comment.