Hi, Great work!

Is it possible now to interact with views? To get views listings and show it on the devices. And then the next step: Get new items for a specific view, so use offset or a date/nid filter.

e.g. get a news listing on day one; for example nodes 1 to 10, and store the items on the device. Then ask for new items on day two, so you filter by nid>10 or something like that.

regards

Comments

tyler.frankenstein’s picture

Assigned: Unassigned » tyler.frankenstein

Thanks for the positive feedback!

Right now the module leverages Views Datasource (Views JSON) to get views listings (content,comments). When installed, DrupalGap creates some views (that use views json to return the results as json) for content and comments.

If you are developing your own mobile application, you can create a view with a page display and set the format to 'Views JSON'. That way a device can communicate with a custom view page and retrieve results. Arguments can be passed to views as well to do contextual filters and such.

Future versions of the module/mobile-app will be more 'intelligent' in regards to dynamically communicating with views available on the Drupal back-end as well as integration with the Forms API to handle additional fields (not just title/body).

Right now the mobile app doesn't use any local storage features (offline mode), but it is possible to store retrieved nodes in local storage for offline mode.

Again, in the future the mobile-app and module will support offline mode so data can be retrieved from Drupal when online, then stored in local storage for retrieval at a later time if the device is offline.

I hope this answers your question, if not please let me know, thanks!

avdp’s picture

nice, thanks!
I am going to check it out after the weekend. This has been on my to do list for some time now. It looks like you have made it a lot more easy to start with this.

tyler.frankenstein’s picture

Status: Active » Needs work
lightsurge’s picture

Version: » 6.x-1.x-dev

Not wanting to hijack this thread, but congrats on the project status. Was looking into how to build an app that integrates with a drupal site, and this project makes it all look a lot less frightening!

SMear’s picture

By converting the views into JSON format Data for Drupal 7 by using the Views_datasource ,the views get exposed to the outside world!!!!!!! is there a secure way of doing this??

lightsurge’s picture

@SMear I'm not entirely well-versed with how this module/app works, but I'm interested in this question as well... but I'm not sure what you mean by the outside world... do you mean that the app can't communicate session information to the drupal back-end, so the View can't make use of this to take advantage of refining by node access etc?

I figure Views datasource itself should be perfectly capable of refining content to just what the viewing user is entitled to see, or returning empty if a user (anonymous for example) has access to see nothing.

tyler.frankenstein’s picture

Using views_json to expose the view's results as JSON isn't a security issue in my opinion. Yes it makes it easier for someone to extract content from your website, but views_json listens to your view's access permissions. So it is up to the site developer to set the appropriate access permission settings on the view to protect their data as desired.

As @lightsurge mentioned, Views datasource is capable of protecting your data by falling back to view's/drupal's access settings. If you don't want your view's json results to be exposed to the outside world, then your mobile app won't be able to get anything from your Drupal site. You can adjust the view to only allow authenticated users, or admins (or whatever) to access the results, this is up to you. If a user doesn't have permission to access the views json results, then they will be returned an empty set as @lightsurge mentioned.

The default drupalgap_content view uses the 'access content' permission, so anyone who can access content, can access the views json results. This can of course be adjusted to your needs. But, in my opinion, site's aren't very useful if no one can access content.

drnikki’s picture

Do you have an example of a protected views_json view allowing access by a user passing in their username & password? Or could they use another account token?

tyler.frankenstein’s picture

I would recommend adjusting the 'access' settings on your view to 'authenticated users'. That way only logged in users can retrieve the JSON data from your view. I'm not sure what you mean by another account token, and I don't recommend passing in a user name and password to anything but the user login service resource.

tyler.frankenstein’s picture

Component: Code » Module Code
Status: Needs work » Closed (won't fix)

Sorry, the Drupal 6 version is no longer supported.

More information: http://www.drupal.org/node/2015071