Beispiel #1
0
     $ath->adminTrackersHeader(array('title' => $Language->getText('tracker_admin_field_usage', 'tracker_admin') . $Language->getText('tracker_admin_index', 'create_tracker'), 'help' => 'tracker-v3.html#tracker-creation'));
     $ath->displayCreateTracker($group_id, $codendi_template, $group_id_template, $atid_template, $name, $description, $itemname);
     $ath->footer(array());
     break;
 case 'docreate':
     if (!user_isloggedin()) {
         exit_not_logged_in();
         return;
     }
     if (!user_ismember($group_id, 'A')) {
         exit_permission_denied();
         return;
     }
     $group_id_chosen = $request->getValidated('group_id_chosen', 'uint', 0);
     $atid_chosen = $request->getValidated('atid_chosen', 'uint', 0);
     $name = $sanitizer->sanitize($request->getValidated('name', 'string', ''));
     $description = $sanitizer->sanitize($request->getValidated('description', 'text', ''));
     $itemname = $request->getValidated('itemname', 'string', '');
     if (!$atf->create($group_id, $group_id_chosen, $atid_chosen, $name, $description, $itemname)) {
         exit_error($Language->getText('global', 'error'), $atf->getErrorMessage());
     } else {
         $GLOBALS['Response']->addFeedback('info', $Language->getText('tracker_admin_index', 'tracker_created'));
         // Create corresponding reference
         $reference_manager =& ReferenceManager::instance();
         $ref = new Reference(0, strtolower($itemname), $Language->getText('project_reference', 'reference_art_desc_key'), '/tracker/?func=detail&aid=$1&group_id=$group_id', 'P', 'tracker', ReferenceManager::REFERENCE_NATURE_ARTIFACT, '1', $group_id);
         $result = $reference_manager->createReference($ref);
         if (!$result) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('project_reference', 'create_for_tracker_fail'));
         } else {
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_reference', 'r_create_success') . " ");
         }
Beispiel #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());
Beispiel #3
0
 }
 // Artifact creation
 if (!$ah->create()) {
     exit_error($Language->getText('global', 'error'), $ah->getErrorMessage());
 } else {
     //
     //      Attach file to this Artifact.
     //
     if (isset($_FILES['input_file']['error']) && $_FILES['input_file']['error'] != UPLOAD_ERR_NO_FILE) {
         $afh = new ArtifactFileHtml($ah);
         if (!$afh || !is_object($afh)) {
             $GLOBALS['Response']->addFeedback('error', $Language->getText('tracker_index', 'not_create_file'));
         } elseif ($afh->isError()) {
             $GLOBALS['Response']->addFeedback('error', $afh->getErrorMessage());
         } else {
             if (!$afh->upload($_FILES['input_file']['tmp_name'], $_FILES['input_file']['name'], $_FILES['input_file']['type'], $sanitizer->sanitize($request->get('file_description')), $changes)) {
                 $GLOBALS['Response']->addFeedback('error', $Language->getText('tracker_index', 'not_attach_file', $afh->getErrorMessage()));
             }
         }
     }
     // Add new cc if any
     if ($add_cc) {
         $ah->addCC($add_cc, $sanitizer->sanitize($request->get('cc_comment')), $changes);
     }
     // send an email to notify the user of the artifact add
     $agnf = new ArtifactGlobalNotificationFactory();
     $addresses = $agnf->getAllAddresses($ath->getID());
     $ah->mailFollowupWithPermissions($addresses);
     $em->processEvent('tracker_postadd', array('ah' => $ah, 'ath' => $ath));
     $itemname = $ath->getItemName();
     $GLOBALS['Response']->addFeedback('info', $Language->getText('tracker_index', 'create_success', '<a href="/goto?key=' . $itemname . '&val=' . $ah->getID() . '&group_id=' . $group_id . '">' . $itemname . ' #' . $ah->getID() . '</a>'), CODENDI_PURIFIER_LIGHT);
 /** parse the first line of the csv file containing all the labels of the fields that are
  * used in the following of the file
  * @param $data (IN): array containing the field labels
  * @return true if parse ok, false if errors occurred
  */
 function parseFieldNames($data)
 {
     global $Language;
     $this->num_columns = count($data);
     for ($c = 0; $c < $this->num_columns; $c++) {
         $field_label = SimpleSanitizer::sanitize($data[$c]);
         if (!array_key_exists($field_label, $this->used_fields)) {
             $this->setError($Language->getText('plugin_tracker_import_utils', 'field_not_known', array($field_label, $this->ath->getName())));
             return false;
         }
         $field = $this->used_fields[$field_label];
         if ($field) {
             $field_name = $field->getName();
             if ($field_name == "artifact_id") {
                 $this->aid_column = $c;
             }
             if ($field_name == "submitted_by") {
                 $this->submitted_by_column = $c;
             }
             if ($field_name == "open_date") {
                 $this->submitted_on_column = $c;
             }
         }
         $this->parsed_labels[$c] = $field_label;
     }
     if (!$this->checkMandatoryFields()) {
         return false;
     }
     return true;
 }