3 * Update Artifact Type Form
5 * Copyright 2010, FusionForge Team
6 * http://fusionforge.org
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once 'common/tracker/ArtifactWorkflow.class.php';
27 $efarr = $ath->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_STATUS));
28 if (count($efarr) === 0) {
30 $error_msg .= _('To create a workflow, you need first to create a custom field of type \'Status\'.');
31 } elseif (count($efarr) !== 1) {
34 $error_msg .= _('Internal error: Illegal number of status fields (WKFL01).');
37 $ath->adminHeader(array('title'=> _('Configure workflow'),
38 'pagename'=>'tracker_admin_customize_liste',
39 'titlevals'=>array($ath->getName())));
42 List of possible user built Selection Boxes for an ArtifactType
46 $keys=array_keys($efarr);
48 $field_name = $efarr[$field_id]['field_name'];
50 $atw = new ArtifactWorkflow($ath, $field_id);
52 $elearray = $ath->getExtraFieldElements($field_id);
57 <h2><?php printf(_('Allowed initial values for the %1$s field'), $field_name) ?></h2>
58 <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
59 <input type="hidden" name="field_id" value="<?php echo $field_id ?>" />
60 <input type="hidden" name="workflow" value="1" />
63 $from = _('From').' ';
65 $init = _('Initial values').' ';
68 $title_arr[]=_('From Value');
69 foreach ($elearray as $status) {
70 $title_arr[]=$status['element_name'];
72 echo $GLOBALS['HTML']->listTableTop($title_arr, false, ' ');
75 // Special treatement for the initial value (in the Submit form).
76 echo '<tr id="initval"><th style="text-align:left">'.$init.'</th>'."\n";
77 $next = $atw->getNextNodes('100');
78 foreach ($states as $s) {
79 $name = 'wk[100]['. $s['element_id'].']';
80 $value = in_array($s['element_id'], $next)? ' checked="checked"' : '';
81 $str = '<input type="checkbox" name="'.$name.'"'.$value.' />';
82 $str .= ' '.html_image('spacer.gif', 20, 20);
83 echo '<td class="align-center">'.$str.'</td>'."\n";
86 echo $GLOBALS['HTML']->listTableBottom();
88 $count=count($title_arr);
89 $totitle_arr = array();
90 for ($i=0; $i<$count; $i++) {
91 $totitle_arr[] = $title_arr[$i]? $to.$title_arr[$i] : '';
93 echo $GLOBALS['HTML']->listTableTop($totitle_arr, false, ' ');
96 foreach ($elearray as $status) {
97 echo '<tr id="configuring-'.$i++.'"><th style="text-align:left">'.$from.$status['element_name'].'</th>'."\n";
98 $next = $atw->getNextNodes($status['element_id']);
99 foreach ($states as $s) {
100 if ($status['element_id'] !== $s['element_id']) {
101 $name = 'wk['.$status['element_id'].']['. $s['element_id'].']';
102 $value = in_array($s['element_id'], $next)? ' checked="checked"' : '';
103 $str = '<input type="checkbox" name="'.$name.'"'.$value.' />';
105 $url = getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID().'&workflow_roles=1&from='.$status['element_id'].'&next='.$s['element_id'];
106 $str .= ' <a href="'.$url.'" title="Edit roles">'.html_image('ic/acl_roles20.png', 20, 20, array('alt'=>'Edit Roles')).'</a>';
108 $str .= ' '.html_image('spacer.gif', 20, 20);
111 $str = '<input type="checkbox" checked="checked" disabled="disabled" />';
112 $str .= ' '.html_image('spacer.gif', 20, 20);
114 echo '<td class="align-center">'.$str.'</td>'."\n";
118 echo $GLOBALS['HTML']->listTableBottom();
121 <div class="tips">Tip: Click on <?php echo html_image('ic/acl_roles20.png', 20, 20, array('alt'=> _('Edit Roles'))) ?> to configure allowed roles for a transition (all by default).</div>
123 <input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
128 $ath->footer(array());