Commit 8fc12169 authored by Sven Franck's avatar Sven Franck

removed no_auth menu to global auth object

parent 5b22b2c8
......@@ -14,6 +14,36 @@
},
"modernizr": ["localStorage"],
"redirect": {"redirect_uri":"http://localhost/sven/slapos-ui/index.html"}
},
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}]
}
]
}
},
......
......@@ -49,38 +49,5 @@
}
]
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -90,69 +90,6 @@
"bottom_grid": 1
},
"children": []
}],
"placeholder_dict": {
"no_items": {
"text":"No items found.",
"text_i18n":"validation_dict.no_items_found",
"children": [{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [
{
"type": "a",
"direct": {
"href":"#",
"className": "translate "
},
"attributes": {
"data-icon":"chevron-sign-left",
"data-i18n":"global_dict.pagination_dict.back"
},
"logic": {"Text": "Back"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#servers::new"},
"attributes": {
"data-i18n": "page_dict.servers.create",
"data-icon": "edit"
},
"logic": {"text":"Create instance"}
}]
}]
},
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
}]
}
......@@ -46,38 +46,5 @@
}
]
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -108,37 +108,6 @@
"logic": {"text":"Create person"}
}]
}]
},
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "page_dict.person.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
}
......@@ -51,37 +51,6 @@
"text":"No servers associated with this network.",
"text_i18n":"page_dict.networks.no_servers",
"children": []
},
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
}
......
......@@ -46,38 +46,5 @@
}
]
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -114,37 +114,6 @@
"logic": {"text":"Add new network"}
}]
}]
},
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
}
......
......@@ -41,38 +41,5 @@
}
]
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -106,37 +106,6 @@
"logic": {"text":"Create person"}
}]
}]
},
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "page_dict.person.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
}
......@@ -67,38 +67,5 @@
}
]
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "page_dict.person.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -42,38 +42,6 @@
"bottom_grid": 1
},
"children": []
}],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -64,38 +64,5 @@
}
]
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "page_dict.person.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -51,38 +51,5 @@
"attributes": {"data-i18n":"page_dict.services.destroy", "data-action": "destroy"},
"logic": {"text":"Destroy"}
}
],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
}
}
]
}
......@@ -55,38 +55,7 @@
}]
}],
"placeholder_dict": {
"no_auth": {
"text":"Requires authorization.",
"text_i18n":"validation_dict.requires_auth",
"children": [
{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"translate action", "href":"#global-popup"},
"attributes":{
"data-i18n":"global_dict.common_dict.login",
"data-action":"login",
"data-icon":"lock",
"data-rel": "popup"
},
"logic": {"text":"Login"}
}, {
"type": "a",
"direct": {"className":"translate ui-btn-slapos-black", "href": "#person::new"},
"attributes": {
"data-i18n": "global_dict.common_dict.register",
"data-icon": "edit"
},
"logic": {"text":"Register"}
}
]
}
]
},
"no_items": {
"no_items": {
"text":"No Software installed.",
"text_i18n":"page_dict.servers.no_software",
"children": [
......
......@@ -642,12 +642,9 @@
* @return {object} mapped object
**/
// TODO: this should be in a storage-related utility object!
// TODO: how to get count? run query on underlying_portal_type with
// category? Lot of queries
// TODO: count/aside still not implemented on listview
// TODO: add remaining mapping!
// TODO: bad because not generic! Try!!!
// NOTE: can't use hash, because the hash updates after storage operation
// and thus may be wrong depending on storage being accessed
// TODO: MAKE GENERIC API with layout!
"mapListItems": function (items, spec, url_pointer) {
var property, obj, i, item, clean, value, store, split, host,
i18n, application, level, core, arr;
......@@ -1021,6 +1018,7 @@
}
if (supported) {
app.default_dict.state_dict.login_pointer = hello;
app.default_dict.state_dict.no_auth = logger.no_auth;
if (hello) {
// initialize hellojs
......@@ -1256,7 +1254,7 @@
* @return {object} fragment
**/
"listgrid": function (spec, answer, field_dict, update, url_pointer) {
var element, i, target, placeholder;
var element, i, target;
// set update of gadget flag
if (spec.property_dict.depends_on) {
......@@ -1268,13 +1266,10 @@
spec.reset = spec.property_dict.resets;
}
// set placeholders
placeholder = spec.placeholder_dict || {};
// no auth
if (answer === null) {
target = factory.util.wrapInForm(spec);
target.appendChild(app.noItemsFound(placeholder.no_auth));
target.appendChild(app.noItemsFound(app.default_dict.state_dict.no_auth));
return target;
}
......@@ -1336,7 +1331,7 @@
* @return {object} fragment
**/
"listbox": function (spec, answer, field_dict, update, url_pointer) {
var element, i, target, container, pack, slot, pop, active, placeholder;
var element, i, target, container, pack, slot, pop, active;
// set update of gadget flag
if (spec.property_dict.depends_on) {
......@@ -1348,13 +1343,10 @@
spec.reset = spec.property_dict.resets;
}
// set placeholders
placeholder = spec.placeholder_dict || {};
// no auth
if (answer === null) {
target = factory.util.wrapInForm(spec);
target.appendChild(app.noItemsFound(placeholder.no_auth));
target.appendChild(app.noItemsFound(app.default_dict.state_dict.no_auth));
return target;
}
......@@ -1423,7 +1415,7 @@
}
}
} else {
target.appendChild(app.noItemsFound(placeholder.no_items));
target.appendChild(app.noItemsFound());
}
// assemble and/or return
......@@ -1445,7 +1437,7 @@
* @return {object} fragment
**/
"fieldlist": function (spec, answer, field_dict) {
var i, element, target, placeholder, update_gadget, reset_state, data;
var i, element, target, update_gadget, reset_state, data;
// set update of gadget flag
if (spec.property_dict.depends_on) {
......@@ -1457,15 +1449,12 @@
reset_state = spec.property_dict.reset;
}
// set placeholders
placeholder = spec.placeholder_dict || {};
// no auth, no allow
if (answer === null) {
spec.reset = reset_state;
spec.depend = update_gadget;
target = factory.util.wrapInForm(spec);
target.appendChild(app.noItemsFound(placeholder.no_auth));
target.appendChild(app.noItemsFound(app.default_dict.state_dict.no_auth));
return target;
// auth or allow
......@@ -4625,6 +4614,7 @@
* return a placeholder with button in case no items were found
* @method noItemsFound
* @param {object} content_dict Type of placeholder to create
* @param {objecŧ} element
* @return {object} HTML fragment
*/
app.noItemsFound = function (content_dict) {
......@@ -5431,6 +5421,7 @@
if (pass.create === false) {
// make sure include_docs is set, to fetch data. DON'T if force_fields
// is set, because then we fetch by columns only (not whole docs)
if (storage === undefined ||
(storage && storage.force_fields === undefined)) {
pass.state.query.include_docs = true;
......@@ -6666,6 +6657,26 @@
return;
};
/**
* escape a urlString
* @method encode
* @param {string} string String to escape
* @return {string} escaped string
**/
util.encode = function (string) {
return encodeURIComponent(string);
};
/**
* decode a urlString
* @method decode
* @param {string} string String to unescape
* @return {string} unescaped string
**/
util.decode = function (string) {
return decodeURIComponent(string);
};
/**
* parse to JSON if element is not in JSON
* @parseIfNeeded
......
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