JS import - SOLVED setting date field, SOLVED adding to collection

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown JS import - SOLVED setting date field, SOLVED adding to collection

by Kevin Walsh :: Rate this Message:

| View Threaded | Show Only this Message


Dear Karel,

thanks for your answer. Using it (and the brain of one of our developers), I found the solution of automating the import of a document with a "date" field.
Here for everyone, who may want to try the same:
       document.setField("Date", new java.text.SimpleDateFormat("yyyy-MM-dd").parse("$DATE"));
We take the $DATE as a string from the file name to be imported.e.g. "2012-04-16".


Your answer regarding adding the document to a collection solved my 'problem' perfectly, but was missing the last ")". The code would be e.g.:
        document.addToCollection(repository.getCollectionManager().getCollection(("QA"),false));

Again: thanks a lot!

Kind regards

Kevin Walsh
Anwendung WWS
IS SW Entwicklung

Phone: +49 201 8676 932
Fax: +49 201 8676 49932
Mobil: +49 177 6664666
kevin_walsh@...



daisy-request@...
Gesendet von: daisy-bounces@...

13.04.2012 11:59
Bitte antworten an
daisy@...

An
daisy@...
Kopie
Thema
daisy Digest, Vol 91, Issue 10 <Virus checked>







Message: 1
Date: Thu, 12 Apr 2012 13:51:01 +0200
From: Karel Vervaeke <karel@...>
Subject: Re: [daisy] Using js import
To: "Daisy: open source CMS - general mailinglist"
                <daisy@...>
Message-ID:
                <CAHq9+r0wGoO1ObUmvJHH8fnswCLR2Lpa7YA8W3=m+mL3AgjELw@...>
Content-Type: text/plain; charset="iso-8859-1"

For dates, use date objects, not strings. Hence:
document.setField("Date", new Date());

For collections, you need a DocumentCollection:
http://www.daisycms.org/javadoc/daisy/2.4/index.html?org/outerj/daisy/repository/Document.html
document.addToCollection(repository.getCollectionManager().getCollection("name-or-id"),
false);


On Thu, Apr 12, 2012 at 1:41 PM, <kevin_walsh@...> wrote:

>
> Dear list,
>
> we are trying to automatically import attachments into daisy. Works fine
> so far, BUT I would like to populate a date field and add the attachment
> document to a collection, both do not work
>
> This will cause problems with a date field:
>         document.setField("Date","2012-04-12");
>
> I do not know how to add a collection to the document.
> It should be something like below, shouldn't it? What do I need to enter
> after this? The collection ID?
>         document.addToCollection
>
> Could you point me the right way, please?
>
> Kind regards
>
> Kevin Walsh
> Anwendung WWS
> IS SW Entwicklung
>
> Phone: +49 201 8676 932
> Fax: +49 201 8676 49932
> Mobil: +49 177 6664666
> kevin_walsh@...
>
>
> ps. Any hints on what daisy 2.5 will be about?
>
>
> [image: DEICHMANN SE LOGO]
>
*************************************

 

DEICHMANN SE LOGO
 
www.deichmann.com

 

Deichmann SE, Deichmannweg 9, D-45359 Essen
 
Sitz der Gesellschaft: Essen, Registergericht Essen HRB 21020, USt.-ID-Nr.: DE 119 663 402
 
Vorsitzender des Verwaltungsrats und der geschäftsführenden Direktoren: Heinrich Otto Deichmann
Stellvertretender Vorsitzender des Verwaltungsrats: Dr. Heinz-Horst Deichmann

Geschäftsführende Direktoren:
Martin Fischer * Wolfram Hail * Martin Heynen * Karsten Schütt * Wolfgang Wislsperger


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy