Open derrell opened 13 years ago
Terrance, this extends from the work you just completed. I'd suggest adding a call to AppInfo's addAppView() function from aiagallery.Application's main(), right after calling addModules().
The URL query string might be something like ?app=23 to request that the application with uid 23 be displayed.
This mechanism can be extended later to other than applications.
So I looked a the JS book and did not see anything that collected the requesting url and parsed it to a usable array or object. Qooxdoo does have q.util.Uri.parseUri() that might help this case, otherwise it is url parsing with regex.
Try here:
You're looking for the 'search' member of the 'location' object.
That will only give me a string, that would give me an object / array that I can just use. So i would still need regex or qx.util.Uri. qx.util.Uri may give me an object I can just look at ( if it work how it seems, not well documented ), which expands to further development easier, or regex which is guaranteed to work as expected. either way I think location.search is a wasted step.
On Wed, Nov 2, 2011 at 14:28, canausa < reply@reply.github.com>wrote:
That will only give me a string, that would give me an object / array that I can just use. So i would still need regex or qx.util.Uri. qx.util.Uri may give me an object I can just look at ( if it work how it seems, not well documented ), which expands to further development easier, or regex which is guaranteed to work as expected. either way I think location.search is a wasted step.
Regular expressions are slow, so they are typically used only where they are the best option, rather than just being "an" option.
Another method for you to consider is the String object's split() method. Given a url like
http://app-inventor-gallery.appspot.com/gui?app=23
you could potentially do something like this if you wanted:
var parts = location.search.split("="); // parts[0] = "app" // parts[1] = "23" var appId = parseInt(parts[1]); // convert from string to integer
How you implement this is up to you, but now you have some additional options that may be more efficient than using regular expressions.
Hey Derrell,
Status Update, still working on this and haven't made much process. I will probably go with the string split method.
I have 2 question for you. should we support multiple get parameters? ex ?app=23&app=24, and is there a way to verify a app exist, before calling the creation of the tab?
On Sun, Nov 6, 2011 at 22:42, canausa < reply@reply.github.com>wrote:
should we support multiple get parameters? ex ?app=23&app=24
That would be a nice extension, allowing saving an entire configuration, but not necessary for the first attempt at this. Let's get this working first with only a single application being specified.
is there a way to verify a app exist, before calling the creation of the tab?
Not from the GUI, since it requires a database lookup. We already have an outstanding issue (not yet assigned, I believe) to better handle errors that are returned. In the case of the AppInfo module, if the error that is returned indicates that the application does not exist, it should display something reasonable in place of all of the application-specific information, rather than the current alert().
Reassign to @efernand
For AppInfo, can be implemented as a search for a particular UID.