Merge lp:~andersdd/eventum/edit-reporter into lp:eventum
- edit-reporter
- Merge into trunk
Proposed by
Dave Anderson
Status: | Merged |
---|---|
Merged at revision: | 4454 |
Proposed branch: | lp:~andersdd/eventum/edit-reporter |
Merge into: | lp:eventum |
Diff against target: |
232 lines (+200/-0) 4 files modified
htdocs/edit_reporter.php (+48/-0) lib/eventum/class.edit_reporter.php (+72/-0) templates/edit_reporter.tpl.html (+73/-0) templates/view_form.tpl.html (+7/-0) |
To merge this branch: | bzr merge lp:~andersdd/eventum/edit-reporter |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Elan Ruusamäe | Needs Resubmitting | ||
Review via email:
|
Commit message
Description of the change
Adds a simple screen on the issue page for amending the reporter. This is useful for email created issues where the email address is unknown and the issue is created with the user "system" . The screen logs who made the change in the issue history.
To post a comment you must log in.
- 4452. By Elan Ruusamäe
-
scm/eventum-
cvs-hook: support CVS 1.11 and 1.12 formats (autodetected if configured correctly) (Elan Ruusamäe) - 4453. By Elan Ruusamäe
-
fix cronjobs erroneously report removed lock files. Fixes #904033
- 4454. By Elan Ruusamäe
-
Add a simple screen on the issue page for amending the reporter. (Elan Ruusamäe, Dave Anderson)
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Dave Anderson (andersdd) wrote : | # |
Thanks - missed that in testing. Have now fixed the problem as suggested.
Also added automatic addition of edited reporter to notification list
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'htdocs/edit_reporter.php' |
2 | --- htdocs/edit_reporter.php 1970-01-01 00:00:00 +0000 |
3 | +++ htdocs/edit_reporter.php 2011-12-14 10:15:29 +0000 |
4 | @@ -0,0 +1,48 @@ |
5 | +<?php |
6 | +/* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */ |
7 | +// +----------------------------------------------------------------------+ |
8 | +// | Eventum - Issue Tracking System | |
9 | +// +----------------------------------------------------------------------+ |
10 | +// | Copyright (c) 2003 - 2008 MySQL AB | |
11 | +// | Copyright (c) 2008 - 2010 Sun Microsystem Inc. | |
12 | +// | | |
13 | +// | This program is free software; you can redistribute it and/or modify | |
14 | +// | it under the terms of the GNU General Public License as published by | |
15 | +// | the Free Software Foundation; either version 2 of the License, or | |
16 | +// | (at your option) any later version. | |
17 | +// | | |
18 | +// | This program is distributed in the hope that it will be useful, | |
19 | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | +// | GNU General Public License for more details. | |
22 | +// | | |
23 | +// | You should have received a copy of the GNU General Public License | |
24 | +// | along with this program; if not, write to: | |
25 | +// | | |
26 | +// | Free Software Foundation, Inc. | |
27 | +// | 59 Temple Place - Suite 330 | |
28 | +// | Boston, MA 02111-1307, USA. | |
29 | +// +----------------------------------------------------------------------+ |
30 | +// | Authors: Bryan Alsdorf <bryan@mysql.com> | |
31 | +// +----------------------------------------------------------------------+ |
32 | + |
33 | +require_once dirname(__FILE__) . '/../init.php'; |
34 | + |
35 | +$tpl = new Template_Helper(); |
36 | +$tpl->setTemplate("edit_reporter.tpl.html"); |
37 | + |
38 | +Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); |
39 | + |
40 | +$prj_id = Auth::getCurrentProject(); |
41 | +$issue_id = @$_POST["issue_id"] ? $_POST["issue_id"] : $_GET["iss_id"]; |
42 | +$tpl->assign("issue_id", $issue_id); |
43 | + |
44 | +if (@$_POST["cat"] == "update") { |
45 | + $res = Edit_Reporter::update($issue_id, $_POST['email']); |
46 | + $tpl->assign("insert_result", $res); |
47 | +} |
48 | + |
49 | +$t = Project::getAddressBook($prj_id, $issue_id); |
50 | +$tpl->assign("allowed_reporters", $t); |
51 | + |
52 | +$tpl->displayTemplate(); |
53 | |
54 | === added file 'lib/eventum/class.edit_reporter.php' |
55 | --- lib/eventum/class.edit_reporter.php 1970-01-01 00:00:00 +0000 |
56 | +++ lib/eventum/class.edit_reporter.php 2011-12-14 10:15:29 +0000 |
57 | @@ -0,0 +1,72 @@ |
58 | +<?php |
59 | +/* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */ |
60 | +// +----------------------------------------------------------------------+ |
61 | +// | Eventum - Issue Tracking System | |
62 | +// +----------------------------------------------------------------------+ |
63 | +// | Copyright (c) 2003 - 2008 MySQL AB | |
64 | +// | Copyright (c) 2008 - 2010 Sun Microsystem Inc. | |
65 | +// | Copyright (c) 2011 - 2011 Anderson.net New Zealand | |
66 | +// | | |
67 | +// | This program is free software; you can redistribute it and/or modify | |
68 | +// | it under the terms of the GNU General Public License as published by | |
69 | +// | the Free Software Foundation; either version 2 of the License, or | |
70 | +// | (at your option) any later version. | |
71 | +// | | |
72 | +// | This program is distributed in the hope that it will be useful, | |
73 | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
74 | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
75 | +// | GNU General Public License for more details. | |
76 | +// | | |
77 | +// | You should have received a copy of the GNU General Public License | |
78 | +// | along with this program; if not, write to: | |
79 | +// | | |
80 | +// | Free Software Foundation, Inc. | |
81 | +// | 59 Temple Place - Suite 330 | |
82 | +// | Boston, MA 02111-1307, USA. | |
83 | +// +----------------------------------------------------------------------+ |
84 | +// | Authors: Dave Anderson (dave@anderson.net.nz) | |
85 | +// +----------------------------------------------------------------------+ |
86 | + |
87 | + |
88 | +/** |
89 | + * Class designed to handle adding, removing and viewing authorized repliers for an issue. |
90 | + * |
91 | + * @author Dave Anderson (dave@anderson.net.nz) |
92 | + */ |
93 | +class Edit_Reporter |
94 | +{ |
95 | + /** |
96 | + * Modifies an Issue's Reporter. |
97 | + * |
98 | + * @access public |
99 | + * @param integer $issue_id The id of the issue. |
100 | + * @param string $fullname The id of the user. |
101 | + * @param boolean $add_history If this should be logged. |
102 | + */ |
103 | + function update($issue_id, $email, $add_history = true) |
104 | + { |
105 | + |
106 | + $email = strtolower(Mail_Helper::getEmailAddress($email)); |
107 | + $usr_id = User::getUserIDByEmail($email, true); |
108 | + |
109 | + $sql = "UPDATE |
110 | + " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue |
111 | + SET |
112 | + iss_usr_id = " . Misc::escapeInteger($usr_id) . " |
113 | + WHERE |
114 | + iss_id = " . Misc::escapeInteger($issue_id); |
115 | + $res = DB_Helper::getInstance()->query($sql); |
116 | + if (PEAR::isError($res)) { |
117 | + Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); |
118 | + return -1; |
119 | + } else { |
120 | + if ($add_history) { |
121 | + // add the change to the history of the issue |
122 | + $summary = 'Reporter was changed to ' . $email . ' by ' . User::getFullName(Auth::getUserID()); |
123 | + History::add($issue_id, Auth::getUserID(), History::getTypeID('issue_updated'), $summary); |
124 | + } |
125 | + } |
126 | + return 1; |
127 | + } |
128 | + |
129 | +} |
130 | |
131 | === added file 'templates/edit_reporter.tpl.html' |
132 | --- templates/edit_reporter.tpl.html 1970-01-01 00:00:00 +0000 |
133 | +++ templates/edit_reporter.tpl.html 2011-12-14 10:15:29 +0000 |
134 | @@ -0,0 +1,73 @@ |
135 | +{include file="header.tpl.html"} |
136 | + |
137 | +<br /> |
138 | + |
139 | +{literal} |
140 | +<script type="text/javascript"> |
141 | +<!-- |
142 | +function validate(f) |
143 | +{ |
144 | + if (isWhitespace(f.email.value)) { |
145 | + alert('{/literal}{t escape=js}Please enter a valid email address.{/t}{literal}'); |
146 | + selectField(f, 'email'); |
147 | + return false; |
148 | + } |
149 | + return true; |
150 | +} |
151 | +//--> |
152 | +</script> |
153 | +{/literal} |
154 | +<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> |
155 | +<script type="text/javascript" src="{$rel_url}js/overlib_mini.js?c=d23a"></script> |
156 | +<table width="100%" bgcolor="{$cell_color}" border="0" cellspacing="0" cellpadding="1" align="center"> |
157 | + <tr> |
158 | + <td> |
159 | + <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2"> |
160 | + <form name="reporter_form" onSubmit="javascript:return validate(this);" method="post" action="{$smarty.server.PHP_SELF}"> |
161 | + <input type="hidden" name="cat" value="update"> |
162 | + <input type="hidden" name="id" value="{$smarty.get.id}"> |
163 | + <input type="hidden" name="issue_id" value="{$issue_id}"> |
164 | + {if $current_role > $roles.reporter} |
165 | + <tr> |
166 | + <td colspan="2" class="default"> |
167 | + <b>{t}Project Reporters{/t}</b> |
168 | + </td> |
169 | + </tr> |
170 | + {if $insert_result != ""} |
171 | + <tr> |
172 | + <td colspan="2" bgcolor="{$cell_color}" align="center" class="error"> |
173 | + {if $insert_result == -1} |
174 | + {t}An error occurred while trying to update the Reporter.{/t} |
175 | + {elseif $insert_result == 1} |
176 | + {t}Thank you, the Reporter was updated successfully.{/t} |
177 | + {/if} |
178 | + </td> |
179 | + </tr> |
180 | + {/if} |
181 | + <tr> |
182 | + <td width="120" bgcolor="{$cell_color}" class="default_white"> |
183 | + <b>{t}Reporter{/t}:</b> |
184 | + </td> |
185 | + <td bgcolor="{$light_color}"> |
186 | + <input type="text" name="email" size="40" class="default" value="{$info.sub_email}"> |
187 | + {if not ($os.mac and $browser.ie)}<a href="javascript:void(null);" onClick="return overlib(getFillInput('{include file="lookup_layer.tpl.html" list=$allowed_reporters}', 'reporter_form', 'email'), STICKY, HEIGHT, 50, WIDTH, 160, BELOW, LEFT, CLOSECOLOR, '#FFFFFF', FGCOLOR, '#FFFFFF', BGCOLOR, '#333333', CAPTION, 'Lookup Details', CLOSECLICK);" onMouseOut="javascript:nd();"><img src="{$rel_url}images/lookup.gif" border="0"></a>{/if} |
188 | + {include file="error_icon.tpl.html" field="email"} |
189 | + </td> |
190 | + </tr> |
191 | + <tr> |
192 | + <td colspan="2" bgcolor="{$cell_color}" align="center"> |
193 | + <input class="button" type="submit" value="{t}Save Reporter{/t}"> |
194 | + <input type="button" value="{t}Cancel{/t}" class="button" onClick="javascript:closeAndRefresh();"> |
195 | + </td> |
196 | + </tr> |
197 | + </form> |
198 | + {/if} |
199 | + </table> |
200 | + </td> |
201 | + </tr> |
202 | +</table> |
203 | + |
204 | +<br /> |
205 | + |
206 | +{include file="app_info.tpl.html"} |
207 | +{include file="footer.tpl.html"} |
208 | |
209 | === modified file 'templates/view_form.tpl.html' |
210 | --- templates/view_form.tpl.html 2011-10-08 07:56:29 +0000 |
211 | +++ templates/view_form.tpl.html 2011-12-14 10:15:29 +0000 |
212 | @@ -27,6 +27,12 @@ |
213 | var popupWin = window.open('authorized_replier.php?iss_id=' + issue_id, '_replier', features); |
214 | popupWin.focus(); |
215 | } |
216 | +function openReporter(issue_id) |
217 | +{ |
218 | + var features = 'width=440,height=400,top=30,left=30,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no'; |
219 | + var popupWin = window.open('edit_reporter.php?iss_id=' + issue_id, '_reporter', features); |
220 | + popupWin.focus(); |
221 | +} |
222 | function signupAsAuthorizedReplier(issue_id) |
223 | { |
224 | var features = 'width=420,height=400,top=30,left=30,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no'; |
225 | @@ -188,6 +194,7 @@ |
226 | </td> |
227 | <td colspan="2" align="right" class="default"> |
228 | {if $current_role > $roles.customer} |
229 | + [ <a class="link" title="{t}Edit the Reporter for this issue{/t}" href="javascript:void(null);" onClick="javascript:openReporter({$smarty.get.id});">{t}Edit Reporter{/t}</a> ] |
230 | [ <a class="link" title="{t}edit the authorized repliers list for this issue{/t}" href="javascript:void(null);" onClick="openAuthorizedReplier({$smarty.get.id|intval});">{t}Edit Authorized Replier List{/t}</a> ] |
231 | [ <a class="link" title="{t}edit the notification list for this issue{/t}" href="javascript:void(null);" onClick="openNotification({$smarty.get.id|intval});">{t}Edit Notification List{/t}</a> ] |
232 | {/if} |
this has a little problem, when saving reporter to email which does not have account in system, it displays the reporter area as blank.
it should keep eventum system account in such cases