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
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");
11 +if (!Auth::hasValidCookie(APP_COOKIE)) {
17 +if (!isset($_POST['before']) || !isset($_POST['after'])) {
21 +$before = Misc::explode_url($_POST['before']);
22 +$after = Misc::explode_url($_POST['after']);
24 +$before = $before['issue_list_table'];
25 +$after = $after['issue_list_table'];
28 +$before = array_slice($before, 2, count($before)-3);
29 +$after = array_slice($after, 2, count($after)-3);
31 +if (count($before) != count($after) or count($before) < 1) {
35 +$usr_id = Auth::getUserID();
37 +$order = Issue::getIssueOrderByUser($usr_id);
39 +if (!count($order)) {
40 + // no prev order list
44 +$after_filterd = array();
45 +$before_filterd = array();
47 +// remove issues that are not assigned to me
48 +foreach ($after as $id) {
49 + if (isset($order[$id])) {
50 + $after_filterd[] = $id;
53 +foreach ($before as $id) {
54 + if (isset($order[$id])) {
55 + $before_filterd[] = $id;
59 +foreach ($after_filterd as $key => $nID) {
60 + if ($nID != $before_filterd[$key]) {
63 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
65 + isu_order = " . $order[$before_filterd[$key]] . "
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');
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
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");
88 +if (!Auth::hasValidCookie(APP_COOKIE)) {
92 +if (!is_numeric($_POST['issueID'])) {
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);
104 + echo 'update failed';
109 + die('object type not supported');
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
117 "iss_expected_resolution_date" => array(
118 "title" => ev_gettext("Expected Resolution Date")
121 + "isu_order" => array(
122 + "title" => ev_gettext("Order")
126 return $columns[$page];
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 @@
131 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
134 + Issue::moveOrderForAllUsers($issue_id, 1000);
135 $prj_id = Issue::getProjectID($issue_id);
138 @@ -1659,6 +1660,176 @@
143 + * Method used to update the a single detail field of a specific issue.
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
151 + function updateField($issue_id, $field_name, $filed_value) {
153 + $issue_id = Misc::escapeInteger($issue_id);
155 + $usr_id = Auth::getUserID();
156 + $prj_id = Issue::getProjectID($issue_id);
158 + // get all of the 'current' information of this issue
159 + $current = Issue::getDetails($issue_id);
162 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue
164 + iss_updated_date='" . Date_API::getCurrentDateGMT() . "',
165 + iss_last_public_action_date='" . Date_API::getCurrentDateGMT() . "',
166 + iss_last_public_action_type='updated'";
168 + switch ($field_name) {
170 + $stmt .= ", iss_prc_id = " . Misc::escapeInteger($filed_value);
173 + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value);
175 + case 'expected_resolution_date':
176 + $stmt .= ", iss_expected_resolution_date = '" . Misc::escapeString($filed_value) . "'";
179 + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value);
182 + $stmt .= ", iss_pri_id = " . Misc::escapeInteger($filed_value);
185 + $stmt .= ", iss_sta_id = " . Misc::escapeInteger($filed_value);
188 + $stmt .= ", iss_res_id = " . Misc::escapeInteger($filed_value);
191 + $stmt .= ", iss_summary = '" . Misc::escapeString($filed_value) . "'";
193 + case 'description':
194 + $stmt .= ", iss_description = '" . Misc::escapeString($filed_value) . "'";
196 + case 'estimated_dev_time':
197 + $stmt .= ", iss_dev_time = '" . Misc::escapeString($filed_value) . "'";
199 + case 'percent_complete':
200 + $stmt .= ", iss_percent_complete = '" . Misc::escapeString($filed_value) . "'";
202 + case 'trigger_reminders':
203 + $stmt .= ", iss_trigger_reminders = " . Misc::escapeInteger($filed_value);
206 + $stmt .= ", iss_grp_id = " . Misc::escapeInteger($filed_value);
209 + $stmt .= ", iss_private = " . Misc::escapeInteger($filed_value);
212 + Error_Handler::logError("Unknown field name $field_name", __FILE__, __LINE__);
221 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
222 + if (PEAR::isError($res)) {
223 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
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']
242 + $new[$field_name] = $filed_value;
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);
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));
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));
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);
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);
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);
271 + $updated_fields["Status"] = History::formatChanges(Status::getStatusTitle($current["iss_sta_id"]), Status::getStatusTitle($filed_value));
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));
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)));
279 + if ($field_name == 'summary' && $current["iss_summary"] != $filed_value) {
280 + $updated_fields["Summary"] = '';
282 + if ($field_name == 'description' && $current["iss_description"] != $filed_value) {
283 + $updated_fields["Description"] = '';
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));
288 + if (count($updated_fields) > 0) {
292 + foreach ($updated_fields as $key => $value) {
296 + if (($key != "Summary") && ($key != "Description")) {
297 + $changes .= "$key: $value";
299 + $changes .= "$key";
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);
314 * Move the issue to a new project
315 @@ -1820,16 +1991,33 @@
317 $issue_id = Misc::escapeInteger($issue_id);
318 $assignee_usr_id = Misc::escapeInteger($assignee_usr_id);
320 + // move all orders down to free "order space" for this new association
322 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
324 + isu_order = isu_order + 1
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__);
333 + // insert the new association
335 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
345 - '" . Date_API::getCurrentDateGMT() . "'
346 + '" . Date_API::getCurrentDateGMT() . "',
349 $res = $GLOBALS["db_api"]->dbh->query($stmt);
350 if (PEAR::isError($res)) {
351 @@ -1844,6 +2032,78 @@
356 + * Method used to get the order list to be rearranged
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.
363 + function getDeleteUserAssociationOrderList($issue_id, $usr_id = "")
365 + // find all affected associantion orders
366 + $stmt = "SELECT isu_usr_id, isu_order FROM
367 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
369 + isu_iss_id IN ($issue_id)";
370 + if ($usr_id !== FALSE) {
371 + $stmt.= " AND isu_usr_id IN ($usr_id)";
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__);
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();
384 + $deleted_orders[$row['isu_usr_id']] [] = $row['isu_order'];
386 + return $deleted_orders;
392 + * Method used to rearrange order list in the db according to known deleted records
395 + * @param mixed deleteorder list
398 + function rearrangeDeleteUserAssociationOrderList($delete_order_list)
400 + if (empty($delete_order_list) || (!is_array($delete_order_list))) {
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
407 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
409 + isu_order = isu_order - " . ($i+1) . "
411 + isu_usr_id = $isu_usr_id AND
412 + isu_order > " . $orders[$i];
413 + if ($i < count($orders) - 1) {
415 + isu_order < " . $orders[$i+1];
417 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
418 + if (PEAR::isError($res)) {
419 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
429 * Method used to delete all user assignments for a specific issue.
430 @@ -1859,6 +2119,7 @@
431 if (is_array($issue_id)) {
432 $issue_id = implode(", ", $issue_id);
434 + $deleted_order_list = Issue::getDeleteUserAssociationOrderList($issue_id);
436 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
438 @@ -1871,6 +2132,7 @@
440 History::add($issue_id, $usr_id, History::getTypeID('user_all_unassociated'), 'Issue assignments removed by ' . User::getFullName($usr_id));
442 + Issue::rearrangeDeleteUserAsssociationOrderList($deleted_order_list);
446 @@ -1889,6 +2151,7 @@
448 $issue_id = Misc::escapeInteger($issue_id);
449 $usr_id = Misc::escapeInteger($usr_id);
450 + $delete_order_list = Issue::getDeleteUserAssociationOrderList($issue_id, $usr_id);
452 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
454 @@ -1903,6 +2166,7 @@
455 History::add($issue_id, Auth::getUserID(), History::getTypeID('user_unassociated'),
456 User::getFullName($usr_id) . ' removed from issue by ' . User::getFullName(Auth::getUserID()));
458 + Issue::rearrangeDeleteUserAssociationOrderList($delete_order_list);
462 @@ -2379,6 +2643,11 @@
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
469 + unset($sort_order);
471 $rows = Issue::getParam('rows');
472 $hide_closed = Issue::getParam('hide_closed');
473 if ($hide_closed === '') {
474 @@ -2483,6 +2752,7 @@
475 "last_action_date" => "desc",
476 "usr_full_name" => "asc",
477 "iss_expected_resolution_date" => "desc",
478 + "isu_order" => "desc",
481 foreach ($custom_fields as $fld_id => $fld_name) {
482 @@ -3275,6 +3545,8 @@
483 $ids = implode(", ", $ids);
490 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,
491 @@ -3286,6 +3558,7 @@
492 if (PEAR::isError($res)) {
493 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
495 + // gather names of the users assigned to each issue
497 for ($i = 0; $i < count($res); $i++) {
498 if (!empty($t[$res[$i]['isu_iss_id']])) {
499 @@ -3294,9 +3567,18 @@
500 $t[$res[$i]['isu_iss_id']] = $res[$i]['usr_full_name'];
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();
509 + $o[$res[$i]['isu_iss_id']][$res[$i]['isu_usr_id']] = $res[$i]['isu_order'];
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']];
518 @@ -4264,6 +4546,7 @@
519 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
522 + Issue::moveOrderForAllUsers($issue_id, 1);
526 @@ -4322,8 +4605,127 @@
528 return $returns[$msg_id];
532 + * Reorders user's issues as requested by user
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
539 + function reorderUserIssues($usr_id, $issue_id, $neworder)
541 + if (!isset($usr_id) || !isset($issue_id) || !isset($neworder)) {
544 + if (!is_numeric($usr_id) || !is_numeric($neworder)) {
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);
555 + $issue_id_str = $issue_id;
556 + $issue_id = array($issue_id);
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
563 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
565 + isu_order = isu_order + $issue_count
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__);
574 + //update the order for the issues being moved
576 + foreach ($issue_id as $iss_id) {
578 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
580 + isu_order = " . ($neworder + $i) . "
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__);
595 + * Get users issue order list
597 + * @param $user_id User
598 + * @param $order_list Order of the issues
601 + function getIssueOrderByUser($usr_id) {
603 + if (!is_numeric($usr_id)) {
608 + isu_iss_id, isu_order
610 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
612 + isu_usr_id = " . $usr_id ;
614 + $order_list = array();
616 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
618 + if (PEAR::isError($res)) {
619 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
622 + foreach ($res as $row) {
623 + $order_list[$row["isu_iss_id"]] = $row["isu_order"];
626 + return $order_list;
629 + function moveOrderForAllUsers($issue_id, $neworder)
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
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__);
641 + foreach ($res as $row) {
642 + Issue::reorderUserIssues($row["isu_usr_id"], $issue_id, $neworder);
651 // benchmarking the included file (aka setup time)
653 $GLOBALS['bench']->setMarker('Included Issue Class');
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
659 return self::$messages;
663 + * Parse url query string to php array
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
670 + function explode_url($str) {
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));
680 + if(isset($index)) {
681 + // Declare or add to the global array defined by $name
682 + if(!isset($return[$name])) {
683 + $return[$name] = array();
685 + // Associative array
686 + if(strlen($index) > 0) {
687 + $return[$name][$index] = addslashes(urldecode($value));
690 + array_push($return[$name], addslashes(urldecode($value)));
694 + // Declare or overwrite the global variable defined by $name
695 + $return[$name] = addslashes(urldecode($value));
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 @@
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
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
731 + masterObj.innerHTML,
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;
743 + {dateFormat: 'dd M yy', duration: ""},
744 + // position of the datepicker calender - taken from div's offset
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
760 $profile['sort_by'] . "&sort_order=" . $profile['sort_order']);
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);
768 $options = Issue::saveSearchParams();
769 $tpl->assign("options", $options);
770 $tpl->assign("sorting", Issue::getSortingInfo($options));
773 $assign_options += $users;
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;
780 + if ($options["users"] > 0) {
781 + $isu_order_user = $options["users"];
783 + unset($isu_order_user);
786 + unset($isu_order_user);
788 +$tpl->assign("isu_order_user", $isu_order_user);
790 $list = Issue::getListing($prj_id, $options, $pagerRow, $rows);
791 $tpl->assign("list", $list["list"]);
792 $tpl->assign("list_info", $list["info"]);
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
800 +function reorderBulk(order_user, neworder)
802 + url = page_url + "?";
803 + url += "reorder_user=" + order_user;
805 + items = document.getElementsByName("item[]");
807 + for (var i = 0; i < items.length; i++) {
808 + if (items[i].checked) {
809 + url += "&reorder_source[" + checkedcount + "]=" + items[i].value;
813 + if (checkedcount == 0) {
814 + alert('{/literal}{t escape=js}Please choose which issues to move to the new place.{/t}{literal}');
818 + url += "&reorder_neworder=" + neworder;
820 + window.location.href = url;
822 function hideClosed(f)
824 if (f.hide_closed.checked) {
826 f.go.disabled = true;
829 +function updateCustomFields(issue_id)
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);
839 @@ -166,11 +195,11 @@
840 <input type="hidden" name="cat" value="bulk_update">
843 - <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
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">
850 + <tr class="nodrag">
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"}
858 - <tr bgcolor="{$cell_color}">
859 + <tr bgcolor="{$cell_color}" class="nodrag">
860 {if $current_role > $roles.developer}
862 <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');toggleBulkUpdate();">
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}
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%">
874 {elseif $sorting.links[$field_name] != ''}
875 <a title="{t}sort by{/t} {$column.title}" href="{$sorting.links[$field_name]}" class="white_link">{$column.title}</a>
876 + {if $field_name == 'isu_order'}
877 + <br>{$users[$isu_order_user]}
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}
882 @@ -229,19 +261,20 @@
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>
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}
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'}
906 <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_id}</a>
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}
917 {if $list[i].iss_private == 1}
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">
927 @@ -297,10 +334,11 @@
931 - <tr bgcolor="{$cell_color}">
933 + <tr bgcolor="{$cell_color}" class="nodrag">
934 <td colspan="{$col_count}">
935 <table width="100%" cellspacing="0" cellpadding="0">
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[]');">
946 +<script type="text/javascript">
948 + * Order issues by drag and drop:
949 + * only if sorted by order and viewing your own issues
951 +{if $options.sort_by == "isu_order" and $current_user_id == $isu_order_user}
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');
959 + onDrop: function(table, row) {
960 + $.post("/ajax/order.php", {before: before, after: $.tableDnD.serialize('id')}, function(data) {
961 + if (data.length > 0) {
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