Commit 0a597949 authored by Romain Courteaud's avatar Romain Courteaud

Upgrade renderJS UI to development version of jIO.

Ensure only jIO API is used.
Allow to access all ERP5 functionnality with getAttachment.
Improve IE support.
parent dd25d0b8
......@@ -10,6 +10,12 @@
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
......@@ -52,10 +58,7 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from zExceptions import Unauthorized\n
from AccessControl import getSecurityManager\n
from ZTUtils import make_query\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
import json\n
from DateTime import DateTime\n
if REQUEST is None:\n
......@@ -66,6 +69,8 @@ if response is None:\n
\n
url_template_dict = {\n
"form_action": "%(traversed_document_url)s/%(action_id)s",\n
"traverse_generator": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"&relative_url=%(relative_url)s&view=%(view)s",\n
"traverse_template": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"{&relative_url,view}",\n
"search_template": "%(root_url)s/%(script_id)s?mode=search" + \\\n
......@@ -269,7 +274,6 @@ def renderForm(form, response_dict):\n
\'name\': form.id\n
}\n
\n
group_list = []\n
for group in form.Form_getGroupTitleAndId():\n
\n
if group[\'gid\'].find(\'hidden\') < 0:\n
......@@ -379,8 +383,10 @@ is_web_mode = (context.REQUEST.get(\'current_web_section\', None) is not None) o
# is_web_mode = traversed_document.isWebMode()\n
if is_web_mode:\n
site_root = context.getWebSectionValue()\n
view_action_type = site_root.getLayoutProperty("view_action_category", default=\'object_view\')\n
else:\n
site_root = portal\n
view_action_type = "object_view"\n
\n
# Check if traversed_document is the site_root\n
if relative_url:\n
......@@ -471,7 +477,6 @@ elif (mode == \'root\') or (mode == \'traverse\'):\n
portal.portal_actions.listFilteredActionsFor(traversed_document))\n
\n
embedded_url = None\n
embedded_action_key = None\n
# XXX See ERP5Type.getDefaultViewFor\n
for erp5_action_key in erp5_action_dict.keys():\n
erp5_action_list = []\n
......@@ -485,11 +490,23 @@ elif (mode == \'root\') or (mode == \'traverse\'):\n
# Try to embed the form in the result\n
if (view == view_action[\'id\']):\n
embedded_url = \'%s\' % view_action[\'url\']\n
embedded_action_key = "action_" + erp5_action_key\n
\n
if (erp5_action_key in (view_action_type, "view", "workflow", "object_new_content_action")):\n
erp5_action_list[-1][\'href\'] = url_template_dict["traverse_generator"] % {\n
"root_url": site_root.absolute_url(),\n
"script_id": script.id,\n
"relative_url": traversed_document.getRelativeUrl().replace("/", "%2F"),\n
"view": erp5_action_list[-1][\'name\']\n
}\n
\n
if erp5_action_list:\n
if len(erp5_action_list) == 1:\n
erp5_action_list = erp5_action_list[0]\n
\n
if erp5_action_key == view_action_type:\n
# Configure view tabs on server level\n
result_dict[\'_links\']["view"] = erp5_action_list\n
\n
# XXX Put a prefix to prevent conflict\n
result_dict[\'_links\']["action_" + erp5_action_key] = erp5_action_list\n
\n
......@@ -564,6 +581,7 @@ elif (mode == \'root\') or (mode == \'traverse\'):\n
##############\n
if is_site_root:\n
\n
result_dict[\'default_view\'] = \'view\'\n
# XXX Hardcoded cache for 30 minutes. Should only bother developers but speed up Jio access\n
response.setHeader("Cache-Control", "public, max-age=1800")\n
response.setHeader("Vary", "Cookie")\n
......@@ -773,7 +791,7 @@ elif mode == \'form\':\n
# renderFormDefinition(form, result_dict)\n
\n
else:\n
raise NotImplementedError, "Unsupported mode %s" % mode\n
raise NotImplementedError("Unsupported mode %s" % mode)\n
\n
response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict, indent=2)\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>URI.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>/*! URI.js v1.12.0 http://medialize.github.com/URI.js/ */\n
/* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js, URI.fragmentQuery.js */</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_URI_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*! URI.js v1.12.0 http://medialize.github.com/URI.js/ */\n
/* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js, URI.fragmentQuery.js */\n
(function(e,k){"object"===typeof exports?module.exports=k():"function"===typeof define&&define.amd?define(k):e.IPv6=k(e)})(this,function(e){var k=e&&e.IPv6;return{best:function(e){e=e.toLowerCase().split(":");var k=e.length,d=8;""===e[0]&&""===e[1]&&""===e[2]?(e.shift(),e.shift()):""===e[0]&&""===e[1]?e.shift():""===e[k-1]&&""===e[k-2]&&e.pop();k=e.length;-1!==e[k-1].indexOf(".")&&(d=7);var g;for(g=0;g<k&&""!==e[g];g++);if(g<d)for(e.splice(g,1,"0000");e.length<d;)e.splice(g,0,"0000");for(g=0;g<d;g++){for(var k=\n
e[g].split(""),q=0;3>q;q++)if("0"===k[0]&&1<k.length)k.splice(0,1);else break;e[g]=k.join("")}var k=-1,l=q=0,r=-1,z=!1;for(g=0;g<d;g++)z?"0"===e[g]?l+=1:(z=!1,l>q&&(k=r,q=l)):"0"==e[g]&&(z=!0,r=g,l=1);l>q&&(k=r,q=l);1<q&&e.splice(k,q,"");k=e.length;d="";""===e[0]&&(beststr=":");for(g=0;g<k;g++){d+=e[g];if(g===k-1)break;d+=":"}""===e[k-1]&&(d+=":");return d},noConflict:function(){e.IPv6===this&&(e.IPv6=k);return this}}});\n
(function(e){function k(a){throw RangeError(p[a]);}function u(a,b){for(var c=a.length;c--;)a[c]=b(a[c]);return a}function m(a,b){return u(a.split(h),b).join(".")}function d(a){for(var b=[],c=0,d=a.length,h,p;c<d;)h=a.charCodeAt(c++),55296<=h&&56319>=h&&c<d?(p=a.charCodeAt(c++),56320==(p&64512)?b.push(((h&1023)<<10)+(p&1023)+65536):(b.push(h),c--)):b.push(h);return b}function g(a){return u(a,function(a){var b="";65535<a&&(a-=65536,b+=x(a>>>10&1023|55296),a=56320|a&1023);return b+=x(a)}).join("")}function q(a,\n
b){return a+22+75*(26>a)-((0!=b)<<5)}function l(a,b,c){var d=0;a=c?A(a/H):a>>1;for(a+=A(a/b);a>n*y>>1;d+=s)a=A(a/n);return A(d+(n+1)*a/(a+I))}function r(b){var c=[],d=b.length,h,p=0,e=F,f=G,n,x,q,t,m;n=b.lastIndexOf(a);0>n&&(n=0);for(x=0;x<n;++x)128<=b.charCodeAt(x)&&k("not-basic"),c.push(b.charCodeAt(x));for(n=0<n?n+1:0;n<d;){x=p;h=1;for(q=s;;q+=s){n>=d&&k("invalid-input");t=b.charCodeAt(n++);t=10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:s;(t>=s||t>A((w-p)/h))&&k("overflow");p+=t*h;m=q<=f?v:q>=f+y?y:\n
q-f;if(t<m)break;t=s-m;h>A(w/t)&&k("overflow");h*=t}h=c.length+1;f=l(p-x,h,0==x);A(p/h)>w-e&&k("overflow");e+=A(p/h);p%=h;c.splice(p++,0,e)}return g(c)}function z(b){var c,h,p,e,f,n,g,m,r,t=[],B,u,z;b=d(b);B=b.length;c=F;h=0;f=G;for(n=0;n<B;++n)r=b[n],128>r&&t.push(x(r));for((p=e=t.length)&&t.push(a);p<B;){g=w;for(n=0;n<B;++n)r=b[n],r>=c&&r<g&&(g=r);u=p+1;g-c>A((w-h)/u)&&k("overflow");h+=(g-c)*u;c=g;for(n=0;n<B;++n)if(r=b[n],r<c&&++h>w&&k("overflow"),r==c){m=h;for(g=s;;g+=s){r=g<=f?v:g>=f+y?y:g-f;\n
if(m<r)break;z=m-r;m=s-r;t.push(x(q(r+z%m,0)));m=A(z/m)}t.push(x(q(m,0)));f=l(h,u,p==e);h=0;++p}++h;++c}return t.join("")}var D="object"==typeof exports&&exports,E="object"==typeof module&&module&&module.exports==D&&module,C="object"==typeof global&&global;if(C.global===C||C.window===C)e=C;var f,w=2147483647,s=36,v=1,y=26,I=38,H=700,G=72,F=128,a="-",b=/^xn--/,c=/[^ -~]/,h=/\\x2E|\\u3002|\\uFF0E|\\uFF61/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)",\n
"invalid-input":"Invalid input"},n=s-v,A=Math.floor,x=String.fromCharCode,B;f={version:"1.2.3",ucs2:{decode:d,encode:g},decode:r,encode:z,toASCII:function(a){return m(a,function(a){return c.test(a)?"xn--"+z(a):a})},toUnicode:function(a){return m(a,function(a){return b.test(a)?r(a.slice(4).toLowerCase()):a})}};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return f});else if(D&&!D.nodeType)if(E)E.exports=f;else for(B in f)f.hasOwnProperty(B)&&(D[B]=f[B]);else e.punycode=\n
f})(this);\n
(function(e,k){"object"===typeof exports?module.exports=k():"function"===typeof define&&define.amd?define(k):e.SecondLevelDomains=k(e)})(this,function(e){var k=e&&e.SecondLevelDomains,u=Object.prototype.hasOwnProperty,m={list:{ac:"com|gov|mil|net|org",ae:"ac|co|gov|mil|name|net|org|pro|sch",af:"com|edu|gov|net|org",al:"com|edu|gov|mil|net|org",ao:"co|ed|gv|it|og|pb",ar:"com|edu|gob|gov|int|mil|net|org|tur",at:"ac|co|gv|or",au:"asn|com|csiro|edu|gov|id|net|org",ba:"co|com|edu|gov|mil|net|org|rs|unbi|unmo|unsa|untz|unze",bb:"biz|co|com|edu|gov|info|net|org|store|tv",\n
bh:"biz|cc|com|edu|gov|info|net|org",bn:"com|edu|gov|net|org",bo:"com|edu|gob|gov|int|mil|net|org|tv",br:"adm|adv|agr|am|arq|art|ato|b|bio|blog|bmd|cim|cng|cnt|com|coop|ecn|edu|eng|esp|etc|eti|far|flog|fm|fnd|fot|fst|g12|ggf|gov|imb|ind|inf|jor|jus|lel|mat|med|mil|mus|net|nom|not|ntr|odo|org|ppg|pro|psc|psi|qsl|rec|slg|srv|tmp|trd|tur|tv|vet|vlog|wiki|zlg",bs:"com|edu|gov|net|org",bz:"du|et|om|ov|rg",ca:"ab|bc|mb|nb|nf|nl|ns|nt|nu|on|pe|qc|sk|yk",ck:"biz|co|edu|gen|gov|info|net|org",cn:"ac|ah|bj|com|cq|edu|fj|gd|gov|gs|gx|gz|ha|hb|he|hi|hl|hn|jl|js|jx|ln|mil|net|nm|nx|org|qh|sc|sd|sh|sn|sx|tj|tw|xj|xz|yn|zj",\n
co:"com|edu|gov|mil|net|nom|org",cr:"ac|c|co|ed|fi|go|or|sa",cy:"ac|biz|com|ekloges|gov|ltd|name|net|org|parliament|press|pro|tm","do":"art|com|edu|gob|gov|mil|net|org|sld|web",dz:"art|asso|com|edu|gov|net|org|pol",ec:"com|edu|fin|gov|info|med|mil|net|org|pro",eg:"com|edu|eun|gov|mil|name|net|org|sci",er:"com|edu|gov|ind|mil|net|org|rochest|w",es:"com|edu|gob|nom|org",et:"biz|com|edu|gov|info|name|net|org",fj:"ac|biz|com|info|mil|name|net|org|pro",fk:"ac|co|gov|net|nom|org",fr:"asso|com|f|gouv|nom|prd|presse|tm",\n
gg:"co|net|org",gh:"com|edu|gov|mil|org",gn:"ac|com|gov|net|org",gr:"com|edu|gov|mil|net|org",gt:"com|edu|gob|ind|mil|net|org",gu:"com|edu|gov|net|org",hk:"com|edu|gov|idv|net|org",id:"ac|co|go|mil|net|or|sch|web",il:"ac|co|gov|idf|k12|muni|net|org","in":"ac|co|edu|ernet|firm|gen|gov|i|ind|mil|net|nic|org|res",iq:"com|edu|gov|i|mil|net|org",ir:"ac|co|dnssec|gov|i|id|net|org|sch",it:"edu|gov",je:"co|net|org",jo:"com|edu|gov|mil|name|net|org|sch",jp:"ac|ad|co|ed|go|gr|lg|ne|or",ke:"ac|co|go|info|me|mobi|ne|or|sc",\n
kh:"com|edu|gov|mil|net|org|per",ki:"biz|com|de|edu|gov|info|mob|net|org|tel",km:"asso|com|coop|edu|gouv|k|medecin|mil|nom|notaires|pharmaciens|presse|tm|veterinaire",kn:"edu|gov|net|org",kr:"ac|busan|chungbuk|chungnam|co|daegu|daejeon|es|gangwon|go|gwangju|gyeongbuk|gyeonggi|gyeongnam|hs|incheon|jeju|jeonbuk|jeonnam|k|kg|mil|ms|ne|or|pe|re|sc|seoul|ulsan",kw:"com|edu|gov|net|org",ky:"com|edu|gov|net|org",kz:"com|edu|gov|mil|net|org",lb:"com|edu|gov|net|org",lk:"assn|com|edu|gov|grp|hotel|int|ltd|net|ngo|org|sch|soc|web",\n
lr:"com|edu|gov|net|org",lv:"asn|com|conf|edu|gov|id|mil|net|org",ly:"com|edu|gov|id|med|net|org|plc|sch",ma:"ac|co|gov|m|net|org|press",mc:"asso|tm",me:"ac|co|edu|gov|its|net|org|priv",mg:"com|edu|gov|mil|nom|org|prd|tm",mk:"com|edu|gov|inf|name|net|org|pro",ml:"com|edu|gov|net|org|presse",mn:"edu|gov|org",mo:"com|edu|gov|net|org",mt:"com|edu|gov|net|org",mv:"aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro",mw:"ac|co|com|coop|edu|gov|int|museum|net|org",mx:"com|edu|gob|net|org",my:"com|edu|gov|mil|name|net|org|sch",\n
nf:"arts|com|firm|info|net|other|per|rec|store|web",ng:"biz|com|edu|gov|mil|mobi|name|net|org|sch",ni:"ac|co|com|edu|gob|mil|net|nom|org",np:"com|edu|gov|mil|net|org",nr:"biz|com|edu|gov|info|net|org",om:"ac|biz|co|com|edu|gov|med|mil|museum|net|org|pro|sch",pe:"com|edu|gob|mil|net|nom|org|sld",ph:"com|edu|gov|i|mil|net|ngo|org",pk:"biz|com|edu|fam|gob|gok|gon|gop|gos|gov|net|org|web",pl:"art|bialystok|biz|com|edu|gda|gdansk|gorzow|gov|info|katowice|krakow|lodz|lublin|mil|net|ngo|olsztyn|org|poznan|pwr|radom|slupsk|szczecin|torun|warszawa|waw|wroc|wroclaw|zgora",\n
pr:"ac|biz|com|edu|est|gov|info|isla|name|net|org|pro|prof",ps:"com|edu|gov|net|org|plo|sec",pw:"belau|co|ed|go|ne|or",ro:"arts|com|firm|info|nom|nt|org|rec|store|tm|www",rs:"ac|co|edu|gov|in|org",sb:"com|edu|gov|net|org",sc:"com|edu|gov|net|org",sh:"co|com|edu|gov|net|nom|org",sl:"com|edu|gov|net|org",st:"co|com|consulado|edu|embaixada|gov|mil|net|org|principe|saotome|store",sv:"com|edu|gob|org|red",sz:"ac|co|org",tr:"av|bbs|bel|biz|com|dr|edu|gen|gov|info|k12|name|net|org|pol|tel|tsk|tv|web",tt:"aero|biz|cat|co|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel",\n
tw:"club|com|ebiz|edu|game|gov|idv|mil|net|org",mu:"ac|co|com|gov|net|or|org",mz:"ac|co|edu|gov|org",na:"co|com",nz:"ac|co|cri|geek|gen|govt|health|iwi|maori|mil|net|org|parliament|school",pa:"abo|ac|com|edu|gob|ing|med|net|nom|org|sld",pt:"com|edu|gov|int|net|nome|org|publ",py:"com|edu|gov|mil|net|org",qa:"com|edu|gov|mil|net|org",re:"asso|com|nom",ru:"ac|adygeya|altai|amur|arkhangelsk|astrakhan|bashkiria|belgorod|bir|bryansk|buryatia|cbg|chel|chelyabinsk|chita|chukotka|chuvashia|com|dagestan|e-burg|edu|gov|grozny|int|irkutsk|ivanovo|izhevsk|jar|joshkar-ola|kalmykia|kaluga|kamchatka|karelia|kazan|kchr|kemerovo|khabarovsk|khakassia|khv|kirov|koenig|komi|kostroma|kranoyarsk|kuban|kurgan|kursk|lipetsk|magadan|mari|mari-el|marine|mil|mordovia|mosreg|msk|murmansk|nalchik|net|nnov|nov|novosibirsk|nsk|omsk|orenburg|org|oryol|penza|perm|pp|pskov|ptz|rnd|ryazan|sakhalin|samara|saratov|simbirsk|smolensk|spb|stavropol|stv|surgut|tambov|tatarstan|tom|tomsk|tsaritsyn|tsk|tula|tuva|tver|tyumen|udm|udmurtia|ulan-ude|vladikavkaz|vladimir|vladivostok|volgograd|vologda|voronezh|vrn|vyatka|yakutia|yamal|yekaterinburg|yuzhno-sakhalinsk",\n
rw:"ac|co|com|edu|gouv|gov|int|mil|net",sa:"com|edu|gov|med|net|org|pub|sch",sd:"com|edu|gov|info|med|net|org|tv",se:"a|ac|b|bd|c|d|e|f|g|h|i|k|l|m|n|o|org|p|parti|pp|press|r|s|t|tm|u|w|x|y|z",sg:"com|edu|gov|idn|net|org|per",sn:"art|com|edu|gouv|org|perso|univ",sy:"com|edu|gov|mil|net|news|org",th:"ac|co|go|in|mi|net|or",tj:"ac|biz|co|com|edu|go|gov|info|int|mil|name|net|nic|org|test|web",tn:"agrinet|com|defense|edunet|ens|fin|gov|ind|info|intl|mincom|nat|net|org|perso|rnrt|rns|rnu|tourism",tz:"ac|co|go|ne|or",\n
ua:"biz|cherkassy|chernigov|chernovtsy|ck|cn|co|com|crimea|cv|dn|dnepropetrovsk|donetsk|dp|edu|gov|if|in|ivano-frankivsk|kh|kharkov|kherson|khmelnitskiy|kiev|kirovograd|km|kr|ks|kv|lg|lugansk|lutsk|lviv|me|mk|net|nikolaev|od|odessa|org|pl|poltava|pp|rovno|rv|sebastopol|sumy|te|ternopil|uzhgorod|vinnica|vn|zaporizhzhe|zhitomir|zp|zt",ug:"ac|co|go|ne|or|org|sc",uk:"ac|bl|british-library|co|cym|gov|govt|icnet|jet|lea|ltd|me|mil|mod|national-library-scotland|nel|net|nhs|nic|nls|org|orgn|parliament|plc|police|sch|scot|soc",\n
us:"dni|fed|isa|kids|nsn",uy:"com|edu|gub|mil|net|org",ve:"co|com|edu|gob|info|mil|net|org|web",vi:"co|com|k12|net|org",vn:"ac|biz|com|edu|gov|health|info|int|name|net|org|pro",ye:"co|com|gov|ltd|me|net|org|plc",yu:"ac|co|edu|gov|org",za:"ac|agric|alt|bourse|city|co|cybernet|db|edu|gov|grondar|iaccess|imt|inca|landesign|law|mil|net|ngo|nis|nom|olivetti|org|pix|school|tm|web",zm:"ac|co|com|edu|gov|net|org|sch"},has_expression:null,is_expression:null,has:function(d){return!!d.match(m.has_expression)},\n
is:function(d){return!!d.match(m.is_expression)},get:function(d){return(d=d.match(m.has_expression))&&d[1]||null},noConflict:function(){e.SecondLevelDomains===this&&(e.SecondLevelDomains=k);return this},init:function(){var d="",e;for(e in m.list)u.call(m.list,e)&&(d+="|("+("("+m.list[e]+")."+e)+")");m.has_expression=RegExp("\\\\.("+d.substr(1)+")$","i");m.is_expression=RegExp("^("+d.substr(1)+")$","i")}};m.init();return m});\n
(function(e,k){"object"===typeof exports?module.exports=k(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"===typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],k):e.URI=k(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(this,function(e,k,u,m){function d(a,b){if(!(this instanceof d))return new d(a,b);void 0===a&&(a="undefined"!==typeof location?location.href+"":"");this.href(a);return void 0!==b?this.absoluteTo(b):this}function g(a){return a.replace(/([.*+?^=!:${}()|[\\]\\/\\\\])/g,\n
"\\\\$1")}function q(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function l(a){return"Array"===q(a)}function r(a,b){var c,d;if(l(b)){c=0;for(d=b.length;c<d;c++)if(!r(a,b[c]))return!1;return!0}var p=q(b);c=0;for(d=a.length;c<d;c++)if("RegExp"===p){if("string"===typeof a[c]&&a[c].match(b))return!0}else if(a[c]===b)return!0;return!1}function z(a,b){if(!l(a)||!l(b)||a.length!==b.length)return!1;a.sort();b.sort();for(var c=0,d=a.length;c<d;c++)if(a[c]!==b[c])return!1;\n
return!0}function D(a){return escape(a)}function E(a){return encodeURIComponent(a).replace(/[!\'()*]/g,D).replace(/\\*/g,"%2A")}var C=m&&m.URI;d.version="1.12.0";var f=d.prototype,w=Object.prototype.hasOwnProperty;d._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:d.duplicateQueryParameters,escapeQuerySpace:d.escapeQuerySpace}};d.duplicateQueryParameters=!1;d.escapeQuerySpace=!0;d.protocol_expression=\n
/^[a-z][a-z0-9.+-]*$/i;d.idn_expression=/[^a-z0-9\\.-]/i;d.punycode_expression=/(xn--)/i;d.ip4_expression=/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;d.ip6_expression=/^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$/;\n
d.find_uri_expression=/\\b((?:[a-z][\\w-]+:(?:\\/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\\/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:\'".,<>?\\u00ab\\u00bb\\u201c\\u201d\\u2018\\u2019]))/ig;d.findUri={start:/\\b(?:([a-z][a-z0-9.+-]*:\\/\\/)|www\\.)/gi,end:/[\\s\\r\\n]|$/,trim:/[`!()\\[\\]{};:\'".,<>?\\u00ab\\u00bb\\u201c\\u201d\\u201e\\u2018\\u2019]+$/};d.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};d.invalid_hostname_characters=\n
/[^a-zA-Z0-9\\.-]/;d.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src"};d.getDomAttribute=function(a){if(a&&a.nodeName){var b=a.nodeName.toLowerCase();return"input"===b&&"image"!==a.type?void 0:d.domAttributes[b]}};d.encode=E;d.decode=decodeURIComponent;d.iso8859=function(){d.encode=escape;d.decode=unescape};d.unicode=function(){d.encode=E;d.decode=decodeURIComponent};d.characters=\n
{pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\\/\\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"\'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}};d.encodeQuery=\n
function(a,b){var c=d.encode(a+"");return b?c.replace(/%20/g,"+"):c};d.decodeQuery=function(a,b){a+="";try{return d.decode(b?a.replace(/\\+/g,"%20"):a)}catch(c){return a}};d.recodePath=function(a){a=(a+"").split("/");for(var b=0,c=a.length;b<c;b++)a[b]=d.encodePathSegment(d.decode(a[b]));return a.join("/")};d.decodePath=function(a){a=(a+"").split("/");for(var b=0,c=a.length;b<c;b++)a[b]=d.decodePathSegment(a[b]);return a.join("/")};var s={encode:"encode",decode:"decode"},v,y=function(a,b){return function(c){return d[b](c+\n
"").replace(d.characters[a][b].expression,function(c){return d.characters[a][b].map[c]})}};for(v in s)d[v+"PathSegment"]=y("pathname",s[v]);d.encodeReserved=y("reserved","encode");d.parse=function(a,b){var c;b||(b={});c=a.indexOf("#");-1<c&&(b.fragment=a.substring(c+1)||null,a=a.substring(0,c));c=a.indexOf("?");-1<c&&(b.query=a.substring(c+1)||null,a=a.substring(0,c));"//"===a.substring(0,2)?(b.protocol=null,a=a.substring(2),a=d.parseAuthority(a,b)):(c=a.indexOf(":"),-1<c&&(b.protocol=a.substring(0,\n
c)||null,b.protocol&&!b.protocol.match(d.protocol_expression)?b.protocol=void 0:"file"===b.protocol?a=a.substring(c+3):"//"===a.substring(c+1,c+3)?(a=a.substring(c+3),a=d.parseAuthority(a,b)):(a=a.substring(c+1),b.urn=!0)));b.path=a;return b};d.parseHost=function(a,b){var c=a.indexOf("/"),d;-1===c&&(c=a.length);"["===a.charAt(0)?(d=a.indexOf("]"),b.hostname=a.substring(1,d)||null,b.port=a.substring(d+2,c)||null):a.indexOf(":")!==a.lastIndexOf(":")?(b.hostname=a.substring(0,c)||null,b.port=null):(d=\n
a.substring(0,c).split(":"),b.hostname=d[0]||null,b.port=d[1]||null);b.hostname&&"/"!==a.substring(c).charAt(0)&&(c++,a="/"+a);return a.substring(c)||"/"};d.parseAuthority=function(a,b){a=d.parseUserinfo(a,b);return d.parseHost(a,b)};d.parseUserinfo=function(a,b){var c=a.indexOf("/"),h=-1<c?a.lastIndexOf("@",c):a.indexOf("@");-1<h&&(-1===c||h<c)?(c=a.substring(0,h).split(":"),b.username=c[0]?d.decode(c[0]):null,c.shift(),b.password=c[0]?d.decode(c.join(":")):null,a=a.substring(h+1)):(b.username=null,\n
b.password=null);return a};d.parseQuery=function(a,b){if(!a)return{};a=a.replace(/&+/g,"&").replace(/^\\?*&*|&+$/g,"");if(!a)return{};for(var c={},h=a.split("&"),p=h.length,n,e,f=0;f<p;f++)n=h[f].split("="),e=d.decodeQuery(n.shift(),b),n=n.length?d.decodeQuery(n.join("="),b):null,c[e]?("string"===typeof c[e]&&(c[e]=[c[e]]),c[e].push(n)):c[e]=n;return c};d.build=function(a){var b="";a.protocol&&(b+=a.protocol+":");a.urn||!b&&!a.hostname||(b+="//");b+=d.buildAuthority(a)||"";"string"===typeof a.path&&\n
("/"!==a.path.charAt(0)&&"string"===typeof a.hostname&&(b+="/"),b+=a.path);"string"===typeof a.query&&a.query&&(b+="?"+a.query);"string"===typeof a.fragment&&a.fragment&&(b+="#"+a.fragment);return b};d.buildHost=function(a){var b="";if(a.hostname)d.ip6_expression.test(a.hostname)?b=a.port?b+("["+a.hostname+"]:"+a.port):b+a.hostname:(b+=a.hostname,a.port&&(b+=":"+a.port));else return"";return b};d.buildAuthority=function(a){return d.buildUserinfo(a)+d.buildHost(a)};d.buildUserinfo=function(a){var b=\n
"";a.username&&(b+=d.encode(a.username),a.password&&(b+=":"+d.encode(a.password)),b+="@");return b};d.buildQuery=function(a,b,c){var h="",p,e,f,k;for(e in a)if(w.call(a,e)&&e)if(l(a[e]))for(p={},f=0,k=a[e].length;f<k;f++)void 0!==a[e][f]&&void 0===p[a[e][f]+""]&&(h+="&"+d.buildQueryParameter(e,a[e][f],c),!0!==b&&(p[a[e][f]+""]=!0));else void 0!==a[e]&&(h+="&"+d.buildQueryParameter(e,a[e],c));return h.substring(1)};d.buildQueryParameter=function(a,b,c){return d.encodeQuery(a,c)+(null!==b?"="+d.encodeQuery(b,\n
c):"")};d.addQuery=function(a,b,c){if("object"===typeof b)for(var h in b)w.call(b,h)&&d.addQuery(a,h,b[h]);else if("string"===typeof b)void 0===a[b]?a[b]=c:("string"===typeof a[b]&&(a[b]=[a[b]]),l(c)||(c=[c]),a[b]=a[b].concat(c));else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");};d.removeQuery=function(a,b,c){var h;if(l(b))for(c=0,h=b.length;c<h;c++)a[b[c]]=void 0;else if("object"===typeof b)for(h in b)w.call(b,h)&&d.removeQuery(a,h,b[h]);else if("string"===\n
typeof b)if(void 0!==c)if(a[b]===c)a[b]=void 0;else{if(l(a[b])){h=a[b];var p={},e,f;if(l(c))for(e=0,f=c.length;e<f;e++)p[c[e]]=!0;else p[c]=!0;e=0;for(f=h.length;e<f;e++)void 0!==p[h[e]]&&(h.splice(e,1),f--,e--);a[b]=h}}else a[b]=void 0;else throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");};d.hasQuery=function(a,b,c,h){if("object"===typeof b){for(var e in b)if(w.call(b,e)&&!d.hasQuery(a,e,b[e]))return!1;return!0}if("string"!==typeof b)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");\n
switch(q(c)){case "Undefined":return b in a;case "Boolean":return a=Boolean(l(a[b])?a[b].length:a[b]),c===a;case "Function":return!!c(a[b],b,a);case "Array":return l(a[b])?(h?r:z)(a[b],c):!1;case "RegExp":return l(a[b])?h?r(a[b],c):!1:Boolean(a[b]&&a[b].match(c));case "Number":c=String(c);case "String":return l(a[b])?h?r(a[b],c):!1:a[b]===c;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");}};d.commonPath=function(a,b){var c=\n
Math.min(a.length,b.length),d;for(d=0;d<c;d++)if(a.charAt(d)!==b.charAt(d)){d--;break}if(1>d)return a.charAt(0)===b.charAt(0)&&"/"===a.charAt(0)?"/":"";if("/"!==a.charAt(d)||"/"!==b.charAt(d))d=a.substring(0,d).lastIndexOf("/");return a.substring(0,d+1)};d.withinString=function(a,b,c){c||(c={});var h=c.start||d.findUri.start,e=c.end||d.findUri.end,f=c.trim||d.findUri.trim,k=/[a-z0-9-]=["\']?$/i;for(h.lastIndex=0;;){var g=h.exec(a);if(!g)break;g=g.index;if(c.ignoreHtml){var l=a.slice(Math.max(g-3,0),\n
g);if(l&&k.test(l))continue}var l=g+a.slice(g).search(e),q=a.slice(g,l).replace(f,"");c.ignore&&c.ignore.test(q)||(l=g+q.length,q=b(q,g,l,a),a=a.slice(0,g)+q+a.slice(l),h.lastIndex=g+q.length)}h.lastIndex=0;return a};d.ensureValidHostname=function(a){if(a.match(d.invalid_hostname_characters)){if(!e)throw new TypeError("Hostname \'"+a+"\' contains characters other than [A-Z0-9.-] and Punycode.js is not available");if(e.toASCII(a).match(d.invalid_hostname_characters))throw new TypeError("Hostname \'"+\n
a+"\' contains characters other than [A-Z0-9.-]");}};d.noConflict=function(a){if(a)return a={URI:this.noConflict()},URITemplate&&"function"==typeof URITemplate.noConflict&&(a.URITemplate=URITemplate.noConflict()),k&&"function"==typeof k.noConflict&&(a.IPv6=k.noConflict()),SecondLevelDomains&&"function"==typeof SecondLevelDomains.noConflict&&(a.SecondLevelDomains=SecondLevelDomains.noConflict()),a;m.URI===this&&(m.URI=C);return this};f.build=function(a){if(!0===a)this._deferred_build=!0;else if(void 0===\n
a||this._deferred_build)this._string=d.build(this._parts),this._deferred_build=!1;return this};f.clone=function(){return new d(this)};f.valueOf=f.toString=function(){return this.build(!1)._string};s={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"};y=function(a){return function(b,c){if(void 0===b)return this._parts[a]||"";this._parts[a]=b||null;this.build(!c);return this}};for(v in s)f[v]=y(s[v]);s={query:"?",fragment:"#"};y=function(a,b){return function(c,\n
d){if(void 0===c)return this._parts[a]||"";null!==c&&(c+="",c.charAt(0)===b&&(c=c.substring(1)));this._parts[a]=c;this.build(!d);return this}};for(v in s)f[v]=y(v,s[v]);s={search:["?","query"],hash:["#","fragment"]};y=function(a,b){return function(c,d){var e=this[a](c,d);return"string"===typeof e&&e.length?b+e:e}};for(v in s)f[v]=y(s[v][1],s[v][0]);f.pathname=function(a,b){if(void 0===a||!0===a){var c=this._parts.path||(this._parts.hostname?"/":"");return a?d.decodePath(c):c}this._parts.path=a?d.recodePath(a):\n
"/";this.build(!b);return this};f.path=f.pathname;f.href=function(a,b){var c;if(void 0===a)return this.toString();this._string="";this._parts=d._parts();var h=a instanceof d,e="object"===typeof a&&(a.hostname||a.path||a.pathname);a.nodeName&&(e=d.getDomAttribute(a),a=a[e]||"",e=!1);!h&&e&&void 0!==a.pathname&&(a=a.toString());if("string"===typeof a)this._parts=d.parse(a,this._parts);else if(h||e)for(c in h=h?a._parts:a,h)w.call(this._parts,c)&&(this._parts[c]=h[c]);else throw new TypeError("invalid input");\n
this.build(!b);return this};f.is=function(a){var b=!1,c=!1,h=!1,e=!1,f=!1,g=!1,k=!1,l=!this._parts.urn;this._parts.hostname&&(l=!1,c=d.ip4_expression.test(this._parts.hostname),h=d.ip6_expression.test(this._parts.hostname),b=c||h,f=(e=!b)&&u&&u.has(this._parts.hostname),g=e&&d.idn_expression.test(this._parts.hostname),k=e&&d.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case "relative":return l;case "absolute":return!l;case "domain":case "name":return e;case "sld":return f;\n
case "ip":return b;case "ip4":case "ipv4":case "inet4":return c;case "ip6":case "ipv6":case "inet6":return h;case "idn":return g;case "url":return!this._parts.urn;case "urn":return!!this._parts.urn;case "punycode":return k}return null};var I=f.protocol,H=f.port,G=f.hostname;f.protocol=function(a,b){if(void 0!==a&&a&&(a=a.replace(/:(\\/\\/)?$/,""),!a.match(d.protocol_expression)))throw new TypeError("Protocol \'"+a+"\' contains characters other than [A-Z0-9.+-] or doesn\'t start with [A-Z]");return I.call(this,\n
a,b)};f.scheme=f.protocol;f.port=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a&&(0===a&&(a=null),a&&(a+="",":"===a.charAt(0)&&(a=a.substring(1)),a.match(/[^0-9]/))))throw new TypeError("Port \'"+a+"\' contains characters other than [0-9]");return H.call(this,a,b)};f.hostname=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a){var c={};d.parseHost(a,c);a=c.hostname}return G.call(this,a,b)};f.host=function(a,b){if(this._parts.urn)return void 0===a?"":this;\n
if(void 0===a)return this._parts.hostname?d.buildHost(this._parts):"";d.parseHost(a,this._parts);this.build(!b);return this};f.authority=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?d.buildAuthority(this._parts):"";d.parseAuthority(a,this._parts);this.build(!b);return this};f.userinfo=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.username)return"";var c=d.buildUserinfo(this._parts);return c.substring(0,\n
c.length-1)}"@"!==a[a.length-1]&&(a+="@");d.parseUserinfo(a,this._parts);this.build(!b);return this};f.resource=function(a,b){var c;if(void 0===a)return this.path()+this.search()+this.hash();c=d.parse(a);this._parts.path=c.path;this._parts.query=c.query;this._parts.fragment=c.fragment;this.build(!b);return this};f.subdomain=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var c=this._parts.hostname.length-this.domain().length-\n
1;return this._parts.hostname.substring(0,c)||""}c=this._parts.hostname.length-this.domain().length;c=this._parts.hostname.substring(0,c);c=RegExp("^"+g(c));a&&"."!==a.charAt(a.length-1)&&(a+=".");a&&d.ensureValidHostname(a);this._parts.hostname=this._parts.hostname.replace(c,a);this.build(!b);return this};f.domain=function(a,b){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var c=this._parts.hostname.match(/\\./g);\n
if(c&&2>c.length)return this._parts.hostname;c=this._parts.hostname.length-this.tld(b).length-1;c=this._parts.hostname.lastIndexOf(".",c-1)+1;return this._parts.hostname.substring(c)||""}if(!a)throw new TypeError("cannot set domain empty");d.ensureValidHostname(a);!this._parts.hostname||this.is("IP")?this._parts.hostname=a:(c=RegExp(g(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(c,a));this.build(!b);return this};f.tld=function(a,b){if(this._parts.urn)return void 0===a?"":\n
this;"boolean"===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var c=this._parts.hostname.lastIndexOf("."),c=this._parts.hostname.substring(c+1);return!0!==b&&u&&u.list[c.toLowerCase()]?u.get(this._parts.hostname)||c:c}if(a)if(a.match(/[^a-zA-Z0-9-]/))if(u&&u.is(a))c=RegExp(g(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(c,a);else throw new TypeError("TLD \'"+a+"\' contains characters other than [A-Z0-9]");else{if(!this._parts.hostname||\n
this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");c=RegExp(g(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(c,a)}else throw new TypeError("cannot set TLD empty");this.build(!b);return this};f.directory=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var c=this._parts.path.length-this.filename().length-1,c=this._parts.path.substring(0,\n
c)||(this._parts.hostname?"/":"");return a?d.decodePath(c):c}c=this._parts.path.length-this.filename().length;c=this._parts.path.substring(0,c);c=RegExp("^"+g(c));this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a));a&&"/"!==a.charAt(a.length-1)&&(a+="/");a=d.recodePath(a);this._parts.path=this._parts.path.replace(c,a);this.build(!b);return this};f.filename=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";\n
var c=this._parts.path.lastIndexOf("/"),c=this._parts.path.substring(c+1);return a?d.decodePathSegment(c):c}c=!1;"/"===a.charAt(0)&&(a=a.substring(1));a.match(/\\.?\\//)&&(c=!0);var h=RegExp(g(this.filename())+"$");a=d.recodePath(a);this._parts.path=this._parts.path.replace(h,a);c?this.normalizePath(b):this.build(!b);return this};f.suffix=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var c=this.filename(),h=c.lastIndexOf(".");\n
if(-1===h)return"";c=c.substring(h+1);c=/^[a-z0-9%]+$/i.test(c)?c:"";return a?d.decodePathSegment(c):c}"."===a.charAt(0)&&(a=a.substring(1));if(c=this.suffix())h=a?RegExp(g(c)+"$"):RegExp(g("."+c)+"$");else{if(!a)return this;this._parts.path+="."+d.recodePath(a)}h&&(a=d.recodePath(a),this._parts.path=this._parts.path.replace(h,a));this.build(!b);return this};f.segment=function(a,b,c){var d=this._parts.urn?":":"/",e=this.path(),f="/"===e.substring(0,1),e=e.split(d);void 0!==a&&"number"!==typeof a&&\n
(c=b,b=a,a=void 0);if(void 0!==a&&"number"!==typeof a)throw Error("Bad segment \'"+a+"\', must be 0-based integer");f&&e.shift();0>a&&(a=Math.max(e.length+a,0));if(void 0===b)return void 0===a?e:e[a];if(null===a||void 0===e[a])if(l(b)){e=[];a=0;for(var g=b.length;a<g;a++)if(b[a].length||e.length&&e[e.length-1].length)e.length&&!e[e.length-1].length&&e.pop(),e.push(b[a])}else{if(b||"string"===typeof b)""===e[e.length-1]?e[e.length-1]=b:e.push(b)}else b||"string"===typeof b&&b.length?e[a]=b:e.splice(a,\n
1);f&&e.unshift("");return this.path(e.join(d),c)};f.segmentCoded=function(a,b,c){var e,f;"number"!==typeof a&&(c=b,b=a,a=void 0);if(void 0===b){a=this.segment(a,b,c);if(l(a))for(e=0,f=a.length;e<f;e++)a[e]=d.decode(a[e]);else a=void 0!==a?d.decode(a):void 0;return a}if(l(b))for(e=0,f=b.length;e<f;e++)b[e]=d.decode(b[e]);else b="string"===typeof b?d.encode(b):b;return this.segment(a,b,c)};var F=f.query;f.query=function(a,b){if(!0===a)return d.parseQuery(this._parts.query,this._parts.escapeQuerySpace);\n
if("function"===typeof a){var c=d.parseQuery(this._parts.query,this._parts.escapeQuerySpace),e=a.call(this,c);this._parts.query=d.buildQuery(e||c,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);this.build(!b);return this}return void 0!==a&&"string"!==typeof a?(this._parts.query=d.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this):F.call(this,a,b)};f.setQuery=function(a,b,c){var e=d.parseQuery(this._parts.query,this._parts.escapeQuerySpace);\n
if("object"===typeof a)for(var f in a)w.call(a,f)&&(e[f]=a[f]);else if("string"===typeof a)e[a]=void 0!==b?b:null;else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");this._parts.query=d.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(c=b);this.build(!c);return this};f.addQuery=function(a,b,c){var e=d.parseQuery(this._parts.query,this._parts.escapeQuerySpace);d.addQuery(e,a,void 0===b?null:b);this._parts.query=\n
d.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(c=b);this.build(!c);return this};f.removeQuery=function(a,b,c){var e=d.parseQuery(this._parts.query,this._parts.escapeQuerySpace);d.removeQuery(e,a,b);this._parts.query=d.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(c=b);this.build(!c);return this};f.hasQuery=function(a,b,c){var e=d.parseQuery(this._parts.query,this._parts.escapeQuerySpace);\n
return d.hasQuery(e,a,b,c)};f.setSearch=f.setQuery;f.addSearch=f.addQuery;f.removeSearch=f.removeQuery;f.hasSearch=f.hasQuery;f.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()};f.normalizeProtocol=function(a){"string"===typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),\n
this.build(!a));return this};f.normalizeHostname=function(a){this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&k&&(this._parts.hostname=k.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!a));return this};f.normalizePort=function(a){"string"===typeof this._parts.protocol&&this._parts.port===d.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!a));return this};f.normalizePath=\n
function(a){if(this._parts.urn||!this._parts.path||"/"===this._parts.path)return this;var b,c=this._parts.path,e="",f,g;"/"!==c.charAt(0)&&(b=!0,c="/"+c);c=c.replace(/(\\/(\\.\\/)+)|(\\/\\.$)/g,"/").replace(/\\/{2,}/g,"/");b&&(e=c.substring(1).match(/^(\\.\\.\\/)+/)||"")&&(e=e[0]);for(;;){f=c.indexOf("/..");if(-1===f)break;else if(0===f){c=c.substring(3);continue}g=c.substring(0,f).lastIndexOf("/");-1===g&&(g=f);c=c.substring(0,g)+c.substring(f+3)}b&&this.is("relative")&&(c=e+c.substring(1));c=d.recodePath(c);\n
this._parts.path=c;this.build(!a);return this};f.normalizePathname=f.normalizePath;f.normalizeQuery=function(a){"string"===typeof this._parts.query&&(this._parts.query.length?this.query(d.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!a));return this};f.normalizeFragment=function(a){this._parts.fragment||(this._parts.fragment=null,this.build(!a));return this};f.normalizeSearch=f.normalizeQuery;f.normalizeHash=f.normalizeFragment;f.iso8859=function(){var a=\n
d.encode,b=d.decode;d.encode=escape;d.decode=decodeURIComponent;this.normalize();d.encode=a;d.decode=b;return this};f.unicode=function(){var a=d.encode,b=d.decode;d.encode=E;d.decode=unescape;this.normalize();d.encode=a;d.decode=b;return this};f.readable=function(){var a=this.clone();a.username("").password("").normalize();var b="";a._parts.protocol&&(b+=a._parts.protocol+"://");a._parts.hostname&&(a.is("punycode")&&e?(b+=e.toUnicode(a._parts.hostname),a._parts.port&&(b+=":"+a._parts.port)):b+=a.host());\n
a._parts.hostname&&a._parts.path&&"/"!==a._parts.path.charAt(0)&&(b+="/");b+=a.path(!0);if(a._parts.query){for(var c="",f=0,g=a._parts.query.split("&"),k=g.length;f<k;f++){var l=(g[f]||"").split("="),c=c+("&"+d.decodeQuery(l[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"));void 0!==l[1]&&(c+="="+d.decodeQuery(l[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}b+="?"+c.substring(1)}return b+=d.decodeQuery(a.hash(),!0)};f.absoluteTo=function(a){var b=this.clone(),c=["protocol","username",\n
"password","hostname","port"],e,f;if(this._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a instanceof d||(a=new d(a));b._parts.protocol||(b._parts.protocol=a._parts.protocol);if(this._parts.hostname)return b;for(e=0;f=c[e];e++)b._parts[f]=a._parts[f];b._parts.path?".."===b._parts.path.substring(-2)&&(b._parts.path+="/"):(b._parts.path=a._parts.path,b._parts.query||(b._parts.query=a._parts.query));"/"!==b.path().charAt(0)&&(a=a.directory(),b._parts.path=(a?\n
a+"/":"")+b._parts.path,b.normalizePath());b.build();return b};f.relativeTo=function(a){var b=this.clone().normalize(),c,e,f,g;if(b._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a=(new d(a)).normalize();c=b._parts;e=a._parts;f=b.path();g=a.path();if("/"!==f.charAt(0))throw Error("URI is already relative");if("/"!==g.charAt(0))throw Error("Cannot calculate a URI relative to another relative URI");c.protocol===e.protocol&&(c.protocol=null);if(c.username===\n
e.username&&c.password===e.password&&null===c.protocol&&null===c.username&&null===c.password&&c.hostname===e.hostname&&c.port===e.port)c.hostname=null,c.port=null;else return b.build();if(f===g)return c.path="",b.build();a=d.commonPath(b.path(),a.path());if(!a)return b.build();e=e.path.substring(a.length).replace(/[^\\/]*$/,"").replace(/.*?\\//g,"../");c.path=e+c.path.substring(a.length);return b.build()};f.equals=function(a){var b=this.clone();a=new d(a);var c={},e={},f={},g;b.normalize();a.normalize();\n
if(b.toString()===a.toString())return!0;c=b.query();e=a.query();b.query("");a.query("");if(b.toString()!==a.toString()||c.length!==e.length)return!1;c=d.parseQuery(c,this._parts.escapeQuerySpace);e=d.parseQuery(e,this._parts.escapeQuerySpace);for(g in c)if(w.call(c,g)){if(!l(c[g])){if(c[g]!==e[g])return!1}else if(!z(c[g],e[g]))return!1;f[g]=!0}for(g in e)if(w.call(e,g)&&!f[g])return!1;return!0};f.duplicateQueryParameters=function(a){this._parts.duplicateQueryParameters=!!a;return this};f.escapeQuerySpace=\n
function(a){this._parts.escapeQuerySpace=!!a;return this};return d});\n
(function(e,k){"object"===typeof exports?module.exports=k(require("./URI")):"function"===typeof define&&define.amd?define(["./URI"],k):k(e.URI)})(this,function(e){var k=e.prototype,u=k.fragment;e.fragmentPrefix="?";var m=e._parts;e._parts=function(){var d=m();d.fragmentPrefix=e.fragmentPrefix;return d};k.fragmentPrefix=function(d){this._parts.fragmentPrefix=d;return this};k.fragment=function(d,g){var k=this._parts.fragmentPrefix,l=this._parts.fragment||"";return!0===d?l.substring(0,k.length)!==k?\n
{}:e.parseQuery(l.substring(k.length)):void 0!==d&&"string"!==typeof d?(this._parts.fragment=k+e.buildQuery(d),this.build(!g),this):u.call(this,d,g)};k.addFragment=function(d,g,k){var l=this._parts.fragmentPrefix,m=e.parseQuery((this._parts.fragment||"").substring(l.length));e.addQuery(m,d,g);this._parts.fragment=l+e.buildQuery(m);"string"!==typeof d&&(k=g);this.build(!k);return this};k.removeFragment=function(d,g,k){var l=this._parts.fragmentPrefix,m=e.parseQuery((this._parts.fragment||"").substring(l.length));\n
e.removeQuery(m,d,g);this._parts.fragment=l+e.buildQuery(m);"string"!==typeof d&&(k=g);this.build(!k);return this};k.addHash=k.addFragment;k.removeHash=k.removeFragment;return{}});
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>URI.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>1.12.0</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.52</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.8892.34577.7731</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405933454.59</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405086440.08</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 06 Oct 2014 15:03:33 +0000\n
# generated on Wed, 04 Feb 2015 16:31:07 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -112,8 +112,6 @@ https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.eot
https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.woff?v=4.0.3\n
https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.ttf?v=4.0.3\n
https://netdna.bootstrapcdn.com/font-awesome/4.0.3/fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular\n
rsvp.js\n
URI.js\n
codemirror.css\n
codemirror.js\n
codemirror_addon_dialog.css\n
......@@ -138,6 +136,8 @@ gadget_erp5.html\n
gadget_erp5.js\n
gadget_erp5_field_float.html\n
gadget_erp5_field_float.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_field_list.html\n
gadget_erp5_field_list.js\n
gadget_erp5_field_listbox.html\n
......@@ -148,8 +148,6 @@ gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n
gadget_erp5_field_textarea.html\n
gadget_erp5_field_textarea.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_form.html\n
gadget_erp5_form.js\n
gadget_erp5_header.html\n
......@@ -182,18 +180,16 @@ gadget_erp5_searchfield.js\n
gadget_global.js\n
gadget_jio.html\n
gadget_jio.js\n
gadget_translate.html\n
gadget_translate.js\n
handlebars.js\n
jio.js\n
jio_complex_queries.js\n
jio_sha1.amd.js\n
jio_sha2.amd.js\n
jio_sha256.amd.js\n
jio_storage_erp5.js\n
i18next.js\n
jiodev.js\n
jquery.js\n
jquerymobile.css\n
jquerymobile.js\n
renderjs.js\n
uritemplate.js\n
rsvp.js\n
NETWORK:\n
*
......@@ -259,7 +255,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -281,7 +277,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1406898405.77</float>
<float>1421252934.14</float>
<string>GMT</string>
</tuple>
</state>
......@@ -312,7 +308,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -326,7 +322,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.17441.54956.1450</string> </value>
<value> <string>940.30209.53658.33979</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -344,8 +340,8 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1421155553.4</float>
<string>UTC</string>
<float>1423067467.33</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -129,7 +129,6 @@
});\n
})\n
\n
.declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.allowPublicAcquisition("notifyInvalid", function (param_list, scope) {\n
return this.getDeclaredGadget(scope)\n
......@@ -474,7 +473,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>super_sven</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -488,7 +487,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.28668.29547.7765</string> </value>
<value> <string>940.21870.34932.42444</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -506,7 +505,7 @@
</tuple>
<state>
<tuple>
<float>1421829262.31</float>
<float>1423061410.81</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -174,7 +174,6 @@
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")\n
.declareAcquiredMethod("triggerPanel", "triggerPanel")\n
\n
......@@ -581,7 +580,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.10099.40468.62378</string> </value>
<value> <string>940.17574.28685.15906</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -599,7 +598,7 @@
</tuple>
<state>
<tuple>
<float>1421080897.75</float>
<float>1421681794.02</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -101,10 +101,12 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global window, document, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest, loopEventListener */\n
/*global window, document, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest, loopEventListener, URI, location */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener) {\n
(function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener, URI, location) {\n
"use strict";\n
\n
var DEFAULT_VIEW_REFERENCE = "view";\n
\n
/////////////////////////////////////////////////////////////////\n
// Desactivate jQuery Mobile URL management\n
......@@ -122,8 +124,17 @@
.push(function (jio_gadget) {\n
return jio_gadget.createJio({\n
type: "erp5",\n
url: gadget.props.hateoas_url\n
url: (new URI("hateoas/")).absoluteTo(location.href).toString()\n
});\n
/*\n
return jio_gadget.createJio({\n
type: "restattachment",\n
sub_storage: {\n
type: "erp5",\n
url: (new URI("hateoas/")).absoluteTo(location.href).toString()\n
}\n
});\n
*/\n
});\n
}\n
\n
......@@ -154,7 +165,7 @@
// Do not break the application in case of errors.\n
// Display it to the user for now, and allow user to go back to the frontpage\n
var error_text = "";\n
if (error.status === 401) {\n
if ((error.target !== undefined) && (error.target.status === 401)) {\n
// Redirect to the login view\n
return gadget.aq_pleasePublishMyState({page: "login"})\n
.push(gadget.pleaseRedirectMyHash.bind(gadget));\n
......@@ -210,9 +221,7 @@
.ready(function (g) {\n
g.props = {\n
translation_lookup: "",\n
hateoas_url: "hateoas/",\n
action_view: "action_object_view",\n
default_view_reference: "view"\n
hateoas_url: "hateoas/"\n
};\n
// return g.getDeclaredGadget("breadcrumb")\n
// .push(function (sub_gadget) {\n
......@@ -292,29 +301,33 @@
return jio_gadget.allDocs.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("jio_ajax", function (param_list) {\n
.allowPublicAcquisition("aq_putAttachment", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.ajax.apply(jio_gadget, param_list);\n
return jio_gadget.putAttachment({\n
"_id": param_list[0]._id,\n
"_attachment": param_list[0]._attachment,\n
"_data": JSON.stringify(param_list[0]._data)\n
});\n
});\n
})\n
.allowPublicAcquisition("jio_put", function (param_list) {\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.put.apply(jio_gadget, param_list);\n
return jio_gadget.get.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("jio_get", function (param_list) {\n
.allowPublicAcquisition("jio_getAttachment", function (param_list) {\n
return this.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
return jio_gadget.get.apply(jio_gadget, param_list);\n
return jio_gadget.getAttachment.apply(jio_gadget, param_list);\n
});\n
})\n
.allowPublicAcquisition("whoWantToDisplayThis", function (param_list) {\n
// Hey, I want to display some URL\n
var options = {\n
jio_key: param_list[0],\n
view: this.props.default_view_reference\n
view: DEFAULT_VIEW_REFERENCE\n
};\n
if (param_list[1] !== undefined) {\n
if (param_list[1].editable !== undefined) {\n
......@@ -327,7 +340,7 @@
// Hey, I want to display some URL\n
var options = {\n
jio_key: this.state_parameter_dict.jio_key,\n
view: param_list[0].name || this.props.default_view_reference\n
view: param_list[0].name || DEFAULT_VIEW_REFERENCE\n
};\n
if (param_list[0].editable !== undefined) {\n
options.editable = param_list[0].editable;\n
......@@ -491,7 +504,6 @@
panel_action: true\n
}];\n
\n
options.action_view = gadget.props.action_view;\n
gadget.state_parameter_dict = {\n
jio_key: options.jio_key,\n
view: options.view\n
......@@ -499,6 +511,7 @@
\n
if ((options.jio_key !== undefined) && (options.page === undefined)) {\n
options.page = "form";\n
options.view = options.view || DEFAULT_VIEW_REFERENCE;\n
}\n
if (options.page === undefined) {\n
// Not rendering a jio document and not page requested.\n
......@@ -566,7 +579,7 @@
);\n
});\n
\n
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener));
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener, URI, location));
]]></string> </value>
</item>
......@@ -689,7 +702,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -703,7 +716,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.10219.33899.48998</string> </value>
<value> <string>940.49304.32028.23995</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -721,8 +734,8 @@
</tuple>
<state>
<tuple>
<float>1420722838.8</float>
<string>UTC</string>
<float>1423067269.03</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -136,7 +136,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
......@@ -150,7 +150,7 @@
result_list,\n
view_list;\n
\n
return gadget.jio_get({"_id": options.jio_key})\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"})\n
.push(function (result) {\n
var i,\n
promise_list = [\n
......@@ -166,7 +166,7 @@
\n
for (i = 0; i < view_list.length; i += 1) {\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[i].name\n
name: view_list[i].href\n
}));\n
}\n
return RSVP.all(promise_list);\n
......@@ -325,7 +325,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -339,7 +339,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.11553.26313.55261</string> </value>
<value> <string>940.49126.4849.49664</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -357,7 +357,7 @@
</tuple>
<state>
<tuple>
<float>1421080866.35</float>
<float>1423066988.75</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -134,7 +134,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
......@@ -172,7 +172,7 @@
title: parent_link.name,\n
link: parent_href\n
});\n
return gadget.jio_get({"_id": jio_key});\n
return gadget.jio_getAttachment({"_id": jio_key, "_attachment": "links"});\n
})\n
.push(function (result) {\n
handleParent(result.data._links.parent || "#");\n
......@@ -186,7 +186,7 @@
return gadget.whoWantToDisplayThisPage({name: options.view, editable: options.editable})\n
.push(function (back_url) {\n
header_options.back_url = back_url;\n
return gadget.jio_get({"_id": options.jio_key});\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"});\n
})\n
.push(function (result) {\n
erp5_document = result.data;\n
......@@ -330,7 +330,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>super_sven</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -344,7 +344,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.1898.34631.55091</string> </value>
<value> <string>940.49124.20596.60757</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -362,7 +362,7 @@
</tuple>
<state>
<tuple>
<float>1420236895.39</float>
<float>1423066901.42</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -132,7 +132,7 @@
/////////////////////////////////////////////////////////////////\n
// acquisition\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_ajax", "jio_ajax")\n
.declareAcquiredMethod("aq_putAttachment", "aq_putAttachment")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
......@@ -256,14 +256,12 @@
}\n
}\n
\n
return form_gadget.jio_ajax({\n
"type": form_gadget.props.action.method,\n
"url": form_gadget.props.action.href,\n
"data": data,\n
"xhrFields": {\n
withCredentials: true\n
}\n
return form_gadget.aq_putAttachment({\n
"_id": form_gadget.props.id,\n
"_attachment": form_gadget.props.action.href,\n
"_data": data\n
});\n
\n
})\n
.push(function (evt) {\n
var location = evt.target.getResponseHeader("X-Location");\n
......@@ -413,7 +411,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -427,7 +425,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.17478.1208.10666</string> </value>
<value> <string>940.49292.16784.61849</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -445,7 +443,7 @@
</tuple>
<state>
<tuple>
<float>1421157982.02</float>
<float>1423066365.58</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -133,7 +133,7 @@
.push(function () {\n
var new_content_action = options.erp5_document._links.action_object_new_content_action;\n
if (new_content_action !== undefined) {\n
new_content_action = gadget.whoWantToDisplayThisPage({name: new_content_action.name, editable: true});\n
new_content_action = gadget.whoWantToDisplayThisPage({name: new_content_action.href, editable: true});\n
} else {\n
new_content_action = "";\n
}\n
......@@ -301,7 +301,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.65471.52542.37171</string> </value>
<value> <string>940.49123.7425.11349</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -319,7 +319,7 @@
</tuple>
<state>
<tuple>
<float>1412596633.53</float>
<float>1423066273.81</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -128,7 +128,7 @@
});\n
})\n
\n
.declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("aq_putAttachment", "aq_putAttachment")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
......@@ -148,6 +148,8 @@
\n
form_gadget.props.id = erp5_document._id;\n
form_gadget.props.view = options.view;\n
form_gadget.props.action = erp5_document._embedded._view._actions.put;\n
form_gadget.props.form_id = erp5_document._embedded._view.form_id;\n
\n
return form_gadget.getDeclaredGadget("erp5_form")\n
.push(function (erp5_form) {\n
......@@ -210,10 +212,17 @@
if (validity) {\n
return erp5_form.getContent()\n
.push(function (data) {\n
data._id = form_gadget.props.id;\n
\n
data[form_gadget.props.form_id.key] =\n
form_gadget.props.form_id[\'default\'];\n
\n
return RSVP.all([\n
form_gadget.notifySubmitting(),\n
form_gadget.aq_put(data, {"_view": form_gadget.props.view})\n
form_gadget.aq_putAttachment({\n
"_id": form_gadget.props.id,\n
"_attachment": form_gadget.props.action.href,\n
"_data": data\n
})\n
]);\n
})\n
.push(form_gadget.notifySubmitted.bind(form_gadget));\n
......@@ -351,7 +360,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -365,7 +374,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.10421.7831.40686</string> </value>
<value> <string>940.49128.62667.58914</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -383,8 +392,8 @@
</tuple>
<state>
<tuple>
<float>1420736076.72</float>
<string>UTC</string>
<float>1423066195.91</float>
<string>GMT</string>
</tuple>
</state>
</object>
......
......@@ -300,7 +300,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -314,7 +314,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>938.194.24732.3993</string> </value>
<value> <string>940.21776.61223.15274</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -332,7 +332,7 @@
</tuple>
<state>
<tuple>
<float>1412343893.37</float>
<float>1421415462.01</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -127,7 +127,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -145,11 +145,11 @@
erp5_form,\n
form_gadget;\n
\n
return gadget.jio_get({"_id": options.jio_key}, {"_view": options.view})\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view})\n
.push(function (result) {\n
var uri = new URI(result.data._embedded._view._links.form_definition.href);\n
erp5_document = result.data;\n
return gadget.jio_get({"_id": uri.segment(2)}, {"_view": "view"});\n
return gadget.jio_getAttachment({"_id": uri.segment(2), "_attachment": "view"});\n
})\n
.push(function (result) {\n
erp5_form = result.data;\n
......@@ -312,7 +312,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>sven</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -326,7 +326,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>938.19043.60684.21452</string> </value>
<value> <string>940.49122.12001.41540</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -344,7 +344,7 @@
</tuple>
<state>
<tuple>
<float>1413473559.42</float>
<float>1423065965.58</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -136,7 +136,7 @@
/////////////////////////////////////////////////////////////////\n
// Acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
......@@ -150,12 +150,12 @@
tab_list = [],\n
gadget = this;\n
\n
return gadget.jio_get({"_id": options.jio_key})\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": "links"})\n
.push(function (result) {\n
var erp5_document = result.data,\n
i,\n
promise_list = [];\n
view_list = erp5_document._links[options.action_view];\n
view_list = erp5_document._links.view;\n
\n
// All ERP5 document should at least have one view.\n
// So, no need normally to test undefined\n
......@@ -164,16 +164,16 @@
}\n
\n
for (i = 0; i < view_list.length; i += 1) {\n
if (options.view === view_list[i].name) {\n
if (options.view === view_list[i].href) {\n
matching = i;\n
}\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[i].name,\n
name: view_list[i].href,\n
editable: true\n
}));\n
}\n
promise_list.push(gadget.whoWantToDisplayThisPage({\n
name: view_list[0].name\n
name: "view"\n
}));\n
return RSVP.all(promise_list);\n
})\n
......@@ -206,9 +206,19 @@
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
\n
if (matching !== undefined) {\n
return gadget.renderPageHeader({\n
cancel_url: tab_list[matching].link\n
});\n
}\n
return gadget.whoWantToDisplayThisPage({\n
name: "view",\n
editable: true\n
})\n
.push(function (url) {\n
return gadget.renderPageHeader({cancel_url: url});\n
});\n
\n
});\n
});\n
\n
......@@ -335,7 +345,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -349,7 +359,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.11553.26313.55261</string> </value>
<value> <string>940.49264.57640.4352</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -367,7 +377,7 @@
</tuple>
<state>
<tuple>
<float>1421080804.4</float>
<float>1423065230.54</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -114,17 +114,7 @@
<script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n
\n
<script src="uritemplate.js" type="text/javascript"></script>\n
<script src="URI.js" type="text/javascript"></script>\n
\n
<script src="jio_sha1.amd.js" type="text/javascript"></script>\n
<script src="jio_sha2.amd.js" type="text/javascript"></script>\n
<script src="jio_sha256.amd.js" type="text/javascript"></script>\n
<script src="jio.js" type="text/javascript"></script>\n
<script src="jio_complex_queries.js" type="text/javascript"></script>\n
<script src="jio_storage_erp5.js" type="text/javascript"></script>\n
\n
\n
<script src="jiodev.js" type="text/javascript"></script>\n
\n
<!-- custom script -->\n
<script src="gadget_jio.js" type="text/javascript"></script>\n
......@@ -255,7 +245,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>tb</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -269,7 +259,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.39262.40401.22254</string> </value>
<value> <string>940.49251.5828.61098</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +277,7 @@
</tuple>
<state>
<tuple>
<float>1406908734.53</float>
<float>1423064264.23</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -103,7 +103,7 @@
/*global window, rJS, jIO, FormData */\n
/*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, jIO, FormData) {\n
(function (window, rJS, jIO) {\n
"use strict";\n
\n
rJS(window)\n
......@@ -116,58 +116,34 @@
.declareMethod(\'createJio\', function (jio_options) {\n
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);\n
})\n
.declareMethod(\'ajax\', function (options) {\n
var key,\n
form_data = new FormData();\n
if (options.data !== undefined) {\n
for (key in options.data) {\n
if (options.data.hasOwnProperty(key)) {\n
form_data.append(key, options.data[key]);\n
}\n
}\n
options.data = form_data;\n
}\n
return jIO.util.ajax(options);\n
})\n
.declareMethod(\'allDocs\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.allDocs.apply(storage, arguments);\n
})\n
.declareMethod(\'get\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.get.apply(storage, arguments);\n
})\n
.declareMethod(\'remove\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.remove.apply(storage, arguments);\n
return storage.get.apply(storage, arguments)\n
.push(function (result) {\n
return {data: result};\n
});\n
})\n
.declareMethod(\'getAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.getAttachment.apply(storage, arguments)\n
// XXX Where to put this &@! blob reading\n
.then(function (response) {\n
return jIO.util.readBlobAsText(response.data);\n
return jIO.util.readBlobAsText(response);\n
})\n
.then(function (lala) {\n
return lala.target.result;\n
.then(function (evt) {\n
return {data: JSON.parse(evt.target.result)};\n
});\n
})\n
.declareMethod(\'putAttachment\', function () {\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.putAttachment.apply(storage, arguments);\n
})\n
.declareMethod(\'put\', function () {\n
// XXX set modified value\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.put.apply(storage, arguments);\n
})\n
.declareMethod(\'post\', function () {\n
// XXX set modified value\n
var storage = this.state_parameter_dict.jio_storage;\n
return storage.post.apply(storage, arguments);\n
});\n
\n
}(window, rJS, jIO, FormData));
}(window, rJS, jIO));
]]></string> </value>
</item>
......@@ -290,7 +266,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -304,7 +280,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.17512.23099.38434</string> </value>
<value> <string>940.46046.3030.52343</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -322,7 +298,7 @@
</tuple>
<state>
<tuple>
<float>1421162230.18</float>
<float>1423064556.21</float>
<string>GMT</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_complex_queries.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_jio_complex_queries_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*\n
* Copyright 2013, Nexedi SA\n
* Released under the LGPL license.\n
* http://www.gnu.org/licenses/lgpl.html\n
*/\n
\n
/**\n
* Provides some function to use complex queries with item list\n
*\n
* @module complex_queries\n
*/\n
// define([module_name], [dependencies], module);\n
(function (dependencies, module) {\n
"use strict";\n
if (typeof define === \'function\' && define.amd) {\n
return define(dependencies, module);\n
}\n
if (typeof exports === \'object\') {\n
return module(exports);\n
}\n
window.complex_queries = {};\n
module(window.complex_queries, RSVP);\n
}([\'exports\', \'rsvp\'], function (to_export, RSVP) {\n
"use strict";\n
\n
/**\n
* Add a secured (write permission denied) property to an object.\n
*\n
* @param {Object} object The object to fill\n
* @param {String} key The object key where to store the property\n
* @param {Any} value The value to store\n
*/\n
function _export(key, value) {\n
Object.defineProperty(to_export, key, {\n
"configurable": false,\n
"enumerable": true,\n
"writable": false,\n
"value": value\n
});\n
}\n
\n
/**\n
* Parse a text request to a json query object tree\n
*\n
* @param {String} string The string to parse\n
* @return {Object} The json query tree\n
*/\n
function parseStringToObject(string) {\n
\n
\n
/*\n
\tDefault template driver for JS/CC generated parsers running as\n
\tbrowser-based JavaScript/ECMAScript applications.\n
\t\n
\tWARNING: \tThis parser template will not run as console and has lesser\n
\t\t\t\tfeatures for debugging than the console derivates for the\n
\t\t\t\tvarious JavaScript platforms.\n
\t\n
\tFeatures:\n
\t- Parser trace messages\n
\t- Integrated panic-mode error recovery\n
\t\n
\tWritten 2007, 2008 by Jan Max Meyer, J.M.K S.F. Software Technologies\n
\t\n
\tThis is in the public domain.\n
*/\n
\n
var NODEJS__dbg_withtrace\t\t= false;\n
var NODEJS__dbg_string\t\t\t= new String();\n
\n
function __NODEJS_dbg_print( text )\n
{\n
\tNODEJS__dbg_string += text + "\\n";\n
}\n
\n
function __NODEJS_lex( info )\n
{\n
\tvar state\t\t= 0;\n
\tvar match\t\t= -1;\n
\tvar match_pos\t= 0;\n
\tvar start\t\t= 0;\n
\tvar pos\t\t\t= info.offset + 1;\n
\n
\tdo\n
\t{\n
\t\tpos--;\n
\t\tstate = 0;\n
\t\tmatch = -2;\n
\t\tstart = pos;\n
\n
\t\tif( info.src.length <= start )\n
\t\t\treturn 19;\n
\n
\t\tdo\n
\t\t{\n
\n
switch( state )\n
{\n
\tcase 0:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 8 ) || ( info.src.charCodeAt( pos ) >= 10 && info.src.charCodeAt( pos ) <= 31 ) || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || info.src.charCodeAt( pos ) == 59 || ( info.src.charCodeAt( pos ) >= 63 && info.src.charCodeAt( pos ) <= 64 ) || ( info.src.charCodeAt( pos ) >= 66 && info.src.charCodeAt( pos ) <= 77 ) || ( info.src.charCodeAt( pos ) >= 80 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 9 ) state = 2;\n
\t\telse if( info.src.charCodeAt( pos ) == 40 ) state = 3;\n
\t\telse if( info.src.charCodeAt( pos ) == 41 ) state = 4;\n
\t\telse if( info.src.charCodeAt( pos ) == 60 || info.src.charCodeAt( pos ) == 62 ) state = 5;\n
\t\telse if( info.src.charCodeAt( pos ) == 33 ) state = 11;\n
\t\telse if( info.src.charCodeAt( pos ) == 79 ) state = 12;\n
\t\telse if( info.src.charCodeAt( pos ) == 32 ) state = 13;\n
\t\telse if( info.src.charCodeAt( pos ) == 61 ) state = 14;\n
\t\telse if( info.src.charCodeAt( pos ) == 34 ) state = 15;\n
\t\telse if( info.src.charCodeAt( pos ) == 65 ) state = 19;\n
\t\telse if( info.src.charCodeAt( pos ) == 78 ) state = 20;\n
\t\telse state = -1;\n
\t\tbreak;\n
\n
\tcase 1:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse state = -1;\n
\t\tmatch = 10;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 2:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse state = -1;\n
\t\tmatch = 1;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 3:\n
\t\tstate = -1;\n
\t\tmatch = 3;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 4:\n
\t\tstate = -1;\n
\t\tmatch = 4;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 5:\n
\t\tif( info.src.charCodeAt( pos ) == 61 ) state = 14;\n
\t\telse state = -1;\n
\t\tmatch = 11;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 6:\n
\t\tstate = -1;\n
\t\tmatch = 8;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 7:\n
\t\tstate = -1;\n
\t\tmatch = 9;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 8:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse state = -1;\n
\t\tmatch = 6;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 9:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse state = -1;\n
\t\tmatch = 5;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 10:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse state = -1;\n
\t\tmatch = 7;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 11:\n
\t\tif( info.src.charCodeAt( pos ) == 61 ) state = 14;\n
\t\telse state = -1;\n
\t\tbreak;\n
\n
\tcase 12:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 81 ) || ( info.src.charCodeAt( pos ) >= 83 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse if( info.src.charCodeAt( pos ) == 82 ) state = 8;\n
\t\telse state = -1;\n
\t\tmatch = 10;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 13:\n
\t\tstate = -1;\n
\t\tmatch = 1;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 14:\n
\t\tstate = -1;\n
\t\tmatch = 11;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 15:\n
\t\tif( info.src.charCodeAt( pos ) == 34 ) state = 7;\n
\t\telse if( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 33 ) || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 91 ) || ( info.src.charCodeAt( pos ) >= 93 && info.src.charCodeAt( pos ) <= 254 ) ) state = 15;\n
\t\telse if( info.src.charCodeAt( pos ) == 92 ) state = 17;\n
\t\telse state = -1;\n
\t\tbreak;\n
\n
\tcase 16:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 67 ) || ( info.src.charCodeAt( pos ) >= 69 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse if( info.src.charCodeAt( pos ) == 68 ) state = 9;\n
\t\telse state = -1;\n
\t\tmatch = 10;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 17:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 254 ) ) state = 15;\n
\t\telse state = -1;\n
\t\tbreak;\n
\n
\tcase 18:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 83 ) || ( info.src.charCodeAt( pos ) >= 85 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse if( info.src.charCodeAt( pos ) == 84 ) state = 10;\n
\t\telse state = -1;\n
\t\tmatch = 10;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 19:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 77 ) || ( info.src.charCodeAt( pos ) >= 79 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse if( info.src.charCodeAt( pos ) == 78 ) state = 16;\n
\t\telse state = -1;\n
\t\tmatch = 10;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
\tcase 20:\n
\t\tif( ( info.src.charCodeAt( pos ) >= 0 && info.src.charCodeAt( pos ) <= 31 ) || info.src.charCodeAt( pos ) == 33 || ( info.src.charCodeAt( pos ) >= 35 && info.src.charCodeAt( pos ) <= 39 ) || ( info.src.charCodeAt( pos ) >= 42 && info.src.charCodeAt( pos ) <= 57 ) || ( info.src.charCodeAt( pos ) >= 59 && info.src.charCodeAt( pos ) <= 78 ) || ( info.src.charCodeAt( pos ) >= 80 && info.src.charCodeAt( pos ) <= 254 ) ) state = 1;\n
\t\telse if( info.src.charCodeAt( pos ) == 58 ) state = 6;\n
\t\telse if( info.src.charCodeAt( pos ) == 79 ) state = 18;\n
\t\telse state = -1;\n
\t\tmatch = 10;\n
\t\tmatch_pos = pos;\n
\t\tbreak;\n
\n
}\n
\n
\n
\t\t\tpos++;\n
\n
\t\t}\n
\t\twhile( state > -1 );\n
\n
\t}\n
\twhile( 1 > -1 && match == 1 );\n
\n
\tif( match > -1 )\n
\t{\n
\t\tinfo.att = info.src.substr( start, match_pos - start );\n
\t\tinfo.offset = match_pos;\n
\t\t\n
\n
\t}\n
\telse\n
\t{\n
\t\tinfo.att = new String();\n
\t\tmatch = -1;\n
\t}\n
\n
\treturn match;\n
}\n
\n
\n
function __NODEJS_parse( src, err_off, err_la )\n
{\n
\tvar\t\tsstack\t\t\t= new Array();\n
\tvar\t\tvstack\t\t\t= new Array();\n
\tvar \terr_cnt\t\t\t= 0;\n
\tvar\t\tact;\n
\tvar\t\tgo;\n
\tvar\t\tla;\n
\tvar\t\trval;\n
\tvar \tparseinfo\t\t= new Function( "", "var offset; var src; var att;" );\n
\tvar\t\tinfo\t\t\t= new parseinfo();\n
\t\n
/* Pop-Table */\n
var pop_tab = new Array(\n
\tnew Array( 0/* begin\' */, 1 ),\n
\tnew Array( 13/* begin */, 1 ),\n
\tnew Array( 12/* search_text */, 1 ),\n
\tnew Array( 12/* search_text */, 2 ),\n
\tnew Array( 12/* search_text */, 3 ),\n
\tnew Array( 14/* and_expression */, 1 ),\n
\tnew Array( 14/* and_expression */, 3 ),\n
\tnew Array( 15/* boolean_expression */, 2 ),\n
\tnew Array( 15/* boolean_expression */, 1 ),\n
\tnew Array( 16/* expression */, 3 ),\n
\tnew Array( 16/* expression */, 2 ),\n
\tnew Array( 16/* expression */, 1 ),\n
\tnew Array( 17/* value */, 2 ),\n
\tnew Array( 17/* value */, 1 ),\n
\tnew Array( 18/* string */, 1 ),\n
\tnew Array( 18/* string */, 1 )\n
);\n
\n
/* Action-Table */\n
var act_tab = new Array(\n
\t/* State 0 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 1 */ new Array( 19/* "$" */,0 ),\n
\t/* State 2 */ new Array( 19/* "$" */,-1 ),\n
\t/* State 3 */ new Array( 6/* "OR" */,14 , 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 , 19/* "$" */,-2 , 4/* "RIGHT_PARENTHESE" */,-2 ),\n
\t/* State 4 */ new Array( 5/* "AND" */,16 , 19/* "$" */,-5 , 7/* "NOT" */,-5 , 3/* "LEFT_PARENTHESE" */,-5 , 8/* "COLUMN" */,-5 , 11/* "OPERATOR" */,-5 , 10/* "WORD" */,-5 , 9/* "STRING" */,-5 , 6/* "OR" */,-5 , 4/* "RIGHT_PARENTHESE" */,-5 ),\n
\t/* State 5 */ new Array( 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 6 */ new Array( 19/* "$" */,-8 , 7/* "NOT" */,-8 , 3/* "LEFT_PARENTHESE" */,-8 , 8/* "COLUMN" */,-8 , 11/* "OPERATOR" */,-8 , 10/* "WORD" */,-8 , 9/* "STRING" */,-8 , 6/* "OR" */,-8 , 5/* "AND" */,-8 , 4/* "RIGHT_PARENTHESE" */,-8 ),\n
\t/* State 7 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 8 */ new Array( 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 9 */ new Array( 19/* "$" */,-11 , 7/* "NOT" */,-11 , 3/* "LEFT_PARENTHESE" */,-11 , 8/* "COLUMN" */,-11 , 11/* "OPERATOR" */,-11 , 10/* "WORD" */,-11 , 9/* "STRING" */,-11 , 6/* "OR" */,-11 , 5/* "AND" */,-11 , 4/* "RIGHT_PARENTHESE" */,-11 ),\n
\t/* State 10 */ new Array( 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 11 */ new Array( 19/* "$" */,-13 , 7/* "NOT" */,-13 , 3/* "LEFT_PARENTHESE" */,-13 , 8/* "COLUMN" */,-13 , 11/* "OPERATOR" */,-13 , 10/* "WORD" */,-13 , 9/* "STRING" */,-13 , 6/* "OR" */,-13 , 5/* "AND" */,-13 , 4/* "RIGHT_PARENTHESE" */,-13 ),\n
\t/* State 12 */ new Array( 19/* "$" */,-14 , 7/* "NOT" */,-14 , 3/* "LEFT_PARENTHESE" */,-14 , 8/* "COLUMN" */,-14 , 11/* "OPERATOR" */,-14 , 10/* "WORD" */,-14 , 9/* "STRING" */,-14 , 6/* "OR" */,-14 , 5/* "AND" */,-14 , 4/* "RIGHT_PARENTHESE" */,-14 ),\n
\t/* State 13 */ new Array( 19/* "$" */,-15 , 7/* "NOT" */,-15 , 3/* "LEFT_PARENTHESE" */,-15 , 8/* "COLUMN" */,-15 , 11/* "OPERATOR" */,-15 , 10/* "WORD" */,-15 , 9/* "STRING" */,-15 , 6/* "OR" */,-15 , 5/* "AND" */,-15 , 4/* "RIGHT_PARENTHESE" */,-15 ),\n
\t/* State 14 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 15 */ new Array( 19/* "$" */,-3 , 4/* "RIGHT_PARENTHESE" */,-3 ),\n
\t/* State 16 */ new Array( 7/* "NOT" */,5 , 3/* "LEFT_PARENTHESE" */,7 , 8/* "COLUMN" */,8 , 11/* "OPERATOR" */,10 , 10/* "WORD" */,12 , 9/* "STRING" */,13 ),\n
\t/* State 17 */ new Array( 19/* "$" */,-7 , 7/* "NOT" */,-7 , 3/* "LEFT_PARENTHESE" */,-7 , 8/* "COLUMN" */,-7 , 11/* "OPERATOR" */,-7 , 10/* "WORD" */,-7 , 9/* "STRING" */,-7 , 6/* "OR" */,-7 , 5/* "AND" */,-7 , 4/* "RIGHT_PARENTHESE" */,-7 ),\n
\t/* State 18 */ new Array( 4/* "RIGHT_PARENTHESE" */,23 ),\n
\t/* State 19 */ new Array( 19/* "$" */,-10 , 7/* "NOT" */,-10 , 3/* "LEFT_PARENTHESE" */,-10 , 8/* "COLUMN" */,-10 , 11/* "OPERATOR" */,-10 , 10/* "WORD" */,-10 , 9/* "STRING" */,-10 , 6/* "OR" */,-10 , 5/* "AND" */,-10 , 4/* "RIGHT_PARENTHESE" */,-10 ),\n
\t/* State 20 */ new Array( 19/* "$" */,-12 , 7/* "NOT" */,-12 , 3/* "LEFT_PARENTHESE" */,-12 , 8/* "COLUMN" */,-12 , 11/* "OPERATOR" */,-12 , 10/* "WORD" */,-12 , 9/* "STRING" */,-12 , 6/* "OR" */,-12 , 5/* "AND" */,-12 , 4/* "RIGHT_PARENTHESE" */,-12 ),\n
\t/* State 21 */ new Array( 19/* "$" */,-4 , 4/* "RIGHT_PARENTHESE" */,-4 ),\n
\t/* State 22 */ new Array( 19/* "$" */,-6 , 7/* "NOT" */,-6 , 3/* "LEFT_PARENTHESE" */,-6 , 8/* "COLUMN" */,-6 , 11/* "OPERATOR" */,-6 , 10/* "WORD" */,-6 , 9/* "STRING" */,-6 , 6/* "OR" */,-6 , 4/* "RIGHT_PARENTHESE" */,-6 ),\n
\t/* State 23 */ new Array( 19/* "$" */,-9 , 7/* "NOT" */,-9 , 3/* "LEFT_PARENTHESE" */,-9 , 8/* "COLUMN" */,-9 , 11/* "OPERATOR" */,-9 , 10/* "WORD" */,-9 , 9/* "STRING" */,-9 , 6/* "OR" */,-9 , 5/* "AND" */,-9 , 4/* "RIGHT_PARENTHESE" */,-9 )\n
);\n
\n
/* Goto-Table */\n
var goto_tab = new Array(\n
\t/* State 0 */ new Array( 13/* begin */,1 , 12/* search_text */,2 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 1 */ new Array( ),\n
\t/* State 2 */ new Array( ),\n
\t/* State 3 */ new Array( 12/* search_text */,15 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 4 */ new Array( ),\n
\t/* State 5 */ new Array( 16/* expression */,17 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 6 */ new Array( ),\n
\t/* State 7 */ new Array( 12/* search_text */,18 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 8 */ new Array( 16/* expression */,19 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 9 */ new Array( ),\n
\t/* State 10 */ new Array( 18/* string */,20 ),\n
\t/* State 11 */ new Array( ),\n
\t/* State 12 */ new Array( ),\n
\t/* State 13 */ new Array( ),\n
\t/* State 14 */ new Array( 12/* search_text */,21 , 14/* and_expression */,3 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 15 */ new Array( ),\n
\t/* State 16 */ new Array( 14/* and_expression */,22 , 15/* boolean_expression */,4 , 16/* expression */,6 , 17/* value */,9 , 18/* string */,11 ),\n
\t/* State 17 */ new Array( ),\n
\t/* State 18 */ new Array( ),\n
\t/* State 19 */ new Array( ),\n
\t/* State 20 */ new Array( ),\n
\t/* State 21 */ new Array( ),\n
\t/* State 22 */ new Array( ),\n
\t/* State 23 */ new Array( )\n
);\n
\n
\n
\n
/* Symbol labels */\n
var labels = new Array(\n
\t"begin\'" /* Non-terminal symbol */,\n
\t"WHITESPACE" /* Terminal symbol */,\n
\t"WHITESPACE" /* Terminal symbol */,\n
\t"LEFT_PARENTHESE" /* Terminal symbol */,\n
\t"RIGHT_PARENTHESE" /* Terminal symbol */,\n
\t"AND" /* Terminal symbol */,\n
\t"OR" /* Terminal symbol */,\n
\t"NOT" /* Terminal symbol */,\n
\t"COLUMN" /* Terminal symbol */,\n
\t"STRING" /* Terminal symbol */,\n
\t"WORD" /* Terminal symbol */,\n
\t"OPERATOR" /* Terminal symbol */,\n
\t"search_text" /* Non-terminal symbol */,\n
\t"begin" /* Non-terminal symbol */,\n
\t"and_expression" /* Non-terminal symbol */,\n
\t"boolean_expression" /* Non-terminal symbol */,\n
\t"expression" /* Non-terminal symbol */,\n
\t"value" /* Non-terminal symbol */,\n
\t"string" /* Non-terminal symbol */,\n
\t"$" /* Terminal symbol */\n
);\n
\n
\n
\t\n
\tinfo.offset = 0;\n
\tinfo.src = src;\n
\tinfo.att = new String();\n
\t\n
\tif( !err_off )\n
\t\terr_off\t= new Array();\n
\tif( !err_la )\n
\terr_la = new Array();\n
\t\n
\tsstack.push( 0 );\n
\tvstack.push( 0 );\n
\t\n
\tla = __NODEJS_lex( info );\n
\n
\twhile( true )\n
\t{\n
\t\tact = 25;\n
\t\tfor( var i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )\n
\t\t{\n
\t\t\tif( act_tab[sstack[sstack.length-1]][i] == la )\n
\t\t\t{\n
\t\t\t\tact = act_tab[sstack[sstack.length-1]][i+1];\n
\t\t\t\tbreak;\n
\t\t\t}\n
\t\t}\n
\n
\t\tif( NODEJS__dbg_withtrace && sstack.length > 0 )\n
\t\t{\n
\t\t\t__NODEJS_dbg_print( "\\nState " + sstack[sstack.length-1] + "\\n" +\n
\t\t\t\t\t\t\t"\\tLookahead: " + labels[la] + " (\\"" + info.att + "\\")\\n" +\n
\t\t\t\t\t\t\t"\\tAction: " + act + "\\n" + \n
\t\t\t\t\t\t\t"\\tSource: \\"" + info.src.substr( info.offset, 30 ) + ( ( info.offset + 30 < info.src.length ) ?\n
\t\t\t\t\t\t\t\t\t"..." : "" ) + "\\"\\n" +\n
\t\t\t\t\t\t\t"\\tStack: " + sstack.join() + "\\n" +\n
\t\t\t\t\t\t\t"\\tValue stack: " + vstack.join() + "\\n" );\n
\t\t}\n
\t\t\n
\t\t\t\n
\t\t//Panic-mode: Try recovery when parse-error occurs!\n
\t\tif( act == 25 )\n
\t\t{\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "Error detected: There is no reduce or shift on the symbol " + labels[la] );\n
\t\t\t\n
\t\t\terr_cnt++;\n
\t\t\terr_off.push( info.offset - info.att.length );\t\t\t\n
\t\t\terr_la.push( new Array() );\n
\t\t\tfor( var i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )\n
\t\t\t\terr_la[err_la.length-1].push( labels[act_tab[sstack[sstack.length-1]][i]] );\n
\t\t\t\n
\t\t\t//Remember the original stack!\n
\t\t\tvar rsstack = new Array();\n
\t\t\tvar rvstack = new Array();\n
\t\t\tfor( var i = 0; i < sstack.length; i++ )\n
\t\t\t{\n
\t\t\t\trsstack[i] = sstack[i];\n
\t\t\t\trvstack[i] = vstack[i];\n
\t\t\t}\n
\t\t\t\n
\t\t\twhile( act == 25 && la != 19 )\n
\t\t\t{\n
\t\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t\t__NODEJS_dbg_print( "\\tError recovery\\n" +\n
\t\t\t\t\t\t\t\t\t"Current lookahead: " + labels[la] + " (" + info.att + ")\\n" +\n
\t\t\t\t\t\t\t\t\t"Action: " + act + "\\n\\n" );\n
\t\t\t\tif( la == -1 )\n
\t\t\t\t\tinfo.offset++;\n
\t\t\t\t\t\n
\t\t\t\twhile( act == 25 && sstack.length > 0 )\n
\t\t\t\t{\n
\t\t\t\t\tsstack.pop();\n
\t\t\t\t\tvstack.pop();\n
\t\t\t\t\t\n
\t\t\t\t\tif( sstack.length == 0 )\n
\t\t\t\t\t\tbreak;\n
\t\t\t\t\t\t\n
\t\t\t\t\tact = 25;\n
\t\t\t\t\tfor( var i = 0; i < act_tab[sstack[sstack.length-1]].length; i+=2 )\n
\t\t\t\t\t{\n
\t\t\t\t\t\tif( act_tab[sstack[sstack.length-1]][i] == la )\n
\t\t\t\t\t\t{\n
\t\t\t\t\t\t\tact = act_tab[sstack[sstack.length-1]][i+1];\n
\t\t\t\t\t\t\tbreak;\n
\t\t\t\t\t\t}\n
\t\t\t\t\t}\n
\t\t\t\t}\n
\t\t\t\t\n
\t\t\t\tif( act != 25 )\n
\t\t\t\t\tbreak;\n
\t\t\t\t\n
\t\t\t\tfor( var i = 0; i < rsstack.length; i++ )\n
\t\t\t\t{\n
\t\t\t\t\tsstack.push( rsstack[i] );\n
\t\t\t\t\tvstack.push( rvstack[i] );\n
\t\t\t\t}\n
\t\t\t\t\n
\t\t\t\tla = __NODEJS_lex( info );\n
\t\t\t}\n
\t\t\t\n
\t\t\tif( act == 25 )\n
\t\t\t{\n
\t\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t\t__NODEJS_dbg_print( "\\tError recovery failed, terminating parse process..." );\n
\t\t\t\tbreak;\n
\t\t\t}\n
\n
\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "\\tError recovery succeeded, continuing" );\n
\t\t}\n
\t\t\n
\t\t/*\n
\t\tif( act == 25 )\n
\t\t\tbreak;\n
\t\t*/\n
\t\t\n
\t\t\n
\t\t//Shift\n
\t\tif( act > 0 )\n
\t\t{\t\t\t\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "Shifting symbol: " + labels[la] + " (" + info.att + ")" );\n
\t\t\n
\t\t\tsstack.push( act );\n
\t\t\tvstack.push( info.att );\n
\t\t\t\n
\t\t\tla = __NODEJS_lex( info );\n
\t\t\t\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "\\tNew lookahead symbol: " + labels[la] + " (" + info.att + ")" );\n
\t\t}\n
\t\t//Reduce\n
\t\telse\n
\t\t{\t\t\n
\t\t\tact *= -1;\n
\t\t\t\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "Reducing by producution: " + act );\n
\t\t\t\n
\t\t\trval = void(0);\n
\t\t\t\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "\\tPerforming semantic action..." );\n
\t\t\t\n
switch( act )\n
{\n
\tcase 0:\n
\t{\n
\t\trval = vstack[ vstack.length - 1 ];\n
\t}\n
\tbreak;\n
\tcase 1:\n
\t{\n
\t\t result = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 2:\n
\t{\n
\t\t rval = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 3:\n
\t{\n
\t\t rval = mkComplexQuery(\'OR\',[vstack[ vstack.length - 2 ],vstack[ vstack.length - 1 ]]); \n
\t}\n
\tbreak;\n
\tcase 4:\n
\t{\n
\t\t rval = mkComplexQuery(\'OR\',[vstack[ vstack.length - 3 ],vstack[ vstack.length - 1 ]]); \n
\t}\n
\tbreak;\n
\tcase 5:\n
\t{\n
\t\t rval = vstack[ vstack.length - 1 ] ; \n
\t}\n
\tbreak;\n
\tcase 6:\n
\t{\n
\t\t rval = mkComplexQuery(\'AND\',[vstack[ vstack.length - 3 ],vstack[ vstack.length - 1 ]]); \n
\t}\n
\tbreak;\n
\tcase 7:\n
\t{\n
\t\t rval = mkNotQuery(vstack[ vstack.length - 1 ]); \n
\t}\n
\tbreak;\n
\tcase 8:\n
\t{\n
\t\t rval = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 9:\n
\t{\n
\t\t rval = vstack[ vstack.length - 2 ]; \n
\t}\n
\tbreak;\n
\tcase 10:\n
\t{\n
\t\t simpleQuerySetKey(vstack[ vstack.length - 1 ],vstack[ vstack.length - 2 ].split(\':\').slice(0,-1).join(\':\')); rval = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 11:\n
\t{\n
\t\t rval = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 12:\n
\t{\n
\t\t vstack[ vstack.length - 1 ].operator = vstack[ vstack.length - 2 ] ; rval = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 13:\n
\t{\n
\t\t rval = vstack[ vstack.length - 1 ]; \n
\t}\n
\tbreak;\n
\tcase 14:\n
\t{\n
\t\t rval = mkSimpleQuery(\'\',vstack[ vstack.length - 1 ]); \n
\t}\n
\tbreak;\n
\tcase 15:\n
\t{\n
\t\t rval = mkSimpleQuery(\'\',vstack[ vstack.length - 1 ].split(\'"\').slice(1,-1).join(\'"\')); \n
\t}\n
\tbreak;\n
}\n
\n
\n
\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "\\tPopping " + pop_tab[act][1] + " off the stack..." );\n
\t\t\t\t\n
\t\t\tfor( var i = 0; i < pop_tab[act][1]; i++ )\n
\t\t\t{\n
\t\t\t\tsstack.pop();\n
\t\t\t\tvstack.pop();\n
\t\t\t}\n
\t\t\t\t\t\t\t\t\t\n
\t\t\tgo = -1;\n
\t\t\tfor( var i = 0; i < goto_tab[sstack[sstack.length-1]].length; i+=2 )\n
\t\t\t{\n
\t\t\t\tif( goto_tab[sstack[sstack.length-1]][i] == pop_tab[act][0] )\n
\t\t\t\t{\n
\t\t\t\t\tgo = goto_tab[sstack[sstack.length-1]][i+1];\n
\t\t\t\t\tbreak;\n
\t\t\t\t}\n
\t\t\t}\n
\t\t\t\n
\t\t\tif( act == 0 )\n
\t\t\t\tbreak;\n
\t\t\t\t\n
\t\t\tif( NODEJS__dbg_withtrace )\n
\t\t\t\t__NODEJS_dbg_print( "\\tPushing non-terminal " + labels[ pop_tab[act][0] ] );\n
\t\t\t\t\n
\t\t\tsstack.push( go );\n
\t\t\tvstack.push( rval );\t\t\t\n
\t\t}\n
\t\t\n
\t\tif( NODEJS__dbg_withtrace )\n
\t\t{\t\t\n
\t\t\talert( NODEJS__dbg_string );\n
\t\t\tNODEJS__dbg_string = new String();\n
\t\t}\n
\t}\n
\n
\tif( NODEJS__dbg_withtrace )\n
\t{\n
\t\t__NODEJS_dbg_print( "\\nParse complete." );\n
\t\talert( NODEJS__dbg_string );\n
\t}\n
\t\n
\treturn err_cnt;\n
}\n
\n
\n
\n
var arrayExtend = function () {\n
var j, i, newlist = [], list_list = arguments;\n
for (j = 0; j < list_list.length; j += 1) {\n
for (i = 0; i < list_list[j].length; i += 1) {\n
newlist.push(list_list[j][i]);\n
}\n
}\n
return newlist;\n
\n
}, mkSimpleQuery = function (key, value, operator) {\n
var object = {"type": "simple", "key": key, "value": value};\n
if (operator !== undefined) {\n
object.operator = operator;\n
}\n
return object;\n
\n
}, mkNotQuery = function (query) {\n
if (query.operator === "NOT") {\n
return query.query_list[0];\n
}\n
return {"type": "complex", "operator": "NOT", "query_list": [query]};\n
\n
}, mkComplexQuery = function (operator, query_list) {\n
var i, query_list2 = [];\n
for (i = 0; i < query_list.length; i += 1) {\n
if (query_list[i].operator === operator) {\n
query_list2 = arrayExtend(query_list2, query_list[i].query_list);\n
} else {\n
query_list2.push(query_list[i]);\n
}\n
}\n
return {type:"complex",operator:operator,query_list:query_list2};\n
\n
}, simpleQuerySetKey = function (query, key) {\n
var i;\n
if (query.type === "complex") {\n
for (i = 0; i < query.query_list.length; ++i) {\n
simpleQuerySetKey (query.query_list[i],key);\n
}\n
return true;\n
}\n
if (query.type === "simple" && !query.key) {\n
query.key = key;\n
return true;\n
}\n
return false;\n
},\n
error_offsets = [],\n
error_lookaheads = [],\n
error_count = 0,\n
result;\n
\n
if ((error_count = __NODEJS_parse(string, error_offsets, error_lookaheads)) > 0) {\n
var i;\n
for (i = 0; i < error_count; i += 1) {\n
throw new Error("Parse error near \\"" +\n
string.substr(error_offsets[i]) +\n
"\\", expecting \\"" +\n
error_lookaheads[i].join() + "\\"");\n
}\n
}\n
\n
\n
return result;\n
} // parseStringToObject\n
\n
_export(\'parseStringToObject\', parseStringToObject);\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true */\n
\n
var query_class_dict = {};\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
/*global Query: true, query_class_dict: true, inherits: true,\n
_export, QueryFactory, RSVP, sequence */\n
\n
/**\n
* The ComplexQuery inherits from Query, and compares one or several metadata\n
* values.\n
*\n
* @class ComplexQuery\n
* @extends Query\n
* @param {Object} [spec={}] The specifications\n
* @param {String} [spec.operator="AND"] The compare method to use\n
* @param {String} spec.key The metadata key\n
* @param {String} spec.value The value of the metadata to compare\n
*/\n
function ComplexQuery(spec, key_schema) {\n
Query.call(this);\n
\n
/**\n
* Logical operator to use to compare object values\n
*\n
* @attribute operator\n
* @type String\n
* @default "AND"\n
* @optional\n
*/\n
this.operator = spec.operator || "AND";\n
\n
/**\n
* The sub Query list which are used to query an item.\n
*\n
* @attribute query_list\n
* @type Array\n
* @default []\n
* @optional\n
*/\n
this.query_list = spec.query_list || [];\n
/*jslint unparam: true*/\n
this.query_list = this.query_list.map(\n
// decorate the map to avoid sending the index as key_schema argument\n
function (o, i) { return QueryFactory.create(o, key_schema); }\n
);\n
/*jslint unparam: false*/\n
\n
}\n
inherits(ComplexQuery, Query);\n
\n
/**\n
* #crossLink "Query/match:method"\n
*/\n
ComplexQuery.prototype.match = function (item) {\n
var operator = this.operator;\n
if (!(/^(?:AND|OR|NOT)$/i.test(operator))) {\n
operator = "AND";\n
}\n
return this[operator.toUpperCase()](item);\n
};\n
\n
/**\n
* #crossLink "Query/toString:method"\n
*/\n
ComplexQuery.prototype.toString = function () {\n
var str_list = ["("], this_operator = this.operator;\n
this.query_list.forEach(function (query) {\n
str_list.push(query.toString());\n
str_list.push(this_operator);\n
});\n
str_list[str_list.length - 1] = ")"; // replace last operator\n
return str_list.join(" ");\n
};\n
\n
/**\n
* #crossLink "Query/serialized:method"\n
*/\n
ComplexQuery.prototype.serialized = function () {\n
var s = {\n
"type": "complex",\n
"operator": this.operator,\n
"query_list": []\n
};\n
this.query_list.forEach(function (query) {\n
s.query_list.push(query.serialized());\n
});\n
return s;\n
};\n
ComplexQuery.prototype.toJSON = ComplexQuery.prototype.serialized;\n
\n
/**\n
* Comparison operator, test if all sub queries match the\n
* item value\n
*\n
* @method AND\n
* @param {Object} item The item to match\n
* @return {Boolean} true if all match, false otherwise\n
*/\n
ComplexQuery.prototype.AND = function (item) {\n
var j, promises = [];\n
for (j = 0; j < this.query_list.length; j += 1) {\n
promises.push(this.query_list[j].match(item));\n
}\n
\n
function cancel() {\n
var i;\n
for (i = 0; i < promises.length; i += 1) {\n
if (typeof promises.cancel === \'function\') {\n
promises.cancel();\n
}\n
}\n
}\n
\n
return new RSVP.Promise(function (resolve, reject) {\n
var i, count = 0;\n
function resolver(value) {\n
if (!value) {\n
resolve(false);\n
}\n
count += 1;\n
if (count === promises.length) {\n
resolve(true);\n
}\n
}\n
\n
function rejecter(err) {\n
reject(err);\n
cancel();\n
}\n
\n
for (i = 0; i < promises.length; i += 1) {\n
promises[i].then(resolver, rejecter);\n
}\n
}, cancel);\n
};\n
\n
/**\n
* Comparison operator, test if one of the sub queries matches the\n
* item value\n
*\n
* @method OR\n
* @param {Object} item The item to match\n
* @return {Boolean} true if one match, false otherwise\n
*/\n
ComplexQuery.prototype.OR = function (item) {\n
var j, promises = [];\n
for (j = 0; j < this.query_list.length; j += 1) {\n
promises.push(this.query_list[j].match(item));\n
}\n
\n
function cancel() {\n
var i;\n
for (i = 0; i < promises.length; i += 1) {\n
if (typeof promises.cancel === \'function\') {\n
promises.cancel();\n
}\n
}\n
}\n
\n
return new RSVP.Promise(function (resolve, reject) {\n
var i, count = 0;\n
function resolver(value) {\n
if (value) {\n
resolve(true);\n
}\n
count += 1;\n
if (count === promises.length) {\n
resolve(false);\n
}\n
}\n
\n
function rejecter(err) {\n
reject(err);\n
cancel();\n
}\n
\n
for (i = 0; i < promises.length; i += 1) {\n
promises[i].then(resolver, rejecter);\n
}\n
}, cancel);\n
};\n
\n
/**\n
* Comparison operator, test if the sub query does not match the\n
* item value\n
*\n
* @method NOT\n
* @param {Object} item The item to match\n
* @return {Boolean} true if one match, false otherwise\n
*/\n
ComplexQuery.prototype.NOT = function (item) {\n
return sequence([function () {\n
return this.query_list[0].match(item);\n
}, function (answer) {\n
return !answer;\n
}]);\n
};\n
\n
query_class_dict.complex = ComplexQuery;\n
\n
_export("ComplexQuery", ComplexQuery);\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
/*global parseStringToObject: true, emptyFunction: true, sortOn: true, limit:\n
true, select: true, _export: true, stringEscapeRegexpCharacters: true,\n
deepClone, RSVP, sequence */\n
\n
/**\n
* The query to use to filter a list of objects.\n
* This is an abstract class.\n
*\n
* @class Query\n
* @constructor\n
*/\n
function Query() {\n
\n
/**\n
* Called before parsing the query. Must be overridden!\n
*\n
* @method onParseStart\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} option Some option gave in parse()\n
*/\n
this.onParseStart = emptyFunction;\n
\n
/**\n
* Called when parsing a simple query. Must be overridden!\n
*\n
* @method onParseSimpleQuery\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} option Some option gave in parse()\n
*/\n
this.onParseSimpleQuery = emptyFunction;\n
\n
/**\n
* Called when parsing a complex query. Must be overridden!\n
*\n
* @method onParseComplexQuery\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} option Some option gave in parse()\n
*/\n
this.onParseComplexQuery = emptyFunction;\n
\n
/**\n
* Called after parsing the query. Must be overridden!\n
*\n
* @method onParseEnd\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} option Some option gave in parse()\n
*/\n
this.onParseEnd = emptyFunction;\n
\n
}\n
\n
/**\n
* Filter the item list with matching item only\n
*\n
* @method exec\n
* @param {Array} item_list The list of object\n
* @param {Object} [option] Some operation option\n
* @param {Array} [option.select_list] A object keys to retrieve\n
* @param {Array} [option.sort_on] Couples of object keys and "ascending"\n
* or "descending"\n
* @param {Array} [option.limit] Couple of integer, first is an index and\n
* second is the length.\n
*/\n
Query.prototype.exec = function (item_list, option) {\n
var i, promises = [];\n
if (!Array.isArray(item_list)) {\n
throw new TypeError("Query().exec(): Argument 1 is not of type \'array\'");\n
}\n
if (option === undefined) {\n
option = {};\n
}\n
if (typeof option !== \'object\') {\n
throw new TypeError("Query().exec(): " +\n
"Optional argument 2 is not of type \'object\'");\n
}\n
for (i = 0; i < item_list.length; i += 1) {\n
if (!item_list[i]) {\n
promises.push(RSVP.resolve(false));\n
} else {\n
promises.push(this.match(item_list[i]));\n
}\n
}\n
return sequence([function () {\n
return RSVP.all(promises);\n
}, function (answers) {\n
var j;\n
for (j = answers.length - 1; j >= 0; j -= 1) {\n
if (!answers[j]) {\n
item_list.splice(j, 1);\n
}\n
}\n
if (option.sort_on) {\n
return sortOn(option.sort_on, item_list);\n
}\n
}, function () {\n
if (option.limit) {\n
return limit(option.limit, item_list);\n
}\n
}, function () {\n
return select(option.select_list || [], item_list);\n
}, function () {\n
return item_list;\n
}]);\n
};\n
\n
/**\n
* Test if an item matches this query\n
*\n
* @method match\n
* @param {Object} item The object to test\n
* @return {Boolean} true if match, false otherwise\n
*/\n
Query.prototype.match = function () {\n
return RSVP.resolve(true);\n
};\n
\n
\n
/**\n
* Browse the Query in deep calling parser method in each step.\n
*\n
* `onParseStart` is called first, on end `onParseEnd` is called.\n
* It starts from the simple queries at the bottom of the tree calling the\n
* parser method `onParseSimpleQuery`, and go up calling the\n
* `onParseComplexQuery` method.\n
*\n
* @method parse\n
* @param {Object} option Any options you want (except \'parsed\')\n
* @return {Any} The parse result\n
*/\n
Query.prototype.parse = function (option) {\n
var that = this, object;\n
/**\n
* The recursive parser.\n
*\n
* @param {Object} object The object shared in the parse process\n
* @param {Object} options Some options usable in the parseMethods\n
* @return {Any} The parser result\n
*/\n
function recParse(object, option) {\n
var query = object.parsed;\n
if (query.type === "complex") {\n
return sequence([function () {\n
return sequence(query.query_list.map(function (v, i) {\n
/*jslint unparam: true */\n
return function () {\n
sequence([function () {\n
object.parsed = query.query_list[i];\n
return recParse(object, option);\n
}, function () {\n
query.query_list[i] = object.parsed;\n
}]);\n
};\n
}));\n
}, function () {\n
object.parsed = query;\n
return that.onParseComplexQuery(object, option);\n
}]);\n
}\n
if (query.type === "simple") {\n
return that.onParseSimpleQuery(object, option);\n
}\n
}\n
object = {"parsed": JSON.parse(JSON.stringify(that.serialized()))};\n
return sequence([function () {\n
return that.onParseStart(object, option);\n
}, function () {\n
return recParse(object, option);\n
}, function () {\n
return that.onParseEnd(object, option);\n
}, function () {\n
return object.parsed;\n
}]);\n
};\n
\n
/**\n
* Convert this query to a parsable string.\n
*\n
* @method toString\n
* @return {String} The string version of this query\n
*/\n
Query.prototype.toString = function () {\n
return "";\n
};\n
\n
/**\n
* Convert this query to an jsonable object in order to be remake thanks to\n
* QueryFactory class.\n
*\n
* @method serialized\n
* @return {Object} The jsonable object\n
*/\n
Query.prototype.serialized = function () {\n
return undefined;\n
};\n
\n
_export("Query", Query);\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
/*global _export, ComplexQuery, SimpleQuery, Query, parseStringToObject,\n
query_class_dict */\n
\n
/**\n
* Provides static methods to create Query object\n
*\n
* @class QueryFactory\n
*/\n
function QueryFactory() {\n
return;\n
}\n
\n
/**\n
* Creates Query object from a search text string or a serialized version\n
* of a Query.\n
*\n
* @method create\n
* @static\n
* @param {Object,String} object The search text or the serialized version\n
* of a Query\n
* @return {Query} A Query object\n
*/\n
QueryFactory.create = function (object, key_schema) {\n
if (object === "") {\n
return new Query();\n
}\n
if (typeof object === "string") {\n
object = parseStringToObject(object);\n
}\n
if (typeof (object || {}).type === "string" &&\n
query_class_dict[object.type]) {\n
return new query_class_dict[object.type](object, key_schema);\n
}\n
throw new TypeError("QueryFactory.create(): " +\n
"Argument 1 is not a search text or a parsable object");\n
};\n
\n
_export("QueryFactory", QueryFactory);\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
/*global _export: true */\n
\n
function objectToSearchText(query) {\n
var str_list = [];\n
if (query.type === "complex") {\n
str_list.push("(");\n
(query.query_list || []).forEach(function (sub_query) {\n
str_list.push(objectToSearchText(sub_query));\n
str_list.push(query.operator);\n
});\n
str_list.length -= 1;\n
str_list.push(")");\n
return str_list.join(" ");\n
}\n
if (query.type === "simple") {\n
return (query.key ? query.key + ": " : "") +\n
(query.operator || "") + \' "\' + query.value + \'"\';\n
}\n
throw new TypeError("This object is not a query");\n
}\n
_export("objectToSearchText", objectToSearchText);\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
/*global Query: true, inherits: true, query_class_dict: true, _export: true,\n
searchTextToRegExp, RSVP */\n
\n
var checkKeySchema = function (key_schema) {\n
var prop;\n
\n
if (key_schema !== undefined) {\n
if (typeof key_schema !== \'object\') {\n
throw new TypeError("SimpleQuery().create(): " +\n
"key_schema is not of type \'object\'");\n
}\n
// key_set is mandatory\n
if (key_schema.key_set === undefined) {\n
throw new TypeError("SimpleQuery().create(): " +\n
"key_schema has no \'key_set\' property");\n
}\n
for (prop in key_schema) {\n
if (key_schema.hasOwnProperty(prop)) {\n
switch (prop) {\n
case \'key_set\':\n
case \'cast_lookup\':\n
case \'match_lookup\':\n
break;\n
default:\n
throw new TypeError("SimpleQuery().create(): " +\n
"key_schema has unknown property \'" + prop + "\'");\n
}\n
}\n
}\n
}\n
};\n
\n
\n
/**\n
* The SimpleQuery inherits from Query, and compares one metadata value\n
*\n
* @class SimpleQuery\n
* @extends Query\n
* @param {Object} [spec={}] The specifications\n
* @param {String} [spec.operator="="] The compare method to use\n
* @param {String} spec.key The metadata key\n
* @param {String} spec.value The value of the metadata to compare\n
*/\n
function SimpleQuery(spec, key_schema) {\n
Query.call(this);\n
\n
checkKeySchema(key_schema);\n
\n
this._key_schema = key_schema || {};\n
\n
/**\n
* Operator to use to compare object values\n
*\n
* @attribute operator\n
* @type String\n
* @optional\n
*/\n
this.operator = spec.operator;\n
\n
/**\n
* Key of the object which refers to the value to compare\n
*\n
* @attribute key\n
* @type String\n
*/\n
this.key = spec.key;\n
\n
/**\n
* Value is used to do the comparison with the object value\n
*\n
* @attribute value\n
* @type String\n
*/\n
this.value = spec.value;\n
\n
}\n
inherits(SimpleQuery, Query);\n
\n
\n
var checkKey = function (key) {\n
var prop;\n
\n
if (key.read_from === undefined) {\n
throw new TypeError("Custom key is missing the read_from property");\n
}\n
\n
for (prop in key) {\n
if (key.hasOwnProperty(prop)) {\n
switch (prop) {\n
case \'read_from\':\n
case \'cast_to\':\n
case \'equal_match\':\n
break;\n
default:\n
throw new TypeError("Custom key has unknown property \'" +\n
prop + "\'");\n
}\n
}\n
}\n
};\n
\n
\n
/**\n
* #crossLink "Query/match:method"\n
*/\n
SimpleQuery.prototype.match = function (item) {\n
var object_value = null,\n
equal_match = null,\n
cast_to = null,\n
matchMethod = null,\n
operator = this.operator,\n
value = null,\n
key = this.key;\n
\n
/*jslint regexp: true */\n
if (!(/^(?:!?=|<=?|>=?)$/i.test(operator))) {\n
// `operator` is not correct, we have to change it to "like" or "="\n
if (/%/.test(this.value)) {\n
// `value` contains a non escaped `%`\n
operator = "like";\n
} else {\n
// `value` does not contain non escaped `%`\n
operator = "=";\n
}\n
}\n
\n
matchMethod = this[operator];\n
\n
if (this._key_schema.key_set && this._key_schema.key_set[key] !== undefined) {\n
key = this._key_schema.key_set[key];\n
}\n
\n
if (typeof key === \'object\') {\n
checkKey(key);\n
object_value = item[key.read_from];\n
\n
equal_match = key.equal_match;\n
\n
// equal_match can be a string\n
if (typeof equal_match === \'string\') {\n
// XXX raise error if equal_match not in match_lookup\n
equal_match = this._key_schema.match_lookup[equal_match];\n
}\n
\n
// equal_match overrides the default \'=\' operator\n
if (equal_match !== undefined) {\n
matchMethod = (operator === "=" || operator === "like" ?\n
equal_match : matchMethod);\n
}\n
\n
value = this.value;\n
cast_to = key.cast_to;\n
if (cast_to) {\n
// cast_to can be a string\n
if (typeof cast_to === \'string\') {\n
// XXX raise error if cast_to not in cast_lookup\n
cast_to = this._key_schema.cast_lookup[cast_to];\n
}\n
\n
value = cast_to(value);\n
object_value = cast_to(object_value);\n
}\n
} else {\n
object_value = item[key];\n
value = this.value;\n
}\n
if (object_value === undefined || value === undefined) {\n
return RSVP.resolve(false);\n
}\n
return matchMethod(object_value, value);\n
};\n
\n
/**\n
* #crossLink "Query/toString:method"\n
*/\n
SimpleQuery.prototype.toString = function () {\n
return (this.key ? this.key + ":" : "") +\n
(this.operator ? " " + this.operator : "") + \' "\' + this.value + \'"\';\n
};\n
\n
/**\n
* #crossLink "Query/serialized:method"\n
*/\n
SimpleQuery.prototype.serialized = function () {\n
var object = {\n
"type": "simple",\n
"key": this.key,\n
"value": this.value\n
};\n
if (this.operator !== undefined) {\n
object.operator = this.operator;\n
}\n
return object;\n
};\n
SimpleQuery.prototype.toJSON = SimpleQuery.prototype.serialized;\n
\n
/**\n
* Comparison operator, test if this query value matches the item value\n
*\n
* @method =\n
* @param {String} object_value The value to compare\n
* @param {String} comparison_value The comparison value\n
* @return {Boolean} true if match, false otherwise\n
*/\n
SimpleQuery.prototype["="] = function (object_value, comparison_value) {\n
var value, i;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
for (i = 0; i < object_value.length; i += 1) {\n
value = object_value[i];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) === 0);\n
}\n
if (\n
searchTextToRegExp(comparison_value.toString(), false).\n
test(value.toString())\n
) {\n
return RSVP.resolve(true);\n
}\n
}\n
return RSVP.resolve(false);\n
};\n
\n
/**\n
* Comparison operator, test if this query value matches the item value\n
*\n
* @method like\n
* @param {String} object_value The value to compare\n
* @param {String} comparison_value The comparison value\n
* @return {Boolean} true if match, false otherwise\n
*/\n
SimpleQuery.prototype.like = function (object_value, comparison_value) {\n
var value, i;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
for (i = 0; i < object_value.length; i += 1) {\n
value = object_value[i];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) === 0);\n
}\n
if (\n
searchTextToRegExp(comparison_value.toString()).test(value.toString())\n
) {\n
return RSVP.resolve(true);\n
}\n
}\n
return RSVP.resolve(false);\n
};\n
\n
/**\n
* Comparison operator, test if this query value does not match the item value\n
*\n
* @method !=\n
* @param {String} object_value The value to compare\n
* @param {String} comparison_value The comparison value\n
* @return {Boolean} true if not match, false otherwise\n
*/\n
SimpleQuery.prototype["!="] = function (object_value, comparison_value) {\n
var value, i;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
for (i = 0; i < object_value.length; i += 1) {\n
value = object_value[i];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) !== 0);\n
}\n
if (\n
searchTextToRegExp(comparison_value.toString(), false).\n
test(value.toString())\n
) {\n
return RSVP.resolve(false);\n
}\n
}\n
return RSVP.resolve(true);\n
};\n
\n
/**\n
* Comparison operator, test if this query value is lower than the item value\n
*\n
* @method <\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if lower, false otherwise\n
*/\n
SimpleQuery.prototype["<"] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) < 0);\n
}\n
return RSVP.resolve(value < comparison_value);\n
};\n
\n
/**\n
* Comparison operator, test if this query value is equal or lower than the\n
* item value\n
*\n
* @method <=\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if equal or lower, false otherwise\n
*/\n
SimpleQuery.prototype["<="] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) <= 0);\n
}\n
return RSVP.resolve(value <= comparison_value);\n
};\n
\n
/**\n
* Comparison operator, test if this query value is greater than the item\n
* value\n
*\n
* @method >\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if greater, false otherwise\n
*/\n
SimpleQuery.prototype[">"] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) > 0);\n
}\n
return RSVP.resolve(value > comparison_value);\n
};\n
\n
/**\n
* Comparison operator, test if this query value is equal or greater than the\n
* item value\n
*\n
* @method >=\n
* @param {Number, String} object_value The value to compare\n
* @param {Number, String} comparison_value The comparison value\n
* @return {Boolean} true if equal or greater, false otherwise\n
*/\n
SimpleQuery.prototype[">="] = function (object_value, comparison_value) {\n
var value;\n
if (!Array.isArray(object_value)) {\n
object_value = [object_value];\n
}\n
value = object_value[0];\n
if (typeof value === \'object\' && value.hasOwnProperty(\'content\')) {\n
value = value.content;\n
}\n
if (typeof value.cmp === "function") {\n
return RSVP.resolve(value.cmp(comparison_value) >= 0);\n
}\n
return RSVP.resolve(value >= comparison_value);\n
};\n
\n
query_class_dict.simple = SimpleQuery;\n
\n
_export("SimpleQuery", SimpleQuery);\n
\n
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */\n
/*global _export, RSVP */\n
\n
/**\n
* Escapes regexp special chars from a string.\n
*\n
* @param {String} string The string to escape\n
* @return {String} The escaped string\n
*/\n
function stringEscapeRegexpCharacters(string) {\n
if (typeof string === "string") {\n
return string.replace(/([\\\\\\.\\$\\[\\]\\(\\)\\{\\}\\^\\?\\*\\+\\-])/g, "\\\\$1");\n
}\n
throw new TypeError("complex_queries.stringEscapeRegexpCharacters(): " +\n
"Argument no 1 is not of type \'string\'");\n
}\n
\n
_export("stringEscapeRegexpCharacters", stringEscapeRegexpCharacters);\n
\n
/**\n
* Convert metadata values to array of strings. ex:\n
*\n
* "a" -> ["a"],\n
* {"content": "a"} -> ["a"]\n
*\n
* @param {Any} value The metadata value\n
* @return {Array} The value in string array format\n
*/\n
function metadataValueToStringArray(value) {\n
var i, new_value = [];\n
if (value === undefined) {\n
return undefined;\n
}\n
if (!Array.isArray(value)) {\n
value = [value];\n
}\n
for (i = 0; i < value.length; i += 1) {\n
if (typeof value[i] === \'object\') {\n
new_value[i] = value[i].content;\n
} else {\n
new_value[i] = value[i];\n
}\n
}\n
return new_value;\n
}\n
\n
/**\n
* A sort function to sort items by key\n
*\n
* @param {String} key The key to sort on\n
* @param {String} [way="ascending"] \'ascending\' or \'descending\'\n
* @return {Function} The sort function\n
*/\n
function sortFunction(key, way) {\n
if (way === \'descending\') {\n
return function (a, b) {\n
// this comparison is 5 times faster than json comparison\n
var i, l;\n
a = metadataValueToStringArray(a[key]) || [];\n
b = metadataValueToStringArray(b[key]) || [];\n
l = a.length > b.length ? a.length : b.length;\n
for (i = 0; i < l; i += 1) {\n
if (a[i] === undefined) {\n
return 1;\n
}\n
if (b[i] === undefined) {\n
return -1;\n
}\n
if (a[i] > b[i]) {\n
return -1;\n
}\n
if (a[i] < b[i]) {\n
return 1;\n
}\n
}\n
return 0;\n
};\n
}\n
if (way === \'ascending\') {\n
return function (a, b) {\n
// this comparison is 5 times faster than json comparison\n
var i, l;\n
a = metadataValueToStringArray(a[key]) || [];\n
b = metadataValueToStringArray(b[key]) || [];\n
l = a.length > b.length ? a.length : b.length;\n
for (i = 0; i < l; i += 1) {\n
if (a[i] === undefined) {\n
return -1;\n
}\n
if (b[i] === undefined) {\n
return 1;\n
}\n
if (a[i] > b[i]) {\n
return 1;\n
}\n
if (a[i] < b[i]) {\n
return -1;\n
}\n
}\n
return 0;\n
};\n
}\n
throw new TypeError("complex_queries.sortFunction(): " +\n
"Argument 2 must be \'ascending\' or \'descending\'");\n
}\n
\n
/**\n
* Clones all native object in deep. Managed types: Object, Array, String,\n
* Number, Boolean, null.\n
*\n
* @param {A} object The object to clone\n
* @return {A} The cloned object\n
*/\n
function deepClone(object) {\n
var i, cloned;\n
if (Array.isArray(object)) {\n
cloned = [];\n
for (i = 0; i < object.length; i += 1) {\n
cloned[i] = deepClone(object[i]);\n
}\n
return cloned;\n
}\n
if (typeof object === "object") {\n
cloned = {};\n
for (i in object) {\n
if (object.hasOwnProperty(i)) {\n
cloned[i] = deepClone(object[i]);\n
}\n
}\n
return cloned;\n
}\n
return object;\n
}\n
\n
/**\n
* Inherits the prototype methods from one constructor into another. The\n
* prototype of `constructor` will be set to a new object created from\n
* `superConstructor`.\n
*\n
* @param {Function} constructor The constructor which inherits the super one\n
* @param {Function} superConstructor The super constructor\n
*/\n
function inherits(constructor, superConstructor) {\n
constructor.super_ = superConstructor;\n
constructor.prototype = Object.create(superConstructor.prototype, {\n
"constructor": {\n
"configurable": true,\n
"enumerable": false,\n
"writable": true,\n
"value": constructor\n
}\n
});\n
}\n
\n
/**\n
* Does nothing\n
*/\n
function emptyFunction() {\n
return;\n
}\n
\n
/**\n
* Filter a list of items, modifying them to select only wanted keys. If\n
* `clone` is true, then the method will act on a cloned list.\n
*\n
* @param {Array} select_option Key list to keep\n
* @param {Array} list The item list to filter\n
* @param {Boolean} [clone=false] If true, modifies a clone of the list\n
* @return {Array} The filtered list\n
*/\n
function select(select_option, list, clone) {\n
var i, j, new_item;\n
if (!Array.isArray(select_option)) {\n
throw new TypeError("complex_queries.select(): " +\n
"Argument 1 is not of type Array");\n
}\n
if (!Array.isArray(list)) {\n
throw new TypeError("complex_queries.select(): " +\n
"Argument 2 is not of type Array");\n
}\n
if (clone === true) {\n
list = deepClone(list);\n
}\n
for (i = 0; i < list.length; i += 1) {\n
new_item = {};\n
for (j = 0; j < select_option.length; j += 1) {\n
if (list[i].hasOwnProperty([select_option[j]])) {\n
new_item[select_option[j]] = list[i][select_option[j]];\n
}\n
}\n
for (j in new_item) {\n
if (new_item.hasOwnProperty(j)) {\n
list[i] = new_item;\n
break;\n
}\n
}\n
}\n
return list;\n
}\n
\n
_export(\'select\', select);\n
\n
/**\n
* Sort a list of items, according to keys and directions. If `clone` is true,\n
* then the method will act on a cloned list.\n
*\n
* @param {Array} sort_on_option List of couples [key, direction]\n
* @param {Array} list The item list to sort\n
* @param {Boolean} [clone=false] If true, modifies a clone of the list\n
* @return {Array} The filtered list\n
*/\n
function sortOn(sort_on_option, list, clone) {\n
var sort_index;\n
if (!Array.isArray(sort_on_option)) {\n
throw new TypeError("complex_queries.sortOn(): " +\n
"Argument 1 is not of type \'array\'");\n
}\n
if (clone) {\n
list = deepClone(list);\n
}\n
for (sort_index = sort_on_option.length - 1; sort_index >= 0;\n
sort_index -= 1) {\n
list.sort(sortFunction(\n
sort_on_option[sort_index][0],\n
sort_on_option[sort_index][1]\n
));\n
}\n
return list;\n
}\n
\n
_export(\'sortOn\', sortOn);\n
\n
/**\n
* Limit a list of items, according to index and length. If `clone` is true,\n
* then the method will act on a cloned list.\n
*\n
* @param {Array} limit_option A couple [from, length]\n
* @param {Array} list The item list to limit\n
* @param {Boolean} [clone=false] If true, modifies a clone of the list\n
* @return {Array} The filtered list\n
*/\n
function limit(limit_option, list, clone) {\n
if (!Array.isArray(limit_option)) {\n
throw new TypeError("complex_queries.limit(): " +\n
"Argument 1 is not of type \'array\'");\n
}\n
if (!Array.isArray(list)) {\n
throw new TypeError("complex_queries.limit(): " +\n
"Argument 2 is not of type \'array\'");\n
}\n
if (clone) {\n
list = deepClone(list);\n
}\n
list.splice(0, limit_option[0]);\n
if (limit_option[1]) {\n
list.splice(limit_option[1]);\n
}\n
return list;\n
}\n
\n
_export(\'limit\', limit);\n
\n
/**\n
* Convert a search text to a regexp.\n
*\n
* @param {String} string The string to convert\n
* @param {Boolean} [use_wildcard_character=true] Use wildcard "%" and "_"\n
* @return {RegExp} The search text regexp\n
*/\n
function searchTextToRegExp(string, use_wildcard_characters) {\n
if (typeof string !== \'string\') {\n
throw new TypeError("complex_queries.searchTextToRegExp(): " +\n
"Argument 1 is not of type \'string\'");\n
}\n
if (use_wildcard_characters === false) {\n
return new RegExp("^" + stringEscapeRegexpCharacters(string) + "$");\n
}\n
return new RegExp("^" + stringEscapeRegexpCharacters(string).replace(\n
/%/g,\n
".*"\n
).replace(\n
/_/g,\n
"."\n
) + "$");\n
}\n
\n
_export("searchTextToRegExp", searchTextToRegExp);\n
\n
/**\n
* sequence(thens): Promise\n
*\n
* Executes a sequence of *then* callbacks. It acts like\n
* `smth().then(callback).then(callback)...`. The first callback is called with\n
* no parameter.\n
*\n
* Elements of `thens` array can be a function or an array contaning at most\n
* three *then* callbacks: *onFulfilled*, *onRejected*, *onNotified*.\n
*\n
* When `cancel()` is executed, each then promises are cancelled at the same\n
* time.\n
*\n
* @param {Array} thens An array of *then* callbacks\n
* @return {Promise} A new promise\n
*/\n
function sequence(thens) {\n
var promises = [];\n
return new RSVP.Promise(function (resolve, reject, notify) {\n
var i;\n
promises[0] = new RSVP.Promise(function (resolve) {\n
resolve();\n
});\n
for (i = 0; i < thens.length; i += 1) {\n
if (Array.isArray(thens[i])) {\n
promises[i + 1] = promises[i].\n
then(thens[i][0], thens[i][1], thens[i][2]);\n
} else {\n
promises[i + 1] = promises[i].then(thens[i]);\n
}\n
}\n
promises[i].then(resolve, reject, notify);\n
}, function () {\n
var i;\n
for (i = 0; i < promises.length; i += 1) {\n
promises[i].cancel();\n
}\n
});\n
}\n
\n
\n
return to_export;\n
}));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jio_complex_queries.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.92</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.8906.38062.29081</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405933455.12</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405087262.84</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_sha1.amd.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_jio_sha1_amd_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
(function (dependencies, module) {\n
if (typeof define === \'function\' && define.amd) {\n
return define(dependencies, module);\n
}\n
if (typeof exports === \'object\') {\n
return module(exports);\n
}\n
module(window);\n
}([\'exports\'], function (exports) {\n
/*\n
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined\n
* in FIPS PUB 180-1\n
* Version 2.1a Copyright Paul Johnston 2000 - 2002.\n
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n
* Distributed under the BSD License\n
* See http://pajhome.org.uk/crypt/md5 for details.\n
*/\n
\n
/*\n
* Configurable variables. You may need to tweak these to be compatible with\n
* the server-side, but the defaults work in most cases.\n
*/\n
\n
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */\n
var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */\n
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */\n
\n
/*\n
* These are the functions you\'ll usually want to call\n
* They take string arguments and return either hex or base-64 encoded strings\n
*/\n
function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}\n
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}\n
function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}\n
function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}\n
function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}\n
function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}\n
\n
/*\n
* Perform a simple self-test to see if the VM is working\n
*/\n
function sha1_vm_test()\n
{\n
return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";\n
}\n
\n
/*\n
* Calculate the SHA-1 of an array of big-endian words, and a bit length\n
*/\n
function core_sha1(x, len)\n
{\n
/* append padding */\n
x[len >> 5] |= 0x80 << (24 - len % 32);\n
x[((len + 64 >> 9) << 4) + 15] = len;\n
\n
var w = Array(80);\n
var a = 1732584193;\n
var b = -271733879;\n
var c = -1732584194;\n
var d = 271733878;\n
var e = -1009589776;\n
\n
for(var i = 0; i < x.length; i += 16)\n
{\n
var olda = a;\n
var oldb = b;\n
var oldc = c;\n
var oldd = d;\n
var olde = e;\n
\n
for(var j = 0; j < 80; j++)\n
{\n
if(j < 16) w[j] = x[i + j];\n
else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);\n
var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n
safe_add(safe_add(e, w[j]), sha1_kt(j)));\n
e = d;\n
d = c;\n
c = rol(b, 30);\n
b = a;\n
a = t;\n
}\n
\n
a = safe_add(a, olda);\n
b = safe_add(b, oldb);\n
c = safe_add(c, oldc);\n
d = safe_add(d, oldd);\n
e = safe_add(e, olde);\n
}\n
return Array(a, b, c, d, e);\n
\n
}\n
\n
/*\n
* Perform the appropriate triplet combination function for the current\n
* iteration\n
*/\n
function sha1_ft(t, b, c, d)\n
{\n
if(t < 20) return (b & c) | ((~b) & d);\n
if(t < 40) return b ^ c ^ d;\n
if(t < 60) return (b & c) | (b & d) | (c & d);\n
return b ^ c ^ d;\n
}\n
\n
/*\n
* Determine the appropriate additive constant for the current iteration\n
*/\n
function sha1_kt(t)\n
{\n
return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :\n
(t < 60) ? -1894007588 : -899497514;\n
}\n
\n
/*\n
* Calculate the HMAC-SHA1 of a key and some data\n
*/\n
function core_hmac_sha1(key, data)\n
{\n
var bkey = str2binb(key);\n
if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);\n
\n
var ipad = Array(16), opad = Array(16);\n
for(var i = 0; i < 16; i++)\n
{\n
ipad[i] = bkey[i] ^ 0x36363636;\n
opad[i] = bkey[i] ^ 0x5C5C5C5C;\n
}\n
\n
var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);\n
return core_sha1(opad.concat(hash), 512 + 160);\n
}\n
\n
/*\n
* Add integers, wrapping at 2^32. This uses 16-bit operations internally\n
* to work around bugs in some JS interpreters.\n
*/\n
function safe_add(x, y)\n
{\n
var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n
return (msw << 16) | (lsw & 0xFFFF);\n
}\n
\n
/*\n
* Bitwise rotate a 32-bit number to the left.\n
*/\n
function rol(num, cnt)\n
{\n
return (num << cnt) | (num >>> (32 - cnt));\n
}\n
\n
/*\n
* Convert an 8-bit or 16-bit string to an array of big-endian words\n
* In 8-bit function, characters >255 have their hi-byte silently ignored.\n
*/\n
function str2binb(str)\n
{\n
var bin = Array();\n
var mask = (1 << chrsz) - 1;\n
for(var i = 0; i < str.length * chrsz; i += chrsz)\n
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);\n
return bin;\n
}\n
\n
/*\n
* Convert an array of big-endian words to a string\n
*/\n
function binb2str(bin)\n
{\n
var str = "";\n
var mask = (1 << chrsz) - 1;\n
for(var i = 0; i < bin.length * 32; i += chrsz)\n
str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\n
return str;\n
}\n
\n
/*\n
* Convert an array of big-endian words to a hex string.\n
*/\n
function binb2hex(binarray)\n
{\n
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";\n
var str = "";\n
for(var i = 0; i < binarray.length * 4; i++)\n
{\n
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n
}\n
return str;\n
}\n
\n
/*\n
* Convert an array of big-endian words to a base-64 string\n
*/\n
function binb2b64(binarray)\n
{\n
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n
var str = "";\n
for(var i = 0; i < binarray.length * 4; i += 3)\n
{\n
var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16)\n
| (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )\n
| ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);\n
for(var j = 0; j < 4; j++)\n
{\n
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;\n
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);\n
}\n
}\n
return str;\n
}\n
\n
exports.hex_sha1 = hex_sha1;\n
exports.b64_sha1 = b64_sha1;\n
exports.str_sha1 = str_sha1;\n
exports.hex_hmac_sha1 = hex_hmac_sha1;\n
exports.b64_hmac_sha1 = b64_hmac_sha1;\n
exports.str_hmac_sha1 = str_hmac_sha1;\n
}));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jio_sha1.amd.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.7</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.8919.26569.29201</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405933454.83</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405086959.62</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_sha256.amd.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_jio_sha256_amd_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
(function (dependencies, module) {\n
if (typeof define === \'function\' && define.amd) {\n
return define(dependencies, module);\n
}\n
if (typeof exports === \'object\') {\n
return module(exports);\n
}\n
module(window);\n
}([\'exports\'], function (window) {\n
/* A JavaScript implementation of the Secure Hash Algorithm, SHA-256\n
* Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/\n
* Distributed under the BSD License\n
* Some bits taken from Paul Johnston\'s SHA-1 implementation\n
*/\n
(function () {\n
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */\n
function safe_add (x, y) {\n
var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n
return (msw << 16) | (lsw & 0xFFFF);\n
}\n
function S (X, n) {return ( X >>> n ) | (X << (32 - n));}\n
function R (X, n) {return ( X >>> n );}\n
function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}\n
function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}\n
function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));}\n
function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));}\n
function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));}\n
function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));}\n
function newArray (n) {\n
var a = [];\n
for (;n>0;n--) {\n
a.push(undefined);\n
}\n
return a;\n
}\n
function core_sha256 (m, l) {\n
var K = [0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2];\n
var HASH = [0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19];\n
var W = newArray(64);\n
var a, b, c, d, e, f, g, h, i, j;\n
var T1, T2;\n
/* append padding */\n
m[l >> 5] |= 0x80 << (24 - l % 32);\n
m[((l + 64 >> 9) << 4) + 15] = l;\n
for ( var i = 0; i<m.length; i+=16 ) {\n
a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3];\n
e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7];\n
for ( var j = 0; j<64; j++) {\n
if (j < 16) {\n
W[j] = m[j + i];\n
} else {\n
W[j] = safe_add(safe_add(safe_add(Gamma1256(\n
W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);\n
}\n
T1 = safe_add(safe_add(safe_add(\n
safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);\n
T2 = safe_add(Sigma0256(a), Maj(a, b, c));\n
h = g; g = f; f = e; e = safe_add(d, T1);\n
d = c; c = b; b = a; a = safe_add(T1, T2);\n
}\n
HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]);\n
HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]);\n
HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]);\n
HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]);\n
}\n
return HASH;\n
}\n
function str2binb (str) {\n
var bin = Array();\n
var mask = (1 << chrsz) - 1;\n
for(var i = 0; i < str.length * chrsz; i += chrsz)\n
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);\n
return bin;\n
}\n
function binb2hex (binarray) {\n
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */\n
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";\n
var str = "";\n
for (var i = 0; i < binarray.length * 4; i++) {\n
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n
}\n
return str;\n
}\n
function hex_sha256(s){\n
return binb2hex(core_sha256(str2binb(s),s.length * chrsz));\n
}\n
window.hex_sha256 = hex_sha256;\n
}());\n
}));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jio_sha256.amd.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.93</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.8919.10922.33092</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405933455.15</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405087119.31</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_sha2.amd.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_jio_sha2_amd_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
(function (dependencies, module) {\n
if (typeof define === \'function\' && define.amd) {\n
return define(dependencies, module);\n
}\n
if (typeof exports === \'object\') {\n
return module(exports);\n
}\n
module(window);\n
}([\'exports\'], function (window) {\n
/* A JavaScript implementation of the Secure Hash Standard\n
* Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/\n
* Distributed under the BSD License\n
* Some bits taken from Paul Johnston\'s SHA-1 implementation\n
*/\n
(function () {\n
var chrsz = 8;/* bits per input character. 8 - ASCII; 16 - Unicode */\n
var hexcase = 0;/* hex output format. 0 - lowercase; 1 - uppercase */\n
\n
function safe_add (x, y) {\n
var lsw = (x & 0xFFFF) + (y & 0xFFFF);\n
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n
return (msw << 16) | (lsw & 0xFFFF);\n
}\n
\n
function S (X, n) {return ( X >>> n ) | (X << (32 - n));}\n
\n
function R (X, n) {return ( X >>> n );}\n
\n
function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}\n
\n
function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}\n
\n
function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));}\n
\n
function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));}\n
\n
function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));}\n
\n
function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));}\n
\n
function Sigma0512(x) {return (S(x, 28) ^ S(x, 34) ^ S(x, 39));}\n
\n
function Sigma1512(x) {return (S(x, 14) ^ S(x, 18) ^ S(x, 41));}\n
\n
function Gamma0512(x) {return (S(x, 1) ^ S(x, 8) ^ R(x, 7));}\n
\n
function Gamma1512(x) {return (S(x, 19) ^ S(x, 61) ^ R(x, 6));}\n
\n
function newArray (n) {\n
var a = [];\n
for (;n>0;n--) {\n
a.push(undefined);\n
}\n
return a;\n
}\n
\n
function core_sha256 (m, l) {\n
var K = [0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2];\n
var HASH = [0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19];\n
var W = newArray(64);\n
var a, b, c, d, e, f, g, h, i, j;\n
var T1, T2;\n
\n
/* append padding */\n
m[l >> 5] |= 0x80 << (24 - l % 32);\n
m[((l + 64 >> 9) << 4) + 15] = l;\n
\n
for ( var i = 0; i<m.length; i+=16 ) {\n
a = HASH[0];\n
b = HASH[1];\n
c = HASH[2];\n
d = HASH[3];\n
e = HASH[4];\n
f = HASH[5];\n
g = HASH[6];\n
h = HASH[7];\n
\n
for ( var j = 0; j<64; j++) {\n
if (j < 16) {\n
W[j] = m[j + i];\n
} else {\n
W[j] = safe_add(safe_add(safe_add(Gamma1256(\n
W[j - 2]),W[j - 7]),Gamma0256(W[j - 15])), W[j - 16]);\n
}\n
\n
T1 = safe_add(safe_add(safe_add(safe_add(\n
h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);\n
T2 = safe_add(Sigma0256(a), Maj(a, b, c));\n
\n
h = g;\n
g = f;\n
f = e;\n
e = safe_add(d, T1);\n
d = c;\n
c = b;\n
b = a;\n
a = safe_add(T1, T2);\n
}\n
\n
HASH[0] = safe_add(a, HASH[0]);\n
HASH[1] = safe_add(b, HASH[1]);\n
HASH[2] = safe_add(c, HASH[2]);\n
HASH[3] = safe_add(d, HASH[3]);\n
HASH[4] = safe_add(e, HASH[4]);\n
HASH[5] = safe_add(f, HASH[5]);\n
HASH[6] = safe_add(g, HASH[6]);\n
HASH[7] = safe_add(h, HASH[7]);\n
}\n
return HASH;\n
}\n
\n
function core_sha512 (m, l) {\n
var K = [0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc, 0x3956c25bf348b538, 0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242, 0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2, 0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235, 0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65, 0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5, 0x983e5152ee66dfab, 0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725, 0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df, 0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b, 0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218, 0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8, 0x19a4c116b8d2d0c8, 0x1e376c085141ab53, 0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec, 0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b, 0xca273eceea26619c, 0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba, 0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b, 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc, 0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817];\n
var HASH = [0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1, 0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179];\n
var W = newArray(80);\n
var a, b, c, d, e, f, g, h, i, j;\n
var T1, T2;\n
\n
}\n
\n
function str2binb (str) {\n
var bin = Array();\n
var mask = (1 << chrsz) - 1;\n
for(var i = 0; i < str.length * chrsz; i += chrsz)\n
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);\n
return bin;\n
}\n
\n
function binb2str (bin) {\n
var str = "";\n
var mask = (1 << chrsz) - 1;\n
for(var i = 0; i < bin.length * 32; i += chrsz)\n
str += String.fromCharCode((bin[i>>5] >>> (24 - i%32)) & mask);\n
return str;\n
}\n
\n
function binb2hex (binarray) {\n
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";\n
var str = "";\n
for(var i = 0; i < binarray.length * 4; i++)\n
{\n
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n
}\n
return str;\n
}\n
\n
function binb2b64 (binarray) {\n
var tab =\n
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n
var str = "";\n
for(var i = 0; i < binarray.length * 4; i += 3) {\n
var triplet = (((binarray[i >> 2] >> 8 * (3- i %4)) & 0xFF) << 16) |\n
(((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) |\n
((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);\n
for(var j = 0; j < 4; j++) {\n
if(i * 8 + j * 6 > binarray.length * 32) { str += b64pad; }\n
else {str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);}\n
}\n
}\n
return str;\n
}\n
\n
function hex_sha256(s){\n
return binb2hex(core_sha256(str2binb(s),s.length * chrsz));\n
}\n
function b64_sha256(s){\n
return binb2b64(core_sha256(str2binb(s),s.length * chrsz));\n
}\n
function str_sha256(s){\n
return binb2str(core_sha256(str2binb(s),s.length * chrsz));\n
}\n
window.hex_sha256 = hex_sha256;\n
window.b64_sha256 = b64_sha256;\n
window.str_sha256 = str_sha256;\n
}());\n
}));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jio_sha2.amd.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.94</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.8919.19351.38041</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405933455.16</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405087086.22</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>jio_storage_erp5.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_jio_storage_erp5_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*\n
* Copyright 2013, Nexedi SA\n
* Released under the LGPL license.\n
* http://www.gnu.org/licenses/lgpl.html\n
*/\n
// JIO ERP5 Storage Description :\n
// {\n
// type: "erp5"\n
// url: {string}\n
// default_view: {string} (optional)\n
// }\n
\n
/*jslint indent: 2, nomen: true, unparam: true */\n
/*global jIO, UriTemplate, FormData, RSVP, URI, DOMParser, Blob,\n
ProgressEvent, define */\n
\n
(function (root, dependencies, module) {\n
"use strict";\n
if (typeof define === \'function\' && define.amd) {\n
return define(dependencies, module);\n
}\n
var namespace = module(RSVP, jIO, URI, UriTemplate);\n
if (namespace !== undefined) { root.ERP5Storage = namespace; }\n
}(this, [\n
"rsvp",\n
"jio",\n
"uri",\n
"uritemplate"\n
], function (RSVP, jIO, URI, UriTemplate) {\n
"use strict";\n
\n
var hasOwnProperty = Function.prototype.call.bind(\n
Object.prototype.hasOwnProperty\n
), constant = {};\n
\n
constant.method_notification_message_obj = {\n
"get": "Getting document.",\n
"post": "Posting document.",\n
"put": "Putting document.",\n
"remove": "Removing document.",\n
"getAttachment": "Getting attachment.",\n
"putAttachment": "Putting attachment.",\n
"removeAttacment": "Removing attachment.",\n
"allDocs": "Getting document list."\n
};\n
\n
// XXX docstring\n
function formatGetSuccessAnswer(answer) {\n
if (answer === undefined || answer === null) { throw answer; }\n
var result;\n
if (typeof answer.data === "object" && answer.data) {\n
return answer;\n
}\n
if (answer.target &&\n
typeof answer.target.status === "number" &&\n
typeof answer.target.statusText === "string") {\n
result = {\n
"status": answer.target.status\n
};\n
if (typeof answer.target.response === "object" &&\n
answer.target.response !== null) {\n
if (typeof answer.target.response.toJSON === "function") {\n
result.data = answer.target.response.toJSON();\n
} else {\n
result.data = answer.target.response;\n
}\n
} else if (answer.target.response instanceof Blob) {\n
return jIO.util.readBlobAsText(answer.target.response).\n
then(function (text) {\n
result.data = JSON.parse(text);\n
return result;\n
});\n
}\n
return result;\n
}\n
return answer;\n
}\n
\n
// XXX docstring\n
function formatUpdateSuccessAnswer(answer) {\n
if (answer === undefined || answer === null) { throw answer; }\n
var result;\n
if (typeof answer.target === "object" && answer.target !== null &&\n
typeof answer.target.status === "number") {\n
result = {\n
"status": answer.target.status\n
};\n
return result;\n
}\n
return answer;\n
}\n
\n
// XXX docstring\n
function formatErrorAnswer(answer) {\n
if (answer === undefined || answer === null) { throw answer; }\n
var result, dom;\n
if (answer.target &&\n
typeof answer.target.status === "number" &&\n
typeof answer.target.statusText === "string") {\n
// seams to be a ProgressEvent\n
result = {\n
"status": answer.target.status\n
};\n
if (typeof answer.target.response === "object" &&\n
answer.target.response !== null) {\n
if (typeof answer.target.response.toJSON === "function") {\n
result.data = answer.target.response.toJSON();\n
} else {\n
result.data = answer.target.response;\n
}\n
} else if (typeof answer.target.responseText === "string") {\n
result.message = answer.target.responseText;\n
// dom = new DOMParser().parseFromString(\n
// answer.target.responseText,\n
// "text/html"\n
// );\n
// result.message = (dom.querySelector(\'#master\') ||\n
// dom.firstElementChild).textContent;\n
// if (!result.message) { delete result.message; }\n
}\n
throw result;\n
}\n
throw answer;\n
}\n
\n
// XXX docstring\n
function formatNotification(method, notif) {\n
var result;\n
if (notif) {\n
if (typeof notif.loaded === "number" &&\n
typeof notif.total === "number") {\n
result = {};\n
// can be a ProgressEvent or a jIO notification\n
if (notif.method !== method) {\n
result = {\n
"method": method,\n
"loaded": notif.loaded,\n
"total": notif.total\n
};\n
if (typeof notif.percentage === "number") {\n
result.percentage = notif.percentage;\n
}\n
}\n
if (typeof notif.message === "string") {\n
result.message = notif.message;\n
} else {\n
result.message = constant.method_notification_message_obj[method];\n
}\n
return result;\n
}\n
}\n
throw null; // stop propagation\n
}\n
\n
constant.formatSuccessAnswerFor = {\n
"post": formatUpdateSuccessAnswer,\n
"put": formatUpdateSuccessAnswer,\n
"get": formatGetSuccessAnswer\n
};\n
\n
//////////////////////////////////////////////////////////////////////\n
\n
// XXX docstring\n
function ERP5Storage(spec) {\n
if (typeof spec.url !== "string" || !spec.url) {\n
throw new TypeError("ERP5 \'url\' must be a string " +\n
"which contains more than one character.");\n
}\n
this._url = spec.url;\n
this._default_view = spec.default_view;\n
}\n
\n
// XXX docstring\n
function methodGenerator(method) {\n
return function (command, param, options) {\n
RSVP.resolve().\n
then(function () {\n
var view = ERP5Storage.onView[options._view || this._default_view] ||\n
ERP5Storage.onView["default"];\n
if (typeof view[method] !== "function") {\n
view = ERP5Storage.onView["default"];\n
}\n
return view[method].call(this, param, options);\n
}.bind(this)).\n
then(constant.formatSuccessAnswerFor[method]).\n
then(null, formatErrorAnswer, formatNotification.bind(null, method)).\n
then(command.success, command.error, command.progress);\n
};\n
}\n
\n
// XXX docstring\n
[\n
"post",\n
"put",\n
"get",\n
"remove",\n
"putAttachment",\n
"getAttachment",\n
"removeAttachment",\n
"allDocs",\n
"check",\n
"repair"\n
].forEach(function (method) {\n
ERP5Storage.prototype[method] = methodGenerator(method);\n
});\n
// XXX docstring\n
function getSiteDocument(url) {\n
if (typeof url !== "string" &&\n
typeof (this && this._url) !== "string") {\n
throw new TypeError("ERP5Storage.getSiteDocument(): Argument 1 `url` " +\n
"or `this._url` are not of type string.");\n
}\n
return jIO.util.ajax({\n
"type": "GET",\n
"url": url || this._url,\n
"xhrFields": {\n
withCredentials: true\n
}\n
}).then(function (event) {\n
return JSON.parse(event.target.responseText);\n
});\n
}\n
ERP5Storage.getSiteDocument = getSiteDocument;\n
\n
// XXX docstring\n
function getDocumentAndHatoas(param, options) {\n
var this_ = this;\n
return ERP5Storage.getSiteDocument(this._url).\n
then(function (site_hal) {\n
// XXX need to get modified metadata\n
return jIO.util.ajax({\n
"type": "GET",\n
"url": UriTemplate.parse(site_hal._links.traverse.href)\n
.expand({\n
relative_url: param._id,\n
view: options._view || this_._default_view || "view"\n
}),\n
"xhrFields": {\n
withCredentials: true\n
}\n
});\n
});\n
}\n
\n
ERP5Storage.onView = {};\n
ERP5Storage.onView["default"] = {};\n
\n
// XXX docstring\n
ERP5Storage.onView["default"].get = function (param, options) {\n
return getDocumentAndHatoas.call(this, param, options).\n
then(function (response) {\n
var result = JSON.parse(response.target.responseText);\n
result._id = param._id;\n
result.portal_type = result._links.type.name;\n
// XXX\n
// delete result._embedded;\n
// delete result._links;\n
// delete result._debug;\n
// new jIO.Metadata(result).format();\n
return {"data": result};\n
});\n
};\n
\n
// XXX docstring\n
ERP5Storage.onView["default"].post = function (metadata, options) {\n
var final_response;\n
return getSiteDocument(this._url)\n
.then(function (site_hal) {\n
/*jslint forin: true */\n
var post_action = site_hal._actions.add,\n
data = new FormData();\n
\n
data.append("portal_type", metadata.portal_type);\n
\n
return jIO.util.ajax({\n
"type": post_action.method,\n
"url": post_action.href,\n
"data": data,\n
"xhrFields": {\n
withCredentials: true\n
}\n
});\n
}).then(function (event) {\n
final_response = {"status": event.target.status};\n
if (!metadata._id) {\n
// XXX Really depend on server response...\n
var uri = new URI(event.target.getResponseHeader("X-Location"));\n
final_response.id = uri.segment(2);\n
metadata._id = final_response.id;\n
}\n
}).\n
then(ERP5Storage.onView["default"].put.bind(this, metadata, options)).\n
then(function () { return final_response; });\n
};\n
\n
// XXX docstring\n
ERP5Storage.onView["default"].put = function (metadata, options) {\n
return getDocumentAndHatoas.call(this, metadata, options).\n
then(function (result) {\n
/*jslint forin: true */\n
result = JSON.parse(result.target.responseText);\n
var put_action = result._embedded._view._actions.put,\n
renderer_form = result._embedded._view,\n
data = new FormData(),\n
key;\n
data.append(renderer_form.form_id.key,\n
renderer_form.form_id[\'default\']);\n
for (key in metadata) {\n
// console.log(key);\n
if (hasOwnProperty(metadata, key)) {\n
if (key !== "_id") {\n
// Hardcoded my_ ERP5 behaviour\n
data.append(key, metadata[key]);\n
// if (hasOwnProperty(renderer_form, "my_" + key)) {\n
// console.log("ok");\n
// data.append(renderer_form["my_" + key].key, metadata[key]);\n
// }\n
}\n
}\n
}\n
return jIO.util.ajax({\n
"type": put_action.method,\n
"url": put_action.href,\n
"data": data,\n
"xhrFields": {\n
withCredentials: true\n
}\n
});\n
});\n
};\n
\n
ERP5Storage.onView["default"].remove = function () {\n
return;\n
};\n
\n
ERP5Storage.onView["default"].allDocs = function (param, options) {\n
if (typeof options.query !== "string") {\n
options.query = (options.query ?\n
jIO.Query.objectToSearchText(options.query) :\n
undefined);\n
}\n
return getSiteDocument(this._url)\n
.then(function (site_hal) {\n
return jIO.util.ajax({\n
"type": "GET",\n
"url": UriTemplate.parse(site_hal._links.raw_search.href)\n
.expand({\n
query: options.query,\n
// XXX Force erp5 to return embedded document\n
select_list: options.select_list || ["title", "reference"],\n
limit: options.limit\n
}),\n
"xhrFields": {\n
withCredentials: true\n
}\n
});\n
})\n
.then(function (response) {\n
return JSON.parse(response.target.responseText);\n
})\n
.then(function (catalog_json) {\n
var data = catalog_json._embedded.contents,\n
count = data.length,\n
i,\n
uri,\n
item,\n
result = [],\n
promise_list = [result];\n
for (i = 0; i < count; i += 1) {\n
item = data[i];\n
uri = new URI(item._links.self.href);\n
result.push({\n
id: uri.segment(2),\n
key: uri.segment(2),\n
doc: {},\n
value: item\n
});\n
// if (options.include_docs) {\n
// promise_list.push(RSVP.Queue().push(function () {\n
// return this._get({_id: item.name}, {_view: "View"});\n
// }).push\n
// }\n
}\n
return RSVP.all(promise_list);\n
})\n
.then(function (promise_list) {\n
var result = promise_list[0];\n
return {"data": {"rows": result, "total_rows": result.length}};\n
});\n
};\n
\n
ERP5Storage.onView["default"].check = function () {\n
return;\n
};\n
\n
ERP5Storage.onView["default"].repair = function () {\n
return;\n
};\n
\n
jIO.addStorage("erp5", ERP5Storage);\n
\n
return ERP5Storage;\n
\n
}));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jio_storage_erp5.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.91</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.690.6828.44612</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1410861948.88</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405087399.46</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>uritemplate.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>http://git.erp5.org/gitweb/uritemplate-js.git/blob_plain/HEAD:/bin/uritemplate.js</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rjs_uritemplate_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*global unescape, module, define, window, global*/\n
\n
/*\n
UriTemplate Copyright (c) 2012-2013 Franz Antesberger. All Rights Reserved.\n
Available via the MIT license.\n
*/\n
\n
(function (exportCallback) {\n
"use strict";\n
\n
var UriTemplateError = (function () {\n
\n
function UriTemplateError (options) {\n
this.options = options;\n
}\n
\n
UriTemplateError.prototype.toString = function () {\n
if (JSON && JSON.stringify) {\n
return JSON.stringify(this.options);\n
}\n
else {\n
return this.options;\n
}\n
};\n
\n
return UriTemplateError;\n
}());\n
\n
var objectHelper = (function () {\n
function isArray (value) {\n
return Object.prototype.toString.apply(value) === \'[object Array]\';\n
}\n
\n
function isString (value) {\n
return Object.prototype.toString.apply(value) === \'[object String]\';\n
}\n
\n
function isNumber (value) {\n
return Object.prototype.toString.apply(value) === \'[object Number]\';\n
}\n
\n
function isBoolean (value) {\n
return Object.prototype.toString.apply(value) === \'[object Boolean]\';\n
}\n
\n
function join (arr, separator) {\n
var\n
result = \'\',\n
first = true,\n
index;\n
for (index = 0; index < arr.length; index += 1) {\n
if (first) {\n
first = false;\n
}\n
else {\n
result += separator;\n
}\n
result += arr[index];\n
}\n
return result;\n
}\n
\n
function map (arr, mapper) {\n
var\n
result = [],\n
index = 0;\n
for (; index < arr.length; index += 1) {\n
result.push(mapper(arr[index]));\n
}\n
return result;\n
}\n
\n
function filter (arr, predicate) {\n
var\n
result = [],\n
index = 0;\n
for (; index < arr.length; index += 1) {\n
if (predicate(arr[index])) {\n
result.push(arr[index]);\n
}\n
}\n
return result;\n
}\n
\n
function deepFreezeUsingObjectFreeze (object) {\n
if (typeof object !== "object" || object === null) {\n
return object;\n
}\n
Object.freeze(object);\n
var property, propertyName;\n
for (propertyName in object) {\n
if (object.hasOwnProperty(propertyName)) {\n
property = object[propertyName];\n
// be aware, arrays are \'object\', too\n
if (typeof property === "object") {\n
deepFreeze(property);\n
}\n
}\n
}\n
return object;\n
}\n
\n
function deepFreeze (object) {\n
if (typeof Object.freeze === \'function\') {\n
return deepFreezeUsingObjectFreeze(object);\n
}\n
return object;\n
}\n
\n
\n
return {\n
isArray: isArray,\n
isString: isString,\n
isNumber: isNumber,\n
isBoolean: isBoolean,\n
join: join,\n
map: map,\n
filter: filter,\n
deepFreeze: deepFreeze\n
};\n
}());\n
\n
var charHelper = (function () {\n
\n
function isAlpha (chr) {\n
return (chr >= \'a\' && chr <= \'z\') || ((chr >= \'A\' && chr <= \'Z\'));\n
}\n
\n
function isDigit (chr) {\n
return chr >= \'0\' && chr <= \'9\';\n
}\n
\n
function isHexDigit (chr) {\n
return isDigit(chr) || (chr >= \'a\' && chr <= \'f\') || (chr >= \'A\' && chr <= \'F\');\n
}\n
\n
return {\n
isAlpha: isAlpha,\n
isDigit: isDigit,\n
isHexDigit: isHexDigit\n
};\n
}());\n
\n
var pctEncoder = (function () {\n
var utf8 = {\n
encode: function (chr) {\n
// see http://ecmanaut.blogspot.de/2006/07/encoding-decoding-utf8-in-javascript.html\n
return unescape(encodeURIComponent(chr));\n
},\n
numBytes: function (firstCharCode) {\n
if (firstCharCode <= 0x7F) {\n
return 1;\n
}\n
else if (0xC2 <= firstCharCode && firstCharCode <= 0xDF) {\n
return 2;\n
}\n
else if (0xE0 <= firstCharCode && firstCharCode <= 0xEF) {\n
return 3;\n
}\n
else if (0xF0 <= firstCharCode && firstCharCode <= 0xF4) {\n
return 4;\n
}\n
// no valid first octet\n
return 0;\n
},\n
isValidFollowingCharCode: function (charCode) {\n
return 0x80 <= charCode && charCode <= 0xBF;\n
}\n
};\n
\n
/**\n
* encodes a character, if needed or not.\n
* @param chr\n
* @return pct-encoded character\n
*/\n
function encodeCharacter (chr) {\n
var\n
result = \'\',\n
octets = utf8.encode(chr),\n
octet,\n
index;\n
for (index = 0; index < octets.length; index += 1) {\n
octet = octets.charCodeAt(index);\n
result += \'%\' + (octet < 0x10 ? \'0\' : \'\') + octet.toString(16).toUpperCase();\n
}\n
return result;\n
}\n
\n
/**\n
* Returns, whether the given text at start is in the form \'percent hex-digit hex-digit\', like \'%3F\'\n
* @param text\n
* @param start\n
* @return {boolean|*|*}\n
*/\n
function isPercentDigitDigit (text, start) {\n
return text.charAt(start) === \'%\' && charHelper.isHexDigit(text.charAt(start + 1)) && charHelper.isHexDigit(text.charAt(start + 2));\n
}\n
\n
/**\n
* Parses a hex number from start with length 2.\n
* @param text a string\n
* @param start the start index of the 2-digit hex number\n
* @return {Number}\n
*/\n
function parseHex2 (text, start) {\n
return parseInt(text.substr(start, 2), 16);\n
}\n
\n
/**\n
* Returns whether or not the given char sequence is a correctly pct-encoded sequence.\n
* @param chr\n
* @return {boolean}\n
*/\n
function isPctEncoded (chr) {\n
if (!isPercentDigitDigit(chr, 0)) {\n
return false;\n
}\n
var firstCharCode = parseHex2(chr, 1);\n
var numBytes = utf8.numBytes(firstCharCode);\n
if (numBytes === 0) {\n
return false;\n
}\n
for (var byteNumber = 1; byteNumber < numBytes; byteNumber += 1) {\n
if (!isPercentDigitDigit(chr, 3*byteNumber) || !utf8.isValidFollowingCharCode(parseHex2(chr, 3*byteNumber + 1))) {\n
return false;\n
}\n
}\n
return true;\n
}\n
\n
/**\n
* Reads as much as needed from the text, e.g. \'%20\' or \'%C3%B6\'. It does not decode!\n
* @param text\n
* @param startIndex\n
* @return the character or pct-string of the text at startIndex\n
*/\n
function pctCharAt(text, startIndex) {\n
var chr = text.charAt(startIndex);\n
if (!isPercentDigitDigit(text, startIndex)) {\n
return chr;\n
}\n
var utf8CharCode = parseHex2(text, startIndex + 1);\n
var numBytes = utf8.numBytes(utf8CharCode);\n
if (numBytes === 0) {\n
return chr;\n
}\n
for (var byteNumber = 1; byteNumber < numBytes; byteNumber += 1) {\n
if (!isPercentDigitDigit(text, startIndex + 3 * byteNumber) || !utf8.isValidFollowingCharCode(parseHex2(text, startIndex + 3 * byteNumber + 1))) {\n
return chr;\n
}\n
}\n
return text.substr(startIndex, 3 * numBytes);\n
}\n
\n
return {\n
encodeCharacter: encodeCharacter,\n
isPctEncoded: isPctEncoded,\n
pctCharAt: pctCharAt\n
};\n
}());\n
\n
var rfcCharHelper = (function () {\n
\n
/**\n
* Returns if an character is an varchar character according 2.3 of rfc 6570\n
* @param chr\n
* @return (Boolean)\n
*/\n
function isVarchar (chr) {\n
return charHelper.isAlpha(chr) || charHelper.isDigit(chr) || chr === \'_\' || pctEncoder.isPctEncoded(chr);\n
}\n
\n
/**\n
* Returns if chr is an unreserved character according 1.5 of rfc 6570\n
* @param chr\n
* @return {Boolean}\n
*/\n
function isUnreserved (chr) {\n
return charHelper.isAlpha(chr) || charHelper.isDigit(chr) || chr === \'-\' || chr === \'.\' || chr === \'_\' || chr === \'~\';\n
}\n
\n
/**\n
* Returns if chr is an reserved character according 1.5 of rfc 6570\n
* or the percent character mentioned in 3.2.1.\n
* @param chr\n
* @return {Boolean}\n
*/\n
function isReserved (chr) {\n
return chr === \':\' || chr === \'/\' || chr === \'?\' || chr === \'#\' || chr === \'[\' || chr === \']\' || chr === \'@\' || chr === \'!\' || chr === \'$\' || chr === \'&\' || chr === \'(\' ||\n
chr === \')\' || chr === \'*\' || chr === \'+\' || chr === \',\' || chr === \';\' || chr === \'=\' || chr === "\'";\n
}\n
\n
return {\n
isVarchar: isVarchar,\n
isUnreserved: isUnreserved,\n
isReserved: isReserved\n
};\n
\n
}());\n
\n
/**\n
* encoding of rfc 6570\n
*/\n
var encodingHelper = (function () {\n
\n
function encode (text, passReserved) {\n
var\n
result = \'\',\n
index,\n
chr = \'\';\n
if (typeof text === "number" || typeof text === "boolean") {\n
text = text.toString();\n
}\n
for (index = 0; index < text.length; index += chr.length) {\n
chr = text.charAt(index);\n
result += rfcCharHelper.isUnreserved(chr) || (passReserved && rfcCharHelper.isReserved(chr)) ? chr : pctEncoder.encodeCharacter(chr);\n
}\n
return result;\n
}\n
\n
function encodePassReserved (text) {\n
return encode(text, true);\n
}\n
\n
function encodeLiteralCharacter (literal, index) {\n
var chr = pctEncoder.pctCharAt(literal, index);\n
if (chr.length > 1) {\n
return chr;\n
}\n
else {\n
return rfcCharHelper.isReserved(chr) || rfcCharHelper.isUnreserved(chr) ? chr : pctEncoder.encodeCharacter(chr);\n
}\n
}\n
\n
function encodeLiteral (literal) {\n
var\n
result = \'\',\n
index,\n
chr = \'\';\n
for (index = 0; index < literal.length; index += chr.length) {\n
chr = pctEncoder.pctCharAt(literal, index);\n
if (chr.length > 1) {\n
result += chr;\n
}\n
else {\n
result += rfcCharHelper.isReserved(chr) || rfcCharHelper.isUnreserved(chr) ? chr : pctEncoder.encodeCharacter(chr);\n
}\n
}\n
return result;\n
}\n
\n
return {\n
encode: encode,\n
encodePassReserved: encodePassReserved,\n
encodeLiteral: encodeLiteral,\n
encodeLiteralCharacter: encodeLiteralCharacter\n
};\n
\n
}());\n
\n
\n
// the operators defined by rfc 6570\n
var operators = (function () {\n
\n
var\n
bySymbol = {};\n
\n
function create (symbol) {\n
bySymbol[symbol] = {\n
symbol: symbol,\n
separator: (symbol === \'?\') ? \'&\' : (symbol === \'\' || symbol === \'+\' || symbol === \'#\') ? \',\' : symbol,\n
named: symbol === \';\' || symbol === \'&\' || symbol === \'?\',\n
ifEmpty: (symbol === \'&\' || symbol === \'?\') ? \'=\' : \'\',\n
first: (symbol === \'+\' ) ? \'\' : symbol,\n
encode: (symbol === \'+\' || symbol === \'#\') ? encodingHelper.encodePassReserved : encodingHelper.encode,\n
toString: function () {\n
return this.symbol;\n
}\n
};\n
}\n
\n
create(\'\');\n
create(\'+\');\n
create(\'#\');\n
create(\'.\');\n
create(\'/\');\n
create(\';\');\n
create(\'?\');\n
create(\'&\');\n
return {\n
valueOf: function (chr) {\n
if (bySymbol[chr]) {\n
return bySymbol[chr];\n
}\n
if ("=,!@|".indexOf(chr) >= 0) {\n
return null;\n
}\n
return bySymbol[\'\'];\n
}\n
};\n
}());\n
\n
\n
/**\n
* Detects, whether a given element is defined in the sense of rfc 6570\n
* Section 2.3 of the RFC makes clear defintions:\n
* * undefined and null are not defined.\n
* * the empty string is defined\n
* * an array ("list") is defined, if it is not empty (even if all elements are not defined)\n
* * an object ("map") is defined, if it contains at least one property with defined value\n
* @param object\n
* @return {Boolean}\n
*/\n
function isDefined (object) {\n
var\n
propertyName;\n
if (object === null || object === undefined) {\n
return false;\n
}\n
if (objectHelper.isArray(object)) {\n
// Section 2.3: A variable defined as a list value is considered undefined if the list contains zero members\n
return object.length > 0;\n
}\n
if (typeof object === "string" || typeof object === "number" || typeof object === "boolean") {\n
// falsy values like empty strings, false or 0 are "defined"\n
return true;\n
}\n
// else Object\n
for (propertyName in object) {\n
if (object.hasOwnProperty(propertyName) && isDefined(object[propertyName])) {\n
return true;\n
}\n
}\n
return false;\n
}\n
\n
var LiteralExpression = (function () {\n
function LiteralExpression (literal) {\n
this.literal = encodingHelper.encodeLiteral(literal);\n
}\n
\n
LiteralExpression.prototype.expand = function () {\n
return this.literal;\n
};\n
\n
LiteralExpression.prototype.toString = LiteralExpression.prototype.expand;\n
\n
return LiteralExpression;\n
}());\n
\n
var parse = (function () {\n
\n
function parseExpression (expressionText) {\n
var\n
operator,\n
varspecs = [],\n
varspec = null,\n
varnameStart = null,\n
maxLengthStart = null,\n
index,\n
chr = \'\';\n
\n
function closeVarname () {\n
var varname = expressionText.substring(varnameStart, index);\n
if (varname.length === 0) {\n
throw new UriTemplateError({expressionText: expressionText, message: "a varname must be specified", position: index});\n
}\n
varspec = {varname: varname, exploded: false, maxLength: null};\n
varnameStart = null;\n
}\n
\n
function closeMaxLength () {\n
if (maxLengthStart === index) {\n
throw new UriTemplateError({expressionText: expressionText, message: "after a \':\' you have to specify the length", position: index});\n
}\n
varspec.maxLength = parseInt(expressionText.substring(maxLengthStart, index), 10);\n
maxLengthStart = null;\n
}\n
\n
operator = (function (operatorText) {\n
var op = operators.valueOf(operatorText);\n
if (op === null) {\n
throw new UriTemplateError({expressionText: expressionText, message: "illegal use of reserved operator", position: index, operator: operatorText});\n
}\n
return op;\n
}(expressionText.charAt(0)));\n
index = operator.symbol.length;\n
\n
varnameStart = index;\n
\n
for (; index < expressionText.length; index += chr.length) {\n
chr = pctEncoder.pctCharAt(expressionText, index);\n
\n
if (varnameStart !== null) {\n
// the spec says: varname = varchar *( ["."] varchar )\n
// so a dot is allowed except for the first char\n
if (chr === \'.\') {\n
if (varnameStart === index) {\n
throw new UriTemplateError({expressionText: expressionText, message: "a varname MUST NOT start with a dot", position: index});\n
}\n
continue;\n
}\n
if (rfcCharHelper.isVarchar(chr)) {\n
continue;\n
}\n
closeVarname();\n
}\n
if (maxLengthStart !== null) {\n
if (index === maxLengthStart && chr === \'0\') {\n
throw new UriTemplateError({expressionText: expressionText, message: "A :prefix must not start with digit 0", position: index});\n
}\n
if (charHelper.isDigit(chr)) {\n
if (index - maxLengthStart >= 4) {\n
throw new UriTemplateError({expressionText: expressionText, message: "A :prefix must have max 4 digits", position: index});\n
}\n
continue;\n
}\n
closeMaxLength();\n
}\n
if (chr === \':\') {\n
if (varspec.maxLength !== null) {\n
throw new UriTemplateError({expressionText: expressionText, message: "only one :maxLength is allowed per varspec", position: index});\n
}\n
if (varspec.exploded) {\n
throw new UriTemplateError({expressionText: expressionText, message: "an exploeded varspec MUST NOT be varspeced", position: index});\n
}\n
maxLengthStart = index + 1;\n
continue;\n
}\n
if (chr === \'*\') {\n
if (varspec === null) {\n
throw new UriTemplateError({expressionText: expressionText, message: "exploded without varspec", position: index});\n
}\n
if (varspec.exploded) {\n
throw new UriTemplateError({expressionText: expressionText, message: "exploded twice", position: index});\n
}\n
if (varspec.maxLength) {\n
throw new UriTemplateError({expressionText: expressionText, message: "an explode (*) MUST NOT follow to a prefix", position: index});\n
}\n
varspec.exploded = true;\n
continue;\n
}\n
// the only legal character now is the comma\n
if (chr === \',\') {\n
varspecs.push(varspec);\n
varspec = null;\n
varnameStart = index + 1;\n
continue;\n
}\n
throw new UriTemplateError({expressionText: expressionText, message: "illegal character", character: chr, position: index});\n
} // for chr\n
if (varnameStart !== null) {\n
closeVarname();\n
}\n
if (maxLengthStart !== null) {\n
closeMaxLength();\n
}\n
varspecs.push(varspec);\n
return new VariableExpression(expressionText, operator, varspecs);\n
}\n
\n
function escape_regexp_string(string) {\n
// http://simonwillison.net/2006/Jan/20/escape/\n
return string.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, "\\\\$&");\n
}\n
\n
function parse (uriTemplateText) {\n
// assert filled string\n
var\n
index,\n
chr,\n
expressions = [],\n
expression,\n
braceOpenIndex = null,\n
regexp_string = \'\',\n
can_match = true,\n
literalStart = 0;\n
for (index = 0; index < uriTemplateText.length; index += 1) {\n
chr = uriTemplateText.charAt(index);\n
if (literalStart !== null) {\n
if (chr === \'}\') {\n
throw new UriTemplateError({templateText: uriTemplateText, message: "unopened brace closed", position: index});\n
}\n
if (chr === \'{\') {\n
if (literalStart < index) {\n
expression = new LiteralExpression(uriTemplateText.substring(literalStart, index));\n
expressions.push(expression);\n
regexp_string += escape_regexp_string(\n
expression.literal);\n
}\n
literalStart = null;\n
braceOpenIndex = index;\n
}\n
continue;\n
}\n
\n
if (braceOpenIndex !== null) {\n
// here just { is forbidden\n
if (chr === \'{\') {\n
throw new UriTemplateError({templateText: uriTemplateText, message: "brace already opened", position: index});\n
}\n
if (chr === \'}\') {\n
if (braceOpenIndex + 1 === index) {\n
throw new UriTemplateError({templateText: uriTemplateText, message: "empty braces", position: braceOpenIndex});\n
}\n
try {\n
expression = parseExpression(uriTemplateText.substring(braceOpenIndex + 1, index));\n
}\n
catch (error) {\n
if (error.prototype === UriTemplateError.prototype) {\n
throw new UriTemplateError({templateText: uriTemplateText, message: error.options.message, position: braceOpenIndex + error.options.position, details: error.options});\n
}\n
throw error;\n
}\n
expressions.push(expression);\n
if (expression.operator.symbol.length === 0) {\n
regexp_string += "([^/]+)";\n
} else {\n
can_match = false;\n
}\n
braceOpenIndex = null;\n
literalStart = index + 1;\n
}\n
continue;\n
}\n
throw new Error(\'reached unreachable code\');\n
}\n
if (braceOpenIndex !== null) {\n
throw new UriTemplateError({templateText: uriTemplateText, message: "unclosed brace", position: braceOpenIndex});\n
}\n
if (literalStart < uriTemplateText.length) {\n
expression = new LiteralExpression(uriTemplateText.substring(literalStart));\n
expressions.push(expression);\n
regexp_string += escape_regexp_string(expression.literal);\n
}\n
if (can_match === false) {\n
regexp_string = undefined;\n
}\n
return new UriTemplate(uriTemplateText, expressions, regexp_string);\n
}\n
\n
return parse;\n
}());\n
\n
var VariableExpression = (function () {\n
// helper function if JSON is not available\n
function prettyPrint (value) {\n
return (JSON && JSON.stringify) ? JSON.stringify(value) : value;\n
}\n
\n
function isEmpty (value) {\n
if (!isDefined(value)) {\n
return true;\n
}\n
if (objectHelper.isString(value)) {\n
return value === \'\';\n
}\n
if (objectHelper.isNumber(value) || objectHelper.isBoolean(value)) {\n
return false;\n
}\n
if (objectHelper.isArray(value)) {\n
return value.length === 0;\n
}\n
for (var propertyName in value) {\n
if (value.hasOwnProperty(propertyName)) {\n
return false;\n
}\n
}\n
return true;\n
}\n
\n
function propertyArray (object) {\n
var\n
result = [],\n
propertyName;\n
for (propertyName in object) {\n
if (object.hasOwnProperty(propertyName)) {\n
result.push({name: propertyName, value: object[propertyName]});\n
}\n
}\n
return result;\n
}\n
\n
function VariableExpression (templateText, operator, varspecs) {\n
this.templateText = templateText;\n
this.operator = operator;\n
this.varspecs = varspecs;\n
}\n
\n
VariableExpression.prototype.toString = function () {\n
return this.templateText;\n
};\n
\n
function expandSimpleValue(varspec, operator, value) {\n
var result = \'\';\n
value = value.toString();\n
if (operator.named) {\n
result += encodingHelper.encodeLiteral(varspec.varname);\n
if (value === \'\') {\n
result += operator.ifEmpty;\n
return result;\n
}\n
result += \'=\';\n
}\n
if (varspec.maxLength !== null) {\n
value = value.substr(0, varspec.maxLength);\n
}\n
result += operator.encode(value);\n
return result;\n
}\n
\n
function valueDefined (nameValue) {\n
return isDefined(nameValue.value);\n
}\n
\n
function expandNotExploded(varspec, operator, value) {\n
var\n
arr = [],\n
result = \'\';\n
if (operator.named) {\n
result += encodingHelper.encodeLiteral(varspec.varname);\n
if (isEmpty(value)) {\n
result += operator.ifEmpty;\n
return result;\n
}\n
result += \'=\';\n
}\n
if (objectHelper.isArray(value)) {\n
arr = value;\n
arr = objectHelper.filter(arr, isDefined);\n
arr = objectHelper.map(arr, operator.encode);\n
result += objectHelper.join(arr, \',\');\n
}\n
else {\n
arr = propertyArray(value);\n
arr = objectHelper.filter(arr, valueDefined);\n
arr = objectHelper.map(arr, function (nameValue) {\n
return operator.encode(nameValue.name) + \',\' + operator.encode(nameValue.value);\n
});\n
result += objectHelper.join(arr, \',\');\n
}\n
return result;\n
}\n
\n
function expandExplodedNamed (varspec, operator, value) {\n
var\n
isArray = objectHelper.isArray(value),\n
arr = [];\n
if (isArray) {\n
arr = value;\n
arr = objectHelper.filter(arr, isDefined);\n
arr = objectHelper.map(arr, function (listElement) {\n
var tmp = encodingHelper.encodeLiteral(varspec.varname);\n
if (isEmpty(listElement)) {\n
tmp += operator.ifEmpty;\n
}\n
else {\n
tmp += \'=\' + operator.encode(listElement);\n
}\n
return tmp;\n
});\n
}\n
else {\n
arr = propertyArray(value);\n
arr = objectHelper.filter(arr, valueDefined);\n
arr = objectHelper.map(arr, function (nameValue) {\n
var tmp = encodingHelper.encodeLiteral(nameValue.name);\n
if (isEmpty(nameValue.value)) {\n
tmp += operator.ifEmpty;\n
}\n
else {\n
tmp += \'=\' + operator.encode(nameValue.value);\n
}\n
return tmp;\n
});\n
}\n
return objectHelper.join(arr, operator.separator);\n
}\n
\n
function expandExplodedUnnamed (operator, value) {\n
var\n
arr = [],\n
result = \'\';\n
if (objectHelper.isArray(value)) {\n
arr = value;\n
arr = objectHelper.filter(arr, isDefined);\n
arr = objectHelper.map(arr, operator.encode);\n
result += objectHelper.join(arr, operator.separator);\n
}\n
else {\n
arr = propertyArray(value);\n
arr = objectHelper.filter(arr, function (nameValue) {\n
return isDefined(nameValue.value);\n
});\n
arr = objectHelper.map(arr, function (nameValue) {\n
return operator.encode(nameValue.name) + \'=\' + operator.encode(nameValue.value);\n
});\n
result += objectHelper.join(arr, operator.separator);\n
}\n
return result;\n
}\n
\n
\n
VariableExpression.prototype.expand = function (variables) {\n
var\n
expanded = [],\n
index,\n
varspec,\n
value,\n
valueIsArr,\n
oneExploded = false,\n
operator = this.operator;\n
\n
// expand each varspec and join with operator\'s separator\n
for (index = 0; index < this.varspecs.length; index += 1) {\n
varspec = this.varspecs[index];\n
value = variables[varspec.varname];\n
// if (!isDefined(value)) {\n
// if (variables.hasOwnProperty(varspec.name)) {\n
if (value === null || value === undefined) {\n
continue;\n
}\n
if (varspec.exploded) {\n
oneExploded = true;\n
}\n
valueIsArr = objectHelper.isArray(value);\n
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {\n
expanded.push(expandSimpleValue(varspec, operator, value));\n
}\n
else if (varspec.maxLength && isDefined(value)) {\n
// 2.4.1 of the spec says: "Prefix modifiers are not applicable to variables that have composite values."\n
throw new Error(\'Prefix modifiers are not applicable to variables that have composite values. You tried to expand \' + this + " with " + prettyPrint(value));\n
}\n
else if (!varspec.exploded) {\n
if (operator.named || !isEmpty(value)) {\n
expanded.push(expandNotExploded(varspec, operator, value));\n
}\n
}\n
else if (isDefined(value)) {\n
if (operator.named) {\n
expanded.push(expandExplodedNamed(varspec, operator, value));\n
}\n
else {\n
expanded.push(expandExplodedUnnamed(operator, value));\n
}\n
}\n
}\n
\n
if (expanded.length === 0) {\n
return "";\n
}\n
else {\n
return operator.first + objectHelper.join(expanded, operator.separator);\n
}\n
};\n
\n
return VariableExpression;\n
}());\n
\n
var UriTemplate = (function () {\n
function UriTemplate (templateText, expressions, regexp_string) {\n
this.templateText = templateText;\n
this.expressions = expressions;\n
\n
if (regexp_string !== undefined) {\n
this.regexp = new RegExp("^" + regexp_string + "$");\n
}\n
\n
objectHelper.deepFreeze(this);\n
}\n
\n
UriTemplate.prototype.toString = function () {\n
return this.templateText;\n
};\n
\n
UriTemplate.prototype.expand = function (variables) {\n
// this.expressions.map(function (expression) {return expression.expand(variables);}).join(\'\');\n
var\n
index,\n
result = \'\';\n
for (index = 0; index < this.expressions.length; index += 1) {\n
result += this.expressions[index].expand(variables);\n
}\n
return result;\n
};\n
\n
UriTemplate.prototype.extract = function (text) {\n
var expression_index,\n
extracted_index = 1,\n
expression,\n
varspec,\n
matched = true,\n
variables = {},\n
result;\n
\n
if ((this.regexp !== undefined) && (this.regexp.test(text))) {\n
result = this.regexp.exec(text);\n
for (expression_index = 0; expression_index < this.expressions.length; expression_index += 1) {\n
expression = this.expressions[expression_index];\n
if (expression.literal === undefined) {\n
if ((expression.operator !== undefined) && (expression.operator.symbol.length === 0) && (expression.varspecs.length === 1)) {\n
varspec = expression.varspecs[0];\n
if ((varspec.exploded === false) && (varspec.maxLength === null)) {\n
if (result[extracted_index].indexOf(\',\') === -1) {\n
variables[varspec.varname] = decodeURIComponent(result[extracted_index]);\n
extracted_index += 1;\n
} else {\n
matched = false;\n
}\n
} else {\n
matched = false;\n
}\n
} else {\n
matched = false;\n
}\n
}\n
}\n
if (matched) {\n
return variables;\n
}\n
}\n
return false;\n
};\n
\n
UriTemplate.parse = parse;\n
UriTemplate.UriTemplateError = UriTemplateError;\n
return UriTemplate;\n
}());\n
\n
exportCallback(UriTemplate);\n
\n
}(function (UriTemplate) {\n
"use strict";\n
// export UriTemplate, when module is present, or pass it to window or global\n
if (typeof module !== "undefined") {\n
module.exports = UriTemplate;\n
}\n
else if (typeof define === "function") {\n
define([],function() {\n
return UriTemplate;\n
});\n
}\n
else if (typeof window !== "undefined") {\n
window.UriTemplate = UriTemplate;\n
}\n
else {\n
global.UriTemplate = UriTemplate;\n
}\n
}\n
));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>uritemplate.js</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>1.12.0</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1406898405.71</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>936.8894.19002.47138</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405933454.85</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1405086573.26</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -114,6 +114,33 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>default_view_action_reference</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>view_action_category</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
......@@ -132,6 +159,10 @@
<key> <string>custom_render_method_id</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value>
</item>
<item>
<key> <string>default_view_action_reference</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
......@@ -146,6 +177,10 @@
<key> <string>id</string> </key>
<value> <string>hateoas</string> </value>
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Section</string> </value>
......@@ -164,6 +199,10 @@
<key> <string>title</string> </key>
<value> <string>Restricted Hateoas</string> </value>
</item>
<item>
<key> <string>view_action_category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_default_view_action_reference</string>
<string>my_view_action_category</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web Section Preference</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_view_action_reference</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_reference</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Default View Action Reference</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_view_action_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_reference</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View Action Category</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment