Source: site.view [edit]
Function name: shareMedia
Arguments: photosXml,destination
Description:
Page type: webl
Render function:  
Module: sandbox

Page source:

// NewPage(`{ "pageData": ` + WubCall("toJSON", [res]) + `,"timeData":` + getTimeData(pageText) + "}", "text/plain");


Wub_DropDB("media");
var db = Wub_GetDB("media");
var coll = Wub_GetCollection(db, "photos");

var P = NewPage(photosXml, "text/xml");
var s = "";
every photo in Elem(P, "photo") do
   var url = Elem(P, "url") inside photo;
   var caption = Elem(P, "caption") inside photo;
   s = s + Str_Trim(Text(url[0]));
   var dbobj = Wub_NewDBObject([. device=destination, url=Str_Trim(Text(url[0])), caption=Str_Trim(Text(caption[0])) .]); 
   Wub_InsertDB(coll, dbobj);
end;  

NewPage("true", "text/plain");