From 6c6211566937fce4f0d8c6b933851f004d6faaff Mon Sep 17 00:00:00 2001 From: David Norton Date: Tue, 23 May 2006 12:53:06 +0000 Subject: [PATCH] Creator editing and deleting should be fully working from the interface side (exceptions thrown on data access side, usually with deletes) --- .../chromeFiles/content/scholar/editpane.js | 92 ++++++++++++------- 1 file changed, 59 insertions(+), 33 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/editpane.js b/chrome/chromeFiles/content/scholar/editpane.js index ee16505df9..a33ee200a4 100644 --- a/chrome/chromeFiles/content/scholar/editpane.js +++ b/chrome/chromeFiles/content/scholar/editpane.js @@ -5,11 +5,13 @@ Scholar.EditPane = new function() var _dynamicCreators; var _itemBeingEdited; var _creatorTypes = Scholar.CreatorTypes.getTypes(); - + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); + this.init = init; this.editItem = editItem; this.close = close; this.addCreator = addCreator; + this.removeCreator = removeCreator; function init() { @@ -22,7 +24,21 @@ Scholar.EditPane = new function() function editItem(thisItem) { + if(!_editpane.hidden) + { + var flags=promptService.BUTTON_TITLE_SAVE * promptService.BUTTON_POS_0 + + promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1 + + promptService.BUTTON_TITLE_DONT_SAVE * promptService.BUTTON_POS_2; + + var response = promptService.confirmEx(window,"", + "One or more files have not been saved.", + flags, null, null, null, null, {}); + if(response == 1) + return; + else if(response == 0) + saveItem(); + } _editpane.hidden = false; removeDynamicRows(_dynamicFields); @@ -52,9 +68,7 @@ Scholar.EditPane = new function() removeDynamicRows(_dynamicCreators); for(var i = 0, len=thisItem.numCreators(); i