1 --- eventum-new/ajax/order.php 2008-10-15 02:02:25.000000000 +0300
2 +++ eventum-new/ajax/order.php 2008-10-15 02:02:25.000000000 +0300
5 +require_once(dirname(__FILE__) . '/../init.php');
6 +require_once(APP_INC_PATH . "class.auth.php");
7 +require_once(APP_INC_PATH . "class.issue.php");
10 +if (!Auth::hasValidCookie(APP_COOKIE)) {
16 +if (!isset($_POST['before']) || !isset($_POST['after'])) {
20 +parse_str($_POST['before'], $before);
21 +parse_str($_POST['after'], $after);
23 +$before = $before['issue_list_table'];
24 +$after = $after['issue_list_table'];
27 +$before = array_slice($before, 2, count($before)-3);
28 +$after = array_slice($after, 2, count($after)-3);
30 +if (count($before) != count($after) or count($before) < 1) {
34 +$usr_id = Auth::getUserID();
36 +$order = Issue::getIssueOrderByUser($usr_id);
38 +if (!count($order)) {
39 + // no prev order list
43 +$after_filterd = array();
44 +$before_filterd = array();
46 +// remove issues that are not assigned to me
47 +foreach ($after as $id) {
48 + if (isset($order[$id])) {
49 + $after_filterd[] = $id;
52 +foreach ($before as $id) {
53 + if (isset($order[$id])) {
54 + $before_filterd[] = $id;
58 +foreach ($after_filterd as $key => $nID) {
59 + if ($nID != $before_filterd[$key]) {
62 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
64 + isu_order = " . $order[$before_filterd[$key]] . "
66 + isu_iss_id = $nID AND
67 + isu_usr_id = $usr_id";
68 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
69 + if (PEAR::isError($res)) {
70 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
71 + die('update failed');
76 --- eventum/ajax/update.php 2008-10-15 01:46:20.000000000 +0300
77 +++ eventum-new/ajax/update.php 2008-10-15 02:02:25.000000000 +0300
80 +require_once(dirname(__FILE__) . '/../init.php');
81 +require_once(APP_INC_PATH . "class.auth.php");
82 +require_once(APP_INC_PATH . "class.issue.php");
85 +if (!Auth::hasValidCookie(APP_COOKIE)) {
89 +if (!is_numeric($_POST['issueID'])) {
93 +switch ($_POST['fieldName']) {
94 + case 'expected_resolution_date':
95 + $day = (int)$_POST['day'];
96 + $month = (int)$_POST['month'];
97 + $year = (int)$_POST['year'];
98 + if (Issue::updateField($_POST['issueID'], $_POST['fieldName'], sprintf('%04d-%02d-%02d', $year, $month, $day)) !== -1) {
99 + echo Date_API::getSimpleDate(sprintf('%04d-%02d-%02d', $year, $month, $day), false);
101 + echo 'update failed';
106 + die('object type not supported');
109 --- eventum/include/class.display_column.php 2008-10-15 01:46:20.000000000 +0300
110 +++ eventum-new/include/class.display_column.php 2008-10-15 02:02:25.000000000 +0300
113 "iss_expected_resolution_date" => array(
114 "title" => ev_gettext("Expected Resolution Date")
117 + "isu_order" => array(
118 + "title" => ev_gettext("Order")
122 return $columns[$page];
123 --- eventum/include/class.issue.php 2008-10-15 01:46:20.000000000 +0300
124 +++ eventum-new/include/class.issue.php 2008-10-15 02:02:25.000000000 +0300
125 @@ -1356,6 +1356,7 @@
126 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
129 + Issue::moveOrderForAllUsers($issue_id, 1000);
130 $prj_id = Issue::getProjectID($issue_id);
133 @@ -1659,6 +1660,176 @@
138 + * Method used to update the a single detail field of a specific issue.
140 + * @param integer $issue_id
141 + * @param string $field_name
142 + * @param string $field_value
143 + * @param string $field_type string or integer (for escape)
144 + * @return integer 1 on success, -1 otherwise
146 + function updateField($issue_id, $field_name, $filed_value) {
148 + $issue_id = Misc::escapeInteger($issue_id);
150 + $usr_id = Auth::getUserID();
151 + $prj_id = Issue::getProjectID($issue_id);
153 + // get all of the 'current' information of this issue
154 + $current = Issue::getDetails($issue_id);
157 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue
159 + iss_updated_date='" . Date_API::getCurrentDateGMT() . "',
160 + iss_last_public_action_date='" . Date_API::getCurrentDateGMT() . "',
161 + iss_last_public_action_type='updated'";
163 + switch ($field_name) {
165 + $stmt .= ", iss_prc_id = " . Misc::escapeInteger($filed_value);
168 + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value);
170 + case 'expected_resolution_date':
171 + $stmt .= ", iss_expected_resolution_date = '" . Misc::escapeString($filed_value) . "'";
174 + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value);
177 + $stmt .= ", iss_pri_id = " . Misc::escapeInteger($filed_value);
180 + $stmt .= ", iss_sta_id = " . Misc::escapeInteger($filed_value);
183 + $stmt .= ", iss_res_id = " . Misc::escapeInteger($filed_value);
186 + $stmt .= ", iss_summary = '" . Misc::escapeString($filed_value) . "'";
188 + case 'description':
189 + $stmt .= ", iss_description = '" . Misc::escapeString($filed_value) . "'";
191 + case 'estimated_dev_time':
192 + $stmt .= ", iss_dev_time = '" . Misc::escapeString($filed_value) . "'";
194 + case 'percent_complete':
195 + $stmt .= ", iss_percent_complete = '" . Misc::escapeString($filed_value) . "'";
197 + case 'trigger_reminders':
198 + $stmt .= ", iss_trigger_reminders = " . Misc::escapeInteger($filed_value);
201 + $stmt .= ", iss_grp_id = " . Misc::escapeInteger($filed_value);
204 + $stmt .= ", iss_private = " . Misc::escapeInteger($filed_value);
207 + Error_Handler::logError("Unknown field name $field_name", __FILE__, __LINE__);
216 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
217 + if (PEAR::isError($res)) {
218 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
222 + 'category' => $current['iss_prc_id'],
223 + 'release' => $current['iss_pre_id'],
224 + 'expected_resolution_date' => $current['iss_expected_resolution_date'],
225 + 'release' => $current['iss_pre_id'],
226 + 'priority' => $current['iss_pri_id'],
227 + 'status' => $current['iss_sta_id'],
228 + 'resolution' => $current['iss_res_id'],
229 + 'summary' => $current['iss_summary'],
230 + 'description' => $current['iss_description'],
231 + 'estimated_dev_time' => $current['iss_dev_time'],
232 + 'percent_complete' => $current['iss_percent_complete'],
233 + 'trigger_reminders' => $current['iss_trigger_reminders'],
234 + 'group' => $current['iss_grp_id'],
235 + 'iss_private' => $current['private']
237 + $new[$field_name] = $filed_value;
239 + // add change to the history (only for changes on specific fields?)
240 + $updated_fields = array();
241 + if ($field_name == 'expected_resolution_date' && $current["iss_expected_resolution_date"] != $filed_value) {
242 + $updated_fields["Expected Resolution Date"] = History::formatChanges($current["iss_expected_resolution_date"], $filed_value);
244 + if ($field_name == 'category' && $current["iss_prc_id"] != $filed_value) {
245 + $updated_fields["Category"] = History::formatChanges(Category::getTitle($current["iss_prc_id"]), Category::getTitle($filed_value));
247 + if ($field_name == 'release' && $current["iss_pre_id"] != $filed_value) {
248 + $updated_fields["Release"] = History::formatChanges(Release::getTitle($current["iss_pre_id"]), Release::getTitle($filed_value));
250 + if ($field_name == 'priority' && $current["iss_pri_id"] != $filed_value) {
251 + $updated_fields["Priority"] = History::formatChanges(Priority::getTitle($current["iss_pri_id"]), Priority::getTitle($filed_value));
252 + Workflow::handlePriorityChange($prj_id, $issue_id, $usr_id, $current, $new);
254 + if ($field_name == 'status' && $current["iss_sta_id"] != $filed_value) {
255 + // clear out the last-triggered-reminder flag when changing the status of an issue
256 + Reminder_Action::clearLastTriggered($issue_id);
258 + // if old status was closed and new status is not, clear closed data from issue.
259 + $old_status_details = Status::getDetails($current['iss_sta_id']);
260 + if ($old_status_details['sta_is_closed'] == 1) {
261 + $new_status_details = Status::getDetails($filed_value);
262 + if ($new_status_details['sta_is_closed'] != 1) {
263 + Issue::clearClosed($issue_id);
266 + $updated_fields["Status"] = History::formatChanges(Status::getStatusTitle($current["iss_sta_id"]), Status::getStatusTitle($filed_value));
268 + if ($field_name == 'resolution' && $current["iss_res_id"] != $filed_value) {
269 + $updated_fields["Resolution"] = History::formatChanges(Resolution::getTitle($current["iss_res_id"]), Resolution::getTitle($filed_value));
271 + if ($field_name == 'estimated_dev_time' && $current["iss_dev_time"] != $filed_value) {
272 + $updated_fields["Estimated Dev. Time"] = History::formatChanges(Misc::getFormattedTime(($current["iss_dev_time"]*60)), Misc::getFormattedTime(($filed_value*60)));
274 + if ($field_name == 'summary' && $current["iss_summary"] != $filed_value) {
275 + $updated_fields["Summary"] = '';
277 + if ($field_name == 'description' && $current["iss_description"] != $filed_value) {
278 + $updated_fields["Description"] = '';
280 + if ($field_name == 'private' && ($filed_value != $current['iss_private'])) {
281 + $updated_fields["Private"] = History::formatChanges(Misc::getBooleanDisplayValue($current['iss_private']), Misc::getBooleanDisplayValue($filed_value));
283 + if (count($updated_fields) > 0) {
287 + foreach ($updated_fields as $key => $value) {
291 + if (($key != "Summary") && ($key != "Description")) {
292 + $changes .= "$key: $value";
294 + $changes .= "$key";
299 + History::add($issue_id, $usr_id, History::getTypeID('issue_updated'), "Issue updated ($changes) by " . User::getFullName($usr_id));
300 + // send notifications for the issue being updated
301 + Notification::notifyIssueUpdated($issue_id, $current, $new);
309 * Move the issue to a new project
310 @@ -1820,16 +1991,33 @@
312 $issue_id = Misc::escapeInteger($issue_id);
313 $assignee_usr_id = Misc::escapeInteger($assignee_usr_id);
315 + // move all orders down to free "order space" for this new association
317 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
319 + isu_order = isu_order + 1
321 + isu_usr_id = $assignee_usr_id AND
322 + isu_order >= $order";
323 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
324 + if (PEAR::isError($res)) {
325 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
328 + // insert the new association
330 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
340 - '" . Date_API::getCurrentDateGMT() . "'
341 + '" . Date_API::getCurrentDateGMT() . "',
344 $res = $GLOBALS["db_api"]->dbh->query($stmt);
345 if (PEAR::isError($res)) {
346 @@ -1844,6 +2032,78 @@
351 + * Method used to get the order list to be rearranged
354 + * @param string $issue_id The issue ID or a comma seperated list of IDs already prepared for giving to mysql
355 + * @param string $usr_id The user to remove. When not specified, all users are taken as to be removed for that issue
356 + * @return mixed delete order list to be rearranged. Used as a parameter to the method of rearranging the order.
358 + function getDeleteUserAssociationOrderList($issue_id, $usr_id = "")
360 + // find all affected associantion orders
361 + $stmt = "SELECT isu_usr_id, isu_order FROM
362 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
364 + isu_iss_id IN ($issue_id)";
365 + if ($usr_id !== FALSE) {
366 + $stmt.= " AND isu_usr_id IN ($usr_id)";
368 + $stmt.= "ORDER BY isu_order";
369 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
370 + if (PEAR::isError($res)) {
371 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
374 + $deleted_orders = array();
375 + foreach ($res as $row) {
376 + if (empty($deleted_orders[$row['isu_usr_id']])) {
377 + $deleted_orders[$row['isu_usr_id']] = array();
379 + $deleted_orders[$row['isu_usr_id']] [] = $row['isu_order'];
381 + return $deleted_orders;
387 + * Method used to rearrange order list in the db according to known deleted records
390 + * @param mixed deleteorder list
393 + function rearrangeDeleteUserAssociationOrderList($delete_order_list)
395 + if (empty($delete_order_list) || (!is_array($delete_order_list))) {
398 + foreach ($delete_order_list as $isu_usr_id => $orders) {
399 + for ($i = 0; $i < count($orders); $i++) { // traverse all deleted orders
400 + // move the orders after them up to take the "order space" of the deleted records
402 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
404 + isu_order = isu_order - " . ($i+1) . "
406 + isu_usr_id = $isu_usr_id AND
407 + isu_order > " . $orders[$i];
408 + if ($i < count($orders) - 1) {
410 + isu_order < " . $orders[$i+1];
412 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
413 + if (PEAR::isError($res)) {
414 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
424 * Method used to delete all user assignments for a specific issue.
425 @@ -1859,6 +2119,7 @@
426 if (is_array($issue_id)) {
427 $issue_id = implode(", ", $issue_id);
429 + $deleted_order_list = Issue::getDeleteUserAssociationOrderList($issue_id);
431 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
433 @@ -1871,6 +2132,7 @@
435 History::add($issue_id, $usr_id, History::getTypeID('user_all_unassociated'), 'Issue assignments removed by ' . User::getFullName($usr_id));
437 + Issue::rearrangeDeleteUserAsssociationOrderList($deleted_order_list);
441 @@ -1889,6 +2151,7 @@
443 $issue_id = Misc::escapeInteger($issue_id);
444 $usr_id = Misc::escapeInteger($usr_id);
445 + $delete_order_list = Issue::getDeleteUserAssociationOrderList($issue_id, $usr_id);
447 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
449 @@ -1903,6 +2166,7 @@
450 History::add($issue_id, Auth::getUserID(), History::getTypeID('user_unassociated'),
451 User::getFullName($usr_id) . ' removed from issue by ' . User::getFullName(Auth::getUserID()));
453 + Issue::rearrangeDeleteUserAssociationOrderList($delete_order_list);
457 @@ -2379,6 +2643,11 @@
459 $sort_by = Issue::getParam('sort_by');
460 $sort_order = Issue::getParam('sort_order');
461 + $users = Issue::getParam('users');
462 + if (empty($users) && ($sort_by == 'isu_order')) { // Sorting by isu_order is impossible when no user specified
464 + unset($sort_order);
466 $rows = Issue::getParam('rows');
467 $hide_closed = Issue::getParam('hide_closed');
468 if ($hide_closed === '') {
469 @@ -2483,6 +2752,7 @@
470 "last_action_date" => "desc",
471 "usr_full_name" => "asc",
472 "iss_expected_resolution_date" => "desc",
473 + "isu_order" => "desc",
476 foreach ($custom_fields as $fld_id => $fld_name) {
477 @@ -3275,6 +3545,8 @@
478 $ids = implode(", ", $ids);
485 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,
486 @@ -3286,6 +3558,7 @@
487 if (PEAR::isError($res)) {
488 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
490 + // gather names of the users assigned to each issue
492 for ($i = 0; $i < count($res); $i++) {
493 if (!empty($t[$res[$i]['isu_iss_id']])) {
494 @@ -3294,9 +3567,18 @@
495 $t[$res[$i]['isu_iss_id']] = $res[$i]['usr_full_name'];
500 + for ($i = 0; $i < count($res); $i++) {
501 + if (empty($o[$res[$i]['isu_iss_id']])) {
502 + $o[$res[$i]['isu_iss_id']] = array();
504 + $o[$res[$i]['isu_iss_id']][$res[$i]['isu_usr_id']] = $res[$i]['isu_order'];
506 // now populate the $result variable again
507 for ($i = 0; $i < count($result); $i++) {
508 @$result[$i]['assigned_users'] = $t[$result[$i]['iss_id']];
509 + @$result[$i]['assigned_users_order'] = $o[$result[$i]['iss_id']];
513 @@ -4264,6 +4546,7 @@
514 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
517 + Issue::moveOrderForAllUsers($issue_id, 1);
521 @@ -4322,8 +4605,127 @@
523 return $returns[$msg_id];
527 + * Reorders user's issues as requested by user
529 + * @param $usr_id User to be reordered
530 + * @param $issue_id Issue or array of issues to be moved
531 + * @param $neworder The new order of the issues
534 + function reorderUserIssues($usr_id, $issue_id, $neworder)
536 + if (!isset($usr_id) || !isset($issue_id) || !isset($neworder)) {
539 + if (!is_numeric($usr_id) || !is_numeric($neworder)) {
542 + $usr_id = Misc::escapeInteger($usr_id);
543 + $issue_id = Misc::escapeInteger($issue_id);
544 + $neworder = Misc::escapeInteger($neworder);
545 + if (is_array($issue_id)) {
546 + $issue_count = count($issue_id);
547 + $issue_id_str = implode(", ", $issue_id);
550 + $issue_id_str = $issue_id;
551 + $issue_id = array($issue_id);
553 + // do a nasty pretending to be deleting stuff so that reordering happens as if these elements were deleted
554 + $orderlist = Issue::getDeleteUserAssociationOrderList($issue_id_str, $usr_id);
555 + Issue::rearrangeDeleteUserAssociationOrderList($orderlist);
556 + // move down the orders to free the "order space" needed
558 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
560 + isu_order = isu_order + $issue_count
562 + isu_usr_id = $usr_id AND
563 + isu_order >= $neworder";
564 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
565 + if (PEAR::isError($res)) {
566 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
569 + //update the order for the issues being moved
571 + foreach ($issue_id as $iss_id) {
573 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
575 + isu_order = " . ($neworder + $i) . "
577 + isu_usr_id = $usr_id AND
578 + isu_iss_id = $iss_id";
579 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
580 + if (PEAR::isError($res)) {
581 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
590 + * Get users issue order list
592 + * @param $user_id User
593 + * @param $order_list Order of the issues
596 + function getIssueOrderByUser($usr_id) {
598 + if (!is_numeric($usr_id)) {
603 + isu_iss_id, isu_order
605 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
607 + isu_usr_id = " . $usr_id ;
609 + $order_list = array();
611 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
613 + if (PEAR::isError($res)) {
614 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
617 + foreach ($res as $row) {
618 + $order_list[$row["isu_iss_id"]] = $row["isu_order"];
621 + return $order_list;
624 + function moveOrderForAllUsers($issue_id, $neworder)
626 + // Move the issue to the top priority for the ppl it's assigned to
627 + $stmt = "SELECT isu_usr_id FROM
628 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
630 + isu_iss_id = " . Misc::escapeInteger($issue_id);
631 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
632 + if (PEAR::isError($res)) {
633 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
636 + foreach ($res as $row) {
637 + Issue::reorderUserIssues($row["isu_usr_id"], $issue_id, $neworder);
646 // benchmarking the included file (aka setup time)
648 $GLOBALS['bench']->setMarker('Included Issue Class');
649 --- eventum-r3749/js/global.js~ 2008-10-15 02:03:48.000000000 +0300
650 +++ eventum-r3749/js/global.js 2008-10-15 02:06:00.000000000 +0300
656 +$(document).ready(function() {
657 + // dialog type calender isn't working in Konqueror beacuse it's not a supported browser for either jQuery or jQuery UI
658 + // http://groups.google.com/group/jquery-ui/browse_thread/thread/ea61238c34cb5f33/046837b02fb90b5c
659 + if (navigator.appName != 'Konqueror') {
660 + $(".inline_date_pick").click(function() {
661 + var masterObj = this;
662 + var masterObjPos = $(masterObj).offset();
663 + // offset gives uses top and left but datepicker needs pageX and pageY
664 + var masterObjPos = {pageX: masterObjPos.left, pageY: masterObjPos.top};
665 + $(this).datepicker(
666 + // we use dialog type calender so we won't haveto have a hidden element on the page
669 + masterObj.innerHTML,
671 + function (date, dteObj) {
672 + fieldName = masterObj.id.substr(0,masterObj.id.indexOf('|'));
673 + issueID = masterObj.id.substr(masterObj.id.indexOf('|')+1);
674 + $.post("/ajax/update.php", {fieldName: fieldName, issueID: issueID, day: dteObj.selectedDay, month: (dteObj.selectedMonth+1), year: dteObj.selectedYear}, function(data) {
675 + if (data.length > 0) {
676 + masterObj.innerHTML = data;
681 + {dateFormat: 'dd M yy', duration: ""},
682 + // position of the datepicker calender - taken from div's offset
691 --- eventum/list.php 2008-10-15 01:46:20.000000000 +0300
692 +++ eventum-new/list.php 2008-10-15 02:02:25.000000000 +0300
694 $profile['sort_by'] . "&sort_order=" . $profile['sort_order']);
697 +@$reorder_usr_id = $_REQUEST["reorder_user"];
698 +@$reorder_issue_id = $_REQUEST["reorder_source"];
699 +@$reorder_neworder = $_REQUEST["reorder_neworder"];
700 +Issue::reorderUserIssues($reorder_usr_id, $reorder_issue_id, $reorder_neworder);
702 $options = Issue::saveSearchParams();
703 $tpl->assign("options", $options);
704 $tpl->assign("sorting", Issue::getSortingInfo($options));
707 $assign_options += $users;
709 +// get the isu_order (assignated users) ordering user
710 +if (!empty($options["users"])) {
711 + if ($options["users"] == -2) {
712 + $isu_order_user = $usr_id;
714 + if ($options["users"] > 0) {
715 + $isu_order_user = $options["users"];
717 + unset($isu_order_user);
720 + unset($isu_order_user);
722 +$tpl->assign("isu_order_user", $isu_order_user);
724 $list = Issue::getListing($prj_id, $options, $pagerRow, $rows);
725 $tpl->assign("list", $list["list"]);
726 $tpl->assign("list_info", $list["info"]);
727 --- eventum/templates/list.tpl.html 2008-10-15 01:46:20.000000000 +0300
728 +++ eventum-new/templates/list.tpl.html 2008-10-15 02:02:25.000000000 +0300
733 +function reorderBulk(order_user, neworder)
735 + url = page_url + "?";
736 + url += "reorder_user=" + order_user;
738 + items = document.getElementsByName("item[]");
740 + for (var i = 0; i < items.length; i++) {
741 + if (items[i].checked) {
742 + url += "&reorder_source[" + checkedcount + "]=" + items[i].value;
746 + if (checkedcount == 0) {
747 + alert('{/literal}{t escape=js}Please choose which issues to move to the new place.{/t}{literal}');
751 + url += "&reorder_neworder=" + neworder;
753 + window.location.href = url;
755 function hideClosed(f)
757 if (f.hide_closed.checked) {
759 f.go.disabled = true;
762 +function updateCustomFields(issue_id)
764 + var features = 'width=560,height=460,top=30,left=30,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no';
765 + var customWin = window.open('custom_fields.php?issue_id=' + issue_id, '_custom_fields', features);
772 @@ -166,11 +195,11 @@
773 <input type="hidden" name="cat" value="bulk_update">
776 - <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
778 + <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0" id="issue_list_table">
779 + <tr class="nodrag">
780 <td colspan="{$col_count}" class="default">
781 <table width="100%" cellspacing="0" cellpadding="0" border="0">
783 + <tr class="nodrag">
785 <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>
786 {include file="help_link.tpl.html" topic="list"}
791 - <tr bgcolor="{$cell_color}">
792 + <tr bgcolor="{$cell_color}" class="nodrag">
793 {if $current_role > $roles.developer}
795 <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');toggleBulkUpdate();">
797 {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}
801 + {elseif $field_name != 'isu_order' || $isu_order_user}
802 <td align="{$column.align|default:'center'}" class="default_white" nowrap {if $column.width != ''}width="{$column.width}"{/if}>
803 {if $field_name == 'iss_summary'}
804 <table cellspacing="0" cellpadding="1" width="100%">
807 {elseif $sorting.links[$field_name] != ''}
808 <a title="{t}sort by{/t} {$column.title}" href="{$sorting.links[$field_name]}" class="white_link">{$column.title}</a>
809 + {if $field_name == 'isu_order'}
810 + <br>{$users[$isu_order_user]}
812 {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}
815 @@ -229,19 +261,20 @@
820 {section name="i" loop=$list}
821 - <tr {if $current_role >= $roles.developer AND $list[i].iqu_status > 0}style="text-decoration: line-through;"{/if}>
822 + <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}>
823 {if $current_role > $roles.developer}
824 <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>
826 {foreach from=$columns item=column key=field_name}
827 {if $field_name == 'custom_fields'}
828 {foreach from=$list[i].custom_field key=fld_id item=fld_value}
829 - <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default">
830 - {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id}
831 + <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default custom_field" onclick="return updateCustomFields({$list[i].iss_id});">
832 + {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id}
836 + {elseif $field_name != 'isu_order' || $isu_order_user}
837 <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default">
838 {if $field_name == 'iss_id'}
839 <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_id}</a>
841 {elseif $field_name == 'iss_percent_complete'}
842 {$list[i].iss_percent_complete|escape:"html"}%
843 {elseif $field_name == 'iss_expected_resolution_date'}
844 - {$list[i].iss_expected_resolution_date|escape:"html"}
845 + <div class="inline_date_pick" id="expected_resolution_date|{$list[i].iss_id}">{$list[i].iss_expected_resolution_date|escape:"html"} </div>
846 {elseif $field_name == 'iss_summary'}
847 <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_summary|escape:"html"}</a>
848 {if $list[i].redeemed}
850 {if $list[i].iss_private == 1}
853 + {elseif $field_name == 'isu_order'}
854 + {if $list[i].assigned_users_order[$current_user_id]}
855 + <img src="{$rel_url}images/updown.gif" alt="move">
860 @@ -297,10 +334,11 @@
864 - <tr bgcolor="{$cell_color}">
866 + <tr bgcolor="{$cell_color}" class="nodrag">
867 <td colspan="{$col_count}">
868 <table width="100%" cellspacing="0" cellpadding="0">
870 + <tr class="nodrag">
871 <td width="30%" nowrap>
872 {if $current_role > $roles.developer}
873 <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');">
879 +<script type="text/javascript">
881 + * Order issues by drag and drop:
882 + * only if sorted by order and viewing your own issues
884 +{if $options.sort_by == "isu_order" and $current_user_id == $isu_order_user}
886 +var before = ''; // make it global variable
887 +$('#issue_list_table').tableDnD({
888 + onDragClass: "tDnD_whileDrag",
889 + onDragStart: function(table, row) {
890 + before = $.tableDnD.serialize('id');
892 + onDrop: function(table, row) {
893 + $.post("/ajax/order.php", {before: before, after: $.tableDnD.serialize('id')}, function(data) {
894 + if (data.length > 0) {
903 {include file="app_info.tpl.html"}
904 -{include file="footer.tpl.html"}
905 +{include file="footer.tpl.html"}
906 \ No newline at end of file