Commit 50570e4e authored by preetwinder's avatar preetwinder

[erp5_officejs] Fix sync, header in login and list results.

parent b71b2085
......@@ -85,9 +85,11 @@
FBStorage.prototype.buildQuery = function (query) {
console.log('QueryRecieved', query);
var that = this, template_argument = {user_id: this._user_id, limit: 100,
access_token: this._access_token}, fields = [],
limit = this._default_limit;
var that = this, fields = [], limit = this._default_limit,
template_argument = {
user_id: this._user_id,
limit: limit,
access_token: this._access_token};
if (query.include_docs) {
fields = fields.concat(that._default_field_list);
}
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.16463.42275.10052</string> </value>
<value> <string>961.20894.37088.58897</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1502116781.14</float>
<float>1502382636.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -18,7 +18,7 @@
<body>
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">&nbsp;
<span id="status" class="ui-icon ui-icon-custom ui-icon-file-text-o">Please Log into the app</span>
<span id="status" class="ui-icon ui-icon-custom ui-icon-file-text-o"> Please Log into the app</span>
</h3>
</section>
<section class="ui-body-c ui-content-section">
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.16470.22894.2645</string> </value>
<value> <string>961.20845.44804.55534</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1502117181.46</float>
<float>1502379704.19</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -79,20 +79,16 @@ gadget_klass
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod("render", function (options) {
var gadget = this;
return gadget.updateHeader({
title: "Connect To Facebook Storage",
back_url: "#page=document_list",
panel_action: false
})
var gadget = this;
return gadget.updateHeader({page_title: "Facebook Login"})
})
.declareService(function () {
var gadget = this;
FB.init({
appId : '1917551475189095',
cookie : true,
xfbml : true,
version : 'v2.8'
cookie : true,
xfbml : true,
version : 'v2.8'
});
FB.getLoginStatus(function(response) {
if (response.status == 'connected') {
......@@ -117,7 +113,7 @@ gadget_klass
}
}
})
.onEvent("click", function (event) {
var gadget = this;
if (event.target.id == 'login') {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.16472.57754.53162</string> </value>
<value> <string>961.20848.25415.9847</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1502117334.01</float>
<float>1502381591.58</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -20,13 +20,16 @@
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
console.log(param_list);
param_list[0].select_list.push('story');
param_list[0].select_list.push('link');
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, date, len = result.data.total_rows;
var i, date, message, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty("modification_date")) {
date = new Date(result.data.rows[i].value.modification_date);
result.data.rows[i].value.modification_date = {
if (result.data.rows[i].value.hasOwnProperty("created_time")) {
date = new Date(result.data.rows[i].value.created_time);
result.data.rows[i].value.created_time = {
allow_empty_time: 0,
ampm_time_style: 0,
css_class: "date_field",
......@@ -36,10 +39,10 @@
hidden: 0,
hidden_day_is_last_day: 0,
default: date.toUTCString(),
key: "modification_date",
key: "created_time",
required: 0,
timezone_style: 0,
title: "Modification Date",
title: "Creation Time",
type: "DateTimeField"
};
result.data.rows[i].value["listbox_uid:list"] = {
......@@ -47,6 +50,22 @@
value: 2713
};
}
if (!result.data.rows[i].value.message) {
message = '';
}
else {
message = result.data.rows[i].value.message;
}
if (result.data.rows[i].value.story) {
message += ' ' + result.data.rows[i].value.story;
}
var link = result.data.rows[i].value.link;
if (link) {
if (!(message == link.slice(0, -1) || message == link)) {
message += ' ' + result.data.rows[i].value.link.slice(0, 100) + '...';
}
}
result.data.rows[i].value.message = message;
}
return result;
});
......
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.16167.19263.24251</string> </value>
<value> <string>961.20726.1023.7560</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1502202691.66</float>
<float>1502372527.27</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -342,7 +342,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.17876.53189.13602</string> </value>
<value> <string>961.20841.15763.31249</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -360,7 +360,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502286664.9</float>
<float>1502440236.9</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,43 +11,8 @@
}
return storage[method_name].apply(storage, argument_list)
.push(undefined, function (error) {
if ((error.target !== undefined) && (error.target.status === 401)) {
var regexp,
site,
login_page;
if (gadget.state_parameter_dict.jio_storage_name === "ERP5") {
regexp = /^X-Delegate uri=\"(http[s]?:\/\/[\/\-\[\]{}()*+=:?&.,\\\^$|#\s\w%]+)\"$/;
login_page = error.target.getResponseHeader('WWW-Authenticate');
if (regexp.test(login_page)) {
return gadget.getUrlFor({
command: 'login',
absolute_url: true
})
.push(function (came_from) {
return gadget.redirect({
command: 'raw',
options: {
url: UriTemplate.parse(regexp.exec(login_page)[1]).expand({came_from: came_from})
}
});
});
}
}
if (gadget.state_parameter_dict.jio_storage_name === "DAV") {
regexp = /^Nayookie login_url=(http[s]?:\/\/[\/\-\[\]{}()*+=:?&.,\\\^$|#\s\w%]+)$/;
login_page = error.target.getResponseHeader('WWW-Authenticate');
if (regexp.test(login_page)) {
site = UriTemplate.parse(
regexp.exec(login_page)[1]
).expand({
back_url: window.location.href,
origin: window.location.origin
});
}
}
if (site) {
return gadget.redirect({ command: "row", url: site});
}
if (error.status_code === 400) {
return gadget.redirect({command: "display", options: {page: 'ojs_facebook_configurator'}});
}
throw error;
});
......
......@@ -233,7 +233,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.19289.52390.7048</string> </value>
<value> <string>961.20900.38898.22289</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -251,7 +251,7 @@
</tuple>
<state>
<tuple>
<float>1502286412.26</float>
<float>1502382996.38</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -320,7 +320,7 @@
})
.push(function (data) {
var options = {
page: "ojs_document_list"
page: "ojs_fb_posts_document_list"
};
if (data.search) {
options.extended_search = data.search;
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.16408.6890.18005</string> </value>
<value> <string>961.19389.35931.31061</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1502113976.19</float>
<float>1502292333.77</float>
<string>UTC</string>
</tuple>
</state>
......
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