- Timestamp:
- 2010-03-18 14:39:32 (2 years ago)
- Location:
- tupper/trunk/tupper-site/src/main
- Files:
-
- 1 added
- 4 edited
-
java/org/kauriproject/tupper/resource/TaskResource.java (modified) (2 diffs)
-
java/org/kauriproject/tupper/resource/TupperException.java (added)
-
kauri/pages/{user}/projects..xml (modified) (1 diff)
-
kauri/representations.groovy (modified) (1 diff)
-
kauri/static/js/popups.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tupper/trunk/tupper-site/src/main/java/org/kauriproject/tupper/resource/TaskResource.java
r1336 r1465 8 8 import java.util.ArrayList; 9 9 import java.util.List; 10 10 11 import net.sf.json.JSONObject; 11 12 import net.sf.json.JSONSerializer; 13 12 14 import org.kauriproject.tupper.api.Tupper; 13 15 import org.kauriproject.tupper.api.manager.TaskManager; … … 241 243 try { 242 244 tupper.begin(); 245 List<Performance> performances = tupper.getPerformanceManager().findByTask(task); 246 if (performances.size() > 0) { 247 throw new TupperException("Can't delete task: there are performances"); 248 } 249 List<Task> subtasks = tm.findByParentTask(task); 250 if (subtasks.size() > 0) { 251 JSONObject json = new JSONObject(); 252 throw new TupperException("Can't delete task: there are subtasks"); 253 } 243 254 tm.destroy(task); 244 255 tupper.commit(); -
tupper/trunk/tupper-site/src/main/kauri/pages/{user}/projects..xml
r1424 r1465 238 238 <input type="button" value="Edit" id="edit_task_button"/> 239 239 </div> 240 <div> 241 <input type="button" value="Delete" id="delete_task_button"/> 242 </div> 240 243 </div> 241 244 </div> -
tupper/trunk/tupper-site/src/main/kauri/representations.groovy
r1269 r1465 10 10 } 11 11 12 exceptions(media:"json") { 13 exception(classes: ["java.lang.RuntimeException"]) { 14 jsonStatus(); 15 } 16 exception { 17 jsonStatus(); 18 } 19 } 20 12 21 exceptions { 22 exception(classes: ["java.lang.RuntimeException"]) { 23 jsonStatus(); 24 } 13 25 exception { 14 26 template(src: "clap://thread/org/kauriproject/representation/defaulterrorpage.xml") -
tupper/trunk/tupper-site/src/main/kauri/static/js/popups.js
r1269 r1465 283 283 loadValues(); 284 284 }); 285 $("#delete_task_button").click(function(){ 286 taskForm.setCreateMode(false); 287 //alert(JSON.stringify(detailJSON)); 288 if (confirm('Are you sure?')) { 289 $.ajax({type:"POST", url:"/data/task/"+detailJSON.id+"?method=DELETE&kauri-error-media=json", 290 success:function(a,b,c) { 291 alert('The task is now gone (refresh!)'); 292 // if delete is confirmed, simulate click on the parent of selected node (need to add parentId to the detailJSON) 293 }, 294 error:function(a,b,c) { 295 var jsonStatus = JSON.parse(a.responseText); 296 var m = jsonStatus.throwable.cause.message; 297 alert(m); 298 } 299 }); 300 } 301 }); 285 302 //closing popup 286 303 $(".popup_submit").click(function(){
Note: See TracChangeset
for help on using the changeset viewer.