1 --- eventum/ajax/order.php 2008-10-15 01:46:20.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 +$before = Misc::explode_url($_POST['before']);
21 +$after = Misc::explode_url($_POST['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 \ No newline at end of file
77 --- eventum/ajax/update.php 2008-10-15 01:46:20.000000000 +0300
78 +++ eventum-new/ajax/update.php 2008-10-15 02:02:25.000000000 +0300
81 +require_once(dirname(__FILE__) . '/../init.php');
82 +require_once(APP_INC_PATH . "class.auth.php");
83 +require_once(APP_INC_PATH . "class.issue.php");
86 +if (!Auth::hasValidCookie(APP_COOKIE)) {
90 +if (!is_numeric($_POST['issueID'])) {
94 +switch ($_POST['fieldName']) {
95 + case 'expected_resolution_date':
96 + $day = (int)$_POST['day'];
97 + $month = (int)$_POST['month'];
98 + $year = (int)$_POST['year'];
99 + if (Issue::updateField($_POST['issueID'], $_POST['fieldName'], sprintf('%04d-%02d-%02d', $year, $month, $day)) !== -1) {
100 + echo Date_API::getSimpleDate(sprintf('%04d-%02d-%02d', $year, $month, $day), false);
102 + echo 'update failed';
107 + die('object type not supported');
110 --- eventum/include/class.display_column.php 2008-10-15 01:46:20.000000000 +0300
111 +++ eventum-new/include/class.display_column.php 2008-10-15 02:02:25.000000000 +0300
114 "iss_expected_resolution_date" => array(
115 "title" => ev_gettext("Expected Resolution Date")
118 + "isu_order" => array(
119 + "title" => ev_gettext("Order")
123 return $columns[$page];
124 --- eventum/include/class.issue.php 2008-10-15 01:46:20.000000000 +0300
125 +++ eventum-new/include/class.issue.php 2008-10-15 02:02:25.000000000 +0300
126 @@ -1356,6 +1356,7 @@
127 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
130 + Issue::moveOrderForAllUsers($issue_id, 1000);
131 $prj_id = Issue::getProjectID($issue_id);
134 @@ -1659,6 +1660,176 @@
139 + * Method used to update the a single detail field of a specific issue.
141 + * @param integer $issue_id
142 + * @param string $field_name
143 + * @param string $field_value
144 + * @param string $field_type string or integer (for escape)
145 + * @return integer 1 on success, -1 otherwise
147 + function updateField($issue_id, $field_name, $filed_value) {
149 + $issue_id = Misc::escapeInteger($issue_id);
151 + $usr_id = Auth::getUserID();
152 + $prj_id = Issue::getProjectID($issue_id);
154 + // get all of the 'current' information of this issue
155 + $current = Issue::getDetails($issue_id);
158 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue
160 + iss_updated_date='" . Date_API::getCurrentDateGMT() . "',
161 + iss_last_public_action_date='" . Date_API::getCurrentDateGMT() . "',
162 + iss_last_public_action_type='updated'";
164 + switch ($field_name) {
166 + $stmt .= ", iss_prc_id = " . Misc::escapeInteger($filed_value);
169 + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value);
171 + case 'expected_resolution_date':
172 + $stmt .= ", iss_expected_resolution_date = '" . Misc::escapeString($filed_value) . "'";
175 + $stmt .= ", iss_pre_id = " . Misc::escapeInteger($filed_value);
178 + $stmt .= ", iss_pri_id = " . Misc::escapeInteger($filed_value);
181 + $stmt .= ", iss_sta_id = " . Misc::escapeInteger($filed_value);
184 + $stmt .= ", iss_res_id = " . Misc::escapeInteger($filed_value);
187 + $stmt .= ", iss_summary = '" . Misc::escapeString($filed_value) . "'";
189 + case 'description':
190 + $stmt .= ", iss_description = '" . Misc::escapeString($filed_value) . "'";
192 + case 'estimated_dev_time':
193 + $stmt .= ", iss_dev_time = '" . Misc::escapeString($filed_value) . "'";
195 + case 'percent_complete':
196 + $stmt .= ", iss_percent_complete = '" . Misc::escapeString($filed_value) . "'";
198 + case 'trigger_reminders':
199 + $stmt .= ", iss_trigger_reminders = " . Misc::escapeInteger($filed_value);
202 + $stmt .= ", iss_grp_id = " . Misc::escapeInteger($filed_value);
205 + $stmt .= ", iss_private = " . Misc::escapeInteger($filed_value);
208 + Error_Handler::logError("Unknown field name $field_name", __FILE__, __LINE__);
217 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
218 + if (PEAR::isError($res)) {
219 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
223 + 'category' => $current['iss_prc_id'],
224 + 'release' => $current['iss_pre_id'],
225 + 'expected_resolution_date' => $current['iss_expected_resolution_date'],
226 + 'release' => $current['iss_pre_id'],
227 + 'priority' => $current['iss_pri_id'],
228 + 'status' => $current['iss_sta_id'],
229 + 'resolution' => $current['iss_res_id'],
230 + 'summary' => $current['iss_summary'],
231 + 'description' => $current['iss_description'],
232 + 'estimated_dev_time' => $current['iss_dev_time'],
233 + 'percent_complete' => $current['iss_percent_complete'],
234 + 'trigger_reminders' => $current['iss_trigger_reminders'],
235 + 'group' => $current['iss_grp_id'],
236 + 'iss_private' => $current['private']
238 + $new[$field_name] = $filed_value;
240 + // add change to the history (only for changes on specific fields?)
241 + $updated_fields = array();
242 + if ($field_name == 'expected_resolution_date' && $current["iss_expected_resolution_date"] != $filed_value) {
243 + $updated_fields["Expected Resolution Date"] = History::formatChanges($current["iss_expected_resolution_date"], $filed_value);
245 + if ($field_name == 'category' && $current["iss_prc_id"] != $filed_value) {
246 + $updated_fields["Category"] = History::formatChanges(Category::getTitle($current["iss_prc_id"]), Category::getTitle($filed_value));
248 + if ($field_name == 'release' && $current["iss_pre_id"] != $filed_value) {
249 + $updated_fields["Release"] = History::formatChanges(Release::getTitle($current["iss_pre_id"]), Release::getTitle($filed_value));
251 + if ($field_name == 'priority' && $current["iss_pri_id"] != $filed_value) {
252 + $updated_fields["Priority"] = History::formatChanges(Priority::getTitle($current["iss_pri_id"]), Priority::getTitle($filed_value));
253 + Workflow::handlePriorityChange($prj_id, $issue_id, $usr_id, $current, $new);
255 + if ($field_name == 'status' && $current["iss_sta_id"] != $filed_value) {
256 + // clear out the last-triggered-reminder flag when changing the status of an issue
257 + Reminder_Action::clearLastTriggered($issue_id);
259 + // if old status was closed and new status is not, clear closed data from issue.
260 + $old_status_details = Status::getDetails($current['iss_sta_id']);
261 + if ($old_status_details['sta_is_closed'] == 1) {
262 + $new_status_details = Status::getDetails($filed_value);
263 + if ($new_status_details['sta_is_closed'] != 1) {
264 + Issue::clearClosed($issue_id);
267 + $updated_fields["Status"] = History::formatChanges(Status::getStatusTitle($current["iss_sta_id"]), Status::getStatusTitle($filed_value));
269 + if ($field_name == 'resolution' && $current["iss_res_id"] != $filed_value) {
270 + $updated_fields["Resolution"] = History::formatChanges(Resolution::getTitle($current["iss_res_id"]), Resolution::getTitle($filed_value));
272 + if ($field_name == 'estimated_dev_time' && $current["iss_dev_time"] != $filed_value) {
273 + $updated_fields["Estimated Dev. Time"] = History::formatChanges(Misc::getFormattedTime(($current["iss_dev_time"]*60)), Misc::getFormattedTime(($filed_value*60)));
275 + if ($field_name == 'summary' && $current["iss_summary"] != $filed_value) {
276 + $updated_fields["Summary"] = '';
278 + if ($field_name == 'description' && $current["iss_description"] != $filed_value) {
279 + $updated_fields["Description"] = '';
281 + if ($field_name == 'private' && ($filed_value != $current['iss_private'])) {
282 + $updated_fields["Private"] = History::formatChanges(Misc::getBooleanDisplayValue($current['iss_private']), Misc::getBooleanDisplayValue($filed_value));
284 + if (count($updated_fields) > 0) {
288 + foreach ($updated_fields as $key => $value) {
292 + if (($key != "Summary") && ($key != "Description")) {
293 + $changes .= "$key: $value";
295 + $changes .= "$key";
300 + History::add($issue_id, $usr_id, History::getTypeID('issue_updated'), "Issue updated ($changes) by " . User::getFullName($usr_id));
301 + // send notifications for the issue being updated
302 + Notification::notifyIssueUpdated($issue_id, $current, $new);
310 * Move the issue to a new project
311 @@ -1820,16 +1991,33 @@
313 $issue_id = Misc::escapeInteger($issue_id);
314 $assignee_usr_id = Misc::escapeInteger($assignee_usr_id);
316 + // move all orders down to free "order space" for this new association
318 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
320 + isu_order = isu_order + 1
322 + isu_usr_id = $assignee_usr_id AND
323 + isu_order >= $order";
324 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
325 + if (PEAR::isError($res)) {
326 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
329 + // insert the new association
331 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
341 - '" . Date_API::getCurrentDateGMT() . "'
342 + '" . Date_API::getCurrentDateGMT() . "',
345 $res = $GLOBALS["db_api"]->dbh->query($stmt);
346 if (PEAR::isError($res)) {
347 @@ -1844,6 +2032,78 @@
352 + * Method used to get the order list to be rearranged
355 + * @param string $issue_id The issue ID or a comma seperated list of IDs already prepared for giving to mysql
356 + * @param string $usr_id The user to remove. When not specified, all users are taken as to be removed for that issue
357 + * @return mixed delete order list to be rearranged. Used as a parameter to the method of rearranging the order.
359 + function getDeleteUserAssociationOrderList($issue_id, $usr_id = "")
361 + // find all affected associantion orders
362 + $stmt = "SELECT isu_usr_id, isu_order FROM
363 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
365 + isu_iss_id IN ($issue_id)";
366 + if ($usr_id !== FALSE) {
367 + $stmt.= " AND isu_usr_id IN ($usr_id)";
369 + $stmt.= "ORDER BY isu_order";
370 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
371 + if (PEAR::isError($res)) {
372 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
375 + $deleted_orders = array();
376 + foreach ($res as $row) {
377 + if (empty($deleted_orders[$row['isu_usr_id']])) {
378 + $deleted_orders[$row['isu_usr_id']] = array();
380 + $deleted_orders[$row['isu_usr_id']] [] = $row['isu_order'];
382 + return $deleted_orders;
388 + * Method used to rearrange order list in the db according to known deleted records
391 + * @param mixed deleteorder list
394 + function rearrangeDeleteUserAssociationOrderList($delete_order_list)
396 + if (empty($delete_order_list) || (!is_array($delete_order_list))) {
399 + foreach ($delete_order_list as $isu_usr_id => $orders) {
400 + for ($i = 0; $i < count($orders); $i++) { // traverse all deleted orders
401 + // move the orders after them up to take the "order space" of the deleted records
403 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
405 + isu_order = isu_order - " . ($i+1) . "
407 + isu_usr_id = $isu_usr_id AND
408 + isu_order > " . $orders[$i];
409 + if ($i < count($orders) - 1) {
411 + isu_order < " . $orders[$i+1];
413 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
414 + if (PEAR::isError($res)) {
415 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
425 * Method used to delete all user assignments for a specific issue.
426 @@ -1859,6 +2119,7 @@
427 if (is_array($issue_id)) {
428 $issue_id = implode(", ", $issue_id);
430 + $deleted_order_list = Issue::getDeleteUserAssociationOrderList($issue_id);
432 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
434 @@ -1871,6 +2132,7 @@
436 History::add($issue_id, $usr_id, History::getTypeID('user_all_unassociated'), 'Issue assignments removed by ' . User::getFullName($usr_id));
438 + Issue::rearrangeDeleteUserAsssociationOrderList($deleted_order_list);
442 @@ -1889,6 +2151,7 @@
444 $issue_id = Misc::escapeInteger($issue_id);
445 $usr_id = Misc::escapeInteger($usr_id);
446 + $delete_order_list = Issue::getDeleteUserAssociationOrderList($issue_id, $usr_id);
448 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
450 @@ -1903,6 +2166,7 @@
451 History::add($issue_id, Auth::getUserID(), History::getTypeID('user_unassociated'),
452 User::getFullName($usr_id) . ' removed from issue by ' . User::getFullName(Auth::getUserID()));
454 + Issue::rearrangeDeleteUserAssociationOrderList($delete_order_list);
458 @@ -2379,6 +2643,11 @@
460 $sort_by = Issue::getParam('sort_by');
461 $sort_order = Issue::getParam('sort_order');
462 + $users = Issue::getParam('users');
463 + if (empty($users) && ($sort_by == 'isu_order')) { // Sorting by isu_order is impossible when no user specified
465 + unset($sort_order);
467 $rows = Issue::getParam('rows');
468 $hide_closed = Issue::getParam('hide_closed');
469 if ($hide_closed === '') {
470 @@ -2483,6 +2752,7 @@
471 "last_action_date" => "desc",
472 "usr_full_name" => "asc",
473 "iss_expected_resolution_date" => "desc",
474 + "isu_order" => "desc",
477 foreach ($custom_fields as $fld_id => $fld_name) {
478 @@ -3275,6 +3545,8 @@
479 $ids = implode(", ", $ids);
486 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,
487 @@ -3286,6 +3558,7 @@
488 if (PEAR::isError($res)) {
489 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
491 + // gather names of the users assigned to each issue
493 for ($i = 0; $i < count($res); $i++) {
494 if (!empty($t[$res[$i]['isu_iss_id']])) {
495 @@ -3294,9 +3567,18 @@
496 $t[$res[$i]['isu_iss_id']] = $res[$i]['usr_full_name'];
501 + for ($i = 0; $i < count($res); $i++) {
502 + if (empty($o[$res[$i]['isu_iss_id']])) {
503 + $o[$res[$i]['isu_iss_id']] = array();
505 + $o[$res[$i]['isu_iss_id']][$res[$i]['isu_usr_id']] = $res[$i]['isu_order'];
507 // now populate the $result variable again
508 for ($i = 0; $i < count($result); $i++) {
509 @$result[$i]['assigned_users'] = $t[$result[$i]['iss_id']];
510 + @$result[$i]['assigned_users_order'] = $o[$result[$i]['iss_id']];
514 @@ -4264,6 +4546,7 @@
515 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
518 + Issue::moveOrderForAllUsers($issue_id, 1);
522 @@ -4322,8 +4605,127 @@
524 return $returns[$msg_id];
528 + * Reorders user's issues as requested by user
530 + * @param $usr_id User to be reordered
531 + * @param $issue_id Issue or array of issues to be moved
532 + * @param $neworder The new order of the issues
535 + function reorderUserIssues($usr_id, $issue_id, $neworder)
537 + if (!isset($usr_id) || !isset($issue_id) || !isset($neworder)) {
540 + if (!is_numeric($usr_id) || !is_numeric($neworder)) {
543 + $usr_id = Misc::escapeInteger($usr_id);
544 + $issue_id = Misc::escapeInteger($issue_id);
545 + $neworder = Misc::escapeInteger($neworder);
546 + if (is_array($issue_id)) {
547 + $issue_count = count($issue_id);
548 + $issue_id_str = implode(", ", $issue_id);
551 + $issue_id_str = $issue_id;
552 + $issue_id = array($issue_id);
554 + // do a nasty pretending to be deleting stuff so that reordering happens as if these elements were deleted
555 + $orderlist = Issue::getDeleteUserAssociationOrderList($issue_id_str, $usr_id);
556 + Issue::rearrangeDeleteUserAssociationOrderList($orderlist);
557 + // move down the orders to free the "order space" needed
559 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
561 + isu_order = isu_order + $issue_count
563 + isu_usr_id = $usr_id AND
564 + isu_order >= $neworder";
565 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
566 + if (PEAR::isError($res)) {
567 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
570 + //update the order for the issues being moved
572 + foreach ($issue_id as $iss_id) {
574 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
576 + isu_order = " . ($neworder + $i) . "
578 + isu_usr_id = $usr_id AND
579 + isu_iss_id = $iss_id";
580 + $res = $GLOBALS["db_api"]->dbh->query($stmt);
581 + if (PEAR::isError($res)) {
582 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
591 + * Get users issue order list
593 + * @param $user_id User
594 + * @param $order_list Order of the issues
597 + function getIssueOrderByUser($usr_id) {
599 + if (!is_numeric($usr_id)) {
604 + isu_iss_id, isu_order
606 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
608 + isu_usr_id = " . $usr_id ;
610 + $order_list = array();
612 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
614 + if (PEAR::isError($res)) {
615 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
618 + foreach ($res as $row) {
619 + $order_list[$row["isu_iss_id"]] = $row["isu_order"];
622 + return $order_list;
625 + function moveOrderForAllUsers($issue_id, $neworder)
627 + // Move the issue to the top priority for the ppl it's assigned to
628 + $stmt = "SELECT isu_usr_id FROM
629 + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user
631 + isu_iss_id = " . Misc::escapeInteger($issue_id);
632 + $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
633 + if (PEAR::isError($res)) {
634 + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
637 + foreach ($res as $row) {
638 + Issue::reorderUserIssues($row["isu_usr_id"], $issue_id, $neworder);
647 // benchmarking the included file (aka setup time)
649 $GLOBALS['bench']->setMarker('Included Issue Class');
650 --- eventum/include/class.misc.php 2008-10-15 01:46:20.000000000 +0300
651 +++ eventum-new/include/class.misc.php 2008-10-15 02:02:25.000000000 +0300
654 return self::$messages;
658 + * Parse url query string to php array
661 + * @link http://php.net/manual/en/function.parse-str.php#79154
662 + * @param string $str The url that will be exploded
663 + * @return array The variables from url
665 + function explode_url($str) {
667 + // Separate all name-value pairs
668 + $pairs = explode('&', $str);
669 + foreach($pairs as $pair) {
670 + // Pull out the names and the values
671 + list($name, $value) = explode('=', $pair, 2);
672 + // Decode the variable name and look for arrays
673 + list($name, $index) = split('[][]', urldecode($name));
675 + if(isset($index)) {
676 + // Declare or add to the global array defined by $name
677 + if(!isset($return[$name])) {
678 + $return[$name] = array();
680 + // Associative array
681 + if(strlen($index) > 0) {
682 + $return[$name][$index] = addslashes(urldecode($value));
685 + array_push($return[$name], addslashes(urldecode($value)));
689 + // Declare or overwrite the global variable defined by $name
690 + $return[$name] = addslashes(urldecode($value));
697 // benchmarking the included file (aka setup time)
698 --- eventum-r3749/js/global.js~ 2008-10-15 02:03:48.000000000 +0300
699 +++ eventum-r3749/js/global.js 2008-10-15 02:06:00.000000000 +0300
705 +$(document).ready(function() {
706 + // dialog type calender isn't working in Konqueror beacuse it's not a supported browser for either jQuery or jQuery UI
707 + // http://groups.google.com/group/jquery-ui/browse_thread/thread/ea61238c34cb5f33/046837b02fb90b5c
708 + if (navigator.appName != 'Konqueror') {
709 + $(".inline_date_pick").click(function() {
710 + var masterObj = this;
711 + var masterObjPos = $(masterObj).offset();
712 + // offset gives uses top and left but datepicker needs pageX and pageY
713 + var masterObjPos = {pageX: masterObjPos.left, pageY: masterObjPos.top};
714 + $(this).datepicker(
715 + // we use dialog type calender so we won't haveto have a hidden element on the page
718 + masterObj.innerHTML,
720 + function (date, dteObj) {
721 + fieldName = masterObj.id.substr(0,masterObj.id.indexOf('|'));
722 + issueID = masterObj.id.substr(masterObj.id.indexOf('|')+1);
723 + $.post("/ajax/update.php", {fieldName: fieldName, issueID: issueID, day: dteObj.selectedDay, month: (dteObj.selectedMonth+1), year: dteObj.selectedYear}, function(data) {
724 + if (data.length > 0) {
725 + masterObj.innerHTML = data;
730 + {dateFormat: 'dd M yy', duration: ""},
731 + // position of the datepicker calender - taken from div's offset
740 --- eventum/list.php 2008-10-15 01:46:20.000000000 +0300
741 +++ eventum-new/list.php 2008-10-15 02:02:25.000000000 +0300
743 $profile['sort_by'] . "&sort_order=" . $profile['sort_order']);
746 +@$reorder_usr_id = $_REQUEST["reorder_user"];
747 +@$reorder_issue_id = $_REQUEST["reorder_source"];
748 +@$reorder_neworder = $_REQUEST["reorder_neworder"];
749 +Issue::reorderUserIssues($reorder_usr_id, $reorder_issue_id, $reorder_neworder);
751 $options = Issue::saveSearchParams();
752 $tpl->assign("options", $options);
753 $tpl->assign("sorting", Issue::getSortingInfo($options));
756 $assign_options += $users;
758 +// get the isu_order (assignated users) ordering user
759 +if (!empty($options["users"])) {
760 + if ($options["users"] == -2) {
761 + $isu_order_user = $usr_id;
763 + if ($options["users"] > 0) {
764 + $isu_order_user = $options["users"];
766 + unset($isu_order_user);
769 + unset($isu_order_user);
771 +$tpl->assign("isu_order_user", $isu_order_user);
773 $list = Issue::getListing($prj_id, $options, $pagerRow, $rows);
774 $tpl->assign("list", $list["list"]);
775 $tpl->assign("list_info", $list["info"]);
776 --- eventum/templates/list.tpl.html 2008-10-15 01:46:20.000000000 +0300
777 +++ eventum-new/templates/list.tpl.html 2008-10-15 02:02:25.000000000 +0300
782 +function reorderBulk(order_user, neworder)
784 + url = page_url + "?";
785 + url += "reorder_user=" + order_user;
787 + items = document.getElementsByName("item[]");
789 + for (var i = 0; i < items.length; i++) {
790 + if (items[i].checked) {
791 + url += "&reorder_source[" + checkedcount + "]=" + items[i].value;
795 + if (checkedcount == 0) {
796 + alert('{/literal}{t escape=js}Please choose which issues to move to the new place.{/t}{literal}');
800 + url += "&reorder_neworder=" + neworder;
802 + window.location.href = url;
804 function hideClosed(f)
806 if (f.hide_closed.checked) {
808 f.go.disabled = true;
811 +function updateCustomFields(issue_id)
813 + var features = 'width=560,height=460,top=30,left=30,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no';
814 + var customWin = window.open('custom_fields.php?issue_id=' + issue_id, '_custom_fields', features);
821 @@ -166,11 +195,11 @@
822 <input type="hidden" name="cat" value="bulk_update">
825 - <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
827 + <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0" id="issue_list_table">
828 + <tr class="nodrag">
829 <td colspan="{$col_count}" class="default">
830 <table width="100%" cellspacing="0" cellpadding="0" border="0">
832 + <tr class="nodrag">
834 <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>
835 {include file="help_link.tpl.html" topic="list"}
840 - <tr bgcolor="{$cell_color}">
841 + <tr bgcolor="{$cell_color}" class="nodrag">
842 {if $current_role > $roles.developer}
844 <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');toggleBulkUpdate();">
846 {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}
850 + {elseif $field_name != 'isu_order' || $isu_order_user}
851 <td align="{$column.align|default:'center'}" class="default_white" nowrap {if $column.width != ''}width="{$column.width}"{/if}>
852 {if $field_name == 'iss_summary'}
853 <table cellspacing="0" cellpadding="1" width="100%">
856 {elseif $sorting.links[$field_name] != ''}
857 <a title="{t}sort by{/t} {$column.title}" href="{$sorting.links[$field_name]}" class="white_link">{$column.title}</a>
858 + {if $field_name == 'isu_order'}
859 + <br>{$users[$isu_order_user]}
861 {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}
864 @@ -229,19 +261,20 @@
869 {section name="i" loop=$list}
870 - <tr {if $current_role >= $roles.developer AND $list[i].iqu_status > 0}style="text-decoration: line-through;"{/if}>
871 + <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}>
872 {if $current_role > $roles.developer}
873 <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>
875 {foreach from=$columns item=column key=field_name}
876 {if $field_name == 'custom_fields'}
877 {foreach from=$list[i].custom_field key=fld_id item=fld_value}
878 - <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default">
879 - {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id}
880 + <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default custom_field" onclick="return updateCustomFields({$list[i].iss_id});">
881 + {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id}
885 + {elseif $field_name != 'isu_order' || $isu_order_user}
886 <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default">
887 {if $field_name == 'iss_id'}
888 <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_id}</a>
890 {elseif $field_name == 'iss_percent_complete'}
891 {$list[i].iss_percent_complete|escape:"html"}%
892 {elseif $field_name == 'iss_expected_resolution_date'}
893 - {$list[i].iss_expected_resolution_date|escape:"html"}
894 + <div class="inline_date_pick" id="expected_resolution_date|{$list[i].iss_id}">{$list[i].iss_expected_resolution_date|escape:"html"} </div>
895 {elseif $field_name == 'iss_summary'}
896 <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_summary|escape:"html"}</a>
897 {if $list[i].redeemed}
899 {if $list[i].iss_private == 1}
902 + {elseif $field_name == 'isu_order'}
903 + {if $list[i].assigned_users_order[$current_user_id]}
904 + <img src="{$rel_url}images/updown.gif" alt="move">
909 @@ -297,10 +334,11 @@
913 - <tr bgcolor="{$cell_color}">
915 + <tr bgcolor="{$cell_color}" class="nodrag">
916 <td colspan="{$col_count}">
917 <table width="100%" cellspacing="0" cellpadding="0">
919 + <tr class="nodrag">
920 <td width="30%" nowrap>
921 {if $current_role > $roles.developer}
922 <input type="button" value="{t}All{/t}" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');">
928 +<script type="text/javascript">
930 + * Order issues by drag and drop:
931 + * only if sorted by order and viewing your own issues
933 +{if $options.sort_by == "isu_order" and $current_user_id == $isu_order_user}
935 +var before = ''; // make it global variable
936 +$('#issue_list_table').tableDnD({
937 + onDragClass: "tDnD_whileDrag",
938 + onDragStart: function(table, row) {
939 + before = $.tableDnD.serialize('id');
941 + onDrop: function(table, row) {
942 + $.post("/ajax/order.php", {before: before, after: $.tableDnD.serialize('id')}, function(data) {
943 + if (data.length > 0) {
952 {include file="app_info.tpl.html"}
953 -{include file="footer.tpl.html"}
954 +{include file="footer.tpl.html"}
955 \ No newline at end of file