/** * Upload a file to store in artifact_file * * @return boolean */ function upload($input_file, $input_file_name, $input_file_type, $description, &$changes) { global $sys_max_size_attachment, $Language; if (!util_check_fileupload($input_file)) { $this->setError($Language->getText('tracker_include_artifactfile', 'invalid_name')); return false; } $size = @filesize($input_file); $input_data = @fread(@fopen($input_file, 'r'), $size); if (strlen($input_data) < 1 || strlen($input_data) > $sys_max_size_attachment) { $this->setError($Language->getText('tracker_include_artifactfile', 'not_attached', formatByteToMb($sys_max_size_attachment))); return false; } return $this->create($input_file_name, $input_file_type, $size, $input_data, $description, $changes); }
/** * Display the artifact to do mass changes * * @param ro: read only parameter - Display mode or update mode * @param pv: printer version * @param query: only in the case of func=masschange, the query that retrieves all the artifacts to be changed * @param $mass_change_ids[]: only in the case of func=masschange_selected, an array containing all the artifact ids to be changed * * @return void */ function displayMassChange($ro, $mass_change_ids = null, $query = null, $art_report_html = null, $advsrch = 0) { global $art_field_fact, $sys_max_size_attachment, $Language; $hp = Codendi_HTMLPurifier::instance(); $fields_per_line = 2; $max_size = 40; $group = $this->getGroup(); $atid = $this->getID(); $group_id = $group->getGroupId(); if ($query) { $art_report_html->getQueryElements($query, $advsrch, $from, $where); $sql = "select distinct a.artifact_id " . $from . " " . $where; $result = db_query($sql); while ($row = db_fetch_array($result)) { $mass_change_ids[] = $row['artifact_id']; } } //if ($mass_change_ids) { echo '<H2>' . $Language->getText('tracker_include_type', 'changing_items', count($mass_change_ids)) . ' </H2>'; reset($mass_change_ids); while (list($key, $val) = each($mass_change_ids)) { $url = '/tracker/?func=detail&group_id=' . (int) $group_id . '&aid=' . (int) $val . '&atid=' . (int) $atid; if ($key == 0) { echo '<a href="' . $url . '">' . $hp->purify($this->getItemName(), CODENDI_PURIFIER_CONVERT_HTML) . ' #' . (int) $val . '</a>'; } if ($key > 0) { echo ', <a href="' . $url . '"> #' . (int) $val . '</a>'; } if ($key == 100) { echo ", .."; break; } } echo ' <br><br>'; echo ' <FORM ACTION="' . $_SERVER['PHP_SELF'] . '" METHOD="POST" enctype="multipart/form-data" NAME="masschange_form"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="' . $sys_max_size_attachment . '"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="postmasschange"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $group_id . '"> <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $atid . '">'; reset($mass_change_ids); while (list(, $val) = each($mass_change_ids)) { echo ' <INPUT TYPE="HIDDEN" NAME="mass_change_ids[]" VALUE="' . $hp->purify($val, CODENDI_PURIFIER_CONVERT_HTML) . '">'; } echo ' <TABLE cellpadding="0">'; //first special case for submitted_by $field = $art_field_fact->getFieldFromName('submitted_by'); $field_html = new ArtifactFieldHtml($field); $field_value = $Language->getText('global', 'unchanged'); list($sz, ) = explode("/", $field->getDisplaySize()); $label = $field_html->labelDisplay(false, false, !$ro); // original submission field must be displayed read-only $value = $field_html->display($this->getID(), $field_value, false, false, $ro, false, false, $Language->getText('global', 'none'), false, 'Any', true, $Language->getText('global', 'unchanged')); echo "\n<TR>"; echo ' <TD valign="top">' . $label . ' </TD> <TD valign="top">' . $value . ' </TD> <TD colspan="2"><FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_type', 'submit_mass_change') . '"></TD>'; echo ' </TR> <TR><TD COLSPAN="' . $fields_per_line * 2 . '"> </TD></TR>'; // Now display the variable part of the field list (depend on the project) $i = 0; $result_fields = $art_field_fact->getAllUsedFields(); while (list($key, $field) = each($result_fields)) { $field_html = new ArtifactFieldHtml($field); // if the field is a special field (except summary and details) // then skip it. if (!$field->isSpecial() && $field->getName() != 'summary' && $field->getName() != 'details') { // display the artifact field // 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 $field_value = $Language->getText('global', 'unchanged'); list($sz, ) = explode("/", $field->getDisplaySize()); $label = $field_html->labelDisplay(false, false, !$ro); $value = $field_html->display($this->getID(), $field_value, false, false, $ro, false, false, $Language->getText('global', 'none'), false, $Language->getText('global', 'any'), true, $Language->getText('global', 'unchanged')); // Details field must be on one row if ($sz > $max_size) { echo "\n<TR>" . '<TD valign="top">' . $label . '</td>' . '<TD valign="top" colspan="' . (2 * $fields_per_line - 1) . '">' . $value . '</TD>' . "\n</TR>"; $i = 0; } else { echo $i % $fields_per_line ? '' : "\n<TR>"; echo '<TD valign="top">' . $label . '</td>' . '<TD valign="top">' . $value . '</TD>'; $i++; echo $i % $fields_per_line ? '' : "\n</TR>"; } } } // while echo ' </TABLE> <table cellspacing="0">'; // // Followups comments // echo ' <TR><TD colspan="2" align="top"><HR></td></TR> <TR><TD> <h3>' . $Language->getText('tracker_include_artifact', 'follow_ups') . ' ' . help_button('ArtifactUpdate.html#ArtifactComments') . '</h3></td> <TD> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_type', 'submit_mass_change') . '"> </td></tr>'; echo ' <tr><TD colspan="2" align="top"> <B>' . $Language->getText('tracker_include_artifact', 'use_canned') . '</B> '; echo $this->cannedResponseBox(); echo ' <A HREF="/tracker/admin/?func=canned&atid=' . (int) $atid . '&group_id=' . (int) $group_id . '&create_canned=1">' . $Language->getText('tracker_include_artifact', 'define_canned') . '</A> </TD></TR>'; echo ' <TR><TD colspan="2">'; $field = $art_field_fact->getFieldFromName('comment_type_id'); if ($field) { $field_html = new ArtifactFieldHtml($field); echo '<P><B>' . $Language->getText('tracker_include_artifact', 'comment_type') . '</B>' . $field_html->fieldBox('', $atid, $field->getDefaultValue(), true, $Language->getText('global', 'none')) . '<BR>'; } // This div id used just to show the toggle of html format echo '<DIV ID="tracker_artifact_comment_label"></DIV>'; echo '<TEXTAREA NAME="comment" ID="tracker_artifact_comment" ROWS="10" style="width:100%" WRAP="SOFT"></TEXTAREA><p>'; echo '</td></tr>'; // // CC List // echo ' <TR><TD colspan="2"><hr></td></tr> <TR><TD colspan="2"> <h3>' . $Language->getText('tracker_include_artifact', 'cc_list') . ' ' . help_button('ArtifactUpdate.html#ArtifactCCList') . '</h3>'; if (!$ro) { echo ' ' . $Language->getText('tracker_include_artifact', 'fill_cc_list_msg'); echo $Language->getText('tracker_include_artifact', 'fill_cc_list_lbl'); echo '<input type="text" name="add_cc" id="tracker_cc" size="30">'; echo $Language->getText('tracker_include_artifact', 'fill_cc_list_cmt'); echo '<input type="text" name="cc_comment" size="40" maxlength="255">'; //echo autocomplete_for_lists_users('tracker_cc', 'tracker_cc_autocomplete'); } echo $this->showCCList($mass_change_ids); echo '</TD></TR>'; // // File attachments // echo ' <TR><TD colspan="2"><hr></td></tr> <TR><TD colspan="2"> <h3>' . $Language->getText('tracker_include_artifact', 'attachment') . ' ' . help_button('ArtifactUpdate.html#ArtifactAttachments') . '</h3>'; echo $Language->getText('tracker_include_artifact', 'upload_checkbox'); echo ' <input type="checkbox" name="add_file" VALUE="1">'; echo $Language->getText('tracker_include_artifact', 'upload_file_lbl'); echo '<input type="file" name="input_file" size="40">'; echo $Language->getText('tracker_include_artifact', 'upload_file_msg', formatByteToMb($sys_max_size_attachment)); echo $Language->getText('tracker_include_artifact', 'upload_file_desc'); echo '<input type="text" name="file_description" size="60" maxlength="255">'; reset($mass_change_ids); echo $this->showAttachedFiles($mass_change_ids); echo '</TD></TR>'; // // Artifact dependencies // echo ' <TR><TD colspan="2"><hr></td></tr> <TR ><TD colspan="2">'; echo '<h3>' . $Language->getText('tracker_include_artifact', 'dependencies') . ' ' . help_button('ArtifactUpdate.html#ArtifactDependencies') . '</h3> <B>' . $Language->getText('tracker_include_artifact', 'dependent_on') . '</B><BR> <P>'; if (!$ro) { echo ' <B>' . $Language->getText('tracker_include_artifact', 'aids') . '</B> <input type="text" name="artifact_id_dependent" size="20" maxlength="255"> <i>' . $Language->getText('tracker_include_artifact', 'fill') . '</i><p>'; } echo $this->showDependencies($mass_change_ids); echo '</TD></TR>'; // // Artifact permissions // if ($this->userIsAdmin()) { echo ' <TR><TD colspan="2"><hr></td></tr> <TR ><TD colspan="2">'; echo '<h3>' . $Language->getText('tracker_include_artifact', 'permissions') . ' ' . help_button('ArtifactUpdate.html#ArtifactPermissions') . '</h3>'; echo '<input type="hidden" name="change_permissions" value="0" />'; echo '<input type="checkbox" name="change_permissions" value="1" id="change_permissions" />'; echo '<label for="change_permissions">' . $GLOBALS['Language']->getText('tracker_include_type', 'mass_change_permissions') . '</label>'; echo '<blockquote>'; $checked = ''; $html = ''; $html .= '<p>'; $html .= '<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 .= '<label for="use_artifact_permissions">' . $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_label') . '</label>'; $html .= '</p>'; $html .= permission_fetch_selection_field('TRACKER_ARTIFACT_ACCESS', 0, $group_id); $html .= '<script type="text/javascript">'; $html .= "\n document.observe('dom:loaded', function() {\n //init\n if ( ! \$('use_artifact_permissions')|| ! \$('use_artifact_permissions').checked ) {\n \$('ugroups').disable();\n }\n if ( ! \$('change_permissions').checked) {\n \$('use_artifact_permissions').disable();\n }\n \n //event handlers\n \$('change_permissions').observe('change', function(evt) {\n if (this.checked) {\n \$('use_artifact_permissions').enable();\n if (\$('use_artifact_permissions').checked) {\n \$('ugroups').enable();\n }\n } else {\n \$('use_artifact_permissions').disable();\n \$('ugroups').disable();\n }\n });\n \n \$('use_artifact_permissions').observe('change', function(evt) {\n if (this.checked) {\n \$('ugroups').enable();\n } else {\n \$('ugroups').disable();\n }\n });\n });\n </script>"; echo $html; echo '</blockquote>'; echo '</TD></TR>'; } echo '<TR><TD colspan="2"><hr></td></tr>'; echo '</TD></TR> <TR><TD colspan="2" ALIGN="center"> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_type', 'submit_mass_change') . '"> </FORM> </TD></TR>'; echo '</table>'; }
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> ' . $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"> </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 . '"> </TD></TR>'; $html .= '<TR class="boxtitle"><TD class="left" COLSPAN="' . (int) $columns_number . '"> <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> ' . $Language->getText('tracker_include_artifact', 'fill_cc_list_cmt') . ": </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>'; }
function frs_display_release_form($is_update, &$release, $group_id, $title, $url) { global $frspf, $frsrf, $frsff; $hp =& Codendi_HTMLPurifier::instance(); if (is_array($release)) { if (isset($release['date'])) { $release_date = $release['date']; } $release = new FRSRelease($release); } if ($is_update) { $files = $release->getFiles(); if (count($files) > 0) { for ($i = 0; $i < count($files); $i++) { if (!$frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'md5_fail', array(basename($files[$i]->getFileName()), $files[$i]->getComputedMd5()))); } } } } file_utils_admin_header(array('title' => $GLOBALS['Language']->getText('file_admin_editreleases', 'release_new_file_version'), 'help' => 'frs.html#delivery-manager-administration')); echo '<H3>' . $hp->purify($title, CODENDI_PURIFIER_CONVERT_HTML) . '</H3>'; $sql = "SELECT * FROM frs_processor WHERE (group_id = 100 OR group_id = " . db_ei($group_id) . ") ORDER BY rank"; $result = db_query($sql); $processor_id = util_result_column_to_array($result, 0); $processor_name = util_result_column_to_array($result, 1); foreach ($processor_name as $key => $value) { $processor_name[$key] = $hp->purify($value, CODENDI_PURIFIER_JS_QUOTE); } $sql = "SELECT * FROM frs_filetype ORDER BY type_id"; $result1 = db_query($sql); $type_id = util_result_column_to_array($result1, 0); $type_name = util_result_column_to_array($result1, 1); $url_news = get_server_url() . "/file/showfiles.php?group_id=" . $group_id; echo '<script type="text/javascript">'; echo "var processor_id = ['" . implode("', '", $processor_id) . "'];"; echo "var processor_name = ['" . implode("', '", $processor_name) . "'];"; echo "var type_id = ['" . implode("', '", $type_id) . "'];"; echo "var type_name = ['" . implode("', '", $type_name) . "'];"; echo "var group_id = " . $group_id . ";"; echo "var relname = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'relname') . "';"; echo "var choose = '" . $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one') . "';"; echo "var browse = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'browse') . "';"; echo "var local_file = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'local_file') . "';"; echo "var scp_ftp_files = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'scp_ftp_files') . "';"; echo "var upload_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload') . "';"; echo "var add_file_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_file') . "';"; echo "var add_change_log_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_change_log') . "';"; echo "var view_change_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'view_change') . "';"; echo "var refresh_files_list = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'refresh_file_list') . "';"; echo "var release_mode = '" . ($is_update ? 'edition' : 'creation') . "';"; if ($is_update) { $pm = PermissionsManager::instance(); $dar = $pm->getAuthorizedUgroups($release->getReleaseID(), FRSRelease::PERM_READ); $ugroups_name = array(); foreach ($dar as $row) { $ugroups_name[] = util_translate_name_ugroup($row['name']); } echo "var ugroups_name = '" . implode(", ", $ugroups_name) . "';"; echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'release_perm') . "';"; } else { echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'default_permissions') . "';"; } echo '</script>'; //set variables for news template $relname = $GLOBALS['Language']->getText('file_admin_editreleases', 'relname'); if (!$is_update) { echo '<p>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'contain_multiple_files') . '</p>'; } ?> <FORM id="frs_form" NAME="frsRelease" ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<?php echo $url; ?> " CLASS="form-inline"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $GLOBALS['sys_max_size_upload']; ?>"> <input type="hidden" name="postReceived" value="" /> <?php if ($release->getReleaseId()) { echo '<input type="hidden" id="release_id" name="release[release_id]" value="' . $release->getReleaseId() . '" />'; } ?> <TABLE BORDER="0" width="100%"> <TR><TD><FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_properties'); ?> </LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2"> <TR> <TD> <B><?php echo $GLOBALS['Language']->getText('file_admin_editpackages', 'p_name'); ?> :</B> </TD> <TD> <?php $res =& $frspf->getFRSPackagesFromDb($group_id); $rows = count($res); if (!$res || $rows < 1) { echo '<p class="highlight">' . $GLOBALS['Language']->getText('file_admin_qrs', 'no_p_available') . '</p>'; } else { echo '<SELECT NAME="release[package_id]" id="package_id">'; for ($i = 0; $i < $rows; $i++) { echo '<OPTION VALUE="' . $res[$i]->getPackageID() . '"'; if ($res[$i]->getPackageID() == $release->getPackageId()) { echo ' selected'; } echo '>' . $hp->purify(util_unconvert_htmlspecialchars($res[$i]->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</OPTION>'; } echo '</SELECT>'; } ?> </TD><td></td> <TD> <B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_name'); ?> : <span class="highlight"><strong>*</strong></span></B> </TD> <TD> <INPUT TYPE="TEXT" id="release_name" name="release[name]" onBlur="update_news()" value="<?php echo $hp->purify($release->getName()); ?> "> </TD> </TR> <TR> <TD> <B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date'); ?> :</B> </TD> <TD> <?php echo $GLOBALS['HTML']->getDatePicker('release_date', 'release[date]', isset($release_date) ? $hp->purify($release_date) : format_date('Y-m-d', $release->getReleaseDate())); ?> </TD> <td></td> <TD> <B><?php echo $GLOBALS['Language']->getText('global', 'status'); ?> :</B> </TD> <TD> <?php print frs_show_status_popup($name = 'release[status_id]', $release->getStatusID()) . "<br>"; ?> </TD> </TR></TABLE></FIELDSET> </TD></TR> <TR><TD><FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_uploaded_files'); ?> </LEGEND> <?php $titles = array(); $titles[] = $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'delete_col') : ''; $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'filename'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'processor'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'file_type'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'md5sum'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'comment'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'user'); if ($is_update) { $titles[] = $GLOBALS['Language']->getText('file_admin_editreleasepermissions', 'release'); $titles[] = $GLOBALS['Language']->getText('file_admin_editreleases', 'release_date'); } echo html_build_list_table_top($titles, false, false, false, 'files'); ?> <tbody id="files_body"> <?php $files =& $release->getFiles(); for ($i = 0; $i < count($files); $i++) { $fname = $files[$i]->getFileName(); $list = split('/', $fname); $fname = $list[sizeof($list) - 1]; $user_id = $files[$i]->getUserID(); $userName = isset($user_id) ? UserManager::instance()->getUserById($files[$i]->getUserID())->getRealName() : ""; echo '<TR>'; echo '<TD><INPUT TYPE="CHECKBOX" NAME="release_files_to_delete[]" VALUE="' . $files[$i]->getFileID() . '"</TD>'; echo '<TD>' . $hp->purify($fname, CODENDI_PURIFIER_CONVERT_HTML) . '<INPUT TYPE="HIDDEN" NAME="release_files[]" VALUE="' . $files[$i]->getFileID() . '"></TD>'; echo '<TD>' . frs_show_processor_popup($group_id, $name = 'release_file_processor[]', $files[$i]->getProcessorID()) . '</TD>'; echo '<TD>' . frs_show_filetype_popup($name = 'release_file_type[]', $files[$i]->getTypeID()) . '</TD>'; //In case of difference between the inserted md5 and the computed one //we dispaly an editable text field to let the user insert the right value //to avoid the error message next time $value = 'value = "' . $files[$i]->getReferenceMd5() . '"'; if ($frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) { $value = 'value = "' . $files[$i]->getComputedMd5() . '" readonly="true"'; } echo '<TD><INPUT TYPE="TEXT" NAME="release_reference_md5[]" ' . $value . ' SIZE="36" ></TD>'; $comment = $files[$i]->getComment(); echo '<TD><textarea NAME="release_comment[]" cols="20", rows="1" >' . $comment . '</textarea></TD>'; echo '<TD><INPUT TYPE="TEXT" NAME="user" value = "' . $userName . '" readonly="true"></TD>'; echo '<TD>' . frs_show_release_popup2($group_id, $name = 'new_release_id[]', $files[$i]->getReleaseID()) . '</TD>'; echo '<TD><INPUT TYPE="TEXT" NAME="release_time[]" VALUE="' . format_date('Y-m-d', $files[$i]->getReleaseTime()) . '" SIZE="10" MAXLENGTH="10"></TD></TR>'; } echo '<INPUT TYPE="HIDDEN" id="nb_files" NAME="nb_files" VALUE="' . count($files) . '">'; ?> <tr id="row_0"> <td></td> <td> <input type="hidden" name="js" value="no_js"/> <select name="ftp_file[]" id="ftp_file_0"> <option value="-1"><?php echo $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one'); ?> </option> <?php //iterate and show the files in the upload directory $file_list = $frsff->getUploadedFileNames($release->getProject()); foreach ($file_list as $file) { echo '<option value="' . $file . '">' . $hp->purify($file, CODENDI_PURIFIER_CONVERT_HTML) . '</option>'; } echo '<script type="text/javascript">'; echo "var available_ftp_files = ['" . implode("', '", $file_list) . "'];"; echo '</script>'; ?> </select> <span id="or">or</span> <input type="file" name="file[]" id="file_0" /> </td> <td> <?php print frs_show_processor_popup($group_id, $name = 'file_processor'); ?> </td> <td> <?php print frs_show_filetype_popup($name = 'file_type'); ?> </td> <td> <input name="reference_md5" value="" size="36" type="TEXT"> </td> </tr> </tbody> </table> <?php echo '<span class="small" style="color:#666"><i>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload_file_msg', formatByteToMb($GLOBALS['sys_max_size_upload'])) . '</i> </span>'; echo '<div id=\'files_help\'><span class="smaller">'; include $GLOBALS['Language']->getContent('file/qrs_attach_file'); echo '</span></div>'; ?> </FIELDSET> </TD></TR> <TR><TD><FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notes'); ?> </LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"> <TR id="notes_title"> <TD VALIGN="TOP" width="10%"> <span id="release_notes"><B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'release_notes'); ?> : </B></span> </TD> </TR> <TR id="upload_notes"> <TD> <input id="uploaded_notes" type="file" name="uploaded_release_notes" size="30"> </TD> </TR> <TR id="release_notes_area"> <TD width="100%"> <TEXTAREA NAME="release[release_notes]" rows="7" cols="70"><?php echo $hp->purify($release->getNotes(), CODENDI_PURIFIER_CONVERT_HTML); ?> </TEXTAREA> </TD> </TR> <TR id="change_log_title"> <TD VALIGN="TOP" width="10%"> <span id="change_log"><B><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'change_log'); ?> : </B></span> </TD> </TR> <TR id="upload_change_log"> <TD> <input type="file" id="uploaded_change_log" name="uploaded_change_log" size="30"> </TD> </TR> <TR id="change_log_area"> <TD width="40%"> <TEXTAREA ID="text_area_change_log" NAME="release[change_log]" ROWS="7" COLS="70"><?php echo $hp->purify($release->getChanges(), CODENDI_PURIFIER_CONVERT_HTML); ?> </TEXTAREA> </TD> </TR> </TABLE></FIELDSET> </TD></TR> <TR> <TD> <FIELDSET><LEGEND><?php echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_permissions'); ?> </LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2"> <TR id="permissions"> <TD> <DIV id="permissions_list"> <?php if ($is_update) { permission_display_selection_frs("RELEASE_READ", $release->getReleaseID(), $group_id); } else { permission_display_selection_frs("PACKAGE_READ", $release->getPackageID(), $group_id); } ?> </DIV> </TD> </TR> </TABLE> </FIELDSET> </TD> </TR> <?php if (user_ismember($group_id, 'A') || user_ismember($group_id, 'N2') || user_ismember($group_id, 'N1')) { echo ' <TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_news') . '</LEGEND> <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2"> <TR> <TD VALIGN="TOP"> <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'submit_news') . ' :</B> </TD> <TD> <INPUT ID="submit_news" TYPE="CHECKBOX" NAME="release_submit_news" VALUE="1"> </TD> </TR> <TR id="tr_subject"> <TD VALIGN="TOP" ALIGN="RIGHT"> <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'subject') . ' :</B> </TD> <TD> <INPUT TYPE="TEXT" ID="release_news_subject" NAME="release_news_subject" VALUE=" ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_subject', $relname) . '" SIZE="40" MAXLENGTH="60"> </TD> </TR> <TR id="tr_details"> <TD VALIGN="TOP" ALIGN="RIGHT"> <B> ' . $GLOBALS['Language']->getText('file_admin_editreleases', 'details') . ' :</B> </TD> <TD> <TEXTAREA ID="release_news_details" NAME="release_news_details" ROWS="7" COLS="50">' . $GLOBALS['Language']->getText('file_admin_editreleases', 'file_news_details', array($relname, $url_news)) . ' </TEXTAREA> </TD> </TR> <TR id="tr_public"> <TD ROWSPAN=2 VALIGN="TOP" ALIGN="RIGHT"> <B> ' . $GLOBALS['Language']->getText('news_submit', 'news_privacy') . ' :</B> </TD> <TD> <INPUT TYPE="RADIO" ID="publicnews" NAME="private_news" VALUE="0" CHECKED>' . $GLOBALS['Language']->getText('news_submit', 'public_news') . ' </TD> </TR > <TR id="tr_private"> <TD> <INPUT TYPE="RADIO" ID="privatenews" NAME="private_news" VALUE="1">' . $GLOBALS['Language']->getText('news_submit', 'private_news') . ' </TD> </TR></DIV> </TABLE></FIELDSET> </TD></TR>'; } $fmmf = new FileModuleMonitorFactory(); $count = count($fmmf->getFilesModuleMonitorFromDb($release->getPackageId())); if ($count > 0) { echo '<TR><TD><FIELDSET><LEGEND>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_notification') . '</LEGEND>'; echo '<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">'; echo '<TR><TD>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'users_monitor', $count) . '</TD></TR>'; echo '<TR><TD><B>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'mail_file_rel_notice') . '</B><INPUT TYPE="CHECKBOX" NAME="notification" VALUE="1" CHECKED>'; echo '</TD></TR>'; echo '</TABLE></FIELDSET></TD></TR>'; } ?> <TR> <TD ALIGN="CENTER"> <INPUT TYPE="HIDDEN" NAME="create" VALUE="bla"> <INPUT TYPE="SUBMIT" ID="create_release" VALUE="<?php echo $is_update ? $GLOBALS['Language']->getText('file_admin_editreleases', 'edit_release') : $GLOBALS['Language']->getText('file_admin_qrs', 'release_file'); ?> "> <input type="submit" ID="cancel_release" name="cancel" value="<?php echo $GLOBALS['Language']->getText('global', 'btn_cancel'); ?> " /> </TD> </TR> </TABLE> </FORM> <?php file_utils_footer(array()); }
<form name="editdata" action="index.php?mode=docdoedit&group_id=' . $group_id . '" method="POST" enctype="multipart/form-data"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="' . $sys_max_size_upload . '"> <table border="0" width="75%"> <tr> <th>' . $Language->getText('docman_new', 'doc_title') . ':</th> <td><input type="text" name="title" size="60" maxlength="255" value="' . $row['title'] . '"></td> </tr> <tr></tr> <tr> <th>' . $Language->getText('docman_new', 'doc_desc') . ':</th> <td><textarea cols="60" rows="4" wrap="virtual" name="description">' . $row['description'] . '</textarea></td> </tr> <tr> <th> <input type="checkbox" name="upload_instead" value="1"> <B>' . $Language->getText('docman_new', 'doc_upload') . ':</B></th> <td> <input type="file" name="uploaded_data" size="50"> <br><span class="smaller"><i>' . $Language->getText('docman_new', 'max_size_msg', array(formatByteToMb($sys_max_size_upload))) . ' </i></span> </td> </tr>'; // Display the content only for HTML and text documents that were not uploaded but copy/pasted if (($row['filetype'] == 'text/html' || $row['filetype'] == 'text/plain') && $row['filesize'] == 0) { echo '<tr> <th valign="top"><br><br>' . $Language->getText('docman_admin_index', 'doc_edit') . ':</th> <td><textarea cols="60" rows="20" wrap="virtual" name="data">'; echo $row['data']; echo '</textarea></td> </tr>'; } echo '<tr> <th>' . $Language->getText('docman_new', 'doc_group') . ':</th> <td>';
public function displayAdminCSVImport(Tracker_IDisplayTrackerLayout $layout, $request, $current_user) { $hp = Codendi_HTMLPurifier::instance(); $items = $this->getAdminItems(); $title = $items['csvimport']['title']; $this->displayAdminCSVImportHeader($layout, $title, array()); echo '<h2>' . $title . ' ' . help_button('TrackerV5ArtifactImport') . '</h2>'; echo '<form name="form1" method="POST" enctype="multipart/form-data" action="' . TRACKER_BASE_URL . '/?tracker=' . (int) $this->id . '&func=admin-csvimport">'; echo '<input type="file" name="csv_filename" size="50">'; echo '<br>'; echo '<span class="smaller"><em>' . $GLOBALS['Language']->getText('plugin_tracker_import', 'max_upload_size', formatByteToMb($GLOBALS['sys_max_size_upload'])) . '</em></span>'; echo '<br>'; echo $GLOBALS['Language']->getText('plugin_tracker_admin_import', 'send_notifications'); echo '<input type="checkbox" name="notify" value="ok" />'; echo '<br>'; echo '<input type="hidden" name="action" value="import_preview">'; echo '<input type="submit" value="' . $GLOBALS['Language']->getText('plugin_tracker_import', 'submit_info') . '">'; echo '</form>'; $this->displayFooter($layout); }
/** * Display screen accepting the CSV file to be parsed * * */ function displayCSVInput($atid, $user_id) { global $Language, $sys_max_size_upload; $this->ath->header(array('title' => $Language->getText('tracker_import', 'art_import') . ' ' . $this->ath->getID() . ' - ' . $this->ath->getName(), 'pagename' => 'tracker', 'atid' => $this->ath->getID(), 'sectionvals' => array($this->group->getPublicName()), 'help' => 'tracker-v3.html#tracker-artifact-import')); echo '<div id="tracker_toolbar_clear"></div>' . PHP_EOL; echo '<h3>' . $Language->getText('tracker_import', 'import_new_hdr', array(help_button('tracker-v3.html#tracker-artifact-import'))) . '</h3>'; echo '<p>' . $Language->getText('tracker_import', 'import_new_msg', array('/tracker/index.php?group_id=' . (int) $this->group->group_id . '&atid=' . (int) $atid . '&user_id=' . (int) $user_id . '&mode=showformat&func=import')) . '</p>'; $_pref_notify = user_get_preference('tracker_import_notify_' . $atid); $notifychecked = ''; if ($_pref_notify === '1') { $notifychecked = 'checked="checked"'; } echo ' <FORM NAME="importdata" id="tracker-import-data" action="" method="POST" enctype="multipart/form-data"> <INPUT TYPE="hidden" name="group_id" value="' . (int) $this->group->group_id . '"> <INPUT TYPE="hidden" name="atid" value="' . (int) $atid . '"> <INPUT TYPE="hidden" name="func" value="import"> <INPUT TYPE="hidden" name="mode" value="parse"> <table border="0"> <tr> <th> '; //<input type="checkbox" name="file_upload" value="1"> echo '<B>' . $Language->getText('tracker_import', 'upload_file') . '</B></th> <td> <input type="file" name="csv_filename" size="50"> </td> <td> <span class="help"><i>' . $Language->getText('tracker_import', 'max_upload_size', formatByteToMb($sys_max_size_upload)) . '</i></span> </td> </tr> <tr> <th> ' . $Language->getText('tracker_import', 'send_notifications') . ' </th> <td colspan="2"> <input type="checkbox" name="notify" value="ok" "' . $notifychecked . '"/> </td> </tr>'; //<tr> //<th>OR Paste Artifact Data (in CSV format):</th> //<td><textarea cols="60" rows="10" name="data"></textarea></td> //</tr> echo ' </table> <br> <input class="btn btn-primary" type="submit" value="' . $Language->getText('tracker_import', 'submit_info') . '"> </FORM> '; $this->ath->footer(array()); }
<INPUT TYPE="HIDDEN" NAME="id" VALUE="' . $id . '"> <TABLE> <TR><TD COLSPAN="2"><B>' . $Language->getText('snippet_addversion', 'version') . '</B> <INPUT TYPE="TEXT" NAME="version" SIZE="10" MAXLENGTH="15"> </TD></TR> <TR><TD COLSPAN="2"><B>' . $Language->getText('snippet_addversion', 'changes') . '</B><BR> <TEXTAREA NAME="changes" ROWS="5" COLS="45"></TEXTAREA> </TD></TR> <TR><TD COLSPAN="2"> <br><B>' . $Language->getText('snippet_addversion', 'upload_s') . '</B> <P> <input type="file" name="uploaded_data" size="40"> <br><span class="smaller"><i>' . $Language->getText('snippet_addversion', 'max_size', formatByteToMb($sys_max_size_upload)) . '</i></span> <P> <B>' . $Language->getText('snippet_addversion', 'paste_code') . '</B><BR> <TEXTAREA NAME="code" ROWS="30" COLS="85" WRAP="SOFT"></TEXTAREA> </TD></TR> <TR><TD COLSPAN="2"> <B>' . $Language->getText('snippet_add_snippet_to_package', 'all_info_complete') . '</B> <BR> <INPUT CLASS="btn btn-primary" TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('global', 'btn_submit') . '"> </TD></TR> </FORM> </TABLE>'; snippet_footer(array()); } else { if ($type == 'package') {
function getField() { $html = '<input type="hidden" name="max_file_size" value="' . $GLOBALS['sys_max_size_upload'] . '" /><input type="file" name="file" />'; $html .= '<br /><em>' . $GLOBALS['Language']->getText('plugin_docman', 'max_size_msg', array(formatByteToMb($GLOBALS['sys_max_size_upload']))) . '</em>'; return $html; }