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

removed no_auth menu to global auth object

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