Open derrell opened 13 years ago
also it should increment a database count (along with email to admins if total count now exceeds some configured value, initially 1). should also store who flagged it. there is an existing database object for flags (needs review). Derrell will need to work with person who takes this issue to get them started.
To send email, use the App Engine Java API from JavaScript.
Chris -- please plan to talk with Derrell to unpack this one. One part of the story is doing unit testing on the backend code w/o having to build a front end.
The global boolean flag rpcjs.sim.remote.MRpc.SIMULATE specifies whether you are in simulation mode or real (App Inventor) mode.
You may find this useful: http://code.google.com/appengine/docs/java/overview.html
What I will have to do to fix this issue is:
in Constants.js add: maxFlagged flaggedType
in ObjComments.js add status and numCurrFlags
in ObjAppData.js add numCurrFlags
create MFlags.js and build an rpc
the rpc flagIt(flagType, visitor, explanation, appId, commentId,)
this rpc will: instanciate and put an ObjFlags object on the database in a similar way to assignment 8.
increment the numCurrFlags variable in the app or comment
if numCurrFlags >= maxFlagged, set status to pending and send an email to the administrators
Chris, I think you hit on the major points we discussed. A few details:
in Constants.js add:
maxFlagged flaggedType
Note naming policy. what you're calling maxFlagged will be an integer constant. It should be named in all upper case: MAX_FLAGGED
flaggedType is a constant map. It should begin with a capital letter, so FlaggedType. On the other hand, the parameter to your RPC is called flagType which I think makes more sense. Maybe this constant map should be called FlagType?
Looking good. Go forth and implement!
Derrell
Sorry the status update is so late. I have made the initial code for the app flagging, however I have had some trouble getting the testing tab to function correctly. I need to set up github properly anyway (I do not have a clean directory at this point) so if I stopped by Derrels office after class tomorrow I believe I could get to a point where I could have the issue closed within a couple hours if everything goes the way I would expect it to.
Chris, I'd suggest that in your case, where you must update to swedev right away, that you make a copy of the files which contain your changes for flagging, then follow my swedev instructions of last night, and after you have confirmed that your swedev environment is working, then create a new branch for your flagging changes, copy/paste your changes (only the changes, not whole files) from the saved files into the just-checked-out files, and go from there.
As for the testing tab, it seems that unzipping the template.zip file creates the files in a template directory. Move the files up into the same directory as the template.zip file is, and remove the template directory that was created by the unzip operation.
I have got the flagging code for apps working, and the code for flagging comments in development. Currently the code is having trouble identifying an already created comment, and sending an email is yet to be implemented.
finish the work up to but NOT INCLUDING email, and commit this. email will be a separate issue.
The comment flagging has been implemented in addition to the app flagging and is in the flagIt branch on my github. I currently have the return value set to the status of the app or comment, however there may be some more important value that could be returned instead(for example the number of flags on the app or comment).
Thanks, Chris! Here are a few things to fix before I can pull it in:
Once you get these issues corrected, I should be able to pull it into swedev.
Thanks!
Derrell
I implemented the changes and sent a pull request, however it appears that in the time between fetching upstream and merging flagIt and swedev derrell has made some changes to his swedev. Let me know if I should re merge and resend the pull request
No need for a re-merge. The other changes did not affect your code, and #166 has been pulled.
I got the code functional to ensure a user only flags an app or comment once. I implemented the flag it button to use the flagIt rpc call, however the handler only outputs the rpc return value to the console. These changes can be found on my flagIt branch.
Chris, this is great. A couple of issues:
if (qx.core.Environment.get("qx.debug")) { alert(...); }
in order to implement the emails where should the java includes be placed? Alternatively what other files could I use as an example of implementing java code.
On Tue, Nov 15, 2011 at 20:39, cadler1 < reply@reply.github.com
wrote:
in order to implement the emails where should the java includes be placed? Alternatively what other files could I use as an example of implementing java code.
For this application, you can put the Java code in the else clause of if (qx.core.Environment.get("qx.debug")) inside of the RPC implementation.
The documentation for the Java classes you'll need to send email are documented here: http://code.google.com/appengine/docs/java/mail/
You can access a Java class from JavaScript with Packages.
does Package have access to the javax library, because when the code is executed it throws a server error saying
Async(undefined) exception: Server error -1: Method threw an error: TypeError: Packages.javax.mail is undefined
on the first execution of the javax library.
On Wed, Nov 16, 2011 at 16:53, cadler1 < reply@reply.github.com
wrote:
does Package have access to the javax library, because when the code is executed it throws a server error saying
Async(undefined) exception: Server error -1: Method threw an error: TypeError: Packages.javax.mail is undefined
on the first execution of the javax library.
Are you running this in the App Engine emulator, or in the simulator running in the browser? There is no access to any java class in the browser. The java classes are only available in App Engine or its emulator.
I suspect you're running in the simulator since we haven't discussed setting up the emulator. Here's the process:
qxroot := ../../../../qx/qooxdoo/framework/source/class/ app := ../../frontendfsm/aiagallery/source/class rpcjs := ../../../../qx/contrib/trunk/qooxdoo-contrib/RpcJs/trunk/source/class
I think that's all there is too it. Let me know if you have problems.
Derrell
I pulled from upstream swedev and now whenever I try to run the make file for the app emulator it gives me the error
*\ No rule to make target qxoo_classes/qx/util/OOUtil.class', needed by
all'. Stop.
On Sun, Nov 27, 2011 at 18:29, cadler1 < reply@reply.github.com
wrote:
I pulled from upstream swedev and now whenever I try to run the make file for the app emulator it gives me the error *\ No rule to make target
qxoo_classes/qx/util/OOUtil.class', needed by
all'. Stop.
Uggh. My mistake. I had to update our backend stuff for latest qooxdoo, which broke it for you. Ok, you have two choices:
Sorry about that.
Derrell
currently the database seems to be executing the java mailing code correctly, however I have it being sent to my gmail account and it does not seem to be showing up there (even in the spam folder) .
It appears the code stops executing after the newFlag.put() line is executed and returns the error: Server error -1: Method threw an error: JavaException: java.lang.NumberFormatException: For input string: "undefined"
I have pushed the current code to my flagIt branch, most of the updates in mFlags is debugging code.
On Sun, Nov 27, 2011 at 21:24, cadler1 < reply@reply.github.com
wrote:
It appears the code stops executing after the newFlag.put() line is executed and returns the error: Server error -1: Method threw an error: JavaException: java.lang.NumberFormatException: For input string: "undefined"
You are overriding the defaults in the ObjFlags object. You are doing:
newFlag = new aiagallery.dbif.ObjFlags();
The above line creates default data for this new object.
var data =
{
type : flagType,
app : appNum,
comment : "0000",
visitor : visitorId,
explanation : explanationInput
}
newFlag.setData(data);
Here, you just overrode all of the default data with your new data.
What you want to do instead is:
newFlag = new aiagallery.dbif.ObjFlags();
var data = newFlag.getData();
data.type = flagType;
data.app = appNum;
data.comment = "0000";
data.visitor = visitorId;
data.explanation = explanationInput;
(and then the newFlag.setData(data) call is superfluous because data contains a reference to the map that's already in the newFlag object and you are modifying the data referenced by that variable)
I suspect that's your problem.
Derrell
yep, that fixed the flag creation problem, now I just have to deal with the java email bit.
where should I be looking to find if the app inventor emulator can send email?
On Mon, Nov 28, 2011 at 14:36, cadler1 < reply@reply.github.com
wrote:
where should I be looking to find if the app inventor emulator can send email?
The page http://code.google.com/appengine/docs/java/mail/overview.html says:
Mail and the Development Server When an application running in the development server calls the Mail service to send an email message, the message is printed to the log. The Java development server does not send the email message.
So if things are working, you should, I think, see the message printed on the "console" which is the shell from which you started the emulator (development server).
Derrell
It is not outputting anything to the console at this point I have been staring at it for over an hour with no progress. I have updated my flagIt branch and I think a second pair of eyes would do some good.
On Mon, Nov 28, 2011 at 20:26, cadler1 < reply@reply.github.com
wrote:
It is not outputting anything to the console at this point I have been staring at it for over an hour with no progress. I have updated my flagIt branch and I think a second pair of eyes would do some good.
Ok. I'll take a look.
On Mon, Nov 28, 2011 at 20:26, cadler1 < reply@reply.github.com
wrote:
It is not outputting anything to the console at this point I have been staring at it for over an hour with no progress. I have updated my flagIt branch and I think a second pair of eyes would do some good.
It seems that the logging of mail messages occurs at level "INFO" and we have the minimum logging level set to "WARNING".
Edit the file backend-js/jsserver/war/WEB-INF/logging.properties Find the line that says:
.level = WARNING
and change it to:
.level = INFO
When you restart the emulator and press your Flag It button again, you'll see the mail INFO log messages.
Derrell
Yep, I confirmed the emailing does log correctly, removed the debugging code and made the changes to the comment flagging section. I am not sure what information to put in the emails (to who from who and the exact message being sent), so I will wait to put a pull request in.
On Wed, Nov 30, 2011 at 00:54, cadler1 < reply@reply.github.com
wrote:
Yep, I confirmed the emailing does log correctly, removed the debugging code and made the changes to the comment flagging section. I am not sure what information to put in the emails (to who from who and the exact message being sent), so I will wait to put a pull request in.
Put in the app being flagged (id and name) and who flagged it (email address and display name). We can deal with anything else we need later.
Yet TBD:
I have changed the message to say how many times the app/comment was flagged rather than the user who last flagged it, and I have disabled the flagIt button after a user has flagged the app. These changes are on the flagIt branch in my repo.
I am not sure what the process will be to move the emailing function into LIBERATED however I will be able to meet tomorrow if that is necessary, otherwise email is always an option. I need the correct email address as well, however whatever method is needed to fix the LIBERATED issue will surely be enough for the email.
On Mon, Dec 5, 2011 at 21:08, cadler1 < reply@reply.github.com
wrote:
I have changed the message to say how many times the app/comment was flagged rather than the user who last flagged it, and I have disabled the flagIt button after a user has flagged the app. These changes are on the flagIt branch in my repo.
That's great. Please issue a pull request with those changes.
I am not sure what the process will be to move the emailing function into LIBERATED however I will be able to meet tomorrow if that is necessary, otherwise email is always an option. I need the correct email address as well, however whatever method is needed to fix the LIBERATED issue will surely be enough for the email.
That's beyond the scope of what you need to be doing. If you want to do it, I'll gladly introduce you to the architecture of LIBERATED, but otherwise, I'll do that integration. You should feel no obligation to do that yourself.
Derrell
for the moment, send email to administrators