|
@@ -19,15 +19,18 @@ function createAssignmentForm(assID, url){
|
|
|
if (assID == null){
|
|
|
$('#storedassignments').css("display", "none");
|
|
|
$('#assignmentLupe').css("display", "block");
|
|
|
- $('#addExternalImageAssignment').removeAttr('disabled');
|
|
|
+ //$('#addExternalImageAssignment').removeAttr('disabled');
|
|
|
$('#addExternalImageAssignment').val("");
|
|
|
+ $('#updateExternalImageAssignment').css("display", "none");
|
|
|
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
$('#storedassignments').css("display", "block");
|
|
|
+ $('#updateExternalImageAssignment').css("display", "block");
|
|
|
+ $('#updateExternalImageAssignment').attr('onClick', 'updateImage(' + assID + ')');
|
|
|
$('#assignmentLupe').css("display", "none");
|
|
|
- $('#addExternalImageAssignment').attr('disabled','disabled');
|
|
|
+ //$('#addExternalImageAssignment').attr('disabled','disabled');
|
|
|
$('#addExternalImageAssignment').val(url);
|
|
|
|
|
|
|
|
@@ -70,6 +73,27 @@ function createAssignmentForm(assID, url){
|
|
|
}
|
|
|
|
|
|
|
|
|
+function updateImage(assID){
|
|
|
+
|
|
|
+ var newImgUrl = $('#addExternalImageAssignment').val();
|
|
|
+ $.ajax({
|
|
|
+ type: "Put",
|
|
|
+ data: '{"url": "' + newImgUrl + '"}',
|
|
|
+ headers: {"content-id": "list"},
|
|
|
+ contentType: "application/json",
|
|
|
+ url: "../server/assignments/" + assID,
|
|
|
+ success: function(res) {
|
|
|
+ //reload assignmentlist (left)
|
|
|
+ initAssignment();
|
|
|
+ //reload cur assignment (right)
|
|
|
+ createAssignmentForm(assID, newImgUrl)
|
|
|
+ },
|
|
|
+ error: function (request, status, error) {
|
|
|
+ alert(request.responseText + status + error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
//called when new image is selected
|
|
|
function getImgText(imgtext){
|