3 * Project Admin: Edit Releases of Packages
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2002-2004 (c) GForge Team
7 * Copyright 2012-2014, Franck Villaume - TrivialDev
8 * http://fusionforge.org/
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 /* please do not add require here : use www/frs/index.php to add require */
27 /* global variables used */
28 global $HTML; // html object
29 global $group_id; // id of group
30 global $g; // group object
32 $package_id = getIntFromRequest('package_id');
33 $release_id = getIntFromRequest('release_id');
35 if (!$package_id || !$release_id) {
36 session_redirect('/frs/?view=admin&group_id='.$group_id);
39 session_require_perm('frs', $package_id, 'file');
44 $frsp = new FRSPackage($g, $package_id);
45 if (!$frsp || !is_object($frsp)) {
46 exit_error(_('Could Not Get FRS Package'), 'frs');
47 } elseif ($frsp->isError()) {
48 exit_error($frsp->getErrorMessage(), 'frs');
54 $frsr = new FRSRelease($frsp,$release_id);
55 if (!$frsr || !is_object($frsr)) {
56 exit_error(_('Could Not Get FRS Release'), 'frs');
57 } elseif ($frsr->isError()) {
58 exit_error($frsr->getErrorMessage(), 'frs');
61 echo html_ao('script', array('type' => 'text/javascript'));
66 jQuery(document).ready(function() {
67 controllerFRS = new FRSController();
72 echo html_ac(html_ap() - 1);
73 echo html_e('h2', array(), _('Edit Release for the package').' '.$frsp->getName());
75 * Show the forms for each part
77 if (forge_check_perm('frs', $package_id, 'admin')) {
78 echo $HTML->openForm(array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => '/frs/?group_id='.$group_id.'&release_id='.$release_id.'&package_id='.$package_id.'&action=editrelease'));
79 echo $HTML->listTableTop();
81 $cells[][] = '<strong>'._('Release Date')._(':').'</strong>';
82 $cells[][] = '<input type="text" name="release_date" value="'.date('Y-m-d H:i',$frsr->getReleaseDate()).'" size="16" maxlength="16" />';
83 echo $HTML->multiTableRow(array(), $cells);
85 $cells[][] = '<strong>'._('Release Name').utils_requiredField()._(':').'</strong>';
86 $cells[][] = '<input type="text" name="release_name" value="'.$frsr->getName().'" required="required" pattern=".{3,}" title="'._('At least 3 characters').'" />';
87 echo $HTML->multiTableRow(array(), $cells);
89 $cells[][] = '<strong>'._('Status')._(':').'</strong>';
90 $cells[][] = frs_show_status_popup('status_id',$frsr->getStatus());
91 echo $HTML->multiTableRow(array(), $cells);
93 $cells[] = array(_('Edit the Release Notes or Change Log for this release of this package. These changes will apply to all files attached to this release.').'<br/>'.
94 _('You can either upload the release notes and change log individually, or paste them in together below.'), 'colspan' => 2);
95 echo $HTML->multiTableRow(array(), $cells);
97 $cells[] = array('<strong>'._('Upload Release Notes')._(':').'</strong>'.
98 '('._('max upload size')._(': ').human_readable_bytes(util_get_maxuploadfilesize()).')', 'colspan' => 2);
99 echo $HTML->multiTableRow(array(), $cells);
101 $cells[] = array('<input type="file" name="uploaded_notes" size="30" />', 'colspan' => 2);
102 echo $HTML->multiTableRow(array(), $cells);
104 $cells[] = array('<strong>'._('Upload Change Log')._(':').'</strong>'.
105 '('._('max upload size')._(': ').human_readable_bytes(util_get_maxuploadfilesize()).')', 'colspan' => 2);
106 echo $HTML->multiTableRow(array(), $cells);
108 $cells[] = array('<input type="file" name="uploaded_changes" />', 'colspan' => 2);
109 echo $HTML->multiTableRow(array(), $cells);
111 $cells[] = array('<strong>'._('Paste The Notes In')._(':').'</strong><br/>'.
112 '<textarea name="release_notes" rows="10" cols="60">'.$frsr->getNotes().'</textarea>', 'colspan' => 2);
113 echo $HTML->multiTableRow(array(), $cells);
115 $cells[] = array('<strong>'._('Paste The Change Log In')._(':').'</strong><br/>'.
116 '<textarea name="release_changes" rows="10" cols="60">'.$frsr->getChanges().'</textarea>', 'colspan' => 2);
117 echo $HTML->multiTableRow(array(), $cells);
119 $cells[] = array('<input type="checkbox" name="preformatted" value="1" '.(($frsr->getPreformatted())?'checked="checked"':'').' />'._('Preserve my pre-formatted text').
120 '<p><input type="submit" name="submit" value="'._('Submit/Refresh').'" /></p>', 'colspan' => 2);
121 echo $HTML->multiTableRow(array(), $cells);
122 echo $HTML->listTableBottom();
123 echo $HTML->closeForm();
126 echo html_e('h2', array(), _('Add Files To This Release'));
127 echo html_e('p', array(), _('Now, choose a file to upload into the system.'));
129 echo $HTML->openForm(array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => '/frs/?group_id='.$group_id.'&release_id='.$release_id.'&package_id='.$package_id.'&action=addfile'));
130 echo html_ao('fieldset');
131 echo html_e('legend', array(), '<strong>'._('File Name').'</strong>');
132 echo _('Upload a new file')._(': ').'<input type="file" name="userfile" />'.'('._('max upload size')._(': ').human_readable_bytes(util_get_maxuploadfilesize()).')';
133 // the following var will be set by different include.
135 if (forge_get_config('use_ftp_uploads')) {
136 include ($gfcommon.'frs/views/useftpuploads.php');
139 if (forge_get_config('use_manual_uploads')) {
140 include $gfcommon.'frs/views/usemanualuploads.php';
142 if ($g->usesDocman() && forge_check_perm('docman', $group_id, 'read')) {
143 include $gfcommon.'frs/views/docmanfile.php';
145 if (!empty($content)) {
148 echo html_ac(html_ap() -1);
149 echo $HTML->listTableTop();
151 $cells[][] = '<strong>'._('File Type')._(':').'</strong>';
152 $cells[][] = frs_show_filetype_popup('type_id');
153 $cells[][] = '<strong>'._('Processor Type')._(':').'</strong>';
154 $cells[][] = frs_show_processor_popup('processor_id');
155 echo $HTML->multiTableRow(array(), $cells);
156 echo $HTML->listTableBottom();
157 echo html_e('p', array(), '<input type="submit" name="submit" value="'._('Add This File').'" />');
158 echo $HTML->closeForm();
159 // Get a list of files associated with this release
160 $files = $frsr->getFiles();
163 echo html_e('h2', array(), _('Edit Files In This Release'));
164 print(_('Once you have added files to this release you <strong>must</strong> update each of these files with the correct information or they will not appear on your download summary page.')."\n");
165 $title_arr[] = html_e('input', array('id' => 'checkallactive', 'type' => 'checkbox', 'title' => _('Select / Deselect all files for massaction'), 'onClick' => 'controllerFRS.checkAll("checkedrelidactive", "active")'));
166 $title_arr[] = _('File Name');
167 $title_arr[] = _('Processor');
168 $title_arr[] = _('File Type');
169 $title_arr[] = _('Release');
170 $title_arr[] = _('Release Date');
171 $title_arr[] = _('Actions');
173 echo $HTML->listTableTop($title_arr, array(), '', '', array(), array(), array(array('style' => 'width: 2%'), array('style' => 'width: 30%')));
174 echo '<tr><td colspan="7" style="padding:0;">';
175 foreach ($files as $key => $file) {
176 echo $HTML->openForm(array('action' => '/frs/?group_id='.$group_id.'&release_id='.$release_id.'&package_id='.$package_id.'&file_id='.$file->getID().'&action=editfile', 'method' => 'post', 'id' => 'fileid'.$file->getID()));
177 echo $HTML->listTableTop();
179 $cells[] = array(html_e('input', array('type' => 'checkbox', 'value' => $file->getID(), 'class' => 'checkedrelidactive', 'title' => _('Select / Deselect this file for massaction'), 'onClick' => 'controllerFRS.checkgeneral("active")')), 'style' => 'width: 2%; padding: 0px;');
180 $cells[] = array($file->getName(), 'style' => 'white-space: nowrap; width: 30%');
181 $cells[][] = frs_show_processor_popup('processor_id', $file->getProcessorID());
182 $cells[][] = frs_show_filetype_popup('type_id', $file->getTypeID());
183 $cells[][] = frs_show_release_popup($group_id, $name = 'new_release_id', $release_id);
184 $cells[][] = '<input type="text" name="release_time" value="'.date('Y-m-d', $file->getReleaseTime()).'" size="10" maxlength="10" />';
185 $deleteUrlAction = util_make_uri('/frs/?action=deletefile&package_id='.$package_id.'&group_id='.$group_id.'&file_id='.$file->getID());
186 $cells[][] = '<input type="submit" name="submit" value="'._('Update/Refresh').'" />'.util_make_link('#', $HTML->getDeletePic(_('Delete this file'), _('Delete file')), array('onclick' => 'javascript:controllerFRS.toggleConfirmBox({idconfirmbox: \'confirmbox1\', do: \''._('Delete the file').' '.$file->getName().'\', cancel: \''._('Cancel').'\', height: 150, width: 400, action: \''.$deleteUrlAction.'\'})' ), true);
187 echo $HTML->multiTableRow(array(), $cells);
188 echo $HTML->listTableBottom();
189 echo $HTML->closeForm();
192 echo $HTML->listTableBottom();
193 $deleteUrlAction = util_make_uri('/frs/?action=deletefile&group_id='.$group_id.'&package_id='.$package_id);
195 echo html_ao('span', array('id' => 'massactionactive', 'class' => 'hide'));
196 echo html_e('span', array('id' => 'frs-massactionmessage', 'title' => _('Actions availables for selected files, you need to check at least one file to get actions')), _('Mass actions for selected files')._(':'), false);
197 echo util_make_link('#', $HTML->getDeletePic(_('Delete selected file(s)'), _('Delete files')), array('onclick' => 'javascript:controllerFRS.toggleConfirmBox({idconfirmbox: \'confirmbox1\', do: \''._('Delete selected file(s)').'\', cancel: \''._('Cancel').'\', height: 150, width: 300, action: \''.$deleteUrlAction.'&file_id=\'+controllerFRS.buildUrlByCheckbox("active")})', 'title' => _('Delete selected file(s)')), true);
198 echo html_ac(html_ap() - 2);
201 echo $HTML->jQueryUIconfirmBox('confirmbox1', _('Delete file'), _('You are about to delete permanently this file. Are you sure? This action is definitive.'));
203 if ($g->usesTracker()) {
204 include $gfcommon.'frs/views/linktrackerroadmap.php';
207 if (forge_get_config('use_object_associations')) {
209 echo html_e('h2', array(), _('Associate Objects To/From This Release'));
210 echo $frsr->showAssociations('/frs/?action=deleteassociation&group_id='.$group_id.'&package_id='.$package_id.'&release_id='.$release_id);
211 echo $HTML->openForm(array('action' => '/frs/?action=addassociation&group_id='.$group_id.'&package_id='.$package_id.'&release_id='.$release_id, 'method' => 'post'));
212 echo $frsr->showAddAssociations();
213 echo html_e('input', array('type' => 'submit', 'name' => 'submit', 'value' => _('Associate Objects')));
214 echo $HTML->closeForm();
218 echo html_e('h2', array(), _('Monitoring Information'));
219 echo html_e('p', array(), sprintf(ngettext('There is %s user monitoring this package.', 'There are %s users monitoring this package.', $frsp->getMonitorCount()), $frsp->getMonitorCount()));