Merge lp:~raulraat/eventum/raul into lp:eventum

Proposed by Raul Raat
Status: Merged
Merged at revision: not available
Proposed branch: lp:~raulraat/eventum/raul
Merge into: lp:eventum
Diff against target: None lines
To merge this branch: bzr merge lp:~raulraat/eventum/raul
Reviewer Review Type Date Requested Status
Eventum Development Team Pending
Review via email: mp+11681@code.launchpad.net
To post a comment you must log in.
lp:~raulraat/eventum/raul updated
3904. By Bryan Alsdorf

Added links to list.php to search for issues from same reporter or customer

3905. By Bryan Alsdorf

Added ability for Custom Field backends to use ajax to get options.

3906. By Bryan Alsdorf

Merging changes

3907. By Elan Ruusamäe

- typo

3908. By Elan Ruusamäe

- avoid warnings if setup file is invalid

3909. By Elan Ruusamäe

- avoid recursive error when database connection fails

3910. By Elan Ruusamäe

- cosmetic

3911. By Elan Ruusamäe

- go to setup if config is empty

3912. By Elan Ruusamäe

- fix smarty and pear path

3913. By Elan Ruusamäe

- check also config files being writable

3914. By Elan Ruusamäe

- remove getRequestedURL (use real code instead)
- cosmetics, cleanups

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'htdocs/ajax'
2=== added file 'htdocs/ajax/update.php'
3--- htdocs/ajax/update.php 1970-01-01 00:00:00 +0000
4+++ htdocs/ajax/update.php 2009-09-02 15:30:58 +0000
5@@ -0,0 +1,83 @@
6+<?
7+/* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
8+// +----------------------------------------------------------------------+
9+// | Eventum - Issue Tracking System |
10+// +----------------------------------------------------------------------+
11+// | Copyright (c) 2003 - 2008 MySQL AB |
12+// | Copyright (c) 2008 - 2009 Sun Microsystem Inc. |
13+// | |
14+// | This program is free software; you can redistribute it and/or modify |
15+// | it under the terms of the GNU General Public License as published by |
16+// | the Free Software Foundation; either version 2 of the License, or |
17+// | (at your option) any later version. |
18+// | |
19+// | This program is distributed in the hope that it will be useful, |
20+// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22+// | GNU General Public License for more details. |
23+// | |
24+// | You should have received a copy of the GNU General Public License |
25+// | along with this program; if not, write to: |
26+// | |
27+// | Free Software Foundation, Inc. |
28+// | 59 Temple Place - Suite 330 |
29+// | Boston, MA 02111-1307, USA. |
30+// +----------------------------------------------------------------------+
31+// | Authors: Raul Raat <raul.raat@delfi.ee> |
32+// | Authors: Elan Ruusamäe <glen@delfi.ee> |
33+// +----------------------------------------------------------------------+
34+//
35+// @(#) $Id: update.php 3868 2009-03-30 00:22:35Z raul $
36+
37+require_once(dirname(__FILE__) . '/../../init.php');
38+require_once(APP_INC_PATH . "/class.auth.php");
39+require_once(APP_INC_PATH . "/class.issue.php");
40+
41+// check login
42+Auth::checkAuthentication(APP_COOKIE);
43+
44+// check if correct issue id was sent
45+if (!is_numeric($_POST['issue_id']) || !Issue::exists($_POST['issue_id'])) {
46+ exit;
47+}
48+
49+$usr_id = Auth::getUserID();
50+
51+// check if user role is above "Standard User"
52+if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID("Standard User")) {
53+ exit;
54+}
55+
56+// check if user can acess the issue
57+if (!Issue::canAccess($_POST['issue_id'], $usr_id)) {
58+ exit;
59+}
60+
61+switch ($_POST['field_name']) {
62+ case 'expected_resolution_date':
63+ $day = Misc::escapeInteger($_POST['day']);
64+ $month = Misc::escapeInteger($_POST['month']);
65+ $year = Misc::escapeInteger($_POST['year']);
66+
67+ if ($day == 0 && $month == 1 && $year == 0) {
68+ // clear button
69+ $date = null;
70+ } else {
71+ $date = sprintf('%04d-%02d-%02d', $year, $month, $day);
72+ }
73+
74+ if (Issue::setExpectedResolutionDate($_POST['issue_id'], $date) !== -1) {
75+ if (!is_null($date)) {
76+ echo Date_Helper::getSimpleDate($date, false);
77+ }
78+ } else {
79+ echo 'update failed';
80+ }
81+
82+ exit;
83+ break;
84+
85+ default:
86+ die('object type not supported');
87+ break;
88+}
89
90=== modified file 'htdocs/css/style.css'
91--- htdocs/css/style.css 2008-06-19 05:30:31 +0000
92+++ htdocs/css/style.css 2009-09-10 13:40:49 +0000
93@@ -172,4 +172,7 @@
94 font-size: 70%;
95 font-family: Verdana, Arial, Helvetica, sans-serif;
96 padding: 10px;
97-}
98\ No newline at end of file
99+}
100+.custom_field {
101+ cursor: pointer;
102+}
103
104=== modified file 'htdocs/js/global.js'
105--- htdocs/js/global.js 2008-10-28 18:23:04 +0000
106+++ htdocs/js/global.js 2009-09-02 16:03:27 +0000
107@@ -798,4 +798,53 @@
108 firstDay: user_prefs.week_firstday
109 });
110 });
111+
112+$(document).ready(function(){
113+ // dialog type calender isn't working in Konqueror beacuse it's not a supported browser by either jQuery or jQuery UI
114+ // http://groups.google.com/group/jquery-ui/browse_thread/thread/ea61238c34cb5f33/046837b02fb90b5c
115+ if (navigator.appName != 'Konqueror') {
116+ $(".inline_date_pick").click(function() {
117+
118+ var masterObj = this;
119+ var masterObjPos = $(masterObj).offset();
120+ // offset gives uses top and left but datepicker needs pageX and pageY
121+ var masterObjPos = {pageX:masterObjPos.left, pageY:masterObjPos.top};
122+
123+ // as i cannot find any documentation about ui.datepicker in dialog mode + blockUI, then i'll disable blockui while showing datepicker
124+ // i found in ui.datepicker when in dialog mode: "if ($.blockUI) $.blockUI(this.dpDiv);" so i assume the point was to show the calender in blockUI?
125+ var tmp_blockUI = $.blockUI;
126+ $.blockUI = false;
127+
128+ $(this).datepicker(
129+ // we use dialog type calender so we won't haveto have a hidden element on the page
130+ 'dialog',
131+ // selected date
132+ masterObj.innerHTML,
133+ // onclick handler
134+ function (date, dteObj) {
135+ var field_name = masterObj.id.substr(0,masterObj.id.indexOf('|'));
136+ var issue_id = masterObj.id.substr(masterObj.id.indexOf('|')+1);
137+ if (date == '') {
138+ // clear button
139+ dteObj.selectedDay = 0;
140+ dteObj.selectedMonth = 0;
141+ dteObj.selectedYear = 0;
142+ }
143+ $.post("/ajax/update.php", {field_name: field_name, issue_id: issue_id, day: dteObj.selectedDay, month: (dteObj.selectedMonth+1), year: dteObj.selectedYear}, function(data) {
144+ masterObj.innerHTML = data;
145+ }, "text");
146+ },
147+ // config
148+ {dateFormat: 'dd M yy', duration: "", firstDay: 1},
149+ // position of the datepicker calender - taken from div's offset
150+ masterObjPos
151+ );
152+
153+ // restore blockUI
154+ $.blockUI = tmp_blockUI;
155+
156+ return false;
157+ });
158+ }
159+});
160 //-->
161
162=== modified file 'lib/eventum/class.issue.php'
163--- lib/eventum/class.issue.php 2009-07-23 11:01:34 +0000
164+++ lib/eventum/class.issue.php 2009-09-02 15:29:20 +0000
165@@ -619,6 +619,62 @@
166 }
167 }
168
169+ /**
170+ * Method used to set the expected resolution date of an issue
171+ *
172+ * @access public
173+ * @param integer $issue_id The ID of the issue
174+ * @param string $expected_resolution_date The Expected Resolution Date to set this issue too
175+ * @return integer 1 if the update worked, -1 otherwise
176+ */
177+ function setExpectedResolutionDate($issue_id, $expected_resolution_date)
178+ {
179+ $issue_id = Misc::escapeInteger($issue_id);
180+ $expected_resolution_date = Misc::escapeString($expected_resolution_date);
181+ $current = self::getExpectedResolutionDate($issue_id);
182+ if ($expected_resolution_date != $current) {
183+ $sql = "UPDATE
184+ " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue
185+ SET
186+ iss_expected_resolution_date = " . (empty($expected_resolution_date) ? "null" : " '$expected_resolution_date'") . "
187+ WHERE
188+ iss_id = $issue_id";
189+ $res = DB_Helper::getInstance()->query($sql);
190+ if (PEAR::isError($res)) {
191+ Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
192+ return -1;
193+ } else {
194+ $usr_id = Auth::getUserID();
195+ Notification::notifyIssueUpdated($issue_id, array('iss_expected_resolution_date' => $current), array('expected_resolution_date' => $expected_resolution_date));
196+ History::add($issue_id, $usr_id, History::getTypeID('issue_updated'), "Issue updated (Expected Resolution Date: " . History::formatChanges($current, $expected_resolution_date) . ") by " . User::getFullName($usr_id));
197+ return 1;
198+ }
199+ }
200+ }
201+
202+ /**
203+ * Returns the current issue expected resolution date
204+ *
205+ * @access public
206+ * @param integer $issue_id The ID of the issue
207+ * @return string The Expected Resolution Date
208+ */
209+ function getExpectedResolutionDate($issue_id)
210+ {
211+ $sql = "SELECT
212+ iss_expected_resolution_date
213+ FROM
214+ " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue
215+ WHERE
216+ iss_id = " . Misc::escapeInteger($issue_id);
217+ $res = DB_Helper::getInstance()->getOne($sql);
218+ if (PEAR::isError($res)) {
219+ Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
220+ return 0;
221+ } else {
222+ return $res;
223+ }
224+ }
225
226 /**
227 * Method used to set the category of an issue
228
229=== modified file 'lib/eventum/class.notification.php'
230--- lib/eventum/class.notification.php 2009-06-27 16:26:21 +0000
231+++ lib/eventum/class.notification.php 2009-09-02 14:16:32 +0000
232@@ -610,11 +610,11 @@
233 @$diffs[] = '+' . ev_gettext('Assignment List') . ': ' . implode(', ', User::getFullName($new['assignments']));
234 }
235 }
236- if (@$old['iss_expected_resolution_date'] != $new['expected_resolution_date']) {
237+ if (isset($new['expected_resolution_date']) && @$old['iss_expected_resolution_date'] != $new['expected_resolution_date']) {
238 $diffs[] = '-' . ev_gettext('Expected Resolution Date') . ': ' . $old['iss_expected_resolution_date'];
239 $diffs[] = '+' . ev_gettext('Expected Resolution Date') . ': ' . $new['expected_resolution_date'];
240 }
241- if ($old["iss_prc_id"] != $new["category"]) {
242+ if (isset($new["category"]) && $old["iss_prc_id"] != $new["category"]) {
243 $diffs[] = '-' . ev_gettext('Category') . ': ' . Category::getTitle($old["iss_prc_id"]);
244 $diffs[] = '+' . ev_gettext('Category') . ': ' . Category::getTitle($new["category"]);
245 }
246@@ -622,27 +622,27 @@
247 $diffs[] = '-' . ev_gettext('Release') . ': ' . Release::getTitle($old["iss_pre_id"]);
248 $diffs[] = '+' . ev_gettext('Release') . ': ' . Release::getTitle($new["release"]);
249 }
250- if ($old["iss_pri_id"] != $new["priority"]) {
251+ if (isset($new["priority"]) && $old["iss_pri_id"] != $new["priority"]) {
252 $diffs[] = '-' . ev_gettext('Priority') . ': ' . Priority::getTitle($old["iss_pri_id"]);
253 $diffs[] = '+' . ev_gettext('Priority') . ': ' . Priority::getTitle($new["priority"]);
254 }
255- if ($old["iss_sta_id"] != $new["status"]) {
256+ if (isset($new["status"]) && $old["iss_sta_id"] != $new["status"]) {
257 $diffs[] = '-' . ev_gettext('Status') . ': ' . Status::getStatusTitle($old["iss_sta_id"]);
258 $diffs[] = '+' . ev_gettext('Status') . ': ' . Status::getStatusTitle($new["status"]);
259 }
260- if ($old["iss_res_id"] != $new["resolution"]) {
261+ if (isset($new["resolution"]) && $old["iss_res_id"] != $new["resolution"]) {
262 $diffs[] = '-' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($old["iss_res_id"]);
263 $diffs[] = '+' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($new["resolution"]);
264 }
265- if ($old["iss_dev_time"] != $new["estimated_dev_time"]) {
266+ if (isset($new["estimated_dev_time"]) && $old["iss_dev_time"] != $new["estimated_dev_time"]) {
267 $diffs[] = '-' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($old["iss_dev_time"]*60);
268 $diffs[] = '+' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($new["estimated_dev_time"]*60);
269 }
270- if ($old["iss_summary"] != $new["summary"]) {
271+ if (isset($new["summary"]) && $old["iss_summary"] != $new["summary"]) {
272 $diffs[] = '-' . ev_gettext('Summary') . ': ' . $old['iss_summary'];
273 $diffs[] = '+' . ev_gettext('Summary') . ': ' . $new['summary'];
274 }
275- if ($old["iss_description"] != $new["description"]) {
276+ if (isset($new["description"]) && $old["iss_description"] != $new["description"]) {
277 // need real diff engine here
278 require_once 'Text/Diff.php';
279 require_once 'Text/Diff/Renderer.php';
280
281=== modified file 'templates/list.tpl.html'
282--- templates/list.tpl.html 2009-06-26 11:45:06 +0000
283+++ templates/list.tpl.html 2009-09-10 13:40:49 +0000
284@@ -153,6 +153,13 @@
285 f.go.disabled = true;
286 }
287 }
288+function updateCustomFields(issue_id)
289+{
290+ var features = 'width=560,height=460,top=30,left=30,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no';
291+ var customWin = window.open('custom_fields.php?issue_id=' + issue_id, '_custom_fields', features);
292+ customWin.focus();
293+ return false;
294+}
295 //-->
296 </script>
297 {/literal}
298@@ -240,7 +247,7 @@
299 {foreach from=$columns item=column key=field_name}
300 {if $field_name == 'custom_fields'}
301 {foreach from=$list[i].custom_field key=fld_id item=fld_value}
302- <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default">
303+ <td bgcolor="{$list[i].status_color}" align="{$column.align|default:'center'}" class="default custom_field" onclick="return updateCustomFields({$list[i].iss_id});">
304 {$fld_value|formatCustomValue:$fld_id:$list[i].iss_id}
305 </td>
306 {/foreach}
307@@ -279,7 +286,7 @@
308 {elseif $field_name == 'iss_percent_complete'}
309 {$list[i].iss_percent_complete|escape:"html"}%
310 {elseif $field_name == 'iss_expected_resolution_date'}
311- {$list[i].iss_expected_resolution_date|escape:"html"}
312+ <div class="inline_date_pick" id="expected_resolution_date|{$list[i].iss_id}">{$list[i].iss_expected_resolution_date|escape:"html"}&nbsp;</div>
313 {elseif $field_name == 'iss_summary'}
314 <a href="view.php?id={$list[i].iss_id}" class="link" title="{t}view issue details{/t}">{$list[i].iss_summary|escape:"html"}</a>
315 {if $list[i].redeemed}

Subscribers

People subscribed via source and target branches