3 * Copyright 2011, Sabri LABBENE - Institut Télécom
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once('../../../env.inc.php');
24 require_once $gfwww.'include/pre.php';
25 require_once $gfplugins.'globaldashboard/include/globalDashboard_utils.php';
26 require_once $gfplugins.'globaldashboard/include/globalDashboardConstants.php';
27 require_once $gfplugins.'globaldashboard/common/manage_accounts_db_utils.php';
29 $user = session_get_user(); // get the user session
31 if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
32 exit_error("Invalid User", "Cannot Process your request for this user.");
35 $type = getStringFromRequest('type');
36 $id = getStringFromRequest('id');
37 $pluginname = getStringFromRequest('pluginname');
38 $action = getStringFromRequest('action');
41 exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
43 exit_error("Cannot Process your request","No ID specified");
45 if ($type == 'user' && $action == 'edit') {
46 $realuser = user_get_object($id);//
47 if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
48 exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
50 if ( (!$user) || ($user->getID() != $id)) {
51 // if someone else tried to access the private GlobalDashboard part of this user
52 exit_error("Access Denied", "You cannot access other user's personal $pluginname");
55 globaldashboard_header(array('title'=> _('Remote Account Management')));
56 globaldashboard_toolbar();
57 editRemoteAccount(getStringFromRequest('account_id'));
60 site_project_footer(array());
64 * UI to edit a stored remote account.
65 * @param integer $account_id
67 function editRemoteAccount($account_id) {
69 $account = getDBStoredRemoteAccountById($account_id);
71 <form action="edit_account.php" method="POST">';
74 <legend> '. _('Main account properties') . ' </legend>
77 <td>' . _('User Name') . ': </td>
79 <input type="hidden" value="'. $account['account_id'] .'" name="account_id">
80 <input type="hidden" value="'. $account['user_id'] .'" name="user_id">
81 <input type="text" value="'.$account["forge_account_login_name"].'" name="login_name">
86 <td>' . _('Account password') . ': </td>
88 <input type="password" name="account_password">
92 <td>' . _('Remote Forge Software') . ': </td>
94 <select name="forge_software">
95 <option value="'. REMOTE_FORGE_SOFTWARE_FUSIONFORGE .'"';
96 if ($account['forge_software'] == REMOTE_FORGE_SOFTWARE_FUSIONFORGE){
97 echo ' selected="selected"';
99 echo '> FusionForge </option>
100 <option value="'. REMOTE_FORGE_SOFTWARE_CODENDI .'"';
101 if ($account['forge_software'] == REMOTE_FORGE_SOFTWARE_CODENDI){
102 echo 'selected="selected"';
104 echo '> Codendi </option>
105 <option value="'. REMOTE_FORGE_SOFTWARE_TULEAP .'"';
106 if ($account['forge_software'] == REMOTE_FORGE_SOFTWARE_TULEAP) {
107 echo 'selected="selected"';
109 echo '> Tuleap </option>
110 <option value="'. REMOTE_FORGE_SOFTWARE_REDMINE .'"';
111 if ($account['forge_software'] == REMOTE_FORGE_SOFTWARE_REDMINE) {
112 echo 'selected="selected"';
114 echo '> Redmine </option>
115 <option value="'. REMOTE_FORGE_SOFTWARE_TRACK .'"';
116 if ($account['forge_software'] == REMOTE_FORGE_SOFTWARE_TRACK) {
117 echo 'selected="selected"';
119 echo '> Track </option>
124 <td>' . _('Account domain') . ': </td>
126 <input type="text" size="60" value="'.$account["forge_account_domain"].'" name="account_domain">
131 <td>' . _('Account URI') . ': </td>
133 <input type="text" size="60" value="'.$account["forge_account_uri"].'" name="account_uri">
134 <input type="checkbox" name="account_is_foaf"';
135 if($account['forge_account_is_foaf']) {
136 echo 'checked="yes"';
139 echo _('Is account FOAF enabled ?') . '
147 <legend> '. _('Account Discovery Capabilities') . ' </legend>
150 <td>' . _('OSLC Discovery URI') . ': </td>
152 <input type="text" size="60" value="'.$account["forge_oslc_discovery_uri"].'" name="oslc_uri">
157 <td>' . _('RSS Stream URI') . ': </td>
159 <input type="text" size="60" value="'.$account["forge_account_rss_uri"].'" name="rss_uri">
163 <td>' . _('SOAP WSDL URI') . ': </td>
165 <input type="text" size="60" value="'.$account['forge_account_soap_wsdl_uri'].'" name="soap_wsdl">
170 $discovery = getDBAccountDiscoveryByAccountId($account_id);
173 <legend>' . _('Ressources Discovery Parameters') . '</legend>
176 <td>' . _('Projects discovery method') . ': </td>
178 <select name="projects_discovery_method">
179 <option value"'. USER_PROJECTS_FETCH_METHOD_NONE .'"';
180 if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_NONE) {
181 echo 'selected="selected"';
183 echo '> None </option>
184 <option value="'. USER_PROJECTS_FETCH_METHOD_SOAP .'"';
185 if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_SOAP) {
186 echo 'selected="selected"';
188 echo '> SOAP </option>
189 <option value="'. USER_PROJECTS_FETCH_METHOD_OSLC .'"';
190 if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_OSLC) {
191 echo 'selected="selected"';
193 echo '> OSLC-CM </option>
194 <option value="' . USER_PROJECTS_FETCH_METHOD_FOAF . '"';
195 if ($discovery['projects_discovery_method'] == USER_PROJECTS_FETCH_METHOD_FOAF) {
196 echo 'selected="selected"';
198 echo '> FOAF </option>
203 <td>' . _('Artifacts discovery method') . ': </td>
205 <select name="artifacts_discovery_method">
206 <option value="'. USER_ARTIFACTS_FETCH_METHOD_NONE .'"';
207 if($discovery['artifacts_discovery_method'] == USER_ARTIFACTS_FETCH_METHOD_NONE) {
208 echo 'selected="selected"';
210 echo '> None </option>
211 <option value="'. USER_ARTIFACTS_FETCH_METHOD_SOAP .'"';
212 if($discovery['artifacts_discovery_method'] == USER_ARTIFACTS_FETCH_METHOD_SOAP) {
213 echo 'selected="selected"';
216 echo '> SOAP </option>
217 <option value="'. USER_ARTIFACTS_FETCH_METHOD_OSLC .'"';
218 if($discovery['artifacts_discovery_method'] == USER_PROJECTS_FETCH_METHOD_OSLC) {
219 echo 'selected="selected"';
221 echo '> OSLC-CM </option>
228 echo '<p style="text-align: center;">
229 <input type="submit" value="Submit account changes">