Merge lp:~samstoll1/tiqit/rollback into lp:tiqit

Proposed by Sam Stoll
Status: Needs review
Proposed branch: lp:~samstoll1/tiqit/rollback
Merge into: lp:tiqit
Diff against target: 589 lines (+81/-155)
4 files modified
changelog (+15/-0)
scripts/actions/edit.py (+0/-49)
scripts/pages/view.py (+21/-21)
static/scripts/view.js (+45/-85)
To merge this branch: bzr merge lp:~samstoll1/tiqit/rollback
Reviewer Review Type Date Requested Status
Matthew Earl Pending
Review via email: mp+283108@code.launchpad.net

Description of the change

Reverting buggy changes to allow editing different bug sections at the same time.

To post a comment you must log in.

Unmerged revisions

11. By Sam Stoll <email address hidden>

Rolling back changes to enable editting notes and bug fields together, as it's buggy!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'changelog'
2--- changelog 2014-11-10 14:11:37 +0000
3+++ changelog 2016-01-19 12:41:51 +0000
4@@ -1,3 +1,18 @@
5+tiqit (1.0.2-1) trusty; urgency=low
6+ * Fix for draggable tables scrolling bug
7+ * Back out changes in previous release relating to submitting notes and
8+ field changes together, as this is buggy.
9+
10+ -- Sam Stoll <samstoll1@gmail.com> Tue, 19 Jan 2016 12:36:27 +0000
11+
12+tiqit (1.0.1-1) trusty; urgency=low
13+ * Draggable tables
14+ * Submit notes and bug field changes together
15+ * Enabling double click to edit preference
16+ * Misc fixes
17+
18+ -- Sam Stoll <samstoll1@gmail.com> Mon, 18 Jan 2016 16:36:27 +0000
19+
20 tiqit (1.0.0-1) precise; urgency=low
21 * Initial release of tiqit.
22
23
24=== modified file 'scripts/actions/edit.py'
25--- scripts/actions/edit.py 2015-12-22 15:22:57 +0000
26+++ scripts/actions/edit.py 2016-01-19 12:41:51 +0000
27@@ -1,7 +1,6 @@
28 #! /usr/bin/python
29
30 import time
31-import os
32 from backend import *
33 from tiqit import *
34 from frontend import *
35@@ -22,54 +21,6 @@
36 if realupdate > lastupdate:
37 raise TiqitWarning("The bug has been edited since you loaded the page. Saving would have overwritten any changes made in between time. Go back to the bug and reload the page to see what fields have been modified (pressing 'Back' and then 'F5' should result in no loss of your own changes - the other modifications will simply appear in blue, alongside your own changes. You may then confirm or revert the changes, as desired).")
38
39-
40-#
41-# Edit note
42-#
43-if args.has_key('tiqitAttachmentAddNote'):
44- if not args.has_key('tiqitAttachmentDeleteTitle'):
45- if len(args['tiqitAttachmentNoteContent']) > 16 * 1024 and args.has_key('tiqitAttachmentIsUpdate'):
46- raise TiqitError("Note too large. Must be less than 16kb. Use Attachements instead. Your note is %d bytes long" % len(args['tiqitAttachmentNoteContent']))
47-
48- noteType = args['tiqitAttachmentNoteType']
49- noteTitle = args['tiqitAttachmentNoteTitle'].strip()
50- newTitle = args['tiqitAttachmentNewNoteTitle'].strip()
51- deleteTitle = args['tiqitAttachmentDeleteTitle'].strip()
52-
53- # If this is a delete, then delete it
54- if args.has_key('tiqitAttachmentDeleteTitle'):
55- deleteNote(bugid, args['tiqitAttachmentDeleteTitle'].strip())
56- else:
57-
58- # Try to rename the note if required first
59- if newTitle and newTitle != noteTitle:
60- renameNote(bugid, noteType, noteTitle, newTitle)
61-
62- # Save the new name for the next step
63- noteTitle = newTitle
64-
65- # Now update/create the note
66- if len(args['tiqitAttachmentNoteContent']) > 0:
67- addNote(bugid, noteType, noteTitle, args['tiqitAttachmentNoteContent'], args.has_key('tiqitAttachmentIsUpdate'))
68-
69-#
70-# Addfile
71-#
72-if args.has_key('tiqitAttachmentAddFile'):
73- if args.has_key('tiqitAttachmentDeleteTitle'):
74- deleteAttachment(bugid, args['tiqitAttachmentDeleteTitle'])
75- elif args.has_key('tiqitAttachmentRenameTitle'):
76- renameAttachment(bugid, args['tiqitAttachmentRenameTitle'], args['tiqitAttachmentNewTitle'])
77- else:
78- filename = args.writeToTempFile('theFile')
79- try:
80- addAttachment(bugid, args['tiqitAttachmentFileTitle'], filename)
81- finally:
82- #
83- # In any case, delete the file!
84- #
85- os.unlink(filename)
86-
87 #
88 # What type of bug is this
89 #
90
91=== modified file 'scripts/pages/view.py'
92--- scripts/pages/view.py 2016-01-18 16:12:33 +0000
93+++ scripts/pages/view.py 2016-01-19 12:41:51 +0000
94@@ -110,7 +110,7 @@
95 <td><a onclick='showUserDropDown(event);'>%(Updater)s</a></td>
96 <td>%(Date)s</td><td>%(Size)s</td>
97 <td>
98- <input type='button' onclick='renameAttachment(this);' value='Rename'><input style='display: none;' type='button' onclick='if (prepareForm()) document.getElementById("tiqitBugEdit").submit();' value='Save'><input style='display: none;' type='button' onclick='cancelAttachmentRename(this);' value='Cancel'><input type='button' onclick='deleteAttachment(this);' value='Delete'><a href='%(Url)s'>Link</a>
99+ <input type='button' onclick='renameAttachment(this);' value='Rename'><input style='display: none;' type='button' onclick='saveAttachmentRename(this);' value='Save'><input style='display: none;' type='button' onclick='cancelAttachmentRename(this);' value='Cancel'><input type='button' onclick='deleteAttachment(this);' value='Delete'><a href='%(Url)s'>Link</a>
100 </td>
101 </tr>
102 <tr class='file' style='display: none;'>
103@@ -189,8 +189,6 @@
104
105 printMessages()
106
107- # Make the whole page a single form
108- print "<form id='tiqitBugEdit' action='edit.py' method='post' onSubmit='return prepareForm();' enctype='multipart/form-data'>"
109 # Other links section
110 print """ <div id='tiqitOtherLinks'>"""
111
112@@ -217,8 +215,6 @@
113 for pos, (name, func) in sections:
114 func(getattr(prefs, 'display%s' % name) == 'remove')
115
116- print "</form>"
117- print "<div id='extraCopies'></div>"
118 printPageFooter()
119
120 view_sections = bugView.getViewBugSections(theDom)
121@@ -227,33 +223,32 @@
122 primarytitle, primarytitleDetail, primaryformat = view_sections[0]
123 printSectionHeader(primarytitle, primarytitleDetail, hide);
124
125+ print "<form id='tiqitBugEdit' action='edit.py' method='post' onSubmit='return prepareForm();'>"
126 print cls.getFormat(primaryformat) % args
127
128 print """
129+<div id='extraCopies'></div>
130 <p>
131 <input type='submit' value='Save Changes'>
132 <input type='button' value='Reset Form' onclick='this.form.reset(); checkChildren(); checkFormValidity();'>
133- <input type='button' onclick='if ((!amEditing && !amEditingNote && !amEditingFile) || confirm("You&apos;ve made changes to this bug. Cloning it will throw them away. Are you sure you want to continue?")) document.location = "newbug.py?bugid=%(Identifier)s";' value='Clone Bug'>
134-</p>""" % args
135+ <input type='button' onclick='if (!amEditing || confirm("You&apos;ve made changes to this bug. Cloning it will throw them away. Are you sure you want to continue?")) document.location = "newbug.py?bugid=%(Identifier)s";' value='Clone Bug'>
136+</p>
137+</form>""" % args
138
139 printSectionFooter()
140
141 def displayExtra(hide=False):
142- print "<div id='tiqitExtraFormData'>"
143+ print "<form onsubmit='return false;' id='tiqitExtraFormData'>"
144 for title, titleDetail, format in view_sections[1:]:
145 printSectionHeader(title, titleDetail, hide)
146 print cls.getFormat(format) % args
147 print """
148
149-<p>
150-<input type='button' value='Save Changes' onClick='if (prepareForm()) document.getElementById("tiqitBugEdit").submit();'>
151-<input type='button' value='Reset Form' onclick='this.form.reset(); checkChildren(); checkFormValidity();'>
152-</p>
153-
154+<p><input type='button' value='Save Changes' onClick='if (prepareForm()) document.getElementById("tiqitBugEdit").submit();'></p>
155 """
156
157 printSectionFooter()
158- print "</div>"
159+ print "</form>"
160 #
161 # Text Notes and File Attachments are printed in the same section.
162 #
163@@ -275,8 +270,9 @@
164 print "<p>No Enclosures or Attachments.</p>"
165 else:
166 print """
167+ <form action='editnote.py' method='post'>
168 <input type='hidden' name='bugid' value='%s'>
169- <input type='hidden' name='tiqitAttachmentIsUpdate' value='true'>
170+ <input type='hidden' name='isUpdate' value='true'>
171 <div id='encTableContainer'>
172 <table id='encTable' class='tiqitTable' style='width: 90%%'>
173 <tr>
174@@ -302,30 +298,33 @@
175 </p>
176 <div id='newnote' class='note' style='display: none;'>
177 <p>Add new Enclosure:</p>
178+ <form action='editnote.py' method='post'>
179 <input type='hidden' name='bugid' value='%s'>
180 <table>
181 <tr>
182 <td>Type: </td>
183- <td><select id='newnotetype' name='tiqitAttachmentNoteType' onchange='newNoteTitle(this);'>%s</select></td>
184+ <td><select id='newnotetype' name='noteType' onchange='newNoteTitle(this);'>%s</select></td>
185 <td>Title: </td>
186- <td><input name='tiqitAttachmentNoteTitle' id='newnotetitle' type='text' size='50' value='%s'></td>
187+ <td><input name='noteTitle' id='newnotetitle' type='text' size='50' value='%s'></td>
188 </tr>
189 <tr>
190 <td colspan='4'>
191- <textarea id='newnotecontent' name='tiqitAttachmentNoteContent' style='width: 100%%' rows='18'></textarea>
192+ <textarea id='newnotecontent' name='noteContent' style='width: 100%%' rows='18'></textarea>
193 </td>
194 </tr>
195 </table>
196 <p>
197- <input type='button' onclick='if (prepareForm()) document.getElementById("tiqitBugEdit").submit();' value='Save'>
198+ <input type='submit' value='Save'>
199 <input type='button' onclick='hideNewNote();' value='Cancel'>
200 </p>
201+ </form>
202 </div>
203 <div id='newfile' class='note' style='display: none;'>
204 <p>Attach new File:</p>
205+ <form action='addfile.py' method='post' enctype='multipart/form-data'>
206 <input type='hidden' name='bugid' value='%s'>
207 <p>
208- Title: <input name='tiqitAttachmentFileTitle' type='text' size='50'>
209+ Title: <input name='fileTitle' type='text' size='50'>
210 <!--
211 Type: <select name='fileType'>
212 <option value='Auto'>Auto</option>
213@@ -335,9 +334,10 @@
214 <input type='file' name='theFile' size='30'>
215 </p>
216 <p>
217- <input type='button' onclick='if (prepareForm()) document.getElementById("tiqitBugEdit").submit();' value='Save'>
218+ <input type='submit' value='Save'>
219 <input type='button' onclick='hideNewFile();' value='Cancel'>
220 </p>
221+ </form>
222 </div>
223 """ % (bugid, "".join(["<option value='%s'>%s</option>" % (x, x) for x in noteTypes]), noteTypes[0], bugid)
224
225
226=== modified file 'static/scripts/view.js'
227--- static/scripts/view.js 2015-12-22 15:22:57 +0000
228+++ static/scripts/view.js 2016-01-19 12:41:51 +0000
229@@ -79,8 +79,6 @@
230
231 // The object currently being edited.
232 var amEditing = null;
233-var amEditingNote = null;
234-var amEditingFile = null;
235
236 var editMsg = "You have already changed another section of this bug.\nYou may only edit one section at a time.\n\nPlease save those changes, or undo them, then try again."
237
238@@ -88,7 +86,7 @@
239 function makeNoteTypeSelect() {
240 var opt;
241 var newS = document.createElement('select');
242- newS.setAttribute('name', 'tiqitAttachmentNoteType')
243+ newS.setAttribute('name', 'noteType')
244
245 for (i in noteTypes) {
246 opt = document.createElement('option');
247@@ -122,13 +120,13 @@
248 img.alt = '[+]';
249 img.title = 'Show Enclosure';
250
251- if (amEditingNote == row) {
252+ if (amEditing == row) {
253 cancelEnclosureEdit(row.cells[6].getElementsByTagName('input')[0]);
254 }
255 }
256
257 function editEnclosure(button) {
258- if (amEditingNote) {
259+ if (amEditing) {
260 alert(editMsg);
261 return;
262 }
263@@ -140,7 +138,7 @@
264
265 // Text box
266 var textBox = document.createElement('textarea');
267- textBox.setAttribute('name', 'tiqitAttachmentNoteContent');
268+ textBox.setAttribute('name', 'noteContent');
269 textBox.setAttribute('rows', 20);
270
271 var pre = table.rows[row.rowIndex + 1].cells[0].firstChild;
272@@ -152,7 +150,7 @@
273
274 // Type select
275 var types = makeNoteTypeSelect();
276- types.setAttribute('name', 'tiqitAttachmentNoteType');
277+ types.setAttribute('name', 'noteType');
278 types.value = row.cells[1].textContent.substring(1, row.cells[1].textContent.lastIndexOf("'"));
279 types.defaultValue = types.value;
280
281@@ -161,13 +159,13 @@
282 // Note title
283 // First save old one
284 var oldTitle = document.createElement('input');
285- oldTitle.setAttribute('name', 'tiqitAttachmentNoteTitle');
286+ oldTitle.setAttribute('name', 'noteTitle');
287 oldTitle.setAttribute('type', 'hidden');
288 oldTitle.setAttribute('value', row.cells[0].lastChild.textContent);
289 row.cells[2].appendChild(oldTitle);
290
291 var title = document.createElement('input');
292- title.setAttribute('name', 'tiqitAttachmentNewNoteTitle');
293+ title.setAttribute('name', 'newNoteTitle');
294 title.setAttribute('type', 'text');
295 title.setAttribute('value', row.cells[0].lastChild.textContent.trim());
296 title.setAttribute('size', 40);
297@@ -179,7 +177,7 @@
298 button.nextSibling.nextSibling.nextSibling.style.display = 'none';
299 button.style.display = 'none';
300
301- amEditingNote = row;
302+ amEditing = row;
303 }
304
305 function cancelEnclosureEdit(button) {
306@@ -187,7 +185,7 @@
307 var row = button.parentNode.parentNode;
308 var table = row.parentNode.parentNode;
309
310- if (amEditingNote != row) {
311+ if (amEditing != row) {
312 alert("How did you manage to cancel an edit you weren't performing?");
313 return;
314 }
315@@ -214,11 +212,11 @@
316 button.nextSibling.nextSibling.nextSibling.style.display = 'inline';
317 button.style.display = 'inline';
318
319- amEditingNote = null;
320+ amEditing = null;
321 }
322
323 function deleteEnclosure(button) {
324- if (amEditingNote) {
325+ if (amEditing) {
326 alert(editMsg);
327 return;
328 }
329@@ -228,18 +226,18 @@
330
331 // Note title
332 var oldTitle = document.createElement('input');
333- oldTitle.setAttribute('name', 'tiqitAttachmentDeleteTitle');
334+ oldTitle.setAttribute('name', 'deleteTitle');
335 oldTitle.setAttribute('type', 'hidden');
336 oldTitle.setAttribute('value', row.cells[0].lastChild.textContent);
337 row.cells[2].appendChild(oldTitle);
338
339- amEditingNote = row;
340+ amEditing = row;
341
342 button.form.submit();
343 }
344
345 function renameAttachment(button) {
346- if (amEditingFile) {
347+ if (amEditing) {
348 alert(editMsg);
349 return;
350 }
351@@ -250,20 +248,20 @@
352 // Title
353 // First save old one
354 var oldTitle = document.createElement('input');
355- oldTitle.setAttribute('name', 'tiqitAttachmentFileTitle');
356+ oldTitle.setAttribute('name', 'fileTitle');
357 oldTitle.setAttribute('type', 'hidden');
358 oldTitle.setAttribute('value', row.cells[0].lastChild.textContent.trim());
359 row.cells[2].appendChild(oldTitle);
360
361 var title = document.createElement('input');
362- title.setAttribute('name', 'tiqitAttachmentNewTitle');
363+ title.setAttribute('name', 'newTitle');
364 title.setAttribute('type', 'text');
365 title.setAttribute('value', row.cells[0].lastChild.textContent.trim());
366 title.setAttribute('size', 40);
367 title.addEventListener('click', function(event) { event.stopPropagation(); }, true);
368 row.cells[0].replaceChild(title, row.cells[0].lastChild);
369
370- amEditingFile = row;
371+ amEditing = row;
372
373 button.style.display = 'none';
374 button.nextSibling.style.display = 'inline';
375@@ -272,14 +270,13 @@
376 }
377
378 function saveAttachmentRename(button) {
379- var row = amEditingFile;
380-
381- // Note title
382- var oldTitle = document.createElement('input');
383- oldTitle.setAttribute('name', 'tiqitAttachmentRenameTitle');
384- oldTitle.setAttribute('type', 'hidden');
385- oldTitle.setAttribute('value', row.cells[2].lastChild.value);
386- row.cells[2].appendChild(oldTitle);
387+ var row = button.parentNode.parentNode;
388+
389+ var fileTitle = row.cells[2].lastChild.value;
390+ var newTitle = row.cells[0].lastChild.value;
391+ var bugid = document.getElementById('Identifier').value;
392+
393+ document.location.assign('editfile.py?bugid=' + bugid + '&renameTitle=' + fileTitle + '&newTitle=' + newTitle);
394 }
395
396 function cancelAttachmentRename(button) {
397@@ -296,11 +293,11 @@
398 button.style.display = 'none';
399 button.nextSibling.style.display = 'inline';
400
401- amEditingFile = null;
402+ amEditing = null;
403 }
404
405 function deleteAttachment(button) {
406- if (amEditingFile) {
407+ if (amEditing) {
408 alert(editMsg);
409 return;
410 }
411@@ -309,7 +306,7 @@
412 var bugid = document.getElementById('Identifier').value;
413 var fileTitle = row.cells[0].textContent.trim();
414
415- document.location.assign('editfile.py?bugid=' + bugid + '&tiqitAttachmentDeleteTitle=' + escape(fileTitle));
416+ document.location.assign('editfile.py?bugid=' + bugid + '&deleteTitle=' + escape(fileTitle));
417 }
418
419 function showAllEnclosures() {
420@@ -395,28 +392,8 @@
421
422 // New Note/File functions
423
424-function addFile() {
425- var newFile = document.getElementById('newfile');
426-
427- var addAttachment = document.createElement('input');
428- addAttachment.setAttribute('name', 'tiqitAttachmentAddFile');
429- addAttachment.setAttribute('type', 'hidden');
430- addAttachment.setAttribute('value', true);
431- newFile.appendChild(addAttachment);
432-}
433-
434-function addNote() {
435- var newNote = document.getElementById('newnote');
436-
437- var addAttachment = document.createElement('input');
438- addAttachment.setAttribute('name', 'tiqitAttachmentAddNote');
439- addAttachment.setAttribute('type', 'hidden');
440- addAttachment.setAttribute('value', true);
441- newNote.appendChild(addAttachment);
442-}
443-
444 function showNewNote() {
445- if (amEditingNote) {
446+ if (amEditing) {
447 alert(editMsg);
448 return false;
449 }
450@@ -427,14 +404,14 @@
451 newNote.style.display = "block";
452 theButton.style.display = "none";
453
454- amEditingNote = theButton;
455+ amEditing = theButton;
456 }
457
458 function hideNewNote() {
459 var newNote = document.getElementById("newnote");
460 var theButton = document.getElementById("newencbuttons");
461
462- if (theButton != amEditingNote) {
463+ if (theButton != amEditing) {
464 alert("You're not editing a new Note!");
465 return false;
466 }
467@@ -442,11 +419,11 @@
468 newNote.style.display = "none";
469 theButton.style.display = "inline";
470
471- amEditingNote = null;
472+ amEditing = null;
473 }
474
475 function showNewFile() {
476- if (amEditingFile) {
477+ if (amEditing) {
478 alert(editMsg);
479 return false;
480 }
481@@ -457,14 +434,14 @@
482 newNote.style.display = "block";
483 theButton.style.display = "none";
484
485- amEditingFile = theButton;
486+ amEditing = theButton;
487 }
488
489 function hideNewFile() {
490 var newNote = document.getElementById("newfile");
491 var theButton = document.getElementById("newencbuttons");
492
493- if (theButton != amEditingFile) {
494+ if (theButton != amEditing) {
495 alert("You're not editing a new File!");
496 return false;
497 }
498@@ -472,7 +449,7 @@
499 newNote.style.display = "none";
500 theButton.style.display = "inline";
501
502- amEditingFile = null;
503+ amEditing = null;
504 }
505
506 function initNoteTitleChange() {
507@@ -804,35 +781,18 @@
508 //
509
510 function prepareForm() {
511- if (amEditing && (amEditingFile || amEditingNote)) {
512- if (!confirm("You've made changes to another section of this bug. Do you wish to continue and also save these changes?")) {
513- return false;
514- }
515- }
516- if (amEditingFile) {
517- if (amEditingFile.tagName == 'P') {
518- addFile();
519- } else if (amEditingFile.tagName == 'TR') {
520- saveAttachmentRename();
521- }
522- }
523- if (amEditingNote) {
524- addNote();
525- }
526-
527-
528 var form = document.getElementById('tiqitBugEdit');
529 var extra = document.getElementById('tiqitExtraFormData');
530-
531+
532 var inputs = extra.getElementsByTagName('input');
533 var selects = extra.getElementsByTagName('select');
534-
535+
536 var extraDiv = document.getElementById('extraCopies');
537-
538+
539 while (extraDiv.childNodes.length) {
540 extraDiv.removeChild(extraDiv.childNodes[0]);
541 }
542-
543+
544 for (var i = 0; i < inputs.length; i++) {
545 if (inputs[i].name && ((inputs[i].type != 'checkbox' && inputs[i].value) || inputs[i].checked) && !inputs[i].disabled) {
546 var hidden = document.createElement('input');
547@@ -842,7 +802,7 @@
548 extraDiv.appendChild(hidden);
549 }
550 }
551-
552+
553 for (var i = 0; i < selects.length; i++) {
554 if (selects[i].name && selects[i].value && !selects[i].disabled) {
555 var hidden = document.createElement('input');
556@@ -852,12 +812,12 @@
557 extraDiv.appendChild(hidden);
558 }
559 }
560-
561+
562 var oldRelates = new Array();
563 var newRelates = document.getElementById('tiqitNewRelates');
564-
565+
566 var relatesTable = document.getElementById('tiqitRelatesTable');
567-
568+
569 if (relatesTable) {
570 for (row = 0; row < relatesTable.rows.length; row++) {
571 // Related bugs with disabled check boxes are those that aren't tracked
572@@ -868,7 +828,7 @@
573 }
574 }
575 }
576-
577+
578 if (newRelates) {
579 var hidden = document.createElement('input');
580 hidden.type = 'hidden';
581@@ -876,7 +836,7 @@
582 hidden.value = oldRelates.join(',') + ',' + newRelates.value;
583 extraDiv.appendChild(hidden);
584 }
585-
586+
587 if (!checkFormValidity())
588 return confirm("Missing info in form. Submit anyway?");
589 else

Subscribers

People subscribed via source and target branches