Migrating XML content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2007 01:39 PM
In the website i am creating (using alfrescos wcm) i have created a number of xsd web forms that capture various content types:
profile
advice page
etc.
When viewing the content produced from completing one of these forms (which are saved as xml content) I get xml code.
My problem is.
When i convert all of my data from my current legacy system (non alfresco), into this xml format and load it, my content controllers are then unable to edit these content items via the form.
Instead they are asked to download the xml file to edit it.
NOTE: All content items that have been manually created in the system via the form are editable via the form interface.
Is there any way of overcomming this?
I have looked at acpGeneratr but if i need to use this and load my meta data as a csv and my content (body text) as the actual xml file then what format would the xml file take?
Would it still look like those manually created (ie. contatining a full xml description of content and meta-data)?
Or would i use the acpGeneratr method and load the content (body text) as plain text and the meta-data via the csv file.
Still, would this enable the content to be editable via my forms?
Thanks,
Luke
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2007 01:44 PM
here is the view of the manually created form xml.
<?xml version="1.0" encoding="UTF-8" ?>
<pr


<pr:title>test for saturday</pr:title>
<pr:body>test test sat</pr:body>
<pr:keywords>saturday test</pr:keywords>
</pr

here is what i loaded via the "create" >> "add content" upload link:
<?xml version="1.0" encoding="UTF-8" ?>
<pr


<pr:title>test for friday</pr:title>
<pr:body>test test fri</pr:body>
<pr:keywords>friday test</pr:keywords>
</pr

as you can see. Both are the same, just the content of the xml has changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2007 12:13 PM
Alfresco are working on this… The xml files need to be associated with the web form in the meta data.
In the meantime, I have written a web script which associates all the xml files in a folder with a particular web form. The code below should get you going, it may need some adjustment for your environment ..
script: {
var sandbox = args.sb;
var form = args.form;
var path = url.extension;
var storeRoot = avm.lookupStore(sandbox);
var folder = storeRoot.lookupNode("ROOT/" + path);
var files = folder.children;
var updated = new Array();
for (var i=0; i<files.length;i++){
var file = files;
if (file.isDocument && file.properties.content.mimetype == "text/xml"){
// add aspect to associate the xml file with its form
if (!hasAspect(file.aspects, "{http://www.alfresco.org/model/wcmappmodel/1.0}forminstancedata")){
var props = new Array(2);
props["{http://www.alfresco.org/model/wcmappmodel/1.0}parentformname"] = form;
props["{http://www.alfresco.org/model/wcmappmodel/1.0}originalparentpath"] = file.parentPath;
file.addAspect("{http://www.alfresco.org/model/wcmappmodel/1.0}forminstancedata", props);
updated[updated.length] = file;
}
}
}
model.folder = folder;
model.updated = updated;
}
function hasAspect(aspects, aspect){
if (aspects.length == undefined){
aspects = aspects.toArray();
}
for (var i=0; i< aspects.length; i++){
if (aspects == aspect){
return true;
}
}
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2007 05:54 AM
Thanks for that.
Sorry to ask for yet more info but I am unsure of how we get javascript files to run against a space or content item.
I can see how rules are added to spaces outside of the wcm but not within it.
Any help would be great.
Thanks,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2007 05:57 AM
I created a web script and then just call that using a web browser. I have not found a way to do it automatically.
There is some info on creating web scripts in the wiki and also in the Web Scripts space in the Data Dictionary on your Alfresco install.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2007 07:11 AM
I believe the feature i spoke of above is present in 2.1.0E.
Just a shame I am using the community version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2007 01:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 08:27 AM
but i have some que for you.i hope u reply me.
your code:
script: {var sandbox = args.sb;var form = args.form;var path = url.extension;var storeRoot = avm.lookupStore(sandbox);var folder = storeRoot.lookupNode("ROOT/" + path);var files = folder.children;var updated = new Array();for (var i=0; i<files.length;i++){var file = files[i];if (file.isDocument && file.properties.content.mimetype == "text/xml"){// add aspect to associate the xml file with its formif (!hasAspect(file.aspects, "{http://www.alfresco.org/model/wcmappmodel/1.0}forminstancedata")){var props = new Array(2);props["{http://www.alfresco.org/model/wcmappmodel/1.0}parentformname"] = form;props["{http://www.alfresco.org/model/wcmappmodel/1.0}originalparentpath"] = file.parentPath;file.addAspect("{http://www.alfresco.org/model/wcmappmodel/1.0}forminstancedata", props);updated[updated.length] = file;}}}model.folder = folder;model.updated = updated;}function hasAspect(aspects, aspect){if (aspects.length == undefined){aspects = aspects.toArray();}for (var i=0; i< aspects.length; i++){if (aspects[i] == aspect){return true;}}return false;}
Que
[size=150]1)if i dont pass the argument from url so what i supposed to write in this line
var storeRoot = avm.lookupStore(sandbox);
what(path) i write in lookupStore instead of sandbox?
2)in this lines,if i dont pass arg from url then what should i write, instead of path?
var path = url.extension;
var folder = storeRoot.lookupNode("ROOT/" + path);[/size]
if you have any suggestion then pls rep-ly me.
thx in advance.
bye
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008 05:20 AM
Mark, that looks like a great customization. Do you mind opening a JIRA feature request, and attaching your code? That may help us expedite adding this to the core.
Also, please note that if you have an imported XML that is not generated via a Web Form, when you click EDIT and are prompted to download, there is a link on that very same page that allows you to associate it with an existing Web Form. If you click on that link, you get to pick from a list of all Web Forms associated with your current Web Project. You do have to select the correct one. If you do, the XML will open in the form, and upon a subsequent save, the appropriate property will be set.
This does mean that the association happens on a file-by-file basis. Ideally, we'd have a general action you can run against your entire site to auto-associate any and all XMLs to remove this additional bootstrap effort currently required by your individual content authors.
Kevin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2008 06:14 PM
