Commit 64c7226d authored by François Billioud's avatar François Billioud

Merge branch 'master' of https://git.erp5.org/repos/ung

Conflicts:
	UNGProject/js/tools.js
	UNGProject/theme.html
parents cf0bbd3c a3308dcc
...@@ -42,38 +42,16 @@ currentTime = function() {return (new Date()).toUTCString();} ...@@ -42,38 +42,16 @@ currentTime = function() {return (new Date()).toUTCString();}
// save // save
saveXHR = function(address) { saveXHR = function(address) {
//create request $.ajax({
var xhr=null; url: address,
try type: "PUT",
{ username: "smik",
xhr = new XMLHttpRequest(); password: "asdf",
} catch(e) data: JSON.stringify(getCurrentDocument()),
{ success: function(){alert("saved");},
try {xhr = new ActiveXObject("Msxml2.XMLHTTP");} error: function(xhr) { alert("error while saving");}
catch (e2) });
{ };
try {xhr = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e) {alert("Please install a more recent browser")}
}
}
//xhr.open("PUT", keyToUrl(key, wallet), true, wallet.userAddress, wallet.davToken);
//HACK:
xhr.open("PUT", address, true);
xhr.setRequestHeader("Authorization", "Basic "+"nom:test");
//END HACK.
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if(xhr.status != 200 && xhr.status != 201 && xhr.status != 204) {
alert("error: got status "+xhr.status+" when doing basic auth PUT on url "+Base64.encode("nom:test")+" " + xhr.statusText);
}
}
}
xhr.withCredentials = "true";
xhr.send(JSON.stringify(getCurrentDocument()));
}
// load // load
loadXHR = function(address) { loadXHR = function(address) {
$.ajax({ $.ajax({
...@@ -83,6 +61,8 @@ loadXHR = function(address) { ...@@ -83,6 +61,8 @@ loadXHR = function(address) {
cache:false, cache:false,
username: "nom", username: "nom",
password: "test", password: "test",
/* username: "smik", No need to specify credential while GETTING
password: "asdf",*/
success: function(data){ success: function(data){
var cDoc = getCurrentDocument(); var cDoc = getCurrentDocument();
cDoc.load(data); cDoc.load(data);
...@@ -117,4 +97,4 @@ tryUntilSucceed = function(func) { ...@@ -117,4 +97,4 @@ tryUntilSucceed = function(func) {
nb*=nb; nb*=nb;
} }
execute(); execute();
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<script type="text/javascript"> <script type="text/javascript">
// initialize // initialize
addressOfTestDocument = "http://sidunhosted.com/ungdav/test.json";
var initPage = function() { var initPage = function() {
var pageIWantToTest = "illustration"; var pageIWantToTest = "illustration";
addressOfTestDocument = "dav/temp2.json"; addressOfTestDocument = "dav/temp2.json";
......
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