Closed
Bug 329415
Opened 19 years ago
Closed 19 years ago
trying to remove exceptions in recurrencedialog with no exceptions selected throws JS-errors
Categories
(Calendar :: Sunbird Only, defect)
Calendar
Sunbird Only
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: robin.edrenius, Assigned: robin.edrenius)
References
Details
Attachments
(1 file, 4 obsolete files)
3.01 KB,
patch
|
jminta
:
first-review+
|
Details | Diff | Splinter Review |
If no exception in the recurrenc-edialog is selected and you press 'remove exceptions', you get a JS error:
Error: item has no properties
Source File: chrome://calendar/content/calendar-recurrence-dialog.js
Line: 357
Assignee | ||
Comment 1•19 years ago
|
||
This should remove the JS-errors.
We should probably disable the button when no exceptions is selected as well.
Attachment #214083 -
Flags: first-review?(jminta)
Assignee | ||
Comment 2•19 years ago
|
||
This patch disables the 'remove exceptions-button' if no exception is selected.
Should the if-block from the previous patch be removed now? Since the button can't be pressed when no exception is selected with this patch.
Attachment #214083 -
Attachment is obsolete: true
Attachment #214084 -
Flags: first-review?(jminta)
Attachment #214083 -
Flags: first-review?(jminta)
Assignee | ||
Comment 3•19 years ago
|
||
Fixes a whitespace change in the previous patch, sorry for the bugspam.
Attachment #214084 -
Attachment is obsolete: true
Attachment #214085 -
Flags: first-review?(jminta)
Attachment #214084 -
Flags: first-review?(jminta)
Comment 4•19 years ago
|
||
Comment on attachment 214085 [details] [diff] [review]
This patch deals with disabling the button, v2
self.focus();
+ checkSelectedException();
Focusing should almost always be the last call. Move this up a bit.
+ if (item) {
+
+ var addedRecently = false;
+ for (var ii in window.addedExceptions) {
The whole point of this patch is to make it so this function is never reached if 'item' would be null, so your suspicion that this is not needed is correct.
+ var item = exceptionList.selectedItem;
+ if(!item) {
+ document.getElementById("remove-exceptions-button").setAttribute("disabled", "true");
+ }
+ if(item) {
+ document.getElementById("remove-exceptions-button").removeAttribute("disabled");
+ }
The indenting here looks weird. Also, this looks like the classic strucutre for if/else, not if/if.
+}
\ No newline at end of file
Oops, can you fix that warning?
onclick="checkSelectedException()"
What's the reason for doing onclick as well? In theory, onselect ought to be the only case we care about, since we're basing our enable/disable on the selection.
Attachment #214085 -
Flags: first-review?(jminta) → first-review-
Assignee | ||
Comment 5•19 years ago
|
||
(In reply to comment #4)
> self.focus();
> + checkSelectedException();
> Focusing should almost always be the last call. Move this up a bit.
>
Fixed.
>
> + var item = exceptionList.selectedItem;
> + if(!item) {
> +
> document.getElementById("remove-exceptions-button").setAttribute("disabled",
> "true");
> + }
> + if(item) {
> +
> document.getElementById("remove-exceptions-button").removeAttribute("disabled");
> + }
> The indenting here looks weird. Also, this looks like the classic strucutre
> for if/else, not if/if.
>
Fixed the indenting and changed to if/else.
> +}
> \ No newline at end of file
> Oops, can you fix that warning?
>
Doh! Fixed =)
> onclick="checkSelectedException()"
> What's the reason for doing onclick as well? In theory, onselect ought to be
> the only case we care about, since we're basing our enable/disable on the
> selection.
>
I was under the impression that it was possible to deselect the items in the listbox by clicking in an empty area of the listbox, however, that was not the case. onclick removed.
Attachment #214085 -
Attachment is obsolete: true
Attachment #214313 -
Flags: first-review?(jminta)
Comment 6•19 years ago
|
||
(In reply to comment #5)
>
> >
> > + var item = exceptionList.selectedItem;
> > + if(!item) {
> > +
> > document.getElementById("remove-exceptions-button").setAttribute("disabled",
> > "true");
> > + }
> > + if(item) {
> > +
> > document.getElementById("remove-exceptions-button").removeAttribute("disabled");
> > + }
> > The indenting here looks weird. Also, this looks like the classic strucutre
> > for if/else, not if/if.
> >
>
> Fixed the indenting and changed to if/else.
>
Looks to me like the if/else change didn't make it.
Assignee | ||
Comment 7•19 years ago
|
||
(In reply to comment #6)
> Looks to me like the if/else change didn't make it.
>
Hmm...I must have updated the wrong tree or something.
However, here is an updated version!
Attachment #214313 -
Attachment is obsolete: true
Attachment #214555 -
Flags: first-review?(jminta)
Attachment #214313 -
Flags: first-review?(jminta)
Comment 8•19 years ago
|
||
Comment on attachment 214555 [details] [diff] [review]
Patch v4
+ var item = exceptionList.selectedItem;
+ if(!item) {
+ document.getElementById("remove-exceptions-button").setAttribute("disabled", "true");
+ }
+ else {
+ document.getElementById("remove-exceptions-button").removeAttribute("disabled");
+ }
Nit: if (foo) is proper style, with a space between the f and the (
Nit: else goes on the same line as }
- <listbox id="recurrence-exceptions-listbox" rows="8" flex="1"/>
+ <listbox id="recurrence-exceptions-listbox" rows="8" flex="1" onselect="checkSelectedException()"/>
<vbox align="top">
<datepicker id="exdate-picker"/>
<button label="&newevent.addexceptions.label;" oncommand="addException()"/>
- <button label="&newevent.recurrence.remove.label;" oncommand="removeSelectedException();"/>
+ <button label="&newevent.recurrence.remove.label;" id="remove-exceptions-button" oncommand="removeSelectedException();"/>
Nit: wrap lines longer than 80chars.
Everything else looks great! r=jminta with the nits picked.
Attachment #214555 -
Flags: first-review?(jminta) → first-review+
Updated•19 years ago
|
Blocks: sunbird-0.3a2
Comment 9•19 years ago
|
||
Thanks for the work on this! patch checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•