Commit cc1c64af authored by Xiaowu Zhang's avatar Xiaowu Zhang

fix uri unknown bug

parent 15efd68b
......@@ -12,6 +12,7 @@
.declareMethod('createJio', function (jio_options) {
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);
this.save = {};
})
.declareMethod('allDocs', function (options) {
var storage = this.state_parameter_dict.jio_storage,
......@@ -35,7 +36,8 @@
if (result.data !== undefined) {
length = result.data.rows.length;
for (i = 0; i < length; i += 1) {
if (result.data.rows[i].id === encodeURI(param._id)) { //xxx
if ((result.data.rows[i].id === encodeURI(param._id))
|| (result.data.rows[i].id === param._id)) {
return ({"data": {"title" : result.data.rows[i].doc.title}});
}
}
......
......@@ -158,6 +158,7 @@
gk.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_remove", "jio_remove")
.declareAcquiredMethod("plSave", "plSave")
.declareAcquiredMethod("plGive", "plGive")
.declareAcquiredMethod("displayThisPage", "displayThisPage")
......@@ -216,8 +217,14 @@
g.url = URL.createObjectURL(blob);
})
.push(undefined, function (error) {
if (!(error instanceof RSVP.CancellationError)) {
window.location = g.__element
.getElementsByClassName("next")[0].href;
if ((error.status === "404")
&& (error.method === "getAttachment")) {
return g.jio_remove({"_id" : error.id});
}
}
});
}
})
......
......@@ -10,6 +10,8 @@
.getElementById('rows-template').innerHTML,
rows_template = Handlebars.compile(rows_template_source);
gk.declareAcquiredMethod("allDocs", "allDocs")
.declareAcquiredMethod("plSave", "plSave")
.declareAcquiredMethod("plGive", "plGive")
.declareAcquiredMethod("jio_remove", "jio_remove")
.declareAcquiredMethod("displayThisPage", "displayThisPage")
.declareAcquiredMethod("displayThisTitle", "displayThisTitle")
......@@ -42,7 +44,14 @@
.href = param_list[2];
})
.push(function () {
return gadget.plGive("ip");
})
.push(function (value) {
var id = options.id;
if (value !== undefined) {
gadget.__element.getElementsByClassName('inputIp')[0]
.value = value;
}
if (options.action === "delete") {
delete options.id;
return gadget.jio_remove({"_id" : id});
......@@ -75,9 +84,9 @@
$(list).listview("refresh");
})
.fail(function (error) {
if ((error instanceof RSVP.CancellationError)) {
if (!(error instanceof RSVP.CancellationError)) {
document.getElementsByTagName('body')[0].textContent =
JSON.stringify(error);
"network ip not correct";
}
});
})
......@@ -105,8 +114,14 @@
});
}),
loopEventListener(ip, "change", false, function () {
return new RSVP.Queue()
.push(function () {
return g.plCreateHttpStorage(ip.value);
})
.push(function () {
return g.plSave({"ip": ip.value});
});
})
]);//any
});//rsvp
});//startService
......
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