//>>built
define("dojox/atom/io/Connection",["dojo/_base/declare","dojo/_base/kernel","dojo/_base/xhr","./model"],function(o,l,k,i){return o("dojox.atom.io.Connection",null,{constructor:function(a,b){this.sync=a;this.preventCache=b},preventCache:!1,alertsEnabled:!1,getFeed:function(a,b,e,f){this._getXmlDoc(a,"feed",new i.Feed,i._Constants.ATOM_NS,b,e,f)},getService:function(a,b,e,f){this._getXmlDoc(a,"service",new i.Service(a),i._Constants.APP_NS,b,e,f)},getEntry:function(a,b,e,f){this._getXmlDoc(a,"entry",
new i.Entry,i._Constants.ATOM_NS,b,e,f)},_getXmlDoc:function(a,b,e,f,c,d,h){if(!h)h=l.global;var n=this.alertsEnabled,a={url:a,handleAs:"xml",sync:this.sync,preventCache:this.preventCache,load:function(a,g){var d=null,j;if(a){if("undefined"!=typeof a.getElementsByTagNameNS)if((j=a.getElementsByTagNameNS(f,b))&&0<j.length)d=j.item(0);else{if(a.lastChild)d=a.lastChild}else if("undefined"!=typeof a.getElementsByTagName)if((j=a.getElementsByTagName(b))&&0<j.length)for(var m=0;m<j.length;m++){if(j[m].namespaceURI==
f){d=j[m];break}}else{if(a.lastChild)d=a.lastChild}else if(a.lastChild)d=a.lastChild;else{c.call(h,null,null,g);return}e.buildFromDom(d);if(c)c.call(h,e,a,g);else if(n)throw Error("The callback value does not exist.");}else c.call(h,null,null,g)}};if(this.user&&null!==this.user)a.user=this.user;if(this.password&&null!==this.password)a.password=this.password;a.error=d?function(a,b){d.call(h,a,b)}:function(){throw Error("The URL requested cannot be accessed");};k.get(a)},updateEntry:function(a,b,e,
f,c,d){if(!d)d=l.global;a.updated=new Date;var h=a.getEditHref();if(!h)throw Error("A URL has not been specified for editing this entry.");var n=this,i=this.alertsEnabled,g={url:h,handleAs:"text",contentType:"text/xml",sync:this.sync,preventCache:this.preventCache,load:function(c,e){var g=null;if(f)(g=e.xhr.getResponseHeader("Location"))||(g=h),n.getEntry(g,function(a,e,c){if(b)b.call(d,a,g,c);else if(i)throw Error("The callback value does not exist.");});else if(b)b.call(d,a,e.xhr.getResponseHeader("Location"),
e);else if(i)throw Error("The callback value does not exist.");return c}};if(this.user&&null!==this.user)g.user=this.user;if(this.password&&null!==this.password)g.password=this.password;g.error=e?function(a,b){e.call(d,a,b)}:function(){throw Error("The URL requested cannot be accessed");};c?(g.postData=a.toString(!0),g.headers={"X-Method-Override":"PUT"},k.post(g)):(g.putData=a.toString(!0),k.put(g))},addEntry:function(a,b,e,f,c,d){if(!d)d=l.global;a.published=new Date;a.updated=new Date;var c=a.feedUrl,
h=this.alertsEnabled;!b&&c&&(b=c);if(b){var i=this,c={url:b,handleAs:"text",contentType:"text/xml",sync:this.sync,preventCache:this.preventCache,postData:a.toString(!0),load:function(c,g){var f=g.xhr.getResponseHeader("Location");f||(f=b);if(g.retrieveEntry)i.getEntry(f,function(a,b,c){if(e)e.call(d,a,f,c);else if(h)throw Error("The callback value does not exist.");});else if(e)e.call(d,a,f,g);else if(h)throw Error("The callback value does not exist.");return c}};if(this.user&&null!==this.user)c.user=
this.user;if(this.password&&null!==this.password)c.password=this.password;c.error=f?function(a,b){f.call(d,a,b)}:function(){throw Error("The URL requested cannot be accessed");};k.post(c)}else if(h)throw Error("The request cannot be processed because the URL parameter is missing.");},deleteEntry:function(a,b,e,f,c){if(!c)c=l.global;var d=null,d="string"==typeof a?a:a.getEditHref();if(!d)throw b.call(c,!1,null),Error("The request cannot be processed because the URL parameter is missing.");a={url:d,
handleAs:"text",sync:this.sync,preventCache:this.preventCache,load:function(a,d){b.call(c,d);return a}};if(this.user&&null!==this.user)a.user=this.user;if(this.password&&null!==this.password)a.password=this.password;a.error=e?function(a,b){e.call(c,a,b)}:function(){throw Error("The URL requested cannot be accessed");};f?(a.headers={"X-Method-Override":"DELETE"},dhxr.post(a)):k.del(a)}})});