The XML3D Module provides a simple and easy way to integrate the XML3D models and applications into Drupal. The current 7.x-1.x version allows to simply enter the XML3D code into a Long Text field that has the XML3D Input Field formatter. The content will then be displayed on the page in the form of an iframe having the same size as the XML3D application.
The current version of the module supports content without any external links (either code or images). Thus, the module folder contains an example directory with two sample files: css_transforms.txt and rubik_cube.txt. You can just copy the content of these files and insert it into you field.

The Project Page: http://drupal.org/node/1959792
The Git Clone Link: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/vkosenko/1959792.git xml3d_integration

Comments

SamChez’s picture

Status: Needs review » Needs work

Cloning into xml3d_integration...
remote: Counting objects: 20, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 20 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (20/20), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

There was an error when attempting to install it locally. You'll need to change the default branch of your repository according to this article: https://help.github.com/articles/error-remote-head-refers-to-nonexistent....

vkosenko’s picture

Issue summary: View changes

The Git Clone Link has been corrected

vkosenko’s picture

Status: Needs work » Needs review

The git clone link has been corrected.
Some other bugs mainly concerning the formatting rules have been fixed as well.

The remaining warnings (http://ventral.org/pareview/httpgitdrupalorgsandboxvkosenko1959792git-7x-1x) belong to the example files that are intended to be used for testing purposes only.

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

chason’s picture

Status: Needs review » Needs work

@vkosenko - very cool module. This is the first I've seen of XML3d technology, looks exciting. A lot of possibilities.

Manual Review:
I installed the module and libraries, created a content type with a Long Text field and applied the XML3d Input Field formatter to the display. Then pasted in all the contents from rubik_cube.txt but do not see any output. Is there something that I should look for that's causing it not to display? Perhaps adding some error logging to the module might help debug?

Your code looks clean. Nothing stands out as needing additional work as far as structure and syntax is concerned.

vkosenko’s picture

Status: Needs work » Needs review

@chason: thank you very much for your review and comments!

In case if the module does not work for you, please check the following:

1) check your browser: Firefox and Chrome are the only browsers supported at the moment. See detailed description on how to install the module at: http://drupal.cocomore.com/blog/xml3d-and-drupal. I'd recommend you to go there and check if the example there works in your browser (the example is at the bottom of the page)

2) check your 'Recent log messages' if there are any errors or warnings of 'XML3D' type. Most of errors are logged there now.

@chason: if it still doesn't work for you, please, let me know (indicating the browser, system, drupal versions). Thank you!

chason’s picture

Status: Needs review » Reviewed & tested by the community

Success! I reloaded the page and the 3d cube appeared. I don't see any calls to watchdog() in your code so I'm not sure if/how errors would appear in 'Recent log message.' However, the functionality the module exposes is working as intended.

d34dman’s picture

Hi,

I really like the excellent code documentation and README.txt. But i am sorry to report that your module lacks the Drupal Experience. (From a developer's perspective your module is awesomely documented i believe, but that is just my opinion ).

Suggestion 1

Thanks for the comprehensive README.txt my installation procedure went on smoothly. but I think its more appropriate to put the contributed modules in contrib folder rather than custom folder.

   sites
   |--all
      |--libraries
         |--xml3d
            |--xml3d.js
            |--camera.js
      |--modules
         |--custom   <<<<<< Make it contrib.
            |--xml3d

Suggestion 2

Also it would be a very nice of the module to display a drupal_set_message() regarding the need to download and install xml3d files ( and link to download them would be more awesome ).

Another place i checked for missing files report was 'admin/reports/status'. Even though i had intentionally forgot to download the required js libraries, it didn't show up there. So another suggestion of mine is to implement a hook_requirements($phase)

Something like the follow could be included in xml3d.install file.

<?php
 /**
  * Implements hook_requirements.
 *
 * Changes its status based on ability to locate JS library.
 * Changes its instructions based on Libraries API being enabled.
  */
 function xml3d_requirements($phase) {
   $requirements = array();

   switch ($phase) {
     case 'runtime':

      /**
       * Test for conditions
       */

      // Fetch the version. For display only.
       $version = xml3d_get_version();

      // Fetch the path to the JS lib.
      $path = xml3d_get_path();

      // Test if Libraries module is being used by comparing output of path functions
      if (module_exists('libraries')) {
        // If this is truthy, the xml3d is using Libraries API as best we can tell.
        $using_libraries = (strpos($path, libraries_get_path('xml3d')) !== FALSE);
      }
      else {
        $using_libraries = FALSE;
      }

      /**
       * Generate status message and severity
       */

      // xml3d / Libraries API installed and working correctly. Do the Drupal happy dance!
      if ($path && $using_libraries) {
        $description = FALSE;
        $severity = REQUIREMENT_OK;
      }
      // xml3d and Libraries API are installed, but something is wrong with Libraries copy of the JS lib.
      elseif ($path && !$using_libraries && module_exists('libraries')) {
        $description = t('xml3d JS library and Libraries API are installed, but something is wrong with the xml3d library inside !path.<br> Fell back to the copy within !path-module.',
          array(
            '!path' => libraries_get_path('xml3d'),
            '!path-module' => drupal_get_path('module','xml3d') .'/js',
          )
        );
        $severity = REQUIREMENT_WARNING;
      }
      // xml3d installed, but Libraries API not installed. Still acceptable, but nudge them.
      elseif ($path && !$using_libraries) {
        $description = t('xml3d JS library is installed using the module directory. Have you considered using !libraries-api?',
          array(
            '!libraries-api' => l('Libraries API','http://drupal.org/project/libraries'),
          )
        );
        $severity = REQUIREMENT_WARNING;
      }
      // xml3d not installed, Libraries API is installed.
      // Supply instructions recommending Libraries module
      elseif (!$path && module_exists('libraries')) {
        $description = t('xml3d JS library cannot be found. Download it from !xml3d-site, copy it into !path and rename it xml3d.min.js.',
          array(
            '!xml3d-site' => l(t('xml3d.com'), 'http://xml3d.com'),
            '!path' => libraries_get_path('xml3d'),
          )
        );
        $severity = REQUIREMENT_ERROR;
      }
      // xml3d not installed, Libraries API not installed.
      // Supply generic instructions
      else {
        $description = t('xml3d JS library cannot be found. Download it from !xml3d-site, copy it to !path and rename it to xml3d.min.js.',
          array(
            '!xml3d-site' => l(t('xml3d.com'), 'http://xml3d.com'),
            '!path' => drupal_get_path('module','xml3d') .'/js',
          )
        );
        $severity = REQUIREMENT_ERROR;
      }

      /**
       * Declare requirement
       */
       $requirements[] = array(
        'title' => t('xml3d'),
        'value' => $version ? $version : t('Not installed'),
        'description' => $description,
        'severity' => $severity,
       );
       break;
   }

   return $requirements;
 }

Please note that I have not tested the above code, it just for showing you how many possible status messages could be there so that drupal user ( admin ) could take appropriate decision. Please edit it to suite your module's need as you are much better aware of what your module's requirements are than I am.

Post installation experience.

Even though i was quite alarmed with lots of garbage text for few seconds but it was soon washed away with an awesome 3d experience (it would be awesome if it could be removed somehow ).

Loved it

, it was awesome and thanks for the cool example of rubik_cube_interactive.

PS: Am not sure if i should pull it down from RTBC since these suggestions are only meant to enhance Drupal experience. Hopefully somebody having better experience in dealing with such stuff can take a proper decision.

vkosenko’s picture

@chason and @D34dMan : thanks a lot for your reviews and valuable comments!

The watchdog() function is used to log errors and warnings in the xml3d.module (at the end of the file).

The folder tree is now updated and the 'custom' folder changed to 'contrib'.

The hook_requirements($phase) hook has been added in order to reflect the current state of the module on the 'Status Report' page. In case if the library files are not installed, a corresponding error message will appear on the list of the Status Report page with some more detailed information in the 'Recent log messages'.

d34dman’s picture

Please note that below is my personal opinion.

@vkosenko i understand it may be a little inconvenient for you, but i strongly suggest that you try for a Review bonus and get the git admin's review. I have came across this post while participating in that program. By doing so i believe i have learned a lot about various standards and responsibilities that are expected from a maintainer. Also it helped me get through the process in just about less than two weeks.

I very much look forward for your contribution to become a full project.

klausi’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +PAreview: security

Sorry for the delay, but you have not listed any reviews of other project applications in your issue summary as strongly recommended in the application documentation.

manual review:

  1. xml3d_field_formatter_view(): why do you need the user_access() check? the field will only be shown if the whole entity is accessible anyway, so you don't need to check that?
  2. xml3d_get_iframe_content(): This does not do any access checking except for "access content" in the hook_menu() definition, so we have an access bypass vulnerability here. If I unpublish a node users can still retrieve the iframe on the xml3d/iframe/%/%/%/% path. Why do you even need your own menu callback? Why do you need an iframe to display the content, shouldn't a div or any other container be enough? And please don't remove the security tag, we keep that for statistics and to show examples of security problems.
PA robot’s picture

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

Closing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

The git clone link updated