Commit 5354ad8e authored by Sven Franck's avatar Sven Franck

removed setGlobalConfiguration, harmonized module configuration

parent e4c0347e
...@@ -35,6 +35,20 @@ ...@@ -35,6 +35,20 @@
} }
}] }]
}, },
{
"type": "hello",
"set_on": "login_dict",
"modernizr": ["localStorage"],
"property_dict": {
"use_login": true
},
"scheme": [{
"property_dict": {
"google" : "1028374738607-pg2qqcopjpoc09shlpul3mehu2dv76ln.apps.googleusercontent.com"
}
}],
"children": []
},
{ {
"type": "i18n", "type": "i18n",
"set_on": "lang_dict", "set_on": "lang_dict",
...@@ -136,7 +150,9 @@ ...@@ -136,7 +150,9 @@
"property_dict": { "property_dict": {
"direction": "horizontal" "direction": "horizontal"
}, },
"children": [] "children": [
{"type":"a", "direct": {"href": "#global-popup", "className":"responsive action"}, "attributes": {"data-depend":"login_state", "data-rel":"popup", "data-action":"login", "data-icon":"user", "data-i18n":"global_dict.login"}, "logic": {"text":"Login"}}
]
}] }]
}] }]
} }
......
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
"initializer": "createJIO", "initializer": "createJIO",
"modernizr": ["blobconstructor", "filereader"], "modernizr": ["blobconstructor", "filereader"],
"property_dict": { "property_dict": {
"name_dict": {
"gadgets": "gadgets",
"configuration": "configuration",
"data_type": "portal_type",
"settings": "settings"
},
"storage": true, "storage": true,
"force_field_definitions": true, "force_field_definitions": true,
"skip_total_records": true "skip_total_records": true
......
...@@ -546,7 +546,7 @@ ...@@ -546,7 +546,7 @@
"installed_services": function (reply) { "installed_services": function (reply) {
var config, property, query, fetch, href, store, pass = reply.pass; var config, property, query, fetch, href, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
// access storage // access storage
...@@ -589,7 +589,7 @@ ...@@ -589,7 +589,7 @@
"release_list": function (reply) { "release_list": function (reply) {
var config, property, query, fetch, href, store, pass = reply.pass; var config, property, query, fetch, href, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
// access storage // access storage
...@@ -632,7 +632,7 @@ ...@@ -632,7 +632,7 @@
"software_list": function (reply) { "software_list": function (reply) {
var config, property, query, props, store, pass = reply.pass; var config, property, query, props, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
config = { config = {
...@@ -683,7 +683,7 @@ ...@@ -683,7 +683,7 @@
"subscription_details": function (reply) { "subscription_details": function (reply) {
var config, property, query, fetch, href, store, pass = reply.pass; var config, property, query, fetch, href, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
// access storage // access storage
...@@ -726,7 +726,7 @@ ...@@ -726,7 +726,7 @@
"ticketing": function (reply) { "ticketing": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass; var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
config = { config = {
...@@ -784,7 +784,7 @@ ...@@ -784,7 +784,7 @@
"ticket_status": function (reply) { "ticket_status": function (reply) {
var fetch, config, property, query, href, i, store, reply, pass = reply.pass; var fetch, config, property, query, href, i, store, reply, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
// access storage // access storage
...@@ -827,7 +827,7 @@ ...@@ -827,7 +827,7 @@
"servers": function (reply) { "servers": function (reply) {
var config, property, query, href, i, store, reply, pass = reply.pass; var config, property, query, href, i, store, reply, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict) { if (store.property_dict) {
config = { config = {
...@@ -884,7 +884,7 @@ ...@@ -884,7 +884,7 @@
"invoices": function (reply) { "invoices": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass; var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
config = { config = {
...@@ -941,7 +941,7 @@ ...@@ -941,7 +941,7 @@
"networks": function (reply) { "networks": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass; var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
config = { config = {
...@@ -999,7 +999,7 @@ ...@@ -999,7 +999,7 @@
"subscriptions": function (reply) { "subscriptions": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass; var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.default_dict.storage_dict; store = app.storage_dict;
if (store.property_dict.storage) { if (store.property_dict.storage) {
config = { config = {
...@@ -1120,7 +1120,7 @@ ...@@ -1120,7 +1120,7 @@
id = obj.state.fragment_list[1]; id = obj.state.fragment_list[1];
formData = new FormData(); formData = new FormData();
store = app.default_dict.storage_dict; store = app.storage_dict;
valid = storage.validate(obj.gadget); valid = storage.validate(obj.gadget);
decode = /^[^\/]*%2[^\/]*$/.test(id); decode = /^[^\/]*%2[^\/]*$/.test(id);
...@@ -1179,7 +1179,7 @@ ...@@ -1179,7 +1179,7 @@
id = obj.state.fragment_list[1]; id = obj.state.fragment_list[1];
element = obj.element; element = obj.element;
store = app.default_dict.storage_dict; store = app.storage_dict;
formData = new FormData(); formData = new FormData();
decode = /^[^\/]*%2[^\/]*$/.test(id); decode = /^[^\/]*%2[^\/]*$/.test(id);
...@@ -1214,7 +1214,7 @@ ...@@ -1214,7 +1214,7 @@
id = obj.state.fragment_list[1]; id = obj.state.fragment_list[1];
element = obj.element; element = obj.element;
store = app.default_dict.storage_dict; store = app.storage_dict;
formData = new FormData(); formData = new FormData();
decode = /^[^\/]*%2[^\/]*$/.test(id); decode = /^[^\/]*%2[^\/]*$/.test(id);
...@@ -1294,7 +1294,7 @@ ...@@ -1294,7 +1294,7 @@
"download": function (obj) { "download": function (obj) {
var store; var store;
store = app.default_dict.storage_dict; store = app.storage_dict;
util.loader("", "status_dict.downloading"); util.loader("", "status_dict.downloading");
store.items.get({"_id": window.decodeURIComponent(obj.element.href.split("/").pop())},{"_view": "web_view"}) store.items.get({"_id": window.decodeURIComponent(obj.element.href.split("/").pop())},{"_view": "web_view"})
...@@ -1637,7 +1637,7 @@ ...@@ -1637,7 +1637,7 @@
id = obj.state.fragment_list[1]; id = obj.state.fragment_list[1];
formData = new FormData(); formData = new FormData();
store = app.default_dict.storage_dict; store = app.storage_dict;
valid = storage.validate(obj.gadget); valid = storage.validate(obj.gadget);
decode = /^[^\/]*%2[^\/]*$/.test(id); decode = /^[^\/]*%2[^\/]*$/.test(id);
...@@ -2392,205 +2392,6 @@ ...@@ -2392,205 +2392,6 @@
**/ **/
map.gadgets = { map.gadgets = {
/**
* Setup global configuration for app
* @method setGlobalConfiguration
* @param {object} content_dict JSON configuration for global setup
**/
"setGlobalConfiguration": function (content_dict) {
var i, j, k, translator, single_path, supported, target, language,
container, foreign, promises, path_flag, status_flag, set_state,
multi_language_flag, force_browser_language, logger, element,
set_login, skip_restore, state, support_state;
promises = [];
path_flag = content_dict.property_dict.path_dict;
status_flag = content_dict.property_dict.status_dict;
multi_language_flag = content_dict.property_dict.i18n;
force_browser_language = content_dict.property_dict
.i18n_force_browser_language;
logger = content_dict.property_dict.login_dict;
// this will manage offline and login states!
state = content_dict.property_dict.state_dict;
// initialize state machine
if (state) {
switch (state.type) {
case "StateMachine":
support_state = true;
if (state.modernizr) {
support_state = util.testSupport(state.modernizr);
}
if (!window[state.type]) {
util.error("globalConfig: Missing StateMachine");
}
if (support_state) {
for (k = 0; k < state.machine_list.length; k += 1) {
app.default_dict.state_dict[state.machine_list[k].machine_name] =
window[state.type].create(state.machine_list[k].property_dict);
}
}
break;
}
}
// make sure login is only setup if needed
if (logger !== undefined) {
app.default_dict.state_dict.login = true;
foreign = logger.third_party;
if (foreign) {
switch (foreign.provider) {
case "hellojs":
// test supported
if (foreign.modernizr) {
supported = util.testSupport(foreign.modernizr);
}
if (supported) {
app.default_dict.state_dict.login_pointer = hello;
app.default_dict.state_dict.no_auth = logger.no_auth;
if (hello) {
// initialize hellojs
hello.init(foreign.initializer_dict, foreign.redirect);
app.default_dict.state_dict.verification_dict =
foreign.verification_dict;
set_login = true;
} else {
util.error("globalConfig: Missing hellojs");
}
}
break;
}
}
}
// setup loader
if (status_flag) {
switch (status_flag.type) {
case "loader":
app.default_dict.property_dict.loader = true;
app.default_dict.property_dict.loader_theme = status_flag.theme;
break;
}
}
// create path dict
if (path_flag) {
for (single_path in path_flag) {
if (path_flag.hasOwnProperty(single_path)) {
app.default_dict.property_dict[single_path] = path_flag[single_path];
}
}
} else {
util.error("globalConfig: Missing path dict");
}
// i18n
if (multi_language_flag) {
language = window.navigator.userLanguage || window.navigator.language;
switch (multi_language_flag) {
case "i18next":
translator = content_dict.property_dict.i18n_dict;
if (translator) {
// overwrite with browser language if specified
if (language && force_browser_language) {
translator.fallbackLng = translator.lng;
translator.lng = language;
}
promises[content_dict.children.length + 1] =
i18n.init(translator, function () {
return;
});
} else {
util.error("globalConfig: Missing i18n configuration");
}
break;
}
}
// start setup
app.checkLoginStatus(set_login)
.then(function (response) {
if (response.error) {
skip_restore = true;
}
// finish, if no login required
if (response && response.pass) {
return;
}
// set login state
if (response && response.user_id) {
set_state = "logoff";
} else {
set_state = "login";
}
return set_state;
})
.then(function (state) {
var open_auth;
// try to register user
if (skip_restore === undefined) {
if (foreign && foreign.initializer_dict) {
for (open_auth in foreign.initializer_dict) {
if (foreign.initializer_dict.hasOwnProperty(open_auth)) {
return app.register(open_auth)
.then(function () {
return state;
});
}
}
}
}
return state;
})
.then(function () {
// global elements
if (content_dict.children) {
for (i = 0; i < content_dict.children.length; i += 1) {
element = content_dict.children[i];
element.set_state = set_state;
promises[i] = app.setContent(element);
}
}
return RSVP.all(promises)
.then(function (promises) {
// create a fragment for promises
target = document.createDocumentFragment();
for (j = 0; j < promises.length; j += 1) {
container = promises[j];
// exclude undefined promises (i18n)
if (container && container.nodeName) {
// translate
if (i18n) {
map.actions.translateNodeList(container);
}
// insert panel as first child into DOM
if (util.testForString("ui-panel", container.className)) {
document.body.insertBefore(
container,
document.body.children[0]
);
} else {
target.appendChild(container);
}
}
document.body.appendChild(target);
}
});
})
.then(app.setGlobalBindings)
.fail(util.error);
},
/** /**
* Pick page_dict to load based on URL * Pick page_dict to load based on URL
* @method pageindex * @method pageindex
...@@ -2643,7 +2444,7 @@ ...@@ -2643,7 +2444,7 @@
// no auth // no auth
if (answer === null) { if (answer === null) {
target = factory.util.wrapInForm(spec); target = factory.util.wrapInForm(spec);
target.appendChild(no_content(app.default_dict.state_dict.no_auth)); target.appendChild(no_content(app.state_dict.no_auth));
return target; return target;
} }
...@@ -2805,7 +2606,7 @@ ...@@ -2805,7 +2606,7 @@
// no auth // no auth
if (answer === null) { if (answer === null) {
target = factory.util.wrapInForm(spec); target = factory.util.wrapInForm(spec);
target.appendChild(no_content(app.default_dict.state_dict.no_auth)); target.appendChild(no_content(app.state_dict.no_auth));
return target; return target;
} }
...@@ -2964,7 +2765,7 @@ ...@@ -2964,7 +2765,7 @@
spec.reset = reset_state; spec.reset = reset_state;
spec.depend = update_gadget; spec.depend = update_gadget;
target = factory.util.wrapInForm(spec); target = factory.util.wrapInForm(spec);
target.appendChild(no_content(app.default_dict.state_dict.no_auth)); target.appendChild(no_content(app.state_dict.no_auth));
return target; return target;
// auth or allow // auth or allow
...@@ -3220,7 +3021,7 @@ ...@@ -3220,7 +3021,7 @@
}; };
// only add last button, if total is available // only add last button, if total is available
if (!app.default_dict.storage_dict.property_dict.skip_total_records) { if (!app.storage_dict.property_dict.skip_total_records) {
config.children[0].children.push({ config.children[0].children.push({
"type": "a", "type": "a",
"direct":{"className":"action", "href":"#"}, "direct":{"className":"action", "href":"#"},
...@@ -3401,8 +3202,8 @@ ...@@ -3401,8 +3202,8 @@
// fetch content // fetch content
app.fetchConfig({ app.fetchConfig({
"storage": app.default_dict.storage_dict.settings, "storage": app.storage_dict.settings,
"file": app.default_dict.storage_dict.gadgets, "file": app.storage_dict.property_dict.name_dict.gadgets,
"attachment": reference, "attachment": reference,
"pass": undefined "pass": undefined
}) })
...@@ -5935,7 +5736,7 @@ ...@@ -5935,7 +5736,7 @@
} }
util.loader("", "status_dict.saving"); util.loader("", "status_dict.saving");
console.log("mh")
// TODO: a post should always include all required fields // TODO: a post should always include all required fields
// TODO: find a way to set default fields, like timestamp etc // TODO: find a way to set default fields, like timestamp etc
app.store({ app.store({
...@@ -5951,7 +5752,6 @@ ...@@ -5951,7 +5752,6 @@
} }
}) })
.then(function (answer) { .then(function (answer) {
console.log("do we get here=")
if (answer.response && answer.response.result === "success") { if (answer.response && answer.response.result === "success") {
pass_id = answer.response.id; pass_id = answer.response.id;
switch (config.gadget.getAttribute("data-reset")) { switch (config.gadget.getAttribute("data-reset")) {
...@@ -6011,19 +5811,9 @@ ...@@ -6011,19 +5811,9 @@
app = {}; app = {};
/** /**
* @object {object} Object containing default names, which can be overridden * Fallback for undefined arrays (faster to lookup than to create)
**/ */
app.default_dict = { app.empty_array = [];
"storage_dict": {
"settings": "settings",
"configuration": "configuration",
"gadgets": "gadgets",
"data_type": "portal_types"
},
"lang_dict": {},
"state_dict": {},
"empty_array": []
};
/** /**
* Timer for 500ms delayed actions * Timer for 500ms delayed actions
...@@ -6082,8 +5872,8 @@ ...@@ -6082,8 +5872,8 @@
// need field values for allDocs select_list... // need field values for allDocs select_list...
return app.fetchConfig({ return app.fetchConfig({
"storage": app.default_dict.storage_dict.settings, "storage": app.storage_dict.settings,
"file": app.default_dict.storage_dict.data_type, "file": app.storage_dict.property_dict.name_dict.data_type,
"attachment": "person_fieldlist", "attachment": "person_fieldlist",
"pass": {"query": query, "profile": profile} "pass": {"query": query, "profile": profile}
}) })
...@@ -6519,8 +6309,8 @@ ...@@ -6519,8 +6309,8 @@
return RSVP.resolve({"pass": skip}); return RSVP.resolve({"pass": skip});
} }
logger = app.default_dict.state_dict.login_pointer; logger = app.state_dict.login_pointer;
verify = app.default_dict.state_dict.verification_dict; verify = app.state_dict.verification_dict;
if (logger) { if (logger) {
...@@ -6627,7 +6417,7 @@ ...@@ -6627,7 +6417,7 @@
info_field_list = element.querySelectorAll(".info"); info_field_list = element.querySelectorAll(".info");
info = ""; info = "";
no_total = total === undefined && app.default_dict.storage_dict.property_dict.skip_total_records; no_total = total === undefined && app.storage_dict.property_dict.skip_total_records;
generateInfo = function (text, text_i18n) { generateInfo = function (text, text_i18n) {
return factory.element( return factory.element(
"span", "span",
...@@ -6885,7 +6675,7 @@ ...@@ -6885,7 +6675,7 @@
obj.include_docs = true; obj.include_docs = true;
} }
if (field_list && field_list.length > 0 && if (field_list && field_list.length > 0 &&
app.default_dict.storage_dict.property_dict.force_field_definitions) { app.storage_dict.property_dict.force_field_definitions) {
delete obj.include_docs; delete obj.include_docs;
obj.select_list = field_list; obj.select_list = field_list;
} }
...@@ -7042,7 +6832,7 @@ ...@@ -7042,7 +6832,7 @@
// home // home
breadcrumb.appendChild( breadcrumb.appendChild(
makeLink(app.default_dict.property_dict.home, undefined, true) makeLink(app.property_dict.home, undefined, true)
); );
// fragments // fragments
...@@ -7237,7 +7027,7 @@ ...@@ -7237,7 +7027,7 @@
app.fetchDataQuery = function (reply) { app.fetchDataQuery = function (reply) {
var parsed, pass = reply.pass, key, value, force_fields; var parsed, pass = reply.pass, key, value, force_fields;
force_fields = app.default_dict.storage_dict.property_dict.force_field_definitions; force_fields = app.storage_dict.property_dict.force_field_definitions;
if (pass.skip === undefined && if (pass.skip === undefined &&
(pass.no_auth || (pass.auth && pass.active_login))) { (pass.no_auth || (pass.auth && pass.active_login))) {
...@@ -7427,7 +7217,7 @@ ...@@ -7427,7 +7217,7 @@
pass.fields = util.parse(reply.response); pass.fields = util.parse(reply.response);
} }
store = app.default_dict.storage_dict.items; store = app.storage_dict.items;
items = util.parse(reply.response); items = util.parse(reply.response);
if (store && items.length > 0) { if (store && items.length > 0) {
...@@ -7448,8 +7238,8 @@ ...@@ -7448,8 +7238,8 @@
// TODO: bad way to set attachment value!! // TODO: bad way to set attachment value!!
return app.fetchConfig({ return app.fetchConfig({
"storage": app.default_dict.storage_dict.settings, "storage": app.storage_dict.settings,
"file": app.default_dict.storage_dict.data_type, "file": app.storage_dict.property_dict.name_dict.data_type,
"attachment": pass.type.toLowerCase() + "_fieldlist", "attachment": pass.type.toLowerCase() + "_fieldlist",
"pass": pass "pass": pass
}) })
...@@ -7496,9 +7286,7 @@ ...@@ -7496,9 +7286,7 @@
// obj.portal_type = pass.type; // obj.portal_type = pass.type;
// if an object identifier was set in the form, we PUT, else POST // if an object identifier was set in the form, we PUT, else POST
console.log("so.... where is the identifier")
console.log(obj)
console.log(obj.identifier)
if (obj.identifier) { if (obj.identifier) {
method = "put"; method = "put";
hacked_view = {"_view": pass.view}; hacked_view = {"_view": pass.view};
...@@ -7514,10 +7302,9 @@ ...@@ -7514,10 +7302,9 @@
.fail(util.error); .fail(util.error);
} }
} else { } else {
console.log("here?")
// do it again, Sam... // do it again, Sam...
promises[0] = jIO.util.ajax({ promises[0] = jIO.util.ajax({
"url": app.default_dict.storage_dict.items.dict.url, "url": app.storage_dict.items.dict.url,
"type": "GET", "type": "GET",
"xhrFields": { "xhrFields": {
"withCredentials": true "withCredentials": true
...@@ -7665,8 +7452,8 @@ ...@@ -7665,8 +7452,8 @@
// TODO: keep this until sample handling is removed // TODO: keep this until sample handling is removed
pass.needs_fields = true; pass.needs_fields = true;
return app.fetchConfig({ return app.fetchConfig({
"storage": app.default_dict.storage_dict.settings, "storage": app.storage_dict.settings,
"file": app.default_dict.storage_dict.data_type, "file": app.storage_dict.property_dict.name_dict.data_type,
"attachment": pass.config.portal_type_fields, "attachment": pass.config.portal_type_fields,
"pass": pass "pass": pass
}); });
...@@ -7693,7 +7480,7 @@ ...@@ -7693,7 +7480,7 @@
pass.type = parsed.portal_type_source; pass.type = parsed.portal_type_source;
// if app uses login and gadget requires auth // if app uses login and gadget requires auth
if (app.default_dict.state_dict.login && if (app.state_dict.login &&
parsed.property_dict.requires_authentication) { parsed.property_dict.requires_authentication) {
pass.auth = parsed.property_dict.requires_authentication; pass.auth = parsed.property_dict.requires_authentication;
} }
...@@ -7774,10 +7561,10 @@ ...@@ -7774,10 +7561,10 @@
// and go // and go
return app.fetchConfig({ return app.fetchConfig({
"storage": app.default_dict.storage_dict.settings, "storage": app.storage_dict.settings,
"file": pass.href ? app.default_dict.storage_dict.gadgets : "file": pass.href ? app.storage_dict.property_dict.name_dict.gadgets :
app.default_dict.storage_dict.settings, app.storage_dict.property_dict.name_dict.settings,
"attachment": pass.href || app.default_dict.storage_dict.configuration, "attachment": pass.href || app.storage_dict.property_dict.name_dict.configuration,
"pass": pass "pass": pass
}) })
.then(app.checkAuth) .then(app.checkAuth)
...@@ -7873,7 +7660,7 @@ ...@@ -7873,7 +7660,7 @@
pass = parcel.pass; pass = parcel.pass;
query = parcel.query; query = parcel.query;
skip = query && query.limit && query.limit.length === 0 && skip = query && query.limit && query.limit.length === 0 &&
app.default_dict.storage_dict.property_dict.skip_total_records; app.storage_dict.property_dict.skip_total_records;
// return here, if skipping total query // return here, if skipping total query
...@@ -7899,7 +7686,7 @@ ...@@ -7899,7 +7686,7 @@
convert = "values"; convert = "values";
} }
return app.default_dict.storage_dict[parcel.storage][method || "allDocs"](parcel.query, hacked_view) return app.storage_dict[parcel.storage][method || "allDocs"](parcel.query, hacked_view)
.then(function (response) { .then(function (response) {
// TODO: best way? // TODO: best way?
if (convert !== undefined && response.status === 200) { if (convert !== undefined && response.status === 200) {
...@@ -7926,7 +7713,7 @@ ...@@ -7926,7 +7713,7 @@
app.loadFile = function (property_dict) { app.loadFile = function (property_dict) {
var response, storage_location, url, hacked_view; var response, storage_location, url, hacked_view;
url = property_dict.url || app.default_dict.property_dict.data + url = property_dict.url || app.property_dict.data +
property_dict.attachment + ".json"; property_dict.attachment + ".json";
// no url... throw error unless optional is set! // no url... throw error unless optional is set!
...@@ -7949,7 +7736,7 @@ ...@@ -7949,7 +7736,7 @@
// store file // store file
storage_location = property_dict.store || storage_location = property_dict.store ||
(storage ? app.default_dict.storage_dict.settings : undefined); (storage ? app.storage_dict.settings : undefined);
// hacked view? // hacked view?
if (property_dict && property_dict.pass && property_dict.pass.config) { if (property_dict && property_dict.pass && property_dict.pass.config) {
...@@ -7969,7 +7756,7 @@ ...@@ -7969,7 +7756,7 @@
return storage_location.putAttachment({ return storage_location.putAttachment({
"_id": (property_dict.file || "settings"), "_id": (property_dict.file || "settings"),
"_attachment": (property_dict.attachment || "_attachment": (property_dict.attachment ||
app.default_dict.storage_dict.configuration), app.storage_dict.property_dict.name_dict.configuration),
"_data": JSON.stringify(response), "_data": JSON.stringify(response),
"_mimetype": "application/json" "_mimetype": "application/json"
}); });
...@@ -8079,7 +7866,7 @@ ...@@ -8079,7 +7866,7 @@
} }
return app.fetchConfig({ return app.fetchConfig({
"storage": app.default_dict.storage_dict.settings, "storage": app.storage_dict.settings,
"file": "pages", "file": "pages",
"attachment": destination, "attachment": destination,
"pass": undefined "pass": undefined
...@@ -8427,13 +8214,13 @@ ...@@ -8427,13 +8214,13 @@
// hm... jQuery... hm string building // hm... jQuery... hm string building
// TODO: better way? // TODO: better way?
if (app.default_dict.property_dict.loader) { if (app.property_dict.loader) {
$.mobile.loading( $.mobile.loading(
"show", "show",
{ {
"text": "", "text": "",
"textVisible": true, "textVisible": true,
"theme": app.default_dict.property_dict.loader_theme, "theme": app.property_dict.loader_theme,
"html": "<span class='ui-icon-" + "html": "<span class='ui-icon-" +
(icon ? (icon + " loader_icon") : "loading") + "'> </span>" + (icon ? (icon + " loader_icon") : "loading") + "'> </span>" +
"<h1 class='loader_message'>" + text_to_display + "</h1>" "<h1 class='loader_message'>" + text_to_display + "</h1>"
...@@ -8753,8 +8540,7 @@ ...@@ -8753,8 +8540,7 @@
var i, j, k, arr, promise_list, len, feature, feature_len, name, dict, var i, j, k, arr, promise_list, len, feature, feature_len, name, dict,
set, child_len, type, nav, language, target, initializer, solver; set, child_len, type, nav, language, target, initializer, solver;
set = app.default_dict; arr = app.empty_array;
arr = set.empty_array;
promise_list = []; promise_list = [];
len = content_dict.length; len = content_dict.length;
...@@ -8763,10 +8549,12 @@ ...@@ -8763,10 +8549,12 @@
// test support // test support
if (app.init.testSupport(feature.modernizr || [])) { if (app.init.testSupport(feature.modernizr || [])) {
set = feature.set_on;
feature_len = (feature.scheme || arr).length; feature_len = (feature.scheme || arr).length;
type = feature.type; type = feature.type;
target = set[feature.set_on] || set;
initializer = feature.initializer; initializer = feature.initializer;
target = (set ? app[feature.set_on] = {} : undefined) || app;
// merge properties on target // merge properties on target
target.property_dict = util.mergeObject( target.property_dict = util.mergeObject(
...@@ -8774,7 +8562,7 @@ ...@@ -8774,7 +8562,7 @@
target.property_dict || {} target.property_dict || {}
); );
// NOTE: Set all globals on app.default_dict and reference from there // NOTE: Set all globals on app and reference from there
for (j = 0; j < feature_len; j += 1) { for (j = 0; j < feature_len; j += 1) {
dict = feature.scheme[j]; dict = feature.scheme[j];
name = dict.set_name || dict.property_dict.application_name || type; name = dict.set_name || dict.property_dict.application_name || type;
...@@ -8787,7 +8575,7 @@ ...@@ -8787,7 +8575,7 @@
case "language": case "language":
nav = window.navigator; nav = window.navigator;
language = nav.userLanguage || nav.language; language = nav.userLanguage || nav.language;
if (language && set.property_dic.use_browser_language) { if (language && target.property_dict.use_browser_language) {
dict.fallbackLng = dict.lng; dict.fallbackLng = dict.lng;
dict.lng = language; dict.lng = language;
} }
...@@ -8809,7 +8597,7 @@ ...@@ -8809,7 +8597,7 @@
// TODO: remove all this, should be handled by setContent // TODO: remove all this, should be handled by setContent
.then (function (response_list) { .then (function (response_list) {
var target, l, container, i18n; var target, l, container, i18n;
// create a fragment for promises // create a fragment for promises
target = document.createDocumentFragment(); target = document.createDocumentFragment();
......
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