Skip to content

Commit

Permalink
feedback added
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Yoo committed Aug 9, 2012
1 parent cd6c941 commit 74f1a29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/org/wescheme/data/Feedback.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public JSONObject toJSONObject() {
obj.put("id", this.id);
obj.put("author", this.author);
obj.put("type", this.type);
obj.put("date", this.date);
obj.put("feedbackText", this.feedbackText);
// date is represented at amount of milliseconds since the epoch.
obj.put("date", this.date.getTime());
return obj;
}
}
7 changes: 6 additions & 1 deletion src/org/wescheme/servlet/DumpFeedback.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.wescheme.data.DAO;
import org.wescheme.data.Feedback;
import org.wescheme.user.Session;
import org.wescheme.user.SessionManager;
Expand All @@ -34,7 +36,7 @@
* @author dyoo
*
*/
public class DumpFeedback {
public class DumpFeedback extends HttpServlet {

public static final long LIMIT_MILLIS = 1000 * 25; // provide a little leeway

Expand All @@ -47,6 +49,9 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
response.sendError(401);
return;
}

// Side effect: force loading of the classes.
DAO dao = new DAO();


// Next, start dumping content till we hit CPU limit
Expand Down
21 changes: 21 additions & 0 deletions war-src/js/ajaxactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,25 @@ goog.require('plt.wescheme.Program');
xhr: function(settings) { return new XMLHttpRequest(settings); }
});
};


plt.wescheme.AjaxActions.prototype.sendFeedback = function(author, type, feedbackText, onSuccess) {
jQuery.ajax({cache : false,
data : {author : author,
type : type,
feedbackText : feedbackText },
datatype: "text",
type: "POST",
url: "/addFeedback",
success: function(data) {
onSuccess();
},
error: function(xhr) {
onSuccess();
},
xhr: function(settings) { return new XMLHttpRequest(settings); }
});

};

})();

0 comments on commit 74f1a29

Please sign in to comment.