talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

Local Schema Extension: adding a new <xs:element> in <xs:complexType>

RL
Ray Lee
Wed, Aug 1, 2012 7:14 PM

Correction, I meant to say record.html is in the app cache. That's the file where you'd want to add the script tag.

Thanks,
Ray

On Aug 1, 2012, at 12:12 PM, Ray Lee wrote:

Hi Sébastien,
You probably weren't able to see the script you added to cataloging.html, because that file is cached in the app cache. Just clearing the "normal" cache in the browser isn't enough. You have to take an extra step to clear the app cache, in both Chrome and Firefox. Here are instructions for doing that:

https://developer.mozilla.org/en/Offline_resources_in_Firefox/#Storage_location_and_clearing_the_offline_cache

And here are instructions for configuring which cspace files go into the app cache, and forcing the browser to reload files in the app cache, if you make a modification:

http://wiki.collectionspace.org/display/UNRELEASED/How+to+Update+UI+Files+that+are+in+the+Offline+Application+Cache

Thanks,
Ray

On Aug 1, 2012, at 8:04 AM, Jesse Martinez wrote:

Hi Sébastien,

I went through something similar a few weeks ago where I wanted to modify the Structured Date widget for a custom tenant.

Here's the thread from the discussion from the Talk list
http://lists.collectionspace.org/pipermail/talk_lists.collectionspace.org/2012-June/000834.html

What I ended up coming up with was to modify the StructuredDate.js with my slight modifications appended. (Since creating a new StructuredDateMMI.js file would have been a bit more work.)

It's not the best code since it's repetitive and needs to be refactored. Feel free to view the code:
https://github.com/jessemartinez/ui/blob/MMI-13/src/main/webapp/tenants/mmi/js/StructuredDate.js

It's also necessary to modify the application layer's configuration for that specific structured date field. For instance I made a modification for the structured date field in the Person authority record that references the component I created in StructuredDate.js
https://github.com/jessemartinez/application/blob/MMI-12/tomcat-main/src/main/resources/tenants/mmi/local-authority-person.xml#L50

Hope this helps,

  • Jesse

On Wed, Aug 1, 2012 at 10:38 AM, Sébastien Brossard Sebastien.Brossard@smk.dk wrote:
Hi all,

You can forget my previous messages, they’re out of date, sooo this morning.

Chris is back from holidays and he’s been a huge help.

But even if we’re getting closer, SMK’s fields still can’t be saved.

The new conf is:

·        In “services/…/ nuxeo-platform-collectionobject-smk/…/shemas/ collectionobjects_smk.xsd”:

<xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/>

<xs:complexType name="structuredDateGroupSMK">

xs:sequence

<xs:element name="dateSMKDisplayText" type="xs:string"/>

     </xs:sequence>

</xs:complexType>

·        In “application/…/tenant/smk/ base-other-structureddateSMK.xml”:

<record id="structureddateSMK" in-recordlist="no" separate-record="false">
             <section>

                             <field id="dateSMKDisplayText">

                  <selector>dateSMKDisplayText</selector>

                           <preselector></preselector>

                 </field>                                                                

             </section>

         </record>

·        In “application/…/tenant/smk-tenant.xml”:

We added this line:

<include src="base-other-structureddateSMK.xml"/>

·        In “application/…/tenant/smk/ base-collectionobject.xml”:

We copied the defaut base-collectionobject.xml  and we added this field:

<field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK"

     primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDate">



     <services-tag>contentDateSMKGroup</services-tag>

     <selector>object-description-content-date-smk</selector>
</field>

·        In “ui/…/tenants/smk/html/pages/cataloging.html”

We copied default file and added this field to default file’s content:

<input type="text" class="csc-object-description-content-date-smk" />

·        In “ui/…/tenants/smk/js/StructuredDate.js” AND in “ui/…/tenants/smk/html/component/StructuredDate.html”

We copied default file and added our dateSMKDisplayText to default file’s content

è So the result is now, that in a new record page, we can see our dateSMKDisplayText field in content-structureddate, we can write a value, and when we re-open the content-structureddate, the value is still there.

But it’s not saved when the button is pressed.

Present questions are now:

·        We wondered about creating a new StructuredDateSMK.js and StructuredDateSMK.html, but it was impossible to insert a new <script type="text/javascript" src="../js/StructuredDateSMK.js"></script> in cataloging.html ??

Even after adding this line in record.html and template.html, StructuredDateSMK.js doesn’t show up in cataloging.html. To be exact: we can see in the source code of the page, but not in firebugs (after cleaning the cache, of course).

·        How does ui-func work in “application/…/tenant/smk/ base-collectionobject.xml” ?

We tried to change its value to "cspace.structuredDateSMK"  and doing subsequent changes in “ui/…/StructuredDate.js” and “”ui/…/Demands.js”, but without success: cataloging.html is not loading.

Thank you again for your kindly help, and have a nice day!

Best regards,

Sébastien

Fra: Sébastien Brossard
Sendt: 1. august 2012 08:58
Til: 'talk@lists.collectionspace.org'
Emne: VS: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Hi all,

I re-send the mail below, Chris told me it hasn’t reached him on the talk@list

Br,

Sébastien

Fra: Sébastien Brossard
Sendt: 30. juli 2012 16:43
Til: 'Patrick Schmitz'; 'Aron Roberts'; 'Ray Lee'
Cc: talk@lists.collectionspace.org
Emne: SV: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Dear all,

Setting up of the service was easily achieved, and REST tests are successful with the following configuration :

·        In “services/…/ nuxeo-platform-collectionobject-smk/…/shemas/ collectionobjects_smk.xsd”:

<xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/>

<xs:complexType name="structuredDateGroupSMK">

xs:sequence

<xs:element name="dateSMKDisplayText" type="xs:string"/>

<xs:element name="dateSMKDateDay" type="xs:string"/>

         <xs:element name="dateSMKDateMonth" type="xs:string"/>

         <xs:element name="dateSMKDateYear" type="xs:string"/>

         <xs:element name="dateSMKEraSelector" type="xs:string"/>

         <xs:element name="dateSMKSecondDateDay" type="xs:string"/>

         <xs:element name="dateSMKSecondDateMonth" type="xs:string"/>

         <xs:element name="dateSMKSecondDateYear" type="xs:string"/>

         <xs:element name="dateSMKSecondEraSelector" type="xs:string"/>           

         <xs:element name="dateSMKThirdDateDay" type="xs:string"/>

         <xs:element name="dateSMKThirdDateMonth" type="xs:string"/>

         <xs:element name="dateSMKThirdDateYear" type="xs:string"/>

         <xs:element name="dateSMKThirdEraSelector" type="xs:string"/>           

         <xs:element name="dateSMKSegmentSelector" type="xs:string"/>

         <xs:element name="dateSMKTypeSelector" type="xs:string"/>                

     </xs:sequence>

 </xs:complexType>

(as you’ll have noticed, I’m actually trying to add more than one field in structuredDate)

… but I’m unable to have the application layer working properly.

I’ve made many many many attempts, but I think the most significant are (n.b. as to simplify things, I reduced my new fields to one during those tries ):

·        Test1:

In “application/…/tenant/smk/ base-other-structureddate.xml”:

<record id="structureddateSMK" in-recordlist="no" separate-record="false">
             <section>                                                                            

                 

<xs:element name="dateSMKDisplayText" type="xs:string"/>

             </section>
</record>

àResulting ERROR MESSAGE when loading “cataloging.html”: “Error fetching ../../../tenant/smk/composite: error”

·        Test2

In “application/…/tenant/smk/ base-other-structureddate.xml”:

<record id="structureddate" in-recordlist="no" separate-record="false">
             <section>                                                                            

                 

<xs:element name="dateSMKDisplayText" type="xs:string"/>

             </section>
</record>

·        Test3: same as above + add all the fields from the core base-other-structureddate.xml

IN BOTH CASES (Test2 & Test3):

àResulting ERROR MESSAGE when saving a new cataloging record: “Cannot set IS_REMOVED on removed or properties that are not map elements”

·        Test4: I re-did Test1 & Test2 & Test3 + changed <services-tag> to contentDateGroupSMK in “application/…/default/ base-other-structureddate.xml”

àERROR ERROR ERROR

I also sniffed data sent to the application and retrieved the JASON (at least I think it is JASON) packet: I found here my SMK fields, but other time also the original fields – I must admit I didn’t really understand how JASON packets are created.

I’m running out of ideas soon - hoping for a kind of clairvoyant revelation tonight?

In case it doesn’t come, any suggestion would be a huge help!!

Thank you by advance.

Best regards,

Sébastien

Ps: I forgot to say in my previous message: I’m currently working with CS v2.3

Fra: Patrick Schmitz [mailto:pschmitz@berkeley.edu]
Sendt: 25. juli 2012 02:10
Til: 'Aron Roberts'; 'Ray Lee'
Cc: talk@lists.collectionspace.org; Sébastien Brossard
Emne: RE: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

As to the app layer support for structured dates, it should actually work okay. The tenant override will inject the new field(s) into the base-other-structureddate definition. It is a sub-record, so it is actually somewhat more flexible in some ways that other repeating groups. I think that the app layer logic will be okay if you just add fields.

You may have to change the way you declare it when it occurs in other records, but we'll cross that bridge we get to it.

As Ray says, get the services working, and we'll help from there.

Patrick

From: talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Aron Roberts
Sent: Tuesday, July 24, 2012 4:39 PM
To: Ray Lee
Cc: talk@lists.collectionspace.org; Sébastien Brossard
Subject: Re: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Ray wrote:

The new app layer merge stuff really needs to get documented.

Agreed completely, Ray.  These's a JIRA issue to begin documenting this:
http://issues.collectionspace.org/browse/CSPACE-5070

This should get done in either the Doc5 sprint (currently ongoing) or if not by then, by no later than the next one (Doc6); it's a huge priority.

Aron

On Tue, Jul 24, 2012 at 3:52 PM, Ray Lee rhlee@berkeley.edu wrote:

Hi Sébastien,

I think what you're trying to do is going to end up being quite complex, so you haven't missed anything. In the services layer, I think you're right to create a new complex type (structuredDateGroupSMK) in your local schema. The structuredDateGroupSMK type would be identical to structuredDateGroup from the common schema, except for the addition of your new field (dateSMKDisplayText). You won't be able to change existing fields in the common schema to be structuredDateGroupSMK instead of structuredDateGroup. You'll have to create new fields in the local schema that have type structuredDateGroupSMK, and use these new fields as replacements for the ones in the common schema.

As a first step, I would create a new field of type structuredDateGroupSMK in your local schema, and use the REST API to read and write that field. Then you'll know that the services layer is configured properly. Then you can move on to the app layer. I'm not sure if you can make this work entirely through xml configuration. This may require modification to the app layer's java code, because there's some special handling for structured dates in there.

The lifesci tenant is using a new (as of 2.3) way of configuring the app layer that potentially makes things easier, but you don't have to use it. The way you've been doing it still works. The new app layer merge stuff really needs to get documented.

If you get the services layer working, let us know. I might be able to help more with the app layer.

Thanks,

Ray

On Jul 23, 2012, at 1:13 AM, Sébastien Brossard wrote:

Dear all,

I’m currently trying to add some customized fields in the frame of SMK’s Local Schema Extension.

As a first try, I could successfully add a new xs:element in the domain-collectionobject,

(I added two files in SMK’s tenant:

  • services/…/ nuxeo-platform-collectionobject-smk/…/shemas/ collectionobjects_smk.xsd

  • application/…/tenant/smk/ domain-collectionobject.xml

  • modified my ui so that to show my new field. It worked fine, showed and saved field’s value.)

But here it’s a bit more complex : I would like to add some fields in the StructuredDate component.

More precisely, I want to add a new xs:element (dateSMKDisplayText) in <xs:complexType name="structuredDateGroup">

·        I tried by many many ways to add my new element in the existing structuredDateGroup via SMK’s tenant, without any success.

·        Looking at the lifesci example, I tried to create a new complex type “structuredDateGroupSMK” (which means that I had to create a new xs:element who supports this new complex type ), but:

o  In lifesci-tenant.xml there’s a merging function that I don’t know nothing about (<include src="base-collectionobject.xml,naturalhistory-collectionobject.xml" merge="xmlmerge.properties"/>), which confused me.

o  structuredDateGroup is used in many places in the code, which means that I should replace it in numerous places in the code – which I think is not a brilliant idea.

It seems a bit too much complex, so I suppose I missed a simpler way to achieve this.

Thank you by advance for your kindly help and tips.

Best regards,

Sébastien

Sébastien Brossard

IT-Udvikler

sebastien.brossard@smk.dk

T +45 3374 8483

Statens Museum for Kunst

Sølvgade 48-50

DK—1307 København K

T +45 3374 8494

F +45 3374 8404

smk.dk

<image004.jpg>

Sébastien Brossard

IT-Udvikler

sebastien.brossard@smk.dk

T +45 3374 8483

Statens Museum for Kunst

Sølvgade 48-50

DK—1307 København K

T +45 3374 8494

F +45 3374 8404

smk.dk

<image005.jpg>


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

Correction, I meant to say record.html is in the app cache. That's the file where you'd want to add the script tag. Thanks, Ray On Aug 1, 2012, at 12:12 PM, Ray Lee wrote: > Hi Sébastien, > You probably weren't able to see the script you added to cataloging.html, because that file is cached in the app cache. Just clearing the "normal" cache in the browser isn't enough. You have to take an extra step to clear the app cache, in both Chrome and Firefox. Here are instructions for doing that: > > https://developer.mozilla.org/en/Offline_resources_in_Firefox/#Storage_location_and_clearing_the_offline_cache > > And here are instructions for configuring which cspace files go into the app cache, and forcing the browser to reload files in the app cache, if you make a modification: > > http://wiki.collectionspace.org/display/UNRELEASED/How+to+Update+UI+Files+that+are+in+the+Offline+Application+Cache > > Thanks, > Ray > > > On Aug 1, 2012, at 8:04 AM, Jesse Martinez wrote: > >> Hi Sébastien, >> >> I went through something similar a few weeks ago where I wanted to modify the Structured Date widget for a custom tenant. >> >> Here's the thread from the discussion from the Talk list >> http://lists.collectionspace.org/pipermail/talk_lists.collectionspace.org/2012-June/000834.html >> >> What I ended up coming up with was to modify the StructuredDate.js with my slight modifications appended. (Since creating a new StructuredDateMMI.js file would have been a bit more work.) >> >> It's not the best code since it's repetitive and needs to be refactored. Feel free to view the code: >> https://github.com/jessemartinez/ui/blob/MMI-13/src/main/webapp/tenants/mmi/js/StructuredDate.js >> >> It's also necessary to modify the application layer's configuration for that specific structured date field. For instance I made a modification for the structured date field in the Person authority record that references the component I created in StructuredDate.js >> https://github.com/jessemartinez/application/blob/MMI-12/tomcat-main/src/main/resources/tenants/mmi/local-authority-person.xml#L50 >> >> Hope this helps, >> >> - Jesse >> >> On Wed, Aug 1, 2012 at 10:38 AM, Sébastien Brossard <Sebastien.Brossard@smk.dk> wrote: >> Hi all, >> >> >> >> You can forget my previous messages, they’re out of date, sooo this morning. >> >> >> >> Chris is back from holidays and he’s been a huge help. >> >> But even if we’re getting closer, SMK’s fields still can’t be saved. >> >> >> >> The new conf is: >> >> >> >> · In “services/…/ nuxeo-platform-collectionobject-smk/…/shemas/ collectionobjects_smk.xsd”: >> >> >> >> <xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/> >> >> >> >> <xs:complexType name="structuredDateGroupSMK"> >> >> <xs:sequence> >> >> <xs:element name="dateSMKDisplayText" type="xs:string"/> >> >> </xs:sequence> >> >> </xs:complexType> >> >> >> >> >> >> >> · In “application/…/tenant/smk/ base-other-structureddateSMK.xml”: >> >> <record id="structureddateSMK" in-recordlist="no" separate-record="false"> >> >> <section> >> >> <field id="dateSMKDisplayText"> >> >> <selector>dateSMKDisplayText</selector> >> >> <preselector></preselector> >> >> </field> >> >> </section> >> >> </record> >> >> >> >> · In “application/…/tenant/smk-tenant.xml”: >> >> We added this line: >> >> <include src="base-other-structureddateSMK.xml"/> >> >> >> >> · In “application/…/tenant/smk/ base-collectionobject.xml”: >> >> We copied the defaut base-collectionobject.xml and we added this field: >> >> >> >> <field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK" >> >> primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDate"> >> >> >> >> <services-tag>contentDateSMKGroup</services-tag> >> >> <selector>object-description-content-date-smk</selector> >> >> </field> >> >> >> >> · In “ui/…/tenants/smk/html/pages/cataloging.html” >> >> We copied default file and added this field to default file’s content: >> >> >> >> <input type="text" class="csc-object-description-content-date-smk" /> >> >> >> >> · In “ui/…/tenants/smk/js/StructuredDate.js” AND in “ui/…/tenants/smk/html/component/StructuredDate.html” >> >> We copied default file and added our dateSMKDisplayText to default file’s content >> >> >> >> >> >> è So the result is now, that in a new record page, we can see our dateSMKDisplayText field in content-structureddate, we can write a value, and when we re-open the content-structureddate, the value is still there. >> >> >> >> But it’s not saved when the button is pressed. >> >> >> >> >> >> >> >> Present questions are now: >> >> · We wondered about creating a new StructuredDateSMK.js and StructuredDateSMK.html, but it was impossible to insert a new <script type="text/javascript" src="../js/StructuredDateSMK.js"></script> in cataloging.html ?? >> >> Even after adding this line in record.html and template.html, StructuredDateSMK.js doesn’t show up in cataloging.html. To be exact: we can see in the source code of the page, but not in firebugs (after cleaning the cache, of course). >> >> >> >> · How does ui-func work in “application/…/tenant/smk/ base-collectionobject.xml” ? >> >> We tried to change its value to "cspace.structuredDateSMK" and doing subsequent changes in “ui/…/StructuredDate.js” and “”ui/…/Demands.js”, but without success: cataloging.html is not loading. >> >> >> >> Thank you again for your kindly help, and have a nice day! >> >> >> >> Best regards, >> >> >> Sébastien >> >> >> >> Fra: Sébastien Brossard >> Sendt: 1. august 2012 08:58 >> Til: 'talk@lists.collectionspace.org' >> Emne: VS: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> >> >> >> >> Hi all, >> >> >> >> I re-send the mail below, Chris told me it hasn’t reached him on the talk@list >> >> >> >> Br, >> >> Sébastien >> >> >> >> Fra: Sébastien Brossard >> Sendt: 30. juli 2012 16:43 >> Til: 'Patrick Schmitz'; 'Aron Roberts'; 'Ray Lee' >> Cc: talk@lists.collectionspace.org >> Emne: SV: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> >> >> >> >> Dear all, >> >> >> >> Setting up of the service was easily achieved, and REST tests are successful with the following configuration : >> >> >> >> · In “services/…/ nuxeo-platform-collectionobject-smk/…/shemas/ collectionobjects_smk.xsd”: >> >> >> >> <xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/> >> >> >> >> <xs:complexType name="structuredDateGroupSMK"> >> >> <xs:sequence> >> >> <xs:element name="dateSMKDisplayText" type="xs:string"/> >> >> <xs:element name="dateSMKDateDay" type="xs:string"/> >> >> <xs:element name="dateSMKDateMonth" type="xs:string"/> >> >> <xs:element name="dateSMKDateYear" type="xs:string"/> >> >> <xs:element name="dateSMKEraSelector" type="xs:string"/> >> >> <xs:element name="dateSMKSecondDateDay" type="xs:string"/> >> >> <xs:element name="dateSMKSecondDateMonth" type="xs:string"/> >> >> <xs:element name="dateSMKSecondDateYear" type="xs:string"/> >> >> <xs:element name="dateSMKSecondEraSelector" type="xs:string"/> >> >> <xs:element name="dateSMKThirdDateDay" type="xs:string"/> >> >> <xs:element name="dateSMKThirdDateMonth" type="xs:string"/> >> >> <xs:element name="dateSMKThirdDateYear" type="xs:string"/> >> >> <xs:element name="dateSMKThirdEraSelector" type="xs:string"/> >> >> <xs:element name="dateSMKSegmentSelector" type="xs:string"/> >> >> <xs:element name="dateSMKTypeSelector" type="xs:string"/> >> >> </xs:sequence> >> >> </xs:complexType> >> >> >> >> >> >> (as you’ll have noticed, I’m actually trying to add more than one field in structuredDate) >> >> >> >> >> >> … but I’m unable to have the application layer working properly. >> >> I’ve made many many many attempts, but I think the most significant are (n.b. as to simplify things, I reduced my new fields to one during those tries ): >> >> >> >> · Test1: >> >> In “application/…/tenant/smk/ base-other-structureddate.xml”: >> >> >> >> <record id="structureddateSMK" in-recordlist="no" separate-record="false"> >> >> <section> >> >> >> >> <xs:element name="dateSMKDisplayText" type="xs:string"/> >> >> >> >> </section> >> >> </record> >> >> >> >> >> >> àResulting ERROR MESSAGE when loading “cataloging.html”: “Error fetching ../../../tenant/smk/composite: error” >> >> >> >> >> >> >> >> · Test2 >> >> >> >> In “application/…/tenant/smk/ base-other-structureddate.xml”: >> >> >> >> <record id="structureddate" in-recordlist="no" separate-record="false"> >> >> <section> >> >> >> >> <xs:element name="dateSMKDisplayText" type="xs:string"/> >> >> >> >> </section> >> >> </record> >> >> >> >> · Test3: same as above + add all the fields from the core base-other-structureddate.xml >> >> >> >> IN BOTH CASES (Test2 & Test3): >> >> >> >> àResulting ERROR MESSAGE when saving a new cataloging record: “Cannot set IS_REMOVED on removed or properties that are not map elements” >> >> >> >> · Test4: I re-did Test1 & Test2 & Test3 + changed <services-tag> to contentDateGroupSMK in “application/…/default/ base-other-structureddate.xml” >> >> >> >> àERROR ERROR ERROR >> >> >> >> I also sniffed data sent to the application and retrieved the JASON (at least I think it is JASON) packet: I found here my SMK fields, but other time also the original fields – I must admit I didn’t really understand how JASON packets are created. >> >> >> >> >> >> I’m running out of ideas soon - hoping for a kind of clairvoyant revelation tonight? >> >> In case it doesn’t come, any suggestion would be a huge help!! >> >> >> >> Thank you by advance. >> >> >> >> Best regards, >> >> Sébastien >> >> Ps: I forgot to say in my previous message: I’m currently working with CS v2.3 >> >> >> >> >> >> >> >> Fra: Patrick Schmitz [mailto:pschmitz@berkeley.edu] >> Sendt: 25. juli 2012 02:10 >> Til: 'Aron Roberts'; 'Ray Lee' >> Cc: talk@lists.collectionspace.org; Sébastien Brossard >> Emne: RE: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> >> >> >> >> As to the app layer support for structured dates, it should actually work okay. The tenant override will inject the new field(s) into the base-other-structureddate definition. It is a sub-record, so it is actually somewhat more flexible in some ways that other repeating groups. I think that the app layer logic will be okay if you just add fields. >> >> >> >> You may have to change the way you declare it when it occurs in other records, but we'll cross that bridge we get to it. >> >> >> >> As Ray says, get the services working, and we'll help from there. >> >> >> >> Patrick >> >> >> >> From: talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Aron Roberts >> Sent: Tuesday, July 24, 2012 4:39 PM >> To: Ray Lee >> Cc: talk@lists.collectionspace.org; Sébastien Brossard >> Subject: Re: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> >> >> Ray wrote: >> > The new app layer merge stuff really needs to get documented. >> >> Agreed completely, Ray. These's a JIRA issue to begin documenting this: >> http://issues.collectionspace.org/browse/CSPACE-5070 >> >> This should get done in either the Doc5 sprint (currently ongoing) or if not by then, by no later than the next one (Doc6); it's a huge priority. >> >> Aron >> >> On Tue, Jul 24, 2012 at 3:52 PM, Ray Lee <rhlee@berkeley.edu> wrote: >> >> Hi Sébastien, >> >> I think what you're trying to do is going to end up being quite complex, so you haven't missed anything. In the services layer, I think you're right to create a new complex type (structuredDateGroupSMK) in your local schema. The structuredDateGroupSMK type would be identical to structuredDateGroup from the common schema, except for the addition of your new field (dateSMKDisplayText). You won't be able to change existing fields in the common schema to be structuredDateGroupSMK instead of structuredDateGroup. You'll have to create new fields in the local schema that have type structuredDateGroupSMK, and use these new fields as replacements for the ones in the common schema. >> >> >> >> As a first step, I would create a new field of type structuredDateGroupSMK in your local schema, and use the REST API to read and write that field. Then you'll know that the services layer is configured properly. Then you can move on to the app layer. I'm not sure if you can make this work entirely through xml configuration. This may require modification to the app layer's java code, because there's some special handling for structured dates in there. >> >> >> >> The lifesci tenant is using a new (as of 2.3) way of configuring the app layer that potentially makes things easier, but you don't have to use it. The way you've been doing it still works. The new app layer merge stuff really needs to get documented. >> >> >> >> If you get the services layer working, let us know. I might be able to help more with the app layer. >> >> >> >> Thanks, >> >> Ray >> >> >> >> >> >> >> >> >> >> >> >> On Jul 23, 2012, at 1:13 AM, Sébastien Brossard wrote: >> >> >> >> Dear all, >> >> I’m currently trying to add some customized fields in the frame of SMK’s Local Schema Extension. >> >> >> >> As a first try, I could successfully add a new <xs:element> in the domain-collectionobject, >> >> (I added two files in SMK’s tenant: >> >> * services/…/ nuxeo-platform-collectionobject-smk/…/shemas/ collectionobjects_smk.xsd >> >> * application/…/tenant/smk/ domain-collectionobject.xml >> >> + modified my ui so that to show my new field. It worked fine, showed and saved field’s value.) >> >> >> >> >> >> But here it’s a bit more complex : I would like to add some fields in the StructuredDate component. >> >> >> >> More precisely, I want to add a new <xs:element> (dateSMKDisplayText) in <xs:complexType name="structuredDateGroup"> >> >> >> >> · I tried by many many ways to add my new element in the existing structuredDateGroup via SMK’s tenant, without any success. >> >> >> >> · Looking at the lifesci example, I tried to create a new complex type “structuredDateGroupSMK” (which means that I had to create a new <xs:element> who supports this new complex type ), but: >> >> >> >> o In lifesci-tenant.xml there’s a merging function that I don’t know nothing about (<include src="base-collectionobject.xml,naturalhistory-collectionobject.xml" merge="xmlmerge.properties"/>), which confused me. >> >> o structuredDateGroup is used in many places in the code, which means that I should replace it in numerous places in the code – which I think is not a brilliant idea. >> >> >> >> It seems a bit too much complex, so I suppose I missed a simpler way to achieve this. >> >> >> >> Thank you by advance for your kindly help and tips. >> >> >> >> Best regards, >> >> Sébastien >> >> >> >> >> >> Sébastien Brossard >> >> IT-Udvikler >> >> sebastien.brossard@smk.dk >> >> T +45 3374 8483 >> >> >> >> Statens Museum for Kunst >> >> Sølvgade 48-50 >> >> DK—1307 København K >> >> T +45 3374 8494 >> >> F +45 3374 8404 >> >> smk.dk >> >> >> >> <image004.jpg> >> >> >> >> >> >> >> >> >> >> >> >> Sébastien Brossard >> >> IT-Udvikler >> >> sebastien.brossard@smk.dk >> >> T +45 3374 8483 >> >> >> >> Statens Museum for Kunst >> >> Sølvgade 48-50 >> >> DK—1307 København K >> >> T +45 3374 8494 >> >> F +45 3374 8404 >> >> smk.dk >> >> >> >> <image005.jpg> >> >> >> >> >> >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >> >> >> >> >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >> >> >> >> >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
SB
Sébastien Brossard
Thu, Aug 2, 2012 2:58 PM

Hi Ray and Jesse, dear all

Thank you for your quick answer.
Ray, you were right: it was an offline cache problem.

We get a step further here, a BIG step further: our new field can now be saved!
However we still have a problem interfacing fields in our new structuredData component with the UI. I hope it will be a quick fix.

I'll let you know as soon as it works in order to enhance our common knowledge database.

Best regards,
Sébastien

Fra: Ray Lee [mailto:rhlee@berkeley.edu]
Sendt: 1. august 2012 21:15
Til: Sébastien Brossard
Cc: talk@lists.collectionspace.org List
Emne: Re: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Correction, I meant to say record.html is in the app cache. That's the file where you'd want to add the script tag.

Thanks,
Ray

On Aug 1, 2012, at 12:12 PM, Ray Lee wrote:

Hi Sébastien,
You probably weren't able to see the script you added to cataloging.html, because that file is cached in the app cache. Just clearing the "normal" cache in the browser isn't enough. You have to take an extra step to clear the app cache, in both Chrome and Firefox. Here are instructions for doing that:

https://developer.mozilla.org/en/Offline_resources_in_Firefox/#Storage_location_and_clearing_the_offline_cache

And here are instructions for configuring which cspace files go into the app cache, and forcing the browser to reload files in the app cache, if you make a modification:

http://wiki.collectionspace.org/display/UNRELEASED/How+to+Update+UI+Files+that+are+in+the+Offline+Application+Cache

Thanks,
Ray

On Aug 1, 2012, at 8:04 AM, Jesse Martinez wrote:

Hi Sébastien,

I went through something similar a few weeks ago where I wanted to modify the Structured Date widget for a custom tenant.

Here's the thread from the discussion from the Talk list
http://lists.collectionspace.org/pipermail/talk_lists.collectionspace.org/2012-June/000834.html

What I ended up coming up with was to modify the StructuredDate.js with my slight modifications appended. (Since creating a new StructuredDateMMI.js file would have been a bit more work.)

It's not the best code since it's repetitive and needs to be refactored. Feel free to view the code:
https://github.com/jessemartinez/ui/blob/MMI-13/src/main/webapp/tenants/mmi/js/StructuredDate.js

It's also necessary to modify the application layer's configuration for that specific structured date field. For instance I made a modification for the structured date field in the Person authority record that references the component I created in StructuredDate.js
https://github.com/jessemartinez/application/blob/MMI-12/tomcat-main/src/main/resources/tenants/mmi/local-authority-person.xml#L50

Hope this helps,

You can forget my previous messages, they're out of date, sooo this morning.

Chris is back from holidays and he's been a huge help.
But even if we're getting closer, SMK's fields still can't be saved.

The new conf is:

  •     In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd":
    

<xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/>

<xs:complexType name="structuredDateGroupSMK">

xs:sequence

<xs:element name="dateSMKDisplayText" type="xs:string"/>

    </xs:sequence>

</xs:complexType>

  •     In "application/.../tenant/smk/ base-other-structureddateSMK.xml":
    
<record id="structureddateSMK" in-recordlist="no" separate-record="false">
            <section>

                            <field id="dateSMKDisplayText">

                 <selector>dateSMKDisplayText</selector>

                          <preselector></preselector>

                </field>

            </section>

        </record>
  •     In "application/.../tenant/smk-tenant.xml":
    

We added this line:

<include src="base-other-structureddateSMK.xml"/>
  •     In "application/.../tenant/smk/ base-collectionobject.xml":
    

We copied the defaut base-collectionobject.xml  and we added this field:

<field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK" primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDate">

    <services-tag>contentDateSMKGroup</services-tag>
    <selector>object-description-content-date-smk</selector>
</field>
  •     In "ui/.../tenants/smk/html/pages/cataloging.html"
    

We copied default file and added this field to default file's content:

<input type="text" class="csc-object-description-content-date-smk" />
  •     In "ui/.../tenants/smk/js/StructuredDate.js" AND in "ui/.../tenants/smk/html/component/StructuredDate.html"
    

We copied default file and added our dateSMKDisplayText to default file's content

==> So the result is now, that in a new record page, we can see our dateSMKDisplayText field in content-structureddate, we can write a value, and when we re-open the content-structureddate, the value is still there.

But it's not saved when the button is pressed.

Present questions are now:

  •     We wondered about creating a new StructuredDateSMK.js and StructuredDateSMK.html, but it was impossible to insert a new <script type="text/javascript" src="../js/StructuredDateSMK.js"></script> in cataloging.html ??
    

Even after adding this line in record.html and template.html, StructuredDateSMK.js doesn't show up in cataloging.html. To be exact: we can see in the source code of the page, but not in firebugs (after cleaning the cache, of course).

  •     How does ui-func work in "application/.../tenant/smk/ base-collectionobject.xml" ?
    

We tried to change its value to "cspace.structuredDateSMK"  and doing subsequent changes in "ui/.../StructuredDate.js" and ""ui/.../Demands.js", but without success: cataloging.html is not loading.

Thank you again for your kindly help, and have a nice day!

Best regards,

Sébastien

Fra: Sébastien Brossard
Sendt: 1. august 2012 08:58
Til: 'talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org'
Emne: VS: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Hi all,

I re-send the mail below, Chris told me it hasn't reached him on the talk@list

Br,
Sébastien

Fra: Sébastien Brossard
Sendt: 30. juli 2012 16:43
Til: 'Patrick Schmitz'; 'Aron Roberts'; 'Ray Lee'
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org
Emne: SV: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Dear all,

Setting up of the service was easily achieved, and REST tests are successful with the following configuration :

  •     In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd":
    

<xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/>

<xs:complexType name="structuredDateGroupSMK">

xs:sequence

<xs:element name="dateSMKDisplayText" type="xs:string"/>

<xs:element name="dateSMKDateDay" type="xs:string"/>

        <xs:element name="dateSMKDateMonth" type="xs:string"/>

        <xs:element name="dateSMKDateYear" type="xs:string"/>

        <xs:element name="dateSMKEraSelector" type="xs:string"/>

        <xs:element name="dateSMKSecondDateDay" type="xs:string"/>

        <xs:element name="dateSMKSecondDateMonth" type="xs:string"/>

        <xs:element name="dateSMKSecondDateYear" type="xs:string"/>

        <xs:element name="dateSMKSecondEraSelector" type="xs:string"/>

        <xs:element name="dateSMKThirdDateDay" type="xs:string"/>

        <xs:element name="dateSMKThirdDateMonth" type="xs:string"/>

        <xs:element name="dateSMKThirdDateYear" type="xs:string"/>

        <xs:element name="dateSMKThirdEraSelector" type="xs:string"/>

        <xs:element name="dateSMKSegmentSelector" type="xs:string"/>

        <xs:element name="dateSMKTypeSelector" type="xs:string"/>

    </xs:sequence>

</xs:complexType>

(as you'll have noticed, I'm actually trying to add more than one field in structuredDate)

... but I'm unable to have the application layer working properly.
I've made many many many attempts, but I think the most significant are (n.b. as to simplify things, I reduced my new fields to one during those tries ):

  •     Test1:
    

In "application/.../tenant/smk/ base-other-structureddate.xml":

<record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section>

<xs:element name="dateSMKDisplayText" type="xs:string"/>

            </section>
</record>

-->Resulting ERROR MESSAGE when loading "cataloging.html": "Error fetching ../../../tenant/smk/composite: error"

  •     Test2
    

In "application/.../tenant/smk/ base-other-structureddate.xml":

<record id="structureddate" in-recordlist="no" separate-record="false"> <section>

<xs:element name="dateSMKDisplayText" type="xs:string"/>

            </section>
</record>
  •     Test3: same as above + add all the fields from the core base-other-structureddate.xml
    

IN BOTH CASES (Test2 & Test3):

-->Resulting ERROR MESSAGE when saving a new cataloging record: "Cannot set IS_REMOVED on removed or properties that are not map elements"

  •     Test4: I re-did Test1 & Test2 & Test3 + changed <services-tag> to contentDateGroupSMK in "application/.../default/ base-other-structureddate.xml"
    

-->ERROR ERROR ERROR

I also sniffed data sent to the application and retrieved the JASON (at least I think it is JASON) packet: I found here my SMK fields, but other time also the original fields - I must admit I didn't really understand how JASON packets are created.

I'm running out of ideas soon - hoping for a kind of clairvoyant revelation tonight?
In case it doesn't come, any suggestion would be a huge help!!

Thank you by advance.

Best regards,
Sébastien
Ps: I forgot to say in my previous message: I'm currently working with CS v2.3

Fra: Patrick Schmitz [mailto:pschmitz@berkeley.edu]mailto:[mailto:pschmitz@berkeley.edu]
Sendt: 25. juli 2012 02:10
Til: 'Aron Roberts'; 'Ray Lee'
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org; Sébastien Brossard
Emne: RE: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

As to the app layer support for structured dates, it should actually work okay. The tenant override will inject the new field(s) into the base-other-structureddate definition. It is a sub-record, so it is actually somewhat more flexible in some ways that other repeating groups. I think that the app layer logic will be okay if you just add fields.

You may have to change the way you declare it when it occurs in other records, but we'll cross that bridge we get to it.

As Ray says, get the services working, and we'll help from there.

Patrick


From: talk-bounces@lists.collectionspace.orgmailto:talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org]mailto:[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Aron Roberts
Sent: Tuesday, July 24, 2012 4:39 PM
To: Ray Lee
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org; Sébastien Brossard
Subject: Re: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType
Ray wrote:

The new app layer merge stuff really needs to get documented.

Agreed completely, Ray.  These's a JIRA issue to begin documenting this:
http://issues.collectionspace.org/browse/CSPACE-5070

This should get done in either the Doc5 sprint (currently ongoing) or if not by then, by no later than the next one (Doc6); it's a huge priority.

Aron
On Tue, Jul 24, 2012 at 3:52 PM, Ray Lee <rhlee@berkeley.edumailto:rhlee@berkeley.edu> wrote:
Hi Sébastien,
I think what you're trying to do is going to end up being quite complex, so you haven't missed anything. In the services layer, I think you're right to create a new complex type (structuredDateGroupSMK) in your local schema. The structuredDateGroupSMK type would be identical to structuredDateGroup from the common schema, except for the addition of your new field (dateSMKDisplayText). You won't be able to change existing fields in the common schema to be structuredDateGroupSMK instead of structuredDateGroup. You'll have to create new fields in the local schema that have type structuredDateGroupSMK, and use these new fields as replacements for the ones in the common schema.

As a first step, I would create a new field of type structuredDateGroupSMK in your local schema, and use the REST API to read and write that field. Then you'll know that the services layer is configured properly. Then you can move on to the app layer. I'm not sure if you can make this work entirely through xml configuration. This may require modification to the app layer's java code, because there's some special handling for structured dates in there.

The lifesci tenant is using a new (as of 2.3) way of configuring the app layer that potentially makes things easier, but you don't have to use it. The way you've been doing it still works. The new app layer merge stuff really needs to get documented.

If you get the services layer working, let us know. I might be able to help more with the app layer.

Thanks,
Ray

On Jul 23, 2012, at 1:13 AM, Sébastien Brossard wrote:

Dear all,
I'm currently trying to add some customized fields in the frame of SMK's Local Schema Extension.

As a first try, I could successfully add a new xs:element in the domain-collectionobject,
(I added two files in SMK's tenant:

  • services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd
  • application/.../tenant/smk/ domain-collectionobject.xml
  • modified my ui so that to show my new field. It worked fine, showed and saved field's value.)

But here it's a bit more complex : I would like to add some fields in the StructuredDate component.

More precisely, I want to add a new xs:element (dateSMKDisplayText) in <xs:complexType name="structuredDateGroup">

  •     I tried by many many ways to add my new element in the existing structuredDateGroup via SMK's tenant, without any success.
    
  •     Looking at the lifesci example, I tried to create a new complex type "structuredDateGroupSMK" (which means that I had to create a new <xs:element> who supports this new complex type ), but:
    

o  In lifesci-tenant.xml there's a merging function that I don't know nothing about (<include src="base-collectionobject.xml,naturalhistory-collectionobject.xml" merge="xmlmerge.properties"/>), which confused me.
o  structuredDateGroup is used in many places in the code, which means that I should replace it in numerous places in the code - which I think is not a brilliant idea.

It seems a bit too much complex, so I suppose I missed a simpler way to achieve this.

Thank you by advance for your kindly help and tips.

Best regards,
Sébastien

Sébastien Brossard
IT-Udvikler
sebastien.brossard@smk.dkmailto:3sebastien.brossard@smk.dkT
Tmailto:3sebastien.brossard@smk.dkT +45 3374 8483tel:%2B45%203374%208483

Statens Museum for Kunst
Sølvgade 48-50
DK-1307 København K

T +45 3374 8494tel:%2B45%203374%208494
F +45 3374 8404tel:%2B45%203374%208404
smk.dkhttp://smk.dk/

<image004.jpg>

Sébastien Brossard
IT-Udvikler
sebastien.brossard@smk.dkmailto:3sebastien.brossard@smk.dkT
Tmailto:3sebastien.brossard@smk.dkT +45 3374 8483tel:%2B45%203374%208483

Statens Museum for Kunst
Sølvgade 48-50
DK-1307 København K

T +45 3374 8494tel:%2B45%203374%208494
F +45 3374 8404tel:%2B45%203374%208404
smk.dkhttp://smk.dk/

<image005.jpg>


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

Hi Ray and Jesse, dear all Thank you for your quick answer. Ray, you were right: it was an offline cache problem. We get a step further here, a BIG step further: our new field can now be saved! However we still have a problem interfacing fields in our new structuredData component with the UI. I hope it will be a quick fix. I'll let you know as soon as it works in order to enhance our common knowledge database. Best regards, Sébastien Fra: Ray Lee [mailto:rhlee@berkeley.edu] Sendt: 1. august 2012 21:15 Til: Sébastien Brossard Cc: talk@lists.collectionspace.org List Emne: Re: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Correction, I meant to say record.html is in the app cache. That's the file where you'd want to add the script tag. Thanks, Ray On Aug 1, 2012, at 12:12 PM, Ray Lee wrote: Hi Sébastien, You probably weren't able to see the script you added to cataloging.html, because that file is cached in the app cache. Just clearing the "normal" cache in the browser isn't enough. You have to take an extra step to clear the app cache, in both Chrome and Firefox. Here are instructions for doing that: https://developer.mozilla.org/en/Offline_resources_in_Firefox/#Storage_location_and_clearing_the_offline_cache And here are instructions for configuring which cspace files go into the app cache, and forcing the browser to reload files in the app cache, if you make a modification: http://wiki.collectionspace.org/display/UNRELEASED/How+to+Update+UI+Files+that+are+in+the+Offline+Application+Cache Thanks, Ray On Aug 1, 2012, at 8:04 AM, Jesse Martinez wrote: Hi Sébastien, I went through something similar a few weeks ago where I wanted to modify the Structured Date widget for a custom tenant. Here's the thread from the discussion from the Talk list http://lists.collectionspace.org/pipermail/talk_lists.collectionspace.org/2012-June/000834.html What I ended up coming up with was to modify the StructuredDate.js with my slight modifications appended. (Since creating a new StructuredDateMMI.js file would have been a bit more work.) It's not the best code since it's repetitive and needs to be refactored. Feel free to view the code: https://github.com/jessemartinez/ui/blob/MMI-13/src/main/webapp/tenants/mmi/js/StructuredDate.js It's also necessary to modify the application layer's configuration for that specific structured date field. For instance I made a modification for the structured date field in the Person authority record that references the component I created in StructuredDate.js https://github.com/jessemartinez/application/blob/MMI-12/tomcat-main/src/main/resources/tenants/mmi/local-authority-person.xml#L50 Hope this helps, - Jesse On Wed, Aug 1, 2012 at 10:38 AM, Sébastien Brossard <Sebastien.Brossard@smk.dk<mailto:Sebastien.Brossard@smk.dk>> wrote: Hi all, You can forget my previous messages, they're out of date, sooo this morning. Chris is back from holidays and he's been a huge help. But even if we're getting closer, SMK's fields still can't be saved. The new conf is: * In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd": <xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/> <xs:complexType name="structuredDateGroupSMK"> <xs:sequence> <xs:element name="dateSMKDisplayText" type="xs:string"/> </xs:sequence> </xs:complexType> * In "application/.../tenant/smk/ base-other-structureddateSMK.xml": <record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section> <field id="dateSMKDisplayText"> <selector>dateSMKDisplayText</selector> <preselector></preselector> </field> </section> </record> * In "application/.../tenant/smk-tenant.xml": We added this line: <include src="base-other-structureddateSMK.xml"/> * In "application/.../tenant/smk/ base-collectionobject.xml": We copied the defaut base-collectionobject.xml and we added this field: <field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK" primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDate"> <services-tag>contentDateSMKGroup</services-tag> <selector>object-description-content-date-smk</selector> </field> * In "ui/.../tenants/smk/html/pages/cataloging.html" We copied default file and added this field to default file's content: <input type="text" class="csc-object-description-content-date-smk" /> * In "ui/.../tenants/smk/js/StructuredDate.js" AND in "ui/.../tenants/smk/html/component/StructuredDate.html" We copied default file and added our dateSMKDisplayText to default file's content ==> So the result is now, that in a new record page, we can see our dateSMKDisplayText field in content-structureddate, we can write a value, and when we re-open the content-structureddate, the value is still there. But it's not saved when the button is pressed. Present questions are now: * We wondered about creating a new StructuredDateSMK.js and StructuredDateSMK.html, but it was impossible to insert a new <script type="text/javascript" src="../js/StructuredDateSMK.js"></script> in cataloging.html ?? Even after adding this line in record.html and template.html, StructuredDateSMK.js doesn't show up in cataloging.html. To be exact: we can see in the source code of the page, but not in firebugs (after cleaning the cache, of course). * How does ui-func work in "application/.../tenant/smk/ base-collectionobject.xml" ? We tried to change its value to "cspace.structuredDateSMK" and doing subsequent changes in "ui/.../StructuredDate.js" and ""ui/.../Demands.js", but without success: cataloging.html is not loading. Thank you again for your kindly help, and have a nice day! Best regards, Sébastien Fra: Sébastien Brossard Sendt: 1. august 2012 08:58 Til: 'talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org>' Emne: VS: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Hi all, I re-send the mail below, Chris told me it hasn't reached him on the talk@list Br, Sébastien Fra: Sébastien Brossard Sendt: 30. juli 2012 16:43 Til: 'Patrick Schmitz'; 'Aron Roberts'; 'Ray Lee' Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org> Emne: SV: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Dear all, Setting up of the service was easily achieved, and REST tests are successful with the following configuration : * In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd": <xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/> <xs:complexType name="structuredDateGroupSMK"> <xs:sequence> <xs:element name="dateSMKDisplayText" type="xs:string"/> <xs:element name="dateSMKDateDay" type="xs:string"/> <xs:element name="dateSMKDateMonth" type="xs:string"/> <xs:element name="dateSMKDateYear" type="xs:string"/> <xs:element name="dateSMKEraSelector" type="xs:string"/> <xs:element name="dateSMKSecondDateDay" type="xs:string"/> <xs:element name="dateSMKSecondDateMonth" type="xs:string"/> <xs:element name="dateSMKSecondDateYear" type="xs:string"/> <xs:element name="dateSMKSecondEraSelector" type="xs:string"/> <xs:element name="dateSMKThirdDateDay" type="xs:string"/> <xs:element name="dateSMKThirdDateMonth" type="xs:string"/> <xs:element name="dateSMKThirdDateYear" type="xs:string"/> <xs:element name="dateSMKThirdEraSelector" type="xs:string"/> <xs:element name="dateSMKSegmentSelector" type="xs:string"/> <xs:element name="dateSMKTypeSelector" type="xs:string"/> </xs:sequence> </xs:complexType> (as you'll have noticed, I'm actually trying to add more than one field in structuredDate) ... but I'm unable to have the application layer working properly. I've made many many many attempts, but I think the most significant are (n.b. as to simplify things, I reduced my new fields to one during those tries ): * Test1: In "application/.../tenant/smk/ base-other-structureddate.xml": <record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section> <xs:element name="dateSMKDisplayText" type="xs:string"/> </section> </record> -->Resulting ERROR MESSAGE when loading "cataloging.html": "Error fetching ../../../tenant/smk/composite: error" * Test2 In "application/.../tenant/smk/ base-other-structureddate.xml": <record id="structureddate" in-recordlist="no" separate-record="false"> <section> <xs:element name="dateSMKDisplayText" type="xs:string"/> </section> </record> * Test3: same as above + add all the fields from the core base-other-structureddate.xml IN BOTH CASES (Test2 & Test3): -->Resulting ERROR MESSAGE when saving a new cataloging record: "Cannot set IS_REMOVED on removed or properties that are not map elements" * Test4: I re-did Test1 & Test2 & Test3 + changed <services-tag> to contentDateGroupSMK in "application/.../default/ base-other-structureddate.xml" -->ERROR ERROR ERROR I also sniffed data sent to the application and retrieved the JASON (at least I think it is JASON) packet: I found here my SMK fields, but other time also the original fields - I must admit I didn't really understand how JASON packets are created. I'm running out of ideas soon - hoping for a kind of clairvoyant revelation tonight? In case it doesn't come, any suggestion would be a huge help!! Thank you by advance. Best regards, Sébastien Ps: I forgot to say in my previous message: I'm currently working with CS v2.3 Fra: Patrick Schmitz [mailto:pschmitz@berkeley.edu]<mailto:[mailto:pschmitz@berkeley.edu]> Sendt: 25. juli 2012 02:10 Til: 'Aron Roberts'; 'Ray Lee' Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org>; Sébastien Brossard Emne: RE: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> As to the app layer support for structured dates, it should actually work okay. The tenant override will inject the new field(s) into the base-other-structureddate definition. It is a sub-record, so it is actually somewhat more flexible in some ways that other repeating groups. I think that the app layer logic will be okay if you just add fields. You may have to change the way you declare it when it occurs in other records, but we'll cross that bridge we get to it. As Ray says, get the services working, and we'll help from there. Patrick ________________________________ From: talk-bounces@lists.collectionspace.org<mailto:talk-bounces@lists.collectionspace.org> [mailto:talk-bounces@lists.collectionspace.org]<mailto:[mailto:talk-bounces@lists.collectionspace.org]> On Behalf Of Aron Roberts Sent: Tuesday, July 24, 2012 4:39 PM To: Ray Lee Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org>; Sébastien Brossard Subject: Re: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Ray wrote: > The new app layer merge stuff really needs to get documented. Agreed completely, Ray. These's a JIRA issue to begin documenting this: http://issues.collectionspace.org/browse/CSPACE-5070 This should get done in either the Doc5 sprint (currently ongoing) or if not by then, by no later than the next one (Doc6); it's a huge priority. Aron On Tue, Jul 24, 2012 at 3:52 PM, Ray Lee <rhlee@berkeley.edu<mailto:rhlee@berkeley.edu>> wrote: Hi Sébastien, I think what you're trying to do is going to end up being quite complex, so you haven't missed anything. In the services layer, I think you're right to create a new complex type (structuredDateGroupSMK) in your local schema. The structuredDateGroupSMK type would be identical to structuredDateGroup from the common schema, except for the addition of your new field (dateSMKDisplayText). You won't be able to change existing fields in the common schema to be structuredDateGroupSMK instead of structuredDateGroup. You'll have to create new fields in the local schema that have type structuredDateGroupSMK, and use these new fields as replacements for the ones in the common schema. As a first step, I would create a new field of type structuredDateGroupSMK in your local schema, and use the REST API to read and write that field. Then you'll know that the services layer is configured properly. Then you can move on to the app layer. I'm not sure if you can make this work entirely through xml configuration. This may require modification to the app layer's java code, because there's some special handling for structured dates in there. The lifesci tenant is using a new (as of 2.3) way of configuring the app layer that potentially makes things easier, but you don't have to use it. The way you've been doing it still works. The new app layer merge stuff really needs to get documented. If you get the services layer working, let us know. I might be able to help more with the app layer. Thanks, Ray On Jul 23, 2012, at 1:13 AM, Sébastien Brossard wrote: Dear all, I'm currently trying to add some customized fields in the frame of SMK's Local Schema Extension. As a first try, I could successfully add a new <xs:element> in the domain-collectionobject, (I added two files in SMK's tenant: * services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd * application/.../tenant/smk/ domain-collectionobject.xml + modified my ui so that to show my new field. It worked fine, showed and saved field's value.) But here it's a bit more complex : I would like to add some fields in the StructuredDate component. More precisely, I want to add a new <xs:element> (dateSMKDisplayText) in <xs:complexType name="structuredDateGroup"> * I tried by many many ways to add my new element in the existing structuredDateGroup via SMK's tenant, without any success. * Looking at the lifesci example, I tried to create a new complex type "structuredDateGroupSMK" (which means that I had to create a new <xs:element> who supports this new complex type ), but: o In lifesci-tenant.xml there's a merging function that I don't know nothing about (<include src="base-collectionobject.xml,naturalhistory-collectionobject.xml" merge="xmlmerge.properties"/>), which confused me. o structuredDateGroup is used in many places in the code, which means that I should replace it in numerous places in the code - which I think is not a brilliant idea. It seems a bit too much complex, so I suppose I missed a simpler way to achieve this. Thank you by advance for your kindly help and tips. Best regards, Sébastien Sébastien Brossard IT-Udvikler sebastien.brossard@smk.dk<mailto:3sebastien.brossard@smk.dkT> T<mailto:3sebastien.brossard@smk.dkT> +45 3374 8483<tel:%2B45%203374%208483> Statens Museum for Kunst Sølvgade 48-50 DK-1307 København K T +45 3374 8494<tel:%2B45%203374%208494> F +45 3374 8404<tel:%2B45%203374%208404> smk.dk<http://smk.dk/> <image004.jpg> Sébastien Brossard IT-Udvikler sebastien.brossard@smk.dk<mailto:3sebastien.brossard@smk.dkT> T<mailto:3sebastien.brossard@smk.dkT> +45 3374 8483<tel:%2B45%203374%208483> Statens Museum for Kunst Sølvgade 48-50 DK-1307 København K T +45 3374 8494<tel:%2B45%203374%208494> F +45 3374 8404<tel:%2B45%203374%208404> smk.dk<http://smk.dk/> <image005.jpg> _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
SB
Sébastien Brossard
Mon, Aug 6, 2012 2:28 PM

Hi all,

As promised, I'm posting the solution we used to create and use a new xs:complexType with new xs:element

In this example we'll create a new structuredDateSMKGroup.

Step 0:
I suggest to read first How to Configure a Local Schema Extension for a Tenanthttp://wiki.collectionspace.org/display/CSPACE23/How+to+Configure+a+Local+Schema+Extension+for+a+Tenant, for those who are not familiar with the subject

Step 1,  create the service:

·        In your tenant folder "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/",  create the following "collectionobjects_smk.xsd" file:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://collectionspace.org/collectionobject/local/smk"
xmlns="http://collectionspace.org/collectionobject/local/smk"
targetNamespace="http://collectionspace.org/collectionobject/local/smk" version="0.1">

 <xs:complexType name="structuredDateSMKGroup">
     <xs:sequence>
        <xs:element name="dateSMKDisplayText" type="xs:string"/>
        <xs:element name="dateSMKDateDay" type="xs:string"/>
        <xs:element name="dateSMKDateMonth" type="xs:string"/>
        <xs:element name="dateSMKDateYear" type="xs:string"/>
        <xs:element name="dateSMKEraSelector" type="xs:string"/>
        <xs:element name="dateSMKSecondDateDay" type="xs:string"/>
        <xs:element name="dateSMKSecondDateMonth" type="xs:string"/>
        <xs:element name="dateSMKSecondDateYear" type="xs:string"/>
        <xs:element name="dateSMKSecondEraSelector" type="xs:string"/>
        <xs:element name="dateSMKThirdDateDay" type="xs:string"/>
        <xs:element name="dateSMKThirdDateMonth" type="xs:string"/>
        <xs:element name="dateSMKThirdDateYear" type="xs:string"/>
        <xs:element name="dateSMKThirdEraSelector" type="xs:string"/>
        <xs:element name="dateSMKSegmentSelector" type="xs:string"/>
        <xs:element name="dateSMKTypeSelector" type="xs:string"/>
        <xs:element name="scalarValuesComputed" type="xs:boolean"/>
    </xs:sequence>
</xs:complexType>

</xs:schema>

è It could be wise to test this service through REST API (see Testing the Schema Extensions section in How to Configure a Local Schema Extension for a Tenanthttp://wiki.collectionspace.org/display/CSPACE23/How+to+Configure+a+Local+Schema+Extension+for+a+Tenant) before jumping to step 2.

Obs: I think it's a good idea to name the complex type structuredDateSMKGroup and not structuredDateGroupSMK - Chirs told me that in some cases, the "-Group" suffix is removed and the remaining name used as an identification by the core code.

Step 2, configure the application:

·        In your tenant folder "application/.../tenant/smk/, create the following "domain-collectionobject.xml" file:

<root>
<services-record-path id="smk">collectionobjects_smk:http://collectionspace.org/services/collectionobject/local/smk,collectionobjects_smk</services-record-path>



      <section id="domaindata">



           <field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK"

              primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDateSMK" section="smk">

              <services-tag>contentDateSMKGroup</services-tag>

              <selector>object-description-content-date-smk</selector>

            </field>



       </section>
</root>

·        In your tenant folder "application/.../tenant/smk/, create the following "base-other-structureddateSMK.xml" file:

        <record id="structureddateSMK" in-recordlist="no" separate-record="false">

            <section>

               <field id="dateSMKDisplayText">

                    <selector>dateSMKDisplayText</selector>

                    <preselector></preselector>

                </field>



                <field id="dateSMKDateDay">

                    <selector>dateSMKDateDay</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKDateMonth">

                    <selector>dateSMKDateMonth</selector>

                    <preselector></preselector>

                </field>

               <field id="dateSMKDateYear">

                    <selector>dateSMKDateYear</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKEraSelector">

                            <options>

                        <option id="Av">+/-</option>

                        <option id="Ap">+</option>

                    </options>

                    <selector>dateSMKEraSelector</selector>

                    <preselector></preselector>

                </field>



                <field id="dateSMKSecondDateDay">

                    <selector>dateSMKSecondDateDay</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKSecondDateMonth">

                    <selector>dateSMKSecondDateMonth</selector>

                    <preselector></preselector>

                </field>

              <field id="dateSMKSecondDateYear">

                    <selector>dateSMKSecondDateYear</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKSecondEraSelector">

                            <options>

                        <option id="Av">+/-</option>

                        <option id="Ap">+</option>

                    </options>

                    <selector>dateSMKSecondEraSelector</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKThirdDateDay">

                    <selector>dateSMKThirdDateDay</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKThirdDateMonth">

                    <selector>dateSMKThirdDateMonth</selector>

                    <preselector></preselector>

                </field>

              <field id="dateSMKThirdDateYear">

                    <selector>dateSMKThirdDateYear</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKThirdEraSelector">

                            <options>

                        <option id="Av">+/-</option>

                        <option id="Ap">+</option>

                    </options>

                    <selector>dateSMKThirdEraSelector</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKSegmentSelector">

                            <options>

                        <option id="avant">+/-</option>

                        <option id="après">+</option>

                    </options>

                    <selector>dateSMKSegmentSelector</selector>

                    <preselector></preselector>

                </field>

                <field id="dateSMKTypeSelector">

                            <options>

                        <option id="Année">+/-</option>

                        <option id="Siècle">+</option>

                    </options>

                    <selector>dateSMKTypeSelector</selector>

                    <preselector></preselector>

                </field>

                <field id="scalarValuesComputed" ui-search="false">

                    <options>

                        <option id="true" default="yes">true</option>

                        <option id="false">false</option>

                    </options>

                    <selector>scalarValuesComputed</selector>

                    <preselector></preselector>

                </field>

            </section>

        </record>

·        In folder "application/.../tenant/, add the following line to your tenant file (here, "smk-tenant.xml"):

<include src="base-other-structureddateSMK.xml"/>

Step 3, configuring the UI:

Now  you "just" have to add your new field object-description-content-date-smk you've just declared in the application to your HTML code - e.g. here, in "CatalogingTemplate.html":

<div class="content"> <input type="text" class="csc-object-description-inscription-content-date-smk" /> </div>

(note the prefix "csc-")

So that to test the whole, I suggest Firebug (local) in order to test the JASON packets between UI and Application, and WireShark (on the server) so that to see the xml fields sent between Application and Service.

Thank for helping us in developing this new element (but wait... We've got another problem now! Post to follow...)

Best regards,
Sébastien

Fra: Sébastien Brossard
Sendt: 2. august 2012 16:58
Til: talk@lists.collectionspace.org List
Emne: SV: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Hi Ray and Jesse, dear all

Thank you for your quick answer.
Ray, you were right: it was an offline cache problem.

We get a step further here, a BIG step further: our new field can now be saved!
However we still have a problem interfacing fields in our new structuredData component with the UI. I hope it will be a quick fix.

I'll let you know as soon as it works in order to enhance our common knowledge database.

Best regards,
Sébastien

Fra: Ray Lee [mailto:rhlee@berkeley.edu]mailto:[mailto:rhlee@berkeley.edu]
Sendt: 1. august 2012 21:15
Til: Sébastien Brossard
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org List
Emne: Re: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Correction, I meant to say record.html is in the app cache. That's the file where you'd want to add the script tag.

Thanks,
Ray

On Aug 1, 2012, at 12:12 PM, Ray Lee wrote:

Hi Sébastien,
You probably weren't able to see the script you added to cataloging.html, because that file is cached in the app cache. Just clearing the "normal" cache in the browser isn't enough. You have to take an extra step to clear the app cache, in both Chrome and Firefox. Here are instructions for doing that:

https://developer.mozilla.org/en/Offline_resources_in_Firefox/#Storage_location_and_clearing_the_offline_cache

And here are instructions for configuring which cspace files go into the app cache, and forcing the browser to reload files in the app cache, if you make a modification:

http://wiki.collectionspace.org/display/UNRELEASED/How+to+Update+UI+Files+that+are+in+the+Offline+Application+Cache

Thanks,
Ray

On Aug 1, 2012, at 8:04 AM, Jesse Martinez wrote:

Hi Sébastien,

I went through something similar a few weeks ago where I wanted to modify the Structured Date widget for a custom tenant.

Here's the thread from the discussion from the Talk list
http://lists.collectionspace.org/pipermail/talk_lists.collectionspace.org/2012-June/000834.html

What I ended up coming up with was to modify the StructuredDate.js with my slight modifications appended. (Since creating a new StructuredDateMMI.js file would have been a bit more work.)

It's not the best code since it's repetitive and needs to be refactored. Feel free to view the code:
https://github.com/jessemartinez/ui/blob/MMI-13/src/main/webapp/tenants/mmi/js/StructuredDate.js

It's also necessary to modify the application layer's configuration for that specific structured date field. For instance I made a modification for the structured date field in the Person authority record that references the component I created in StructuredDate.js
https://github.com/jessemartinez/application/blob/MMI-12/tomcat-main/src/main/resources/tenants/mmi/local-authority-person.xml#L50

Hope this helps,

You can forget my previous messages, they're out of date, sooo this morning.

Chris is back from holidays and he's been a huge help.
But even if we're getting closer, SMK's fields still can't be saved.

The new conf is:

  •     In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd":
    

<xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/>

<xs:complexType name="structuredDateGroupSMK">

xs:sequence

<xs:element name="dateSMKDisplayText" type="xs:string"/>

    </xs:sequence>

</xs:complexType>

  •     In "application/.../tenant/smk/ base-other-structureddateSMK.xml":
    
<record id="structureddateSMK" in-recordlist="no" separate-record="false">
            <section>

                            <field id="dateSMKDisplayText">

                 <selector>dateSMKDisplayText</selector>

                          <preselector></preselector>

                </field>

            </section>

        </record>
  •     In "application/.../tenant/smk-tenant.xml":
    

We added this line:

<include src="base-other-structureddateSMK.xml"/>
  •     In "application/.../tenant/smk/ base-collectionobject.xml":
    

We copied the defaut base-collectionobject.xml  and we added this field:

<field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK" primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDate">

    <services-tag>contentDateSMKGroup</services-tag>
    <selector>object-description-content-date-smk</selector>
</field>
  •     In "ui/.../tenants/smk/html/pages/cataloging.html"
    

We copied default file and added this field to default file's content:

<input type="text" class="csc-object-description-content-date-smk" />
  •     In "ui/.../tenants/smk/js/StructuredDate.js" AND in "ui/.../tenants/smk/html/component/StructuredDate.html"
    

We copied default file and added our dateSMKDisplayText to default file's content

==> So the result is now, that in a new record page, we can see our dateSMKDisplayText field in content-structureddate, we can write a value, and when we re-open the content-structureddate, the value is still there.

But it's not saved when the button is pressed.

Present questions are now:

  •     We wondered about creating a new StructuredDateSMK.js and StructuredDateSMK.html, but it was impossible to insert a new <script type="text/javascript" src="../js/StructuredDateSMK.js"></script> in cataloging.html ??
    

Even after adding this line in record.html and template.html, StructuredDateSMK.js doesn't show up in cataloging.html. To be exact: we can see in the source code of the page, but not in firebugs (after cleaning the cache, of course).

  •     How does ui-func work in "application/.../tenant/smk/ base-collectionobject.xml" ?
    

We tried to change its value to "cspace.structuredDateSMK"  and doing subsequent changes in "ui/.../StructuredDate.js" and ""ui/.../Demands.js", but without success: cataloging.html is not loading.

Thank you again for your kindly help, and have a nice day!

Best regards,

Sébastien

Fra: Sébastien Brossard
Sendt: 1. august 2012 08:58
Til: 'talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org'
Emne: VS: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Hi all,

I re-send the mail below, Chris told me it hasn't reached him on the talk@list

Br,
Sébastien

Fra: Sébastien Brossard
Sendt: 30. juli 2012 16:43
Til: 'Patrick Schmitz'; 'Aron Roberts'; 'Ray Lee'
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org
Emne: SV: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

Dear all,

Setting up of the service was easily achieved, and REST tests are successful with the following configuration :

  •     In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd":
    

<xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/>

<xs:complexType name="structuredDateGroupSMK">

xs:sequence

<xs:element name="dateSMKDisplayText" type="xs:string"/>

<xs:element name="dateSMKDateDay" type="xs:string"/>

        <xs:element name="dateSMKDateMonth" type="xs:string"/>

        <xs:element name="dateSMKDateYear" type="xs:string"/>

        <xs:element name="dateSMKEraSelector" type="xs:string"/>

        <xs:element name="dateSMKSecondDateDay" type="xs:string"/>

        <xs:element name="dateSMKSecondDateMonth" type="xs:string"/>

        <xs:element name="dateSMKSecondDateYear" type="xs:string"/>

        <xs:element name="dateSMKSecondEraSelector" type="xs:string"/>

        <xs:element name="dateSMKThirdDateDay" type="xs:string"/>

        <xs:element name="dateSMKThirdDateMonth" type="xs:string"/>

        <xs:element name="dateSMKThirdDateYear" type="xs:string"/>

        <xs:element name="dateSMKThirdEraSelector" type="xs:string"/>

        <xs:element name="dateSMKSegmentSelector" type="xs:string"/>

        <xs:element name="dateSMKTypeSelector" type="xs:string"/>

    </xs:sequence>

</xs:complexType>

(as you'll have noticed, I'm actually trying to add more than one field in structuredDate)

... but I'm unable to have the application layer working properly.
I've made many many many attempts, but I think the most significant are (n.b. as to simplify things, I reduced my new fields to one during those tries ):

  •     Test1:
    

In "application/.../tenant/smk/ base-other-structureddate.xml":

<record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section>

<xs:element name="dateSMKDisplayText" type="xs:string"/>

            </section>
</record>

-->Resulting ERROR MESSAGE when loading "cataloging.html": "Error fetching ../../../tenant/smk/composite: error"

  •     Test2
    

In "application/.../tenant/smk/ base-other-structureddate.xml":

<record id="structureddate" in-recordlist="no" separate-record="false"> <section>

<xs:element name="dateSMKDisplayText" type="xs:string"/>

            </section>
</record>
  •     Test3: same as above + add all the fields from the core base-other-structureddate.xml
    

IN BOTH CASES (Test2 & Test3):

-->Resulting ERROR MESSAGE when saving a new cataloging record: "Cannot set IS_REMOVED on removed or properties that are not map elements"

  •     Test4: I re-did Test1 & Test2 & Test3 + changed <services-tag> to contentDateGroupSMK in "application/.../default/ base-other-structureddate.xml"
    

-->ERROR ERROR ERROR

I also sniffed data sent to the application and retrieved the JASON (at least I think it is JASON) packet: I found here my SMK fields, but other time also the original fields - I must admit I didn't really understand how JASON packets are created.

I'm running out of ideas soon - hoping for a kind of clairvoyant revelation tonight?
In case it doesn't come, any suggestion would be a huge help!!

Thank you by advance.

Best regards,
Sébastien
Ps: I forgot to say in my previous message: I'm currently working with CS v2.3

Fra: Patrick Schmitz [mailto:pschmitz@berkeley.edu]mailto:[mailto:pschmitz@berkeley.edu]
Sendt: 25. juli 2012 02:10
Til: 'Aron Roberts'; 'Ray Lee'
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org; Sébastien Brossard
Emne: RE: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType

As to the app layer support for structured dates, it should actually work okay. The tenant override will inject the new field(s) into the base-other-structureddate definition. It is a sub-record, so it is actually somewhat more flexible in some ways that other repeating groups. I think that the app layer logic will be okay if you just add fields.

You may have to change the way you declare it when it occurs in other records, but we'll cross that bridge we get to it.

As Ray says, get the services working, and we'll help from there.

Patrick


From: talk-bounces@lists.collectionspace.orgmailto:talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org]mailto:[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Aron Roberts
Sent: Tuesday, July 24, 2012 4:39 PM
To: Ray Lee
Cc: talk@lists.collectionspace.orgmailto:talk@lists.collectionspace.org; Sébastien Brossard
Subject: Re: [Talk] Local Schema Extension: adding a new xs:element inxs:complexType
Ray wrote:

The new app layer merge stuff really needs to get documented.

Agreed completely, Ray.  These's a JIRA issue to begin documenting this:
http://issues.collectionspace.org/browse/CSPACE-5070

This should get done in either the Doc5 sprint (currently ongoing) or if not by then, by no later than the next one (Doc6); it's a huge priority.

Aron
On Tue, Jul 24, 2012 at 3:52 PM, Ray Lee <rhlee@berkeley.edumailto:rhlee@berkeley.edu> wrote:
Hi Sébastien,
I think what you're trying to do is going to end up being quite complex, so you haven't missed anything. In the services layer, I think you're right to create a new complex type (structuredDateGroupSMK) in your local schema. The structuredDateGroupSMK type would be identical to structuredDateGroup from the common schema, except for the addition of your new field (dateSMKDisplayText). You won't be able to change existing fields in the common schema to be structuredDateGroupSMK instead of structuredDateGroup. You'll have to create new fields in the local schema that have type structuredDateGroupSMK, and use these new fields as replacements for the ones in the common schema.

As a first step, I would create a new field of type structuredDateGroupSMK in your local schema, and use the REST API to read and write that field. Then you'll know that the services layer is configured properly. Then you can move on to the app layer. I'm not sure if you can make this work entirely through xml configuration. This may require modification to the app layer's java code, because there's some special handling for structured dates in there.

The lifesci tenant is using a new (as of 2.3) way of configuring the app layer that potentially makes things easier, but you don't have to use it. The way you've been doing it still works. The new app layer merge stuff really needs to get documented.

If you get the services layer working, let us know. I might be able to help more with the app layer.

Thanks,
Ray

On Jul 23, 2012, at 1:13 AM, Sébastien Brossard wrote:

Dear all,
I'm currently trying to add some customized fields in the frame of SMK's Local Schema Extension.

As a first try, I could successfully add a new xs:element in the domain-collectionobject,
(I added two files in SMK's tenant:

  • services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd
  • application/.../tenant/smk/ domain-collectionobject.xml
  • modified my ui so that to show my new field. It worked fine, showed and saved field's value.)

But here it's a bit more complex : I would like to add some fields in the StructuredDate component.

More precisely, I want to add a new xs:element (dateSMKDisplayText) in <xs:complexType name="structuredDateGroup">

  •     I tried by many many ways to add my new element in the existing structuredDateGroup via SMK's tenant, without any success.
    
  •     Looking at the lifesci example, I tried to create a new complex type "structuredDateGroupSMK" (which means that I had to create a new <xs:element> who supports this new complex type ), but:
    

o  In lifesci-tenant.xml there's a merging function that I don't know nothing about (<include src="base-collectionobject.xml,naturalhistory-collectionobject.xml" merge="xmlmerge.properties"/>), which confused me.
o  structuredDateGroup is used in many places in the code, which means that I should replace it in numerous places in the code - which I think is not a brilliant idea.

It seems a bit too much complex, so I suppose I missed a simpler way to achieve this.

Thank you by advance for your kindly help and tips.

Best regards,
Sébastien

Sébastien Brossard
IT-Udvikler
sebastien.brossard@smk.dkmailto:3sebastien.brossard@smk.dkT
Tmailto:3sebastien.brossard@smk.dkT +45 3374 8483tel:%2B45%203374%208483

Statens Museum for Kunst
Sølvgade 48-50
DK-1307 København K

T +45 3374 8494tel:%2B45%203374%208494
F +45 3374 8404tel:%2B45%203374%208404
smk.dkhttp://smk.dk/

<image004.jpg>

Sébastien Brossard
IT-Udvikler
sebastien.brossard@smk.dkmailto:3sebastien.brossard@smk.dkT
Tmailto:3sebastien.brossard@smk.dkT +45 3374 8483tel:%2B45%203374%208483

Statens Museum for Kunst
Sølvgade 48-50
DK-1307 København K

T +45 3374 8494tel:%2B45%203374%208494
F +45 3374 8404tel:%2B45%203374%208404
smk.dkhttp://smk.dk/

<image005.jpg>


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org


Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

Hi all, As promised, I'm posting the solution we used to create and use a new <xs:complexType> with new <xs:element> In this example we'll create a new structuredDateSMKGroup. Step 0: I suggest to read first How to Configure a Local Schema Extension for a Tenant<http://wiki.collectionspace.org/display/CSPACE23/How+to+Configure+a+Local+Schema+Extension+for+a+Tenant>, for those who are not familiar with the subject Step 1, create the service: · In your tenant folder "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/", create the following "collectionobjects_smk.xsd" file: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://collectionspace.org/collectionobject/local/smk" xmlns="http://collectionspace.org/collectionobject/local/smk" targetNamespace="http://collectionspace.org/collectionobject/local/smk" version="0.1"> <xs:complexType name="structuredDateSMKGroup"> <xs:sequence> <xs:element name="dateSMKDisplayText" type="xs:string"/> <xs:element name="dateSMKDateDay" type="xs:string"/> <xs:element name="dateSMKDateMonth" type="xs:string"/> <xs:element name="dateSMKDateYear" type="xs:string"/> <xs:element name="dateSMKEraSelector" type="xs:string"/> <xs:element name="dateSMKSecondDateDay" type="xs:string"/> <xs:element name="dateSMKSecondDateMonth" type="xs:string"/> <xs:element name="dateSMKSecondDateYear" type="xs:string"/> <xs:element name="dateSMKSecondEraSelector" type="xs:string"/> <xs:element name="dateSMKThirdDateDay" type="xs:string"/> <xs:element name="dateSMKThirdDateMonth" type="xs:string"/> <xs:element name="dateSMKThirdDateYear" type="xs:string"/> <xs:element name="dateSMKThirdEraSelector" type="xs:string"/> <xs:element name="dateSMKSegmentSelector" type="xs:string"/> <xs:element name="dateSMKTypeSelector" type="xs:string"/> <xs:element name="scalarValuesComputed" type="xs:boolean"/> </xs:sequence> </xs:complexType> </xs:schema> è It could be wise to test this service through REST API (see Testing the Schema Extensions section in How to Configure a Local Schema Extension for a Tenant<http://wiki.collectionspace.org/display/CSPACE23/How+to+Configure+a+Local+Schema+Extension+for+a+Tenant>) before jumping to step 2. Obs: I think it's a good idea to name the complex type structuredDateSMKGroup and not structuredDateGroupSMK - Chirs told me that in some cases, the "-Group" suffix is removed and the remaining name used as an identification by the core code. Step 2, configure the application: · In your tenant folder "application/.../tenant/smk/, create the following "domain-collectionobject.xml" file: <root> <services-record-path id="smk">collectionobjects_smk:http://collectionspace.org/services/collectionobject/local/smk,collectionobjects_smk</services-record-path> <section id="domaindata"> <field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK" primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDateSMK" section="smk"> <services-tag>contentDateSMKGroup</services-tag> <selector>object-description-content-date-smk</selector> </field> </section> </root> · In your tenant folder "application/.../tenant/smk/, create the following "base-other-structureddateSMK.xml" file: <record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section> <field id="dateSMKDisplayText"> <selector>dateSMKDisplayText</selector> <preselector></preselector> </field> <field id="dateSMKDateDay"> <selector>dateSMKDateDay</selector> <preselector></preselector> </field> <field id="dateSMKDateMonth"> <selector>dateSMKDateMonth</selector> <preselector></preselector> </field> <field id="dateSMKDateYear"> <selector>dateSMKDateYear</selector> <preselector></preselector> </field> <field id="dateSMKEraSelector"> <options> <option id="Av">+/-</option> <option id="Ap">+</option> </options> <selector>dateSMKEraSelector</selector> <preselector></preselector> </field> <field id="dateSMKSecondDateDay"> <selector>dateSMKSecondDateDay</selector> <preselector></preselector> </field> <field id="dateSMKSecondDateMonth"> <selector>dateSMKSecondDateMonth</selector> <preselector></preselector> </field> <field id="dateSMKSecondDateYear"> <selector>dateSMKSecondDateYear</selector> <preselector></preselector> </field> <field id="dateSMKSecondEraSelector"> <options> <option id="Av">+/-</option> <option id="Ap">+</option> </options> <selector>dateSMKSecondEraSelector</selector> <preselector></preselector> </field> <field id="dateSMKThirdDateDay"> <selector>dateSMKThirdDateDay</selector> <preselector></preselector> </field> <field id="dateSMKThirdDateMonth"> <selector>dateSMKThirdDateMonth</selector> <preselector></preselector> </field> <field id="dateSMKThirdDateYear"> <selector>dateSMKThirdDateYear</selector> <preselector></preselector> </field> <field id="dateSMKThirdEraSelector"> <options> <option id="Av">+/-</option> <option id="Ap">+</option> </options> <selector>dateSMKThirdEraSelector</selector> <preselector></preselector> </field> <field id="dateSMKSegmentSelector"> <options> <option id="avant">+/-</option> <option id="après">+</option> </options> <selector>dateSMKSegmentSelector</selector> <preselector></preselector> </field> <field id="dateSMKTypeSelector"> <options> <option id="Année">+/-</option> <option id="Siècle">+</option> </options> <selector>dateSMKTypeSelector</selector> <preselector></preselector> </field> <field id="scalarValuesComputed" ui-search="false"> <options> <option id="true" default="yes">true</option> <option id="false">false</option> </options> <selector>scalarValuesComputed</selector> <preselector></preselector> </field> </section> </record> · In folder "application/.../tenant/, add the following line to your tenant file (here, "smk-tenant.xml"): <include src="base-other-structureddateSMK.xml"/> Step 3, configuring the UI: Now you "just" have to add your new field object-description-content-date-smk you've just declared in the application to your HTML code - e.g. here, in "CatalogingTemplate.html": <div class="content"> <input type="text" class="csc-object-description-inscription-content-date-smk" /> </div> (note the prefix "csc-") So that to test the whole, I suggest Firebug (local) in order to test the JASON packets between UI and Application, and WireShark (on the server) so that to see the xml fields sent between Application and Service. Thank for helping us in developing this new element (but wait... We've got another problem now! Post to follow...) Best regards, Sébastien Fra: Sébastien Brossard Sendt: 2. august 2012 16:58 Til: talk@lists.collectionspace.org List Emne: SV: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Hi Ray and Jesse, dear all Thank you for your quick answer. Ray, you were right: it was an offline cache problem. We get a step further here, a BIG step further: our new field can now be saved! However we still have a problem interfacing fields in our new structuredData component with the UI. I hope it will be a quick fix. I'll let you know as soon as it works in order to enhance our common knowledge database. Best regards, Sébastien Fra: Ray Lee [mailto:rhlee@berkeley.edu]<mailto:[mailto:rhlee@berkeley.edu]> Sendt: 1. august 2012 21:15 Til: Sébastien Brossard Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org> List Emne: Re: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Correction, I meant to say record.html is in the app cache. That's the file where you'd want to add the script tag. Thanks, Ray On Aug 1, 2012, at 12:12 PM, Ray Lee wrote: Hi Sébastien, You probably weren't able to see the script you added to cataloging.html, because that file is cached in the app cache. Just clearing the "normal" cache in the browser isn't enough. You have to take an extra step to clear the app cache, in both Chrome and Firefox. Here are instructions for doing that: https://developer.mozilla.org/en/Offline_resources_in_Firefox/#Storage_location_and_clearing_the_offline_cache And here are instructions for configuring which cspace files go into the app cache, and forcing the browser to reload files in the app cache, if you make a modification: http://wiki.collectionspace.org/display/UNRELEASED/How+to+Update+UI+Files+that+are+in+the+Offline+Application+Cache Thanks, Ray On Aug 1, 2012, at 8:04 AM, Jesse Martinez wrote: Hi Sébastien, I went through something similar a few weeks ago where I wanted to modify the Structured Date widget for a custom tenant. Here's the thread from the discussion from the Talk list http://lists.collectionspace.org/pipermail/talk_lists.collectionspace.org/2012-June/000834.html What I ended up coming up with was to modify the StructuredDate.js with my slight modifications appended. (Since creating a new StructuredDateMMI.js file would have been a bit more work.) It's not the best code since it's repetitive and needs to be refactored. Feel free to view the code: https://github.com/jessemartinez/ui/blob/MMI-13/src/main/webapp/tenants/mmi/js/StructuredDate.js It's also necessary to modify the application layer's configuration for that specific structured date field. For instance I made a modification for the structured date field in the Person authority record that references the component I created in StructuredDate.js https://github.com/jessemartinez/application/blob/MMI-12/tomcat-main/src/main/resources/tenants/mmi/local-authority-person.xml#L50 Hope this helps, - Jesse On Wed, Aug 1, 2012 at 10:38 AM, Sébastien Brossard <Sebastien.Brossard@smk.dk<mailto:Sebastien.Brossard@smk.dk>> wrote: Hi all, You can forget my previous messages, they're out of date, sooo this morning. Chris is back from holidays and he's been a huge help. But even if we're getting closer, SMK's fields still can't be saved. The new conf is: * In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd": <xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/> <xs:complexType name="structuredDateGroupSMK"> <xs:sequence> <xs:element name="dateSMKDisplayText" type="xs:string"/> </xs:sequence> </xs:complexType> * In "application/.../tenant/smk/ base-other-structureddateSMK.xml": <record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section> <field id="dateSMKDisplayText"> <selector>dateSMKDisplayText</selector> <preselector></preselector> </field> </section> </record> * In "application/.../tenant/smk-tenant.xml": We added this line: <include src="base-other-structureddateSMK.xml"/> * In "application/.../tenant/smk/ base-collectionobject.xml": We copied the defaut base-collectionobject.xml and we added this field: <field id="contentDateSMK" ui-search="range" ui-type="groupfield/structureddateSMK" primarykey="contentDateSMK.dateSMKDisplayText" ui-func="cspace.structuredDate"> <services-tag>contentDateSMKGroup</services-tag> <selector>object-description-content-date-smk</selector> </field> * In "ui/.../tenants/smk/html/pages/cataloging.html" We copied default file and added this field to default file's content: <input type="text" class="csc-object-description-content-date-smk" /> * In "ui/.../tenants/smk/js/StructuredDate.js" AND in "ui/.../tenants/smk/html/component/StructuredDate.html" We copied default file and added our dateSMKDisplayText to default file's content ==> So the result is now, that in a new record page, we can see our dateSMKDisplayText field in content-structureddate, we can write a value, and when we re-open the content-structureddate, the value is still there. But it's not saved when the button is pressed. Present questions are now: * We wondered about creating a new StructuredDateSMK.js and StructuredDateSMK.html, but it was impossible to insert a new <script type="text/javascript" src="../js/StructuredDateSMK.js"></script> in cataloging.html ?? Even after adding this line in record.html and template.html, StructuredDateSMK.js doesn't show up in cataloging.html. To be exact: we can see in the source code of the page, but not in firebugs (after cleaning the cache, of course). * How does ui-func work in "application/.../tenant/smk/ base-collectionobject.xml" ? We tried to change its value to "cspace.structuredDateSMK" and doing subsequent changes in "ui/.../StructuredDate.js" and ""ui/.../Demands.js", but without success: cataloging.html is not loading. Thank you again for your kindly help, and have a nice day! Best regards, Sébastien Fra: Sébastien Brossard Sendt: 1. august 2012 08:58 Til: 'talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org>' Emne: VS: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Hi all, I re-send the mail below, Chris told me it hasn't reached him on the talk@list Br, Sébastien Fra: Sébastien Brossard Sendt: 30. juli 2012 16:43 Til: 'Patrick Schmitz'; 'Aron Roberts'; 'Ray Lee' Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org> Emne: SV: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Dear all, Setting up of the service was easily achieved, and REST tests are successful with the following configuration : * In "services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd": <xs:element name="contentDateGroupSMK" type="structuredDateGroupSMK"/> <xs:complexType name="structuredDateGroupSMK"> <xs:sequence> <xs:element name="dateSMKDisplayText" type="xs:string"/> <xs:element name="dateSMKDateDay" type="xs:string"/> <xs:element name="dateSMKDateMonth" type="xs:string"/> <xs:element name="dateSMKDateYear" type="xs:string"/> <xs:element name="dateSMKEraSelector" type="xs:string"/> <xs:element name="dateSMKSecondDateDay" type="xs:string"/> <xs:element name="dateSMKSecondDateMonth" type="xs:string"/> <xs:element name="dateSMKSecondDateYear" type="xs:string"/> <xs:element name="dateSMKSecondEraSelector" type="xs:string"/> <xs:element name="dateSMKThirdDateDay" type="xs:string"/> <xs:element name="dateSMKThirdDateMonth" type="xs:string"/> <xs:element name="dateSMKThirdDateYear" type="xs:string"/> <xs:element name="dateSMKThirdEraSelector" type="xs:string"/> <xs:element name="dateSMKSegmentSelector" type="xs:string"/> <xs:element name="dateSMKTypeSelector" type="xs:string"/> </xs:sequence> </xs:complexType> (as you'll have noticed, I'm actually trying to add more than one field in structuredDate) ... but I'm unable to have the application layer working properly. I've made many many many attempts, but I think the most significant are (n.b. as to simplify things, I reduced my new fields to one during those tries ): * Test1: In "application/.../tenant/smk/ base-other-structureddate.xml": <record id="structureddateSMK" in-recordlist="no" separate-record="false"> <section> <xs:element name="dateSMKDisplayText" type="xs:string"/> </section> </record> -->Resulting ERROR MESSAGE when loading "cataloging.html": "Error fetching ../../../tenant/smk/composite: error" * Test2 In "application/.../tenant/smk/ base-other-structureddate.xml": <record id="structureddate" in-recordlist="no" separate-record="false"> <section> <xs:element name="dateSMKDisplayText" type="xs:string"/> </section> </record> * Test3: same as above + add all the fields from the core base-other-structureddate.xml IN BOTH CASES (Test2 & Test3): -->Resulting ERROR MESSAGE when saving a new cataloging record: "Cannot set IS_REMOVED on removed or properties that are not map elements" * Test4: I re-did Test1 & Test2 & Test3 + changed <services-tag> to contentDateGroupSMK in "application/.../default/ base-other-structureddate.xml" -->ERROR ERROR ERROR I also sniffed data sent to the application and retrieved the JASON (at least I think it is JASON) packet: I found here my SMK fields, but other time also the original fields - I must admit I didn't really understand how JASON packets are created. I'm running out of ideas soon - hoping for a kind of clairvoyant revelation tonight? In case it doesn't come, any suggestion would be a huge help!! Thank you by advance. Best regards, Sébastien Ps: I forgot to say in my previous message: I'm currently working with CS v2.3 Fra: Patrick Schmitz [mailto:pschmitz@berkeley.edu]<mailto:[mailto:pschmitz@berkeley.edu]> Sendt: 25. juli 2012 02:10 Til: 'Aron Roberts'; 'Ray Lee' Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org>; Sébastien Brossard Emne: RE: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> As to the app layer support for structured dates, it should actually work okay. The tenant override will inject the new field(s) into the base-other-structureddate definition. It is a sub-record, so it is actually somewhat more flexible in some ways that other repeating groups. I think that the app layer logic will be okay if you just add fields. You may have to change the way you declare it when it occurs in other records, but we'll cross that bridge we get to it. As Ray says, get the services working, and we'll help from there. Patrick ________________________________ From: talk-bounces@lists.collectionspace.org<mailto:talk-bounces@lists.collectionspace.org> [mailto:talk-bounces@lists.collectionspace.org]<mailto:[mailto:talk-bounces@lists.collectionspace.org]> On Behalf Of Aron Roberts Sent: Tuesday, July 24, 2012 4:39 PM To: Ray Lee Cc: talk@lists.collectionspace.org<mailto:talk@lists.collectionspace.org>; Sébastien Brossard Subject: Re: [Talk] Local Schema Extension: adding a new <xs:element> in<xs:complexType> Ray wrote: > The new app layer merge stuff really needs to get documented. Agreed completely, Ray. These's a JIRA issue to begin documenting this: http://issues.collectionspace.org/browse/CSPACE-5070 This should get done in either the Doc5 sprint (currently ongoing) or if not by then, by no later than the next one (Doc6); it's a huge priority. Aron On Tue, Jul 24, 2012 at 3:52 PM, Ray Lee <rhlee@berkeley.edu<mailto:rhlee@berkeley.edu>> wrote: Hi Sébastien, I think what you're trying to do is going to end up being quite complex, so you haven't missed anything. In the services layer, I think you're right to create a new complex type (structuredDateGroupSMK) in your local schema. The structuredDateGroupSMK type would be identical to structuredDateGroup from the common schema, except for the addition of your new field (dateSMKDisplayText). You won't be able to change existing fields in the common schema to be structuredDateGroupSMK instead of structuredDateGroup. You'll have to create new fields in the local schema that have type structuredDateGroupSMK, and use these new fields as replacements for the ones in the common schema. As a first step, I would create a new field of type structuredDateGroupSMK in your local schema, and use the REST API to read and write that field. Then you'll know that the services layer is configured properly. Then you can move on to the app layer. I'm not sure if you can make this work entirely through xml configuration. This may require modification to the app layer's java code, because there's some special handling for structured dates in there. The lifesci tenant is using a new (as of 2.3) way of configuring the app layer that potentially makes things easier, but you don't have to use it. The way you've been doing it still works. The new app layer merge stuff really needs to get documented. If you get the services layer working, let us know. I might be able to help more with the app layer. Thanks, Ray On Jul 23, 2012, at 1:13 AM, Sébastien Brossard wrote: Dear all, I'm currently trying to add some customized fields in the frame of SMK's Local Schema Extension. As a first try, I could successfully add a new <xs:element> in the domain-collectionobject, (I added two files in SMK's tenant: * services/.../ nuxeo-platform-collectionobject-smk/.../shemas/ collectionobjects_smk.xsd * application/.../tenant/smk/ domain-collectionobject.xml + modified my ui so that to show my new field. It worked fine, showed and saved field's value.) But here it's a bit more complex : I would like to add some fields in the StructuredDate component. More precisely, I want to add a new <xs:element> (dateSMKDisplayText) in <xs:complexType name="structuredDateGroup"> * I tried by many many ways to add my new element in the existing structuredDateGroup via SMK's tenant, without any success. * Looking at the lifesci example, I tried to create a new complex type "structuredDateGroupSMK" (which means that I had to create a new <xs:element> who supports this new complex type ), but: o In lifesci-tenant.xml there's a merging function that I don't know nothing about (<include src="base-collectionobject.xml,naturalhistory-collectionobject.xml" merge="xmlmerge.properties"/>), which confused me. o structuredDateGroup is used in many places in the code, which means that I should replace it in numerous places in the code - which I think is not a brilliant idea. It seems a bit too much complex, so I suppose I missed a simpler way to achieve this. Thank you by advance for your kindly help and tips. Best regards, Sébastien Sébastien Brossard IT-Udvikler sebastien.brossard@smk.dk<mailto:3sebastien.brossard@smk.dkT> T<mailto:3sebastien.brossard@smk.dkT> +45 3374 8483<tel:%2B45%203374%208483> Statens Museum for Kunst Sølvgade 48-50 DK-1307 København K T +45 3374 8494<tel:%2B45%203374%208494> F +45 3374 8404<tel:%2B45%203374%208404> smk.dk<http://smk.dk/> <image004.jpg> Sébastien Brossard IT-Udvikler sebastien.brossard@smk.dk<mailto:3sebastien.brossard@smk.dkT> T<mailto:3sebastien.brossard@smk.dkT> +45 3374 8483<tel:%2B45%203374%208483> Statens Museum for Kunst Sølvgade 48-50 DK-1307 København K T +45 3374 8494<tel:%2B45%203374%208494> F +45 3374 8404<tel:%2B45%203374%208404> smk.dk<http://smk.dk/> <image005.jpg> _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org _______________________________________________ Talk mailing list Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org