Exemplo n.º 1
0
 /**
  *  Display detail report form
  *
  *  @return void
  */
 function showReportForm()
 {
     $hp = Codendi_HTMLPurifier::instance();
     global $ath, $Language;
     $g = $ath->getGroup();
     $group_id = $g->getID();
     $atid = $ath->getID();
     $ath->adminHeader(array('title' => $Language->getText('tracker_include_report', 'modify_report'), 'help' => 'TrackerAdministration.html#TrackerReportSetting'));
     echo '<H2>' . $Language->getText('tracker_import_admin', 'tracker') . ' \'<a href="/tracker/admin/?group_id=' . (int) $group_id . '&atid=' . (int) $atid . '">' . $hp->purify(SimpleSanitizer::unsanitize($ath->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</a>\' -  ' . $Language->getText('tracker_include_report', 'modify_report') . ' \'' . $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML) . '\'</H2>';
     // display the table of all fields that can be included in the report
     // along with their current state in this report
     $title_arr = array();
     $title_arr[] = $Language->getText('tracker_include_report', 'field_label');
     $title_arr[] = $Language->getText('tracker_include_artifact', 'desc');
     $title_arr[] = $Language->getText('tracker_include_report', 'search_crit');
     $title_arr[] = $Language->getText('tracker_include_report', 'rank_search');
     $title_arr[] = $Language->getText('tracker_include_report', 'rep_col');
     $title_arr[] = $Language->getText('tracker_include_report', 'rank_repo');
     $title_arr[] = $Language->getText('tracker_include_report', 'col_width');
     echo '<FORM ACTION="/tracker/admin/" METHOD="POST">
                <INPUT TYPE="HIDDEN" NAME="func" VALUE="report">
                <INPUT TYPE="HIDDEN" NAME="update_report" VALUE="y">
                <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $atid . '">
                <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $group_id . '">
                <INPUT TYPE="HIDDEN" NAME="report_id" VALUE="' . (int) $this->report_id . '">
                <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="1">
                <B>' . $Language->getText('tracker_include_artifact', 'name') . ': </B>
                <INPUT TYPE="TEXT" NAME="rep_name" VALUE="' . $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML) . '" CLASS="textfield_small" MAXLENGTH="80">
                      &nbsp;&nbsp;&nbsp;&nbsp;<B>' . $Language->getText('tracker_include_report', 'scope') . ': </B>';
     $scope = $this->scope;
     if ($ath->userIsAdmin()) {
         echo '<SELECT ID="rep_scope" NAME="rep_scope" onchange="if (document.getElementById(\'rep_scope\').value == \'P\') {document.getElementById(\'rep_default\').disabled=false} else { document.getElementById(\'rep_default\').disabled=true;document.getElementById(\'rep_default\').checked=false }" >
                                     <OPTION VALUE="I"' . ($scope == 'I' ? 'SELECTED' : '') . '>' . $Language->getText('global', 'Personal') . '</OPTION>
                                     <OPTION VALUE="P"' . ($scope == 'P' ? 'SELECTED' : '') . '>' . $Language->getText('global', 'Project') . '</OPTION>
                                     </SELECT>';
         echo '&nbsp;&nbsp;&nbsp;&nbsp;<B>' . $Language->getText('tracker_include_report', 'default') . ':</B>' . '<INPUT TYPE="CHECKBOX" ID="rep_default" NAME="rep_default" ' . ($this->is_default == 1 ? 'CHECKED' : '') . ' ' . ($this->scope != 'P' ? 'DISABLED' : '') . '>';
     } else {
         echo ($scope == 'P' ? $Language->getText('global', 'Project') : $Language->getText('global', 'Personal')) . '<INPUT TYPE="HIDDEN" NAME="rep_scope" VALUE="' . $hp->purify($scope, CODENDI_PURIFIER_CONVERT_HTML) . '">';
         echo '&nbsp;&nbsp;&nbsp;&nbsp;<B>' . $Language->getText('tracker_include_report', 'default') . ':</B>' . '<INPUT TYPE="CHECKBOX" ID="rep_default" NAME="rep_default" ' . ($this->is_default == 1 ? 'CHECKED' : '') . ' DISABLED >';
     }
     echo '
                 <P>
                 <B>' . $Language->getText('tracker_include_artifact', 'desc') . ':</B>
                 <INPUT TYPE="TEXT" NAME="rep_desc" VALUE="' . $hp->purify($this->description, CODENDI_PURIFIER_CONVERT_HTML) . '" SIZE="50" MAXLENGTH="120">
                       <P>';
     echo html_build_list_table_top($title_arr);
     // Write all the fields, grouped by fieldsetset and ordered by rank.
     $i = 0;
     $aff = new ArtifactFieldFactory($ath);
     $art_fieldset_fact = new ArtifactFieldsetFactory($ath);
     $used_fieldsets = $art_fieldset_fact->getAllFieldSetsContainingUsedFields();
     // fetch list of used fieldsets for this artifact
     foreach ($used_fieldsets as $fieldset_id => $fieldset) {
         $used_fields = $fieldset->getAllUsedFields();
         echo '<TR class="fieldset_separator">';
         echo '<TD colspan="7">' . $fieldset->getLabel() . '</TD>';
         echo '</TR>';
         while (list($key, $field) = each($used_fields)) {
             // Do not show fields not used by the project
             if (!$field->isUsed()) {
                 continue;
             }
             // Do not show some special fields any way
             if ($field->isSpecial()) {
                 if ($field->getName() == 'group_id' || $field->getName() == 'comment_type_id') {
                     continue;
                 }
             }
             //Do not show unreadable fields
             if (!$ath->userIsAdmin() && !$field->userCanRead($group_id, $this->group_artifact_id)) {
                 continue;
             }
             $cb_search = 'CBSRCH_' . $field->getName();
             $cb_report = 'CBREP_' . $field->getName();
             $tf_search = 'TFSRCH_' . $field->getName();
             $tf_report = 'TFREP_' . $field->getName();
             $tf_colwidth = 'TFCW_' . $field->getName();
             $rep_field = null;
             if (isset($this->fields[$field->getName()])) {
                 $rep_field = $this->fields[$field->getName()];
             }
             if (!$rep_field) {
                 $rep_field = new ArtifactReportField();
             }
             $cb_search_chk = $rep_field->isShowOnQuery() ? 'CHECKED' : '';
             $cb_report_chk = $rep_field->isShowOnResult() ? 'CHECKED' : '';
             $tf_search_val = $rep_field->getPlaceQuery();
             $tf_report_val = $rep_field->getPlaceResult();
             $tf_colwidth_val = $rep_field->getColWidth();
             echo '<TR class="' . util_get_alt_row_color($i) . '">';
             echo "\n<td>" . $field->getLabel() . '</td>' . "\n<td>" . $field->getDescription() . '</td>' . "\n<td align=\"center\">" . '<input type="checkbox" name="' . $cb_search . '" value="1" ' . $cb_search_chk . ' ></td>' . "\n<td align=\"center\">" . '<input type="text" name="' . $tf_search . '" value="' . $tf_search_val . '" size="5" maxlen="5"></td>' . "\n<td align=\"center\">" . '<input type="checkbox" name="' . $cb_report . '" value="1" ' . $cb_report_chk . ' ></td>' . "\n<td align=\"center\">" . '<input type="text" name="' . $tf_report . '" value="' . $tf_report_val . '" size="5" maxlen="5"></td>' . "\n<td align=\"center\">" . '<input type="text" name="' . $tf_colwidth . '" value="' . $tf_colwidth_val . '" size="5" maxlen="5"></td>' . '</TR>';
             $i++;
         }
     }
     echo '</TABLE>' . '<P><CENTER><INPUT TYPE="SUBMIT" VALUE="' . $Language->getText('global', 'btn_submit') . '"></CENTER>' . '</FORM>';
 }
Exemplo n.º 2
0
<P>
<?php 
/*
	Delete this customer's responses in case they had back-arrowed
	Only do that for non anonymous users because if anonymous
	responses are allowed then they all have user_id = 0 and we don't
	want to delete them.
*/
if (user_isloggedin()) {
    $result = db_query("DELETE FROM survey_responses WHERE survey_id='{$survey_id}' AND group_id='{$group_id}' AND user_id='" . user_getid() . "'");
}
/*
	Select the questions for this survey
*/
$quest_array = explode(',', db_result($result_survey, 0, "survey_questions"));
$count = count($quest_array);
$now = time();
$sanitizer = new SimpleSanitizer();
for ($i = 0; $i < $count; $i++) {
    /*
    	Insert each form value into the responses table
    */
    $val = "_{$quest_array[$i]}";
    $value_sanitized = $sanitizer->sanitize(${$val});
    $sql = "INSERT INTO survey_responses (user_id,group_id,survey_id,question_id,response,date) " . "VALUES ('" . user_getid() . "','{$group_id}','{$survey_id}','{$quest_array[$i]}','" . $value_sanitized . "','{$now}')";
    $result = db_query($sql);
    if (!$result) {
        echo "<h1>" . $Language->getText('global', 'error') . "</h1>";
    }
}
survey_footer(array());
Exemplo n.º 3
0
/**
 * Prepare the column values in the artifact record
 *
 * @param ArtifactType (tracker) $at the tracker the artifact to prepare blelong to
 * @param array{ArtifactField} $fields the fields of the artifact to export 
 * @param int $group_artifact_id the tracker ID
 * @param array $record array 'field_name' => 'field_value'
 * @param string $export type of export ('csv' or 'database' : for date format, csv will take user preference, wheareas for database the format will be mysql format.)
 */
function prepare_artifact_record($at, $fields, $group_artifact_id, &$record, $export)
{
    global $datetime_fmt, $sys_lf, $Language;
    /* $record:          
          Input: a row from the artifact table (passed by reference.
          Output: the same row with values transformed for export
       */
    reset($fields);
    $line = '';
    while (list(, $field) = each($fields)) {
        if ($field->isSelectBox() || $field->isMultiSelectBox()) {
            $values = array();
            if ($field->isStandardField()) {
                $values[] = $record[$field->getName()];
            } else {
                $values = $field->getValues($record['artifact_id']);
            }
            $label_values = $field->getLabelValues($group_artifact_id, $values);
            $record[$field->getName()] = SimpleSanitizer::unsanitize(join(",", $label_values));
        } else {
            if ($field->isTextArea() || $field->isTextField() && $field->getDataType() == $field->DATATYPE_TEXT) {
                // all text fields converted from HTML to ASCII
                $record[$field->getName()] = prepare_textarea($record[$field->getName()]);
            } else {
                if ($field->isDateField()) {
                    // replace the date fields (unix time) with human readable dates that
                    // is also accepted as a valid format in future import
                    if ($record[$field->getName()] == '') {
                        // if date undefined then set datetime to 0. Ideally should
                        // NULL as well but if we pass NULL it is interpreted as a string
                        // later in the process
                        $record[$field->getName()] = '0';
                    } else {
                        if ($export == 'database') {
                            $record[$field->getName()] = format_date($datetime_fmt, $record[$field->getName()]);
                        } else {
                            $record[$field->getName()] = format_date(util_get_user_preferences_export_datefmt(), $record[$field->getName()]);
                        }
                    }
                } else {
                    if ($field->isFloat()) {
                        $record[$field->getName()] = number_format($record[$field->getName()], 2);
                    }
                }
            }
        }
    }
    // Follow ups
    $ah = new ArtifactHtml($at, $record['artifact_id']);
    $sys_lf_sav = $sys_lf;
    $sys_lf = "\n";
    $record['follow_ups'] = $ah->showFollowUpComments($at->Group->getID(), true, Artifact::OUTPUT_EXPORT);
    $sys_lf = $sys_lf_sav;
    // Dependencies
    $result = $ah->getDependencies();
    $rows = db_numrows($result);
    $dependent = '';
    for ($i = 0; $i < $rows; $i++) {
        $dependent_on_artifact_id = db_result($result, $i, 'is_dependent_on_artifact_id');
        $dependent .= $dependent_on_artifact_id . ",";
    }
    $record['is_dependent_on'] = $dependent !== '' ? substr($dependent, 0, strlen($dependent) - 1) : $Language->getText('global', 'none');
    //CC
    $cc_list = $ah->getCCList();
    $rows = db_numrows($cc_list);
    $cc = array();
    for ($i = 0; $i < $rows; $i++) {
        $cc_email = db_result($cc_list, $i, 'email');
        $cc[] = $cc_email;
    }
    $record['cc'] = implode(',', $cc);
}
Exemplo n.º 4
0
 function displayAdd($user_id)
 {
     global $art_field_fact, $art_fieldset_fact, $sys_max_size_attachment, $Language;
     $hp = Codendi_HTMLPurifier::instance();
     $fields_per_line = 2;
     // the column number is the number of field per line * 2 (label + value)
     // + the number of field per line -1 (a blank column between each pair "label-value" to give more space)
     $columns_number = $fields_per_line * 2 + ($fields_per_line - 1);
     $max_size = 40;
     $group = $this->ArtifactType->getGroup();
     $group_artifact_id = $this->ArtifactType->getID();
     $group_id = $group->getGroupId();
     $result_fieldsets = $art_fieldset_fact->getAllFieldSetsContainingUsedFields();
     // Display submit informations if any
     if ($this->ArtifactType->getSubmitInstructions()) {
         echo $hp->purify(util_unconvert_htmlspecialchars($this->ArtifactType->getSubmitInstructions()), CODENDI_PURIFIER_FULL);
     }
     // Beginning of the submission form with fixed fields
     echo '<FORM ACTION="" METHOD="POST" enctype="multipart/form-data" NAME="artifact_form">
             <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="' . $sys_max_size_attachment . '">
             <INPUT TYPE="HIDDEN" NAME="func" VALUE="postadd">
             <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $group_id . '">
             <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $group_artifact_id . '">';
     echo '<TABLE><TR><TD class="artifact">';
     $pm = ProjectManager::instance();
     $html = '';
     $html .= '  <TABLE width="100%">
             <TR><TD VALIGN="TOP" COLSPAN="' . $columns_number . '">
                       <B>' . $Language->getText('tracker_include_artifact', 'group') . ':</B>&nbsp;' . $hp->purify(util_unconvert_htmlspecialchars($pm->getProject($group_id)->getPublicName()), CODENDI_PURIFIER_CONVERT_HTML) . '</TD></TR>';
     // Now display the variable part of the field list (depend on the project)
     foreach ($result_fieldsets as $fieldset_id => $result_fieldset) {
         // this variable will tell us if we have to display the fieldset or not (if there is at least one field to display or not)
         $display_fieldset = false;
         $fieldset_html = '';
         $i = 0;
         $fields_in_fieldset = $result_fieldset->getAllUsedFields();
         while (list($key, $field) = each($fields_in_fieldset)) {
             $field_html = new ArtifactFieldHtml($field);
             // if the field is a special field (except summary and original description)
             // or if not used by this project  then skip it.
             // Plus only show fields allowed on the artifact submit_form
             if (!$field->isSpecial() || $field->getName() == 'summary' || $field->getName() == 'details') {
                 if ($field->userCanSubmit($group_id, $group_artifact_id, $user_id)) {
                     // display the artifact field with its default value
                     // if field size is greatest than max_size chars then force it to
                     // appear alone on a new line or it won't fit in the page
                     // if the user can submit at least one field, we can display the fieldset this field is within
                     $display_fieldset = true;
                     $field_value = $field->getDefaultValue();
                     list($sz, ) = $field->getGlobalDisplaySize();
                     $label = $field_html->labelDisplay(false, false, true);
                     $value = $field_html->display($group_artifact_id, $field_value, false, false);
                     $star = $field->isEmptyOk() ? '' : '<span class="highlight"><big>*</big></b></span>';
                     if ($sz > $max_size || $field->getName() == 'details') {
                         $fieldset_html .= "\n<TR>" . '<TD valign="top"><a class="artifact_field_tooltip" href="#" title="' . $hp->purify(SimpleSanitizer::unsanitize($field->getDescription()), CODENDI_PURIFIER_CONVERT_HTML) . '">' . $label . $star . '</a></td>' . '<TD valign="middle" colspan="' . ($columns_number - 1) . '">' . $value . '</TD>' . "\n</TR>";
                         $i = 0;
                     } else {
                         $fieldset_html .= $i % $fields_per_line ? '' : "\n<TR>";
                         $fieldset_html .= '<TD valign="middle"><a class="artifact_field_tooltip" href="#" title="' . $hp->purify(SimpleSanitizer::unsanitize($field->getDescription()), CODENDI_PURIFIER_CONVERT_HTML) . '">' . $label . $star . '</a></td>' . '<TD valign="middle">' . $value . '</TD>';
                         $i++;
                         $fieldset_html .= $i % $fields_per_line ? '<td class="artifact_spacer">&nbsp;</td>' : "\n</TR>";
                     }
                 }
             }
         }
         // while
         // We display the fieldset only if there is at least one field inside that we can display
         if ($display_fieldset) {
             $html .= '<TR><TD COLSPAN="' . (int) $columns_number . '">&nbsp</TD></TR>';
             $html .= '<TR class="boxtitle"><TD class="left" COLSPAN="' . (int) $columns_number . '">&nbsp;<span title="' . $hp->purify(SimpleSanitizer::unsanitize($result_fieldset->getDescriptionText()), CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify(SimpleSanitizer::unsanitize($result_fieldset->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</span></TD></TR>';
             $html .= $fieldset_html;
         }
     }
     $html .= '</TABLE>';
     echo $this->_getSection('artifact_section_details', $Language->getText('tracker_include_artifact', 'details'), $html, true);
     //
     // CC List
     //
     $html = '';
     $html .= $Language->getText('tracker_include_artifact', 'fill_cc_list_msg');
     $html .= $Language->getText('tracker_include_artifact', 'fill_cc_list_lbl');
     $html .= '<textarea type="text" name="add_cc" id="tracker_cc" rows="2" cols="60" wrap="soft"></textarea>';
     $html .= '<B>&nbsp;&nbsp;&nbsp;' . $Language->getText('tracker_include_artifact', 'fill_cc_list_cmt') . ":&nbsp</b>";
     $html .= '<input type="text" name="cc_comment" size="40" maxlength="255">';
     echo $this->_getSection('artifact_section_cc', $Language->getText('tracker_include_artifact', 'cc_list') . ' ' . help_button('tracker-v3.html#cc-list'), $html, true);
     //
     // File attachments
     //
     $html = '';
     $html .= '<input type="file" name="input_file" size="40">';
     $html .= $Language->getText('tracker_include_artifact', 'upload_file_msg', formatByteToMb($sys_max_size_attachment));
     $html .= $Language->getText('tracker_include_artifact', 'upload_file_desc');
     $html .= '<input type="text" name="file_description" size="60" maxlength="255">';
     echo $this->_getSection('artifact_section_attachments', $Language->getText('tracker_include_artifact', 'attachment') . ' ' . help_button('tracker-v3.html#artifact-attachments'), $html, true);
     //
     // Artifact permissions
     //
     if ($this->ArtifactType->userIsAdmin()) {
         $checked = '';
         if ($this->useArtifactPermissions()) {
             $checked = 'checked="checked"';
         }
         $html = '';
         $html .= '<p>';
         $html .= '<label class="checkbox" for="use_artifact_permissions"><input type="hidden" name="use_artifact_permissions_name" value="0" />';
         $html .= '<input type="checkbox" name="use_artifact_permissions_name" id="use_artifact_permissions" value="1" ' . $checked . ' />';
         $html .= $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_label') . '</label>';
         $html .= '</p>';
         $html .= permission_fetch_selection_field('TRACKER_ARTIFACT_ACCESS', $this->getId(), $group_id);
         $html .= '<script type="text/javascript">';
         $html .= "\n            document.observe('dom:loaded', function() {\n                if ( ! \$('use_artifact_permissions').checked) {\n                    \$('ugroups').disable();\n                }\n                \$('use_artifact_permissions').observe('click', function(evt) {\n                    if (this.checked) {\n                        \$('ugroups').enable();\n                    } else {\n                        \$('ugroups').disable();\n                    }\n                });\n            });\n            </script>";
         echo $this->_getSection('artifact_section_permissions', $Language->getText('tracker_include_artifact', 'permissions') . ' ' . help_button('tracker-v3.html#permissions-on-artifacts'), $html, false, $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_use_default'));
     }
     //
     // Final submit button
     //
     echo '<p><B><span class="highlight">' . $Language->getText('tracker_include_artifact', 'check_already_submitted') . '</b></p>';
     echo '<div style="text-align:center"><INPUT CLASS="btn btn-primary" TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_artifact', 'submit') . '"></div>';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
 }
Exemplo n.º 5
0
require_once 'common/tracker/ArtifactFieldSetFactory.class.php';
require_once 'common/tracker/ArtifactFieldSet.class.php';
require_once 'common/tracker/ArtifactCanned.class.php';
require_once 'common/tracker/ArtifactFieldFactory.class.php';
require_once 'common/tracker/ArtifactField.class.php';
require_once 'common/tracker/ArtifactReport.class.php';
require_once 'common/tracker/ArtifactReportFactory.class.php';
require_once 'common/tracker/ArtifactReportField.class.php';
require_once 'common/tracker/Artifact.class.php';
require_once 'common/reference/ReferenceManager.class.php';
require_once '../include/ArtifactTypeHtml.class.php';
require_once '../include/ArtifactCannedHtml.class.php';
require_once '../include/ArtifactReportHtml.class.php';
require_once '../include/ArtifactHtml.class.php';
require_once 'common/include/SimpleSanitizer.class.php';
$sanitizer = new SimpleSanitizer();
$request =& HTTPRequest::instance();
$group_id = $request->getValidated('group_id', 'GroupId');
$atid = $request->getValidated('atid', 'uint');
$hp = Codendi_HTMLPurifier::instance();
if ($group_id && !$atid) {
    //
    // Manage trackers: create and delete
    //
    //	get the Group object
    //
    $pm = ProjectManager::instance();
    $group = $pm->getProject($group_id);
    if (!$group || !is_object($group) || $group->isError()) {
        exit_no_group();
    }
Exemplo n.º 6
0
 private function getSelectBoxForTV3($requested_template_id, $radio, array $trackers_v3, $label)
 {
     $html = '';
     $hp = Codendi_HTMLPurifier::instance();
     $html .= '<h3><label>' . $radio . $label . '</label></h3>';
     $html .= '<div class="tracker_create_mode">';
     $checked = $requested_template_id ? '' : 'checked="checked"';
     foreach ($trackers_v3 as $tracker_v3) {
         $html .= '<p>';
         $html .= '<label>';
         if ($requested_template_id == $tracker_v3->getID()) {
             $checked = 'checked="checked"';
         }
         $html .= '<input type="radio" name="tracker_new_tv3" value="' . $tracker_v3->getID() . '" ' . $checked . ' />';
         $html .= $hp->purify(SimpleSanitizer::unsanitize($tracker_v3->getName()), CODENDI_PURIFIER_CONVERT_HTML);
         $html .= '</label>';
         $html .= '</p>';
         $checked = '';
     }
     $html .= '</div>';
     return $html;
 }
 /**
  * Send a notification
  *
  * @param array  $recipients the list of recipients
  * @param array  $headers    the additional headers
  * @param string $subject    the subject of the message
  * @param string $htmlBody   the html content of the message
  * @param string $txtBody    the text content of the message
  *
  * @return void
  */
 protected function sendNotification($recipients, $headers, $subject, $htmlBody, $txtBody)
 {
     $mail = new Codendi_Mail();
     $hp = Codendi_HTMLPurifier::instance();
     $breadcrumbs = array();
     $groupId = $this->getTracker()->getGroupId();
     $project = $this->getTracker()->getProject();
     $trackerId = $this->getTracker()->getID();
     $artifactId = $this->getArtifact()->getID();
     $breadcrumbs[] = '<a href="' . get_server_url() . '/projects/' . $project->getUnixName(true) . '" />' . $project->getPublicName() . '</a>';
     $breadcrumbs[] = '<a href="' . get_server_url() . '/plugins/tracker/?tracker=' . (int) $trackerId . '" />' . $hp->purify(SimpleSanitizer::unsanitize($this->getTracker()->getName())) . '</a>';
     $breadcrumbs[] = '<a href="' . get_server_url() . '/plugins/tracker/?aid=' . (int) $artifactId . '" />' . $hp->purify($this->getTracker()->getName() . ' #' . $artifactId) . '</a>';
     $mail->getLookAndFeelTemplate()->set('breadcrumbs', $breadcrumbs);
     $mail->getLookAndFeelTemplate()->set('title', $hp->purify($subject));
     $mail->setFrom($GLOBALS['sys_noreply']);
     $mail->addAdditionalHeader("X-Codendi-Project", $this->getArtifact()->getTracker()->getProject()->getUnixName());
     $mail->addAdditionalHeader("X-Codendi-Tracker", $this->getArtifact()->getTracker()->getItemName());
     $mail->addAdditionalHeader("X-Codendi-Artifact-ID", $this->getId());
     foreach ($headers as $header) {
         $mail->addAdditionalHeader($header['name'], $header['value']);
     }
     $mail->setTo(implode(', ', $recipients));
     $mail->setSubject($subject);
     if ($htmlBody) {
         $mail->setBodyHTML($htmlBody);
     }
     $mail->setBodyText($txtBody);
     $mail->send();
 }
Exemplo n.º 8
0
 /**
  * Export muc logs of project $group_id
  * using monitoring openfire's plugin
  */
 function export_muc_logs()
 {
     $request = HTTPRequest::instance();
     $group_id = $request->get('group_id');
     $pm = ProjectManager::instance();
     $project = $pm->getProject($group_id);
     $any = $GLOBALS['Language']->getText('global', 'any');
     if ($request->exist('log_start_date')) {
         $start_date = $request->get('log_start_date');
         if ($start_date == '') {
             $start_date = $any;
         }
     } else {
         $week_ago = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
         $start_date = date("Y-m-d", $week_ago);
     }
     $end_date = $request->get('log_end_date');
     if ($end_date == '') {
         $end_date = $any;
     }
     $mclm = IMMucLogManager::getMucLogManagerInstance();
     $conversations = null;
     try {
         if ($start_date == $any && $end_date == $any) {
             $conversations = $mclm->getLogsByGroupName($project->getUnixName(true));
         } elseif ($start_date == $any && $end_date != $any) {
             $conversations = $mclm->getLogsByGroupNameBeforeDate($project->getUnixName(true), $end_date);
         } elseif ($start_date != $any && $end_date == $any) {
             $conversations = $mclm->getLogsByGroupNameAfterDate($project->getUnixName(true), $start_date);
         } else {
             $conversations = $mclm->getLogsByGroupNameBetweenDates($project->getUnixName(true), $start_date, $end_date);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $eol = "\n";
     $col_list = array('date', 'nickname', 'message');
     $lbl_list = array('date' => $GLOBALS['Language']->getText('plugin_im', 'muc_logs_time'), 'nickname' => $GLOBALS['Language']->getText('plugin_im', 'muc_logs_user'), 'message' => $GLOBALS['Language']->getText('plugin_im', 'muc_logs_message'));
     $purifier = Codendi_HTMLPurifier::instance();
     $uh = new UserHelper();
     $file_name = 'muc_logs_' . $project->getUnixName();
     header('Content-Type: text/csv');
     header('Content-Disposition: filename=' . $file_name . '.csv');
     if (!$conversations || sizeof($conversations) == 0) {
         echo $GLOBALS['Language']->getText('plugin_im', 'no_muc_logs');
     } else {
         // Build CSV header
         foreach ($lbl_list as $k => $v) {
             $lbl_list[$k] = SimpleSanitizer::unsanitize($v);
         }
         echo build_csv_header($col_list, $lbl_list) . $eol;
         // Build CSV content
         foreach ($conversations as $conv) {
             $time = format_date(util_get_user_preferences_export_datefmt(), $conv->getTimestamp());
             if ($conv->getNickname() != null) {
                 $nick = $conv->getNickname();
             } else {
                 $nick = '';
             }
             $message = $conv->getMessage();
             echo build_csv_record($col_list, array('date' => $time, 'nickname' => $nick, 'message' => $message)) . $eol;
         }
     }
 }
Exemplo n.º 9
0
<?php

//
// Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
//
// $$
//
//
//  Written for Codendi by Marc Nazarian
//
if (!user_isloggedin()) {
    exit_not_logged_in();
    return;
}
if (!$ath->userIsAdmin()) {
    exit_permission_denied();
    return;
}
// Check if this tracker is valid (not deleted)
if (!$ath->isValid()) {
    exit_error($Language->getText('global', 'error'), $Language->getText('tracker_add', 'invalid'));
}
$ath->adminHeader(array('title' => $Language->getText('tracker_admin_fieldset', 'tracker_admin') . $Language->getText('tracker_admin_fieldset', 'fieldset_admin'), 'help' => 'TrackerAdministration.html#TrackerFieldSetsManagement'));
$hp = Codendi_HTMLPurifier::instance();
echo '<H2>' . $Language->getText('tracker_import_admin', 'tracker') . ' \'<a href="/tracker/admin/?group_id=' . (int) $group_id . '&atid=' . (int) $atid . '">' . $hp->purify(SimpleSanitizer::unsanitize($ath->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</a>\' ' . $Language->getText('tracker_admin_fieldset', 'fieldset_admin') . '</H2>';
$ath->displayFieldSetList();
$ath->displayFieldSetCreateForm();
$ath->footer(array());
Exemplo n.º 10
0
 /**
  *  Display the different Canned Responses associated to this tracker
  *
  *  @return void
  */
 function displayCannedResponses()
 {
     global $Language;
     $group_id = $this->ArtifactType->Group->getID();
     $atid = $this->ArtifactType->getID();
     $hp = Codendi_HTMLPurifier::instance();
     echo '<H2>' . $Language->getText('tracker_import_admin', 'tracker') . ' \'<a href="/tracker?group_id=' . (int) $group_id . '&atid=' . (int) $atid . '">' . $hp->purify(SimpleSanitizer::unsanitize($this->ArtifactType->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</a>\' - ' . $Language->getText('tracker_admin_index', 'create_modify_cannedresponse') . '</a></H2>';
     $result = $this->ArtifactType->getCannedResponses();
     $rows = db_numrows($result);
     echo "<P>";
     if ($result && $rows > 0) {
         /*
         Links to update pages
         */
         echo "\n<H3>" . $Language->getText('tracker_include_canned', 'existing_responses') . "</H3><P>";
         $title_arr = array();
         $title_arr[] = $Language->getText('tracker_include_canned', 'title');
         $title_arr[] = $Language->getText('tracker_include_canned', 'body_extract');
         $title_arr[] = $Language->getText('tracker_include_canned', 'delete');
         echo html_build_list_table_top($title_arr);
         $atid = $this->ArtifactType->getID();
         $g = $this->ArtifactType->getGroup();
         $group_id = $g->getID();
         for ($i = 0; $i < $rows; $i++) {
             echo '<TR class="' . util_get_alt_row_color($i) . '">' . '<TD><A HREF="/tracker/admin?func=canned&update_canned=1&artifact_canned_id=' . (int) db_result($result, $i, 'artifact_canned_id') . '&atid=' . (int) $atid . '&group_id=' . (int) $group_id . '">' . $hp->purify(util_unconvert_htmlspecialchars(db_result($result, $i, 'title')), CODENDI_PURIFIER_CONVERT_HTML) . '</A></TD>' . '<TD>' . $hp->purify(util_unconvert_htmlspecialchars(substr(db_result($result, $i, 'body'), 0, 160)), CODENDI_PURIFIER_CONVERT_HTML) . '<b>...</b></TD>' . '<td align="center"><A HREF="/tracker/admin/?func=canned&delete_canned=1&artifact_canned_id=' . (int) db_result($result, $i, 'artifact_canned_id') . '&atid=' . (int) $atid . '&group_id=' . (int) $group_id . '" onClick="return confirm(\'' . addslashes($Language->getText('tracker_include_canned', 'delete_canned', db_result($result, $i, 'title'))) . '\')">' . '<img src="' . util_get_image_theme("ic/trash.png") . '" border="0"></A></td></TR>';
         }
         echo '</TABLE>';
     } else {
         echo "\n<H3>" . $Language->getText('tracker_include_canned', 'no_canned_response') . "</H3>";
     }
 }
Exemplo n.º 11
0
//
if (!user_isloggedin()) {
    exit_not_logged_in();
    return;
}
if (!$ath->userIsAdmin()) {
    exit_permission_denied();
    return;
}
// Check if this tracker is valid (not deleted)
if (!$ath->isValid()) {
    exit_error($Language->getText('global', 'error'), $Language->getText('tracker_add', 'invalid'));
}
$ath->adminHeader(array('title' => $Language->getText('tracker_admin_field_usage', 'tracker_admin') . $Language->getText('tracker_admin_field_values_details', 'values_admin'), 'help' => 'tracker-v3.html#browsing-tracker-field-values'));
$hp = Codendi_HTMLPurifier::instance();
echo "<H2>" . $Language->getText('tracker_import_admin', 'tracker') . ' \'<a href="/tracker/admin/?group_id=' . (int) $group_id . "&atid=" . (int) $atid . '">' . $hp->purify(SimpleSanitizer::unsanitize($ath->getName()), CODENDI_PURIFIER_CONVERT_HTML) . "</a>'" . $Language->getText('tracker_admin_field_values_details', 'manage_for', $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML)) . "</H2>";
if (!$field->isSelectBox() && !$field->isMultiSelectBox()) {
    $ath->displayDefaultValueForm($field_id, $field->getDefaultValue());
} else {
    $val_func = $field->getValueFunction();
    if (isset($val_func[0]) && $val_func[0]) {
        $ath->displayValueFunctionForm($field_id, $val_func);
        $ath->displayDefaultValueFunctionForm($field_id, $field->getDefaultValue(), $val_func);
    } else {
        $ath->displayFieldValuesList($field_id);
        $ath->displayDefaultValueForm($field_id, $field->getDefaultValue());
        // For severity field, we don't display the Bind form or the Create Form
        if ($field->getName() != "severity" && $field->getName() != "status_id" || user_is_super_user()) {
            echo '<hr>';
            $ath->displayFieldValueForm("value_create", $field_id);
            $ath->displayValueFunctionForm($field_id, NULL, $Language->getText('global', 'or'));
Exemplo n.º 12
0
 /**
  * set the predefined values of the field parsed at column column_number
  */
 function setPredefinedValue($field, $column_number)
 {
     if ($field && ($field->getDisplayType() == "SB" || $field->getDisplayType() == "MB")) {
         //special case for submitted by
         if ($field->getName() == "submitted_by") {
             // simply put nothing in predefined values for submitted_by
             // as we accept all logged users, even None for allow-anon trackers
             //for all other fields not submitted by
         } else {
             $predef_val = $field->getFieldPredefinedValues($this->ath->getID());
             $count = db_numrows($predef_val);
             for ($i = 0; $i < $count; $i++) {
                 $values[SimpleSanitizer::unsanitize(db_result($predef_val, $i, 1))] = db_result($predef_val, $i, 0);
             }
             $this->predefined_values[$column_number] = $values;
         }
     }
 }
Exemplo n.º 13
0
 /**
  * trackerlist_to_soap : return the soap ArrayOfTracker structure giving an array of PHP Tracker Object.
  * @access private
  *
  * WARNING : We check the permissions here : only the readable trackers are returned.
  *
  * @param array of Object{Tracker} $tf_arr the array of ArtifactTrackers to convert.
  * @return array the SOAPArrayOfTracker corresponding to the array of Trackers Object
  */
 private function trackerlist_to_soap($tf_arr, PFUser $user)
 {
     $return = array();
     foreach ($tf_arr as $tracker_id => $tracker) {
         // Check if this tracker is active (not deleted)
         if (!$tracker->isActive()) {
             return new SoapFault(get_tracker_fault, 'This tracker is no longer valid.', 'getTrackerList');
         }
         // Check if the user can view this tracker
         if ($tracker->userCanView($user)) {
             // get the reports description (light desc of reports)
             //$report_fact = new ArtifactReportFactory();
             /* if (!$report_fact || !is_object($report_fact)) {
                return new SoapFault(get_artifact_type_fault, 'Could Not Get ArtifactReportFactory', 'getArtifactTrackers');
                }
                $reports_desc = artifactreportsdesc_to_soap($report_fact->getReports($at_arr[$i]->data_array['group_artifact_id'], $user_id)); */
             $return[] = array('tracker_id' => $tracker->getId(), 'group_id' => $tracker->getGroupID(), 'name' => SimpleSanitizer::unsanitize($tracker->getName()), 'description' => SimpleSanitizer::unsanitize($tracker->getDescription()), 'item_name' => $tracker->getItemName());
         }
     }
     return $return;
 }
 protected function displaySubmitJavascript()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $html = '<script type="text/javascript">';
     $html .= "codendi.tracker.fields.add('" . (int) $this->getID() . "', '" . $this->getName() . "', '" . $hp->purify(SimpleSanitizer::unsanitize($this->getLabel()), CODENDI_PURIFIER_JS_QUOTE) . "')";
     $default_value = $this->getDefaultValue();
     $values = $this->getBind()->getAllValues();
     $html .= "\n\t.addOption('" . $hp->purify(SimpleSanitizer::unsanitize('None'), CODENDI_PURIFIER_JS_QUOTE) . "'.escapeHTML(), '100', " . ($default_value == 100 ? 'true' : 'false') . ")";
     foreach ($values as $id => $value) {
         $html .= "\n\t.addOption('" . $hp->purify(SimpleSanitizer::unsanitize($value->getLabel()), CODENDI_PURIFIER_JS_QUOTE) . "'.escapeHTML(), '" . (int) $id . "', " . ($id == $default_value ? 'true' : 'false') . ")";
     }
     $html .= ";\n";
     $html .= '</script>';
     return $html;
 }
Exemplo n.º 15
0
 function artifactCC_to_soap($group_id, $group_artifact_id, $artifact_id, $artifact_cc_list)
 {
     $return = array();
     $rows = db_numrows($artifact_cc_list);
     for ($i = 0; $i < $rows; $i++) {
         // retrieve the field, for permission checks
         $return[] = array('artifact_cc_id' => db_result($artifact_cc_list, $i, 'artifact_cc_id'), 'artifact_id' => $artifact_id, 'email' => db_result($artifact_cc_list, $i, 'email'), 'added_by' => db_result($artifact_cc_list, $i, 'added_by'), 'added_by_name' => db_result($artifact_cc_list, $i, 'user_name'), 'comment' => SimpleSanitizer::unsanitize(db_result($artifact_cc_list, $i, 'comment')), 'date' => db_result($artifact_cc_list, $i, 'date'));
     }
     return $return;
 }
Exemplo n.º 16
0
require_once 'common/tracker/ArtifactFieldSetFactory.class.php';
require_once 'common/tracker/ArtifactField.class.php';
require_once 'common/tracker/ArtifactFieldFactory.class.php';
require_once 'common/tracker/ArtifactReportFactory.class.php';
require_once 'common/tracker/ArtifactReport.class.php';
require_once 'common/tracker/ArtifactReportField.class.php';
require_once './include/ArtifactFieldHtml.class.php';
require_once './include/ArtifactReportHtml.class.php';
require_once './include/ArtifactImportHtml.class.php';
require_once 'www/project/admin/permissions.php';
require_once 'common/include/SimpleSanitizer.class.php';
$aid = $request->getValidated('aid', 'uint', 0);
$atid = $request->getValidated('atid', 'uint', 0);
$group_id = $request->getValidated('group_id', 'GroupId', 0);
$em = EventManager::instance();
$sanitizer = new SimpleSanitizer();
$hp = Codendi_HTMLPurifier::instance();
if ($aid && !$atid) {
    // We have the artifact id, but not the tracker id
    $sql = "SELECT group_artifact_id FROM artifact WHERE artifact_id= " . db_ei($aid);
    $result = db_query($sql);
    if (db_numrows($result) > 0) {
        $row = db_fetch_array($result);
        $atid = $row['group_artifact_id'];
    }
}
if ($atid && !$group_id) {
    // We have the artifact group id, but not the group id
    $sql = "SELECT group_id FROM artifact_group_list WHERE group_artifact_id=" . db_ei($atid);
    $result = db_query($sql);
    if (db_numrows($result) > 0) {
 /**
  * 
  *  Check whether empty values are allowed for the bug fields
  *
  *  @param Array   $field_array   associative array of field_name -> value
  *  @param Boolean $showFeedback default value set to true, manage the display or not of the error message with reference to the field label 
  *
  *	@return	boolean
  */
 function checkEmptyFields($field_array, $showFeedback = true)
 {
     global $Language;
     $bad_fields = array();
     reset($field_array);
     while (list($key, $val) = each($field_array)) {
         //Those fields are automatically filled out
         if ($key != 'artifact_id' && $key != 'open_date' && $key != 'last_update_date') {
             $field = $this->getFieldFromName($key);
             if ($field) {
                 if ($field->isMultiSelectBox()) {
                     $is_empty = implode(",", $val) == "100";
                 } else {
                     $is_empty = $field->isSelectBox() ? $val == 100 : $val == '';
                 }
                 if ($is_empty && !$field->isEmptyOk()) {
                     $bad_fields[] = $field->getLabel();
                 }
             }
         }
     }
     if (count($bad_fields) > 0) {
         $hp = Codendi_HTMLPurifier::instance();
         $bad_fields_escaped = array();
         foreach ($bad_fields as $f) {
             $bad_fields_escaped[] = $hp->purify(SimpleSanitizer::unsanitize($f), CODENDI_PURIFIER_CONVERT_HTML);
         }
         if ($showFeedback) {
             $GLOBALS['Response']->addFeedback('error', $Language->getText('tracker_common_field_factory', 'missing', join(', ', $bad_fields_escaped)), CODENDI_PURIFIER_DISABLED);
             $this->setError($Language->getText('tracker_common_field_factory', 'missing', join(', ', $bad_fields)));
         }
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 18
0
        $result = db_query($q);
        $all_results[] = $result;
        $rows = db_numrows($result);
    }
} else {
    $result = db_query($sql);
    $rows = db_numrows($result);
}
if ($export == 'artifact') {
    // Send the result in CSV format
    if ($result && $rows > 0) {
        $tbl_name = str_replace(' ', '_', 'artifact_' . $at->getItemName());
        header('Content-Type: text/csv');
        header('Content-Disposition: filename=' . $tbl_name . '_' . $dbname . '.csv');
        foreach ($lbl_list as $k => $v) {
            $lbl_list[$k] = SimpleSanitizer::unsanitize($v);
        }
        echo build_csv_header($col_list, $lbl_list) . $eol;
        if ($multiple_queries) {
            $multiarr = array();
            for ($i = 0; $i < $rows; $i++) {
                foreach ($all_results as $result) {
                    $multiarr = array_merge($multiarr, db_fetch_array($result));
                }
                prepare_artifact_record($ath, $fields, $atid, $multiarr, 'csv');
                echo build_csv_record($col_list, $multiarr) . $eol;
            }
        } else {
            while ($arr = db_fetch_array($result)) {
                prepare_artifact_record($at, $fields, $atid, $arr, 'csv');
                echo build_csv_record($col_list, $arr) . $eol;
Exemplo n.º 19
0
 function artifactfile_to_soap($file_id, $attachedfiles_arr, $set_bin_data)
 {
     $return = null;
     $rows = db_numrows($attachedfiles_arr);
     for ($i = 0; $i < $rows; $i++) {
         $file = array();
         $file['id'] = db_result($attachedfiles_arr, $i, 'id');
         $file['artifact_id'] = db_result($attachedfiles_arr, $i, 'artifact_id');
         $file['filename'] = db_result($attachedfiles_arr, $i, 'filename');
         $file['description'] = SimpleSanitizer::unsanitize(db_result($attachedfiles_arr, $i, 'description'));
         if ($set_bin_data) {
             $bin_data = db_result($attachedfiles_arr, $i, 'bin_data');
             $file['bin_data'] = $bin_data;
         }
         $file['filesize'] = db_result($attachedfiles_arr, $i, 'filesize');
         $file['filetype'] = db_result($attachedfiles_arr, $i, 'filetype');
         $file['adddate'] = db_result($attachedfiles_arr, $i, 'adddate');
         $file['submitted_by'] = db_result($attachedfiles_arr, $i, 'user_name');
         if ($file['id'] == $file_id) {
             $return = $file;
         }
     }
     return $return;
 }
 function displayChooseSourceAndTarget($engine, $request, $current_user, $source_field_id)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $this->tracker->displayAdminItemHeader($engine, 'dependencies');
     echo '<p>' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'inline_help') . '</p>';
     echo '<form action="' . TRACKER_BASE_URL . '/?" method="GET">';
     echo '<input type="hidden" name="tracker" value="' . (int) $this->tracker->id . '" />';
     echo '<input type="hidden" name="func" value="admin-dependencies" />';
     //source
     $source_field = $this->form_element_factory->getFormElementById($source_field_id);
     if (!$source_field) {
         echo '<select name="source_field" onchange="this.form.submit()">';
         echo '<option value="0">' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'choose_source_field') . '</option>';
         $sources = $this->getAllSourceFields(null);
         foreach ($sources as $id => $field) {
             echo '<option value="' . $id . '">';
             echo $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML);
             echo '</option>';
         }
         echo '</select>';
     } else {
         echo '<input type="hidden" name="source_field" value="' . $source_field_id . '" />';
         echo $source_field->getLabel();
     }
     echo ' &rarr; ';
     //target
     $disabled = '';
     if (!$source_field) {
         $disabled = 'disabled="disabled" readonly="readonly"';
     }
     echo '<select name="target_field" ' . $disabled . '>';
     echo '<option value="0">' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'choose_target_field') . '</option>';
     if ($source_field) {
         $sources = $this->getAllTargetFields($source_field_id);
         foreach ($sources as $id => $field) {
             echo '<option value="' . $id . '">';
             echo $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML);
             echo '</option>';
         }
     }
     echo '</select>';
     echo ' <input type="submit" name="choose_source" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />';
     echo '</form>';
     //Shortcut
     $sources_targets = $this->getRuleFactory()->getInvolvedFieldsByTrackerId($this->tracker->id);
     if (count($sources_targets)) {
         $dependencies = array();
         foreach ($sources_targets as $row) {
             if ($source = $this->form_element_factory->getFormElementById($row['source_field_id'])) {
                 if ($target = $this->form_element_factory->getFormElementById($row['target_field_id'])) {
                     $d = '<a href="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-dependencies', 'source_field' => $row['source_field_id'], 'target_field' => $row['target_field_id'])) . '">';
                     $d .= $source->getLabel() . ' &rarr; ' . $target->getLabel();
                     $d .= '</a>';
                     $dependencies[] = $d;
                 }
             }
         }
         if ($dependencies) {
             echo '<p>' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'choose_existing_dependency') . '</p>';
             echo '<ul><li>' . implode('</li><li>', $dependencies) . '</li></ul>';
         }
         echo '</ul>';
     }
     $this->tracker->displayFooter($engine);
 }
Exemplo n.º 21
0
  <tr class="boxtable"> 
    <td class="boxtitle">&nbsp;</td>
    <td class="boxtitle"> 
      <div align="center"><b>' . $Language->getText('tracker_import_admin', 'art_data_import') . '</b></div>
    </td>
    <td class="boxtitle"> 
      <div align="center"><b>' . $Language->getText('tracker_import_admin', 'import_format') . '</b></div>
    </td>
 </tr>';
        // Get the artfact type list
        $at_arr = $atf->getArtifactTypes();
        if ($at_arr && count($at_arr) >= 1) {
            for ($j = 0; $j < count($at_arr); $j++) {
                echo '
		  <tr class="' . util_get_alt_row_color($j) . '"> 
		    <td><b>' . $Language->getText('tracker_import_admin', 'tracker') . ': ' . $hp->purify(SimpleSanitizer::unsanitize($at_arr[$j]->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</b></td>
		    <td align="center">
                      <a href="/tracker/index.php?group_id=' . (int) $group_id . '&atid=' . (int) $at_arr[$j]->getID() . '&user_id=' . (int) user_getid() . '&func=import">' . $Language->getText('tracker_import_admin', 'import') . '</a>
		    </td>
		    <td align="center"> 
		      <a href="/tracker/index.php?group_id=' . (int) $group_id . '&atid=' . (int) $at_arr[$j]->getID() . '&user_id=' . (int) user_getid() . '&mode=showformat&func=import">' . $Language->getText('tracker_import_admin', 'show_format') . '</a>
		    </td>
		  </tr>';
            }
        }
        echo '</TABLE>';
        project_admin_footer(array());
    }
} else {
    exit_missing_param();
}
Exemplo n.º 22
0
 // Get the artfact type list
 $at_arr = $atf->getArtifactTypes();
 if (!$at_arr || count($at_arr) < 1) {
     $no_rows = 1;
     echo '<H2>' . $Language->getText('search_index', 'no_match_found', htmlentities(stripslashes($words), ENT_QUOTES, 'UTF-8')) . '</H2>';
 } else {
     for ($i = 0; $i < count($at_arr); $i++) {
         $atid = $at_arr[$i]->getID();
         $array = explode(" ", $words);
         $words1 = implode($array, "%' {$crit} artifact.details LIKE '%");
         $words2 = implode($array, "%' {$crit} artifact.summary LIKE '%");
         $words3 = implode($array, "%' {$crit} artifact_history.new_value LIKE '%");
         $sql = "SELECT SQL_CALC_FOUND_ROWS artifact.artifact_id,\n                               artifact.summary,\n                               artifact.open_date,\n                               user.user_name\n                       FROM artifact INNER JOIN user ON user.user_id=artifact.submitted_by \n                          LEFT JOIN artifact_history ON artifact_history.artifact_id=artifact.artifact_id \n                          LEFT JOIN permissions ON (permissions.object_id = CAST(artifact.artifact_id AS CHAR) AND permissions.permission_type = 'TRACKER_ARTIFACT_ACCESS')\n                       WHERE artifact.group_artifact_id='" . db_ei($atid) . "' \n                         AND (\n                               artifact.use_artifact_permissions = 0\n                               OR \n                               (\n                                   permissions.ugroup_id IN (" . implode(',', $current_user->getUgroups($group_id, $atid)) . ")\n                               )\n                         )\n                         AND (\n                               (artifact.details LIKE '%" . db_es($words1) . "%') \n                               OR \n                               (artifact.summary LIKE '%" . db_es($words2) . "%') \n                               OR \n                               (artifact_history.field_name='comment' AND (artifact_history.new_value LIKE '%" . db_es($words3) . "%'))\n                         ) \n                       GROUP BY open_date DESC, artifact.artifact_id DESC \n                       LIMIT " . db_ei($offset) . ", 25";
         $result = db_query($sql);
         if ($rows_returned = db_result(db_query('SELECT FOUND_ROWS() as nb'), 0, 'nb')) {
             echo '<h3>' . $hp->purify(SimpleSanitizer::unsanitize($at_arr[$i]->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</h3>';
             $art_field_fact = new ArtifactFieldFactory($at_arr[$i]);
             $title_arr = array();
             $summary_field = $art_field_fact->getFieldFromName("summary");
             if ($summary_field->userCanRead($group_id, $atid)) {
                 $title_arr[] = $Language->getText('search_index', 'artifact_summary');
             }
             $submitted_field = $art_field_fact->getFieldFromName("submitted_by");
             if ($submitted_field->userCanRead($group_id, $atid)) {
                 $title_arr[] = $Language->getText('search_index', 'submitted_by');
             }
             $date_field = $art_field_fact->getFieldFromName("open_date");
             if ($date_field->userCanRead($group_id, $atid)) {
                 $title_arr[] = $Language->getText('search_index', 'date');
             }
             $status_field = $art_field_fact->getFieldFromName("status_id");
Exemplo n.º 23
0
 protected function displayCSVImportOverview($project, $group_id, $user)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $breadcrumbs = array();
     $toolbar = array();
     $this->displayHeader($project, $GLOBALS['Language']->getText('plugin_tracker', 'trackers'), $breadcrumbs, $toolbar);
     $html = '';
     $tf = TrackerFactory::instance();
     $trackers = $tf->getTrackersByGroupId($group_id);
     // Show all the fields currently available in the system
     echo '<table width="100%" border="0" cellspacing="1" cellpadding="2">';
     echo ' <tr class="boxtable">';
     echo '  <td class="boxtitle">&nbsp;</td>';
     echo '  <td class="boxtitle">';
     echo '   <div align="center"><b>' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'art_data_import') . '</b></div>';
     echo '  </td>';
     echo '  <td class="boxtitle">';
     echo '   <div align="center"><b>' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'import_format') . '</b></div>';
     echo '  </td>';
     echo ' </tr>';
     $cpt = 0;
     foreach ($trackers as $tracker) {
         if ($tracker->userIsAdmin($user)) {
             echo '<tr class="' . util_get_alt_row_color($cpt) . '">';
             echo ' <td><b>' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'tracker') . ': ' . $hp->purify(SimpleSanitizer::unsanitize($tracker->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</b></td>';
             echo ' <td align="center"><a href="' . TRACKER_BASE_URL . '/?tracker=' . (int) $tracker->getID() . '&func=admin-csvimport">' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'import') . '</a></td>';
             echo ' <td align="center"><a href="' . TRACKER_BASE_URL . '/?tracker=' . (int) $tracker->getID() . '&func=csvimport-showformat">' . $GLOBALS['Language']->getText('plugin_tracker_import_admin', 'show_format') . '</a></td>';
             echo '</tr>';
         }
     }
     echo '</table>';
     $this->displayFooter($project);
 }
Exemplo n.º 24
0
 /**
  * Display the list of attached files
  *
  * @param group_id: the group id
  * @param group_artifact_id: the artifact type ID
  * @param ascii: ascii mode
  *
  * @return void
  */
 function showAttachedFiles($group_id, $group_artifact_id, $ascii = false, $pv = 0)
 {
     global $Language;
     $hp = $this->getHtmlPurifier();
     //
     //  show the files attached to this artifact
     //
     $result = $this->getAttachedFiles();
     $rows = db_numrows($result);
     // No file attached -> return now
     if ($rows <= 0) {
         if ($ascii) {
             $out = $Language->getText('tracker_include_artifact', 'no_file_attached') . $GLOBALS['sys_lf'];
         } else {
             $out = '<H4>' . $Language->getText('tracker_include_artifact', 'no_file_attached') . '</H4>';
         }
         return $out;
     }
     // Header first
     if ($ascii) {
         $out = $Language->getText('tracker_include_artifact', 'file_attachment') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'file_attachment')));
     } else {
         $title_arr = array();
         $title_arr[] = $Language->getText('tracker_include_artifact', 'name');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'desc');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'size_kb');
         $title_arr[] = $Language->getText('global', 'by');
         $title_arr[] = $Language->getText('tracker_include_artifact', 'posted_on');
         if ($pv == 0) {
             $title_arr[] = $Language->getText('tracker_include_canned', 'delete');
         }
         $out = html_build_list_table_top($title_arr);
     }
     // Determine what the print out format is based on output type (Ascii, HTML)
     if ($ascii) {
         $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %s  " . $Language->getText('tracker_include_artifact', 'name') . ": %s  " . $Language->getText('tracker_include_artifact', 'size') . ": %dKB   " . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s" . $GLOBALS['sys_lf'] . "%s";
     } else {
         $fmt = "" . $GLOBALS['sys_lf'] . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td><td align="center">%s</td><td align="center">%s</td>';
         if ($pv == 0) {
             $fmt .= '<td align="center">%s</td>';
         }
         $fmt .= '</tr>';
     }
     // Determine which protocl to use for embedded URL in ASCII format
     $server = get_server_url();
     // Loop throuh the attached files and format them
     for ($i = 0; $i < $rows; $i++) {
         $artifact_file_id = db_result($result, $i, 'id');
         $href = "/tracker/download.php?artifact_id=" . (int) $this->getID() . "&id=" . (int) $artifact_file_id;
         if ($ascii) {
             $out .= sprintf($fmt, format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), db_result($result, $i, 'filename'), intval(db_result($result, $i, 'filesize') / 1024), db_result($result, $i, 'user_name'), SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), $server . $href);
         } else {
             // show CC delete icon if one of the condition is met:
             // (a) current user is group member
             // (b) the current user is the person who added a gieven name in CC list
             if (user_ismember($this->ArtifactType->getGroupID()) || user_getname(user_getid()) == db_result($result, $i, 'user_name')) {
                 $html_delete = '<a href="?func=delete_file&group_id=' . (int) $group_id . "&atid=" . (int) $group_artifact_id . "&aid=" . (int) $this->getID() . "&id=" . (int) db_result($result, $i, 'id') . '" ' . ' onClick="return confirm(\'' . $Language->getText('tracker_include_artifact', 'delete_attachment') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="' . $Language->getText('global', 'btn_delete') . '"></A>';
             } else {
                 $html_delete = '-';
             }
             $out .= sprintf($fmt, util_get_alt_row_color($i), '<a href="' . $href . '">' . $hp->purify(db_result($result, $i, 'filename'), CODENDI_PURIFIER_CONVERT_HTML) . '</a>', $hp->purify(SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), CODENDI_PURIFIER_BASIC, $group_id), intval(db_result($result, $i, 'filesize') / 1024), util_user_link(db_result($result, $i, 'user_name')), format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), $html_delete);
         }
     }
     // for
     // final touch...
     $out .= $ascii ? "" . $GLOBALS['sys_lf'] . "" : "</TABLE>";
     return $out;
 }
 function displayEditForm($source_field = false, $target_field = false, $source_value = false, $target_value = false)
 {
     $hp = Codendi_HTMLPurifier::instance();
     echo '<noscript class="error">' . $GLOBALS['Language']->getText('tracker_field_dependencies', 'noscript') . '</noscript>';
     echo '<form action="' . $this->href . '" method="post" id="edit_rule_form"><div id="edit_rule">';
     /**/
     echo '<table border=0><thead><tr class="boxtable"><td class="boxtitle">';
     echo $GLOBALS['Language']->getText('tracker_field_dependencies', 'source');
     $onchange = '$(\'source_field_hidden\').value = $(\'source_field\').value;' . '$(\'target_field_hidden\').value = $(\'target_field\').value;' . 'Form.Element.disable(\'source_field\');' . 'Form.Element.disable(\'target_field\');' . 'this.up(\'table\').down(\'tbody\').update(\'<tr><td align=\\\'center\\\' colspan=\\\'2\\\'>' . addslashes(str_replace('"', "'", $GLOBALS['HTML']->getImage('ic/spinner.gif'))) . '</td></tr>\');' . 'this.form.submit();';
     echo PHP_EOL . '<select id="source_field" name="source_field" onchange="' . $onchange . '">' . PHP_EOL;
     echo '<option value="-1">' . $GLOBALS['Language']->getText('tracker_field_dependencies', 'choose_field') . '</option>';
     $sources = $this->getAllSourceFields($target_field);
     foreach ($sources as $id => $field) {
         $highlight = $this->fieldHasTarget($this->artifact_type->getId(), $field->getId()) ? ' class="boxhighlight" ' : ' ';
         $selected = $field->getId() == $source_field ? ' selected="selected" ' : ' ';
         echo '<option value="' . $id . '" ' . $highlight . $selected . '>';
         echo $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML);
         echo '</option>';
     }
     echo '</select>';
     echo '</td><td class="boxtitle">';
     echo $GLOBALS['Language']->getText('tracker_field_dependencies', 'target');
     echo '<select id="target_field" name="target_field" onchange="' . $onchange . '">';
     echo '<option value="-1">' . $GLOBALS['Language']->getText('tracker_field_dependencies', 'choose_field') . '</option>';
     $targets = $this->getAllTargetFields($source_field);
     foreach ($targets as $id => $field) {
         $highlight = $this->fieldHasSource($this->artifact_type->getId(), $field->getId()) ? ' class="boxhighlight" ' : ' ';
         $selected = $field->getId() == $target_field ? ' selected="selected" ' : ' ';
         echo '<option value="' . $id . '" ' . $highlight . $selected . '>';
         echo $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML);
         echo '</option>';
     }
     echo '</select>';
     //Preload spinner
     echo $GLOBALS['HTML']->getImage('ic/spinner.gif', array('style' => 'display:none'));
     echo '</td></tr></thead>';
     echo '<tbody><tr style="vertical-align:top;" class="boxitemalt"><td>';
     if ($source_field && $target_field && isset($sources[$source_field]) && isset($targets[$target_field])) {
         //Source values
         echo '<table width="100%" cellpadding="0" cellspacing="0">';
         $values = $sources[$source_field]->getFieldPredefinedValues($this->artifact_type->getID());
         if (db_numrows($values) >= 1) {
             while ($row = db_fetch_array($values)) {
                 echo '<tr id="source_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '">';
                 echo '<td style="width: 1%;">';
                 echo '<input type="checkbox" 
                              id="source_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '_chk" 
                              name="source_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '_chk" 
                              style="visibility: hidden;"
                              onclick="admin_checked(this.id)" />';
                 echo '</td><td style="cursor: pointer;" onclick="return admin_selectSourceEvent(this)"><span> </span><label style="cursor: pointer;">';
                 $v = $hp->purify(SimpleSanitizer::unsanitize($row[1]), CODENDI_PURIFIER_CONVERT_HTML);
                 if ($this->valueHasTarget($this->artifact_type->getId(), $source_field, $row[0], $target_field)) {
                     echo '<strong>' . $v . '</strong>';
                 } else {
                     echo $v;
                 }
                 echo ' </label></td>';
                 echo '<td style="text-align: right;"><div id="source_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '_arrow" style="visibility: hidden;">&rarr;</div></td>';
                 echo '</tr>';
             }
         }
         echo '</table>';
         echo '</td><td>';
         //Target values
         echo '<table width="100%" cellpadding="0" cellspacing="0">';
         $values = $targets[$target_field]->getFieldPredefinedValues($this->artifact_type->getID());
         if (db_numrows($values) >= 1) {
             while ($row = db_fetch_array($values)) {
                 echo '<tr id="target_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '">';
                 echo '<td style="text-align: right; width: 1%"><div id="target_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '_arrow" style="visibility: hidden;">&rarr;</div></td>';
                 echo '<td style="width: 1%;">';
                 echo '<input type="checkbox" 
                              id="target_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '_chk" 
                              name="target_' . $source_field . '_' . $target_field . '_' . (int) $row[0] . '_chk" 
                              style="visibility: hidden;"
                              onclick="admin_checked(this.id)" />';
                 echo '</td><td style="cursor: pointer;" onclick="return admin_selectTargetEvent(this)"><span> </span><label style="cursor: pointer;">';
                 $v = $hp->purify(SimpleSanitizer::unsanitize($row[1]), CODENDI_PURIFIER_CONVERT_HTML);
                 if ($this->valueHasSource($this->artifact_type->getId(), $target_field, $row[0], $source_field)) {
                     echo '<strong>' . $v . '</strong>';
                 } else {
                     echo $v;
                 }
                 echo ' </label></td>';
                 echo '</tr>';
             }
         }
         echo '</table>';
     } else {
         echo '</td><td>';
     }
     echo '</td></tr>';
     echo '<tr id="save_panel" class="boxtitle">';
     echo '<td colspan="2" style="text-align: center;">';
     echo '<input type="submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" id="save_btn"/>';
     echo '<button id="reset_btn">' . $GLOBALS['Language']->getText('global', 'btn_reset') . '</button>';
     echo '</td>';
     echo '</tr>';
     echo '</tbody>';
     echo '</table>';
     echo '</div>';
     /**/
     echo '<input type="hidden" id="save"  name="save" value="no" />';
     echo '<input type="hidden" id="source_field_hidden" name="source_field" value="" />';
     echo '<input type="hidden" id="target_field_hidden" name="target_field" value="" />';
     echo '<input type="hidden" id="value" name="value" value="" />';
     echo '<input type="hidden" id="direction_type" name="direction_type" value="" />';
     echo '</form>';
     echo '<script type="text/javascript">' . "\n";
     echo "//<![CDATA[\n";
     $this->displayFieldsAndValuesAsJavascript();
     $this->displayRulesAsJavascript();
     echo "var messages = {\n";
     echo "btn_save_rule:      '" . addslashes($GLOBALS['Language']->getText('global', 'btn_submit')) . "',\n";
     echo "btn_reset:          '" . addslashes($GLOBALS['Language']->getText('global', 'btn_reset')) . "'\n";
     echo "};\n";
     echo "document.observe('dom:loaded', buildAdminUI);";
     echo "\n//------------------------------------------------------\n";
     echo "\n" . '//]]></script>';
 }
Exemplo n.º 26
0
 /**
  * Display the dropdownlist (select list) of all available fieldsets of the tracker $artifact_group_id
  *
  * @param int $artifact_group_id the tracker id
  * @param int $selected_field_set_id the id of the fieldset that must be selected, or false if no default fieldset is selected
  */
 function displayFieldSetDropDownList($artifact_group_id, $selected_fieldset_id = false)
 {
     $hp = Codendi_HTMLPurifier::instance();
     global $ath, $art_fieldset_fact;
     $fieldsets = $art_fieldset_fact->getArtifactFieldSetsFromId($artifact_group_id);
     $html = '<select name="field_set_id">';
     foreach ($fieldsets as $fieldset) {
         $html .= '<option value="' . $fieldset->getID() . '"';
         if ($fieldset->getID() === $selected_fieldset_id) {
             $html .= ' selected="selected"';
         }
         $html .= '>' . $hp->purify(SimpleSanitizer::unsanitize($fieldset->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</option>';
     }
     $html .= '</select>';
     echo $html;
 }
Exemplo n.º 27
0
 /**
  * 
  * Display a artifact field either as a read-only value or as a read-write 
  * making modification possible
  *
  * @param group_artifact_id : the group artifact id (artifact type id)
  * @param value: the current value stored in this field (for select boxes type of field
  *         it is the value_id actually. It can also be an array with mutliple values.
  * @param break: true if a break line is to be inserted between the field label
  *        and the field value
  * @param label: if true display the field label.
  * @param ro: true if only the field value is to be displayed. Otherwise
  *        display an HTML select box, text field or text area to modify the value
  * @param ascii: if true do not use any HTML decoration just plain text (if true
  *        then read-only (ro) flag is forced to true as well)
  * @param show_none: show the None entry in the select box if true (value_id 100)
  * @param text_none: text associated with the none value_id to display in the select box
  * @param show_any: show the Any entry in the select box if true (value_id 0)
  * @param text_any: text associated with the any value_id  tp display in the select box
  * @param htmlEmail: Specific display for HTML email
  *
  *	@return	string
  */
 function display($group_artifact_id, $value = 'xyxy', $break = false, $label = true, $ro = false, $ascii = false, $show_none = false, $text_none = 0, $show_any = false, $text_any = 0, $show_unchanged = false, $text_unchanged = 0, $htmlEmail = true)
 {
     global $Language;
     $hp = Codendi_HTMLPurifier::instance();
     //Use url parameters to populate fields
     if (!$ro) {
         $request =& HTTPRequest::instance();
         if ($request->get('func') == 'add' && $request->exist($this->field_name)) {
             $value = htmlentities($request->get($this->field_name), ENT_QUOTES, 'UTF-8');
         }
     }
     if (!$text_none) {
         $text_none = $Language->getText('global', 'none');
     }
     if (!$text_any) {
         $text_any = $Language->getText('global', 'any');
     }
     if (!$text_unchanged) {
         $text_unchanged = $Language->getText('global', 'unchanged');
     }
     $output = "";
     if ($label) {
         $output = $this->labelDisplay($break, $ascii, !$ro);
     }
     // display depends upon display type of this field
     switch ($this->getDisplayType()) {
         case 'SB':
             if ($ro) {
                 // if multiple selected values return a list of <br> separated values
                 $arr = is_array($value) ? $value : array($value);
                 for ($i = 0; $i < count($arr); $i++) {
                     if ($arr[$i] == 0) {
                         $arr[$i] = $text_any;
                     } else {
                         if ($arr[$i] == 100) {
                             $arr[$i] = $text_none;
                         } else {
                             $arr[$i] = SimpleSanitizer::unsanitize($this->getValue($group_artifact_id, $arr[$i]));
                             if (!$ascii) {
                                 $arr[$i] = $hp->purify($arr[$i], CODENDI_PURIFIER_CONVERT_HTML);
                             }
                         }
                     }
                 }
                 if ($ascii) {
                     $output .= join(', ', $arr);
                 } else {
                     $output .= join('<br>', $arr);
                     if ($htmlEmail) {
                         //The span is used to pass values that would be processed in JS as dependency sources' values
                         $output .= '<span id="' . $this->field_name . '" style="display: none;">' . $value . '</span>';
                     }
                     $output .= $this->fieldBox('', $group_artifact_id, $value, $show_none, $text_none, $show_any, $text_any, $show_unchanged, $text_unchanged, false);
                 }
             } else {
                 // Only show the 'None" label if empty value is allowed or
                 // if value is already none (it can happen if the field was not used in
                 // the artifact submission form)
                 if ($this->isEmptyOk() || $value == 100) {
                     $show_none = true;
                     $text_none = $Language->getText('global', 'none');
                 }
                 if (is_array($value)) {
                     $output .= $this->multipleFieldBox('', $group_artifact_id, $value, $show_none, $text_none, $show_any, $text_any, $show_unchanged, $text_unchanged);
                 } else {
                     $output .= $this->fieldBox('', $group_artifact_id, $value, $show_none, $text_none, $show_any, $text_any, $show_unchanged, $text_unchanged);
                 }
             }
             break;
         case 'MB':
             $arr = is_array($value) ? $value : array($value);
             $valueArray = $arr;
             if ($ro) {
                 // if multiple selected values return a list of , separated values
                 for ($i = 0; $i < count($arr); $i++) {
                     if ($arr[$i] == 0) {
                         $arr[$i] = $text_any;
                     } else {
                         if ($arr[$i] == 100) {
                             $arr[$i] = $text_none;
                         } else {
                             $arr[$i] = SimpleSanitizer::unsanitize($this->getValue($group_artifact_id, $arr[$i]));
                             if (!$ascii) {
                                 $arr[$i] = $hp->purify($arr[$i], CODENDI_PURIFIER_CONVERT_HTML);
                             }
                         }
                     }
                 }
                 $output .= join(",", $arr);
                 if (!$ascii) {
                     if ($htmlEmail) {
                         //The span is used to pass values id that would be processed in JS as dependency sources' values
                         $output .= '<span id="' . $this->field_name . '" style="display: none;">' . implode(',', $valueArray) . '</span>';
                     }
                     $output .= $this->multipleFieldBox('', $group_artifact_id, $value, $show_none, $text_none, $show_any, $text_any, $show_unchanged, $text_unchanged, false, false);
                 }
             } else {
                 // Only show the 'None" label if empty value is allowed or
                 // if value is already none (it can happen if the field was not used in
                 // the artifact submission form)
                 if ($this->isEmptyOk() || implode(",", $arr) == "100") {
                     $show_none = true;
                     $text_none = $Language->getText('global', 'none');
                 }
                 //if (is_array($value))
                 $output .= $this->multipleFieldBox('', $group_artifact_id, $value, $show_none, $text_none, $show_any, $text_any, $show_unchanged, $text_unchanged);
                 // else
                 //	$output .= $this->fieldBox('',$group_artifact_id, $value,
                 //			       $show_none,$text_none,$show_any,
                 //			       $text_any);
             }
             break;
         case 'DF':
             if ($value == $Language->getText('global', 'unchanged')) {
                 //$value = 'Unchanged (e.g. '.format_date("Y-m-j",time()).')';
                 $value = $Language->getText('global', 'unchanged');
                 $output .= $this->fieldDate($value, false, strlen($value) + 1, strlen($value) + 1, 'masschange_form', true);
             } else {
                 // Default value
                 if ($value == "") {
                     $value = time();
                 }
                 if ($ascii) {
                     // most date fields (except open_date) are real dates (without time), so do not use $sys_datefmt
                     // any more which can include an hour:min (than set on 00:00 for most dates). Especially in mail_follow_ups
                     // after changing an Artifact
                     $output .= $value == 0 ? '' : format_date("Y-m-j", $value);
                 } else {
                     if ($ro) {
                         $output .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), $value);
                     } else {
                         $output .= $this->fieldDate($value == 0 ? '' : format_date("Y-m-j", $value, ''));
                     }
                 }
             }
             break;
         case 'TF':
             if ($this->getDataType() == $this->DATATYPE_FLOAT) {
                 if ($value == $Language->getText('global', 'unchanged')) {
                     //$value = 'Unchanged (e.g. '.number_format($value,2).')';
                     $output .= $this->fieldText($value, strlen($value) + 1, strlen($value) + 1);
                     break;
                 } else {
                     $value = number_format($value, 2, '.', '');
                 }
             }
             if ($ascii) {
                 $output .= util_unconvert_htmlspecialchars($value);
             } else {
                 $output .= $ro ? $value : $this->fieldText($value);
             }
             break;
         case 'TA':
             if ($ascii) {
                 $output .= util_unconvert_htmlspecialchars($value);
             } else {
                 $output .= $ro ? nl2br($value) : $this->fieldTextarea($value);
             }
             break;
         default:
             $output .= $Language->getText('tracker_include_field', 'unknown_display_type', $this->getName());
     }
     return $output;
 }