CVS edit link for callum

Im requesting a CVS account for my drupal layar module, a phone application for viewing places of interest in an augmented reality map. It is complete and works. It's build on top of 2 other very popular and supported modules: Views and location.

It works like so:

I've created a views style plugin, that outputs the views result nodes as layar compatible JSON hotspots (you map which fields go to which layar field in the style settings).

It creates a views filter of "Filter out nodes not within the layar requests proximity filter", this filter uses the location information on nodes (from the location module) to decide which nodes to filter out.

And it also creates a content type of "layar" which is a content type that has a listbox of the all the view displays in the drupal site. The user can create a layar and select which views displays will be used in the layar response. When the content item of layar is viewed it displays a link at the top showing the user what link to use in the layar interface.

The module is complete and working, there are some things i would like to work on in the future such as:

1. Live preview does not work correctly, at the moment i just output text telling the developer to test the view within layars testbed.

2. I do not support altitude as the location module does not include altitude information (although it may be possible through an extension module).

CommentFileSizeAuthor
#13 layar.tar_.gz11.39 KBcallum
#10 layar.tar_.gz12.05 KBcallum
#8 layar.tar_.gz10.75 KBcallum
#7 layar.tar_.gz10.75 KBcallum
#1 layar.tar_.gz10.76 KBcallum

Comments

callum’s picture

StatusFileSize
new10.76 KB

The module so far. Capable of building a basic layar application, features like OAUTH and altitude .etc still to come.

I've written a small step by step guide in the README.txt that produces a very basic layar application from a base drupal installation.

avpaderno’s picture

Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.

What do you mean by as layar compatible JSON hotspots?

callum’s picture

Hotspots are objects that the layar app places in it's 3d map. They just contain some location information and some meta information like atitle, description, image .etc The view style plugin takes the node results from a view and encodes them into hotspot objects.

To better explain how the module fits in with layar, The flow of the layar app goes like this:

1. The mobile app loads a publishers "layer" (that is set up on the layar website) and sends it's current location to the layar server. Which then makes a request to the "POI" (points of interest) url defined in the layer settings on the layar website. This URL is supplied by my module (http://img687.imageshack.us/img687/5167/screenshotmylayartestsi.png).

2. When recieving the request the module takes the nid of the layar content item in the url and loads it. All the views that were selected in the listbox in the node are executed to make an array of hotspots (http://img697.imageshack.us/img697/5167/screenshotmylayartestsi.png). I provide views style plugin to make hotspot objects from the result nodes and a filter to remove results that were not within the requests range.

3. Once the views have been executed. All the hotspots are packaged up into a layar response and returned to the layar servers.

4. Which is sent to the client phone and displayed in the 3d augmented reality map.

The benefit of using views to build the hotspots is that you don't need to modify the current dataset, in the layar style plugin settings you simply map what each field in the hotspot object maps to what field in the node. here's a screenshot of the mapping interface http://img806.imageshack.us/img806/9051/screenshoteditviewlayar.png

if your unfamiliar with layar you should check it out at http://www.layar.com/ and to test it apply for an account at http://publishing.layar.com. Well worth a look if you own a iphone or android smartphone.

avpaderno’s picture

Status: Postponed (maintainer needs more info) » Needs review

Thank you for your reply.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Needs work
  • The points reported in this review are not in order or importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1.   ob_start();
      include drupal_get_path('module', 'layar') . '/definitions/layar.cck.inc';
      ob_end_clean();
    

    What is the purpose of calling ob_start(), and ob_end_clean()?
    There is a Drupal function that can be called to load files containing PHP code.

  2.         drupal_set_message(t('The POI URL of this layar is: ') . l($GLOBALS['base_url'] . '/layar/' . $node->nid, 'layar/' . $node->nid));
    

    The code should use t()-placeholders, and generate URLs using url(). l() should never be used together t(), as reported in the documentation for t().

  3.     echo json_encode($response);                
    

    json_encode() is only defined in PHP5, but Drupal 6 is compatible with PHP4. If the module require a function present in PHP5, then it should declare its dependency from PHP5. The function is only found on PHP 5.2.0 or higher; for other versions of PHP, the module should check if the function is present. There is then a Drupal function that can be used instead of json_encode().

  4. The same is true for filter_input(), which is present only on versions of PHP higher or equal to 5.2.0.
callum’s picture

Awesome, just saw your message. Just about to leave work for home though! I should have you changes sorted by tomorrow afternoon.

Cheers.

Cal

callum’s picture

StatusFileSize
new10.75 KB

I've made some changes.

1. I know load the definition as a file. Im not sure which function you said could load a file containing php code, but i've used file_get_contents() instead of buffers.

$definition_file = file_get_contents(drupal_get_path('module', 'layar') . '/definitions/layar.cck.inc');
...
$form_state['values']['macro'] = $definition_file;

2.

Everything is now done in the t() function:

drupal_set_message(t("The POI URL of this layar is: !url", array('!url' => url("layar/$node->nid", array('absolute' => TRUE)))));

3. Changed the php requirement to 5.2 until i get round to using the old libs.

4. changed the php requirement to 5.2 until i get round to using the old libs.

callum’s picture

StatusFileSize
new10.75 KB

Sorry, made a mistake, that was a slightly old tar of the module, here is the the latest (the only difference is one defines php 5.2 the other doesn't).

avpaderno’s picture

  1. The function I was referring to is module_load_include().
  2. The correct placeholders for URLs start with @.
  3. The function layar_getpointsofinterest() should be renamed layar_get_points_of_interest(), or layar_points_of_interest().
  4.       if (!in_array(NULL, $fields) && !in_array(FALSE, $fields)) {
            $this->query->add_where($this->options['group'], earth_distance_sql((Float)$fields['lon'], (Float)$fields['lat'], 'location') . ' < %f', (Float)$fields['radius']);
          }
    
    

    Where is the function earth_distance_sql() defined?

  5.     $response->errorString = 'Input fields were either missing or failed sanitization.';
    
    

    Strings used in the user interface should be translated.

  6. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how hook implementations should be commented.
  7.       '#description' => t('The size of the object in meters squared.'),
    
    

    It's square meters, not meters squared.

callum’s picture

StatusFileSize
new12.05 KB

1. Done.

2. Done.

3. Done.

4. That's defined in the location_search module which comes bundled with location. I've added adjusted the methods doxygen comment to include a @see stating where it is from.

5. Done.

6. I've gone through and i believe to have done them. And i've added the doxygen comments to all of my functions and methods and file statements to my files. I've also installed the coder module and and done a scan of my module and it comes up with no issues under the most detailed mode (i'm aware this doesn't get everything). The only thing that may be an issue is the naming of my views classes, the naming conventions used in the views api documentation and the drupal coding standard document is different (views uses underscores, drupal coding standards camelCase). I've left them as underscores.

7. Done.

avpaderno’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Needs work
    $form['tooltip']['layar_attribution'] = array(
      '#type' => 'select',
      '#title' => 'Layar Attribution',
      '#default_value' => $this->options['tooltip']['layar_attribution'],
      '#description' => t('The attribution of the tooltip box (in italic at the bottom).'),
      '#options' => $fields,
    );

Strings used in the user interface are translated.

callum’s picture

StatusFileSize
new11.39 KB

Titles of form objects are now enclosed in t() tags.

avpaderno’s picture

Status: Needs work » Needs review
avpaderno’s picture

Status: Needs review » Fixed

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes