Commit 43b77fd3 authored by preetwinder's avatar preetwinder Committed by Vincent Bechu

[erp5_officejs] Add WallSearch

parent 91a7a15a
<!doctype html>
<html>
<head>
<base href="https://softinst83083.host.vifib.net/erp5/web_site_module/officejs_text_editor/development/gadget_erp5_page_ojs_facebook_configurator.html/" />
Please register or sign in to reply
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS jIO Facebook Configurator Page</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script id="facebook-jssdk" src="//connect.facebook.net/en_US/sdk.js"></script>
<script src="gadget_erp5_page_ojs_facebook_configurator.js"></script>
</head>
<body>
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">&nbsp;
<span 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">
<ul data-role="listview" class="document-listview">
<li> <a href="" data-i18n="Log In">Log In</a> </li>
<li> <a href="" data-i18n="Log Out">Log Out</a> </li>
</ul>
</section>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, URI, location,
loopEventListener, btoa, FB */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP, FB) {
"use strict";
function setFacebookConfiguration(gadget, access_token, user_id) {
return new RSVP.Queue()
.push(function () {
var configuration = {};
configuration = {
type: "replicate",
use_remote_post: false,
conflict_handling: 2,
check_local_modification: false,
check_local_creation: false,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
signature_hash_key: 'updated_time',
parallel_operation_amount: 16,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: user_id + "t5-officejs-facebook"
}
}
},
signature_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: user_id + "signature-officejs-facebook"
}
}
},
remote_sub_storage: {
type: "query",
sub_storage: {
type: "facebook",
access_token: access_token,
user_id: user_id,
default_field_list: ['id', 'message', 'created_time', 'link', 'story']
}
}
};
return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () {
return gadget.setSetting('jio_storage_name', "FACEBOOK");
})
.push(function () {
return gadget.setSetting('sync_reload', true);
})
.push(function () {
return gadget.redirect({
command: "display",
options: {page: 'ojs_sync', auto_repair: 'true'}
});
});
}
var gadget_klass = rJS(window);
gadget_klass
.setState({
logged: false
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod("render", function () {
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'
});
FB.getLoginStatus(function (response) {
if (response.status === 'connected') {
gadget.element.querySelector("span").textContent = ' Logged in';
} else {
gadget.element.querySelector("span").textContent = ' Logged out';
}
});
})
.onStateChange(function (modification_dict) {
var gadget = this;
if (modification_dict.hasOwnProperty('logged')) {
if (modification_dict.logged) {
gadget.element.querySelector("span").textContent = ' Logged in';
return setFacebookConfiguration(gadget, FB.getAccessToken(), FB.getUserID());
}
gadget.element.querySelector("span").textContent = ' Logged out';
}
})
.onEvent("click", function (event) {
var gadget = this;
if (event.target.getAttribute('data-i18n') === 'Log In') {
FB.getLoginStatus(function (response) {
if (response.status === 'connected') {
gadget.changeState({logged: true});
} else {
FB.login(function (response) {
if (response.authResponse) {
gadget.changeState({logged: true});
}
}, {scope: 'user_posts'});
}
});
} else if (event.target.getAttribute('data-i18n') === 'Log Out') {
FB.logout(function () {
gadget.element.querySelector("span").textContent = ' Logged out';
gadget.changeState({logged: false});
});
}
});
}(window, rJS, RSVP, FB));
\ No newline at end of file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Text Editor List</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_ojs_wallsearch_document_list.js"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html" data-gadget-scope="form_list"></div>
</body>
</html>
/*global window, rJS, RSVP, console */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlForAcquired", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("getSetting", "getSetting")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
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, message, link, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
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",
date_only: 0,
description: "The Date",
editable: 0,
hidden: 0,
hidden_day_is_last_day: 0,
default: date.toUTCString(),
key: "created_time",
required: 0,
timezone_style: 0,
title: "Creation Time",
type: "DateTimeField"
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
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;
}
link = result.data.rows[i].value.link;
if (link) {
if (message.indexOf(link.slice(0, -1)) === -1) {
message += ' ' + result.data.rows[i].value.link.slice(0, 100) + '...';
}
}
result.data.rows[i].value.message = message;
}
return result;
});
})
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list')
.push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.allowPublicAcquisition("getUrlFor", function (param_list) {
var gadget = this;
if (param_list[0].command === 'index') {
return gadget.jio_get(param_list[0].options.jio_key)
.push(function (result) {
if (result.link) {
return result.link;
}
return window.location.href;
});
}
return this.getUrlForAcquired.apply(this, param_list);
})
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_list'),
gadget.getSetting("portal_type")
]);
})
.push(function (result) {
var column_list = [
['message', 'Message'],
['created_time', 'Creation Time']
];
return result[0].render({
erp5_document: {"_embedded": {"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 1,
"editable_column_list": [],
"key": "field_listbox",
"lines": 30,
"list_method": "portal_catalog",
"query": "",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [['created_time', 'descending']],
"title": "Documents",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
]]
}
});
})
.push(function () {
return gadget.getSetting('document_title_plural');
})
.push(function (result) {
return gadget.updateHeader({
page_title: result,
filter_action: true
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Jio Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_ojs_wallsearch_jio.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS, jIO, FormData, UriTemplate */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, jIO) {
"use strict";
// jIO call wrapper for redirection to authentication page if needed
function wrapJioCall(gadget, method_name, argument_list) {
var storage = gadget.state_parameter_dict.jio_storage;
if (storage === undefined) {
return gadget.redirect({command: 'display', options: {page: 'ojs_facebook_configurator'}});
}
return storage[method_name].apply(storage, argument_list)
.push(undefined, function (error) {
if (error.status_code === 400) {
return gadget.redirect({command: "display", options: {page: 'ojs_facebook_configurator'}});
}
throw error;
});
}
rJS(window)
.ready(function (gadget) {
// Initialize the gadget local parameters
gadget.state_parameter_dict = {};
})
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod('getUrlFor', 'getUrlFor')
.declareMethod('createJio', function (jio_options) {
var gadget = this;
if (jio_options === undefined) {
return;
}
try {
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);
} catch (error) {
this.state_parameter_dict.jio_storage = undefined;
}
return this.getSetting("jio_storage_name")
.push(function (jio_storage_name) {
gadget.state_parameter_dict.jio_storage_name = jio_storage_name;
});
})
.declareMethod('allDocs', function () {
return wrapJioCall(this, 'allDocs', arguments);
})
.declareMethod('allAttachments', function () {
return wrapJioCall(this, 'allAttachments', arguments);
})
.declareMethod('get', function () {
return wrapJioCall(this, 'get', arguments);
})
.declareMethod('put', function () {
return wrapJioCall(this, 'put', arguments);
})
.declareMethod('post', function () {
return wrapJioCall(this, 'post', arguments);
})
.declareMethod('remove', function () {
return wrapJioCall(this, 'remove', arguments);
})
.declareMethod('getAttachment', function () {
return wrapJioCall(this, 'getAttachment', arguments);
})
.declareMethod('putAttachment', function () {
return wrapJioCall(this, 'putAttachment', arguments);
})
.declareMethod('removeAttachment', function () {
return wrapJioCall(this, 'removeAttachment', arguments);
})
.declareMethod('repair', function () {
return wrapJioCall(this, 'repair', arguments);
});
}(window, rJS, jIO));
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 Panel</title>
<!--
data-i18n=Editable
-->
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script id="panel-template-header" type="text/x-handlebars-template">
<div data-role="header" class="ui-bar-inherit">
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">
<div class="ui-controlgroup-controls">
<button data-i18n="Close" class="ui-btn ui-btn-icon-notext ui-icon-delete">Close</button>
</div>
</div>
</div>
</script>
<script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content">
<form class="dialog_form">
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-action ui-btn-icon-right ui-screen-hidden">Submit</button>
<div data-gadget-url="gadget_erp5_searchfield.html"
data-gadget-scope="erp5_searchfield"
data-gadget-sandbox="public"></div>
</form>
<ul data-role="listview" class="ui-listview" data-enhanced="true"></ul>
<div data-gadget-url="gadget_erp5_field_checkbox.html"
data-gadget-scope="erp5_checkbox"
data-gadget-sandbox="public"></div>
<dl></dl>
</div>
</script>
<script id="panel-template-body-list" type="text/x-handlebars-template">
<li class="ui-first-child"><a href="{{document_list_href}}" class="ui-btn ui-btn-icon-left ui-icon-search" data-i18n="Document" accesskey="s">Posts</a></li>
<li class="ui-last-child"><a href="{{sync_href}}" class="ui-btn ui-btn-icon-left ui-icon-refresh" data-i18n="Synchronize">Synchronize</a></li>
<li><a href="{{storage_href}}" class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Login/Logout">Storages</a></li>
</script>
<script id="panel-template-body-desktop" type="text/x-handlebars-template">
<dt class="ui-content-title ui-body-c ui-btn ui-btn-icon-left ui-icon-eye" data-i18n="Views">Views</dt>
{{#each view_list}}
<dd data-role="listview" data-theme="c" data-inset="true" class="document-listview">
<a data-i18n="{{title}}" class="ui-body-inherit" href="{{href}}">{{title}}</a>
</dd>
{{/each}}
<dt class="ui-content-title ui-body-c ui-btn ui-btn-icon-left ui-icon-cogs" data-i18n="Decisions">Decisions</dt>
{{#each workflow_list}}
<dd data-role="listview" data-theme="c" data-inset="true" class="document-listview">
<a data-i18n="{{title}}" class="ui-body-inherit" href="{{href}}">{{title}}</a>
</dd>
{{/each}}
</script>
<!-- custom script -->
<script src="gadget_erp5_page_ojs_wallsearch_panel.js" type="text/javascript"></script>
</head>
<body>
<div class="jqm-navmenu-panel"></div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>OfficeJS Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Web Page</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Facebook Post</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Facebook Posts</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">web_page_module</script>
<div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div>
</body>
</html>
\ No newline at end of file
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