IMAmuseum / tap-cms

Authoring tools for the TAP mobile application software platform, built on top of Drupal. Learn more about the project at TAPintoMuseums.org.
https://github.com/IMAmuseum/tap-cms/wiki
GNU General Public License v3.0
24 stars 8 forks source link

Custom fields not exporting / Default Stops do not export to XML #41

Closed prash-nk closed 9 years ago

prash-nk commented 9 years ago

Whenever we check the tourml xml tab for all the various default stops, we get following errors:

Error 1872: The document has no document element. on line 0

Drupal posts the following warnings:

Warning: DOMDocument::loadXML(): Empty string supplied as input in _tap_tourml_validate() (line 795 of /var/www/cabinet/docroot/sites/all/modules/tap-cms/modules/tap/tap.module).

Now up until this morning, the tap web app was displaying the tours just fine and it would show up as desired without any issues.

We added a few custom fields alongside the default Web Stop and Image Stop content types but they do not appear to export to tourml xml as well. We tried using both 'tourml asset' and 'tourml property' and it still gives us above errors.

Our goal is to create a tourml file that gets loaded up in the tap web app display which ALSO displays custom fields we have added. Could you please give us a method to do so?

Thanks,

kjaebker commented 9 years ago

Could you give me some more detail on the custom fields that you added... what type of fields are they?

prash-nk commented 9 years ago

screen shot 2015-01-28 at 2 43 19 pm Just adding a simple Field collection image asset field for the web stop content type where we want it to display an image on the web app. It does not seem to show any images in the web app preview of the site. In fact I don't think its exporting the data from this field to the xml file. This is where the errors are coming in. I've attached a screenshot of the other site we are currently working on, that has more than the usual fields for web stop, which also doesn't export anything but a blank xml file.

Is this correct for the tourml xml export? screen shot 2015-01-28 at 3 18 55 pm

kjaebker commented 9 years ago

ok, we just took a look and think there is a bug when trying to view the TourML from a specific stop. Does it work if you do it from the Tour that contains these stops?

prash-nk commented 9 years ago

Yes the web app view seems to display the tours just fine, specific stop web app view seems to spew out the errors and blank xml files. Is that normal behavior or is this a bug?

kjaebker commented 9 years ago

Sounds like this is a bug. I know that used to be functionality that a worked.

prash-nk commented 9 years ago

I'll be happy to provide more info if you'd like to look into it, maybe see if theres a solution or a fix for it.

We'd like to have a tourml file that the tap web app picks up the needed items to display the tour and also include additional items that aren't exactly used in the tour but metadata we'd like to have additionally in the tourml xml file. Is this possible?

kjaebker commented 9 years ago

Yes it is possible and I think you are actually getting the extra fields in the TourML. You just have to view the TourML from the Tour node and not the individual stops. On the individual stop nodes the TourML is erring out, but if your webapp is working the TourML generation for the tour is working and should have the custom fields.

prash-nk commented 9 years ago

I took a look at the tourml export option for that above mentioned screenshot fields, while the "Validate" tab gives me a "Error 1872: The document has no document element. on line 0" error, I generated a zip file via export tab, and I see the following:

screen shot 2015-01-28 at 4 44 14 pm

I believe those NUL NUL might be cause of my issues in this particular site. Are you able to pick out where these NUL symbols might be coming from?

kjaebker commented 9 years ago

I have never seen that before... did you add any fields to the Tour node type? Based on the location of those inside of the TourMetadata it makes me think there is something wrong in the tour processing.

kjaebker commented 9 years ago

@tokersey just committed a fix for generating the TourML from a stop, so give those changes a try and let us know if that fixed it for you.

prash-nk commented 9 years ago

@kjaebker Awesome that fixed the individual stops xml errors. And I do see that custom fields are getting exported properly. I checked the tour content type and it does not seem like there are any additional fields in that. I am however having the following issues when I try to validate a tour node:

Error 1871: Element '{http://tapintomuseums.org/TourML}RootStopRef': This element is not expected. Expected is one of ( {http://tapintomuseums.org/TourML}AppResource, {http://tapintomuseums.org/TourML}PropertySet ). in /var/www/cabinet/docroot/ on line 13

The tap web app view shows 'select a tour' with a blank white page underneath. Seems its not picking up any of the stops listed. Maybe the hierarchy I have is wrong? I was under the impression that the following is how things are nested:

-| Tour Sets --| Tours ---| Stop Groups ----| Stops

Is this correct?

Also unrelated: What is the default Stop Connection Field setting normally set to? I'm not using any connections currently but it seems the module requires something to be selected here.

prash-nk commented 9 years ago

Currently, both of my tourml related sites are displaying the Tour just fine, clicking through will take me to a 'select a stop' screen, where there are no stops listed. If I set a root stop, the tour stops working and gives above error. Basically the tour stop content types now validate and export xml just fine, they just don't show up on the tap-web-app view.

Any ideas?

kjaebker commented 9 years ago

the root stop issue sounds like a bug. As for no stops showing up, the default is to only show stops that have codes, do you have any with stop codes attached to them?

Also, for the Stop Connection you will want to set that up to field_tour for things to work properly.

prash-nk commented 9 years ago

Currently all stops have codes associated with them. One site has 0, 1, 2, 3, etc. and other site has 100, 101, 102, 103 etc.

Are all stops REQUIRED to have a location field attached to it?

kjaebker commented 9 years ago

no, location is only required for the map display

prash-nk commented 9 years ago

Success! Both sites are displaying stop group and stops as expected!

Thanks for all your help Kyle, you've been very patient with all these issues we're having.

prash-nk commented 9 years ago

@kjaebker Updated my last post to say things are exporting smoothly, only thing I cannot see is how to display some of the extra fields that are in the xml to show up in edited default stops.

For example, I want an image to display in the web stop, so I added an image field (exact same settings as one in image stop) to the web stop content type. It exports in the xml just fine and displays in drupal node view just fine, however the web stop content type does not display the image (or the description text content) in the tap-web-app. Any ideas?

kjaebker commented 9 years ago

ok, so first off... the code comes through as a property not an asset.

The web app stop listing has two different display modes. You can either have it display stop groups or all stops with codes. This has to be set within the javascript config.js file. So if you want to show all codes with stops update the config.js file to include the following:

navigationControllers: {
        'StopListView': {
            label: 'Stop Menu',
            filterBy: 'code',
            sortBy: 'code',
            displayCodes: false
        }
}

You should see in that file where the navigationControllers gets set (it has an empty object by default).

As for the additional fields, those are not automatically displayed in the web app. The code reads in the TourML and we have coded the different stop types to know how to display their default fields. If you add a custom field it will require editing the javascript for that View and probably the template for it as well.

prash-nk commented 9 years ago

If you add a custom field it will require editing the javascript for that View and probably the template for it as well.

AHA! This is what I was not understanding. I was under the impression that it would spit out all the data automagically. Silly line of thinking I realize now. I'll edit the views and template and have the data display. Thank you so much.