Namespace fix

This commit is contained in:
Dennis Eichhorn 2016-03-25 20:12:29 +01:00
parent e89cb9da52
commit 91d8de12a5
8 changed files with 43 additions and 83 deletions

View File

@ -62,7 +62,7 @@
*/
jsOMS.Auth.prototype.login = function ()
{
var authRequest = new jsOMS.Request();
var authRequest = new jsOMS.Message.Request();
authRequest.setUri(this.uri);
authRequest.setMethod(jsOMS.EnumRequestMethod.POST);
authRequest.setResponseType(jsOMS.EnumRequestType.JSON);

View File

@ -41,8 +41,8 @@
{
context['datetime'] = (new Date()).toISOString();
context['version'] = '1.0.0';
context['os'] = jsOMS.Request.getOS();
context['browser'] = jsOMS.Request.getBrowser();
context['os'] = jsOMS.Message.Request.getOS();
context['browser'] = jsOMS.Message.Request.getBrowser();
context['path'] = window.location.href;
context['level'] = level;
context['message'] = message;
@ -63,7 +63,7 @@
}
if(this.remote) {
let request = new jsOMS.Request(),
let request = new jsOMS.Message.Request(),
request.setData(context);
request.setType(jsOMS.EnumResponseType.JSON);
request.setUri('/{/lang}/api/log');

View File

@ -9,14 +9,14 @@
*/
(function (jsOMS, undefined)
{
/**
* @constructor
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request = function (uri, method, type)
jsOMS.Message.Request = function (uri, method, type)
{
this.uri = typeof uri !== 'undefined' ? uri : null;
this.method = typeof method !== 'undefined' ? method : jsOMS.EnumRequestMethod.GET;
@ -30,7 +30,7 @@
this.xhr = new XMLHttpRequest();
};
jsOMS.Request.getBrowser = function()
jsOMS.Message.Request.getBrowser = function()
{
if((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
return jsOMS.EnumBrowser.OPERA;
@ -49,7 +49,7 @@
}
};
jsOMS.Request.getOS = function()
jsOMS.Message.Request.getOS = function()
{
for(let os in jsOMS.EnumOSType) {
if(navigator.appversion.indexOf(jsOMS.EnumOSType[os]) !== -1) {
@ -70,7 +70,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setMethod = function (method)
jsOMS.Message.Request.prototype.setMethod = function (method)
{
this.method = method;
};
@ -87,7 +87,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.getMethod = function ()
jsOMS.Message.Request.prototype.getMethod = function ()
{
return this.method;
};
@ -104,7 +104,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setResponseType = function (type)
jsOMS.Message.Request.prototype.setResponseType = function (type)
{
this.xhr.responseType = type;
};
@ -121,7 +121,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.getResponseType = function ()
jsOMS.Message.Request.prototype.getResponseType = function ()
{
return this.responseType;
};
@ -137,7 +137,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setRequestHeader = function (type, header)
jsOMS.Message.Request.prototype.setRequestHeader = function (type, header)
{
this.requestHeader[type] = header;
};
@ -152,7 +152,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.getRequestHeader = function ()
jsOMS.Message.Request.prototype.getRequestHeader = function ()
{
return this.requestHeader;
};
@ -167,7 +167,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setUri = function (uri)
jsOMS.Message.Request.prototype.setUri = function (uri)
{
this.uri = uri;
};
@ -182,7 +182,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.getUri = function ()
jsOMS.Message.Request.prototype.getUri = function ()
{
return this.uri;
};
@ -197,7 +197,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setSuccess = function (callback)
jsOMS.Message.Request.prototype.setSuccess = function (callback)
{
this.success = callback;
};
@ -212,7 +212,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setData = function (data)
jsOMS.Message.Request.prototype.setData = function (data)
{
this.data = data;
};
@ -227,7 +227,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.getData = function ()
jsOMS.Message.Request.prototype.getData = function ()
{
return this.data
};
@ -244,7 +244,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.setType = function (type)
jsOMS.Message.Request.prototype.setType = function (type)
{
this.type = type;
};
@ -261,7 +261,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.getType = function ()
jsOMS.Message.Request.prototype.getType = function ()
{
return this.type;
};
@ -276,7 +276,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.queryfy = function (obj)
jsOMS.Message.Request.prototype.queryfy = function (obj)
{
let str = [];
for (let p in obj) {
@ -297,7 +297,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.Request.prototype.send = function ()
jsOMS.Message.Request.prototype.send = function ()
{
let self = this;

View File

@ -18,7 +18,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.RequestManager = function ()
jsOMS.Message.RequestManager = function ()
{
};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -18,7 +18,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.ResponseManager = function ()
jsOMS.Message.ResponseManager = function ()
{
this.messages = {};
};
@ -37,7 +37,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.ResponseManager.prototype.add = function (key, message, request)
jsOMS.Message.ResponseManager.prototype.add = function (key, message, request)
{
request = typeof request !== 'undefined' ? request : 'any';
if (typeof this.messages[key] === 'undefined') {
@ -61,7 +61,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.ResponseManager.prototype.execute = function (key, data, request)
jsOMS.Message.ResponseManager.prototype.execute = function (key, data, request)
{
console.log(data);
if (typeof request !== 'undefined' && typeof this.messages[key][request] !== 'undefined') {

View File

@ -17,24 +17,24 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.FormManager = function (app)
jsOMS.UI.FormManager = function (app)
{
this.app = app;
this.forms = {};
this.ignore = {};
};
jsOMS.FormManager.prototype.get = function(id)
jsOMS.UI.FormManager.prototype.get = function(id)
{
return this.forms[id];
};
jsOMS.FormManager.prototype.isIgnored = function(id)
jsOMS.UI.FormManager.prototype.isIgnored = function(id)
{
return this.ignore.indexOf(id) !== -1;
};
jsOMS.FormManager.prototype.bind = function(id)
jsOMS.UI.FormManager.prototype.bind = function(id)
{
if (typeof id !== 'undefined' && this.ignore.indexOf(id) === -1) {
this.bindForm(id)
@ -50,7 +50,7 @@
}
};
jsOMS.FormManager.prototype.bindForm = function(id)
jsOMS.UI.FormManager.prototype.bindForm = function(id)
{
let self = this;
@ -66,7 +66,7 @@
});
};
jsOMS.FormManager.prototype.unbindForm = function(id)
jsOMS.UI.FormManager.prototype.unbindForm = function(id)
{
// todo: do i need the findex? can't i just use id?
let findex = 0;
@ -81,7 +81,7 @@
return false;
};
jsOMS.FormManager.prototype.submit = function(form)
jsOMS.UI.FormManager.prototype.submit = function(form)
{
/* Handle injects */
let injects = form.getSubmitInjects();
@ -90,7 +90,7 @@
}
/* Handle default submit */
let request = new jsOMS.Request(),
let request = new jsOMS.Message.Request(),
self = this;
request.setData(form.getData());
@ -127,7 +127,7 @@
request.send();
};
jsOMS.FormManager.prototype.count = function ()
jsOMS.UI.FormManager.prototype.count = function ()
{
return this.forms.length;
};

View File

@ -1,41 +0,0 @@
/**
* Form manager class.
*
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0 * @since 1.0.0
*/
(function (jsOMS, undefined)
{
"use strict";
/**
* @constructor
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.InputElements = function ()
{
this.elements = [];
};
jsOMS.InputElements.prototype.bind = function(id)
{
};
jsOMS.InputElements.prototype.bindElement = function(e)
{
switch(e.dataset.type) {
case jsOMS.InputElementsEnum.AUTOCOMPLETE:
// autocomplete with drop down returns object
// { value: , text: , data: 'could be object'}
break;
case jsOMS.InputElementsEnum.POPUP:
break;
}
};
}

View File

@ -9,6 +9,7 @@
*/
(function (jsOMS, undefined)
{
jsOMS.UI = {};
/**
* @constructor
@ -16,10 +17,10 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.UIManager = function (app)
jsOMS.UI.UIManager = function (app)
{
this.app = app;
this.formManager = new jsOMS.FormManager(this.app.responseManager);
this.formManager = new jsOMS.FormManager(this.app);
this.tabManager = new jsOMS.TabManager(this.app.responseManager);
this.tableManager = new jsOMS.TableManager(this.app.responseManager);
};
@ -34,7 +35,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.UIManager.prototype.bind = function (id)
jsOMS.UI.UIManager.prototype.bind = function (id)
{
if (typeof id === 'undefined') {
this.formManager.bind();
@ -64,7 +65,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.UIManager.prototype.getFormManager = function ()
jsOMS.UI.UIManager.prototype.getFormManager = function ()
{
return this.formManager;
};
@ -79,7 +80,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.UIManager.prototype.getTabManager = function ()
jsOMS.UI.UIManager.prototype.getTabManager = function ()
{
return this.tabManager;
};
@ -94,7 +95,7 @@
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
jsOMS.UIManager.prototype.getTableManager = function ()
jsOMS.UI.UIManager.prototype.getTableManager = function ()
{
return this.tabManager;
};