From 2e950c95f383db419dbb15e070b1420a1499dfa7 Mon Sep 17 00:00:00 2001 From: rylon Date: Sun, 6 Jul 2014 14:05:33 +0200 Subject: [PATCH] charname workin again, updated system reference --- .../charcreation/charcreation_validator.php | 2 +- mojotrollz/page/default_page/default_page.php | 2 +- mojotrollz/page/default_page/js/system.js | 109 ------------------ .../page/default_start/default_start.php | 3 + mojotrollz/page/page_mojotrollz.php | 28 ++--- .../page/wizard_details/js/wizard_details.js | 9 +- system | 2 +- 7 files changed, 25 insertions(+), 130 deletions(-) delete mode 100644 mojotrollz/page/default_page/js/system.js diff --git a/mojotrollz/api/charcreation/charcreation_validator.php b/mojotrollz/api/charcreation/charcreation_validator.php index 834b758..5a9ec92 100644 --- a/mojotrollz/api/charcreation/charcreation_validator.php +++ b/mojotrollz/api/charcreation/charcreation_validator.php @@ -2,7 +2,7 @@ class charcreation_validator { public static function char_name($value){ $data = \SYSTEM\SECURITY\Security::load(charcreation::MOJO_CC_SESSIONKEY); - if( strlen($value) > 12 || strlen($value) < 2 || + if( strlen($value) > 12 || //strlen($value) < 2 || preg_match('/[^A-Za-z]/',$value)){ $data['char_name'] = charcreation::DEFAULT_CHAR_NAME; } else { diff --git a/mojotrollz/page/default_page/default_page.php b/mojotrollz/page/default_page/default_page.php index afef6c5..d0895fb 100644 --- a/mojotrollz/page/default_page/default_page.php +++ b/mojotrollz/page/default_page/default_page.php @@ -10,7 +10,7 @@ class default_page extends SYSTEM\PAGE\Page { ''. ''. ''. - ''. + ''. ''. ''. ''. diff --git a/mojotrollz/page/default_page/js/system.js b/mojotrollz/page/default_page/js/system.js deleted file mode 100644 index 1f9197e..0000000 --- a/mojotrollz/page/default_page/js/system.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - -divs -> content wird geladen -eindeutige id -url -> formulardaten -function die danach ausgeführt wird - -id : div -> url -> func -default : div -> url -> func //default load - -hole array via json -lese id -stelle dar id mithilfe von json - -// Define a class like this -function Person(name, gender){ - - // Add object properties like this - this.name = name; - this.gender = gender; -} - -// Add methods like this. All Person objects will be able to invoke this -Person.prototype.speak = function(){ - alert("Howdy, my name is" + this.name); -} - -// Instantiate new objects with 'new' -var person = new Person("Bob", "M"); - -// Invoke methods like this -person.speak(); // alerts "Howdy, my name is Bob" - - */ - -//mother object -function SYSTEM(endpoint, group){ - this.endpoint = endpoint; - this.group = group; - this.pagestates = null; -} -//internal function to handle pagestate result -SYSTEM.prototype.handle_call_pagestates = function (data) { - if(data['status']){ - newps = data['result']; - console.log('SYSTEM: loaded Pagestates'); - result = true; - } else { - console.log('SYSTEM: Problem with your Pagestates.'); - result = false;} -} -//send a call to the endpoint -SYSTEM.prototype.call = function(call,success,data,data_type,async){ - $.ajax({ - async: async, - data: data, - dataType: data_type, - url: this.endpoint+'?'+call, - success: success, - error: function(XMLHttpRequest, textStatus, errorThrown){console.log(call);} - }); -} -//get the pagestates and save em -SYSTEM.prototype.load_pagestates = function(){ - result = false; - newps = this.pagestates; - if(!this.pagestates){ - this.call('call=pagestates&group='+this.group,this.handle_call_pagestates,{},"json",false); - } else { result = true;} - this.pagestates = newps; - return result; -}; -//load a pagestatewith given id -SYSTEM.prototype.load = function(id){ - console.log('Load Pagestate: '+id); - if(!this.load_pagestates()){ - return false;} - var push = true; - this.pagestates.forEach(function(entry) { - if(entry['id'] === id){ - if(push){ - window.history.pushState(null, "", '#'+id); - push = false;} - $.ajax({ - async: false, - data: {}, - dataType: 'html', - url: entry['url'], - success: function(data){$(entry['div']).html(data); var fn = window[entry['func']]; if(typeof fn === 'function'){fn()};}, - error: function(XMLHttpRequest, textStatus, errorThrown){console.log(errorThrown);} - }); - //$(entry['div']).load(entry['url'],fn); - - } - }); - return push ? false : true; -}; -//what? -SYSTEM.prototype.cur_state = function() { - var pathName = window.location.href; - if (pathName.indexOf('#') != -1) { - return pathName.split('#').pop();} - return ''; -} - -SYSTEM.prototype.go_state = function(default_state){ - pageName = this.cur_state(); - this.load(pageName ? pageName : default_state); -} \ No newline at end of file diff --git a/mojotrollz/page/default_start/default_start.php b/mojotrollz/page/default_start/default_start.php index 1e2b85a..e586ef9 100644 --- a/mojotrollz/page/default_start/default_start.php +++ b/mojotrollz/page/default_start/default_start.php @@ -1,6 +1,9 @@