5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2002-2004 (c) GForge Team
7 * Copyright 2010-2011, Franck Villaume - Capgemini
8 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
9 * Copyright 2012-2014, Franck Villaume - TrivialDev
10 * http://fusionforge.org
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
18 * FusionForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 /* please do not add require here : use www/frs/index.php to add require */
29 /* global variables used */
30 global $HTML; // html object
31 global $group_id; // id of group
32 global $g; // group object
33 global $permissionlevel;
36 if (!forge_check_perm('frs_admin', $group_id, 'read')) {
37 $warning_msg = _('FRS Access Denied');
38 session_redirect('/frs/?group_id='.$group_id);
41 $FRSPackages = $fpFactory->getFRSs();
43 if (count($FRSPackages) > 0) {
44 echo html_e('h2', array(), _('QRS'));
45 if ($permissionlevel >= 4) { // admin
46 echo html_e('p', array(), _('Click here to ').util_make_link('/frs/?view=qrs&group_id='.$group_id, _('quick-release a file')));
50 echo html_ao('script', array('type' => 'text/javascript'));
54 jQuery(document).ready(function() {
55 controllerFRS = new FRSController();
59 echo html_ac(html_ap() - 1);
61 echo html_ao('fieldset', array('class' => 'coolfieldset', 'id' => 'fieldset1_closed'));
62 echo html_e('legend', array(), _('Help about Packages and Releases'));
64 echo html_e('h3', array(), _('Packages'));
65 echo html_e('p', array(), _('You can use packages to group different file releases together, or use them however you like.'));
66 echo html_e('h4', array(), _('An example of packages')._(':'));
67 echo html_e('p', array(), html_e('strong', array(), 'Mysql-win').html_e('br').html_e('strong', array(), 'Mysql-unix').html_e('br').html_e('strong', array(), 'Mysql-odbc'));
68 echo html_e('h4', array(), _('Your Packages')._(':'));
69 $lielements = array();
70 $lielements[] = array('content' => _('Define your packages'));
71 $lielements[] = array('content' => _('Create new releases of packages.'));
72 echo $HTML->html_list($lielements, array(), 'ol');
73 echo html_e('h3', array(), _('Releases of Packages'));
74 echo html_e('p', array(), _('A release of a package can contain multiple files.'));
75 echo html_e('h4', array(), _('Examples of releases')._(':'));
76 echo html_e('p', array(), html_e('strong', array(), '3.22.1').html_e('br').html_e('strong', array(), '3.22.2').html_e('br').html_e('strong', array(), '3.22.3'));
77 echo html_e('p', array(), _('You can create new releases of packages by clicking on <strong>Add/Edit Releases</strong> next to your package name.'));
78 echo html_ac(html_ap() -2);
80 //Show a list of existing packages for this project so they can be edited
81 if (count($FRSPackages) == 0) {
82 echo $HTML->information(_('There are no packages defined.'));
85 $thTitleArray = array();
86 if ($permissionlevel >= 4) { // admin
87 $title_arr[] = html_e('input', array('id' => 'checkallactive', 'type' => 'checkbox', 'title' => _('Select / Deselect all packages for massaction'), 'onClick' => 'controllerFRS.checkAll("checkedrelidactive", "active")'));
88 $thTitleArray[] = NULL;
90 $title_arr[] = _('Package name');
91 $thTitleArray[] = NULL;
92 $title_arr[] = _('Status');
93 $thTitleArray[] = NULL;
94 $title_arr[] = _('Publicly Viewable');
95 $thTitleArray[] = _('To change public visibility of a specific package, you have to use the role permission.');
96 $title_arr[] = _('Actions on package');
97 $thTitleArray[] = NULL;
98 $title_arr[] = _('Actions on release');
99 $thTitleArray[] = NULL;
102 echo $HTML->listTableTop($title_arr, array(), '', '', array(), $thTitleArray);
103 foreach ($FRSPackages as $key => $FRSPackage) {
105 if (forge_check_perm('frs', $FRSPackage->getID(), 'admin')) {
106 $cells[][] = html_e('input', array('type' => 'checkbox', 'value' => $FRSPackage->getID(), 'class' => 'checkedrelidactive', 'title' => _('Select / Deselect this package for massaction'), 'onClick' => 'controllerFRS.checkgeneral("active")'));
110 $package_nameInputAttr = array('type' => 'text', 'name' => 'package_name', 'value' => html_entity_decode($FRSPackage->getName()), 'size' => 20, 'maxlength' => 60, 'required' => 'required', 'pattern' => '.{3,}', 'title' => _('At least 3 characters'));
111 if (!forge_check_perm('frs', $FRSPackage->getID(), 'admin')) {
112 $package_nameInputAttr['disabled'] = 'disabled';
114 $cells[][] = html_e('input', $package_nameInputAttr);
115 if (forge_check_perm('frs', $FRSPackage->getID(), 'admin')) {
116 $cells[][] = frs_show_status_popup('status_id', $FRSPackage->getStatus());
117 $cells[][] = $FRSPackage->getPublicLabel();
118 $deleteUrlAction = util_make_uri('/frs/?action=deletepackage&package_id='.$FRSPackage->getID().'&group_id='.$group_id);
119 $cells[][] = html_e('input', array('type' => 'button', 'name' => 'submit', 'value' => _('Update'), 'onclick' => 'javascript:controllerFRS.updatePackage({rowid: \'#pkgid'.$FRSPackage->getID().'\', action: \''.util_make_uri('/frs/?group_id='.$group_id.'&action=updatepackage&package_id='.$FRSPackage->getID()).'\'})')).
120 util_make_link('#', $HTML->getDeletePic(_('Delete this package'), _('Delete package')), array('onclick' => 'javascript:controllerFRS.toggleConfirmBox({idconfirmbox: \'confirmbox1\', do: \''._('Delete the package').' '.html_entity_decode($FRSPackage->getName()).'\', cancel: \''._('Cancel').'\', height: 150, width: 300, action: \''.$deleteUrlAction.'\'})' ), true);
122 $cells[][] = $FRSPackage->getStatusName();
123 $cells[][] = $FRSPackage->getPublicLabel();
127 if (forge_check_perm('frs', $FRSPackage->getID(), 'release')) {
128 $content .= util_make_link('/frs/?view=qrs&package_id='.$FRSPackage->getID().'&group_id='.$group_id, '<strong>['._('Add Release').']</strong>');
130 if (forge_check_perm('frs', $FRSPackage->getID(), 'file') && count($FRSPackage->getReleases())) {
131 $content .= util_make_link('/frs/?view=showreleases&package_id='.$FRSPackage->getID().'&group_id='.$group_id, $HTML->getConfigurePic(_('Edit Releases'), _('Edit Releases')));
133 $cells[] = array($content, 'style' => 'white-space: nowrap;', 'align' => 'center');
134 echo $HTML->multiTableRow(array('id' => 'pkgid'.$FRSPackage->getID()), $cells);
136 echo $HTML->listTableBottom();
137 if ($permissionlevel >= 4) { // admin
138 $deleteUrlAction = util_make_uri('/frs/?action=deletepackage&group_id='.$group_id);
140 echo html_ao('span', array('id' => 'massactionactive', 'class' => 'hide'));
141 echo html_e('span', array('id' => 'frs-massactionmessage', 'title' => _('Actions availables for selected packages, you need to check at least one package to get actions')), _('Mass actions for selected packages')._(':'), false);
142 echo util_make_link('#', $HTML->getDeletePic(_('Delete selected package(s)'), _('Delete packages')), array('onclick' => 'javascript:controllerFRS.toggleConfirmBox({idconfirmbox: \'confirmbox1\', do: \''._('Delete selected package(s)').'\', cancel: \''._('Cancel').'\', height: 150, width: 300, action: \''.$deleteUrlAction.'&package_id=\'+controllerFRS.buildUrlByCheckbox("active")})', 'title' => _('Delete selected package(s)')), true);
143 echo html_ac(html_ap() - 2);
145 echo $HTML->jQueryUIconfirmBox('confirmbox1', _('Delete package'), _('You are about to delete permanently this package. Are you sure? This action is definitive.'));
148 form to create a new package
150 if (forge_check_perm('frs_admin', $group_id, 'admin')) {
151 echo html_ao('fieldset');
152 echo html_e('legend', array(), _('Create New Package'));
153 echo $HTML->openForm(array('action' => '/frs/?group_id='.$group_id.'&action=addpackage', 'method' => 'post'));
154 echo html_e('p', array(), html_e('strong', array(), _('New Package Name')._(':')).html_e('input', array('type' => 'text', 'name' => 'package_name', 'size' => 20, 'maxlength' => 30, 'required' => 'required', 'pattern' => '.{3,}', 'title' => _('At least 3 characters'))).html_e('input', array('type' => 'submit', 'name' => 'submit', 'value' => _('Create'))));
155 echo $HTML->closeForm();
156 echo html_ac(html_ap() - 1);