3 * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
5 * This file is part of FusionForge. FusionForge is free software;
6 * you can redistribute it and/or modify it under the terms of the
7 * GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the Licence, or (at your option)
11 * FusionForge is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Standard Alcatel-Lucent disclaimer for contributing to open source
24 * "The provided file ("Contribution") has not been tested and/or
25 * validated for release as or in products, combinations with products or
26 * other commercial use. Any use of the Contribution is entirely made at
27 * the user's own responsibility and the user can not rely on any features,
28 * functionalities or performances Alcatel-Lucent has attributed to the
31 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
32 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
33 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
34 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
35 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
36 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
37 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
38 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
39 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
44 // This page contains a form with a file-upload button
45 // so a user can choose a file to upload a .csv file and store it in task mgr
49 pm_header(array('title'=>_('Upload data into the tasks.'),'group_project_id'=>$group_project_id));
51 $default = array('headers' => 1, 'full' => 1, 'sep' => ',');
53 if (session_loggedin()) {
54 $u = session_get_user();
55 $pref = $u->getPreference('csv');
57 $default = array_merge($default, unserialize($pref));
61 $headers = getIntFromRequest('headers', $default['headers']);
62 $full = getIntFromRequest('full', $default['full']);
63 $sep = getStringFromRequest('sep', $default['sep']);
65 if (session_loggedin()) {
66 if ( ($sep !== $default['sep']) || ($headers !== $default['headers']) ) {
67 $pref = array_merge( $default, array('headers' => $headers, 'full' => $full, 'sep' => $sep));
68 $u->setPreference('csv', serialize($pref));
72 $url_set_format = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=format_csv&sep='.urlencode($sep).'&full='.$full.'&headers='.$headers;
74 $url_export = '/pm/task.php?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=downloadcsv&sep='.urlencode($sep).'&full='.$full.'&headers='.$headers;
76 $format = $full ? "Full CSV" : "Normal CSV";
77 $format .= $headers ? ' with headers' : ' without headers';
78 $format .= " using '$sep' as separator.";
80 <p><?php echo _('This page allows you to export or import all the tasks using a CSV (<a href="http://en.wikipedia.org/wiki/Comma-separated_values">Comma Separated Values</a>) File. This format can be used to view tasks using MS Excel.'); ?></p>
81 <h2><?php echo _('Export tasks as a CSV file'); ?></h2>
83 <strong><?php echo _('Selected CSV Format :'); ?></strong> <?php echo $format ?> <a href="<?php echo $url_set_format ?>">(Change)</a>
85 <p><a href="<?php echo $url_export ?>"><?php echo _('Export CSV file'); ?></a></p>
87 <h2><?php echo _('Import tasks using a CSV file'); ?></h2>
88 <form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')?>?group_project_id=<?php echo $group_project_id ?>&group_id=<?php echo $group_id ?>&func=postuploadcsv">
89 <p><?php echo _('Choose a file in the proper .csv format for uploading.'); ?></p>
90 <input type="file" name="userfile" size="30" />
91 <input type="submit" name="submit" value="submit" />
94 <p><strong>Notes:</strong></p>
97 <li>Be careful, when importing a CSV file, all the tasks will be replaced by the ones present in the file.</li>
98 <li>If project_task_id is empty, then a new task will be created.</li>
99 <li>If project_task_id is present, then the corresponding task will be updated.</li>
103 <h2>Record Layout</h2>
105 <table align="center" border="1" cellspacing="0" cellpadding="3">
106 <tr><td><strong>Field Name</strong></td><td><strong>Description</strong></td></tr>
107 <tr><td>project_task_id</td><td>this is the ID in gforge database</td></tr>
108 <tr><td>external_task_id</td><td>optional, the equivalent of project_task_id but determined by
109 external application, such as MS Project. Primarily preserved for sorting purposes only.</td></tr>
110 <tr><td>parent_id</td><td>the project_task_id of the parent task, if any</td></tr>
111 <tr><td>external_parent_id</td><td>the equivalent of parent project_task_id but
112 determined by external application, such as MS Project. Primarily preserved for matching purposes only.</td></tr>
113 <tr><td>title</td><td>The summary or brief description</td></tr>
114 <tr><td>category</td><td>The category name (must be defined, only available in full export)</td></tr>
115 <tr><td>duration</td><td>Duration in days</td></tr>
116 <tr><td>work</td><td>Number of hours required to complete</td></tr>
117 <tr><td>start_date</td><td>The start date in MM-DD-YYYY HH:MM:SS format</td></tr>
118 <tr><td>end_date</td><td>The end date in MM-DD-YYYY HH:MM:SS format</td></tr>
119 <tr><td>percent_complete</td><td>Percentage of completion</td></tr>
120 <tr><td>priority</td><td>integers 1 to 5</td></tr>
121 <tr><td>notes</td><td>optional, the details of the task or a comment to add to a task</td></tr>
122 <tr><td>resource1_unixname</td><td>optional, the unixname or precisely-matched realname of the assignee </td></tr>
123 <tr><td>resource2_unixname</td><td>optional, same as above</td></tr>
124 <tr><td>resource3_unixname</td><td>optional, same as above</td></tr>
125 <tr><td>resource4_unixname</td><td>optional, same as above</td></tr>
126 <tr><td>resource5_unixname</td><td>optional, same as above</td></tr>
127 <tr><td>dependenton1_project_task_id</td><td>optional, the GForge task_id of a task to be dependent on</td></tr>
128 <tr><td>dependenton1_external_task_id</td><td>optional, the ID used by the external application</td></tr>
129 <tr><td>dependenton1_linktype</td><td>SS, SF, FS, FF, - The same types as MS Project</td></tr>
130 <tr><td>dependenton2_project_task_id</td><td>repetition of dependenton1</td></tr>
131 <tr><td>dependenton2_external_task_id</td><td>repetition of dependenton1</td></tr>
132 <tr><td>dependenton2_linktype</td><td>repetition of dependenton1</td></tr>
133 <tr><td>dependenton3_project_task_id</td><td>repetition of dependenton1</td></tr>
134 <tr><td>dependenton3_external_task_id</td><td>repetition of dependenton1</td></tr>
135 <tr><td>dependenton3_linktype</td><td>repetition of dependenton1</td></tr>
136 <tr><td>dependenton4_project_task_id</td><td>repetition of dependenton1</td></tr>
137 <tr><td>dependenton4_external_task_id</td><td>repetition of dependenton1</td></tr>
138 <tr><td>dependenton4_linktype</td><td>repetition of dependenton1</td></tr>
139 <tr><td>dependenton5_project_task_id</td><td>repetition of dependenton1</td></tr>
140 <tr><td>dependenton5_external_task_id</td><td>repetition of dependenton1</td></tr>
141 <tr><td>dependenton5_linktype</td><td>repetition of dependenton1</td></tr>