]>
Commit | Line | Data |
---|---|---|
be762003 ER |
1 | diff -ur eventum/ajax/order.php eventum-new/ajax/order.php |
2 | --- eventum/ajax/order.php 2008-10-15 01:46:20.000000000 +0300 | |
3 | +++ eventum-new/ajax/order.php 2008-10-15 02:02:25.000000000 +0300 | |
4 | @@ -0,0 +1,72 @@ | |
5 | +<? | |
6 | +require_once(dirname(__FILE__) . '/../init.php'); | |
7 | +require_once(APP_INC_PATH . "class.auth.php"); | |
8 | +require_once(APP_INC_PATH . "class.issue.php"); | |
9 | + | |
10 | +// check login | |
11 | +if (!Auth::hasValidCookie(APP_COOKIE)) { | |
12 | + exit; | |
13 | +} | |
14 | + | |
15 | + | |
16 | + | |
17 | +if (!isset($_POST['before']) || !isset($_POST['after'])) { | |
18 | + exit; | |
19 | +} | |
20 | + | |
21 | +$before = Misc::explode_url($_POST['before']); | |
22 | +$after = Misc::explode_url($_POST['after']); | |
23 | + | |
24 | +$before = $before['issue_list_table']; | |
25 | +$after = $after['issue_list_table']; | |
26 | + | |
27 | + | |
28 | +$before = array_slice($before, 2, count($before)-3); | |
29 | +$after = array_slice($after, 2, count($after)-3); | |
30 | + | |
31 | +if (count($before) != count($after) or count($before) < 1) { | |
32 | + exit; | |
33 | +} | |
34 | + | |
35 | +$usr_id = Auth::getUserID(); | |
36 | + | |
37 | +$order = Issue::getIssueOrderByUser($usr_id); | |
38 | + | |
39 | +if (!count($order)) { | |
40 | + // no prev order list | |
41 | + exit; | |
42 | +} | |
43 | + | |
44 | +$after_filterd = array(); | |
45 | +$before_filterd = array(); | |
46 | + | |
47 | +// remove issues that are not assigned to me | |
48 | +foreach ($after as $id) { | |
49 | + if (isset($order[$id])) { | |
50 | + $after_filterd[] = $id; | |
51 | + } | |
52 | +} | |
53 | +foreach ($before as $id) { | |
54 | + if (isset($order[$id])) { | |
55 | + $before_filterd[] = $id; | |
56 | + } | |
57 | +} | |
58 | + | |
59 | +foreach ($after_filterd as $key => $nID) { | |
60 | + if ($nID != $before_filterd[$key]) { | |
61 | + if ($nID) { | |
62 | + $stmt = "UPDATE | |
63 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
64 | + SET | |
65 | + isu_order = " . $order[$before_filterd[$key]] . " | |
66 | + WHERE | |
67 | + isu_iss_id = $nID AND | |
68 | + isu_usr_id = $usr_id"; | |
69 | + $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
70 | + if (PEAR::isError($res)) { | |
71 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
72 | + die('update failed'); | |
73 | + } | |
74 | + } | |
75 | + } | |
76 | +} | |
77 | \ No newline at end of file | |
78 | diff -ur eventum/ajax/update.php eventum-new/ajax/update.php | |
79 | --- eventum/ajax/update.php 2008-10-15 01:46:20.000000000 +0300 | |
80 | +++ eventum-new/ajax/update.php 2008-10-15 02:02:25.000000000 +0300 | |
81 | @@ -0,0 +1,30 @@ | |
82 | +<? | |
83 | +require_once(dirname(__FILE__) . '/../init.php'); | |
84 | +require_once(APP_INC_PATH . "class.auth.php"); | |
85 | +require_once(APP_INC_PATH . "class.issue.php"); | |
86 | + | |
87 | +// check login | |
88 | +if (!Auth::hasValidCookie(APP_COOKIE)) { | |
89 | + exit; | |
90 | +} | |
91 | + | |
92 | +if (!is_numeric($_POST['issueID'])) { | |
93 | + exit; | |
94 | +} | |
95 | + | |
96 | +switch ($_POST['fieldName']) { | |
97 | + case 'expected_resolution_date': | |
98 | + $day = (int)$_POST['day']; | |
99 | + $month = (int)$_POST['month']; | |
100 | + $year = (int)$_POST['year']; | |
101 | + if (Issue::updateField($_POST['issueID'], $_POST['fieldName'], sprintf('%04d-%02d-%02d', $year, $month, $day)) !== -1) { | |
102 | + echo Date_API::getSimpleDate(sprintf('%04d-%02d-%02d', $year, $month, $day), false); | |
103 | + } else { | |
104 | + echo 'update failed'; | |
105 | + } | |
106 | + exit; | |
107 | + break; | |
108 | + default: | |
109 | + die('object type not supported'); | |
110 | + break; | |
111 | +} | |
112 | diff -ur eventum/include/class.display_column.php eventum-new/include/class.display_column.php | |
113 | --- eventum/include/class.display_column.php 2008-10-15 01:46:20.000000000 +0300 | |
114 | +++ eventum-new/include/class.display_column.php 2008-10-15 02:02:25.000000000 +0300 | |
d95f9b26 | 115 | @@ -229,7 +229,10 @@ |
9fbd0c65 ER |
116 | ), |
117 | "iss_expected_resolution_date" => array( | |
d95f9b26 ER |
118 | "title" => ev_gettext("Expected Resolution Date") |
119 | - ) | |
9fbd0c65 ER |
120 | + ), |
121 | + "isu_order" => array( | |
be762003 | 122 | + "title" => ev_gettext("Order") |
d95f9b26 | 123 | + ), |
9fbd0c65 ER |
124 | ) |
125 | ); | |
d95f9b26 | 126 | return $columns[$page]; |
be762003 ER |
127 | diff -ur eventum/include/class.issue.php eventum-new/include/class.issue.php |
128 | --- eventum/include/class.issue.php 2008-10-15 01:46:20.000000000 +0300 | |
129 | +++ eventum-new/include/class.issue.php 2008-10-15 02:02:25.000000000 +0300 | |
130 | @@ -1356,6 +1356,7 @@ | |
9fbd0c65 ER |
131 | Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); |
132 | return -1; | |
133 | } else { | |
134 | + Issue::moveOrderForAllUsers($issue_id, 1000); | |
135 | $prj_id = Issue::getProjectID($issue_id); | |
136 | ||
be762003 ER |
137 | // record the change |
138 | @@ -1659,6 +1660,176 @@ | |
139 | } | |
140 | } | |
141 | ||
142 | + /** | |
143 | + * Method used to update the a single detail field of a specific issue. | |
144 | + * | |
145 | + * @param integer $issue_id | |
146 | + * @param string $field_name | |
147 | + * @param string $field_value | |
148 | + * @param string $field_type string or integer (for escape) | |
149 | + * @return integer 1 on success, -1 otherwise | |
150 | + */ | |
151 | + function updateField($issue_id, $field_name, $filed_value) { | |
152 | + | |
153 | + $issue_id = Misc::escapeInteger($issue_id); | |
154 | + | |
155 | + $usr_id = Auth::getUserID(); | |
156 | + $prj_id = Issue::getProjectID($issue_id); | |
157 | + | |
158 | + // get all of the 'current' information of this issue | |
159 | + $current = Issue::getDetails($issue_id); | |
160 | + | |
161 | + $stmt = "UPDATE | |
162 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue | |
163 | + SET | |
164 | + iss_updated_date='" . Date_API::getCurrentDateGMT() . "', | |
165 | + iss_last_public_action_date='" . Date_API::getCurrentDateGMT() . "', | |
166 | + iss_last_public_action_type='updated'"; | |
167 | + | |
168 | + switch ($field_name) { | |
169 | + case 'category': | |
170 | + $stmt .= ", iss_prc_id = " . Misc::escapeInteger($filed_value); | |
171 | + break; | |
172 | + case 'release': | |
173 | + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value); | |
174 | + break; | |
175 | + case 'expected_resolution_date': | |
176 | + $stmt .= ", iss_expected_resolution_date = '" . Misc::escapeString($filed_value) . "'"; | |
177 | + break; | |
178 | + case 'release': | |
179 | + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value); | |
180 | + break; | |
181 | + case 'priority': | |
182 | + $stmt .= ", iss_pri_id = " . Misc::escapeInteger($filed_value); | |
183 | + break; | |
184 | + case 'status': | |
185 | + $stmt .= ", iss_sta_id = " . Misc::escapeInteger($filed_value); | |
186 | + break; | |
187 | + case 'resolution': | |
188 | + $stmt .= ", iss_res_id = " . Misc::escapeInteger($filed_value); | |
189 | + break; | |
190 | + case 'summary': | |
191 | + $stmt .= ", iss_summary = '" . Misc::escapeString($filed_value) . "'"; | |
192 | + break; | |
193 | + case 'description': | |
194 | + $stmt .= ", iss_description = '" . Misc::escapeString($filed_value) . "'"; | |
195 | + break; | |
196 | + case 'estimated_dev_time': | |
197 | + $stmt .= ", iss_dev_time = '" . Misc::escapeString($filed_value) . "'"; | |
198 | + break; | |
199 | + case 'percent_complete': | |
200 | + $stmt .= ", iss_percent_complete = '" . Misc::escapeString($filed_value) . "'"; | |
201 | + break; | |
202 | + case 'trigger_reminders': | |
203 | + $stmt .= ", iss_trigger_reminders = " . Misc::escapeInteger($filed_value); | |
204 | + break; | |
205 | + case 'group': | |
206 | + $stmt .= ", iss_grp_id = " . Misc::escapeInteger($filed_value); | |
207 | + break; | |
208 | + case 'private': | |
209 | + $stmt .= ", iss_private = " . Misc::escapeInteger($filed_value); | |
210 | + break; | |
211 | + default: | |
212 | + Error_Handler::logError("Unknown field name $field_name", __FILE__, __LINE__); | |
213 | + return -1; | |
214 | + break; | |
215 | + } | |
216 | + | |
217 | + $stmt .= " | |
218 | + WHERE | |
219 | + iss_id=$issue_id"; | |
220 | + | |
221 | + $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
222 | + if (PEAR::isError($res)) { | |
223 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
224 | + return -1; | |
225 | + } else { | |
226 | + $new = array( | |
227 | + 'category' => $current['iss_prc_id'], | |
228 | + 'release' => $current['iss_pre_id'], | |
229 | + 'expected_resolution_date' => $current['iss_expected_resolution_date'], | |
230 | + 'release' => $current['iss_pre_id'], | |
231 | + 'priority' => $current['iss_pri_id'], | |
232 | + 'status' => $current['iss_sta_id'], | |
233 | + 'resolution' => $current['iss_res_id'], | |
234 | + 'summary' => $current['iss_summary'], | |
235 | + 'description' => $current['iss_description'], | |
236 | + 'estimated_dev_time' => $current['iss_dev_time'], | |
237 | + 'percent_complete' => $current['iss_percent_complete'], | |
238 | + 'trigger_reminders' => $current['iss_trigger_reminders'], | |
239 | + 'group' => $current['iss_grp_id'], | |
240 | + 'iss_private' => $current['private'] | |
241 | + ); | |
242 | + $new[$field_name] = $filed_value; | |
243 | + | |
244 | + // add change to the history (only for changes on specific fields?) | |
245 | + $updated_fields = array(); | |
246 | + if ($field_name == 'expected_resolution_date' && $current["iss_expected_resolution_date"] != $filed_value) { | |
247 | + $updated_fields["Expected Resolution Date"] = History::formatChanges($current["iss_expected_resolution_date"], $filed_value); | |
248 | + } | |
249 | + if ($field_name == 'category' && $current["iss_prc_id"] != $filed_value) { | |
250 | + $updated_fields["Category"] = History::formatChanges(Category::getTitle($current["iss_prc_id"]), Category::getTitle($filed_value)); | |
251 | + } | |
252 | + if ($field_name == 'release' && $current["iss_pre_id"] != $filed_value) { | |
253 | + $updated_fields["Release"] = History::formatChanges(Release::getTitle($current["iss_pre_id"]), Release::getTitle($filed_value)); | |
254 | + } | |
255 | + if ($field_name == 'priority' && $current["iss_pri_id"] != $filed_value) { | |
256 | + $updated_fields["Priority"] = History::formatChanges(Priority::getTitle($current["iss_pri_id"]), Priority::getTitle($filed_value)); | |
257 | + Workflow::handlePriorityChange($prj_id, $issue_id, $usr_id, $current, $new); | |
258 | + } | |
259 | + if ($field_name == 'status' && $current["iss_sta_id"] != $filed_value) { | |
260 | + // clear out the last-triggered-reminder flag when changing the status of an issue | |
261 | + Reminder_Action::clearLastTriggered($issue_id); | |
262 | + | |
263 | + // if old status was closed and new status is not, clear closed data from issue. | |
264 | + $old_status_details = Status::getDetails($current['iss_sta_id']); | |
265 | + if ($old_status_details['sta_is_closed'] == 1) { | |
266 | + $new_status_details = Status::getDetails($filed_value); | |
267 | + if ($new_status_details['sta_is_closed'] != 1) { | |
268 | + Issue::clearClosed($issue_id); | |
269 | + } | |
270 | + } | |
271 | + $updated_fields["Status"] = History::formatChanges(Status::getStatusTitle($current["iss_sta_id"]), Status::getStatusTitle($filed_value)); | |
272 | + } | |
273 | + if ($field_name == 'resolution' && $current["iss_res_id"] != $filed_value) { | |
274 | + $updated_fields["Resolution"] = History::formatChanges(Resolution::getTitle($current["iss_res_id"]), Resolution::getTitle($filed_value)); | |
275 | + } | |
276 | + if ($field_name == 'estimated_dev_time' && $current["iss_dev_time"] != $filed_value) { | |
277 | + $updated_fields["Estimated Dev. Time"] = History::formatChanges(Misc::getFormattedTime(($current["iss_dev_time"]*60)), Misc::getFormattedTime(($filed_value*60))); | |
278 | + } | |
279 | + if ($field_name == 'summary' && $current["iss_summary"] != $filed_value) { | |
280 | + $updated_fields["Summary"] = ''; | |
281 | + } | |
282 | + if ($field_name == 'description' && $current["iss_description"] != $filed_value) { | |
283 | + $updated_fields["Description"] = ''; | |
284 | + } | |
285 | + if ($field_name == 'private' && ($filed_value != $current['iss_private'])) { | |
286 | + $updated_fields["Private"] = History::formatChanges(Misc::getBooleanDisplayValue($current['iss_private']), Misc::getBooleanDisplayValue($filed_value)); | |
287 | + } | |
288 | + if (count($updated_fields) > 0) { | |
289 | + // log the changes | |
290 | + $changes = ''; | |
291 | + $i = 0; | |
292 | + foreach ($updated_fields as $key => $value) { | |
293 | + if ($i > 0) { | |
294 | + $changes .= "; "; | |
295 | + } | |
296 | + if (($key != "Summary") && ($key != "Description")) { | |
297 | + $changes .= "$key: $value"; | |
298 | + } else { | |
299 | + $changes .= "$key"; | |
300 | + } | |
301 | + $i++; | |
302 | + } | |
303 | + | |
304 | + History::add($issue_id, $usr_id, History::getTypeID('issue_updated'), "Issue updated ($changes) by " . User::getFullName($usr_id)); | |
305 | + // send notifications for the issue being updated | |
306 | + Notification::notifyIssueUpdated($issue_id, $current, $new); | |
307 | + } | |
308 | + } | |
309 | + return 1; | |
310 | + } | |
311 | + | |
312 | ||
313 | /** | |
314 | * Move the issue to a new project | |
315 | @@ -1820,16 +1991,33 @@ | |
9fbd0c65 ER |
316 | { |
317 | $issue_id = Misc::escapeInteger($issue_id); | |
318 | $assignee_usr_id = Misc::escapeInteger($assignee_usr_id); | |
319 | + $order = 1; | |
320 | + // move all orders down to free "order space" for this new association | |
321 | + $stmt = "UPDATE | |
322 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
323 | + SET | |
324 | + isu_order = isu_order + 1 | |
325 | + WHERE | |
326 | + isu_usr_id = $assignee_usr_id AND | |
327 | + isu_order >= $order"; | |
328 | + $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
329 | + if (PEAR::isError($res)) { | |
330 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
331 | + return -1; | |
332 | + } | |
333 | + // insert the new association | |
334 | $stmt = "INSERT INTO | |
335 | " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
336 | ( | |
337 | isu_iss_id, | |
338 | isu_usr_id, | |
339 | - isu_assigned_date | |
340 | + isu_assigned_date, | |
341 | + isu_order | |
342 | ) VALUES ( | |
343 | $issue_id, | |
344 | $assignee_usr_id, | |
345 | - '" . Date_API::getCurrentDateGMT() . "' | |
346 | + '" . Date_API::getCurrentDateGMT() . "', | |
347 | + $order | |
348 | )"; | |
349 | $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
350 | if (PEAR::isError($res)) { | |
be762003 | 351 | @@ -1844,6 +2032,78 @@ |
9fbd0c65 ER |
352 | } |
353 | } | |
354 | ||
355 | + /** | |
356 | + * Method used to get the order list to be rearranged | |
357 | + * | |
358 | + * @access private | |
359 | + * @param string $issue_id The issue ID or a comma seperated list of IDs already prepared for giving to mysql | |
360 | + * @param string $usr_id The user to remove. When not specified, all users are taken as to be removed for that issue | |
361 | + * @return mixed delete order list to be rearranged. Used as a parameter to the method of rearranging the order. | |
362 | + */ | |
363 | + function getDeleteUserAssociationOrderList($issue_id, $usr_id = "") | |
364 | + { | |
365 | + // find all affected associantion orders | |
366 | + $stmt = "SELECT isu_usr_id, isu_order FROM | |
367 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
368 | + WHERE | |
369 | + isu_iss_id IN ($issue_id)"; | |
370 | + if ($usr_id !== FALSE) { | |
371 | + $stmt.= " AND isu_usr_id IN ($usr_id)"; | |
372 | + } | |
373 | + $stmt.= "ORDER BY isu_order"; | |
374 | + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC); | |
375 | + if (PEAR::isError($res)) { | |
376 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
377 | + return -1; | |
378 | + } else { | |
379 | + $deleted_orders = array(); | |
380 | + foreach ($res as $row) { | |
381 | + if (empty($deleted_orders[$row['isu_usr_id']])) { | |
382 | + $deleted_orders[$row['isu_usr_id']] = array(); | |
383 | + } | |
384 | + $deleted_orders[$row['isu_usr_id']] [] = $row['isu_order']; | |
385 | + } | |
386 | + return $deleted_orders; | |
387 | + } | |
388 | + } | |
389 | + | |
390 | + /** | |
391 | + * | |
392 | + * Method used to rearrange order list in the db according to known deleted records | |
393 | + * | |
394 | + * @access private | |
395 | + * @param mixed deleteorder list | |
396 | + * @return void | |
397 | + */ | |
398 | + function rearrangeDeleteUserAssociationOrderList($delete_order_list) | |
399 | + { | |
400 | + if (empty($delete_order_list) || (!is_array($delete_order_list))) { | |
401 | + return -1; | |
402 | + } | |
403 | + foreach ($delete_order_list as $isu_usr_id => $orders) { | |
404 | + for ($i = 0; $i < count($orders); $i++) { // traverse all deleted orders | |
405 | + // move the orders after them up to take the "order space" of the deleted records | |
406 | + $stmt = "UPDATE | |
407 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
408 | + SET | |
409 | + isu_order = isu_order - " . ($i+1) . " | |
410 | + WHERE | |
411 | + isu_usr_id = $isu_usr_id AND | |
412 | + isu_order > " . $orders[$i]; | |
413 | + if ($i < count($orders) - 1) { | |
414 | + $stmt.= " AND | |
415 | + isu_order < " . $orders[$i+1]; | |
416 | + } | |
417 | + $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
418 | + if (PEAR::isError($res)) { | |
419 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
420 | + return -1; | |
421 | + } | |
422 | + } | |
423 | + } | |
424 | + return 1; | |
425 | + } | |
426 | + | |
427 | ||
428 | /** | |
429 | * Method used to delete all user assignments for a specific issue. | |
be762003 | 430 | @@ -1859,6 +2119,7 @@ |
9fbd0c65 ER |
431 | if (is_array($issue_id)) { |
432 | $issue_id = implode(", ", $issue_id); | |
433 | } | |
434 | + $deleted_order_list = Issue::getDeleteUserAssociationOrderList($issue_id); | |
435 | $stmt = "DELETE FROM | |
436 | " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
437 | WHERE | |
be762003 | 438 | @@ -1871,6 +2132,7 @@ |
9fbd0c65 ER |
439 | if ($usr_id) { |
440 | History::add($issue_id, $usr_id, History::getTypeID('user_all_unassociated'), 'Issue assignments removed by ' . User::getFullName($usr_id)); | |
441 | } | |
442 | + Issue::rearrangeDeleteUserAsssociationOrderList($deleted_order_list); | |
443 | return 1; | |
444 | } | |
445 | } | |
be762003 | 446 | @@ -1889,6 +2151,7 @@ |
9fbd0c65 ER |
447 | { |
448 | $issue_id = Misc::escapeInteger($issue_id); | |
449 | $usr_id = Misc::escapeInteger($usr_id); | |
450 | + $delete_order_list = Issue::getDeleteUserAssociationOrderList($issue_id, $usr_id); | |
451 | $stmt = "DELETE FROM | |
452 | " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
453 | WHERE | |
be762003 | 454 | @@ -1903,6 +2166,7 @@ |
9fbd0c65 ER |
455 | History::add($issue_id, Auth::getUserID(), History::getTypeID('user_unassociated'), |
456 | User::getFullName($usr_id) . ' removed from issue by ' . User::getFullName(Auth::getUserID())); | |
457 | } | |
458 | + Issue::rearrangeDeleteUserAssociationOrderList($delete_order_list); | |
459 | return 1; | |
460 | } | |
461 | } | |
be762003 | 462 | @@ -2379,6 +2643,11 @@ |
9fbd0c65 ER |
463 | { |
464 | $sort_by = Issue::getParam('sort_by'); | |
465 | $sort_order = Issue::getParam('sort_order'); | |
466 | + $users = Issue::getParam('users'); | |
467 | + if (empty($users) && ($sort_by == 'isu_order')) { // Sorting by isu_order is impossible when no user specified | |
468 | + unset($sort_by); | |
469 | + unset($sort_order); | |
470 | + } | |
471 | $rows = Issue::getParam('rows'); | |
472 | $hide_closed = Issue::getParam('hide_closed'); | |
473 | if ($hide_closed === '') { | |
be762003 | 474 | @@ -2483,6 +2752,7 @@ |
aa90cfdb ER |
475 | "last_action_date" => "desc", |
476 | "usr_full_name" => "asc", | |
477 | "iss_expected_resolution_date" => "desc", | |
478 | + "isu_order" => "desc", | |
9fbd0c65 | 479 | ); |
aa90cfdb ER |
480 | |
481 | foreach ($custom_fields as $fld_id => $fld_name) { | |
be762003 | 482 | @@ -3275,6 +3545,8 @@ |
9fbd0c65 ER |
483 | $ids = implode(", ", $ids); |
484 | $stmt = "SELECT | |
485 | isu_iss_id, | |
486 | + isu_order, | |
487 | + isu_usr_id, | |
488 | usr_full_name | |
489 | FROM | |
490 | " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user, | |
be762003 | 491 | @@ -3286,6 +3558,7 @@ |
9fbd0c65 ER |
492 | if (PEAR::isError($res)) { |
493 | Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
494 | } else { | |
495 | + // gather names of the users assigned to each issue | |
496 | $t = array(); | |
497 | for ($i = 0; $i < count($res); $i++) { | |
498 | if (!empty($t[$res[$i]['isu_iss_id']])) { | |
be762003 | 499 | @@ -3294,9 +3567,18 @@ |
9fbd0c65 ER |
500 | $t[$res[$i]['isu_iss_id']] = $res[$i]['usr_full_name']; |
501 | } | |
502 | } | |
503 | + // gather orders | |
504 | + $o = array(); | |
505 | + for ($i = 0; $i < count($res); $i++) { | |
506 | + if (empty($o[$res[$i]['isu_iss_id']])) { | |
507 | + $o[$res[$i]['isu_iss_id']] = array(); | |
508 | + } | |
509 | + $o[$res[$i]['isu_iss_id']][$res[$i]['isu_usr_id']] = $res[$i]['isu_order']; | |
510 | + } | |
511 | // now populate the $result variable again | |
512 | for ($i = 0; $i < count($result); $i++) { | |
513 | @$result[$i]['assigned_users'] = $t[$result[$i]['iss_id']]; | |
514 | + @$result[$i]['assigned_users_order'] = $o[$result[$i]['iss_id']]; | |
515 | } | |
516 | } | |
517 | } | |
be762003 | 518 | @@ -4264,6 +4546,7 @@ |
9fbd0c65 ER |
519 | Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); |
520 | return -1; | |
521 | } | |
522 | + Issue::moveOrderForAllUsers($issue_id, 1); | |
523 | } | |
524 | ||
525 | ||
be762003 | 526 | @@ -4322,8 +4605,127 @@ |
9fbd0c65 ER |
527 | } |
528 | return $returns[$msg_id]; | |
529 | } | |
530 | + | |
531 | + /** | |
532 | + * Reorders user's issues as requested by user | |
533 | + * @access public | |
534 | + * @param $usr_id User to be reordered | |
535 | + * @param $issue_id Issue or array of issues to be moved | |
536 | + * @param $neworder The new order of the issues | |
537 | + * @return void | |
538 | + */ | |
539 | + function reorderUserIssues($usr_id, $issue_id, $neworder) | |
540 | + { | |
541 | + if (!isset($usr_id) || !isset($issue_id) || !isset($neworder)) { | |
542 | + return false; | |
543 | + } | |
544 | + if (!is_numeric($usr_id) || !is_numeric($neworder)) { | |
545 | + return false; | |
546 | + } | |
547 | + $usr_id = Misc::escapeInteger($usr_id); | |
548 | + $issue_id = Misc::escapeInteger($issue_id); | |
549 | + $neworder = Misc::escapeInteger($neworder); | |
550 | + if (is_array($issue_id)) { | |
551 | + $issue_count = count($issue_id); | |
552 | + $issue_id_str = implode(", ", $issue_id); | |
553 | + } else { | |
554 | + $issue_count = 1; | |
555 | + $issue_id_str = $issue_id; | |
556 | + $issue_id = array($issue_id); | |
557 | + } | |
558 | + // do a nasty pretending to be deleting stuff so that reordering happens as if these elements were deleted | |
559 | + $orderlist = Issue::getDeleteUserAssociationOrderList($issue_id_str, $usr_id); | |
560 | + Issue::rearrangeDeleteUserAssociationOrderList($orderlist); | |
561 | + // move down the orders to free the "order space" needed | |
562 | + $stmt = "UPDATE | |
563 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
564 | + SET | |
565 | + isu_order = isu_order + $issue_count | |
566 | + WHERE | |
567 | + isu_usr_id = $usr_id AND | |
568 | + isu_order >= $neworder"; | |
569 | + $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
570 | + if (PEAR::isError($res)) { | |
571 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
572 | + return -1; | |
573 | + } | |
574 | + //update the order for the issues being moved | |
575 | + $i = 0; | |
576 | + foreach ($issue_id as $iss_id) { | |
577 | + $stmt = "UPDATE | |
578 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
579 | + SET | |
580 | + isu_order = " . ($neworder + $i) . " | |
581 | + WHERE | |
582 | + isu_usr_id = $usr_id AND | |
583 | + isu_iss_id = $iss_id"; | |
584 | + $res = $GLOBALS["db_api"]->dbh->query($stmt); | |
585 | + if (PEAR::isError($res)) { | |
586 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
587 | + return -1; | |
588 | + } | |
589 | + $i++; | |
590 | + } | |
591 | + } | |
592 | + | |
be762003 ER |
593 | + |
594 | + /** | |
595 | + * Get users issue order list | |
596 | + * @access public | |
597 | + * @param $user_id User | |
598 | + * @param $order_list Order of the issues | |
599 | + * @return void | |
600 | + */ | |
601 | + function getIssueOrderByUser($usr_id) { | |
602 | + | |
603 | + if (!is_numeric($usr_id)) { | |
604 | + return false; | |
605 | + } | |
606 | + | |
607 | + $stmt = "SELECT | |
608 | + isu_iss_id, isu_order | |
609 | + FROM | |
610 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
611 | + WHERE | |
612 | + isu_usr_id = " . $usr_id ; | |
613 | + | |
614 | + $order_list = array(); | |
615 | + | |
616 | + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC); | |
617 | + | |
618 | + if (PEAR::isError($res)) { | |
619 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
620 | + return array(); | |
621 | + } else { | |
622 | + foreach ($res as $row) { | |
623 | + $order_list[$row["isu_iss_id"]] = $row["isu_order"]; | |
624 | + } | |
625 | + } | |
626 | + return $order_list; | |
627 | + } | |
628 | + | |
9fbd0c65 ER |
629 | + function moveOrderForAllUsers($issue_id, $neworder) |
630 | + { | |
631 | + // Move the issue to the top priority for the ppl it's assigned to | |
632 | + $stmt = "SELECT isu_usr_id FROM | |
633 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user | |
634 | + WHERE | |
635 | + isu_iss_id = " . Misc::escapeInteger($issue_id); | |
636 | + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC); | |
637 | + if (PEAR::isError($res)) { | |
638 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); | |
639 | + return -1; | |
640 | + } | |
641 | + foreach ($res as $row) { | |
642 | + Issue::reorderUserIssues($row["isu_usr_id"], $issue_id, $neworder); | |
643 | + } | |
644 | + } | |
645 | + | |
646 | } | |
647 | ||
648 | + | |
649 | + | |
650 | + | |
651 | // benchmarking the included file (aka setup time) | |
652 | if (APP_BENCHMARK) { | |
653 | $GLOBALS['bench']->setMarker('Included Issue Class'); | |
be762003 ER |
654 | diff -ur eventum/include/class.misc.php eventum-new/include/class.misc.php |
655 | --- eventum/include/class.misc.php 2008-10-15 01:46:20.000000000 +0300 | |
656 | +++ eventum-new/include/class.misc.php 2008-10-15 02:02:25.000000000 +0300 | |
657 | @@ -744,6 +744,45 @@ | |
658 | { | |
659 | return self::$messages; | |
660 | } | |
661 | + | |
662 | + /** | |
663 | + * Parse url query string to php array | |
664 | + * | |
665 | + * @access public | |
666 | + * @link http://php.net/manual/en/function.parse-str.php#79154 | |
667 | + * @param string $str The url that will be exploded | |
668 | + * @return array The variables from url | |
669 | + */ | |
670 | + function explode_url($str) { | |
671 | + $return = array(); | |
672 | + // Separate all name-value pairs | |
673 | + $pairs = explode('&', $str); | |
674 | + foreach($pairs as $pair) { | |
675 | + // Pull out the names and the values | |
676 | + list($name, $value) = explode('=', $pair, 2); | |
677 | + // Decode the variable name and look for arrays | |
678 | + list($name, $index) = split('[][]', urldecode($name)); | |
679 | + // Arrays | |
680 | + if(isset($index)) { | |
681 | + // Declare or add to the global array defined by $name | |
682 | + if(!isset($return[$name])) { | |
683 | + $return[$name] = array(); | |
684 | + } | |
685 | + // Associative array | |
686 | + if(strlen($index) > 0) { | |
687 | + $return[$name][$index] = addslashes(urldecode($value)); | |
688 | + } else { | |
689 | + // Ordered array | |
690 | + array_push($return[$name], addslashes(urldecode($value))); | |
691 | + } | |
692 | + // Variables | |
693 | + } else { | |
694 | + // Declare or overwrite the global variable defined by $name | |
695 | + $return[$name] = addslashes(urldecode($value)); | |
696 | + } | |
697 | + } | |
698 | + return $return; | |
699 | + } | |
700 | } | |
701 | ||
702 | // benchmarking the included file (aka setup time) | |
703 | diff -ur eventum/js/global.js eventum-new/js/global.js | |
704 | --- eventum/js/global.js 2008-10-15 02:02:33.000000000 +0300 | |
705 | +++ eventum-new/js/global.js 2008-10-15 02:02:25.000000000 +0300 | |
706 | @@ -792,10 +792,44 @@ | |
707 | } | |
708 | ||
709 | // call when document ready | |
710 | -$(document).ready(function() { | |
711 | +$(document).ready(function(){ | |
712 | $('.date_picker').datepicker({ | |
713 | dateFormat: 'yy-mm-dd', firstDay: 0 // FIXME: make it configurable | |
714 | }); | |
715 | -} | |
716 | +}); | |
717 | + | |
718 | +$(document).ready(function(){ | |
719 | + // dialog type calender isn't working in Konqueror beacuse it's not a supported browser for either jQuery or jQuery UI | |
720 | + // http://groups.google.com/group/jquery-ui/browse_thread/thread/ea61238c34cb5f33/046837b02fb90b5c | |
721 | + if (navigator.appName != 'Konqueror') { | |
722 | + $(".inline_date_pick").click(function() { | |
723 | + var masterObj = this; | |
724 | + var masterObjPos = $(masterObj).offset(); | |
725 | + // offset gives uses top and left but datepicker needs pageX and pageY | |
726 | + var masterObjPos = {pageX:masterObjPos.left, pageY:masterObjPos.top}; | |
727 | + $(this).datepicker( | |
728 | + // we use dialog type calender so we won't haveto have a hidden element on the page | |
729 | + 'dialog', | |
730 | + // selected date | |
731 | + masterObj.innerHTML, | |
732 | + // onclick handler | |
733 | + function (date, dteObj) { | |
734 | + fieldName = masterObj.id.substr(0,masterObj.id.indexOf('|')); | |
735 | + issueID = masterObj.id.substr(masterObj.id.indexOf('|')+1); | |
736 | + $.post("/ajax/update.php", {fieldName: fieldName, issueID: issueID, day: dteObj.selectedDay, month: (dteObj.selectedMonth+1), year: dteObj.selectedYear}, function(data) { | |
737 | + if (data.length > 0) { | |
738 | + masterObj.innerHTML = data; | |
739 | + } | |
740 | + }, "text"); | |
741 | + }, | |
742 | + // config | |
743 | + {dateFormat: 'dd M yy', duration: ""}, | |
744 | + // position of the datepicker calender - taken from div's offset | |
745 | + masterObjPos | |
746 | + ); | |
747 | + return false; | |
748 | + }); | |
749 | + } | |
750 | +}); | |
751 | ||
752 | -//--> | |
753 | +//--> | |
754 | \ No newline at end of file | |
755 | Only in eventum-new/js/jquery: jquery.tablednd_0_5.js | |
756 | diff -ur eventum/list.php eventum-new/list.php | |
757 | --- eventum/list.php 2008-10-15 01:46:20.000000000 +0300 | |
758 | +++ eventum-new/list.php 2008-10-15 02:02:25.000000000 +0300 | |
9fbd0c65 ER |
759 | @@ -67,6 +67,11 @@ |
760 | $profile['sort_by'] . "&sort_order=" . $profile['sort_order']); | |
761 | } | |
762 | ||
763 | +@$reorder_usr_id = $_REQUEST["reorder_user"]; | |
764 | +@$reorder_issue_id = $_REQUEST["reorder_source"]; | |
765 | +@$reorder_neworder = $_REQUEST["reorder_neworder"]; | |
766 | +Issue::reorderUserIssues($reorder_usr_id, $reorder_issue_id, $reorder_neworder); | |
767 | + | |
768 | $options = Issue::saveSearchParams(); | |
769 | $tpl->assign("options", $options); | |
770 | $tpl->assign("sorting", Issue::getSortingInfo($options)); | |
be762003 | 771 | @@ -90,6 +95,21 @@ |
9fbd0c65 | 772 | } |
be762003 | 773 | $assign_options += $users; |
9fbd0c65 ER |
774 | |
775 | +// get the isu_order (assignated users) ordering user | |
776 | +if (!empty($options["users"])) { | |
777 | + if ($options["users"] == -2) { | |
778 | + $isu_order_user = $usr_id; | |
779 | + } else | |
780 | + if ($options["users"] > 0) { | |
781 | + $isu_order_user = $options["users"]; | |
782 | + } else { | |
783 | + unset($isu_order_user); | |
784 | + } | |
785 | +} else { | |
786 | + unset($isu_order_user); | |
787 | +} | |
788 | +$tpl->assign("isu_order_user", $isu_order_user); | |
789 | + | |
790 | $list = Issue::getListing($prj_id, $options, $pagerRow, $rows); | |
791 | $tpl->assign("list", $list["list"]); | |
792 | $tpl->assign("list_info", $list["info"]); | |
be762003 ER |
793 | diff -ur eventum/templates/list.tpl.html eventum-new/templates/list.tpl.html |
794 | --- eventum/templates/list.tpl.html 2008-10-15 01:46:20.000000000 +0300 | |
795 | +++ eventum-new/templates/list.tpl.html 2008-10-15 02:02:25.000000000 +0300 | |
9fbd0c65 ER |
796 | @@ -89,6 +89,28 @@ |
797 | f.target = '_popup'; | |
798 | f.submit(); | |
799 | } | |
800 | +function reorderBulk(order_user, neworder) | |
801 | +{ | |
802 | + url = page_url + "?"; | |
803 | + url += "reorder_user=" + order_user; | |
d95f9b26 | 804 | + |
9fbd0c65 ER |
805 | + items = document.getElementsByName("item[]"); |
806 | + checkedcount = 0; | |
807 | + for (var i = 0; i < items.length; i++) { | |
d95f9b26 ER |
808 | + if (items[i].checked) { |
809 | + url += "&reorder_source[" + checkedcount + "]=" + items[i].value; | |
810 | + checkedcount++; | |
811 | + } | |
9fbd0c65 ER |
812 | + } |
813 | + if (checkedcount == 0) { | |
d95f9b26 | 814 | + alert('{/literal}{t escape=js}Please choose which issues to move to the new place.{/t}{literal}'); |
9fbd0c65 ER |
815 | + return false; |
816 | + } | |
817 | + | |
818 | + url += "&reorder_neworder=" + neworder; | |
819 | + | |
820 | + window.location.href = url; | |
821 | +} | |
822 | function hideClosed(f) | |
823 | { | |
824 | if (f.hide_closed.checked) { | |
be762003 ER |
825 | @@ -150,6 +172,13 @@ |
826 | f.go.disabled = true; | |
827 | } | |
828 | } | |
829 | +function updateCustomFields(issue_id) | |
830 | +{ | |
831 | + var features = 'width=560,height=460,top=30,left=30,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no'; | |
832 | + var customWin = window.open('custom_fields.php?issue_id=' + issue_id, '_custom_fields', features); | |
833 | + customWin.focus(); | |
834 | + return false; | |
835 | +} | |
836 | //--> | |
837 | </script> | |
838 | {/literal} | |
839 | @@ -166,11 +195,11 @@ | |
840 | <input type="hidden" name="cat" value="bulk_update"> | |
841 | <tr> | |
842 | <td> | |
843 | - <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0"> | |
844 | - <tr> | |
845 | + <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0" id="issue_list_table"> | |
846 | + <tr class="nodrag"> | |
847 | <td colspan="{$col_count}" class="default"> | |
848 | <table width="100%" cellspacing="0" cellpadding="0" border="0"> | |
849 | - <tr> | |
850 | + <tr class="nodrag"> | |
851 | <td class="default"> | |
852 | <b>{t}Search Results{/t} ({$list_info.total_rows} {t}issues found{/t}{if $list_info.end_offset > 0}, {math equation="x + 1" x=$list_info.start_offset} - {$list_info.end_offset} {t}shown{/t}{/if})</b> | |
853 | {include file="help_link.tpl.html" topic="list"} | |
854 | @@ -190,7 +219,7 @@ | |
855 | </table> | |
856 | </td> | |
857 | </tr> | |
858 | - <tr bgcolor="{$cell_color}"> | |
859 | + <tr bgcolor="{$cell_color}" class="nodrag"> | |
860 | {if $current_role > $roles.developer} | |
861 | <td width="1%"> | |
862 | <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');toggleBulkUpdate();"> | |
863 | @@ -205,7 +234,7 @@ | |
864 | {if $sorting.images[$fld_name_id] != ""}<a title="{t}sort by{/t} {$fld_title|escape:"html"}" href="{$sorting.links[$fld_name_id]}" class="white_link"><img border="0" src="{$sorting.images[$fld_name_id]}"></a>{/if} | |
9fbd0c65 | 865 | </td> |
be762003 | 866 | {/foreach} |
9fbd0c65 | 867 | - {else} |
9fbd0c65 ER |
868 | + {elseif $field_name != 'isu_order' || $isu_order_user} |
869 | <td align="{$column.align|default:'center'}" class="default_white" nowrap {if $column.width != ''}width="{$column.width}"{/if}> | |
870 | {if $field_name == 'iss_summary'} | |
871 | <table cellspacing="0" cellpadding="1" width="100%"> | |
be762003 | 872 | @@ -221,6 +250,9 @@ |
9fbd0c65 ER |
873 | </table> |
874 | {elseif $sorting.links[$field_name] != ''} | |
be762003 | 875 | <a title="{t}sort by{/t} {$column.title}" href="{$sorting.links[$field_name]}" class="white_link">{$column.title}</a> |
d95f9b26 ER |
876 | + {if $field_name == 'isu_order'} |
877 | + <br>{$users[$isu_order_user]} | |
878 | + {/if} | |
be762003 | 879 | {if $sorting.images[$field_name] != ""}<a title="{t}sort by{/t} {$column.title}" href="{$sorting.links[$field_name]}" class="white_link"><img border="0" src="{$sorting.images[$field_name]}"></a>{/if} |
9fbd0c65 ER |
880 | {else} |
881 | {$column.title} | |
be762003 ER |
882 | @@ -229,19 +261,20 @@ |
883 | {/if} | |
884 | {/foreach} | |
885 | </tr> | |
886 | + <tbody> | |
887 | {section name="i" loop=$list} | |
888 | - <tr {if $current_role >= $roles.developer AND $list[i].iqu_status > 0}style="text-decoration: line-through;"{/if}> | |
889 | + <tr {if $current_role >= $roles.developer AND $list[i].iqu_status > 0}style="text-decoration: line-through;"{/if} id="{$list[i].iss_id}" {if !$list[i].assigned_users_order[$current_user_id]}class="nodrag"{/if}> | |
890 | {if $current_role > $roles.developer} | |
891 | <td bgcolor="{$list[i].status_color}" width="1%" class="default" align="center"><input type="checkbox" name="item[]" value="{$list[i].iss_id}" onchange="toggleBulkUpdate();"></td> | |
892 | {/if} | |
893 | {foreach from=$columns item=column key=field_name} | |
894 | {if $field_name == 'custom_fields'} | |
895 | {foreach from=$list[i].custom_field key=fld_id item=fld_value} | |
896 | - <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default"> | |
897 | - {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id} | |
898 | + <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default custom_field" onclick="return updateCustomFields({$list[i].iss_id});"> | |
899 | + {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id} | |
9fbd0c65 ER |
900 | </td> |
901 | {/foreach} | |
902 | - {else} | |
903 | + {elseif $field_name != 'isu_order' || $isu_order_user} | |
904 | <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default"> | |
905 | {if $field_name == 'iss_id'} | |
be762003 ER |
906 | <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_id}</a> |
907 | @@ -276,7 +309,7 @@ | |
908 | {elseif $field_name == 'iss_percent_complete'} | |
909 | {$list[i].iss_percent_complete|escape:"html"}% | |
910 | {elseif $field_name == 'iss_expected_resolution_date'} | |
911 | - {$list[i].iss_expected_resolution_date|escape:"html"} | |
912 | + <div class="inline_date_pick" id="expected_resolution_date|{$list[i].iss_id}">{$list[i].iss_expected_resolution_date|escape:"html"} </div> | |
913 | {elseif $field_name == 'iss_summary'} | |
914 | <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_summary|escape:"html"}</a> | |
915 | {if $list[i].redeemed} | |
916 | @@ -285,6 +318,10 @@ | |
9fbd0c65 ER |
917 | {if $list[i].iss_private == 1} |
918 | <b>[Private]</b> | |
be762003 ER |
919 | {/if} |
920 | + {elseif $field_name == 'isu_order'} | |
921 | + {if $list[i].assigned_users_order[$current_user_id]} | |
922 | + <img src="{$rel_url}images/updown.gif" alt="move"> | |
d95f9b26 | 923 | + {/if} |
9fbd0c65 ER |
924 | {/if} |
925 | </td> | |
926 | {/if} | |
be762003 ER |
927 | @@ -297,10 +334,11 @@ |
928 | </td> | |
929 | </tr> | |
930 | {/section} | |
931 | - <tr bgcolor="{$cell_color}"> | |
932 | + </tbody> | |
933 | + <tr bgcolor="{$cell_color}" class="nodrag"> | |
934 | <td colspan="{$col_count}"> | |
935 | <table width="100%" cellspacing="0" cellpadding="0"> | |
936 | - <tr> | |
937 | + <tr class="nodrag"> | |
938 | <td width="30%" nowrap> | |
939 | {if $current_role > $roles.developer} | |
940 | <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');"> | |
941 | @@ -352,6 +390,29 @@ | |
942 | </form> | |
943 | </table> | |
944 | <br /> | |
945 | - | |
946 | +<script type="text/javascript"> | |
947 | +{* | |
948 | + * Order issues by drag and drop: | |
949 | + * only if sorted by order and viewing your own issues | |
950 | + *} | |
951 | +{if $options.sort_by == "isu_order" and $current_user_id == $isu_order_user} | |
952 | +{literal} | |
953 | +var before = ''; // make it global variable | |
954 | +$('#issue_list_table').tableDnD({ | |
955 | + onDragClass: "tDnD_whileDrag", | |
956 | + onDragStart: function(table, row) { | |
957 | + before = $.tableDnD.serialize('id'); | |
958 | + }, | |
959 | + onDrop: function(table, row) { | |
960 | + $.post("/ajax/order.php", {before: before, after: $.tableDnD.serialize('id')}, function(data) { | |
961 | + if (data.length > 0) { | |
962 | + alert(data); | |
963 | + } | |
964 | + }, "text"); | |
965 | + } | |
966 | +}); | |
967 | +{/literal} | |
968 | +{/if} | |
969 | +</script> | |
970 | {include file="app_info.tpl.html"} | |
971 | -{include file="footer.tpl.html"} | |
972 | +{include file="footer.tpl.html"} | |
973 | \ No newline at end of file |