watermelon avatar watermelon committed 7ad9106

change to bookmaak namespace

Comments (0)

Files changed (16)

src/main/client/comm/Communicator.js

  * **_login** so that the server can determine which users files to access
  * **_server_url** the url of the server
  **/
-namespace.Bookmaak.comm.Communicator = function Communicator(_login, _server_url) {
+bookmaak.comm.Communicator = function Communicator(_login, _server_url) {
 
 	var that = this;
 	
 			throw "illegal argument _file_type.";
 		
 		switch(file_type) {
-			case namespace.Bookmaak.controller.FILE_TYPE.USER:
+			case bookmaak.controller.FILE_TYPE.USER:
 				var mime_type = "text/bookmaak."+file_type+".crypt";
 				break;
-			case namespace.Bookmaak.controller.FILE_TYPE.BOOKMARKS:
+			case bookmaak.controller.FILE_TYPE.BOOKMARKS:
 				var mime_type = "text/bookmaak."+file_type+".crypt";
 				break;
 			default:
 							success: true,
 							type: textStatus,
 							msg: "Successfully retrieved "+file_type+" file of "+login+"."
-							}, new namespace.Bookmaak.domain.File(file_type, data));
+							}, new bookmaak.domain.File(file_type, data));
 						break;
 					default:
 						callback({
 			throw "illegal argument _file.";
 		
 		switch(file.type) {
-			case namespace.Bookmaak.controller.FILE_TYPE.USER:
+			case bookmaak.controller.FILE_TYPE.USER:
 				var mime_type = "text/bookmaak."+file.type+".crypt";
 				break;
-			case namespace.Bookmaak.controller.FILE_TYPE.BOOKMARKS:
+			case bookmaak.controller.FILE_TYPE.BOOKMARKS:
 				var mime_type = "text/bookmaak."+file.type+".crypt";
 				break;
 			default:

src/main/client/controller/Controller.js

-//namespace = window.namespace || {};
-//namespace.Bookmaak = namespace.Bookmaak || {};
-//namespace.Bookmaak.domain = namespace.Bookmaak.domain || {};
-//
-//namespace.Bookmaak.comm = namespace.Bookmaak.comm || {};
-//namespace.Bookmaak.dao = namespace.Bookmaak.dao || {};
-//namespace.Bookmaak.crypto = namespace.Bookmaak.crypto || {};
-//
-//namespace.Bookmaak.controller = namespace.Bookmaak.controller || {};
-//
-//namespace.Bookmaak.ui = namespace.Bookmaak.ui || {};
-
-
 //TODO MOVE ARGUMENT VALIDATION TO THOSE WHO CALL THE CONTROLLER
 //(keeps controller/the actual application logic code simple and readable)
 
 /**
- * namespace.Bookmaak.controller.Controller
+ * bookmaak.controller.Controller
  *
  * The controller (MVC)
  * The controller initialises the client application and
  * manages all layers below.
  **/
-namespace.Bookmaak.controller.Controller = namespace.Bookmaak.controller.Controller || {};
+bookmaak.controller.Controller = bookmaak.controller.Controller || {};
 
 
 
 /**
- * namespace.Bookmaak.controller.SETTING_TYPE = USER | GLOBAL
+ * bookmaak.controller.SETTING_TYPE = USER | GLOBAL
  * 
  * Enumeration of all setting types.
  **/
-namespace.Bookmaak.controller.SETTING_TYPE = {
+bookmaak.controller.SETTING_TYPE = {
 	
 	USER:	"user_setting",
 	GLOBAL:	"global_setting"
 
 
 /**
- * namespace.Bookmaak.controller.Controller.server_url -> String
+ * bookmaak.controller.Controller.server_url -> String
  * 
  * the url to the server... it is only set when the user is "connected".
  **/
-namespace.Bookmaak.controller.Controller.server_url = "";
+bookmaak.controller.Controller.server_url = "";
 
 
 /**
- * namespace.Bookmaak.controller.Controller.login -> String
+ * bookmaak.controller.Controller.login -> String
  * 
  * the user that is logged in.
  **/
-namespace.Bookmaak.controller.Controller.login = "";
+bookmaak.controller.Controller.login = "";
 
 
 /**
- * namespace.Bookmaak.controller.Controller.rng -> SecureRandom
+ * bookmaak.controller.Controller.rng -> SecureRandom
  * 
  * the secure random provider/generator
  **/
-namespace.Bookmaak.controller.Controller.rng = new SecureRandom();
+bookmaak.controller.Controller.rng = new SecureRandom();
 
 
 
 /**
- * namespace.Bookmaak.controller.Controller.probeServer([String], Function) -> Object
+ * bookmaak.controller.Controller.probeServer([String], Function) -> Object
  * 
  * TODO maybe we should replace that by a real login
  * 
  * 				msg: String, textual error message
  * 			};
  **/
-namespace.Bookmaak.controller.Controller.probeServer = function(_server_url, callback) {
+bookmaak.controller.Controller.probeServer = function(_server_url, callback) {
 	
 	if(typeof callback != typeof Function)
 		throw "callback is undefined or not a function.";
 	if(typeof _server_url != 'undefined') {
 		
 		if(Object.prototype.toString.call(_server_url) == "[object String]")
-			namespace.Bookmaak.controller.Controller.server_url = _server_url;
+			bookmaak.controller.Controller.server_url = _server_url;
 		else
 			throw "illegal argument _server_url.";
 	}
 	else if(//typeof _server_url == 'undefined' && not neccessary
-			typeof namespace.Bookmaak.controller.Controller.server_url == 'undefined') {
+			typeof bookmaak.controller.Controller.server_url == 'undefined') {
 		
 		throw "no sever url specified.";
 //		callback(function() {
 //			this.msg = "There is no sever url specified.";
 //		});
 	}
-	//else namespace.Bookmaak.controller.Controller.server_url == defined...
+	//else bookmaak.controller.Controller.server_url == defined...
 	
 	//work around for problem with opera... :(((((( about:config#UserPrefs|AllowFileXHTTPRequest does not work
 	if(jQuery.browser.opera) {
 	
 	//probe server
 	jQuery.ajax({
-		url: namespace.Bookmaak.controller.Controller.server_url,
+		url: bookmaak.controller.Controller.server_url,
 		aync: false,//we want to probe the server before proceeding TODO maybe we change the wohle process and make the login a real login...
 		type: "HEAD",
 		crossDomain: true,
 
 
 /**
- * namespace.Bookmaak.controller.userExists(String, Function) -> Boolean
+ * bookmaak.controller.userExists(String, Function) -> Boolean
  * 
  * **_login** the user name/login
  * **callback** called passing the result
  * 		msg: String, textual message, describing the error.
  * 	}
  **/
-namespace.Bookmaak.controller.userExists = function(_login, callback) {
+bookmaak.controller.userExists = function(_login, callback) {
 	
 	if(typeof callback != typeof Function)
 		throw "callback is undefined or not a function.";
 		throw "illegal argument _login.";
 	
 	jQuery.ajax({
-		url: namespace.Bookmaak.controller.Controller.server_url + login,
+		url: bookmaak.controller.Controller.server_url + login,
 		aync: false,
 		type: "HEAD",
 		crossDomain: true,
 
 
 /**
- * namespace.Bookmaak.controller.Controller.addSetting(String, ANY, SETTING_TYPE) -> Boolean
+ * bookmaak.controller.Controller.addSetting(String, ANY, SETTING_TYPE) -> Boolean
  * 
  * Adds a setting by key/value, according to _type.
  * Assumes as state in http://dev.w3.org/html5/webstorage/#storage
  * **_type** the type
  * returns true on success, otherwise false.
  **/
-namespace.Bookmaak.controller.Controller.addSetting = function(_key, _value, _type){
+bookmaak.controller.Controller.addSetting = function(_key, _value, _type){
 	
 	if(typeof _key == 'undefined')
 		throw "_key is undefined.";
 	
 	switch(type) {
 	
-		case namespace.Bookmaak.controller.SETTING_TYPE.USER:
+		case bookmaak.controller.SETTING_TYPE.USER:
 			return addSetting(SETTINGS_PREFIX_USER, key, value);
 			break;
 			
-		case namespace.Bookmaak.controller.SETTING_TYPE.GLOBAL:
+		case bookmaak.controller.SETTING_TYPE.GLOBAL:
 			return addSetting(SETTINGS_PREFIX_GLOBAL, key, value);
 			break;
 		default:
 };
 
 /**
- * namespace.Bookmaak.controller.Controller.getSetting(String, SETTING_TYPE) -> ANY | null
+ * bookmaak.controller.Controller.getSetting(String, SETTING_TYPE) -> ANY | null
  * 
  * Retrieves a setting by key, according to _type.
  * Assumes as state in http://dev.w3.org/html5/webstorage/#storage
  * **_type** the type
  * returns true on success, otherwise false.
  **/
-namespace.Bookmaak.controller.Controller.getSetting = function(_key, _type){
+bookmaak.controller.Controller.getSetting = function(_key, _type){
 	
 	if(typeof _key == 'undefined')
 		throw "_key is undefined.";
 	
 	switch(type) {
 	
-		case namespace.Bookmaak.controller.SETTING_TYPE.USER:
+		case bookmaak.controller.SETTING_TYPE.USER:
 			return getSetting(SETTINGS_PREFIX_USER, key);
 			break;
 			
-		case namespace.Bookmaak.controller.SETTING_TYPE.GLOBAL:
+		case bookmaak.controller.SETTING_TYPE.GLOBAL:
 			return getSetting(SETTINGS_PREFIX_GLOBAL, key);
 			break;
 		default:
 };
 
 /**
- * namespace.Bookmaak.controller.Controller.removeSetting(String, SETTING_TYPE) -> Boolean
+ * bookmaak.controller.Controller.removeSetting(String, SETTING_TYPE) -> Boolean
  * 
  * Removes a setting by key, according to _type.
  * Assumes as state in http://dev.w3.org/html5/webstorage/#storage
  * **_type** the type
  * returns true on success, otherwise false.
  **/
-namespace.Bookmaak.controller.Controller.removeSetting = function(_key, _type){
+bookmaak.controller.Controller.removeSetting = function(_key, _type){
 	
 	if(typeof _key == 'undefined')
 		throw "_key is undefined.";
 	
 	switch(type) {
 	
-		case namespace.Bookmaak.controller.SETTING_TYPE.USER:
+		case bookmaak.controller.SETTING_TYPE.USER:
 			return removeSetting(SETTINGS_PREFIX_USER, key);
 			break;
 			
-		case namespace.Bookmaak.controller.SETTING_TYPE.GLOBAL:
+		case bookmaak.controller.SETTING_TYPE.GLOBAL:
 			return removeSetting(SETTINGS_PREFIX_GLOBAL, key);
 			break;
 		default:
 
 
 /**
- * namespace.Bookmaak.controller.Controller.register(Object) -> Boolean
+ * bookmaak.controller.Controller.register(Object) -> Boolean
  *
  * To register a new "account".
  * 
  * 			msg: String, textual message, describing the error or success.
  * 		}
  **/
-namespace.Bookmaak.controller.Controller.register = function(registrationData, callback) {
+bookmaak.controller.Controller.register = function(registrationData, callback) {
 	
 	if(typeof callback != typeof Function)
 		throw "callback is undefined or not a function.";
 	var key_length = 128;
 	var symm_key_bytes = new Array(key_length);
 	
-	namespace.Bookmaak.controller.Controller.rng.nextBytes(symm_key_bytes);
+	bookmaak.controller.Controller.rng.nextBytes(symm_key_bytes);
 	
 	var symm_key = pidCryptUtil.byteArray2String(symm_key_bytes);
 	alert("symm_key_b64: " + symm_key.encodeBase64());
 	
 	//create user file with symm key + filename (what will be the file name for this one... maybe the rsa encrypted user identification)
-	var user_file_plain = new namespace.Bookmaak.domain.File(
-			namespace.Bookmaak.controller.FILE_TYPE.USER,
+	var user_file_plain = new bookmaak.domain.File(
+			bookmaak.controller.FILE_TYPE.USER,
 			symm_key);
 	
 	//encrypt the user file with the private key
-	var usrCrypto = new namespace.Bookmaak.crypto.UserCrypto(
+	var usrCrypto = new bookmaak.crypto.UserCrypto(
 			registrationData.rsa_private_key_pem,
 			registrationData.rsa_public_key_pem);
 	
 	var user_file_encrypted = usrCrypto.encryptUserFile(user_file_plain);
 	
 	//send it to the server
-	(new namespace.Bookmaak.comm.Communicator(
+	(new bookmaak.comm.Communicator(
 			registrationData.login,
-			namespace.Bookmaak.controller.Controller.server_url)).sendFile(
+			bookmaak.controller.Controller.server_url)).sendFile(
 					user_file_encrypted,
 					function(result) {
 //						{	
 
 
 /**
- * namespace.Bookmaak.controller.FILE_TYPE = USER | BOOKMARKS
+ * bookmaak.controller.FILE_TYPE = USER | BOOKMARKS
  * 
  * Enumeration of all file  types.
  **/
-namespace.Bookmaak.controller.FILE_TYPE = {
+bookmaak.controller.FILE_TYPE = {
 	
 	USER:		"user",
 	BOOKMARKS:	"bookmarks"
 
 
 /**
- * namespace.Bookmaak.controller.Controller.login(String, Function) -> Boolean
+ * bookmaak.controller.Controller.login(String, Function) -> Boolean
  *
  * To log into an "account"
  * 
  * 			msg: String, textual message, describing the error or success.
  * 		}
  **/
-namespace.Bookmaak.controller.Controller.login = function(login, callback) {
+bookmaak.controller.Controller.login = function(login, callback) {
 	
 	if(typeof callback != typeof Function)
 		throw "callback is undefined or not a function.";
 	
 	
 	//retrieve user file
-	var comm = new namespace.Bookmaak.comm.Communicator(login, namespace.Bookmaak.controller.Controller.server_url);
+	var comm = new bookmaak.comm.Communicator(login, bookmaak.controller.Controller.server_url);
 	//TODO just for testing
-	comm.retrieveFile(namespace.Bookmaak.controller.FILE_TYPE.USER, function(result, file) {
+	comm.retrieveFile(bookmaak.controller.FILE_TYPE.USER, function(result, file) {
 		
 		if(result.success) {
 			
-			namespace.Bookmaak.controller.Controller.login = login;
+			bookmaak.controller.Controller.login = login;
 			callback(result);
 		}
 		else {
 	
 	//on error: return false;
 	
-//	comm.sendFile(new namespace.Bookmaak.domain.File(namespace.Bookmaak.controller.FILE_TYPE.USER, "ich bin ein user file :D"), function(result) {
+//	comm.sendFile(new bookmaak.domain.File(bookmaak.controller.FILE_TYPE.USER, "ich bin ein user file :D"), function(result) {
 //		
 //		if(result.success) {
 //			alert("jo");

src/main/client/crypto/BookmarkCrypto.js

  * 
  * **_symmKey** the symmetric key
  **/
-namespace.Bookmaak.crypto.BookmarkCrypto = function BookmarkCrypto( _symmeKey) {
+bookmaak.crypto.BookmarkCrypto = function BookmarkCrypto( _symmeKey) {
 	
 	var that = this;
 	

src/main/client/crypto/CryptoUtils.js

 /**
- * namespace.Bookmaak.crypto.CryptoUtils
+ * bookmaak.crypto.CryptoUtils
  * 
  * CryptoUtils provides some helper functions dealing with crypto issues
  **/
-namespace.Bookmaak.crypto.CryptoUtils = namespace.Bookmaak.crypto.CryptoUtils || {};
+bookmaak.crypto.CryptoUtils = bookmaak.crypto.CryptoUtils || {};
 
 
 /**
- * namespace.Bookmaak.crypto.CryptoUtils.validate_rsa_private_key_pem(String) -> Boolean
+ * bookmaak.crypto.CryptoUtils.validate_rsa_private_key_pem(String) -> Boolean
  * 
  * Validates the pem formated private key.
  * 
  * **rsa_private_key_pem** the private key in pem format
  * returns true if valid, otherwise false.
  **/
-namespace.Bookmaak.crypto.CryptoUtils.validate_rsa_private_key_pem = function(rsa_private_key_pem) {
+bookmaak.crypto.CryptoUtils.validate_rsa_private_key_pem = function(rsa_private_key_pem) {
 	
 	var rsa_params = {};
 	
-	rsa_params = namespace.Bookmaak.crypto.CryptoUtils.parseCert(rsa_private_key_pem);
+	rsa_params = bookmaak.crypto.CryptoUtils.parseCert(rsa_private_key_pem);
 
 	if(rsa_params.iv
 	&& rsa_params.salt
 
 
 /**
- * namespace.Bookmaak.crypto.CryptoUtils.decryptPrivateKey(Object) -> ASN1
+ * bookmaak.crypto.CryptoUtils.decryptPrivateKey(Object) -> ASN1
  * 
  * **rsa_params** the rsa parameters as follows
  * 	{
  * 	}
  * returns the asn1 object of the private key
  **/
-namespace.Bookmaak.crypto.CryptoUtils.decryptPrivateKey = function(rsa_params) {
+bookmaak.crypto.CryptoUtils.decryptPrivateKey = function(rsa_params) {
 	
 	//new aes-cbc instance
 	var aes = new pidCrypt.AES.CBC();
 
 
 /**
- * namespace.Bookmaak.crypto.CryptoUtils.parseCert(String) -> Object
+ * bookmaak.crypto.CryptoUtils.parseCert(String) -> Object
  * 
  * **cert** the rsa private key as pem string
  * returns the rsa parameters as follows
  * 		rsa_params.b64
  * 	}
  **/
-namespace.Bookmaak.crypto.CryptoUtils.parseCert = function(cert) {
+bookmaak.crypto.CryptoUtils.parseCert = function(cert) {
 	
 	//-----BEGIN RSA PRIVATE KEY-----
 	//Proc-Type: 4,ENCRYPTED

src/main/client/crypto/UserCrypto.js

  * **_rsa_private_key_pem_encrypted** the pem formated encrypted private key
  * **_privateKey** the pem formated public key
  **/
-namespace.Bookmaak.crypto.UserCrypto = function UserCrypto(_rsa_private_key_pem_encrypted, _rsa_public_key_pem) {
+bookmaak.crypto.UserCrypto = function UserCrypto(_rsa_private_key_pem_encrypted, _rsa_public_key_pem) {
 	
 	var that = this;
 	
 	
 	//parse pem
 	var rsa_params = {};
-	rsa_params = namespace.Bookmaak.crypto.CryptoUtils.parseCert(rsa_private_key_pem_encrypted);
+	rsa_params = bookmaak.crypto.CryptoUtils.parseCert(rsa_private_key_pem_encrypted);
 	
 	if(!(rsa_params.iv
 	&& rsa_params.salt
 	else {
 		
 		//decrypt and set
-		var rsa_private_key_asn = namespace.Bookmaak.crypto.CryptoUtils.decryptPrivateKey(rsa_params);
+		var rsa_private_key_asn = bookmaak.crypto.CryptoUtils.decryptPrivateKey(rsa_params);
 		
 		//asn.toHexTree() returns the parameters used for RSA intialization
 		//@returns node: as javascript object tree with hex strings as values
 		
 		var _type = plain_file.type;
 		if(typeof _type == 'undefined'
-			|| _type != namespace.Bookmaak.controller.FILE_TYPE.USER)
+			|| _type != bookmaak.controller.FILE_TYPE.USER)
 			throw "plain_file is undefined or of wrong type";
 		else
 			var type = plain_file.type;
 		
 		var data_encrypted_b64 = pidCryptUtil.encodeBase64(data_encrypted);
 		
-		return new namespace.Bookmaak.domain.File(
+		return new bookmaak.domain.File(
 				type,
 				data_encrypted_b64);
 	 };

src/main/client/dao/BookmarkDao.js

  * **_comm** the communication object
  * **_bookmarkCrypto** the crypto layer object
  **/
-namespace.Bookmaak.dao.BookmarkDao = function BookmarkDao(_fileName, _comm, _bookmarkCrypto) {
+bookmaak.dao.BookmarkDao = function BookmarkDao(_fileName, _comm, _bookmarkCrypto) {
 //here we can allow other types like sql or harddisc access providers
 //TODO change communicator to provider	
 	var that = this;

src/main/client/domain/Bookmark.js

  * **_tags (optional)** a list of tags
  * **_metas (optional)** a list of meta tags retrieved from the page's header
  **/
-namespace.Bookmaak.domain.Bookmark = function Bookmark(_title, _url, _tags, _metas) {
+bookmaak.domain.Bookmark = function Bookmark(_title, _url, _tags, _metas) {
 	
 	var that = this;
 	

src/main/client/domain/File.js

  * **_type** the file type
  * **_data** the content in b64
  **/
-namespace.Bookmaak.domain.File = function File(_type, _data) {
+bookmaak.domain.File = function File(_type, _data) {
 	
 	var that = this;
 	

src/main/client/namespaces.js

 /**
- * namespace
- *
- * namespace the root namespace.
- * ...fact...
- **/
-namespace = window.namespace || {};
-
-
-
-/**
- * namespace.Bookmaak
+ * bookmaak
  *
  * This is our namespace.
  * Here lives the whole bookmark application.
  **/
-namespace.Bookmaak = namespace.Bookmaak || {};
+bookmaak = window.bookmaak || {};
 
 
 /**
- * namespace.Bookmaak.controller
+ * bookmaak.controller
  *
  * The controller layer.
  * Contains the application logic.
  **/
-namespace.Bookmaak.controller = namespace.Bookmaak.controller || {};
+bookmaak.controller = bookmaak.controller || {};
 
 /**
- * namespace.Bookmaak.dao
+ * bookmaak.dao
  *
  * The dao layer.
  * Data access objects provide access to domain objects.
  **/
-namespace.Bookmaak.dao = namespace.Bookmaak.dao || {};
+bookmaak.dao = bookmaak.dao || {};
 
 /**
- * namespace.Bookmaak.ui
+ * bookmaak.ui
  * 
  * The ui layer.
  * Ui displays and gathers information.
  **/
-namespace.Bookmaak.ui = namespace.Bookmaak.ui || {};
+bookmaak.ui = bookmaak.ui || {};
 
 /**
- * namespace.Bookmaak.comm
+ * bookmaak.comm
  * 
  * The comm layer.
  * Contains classes to communicate with the server
  **/
-namespace.Bookmaak.comm = namespace.Bookmaak.comm || {};
+bookmaak.comm = bookmaak.comm || {};
 
 /**
- * namespace.Bookmaak.crypto
+ * bookmaak.crypto
  * 
  * The crypto layer.
  * Contains classes that do cryptographic operations.
  **/
-namespace.Bookmaak.crypto = namespace.Bookmaak.crypto || {};
+bookmaak.crypto = bookmaak.crypto || {};
 
 /**
- * namespace.Bookmaak.domain
+ * bookmaak.domain
  * 
  * The domain layer.
  * Contains classes of domain objects.
  **/
-namespace.Bookmaak.domain = namespace.Bookmaak.domain || {};
+bookmaak.domain = bookmaak.domain || {};

src/main/client/ui/UiController.js

 /**
- * namespace.Bookmaak.ui.UiController
+ * bookmaak.ui.UiController
  * 
  * UiController provides some helper functions to simplify ui tasks
  **/
-namespace.Bookmaak.ui.UiController = namespace.Bookmaak.ui.UiController || {};
+bookmaak.ui.UiController = bookmaak.ui.UiController || {};
 
 
 /**
- * namespace.Bookmaak.ui.UiController.initUi()
+ * bookmaak.ui.UiController.initUi()
  * 
  * Called when document is entirely loaded.
  **/
-namespace.Bookmaak.ui.UiController.initUi = function() {
+bookmaak.ui.UiController.initUi = function() {
 	
 	return function() {
 		
 
 
 /**
- * namespace.Bookmaak.ui.MESSAGE_TYPE = SUCCESS | NOTICE | WARNING | ERROR
+ * bookmaak.ui.MESSAGE_TYPE = SUCCESS | NOTICE | WARNING | ERROR
  * 
  * Enumeration of all message types.
  **/
-namespace.Bookmaak.ui.MESSAGE_TYPE = {
+bookmaak.ui.MESSAGE_TYPE = {
 	
 	SUCCESS:	"success",
 	NOTICE:		"notice",
 
 
 /**
- * namespace.Bookmaak.ui.UiController.printMessage(String[, MESSAGE_TYPE])
+ * bookmaak.ui.UiController.printMessage(String[, MESSAGE_TYPE])
  * 
  * Shows the message and fades it out again.
  * 
  * **_message** the message<br/>
- * **type** enum namespace.Bookmaak.ui.UiController.MESSAGE_TYPE
+ * **type** enum bookmaak.ui.UiController.MESSAGE_TYPE
  **/
-namespace.Bookmaak.ui.UiController.printMessage = function(_message, _type) {
+bookmaak.ui.UiController.printMessage = function(_message, _type) {
 	
 	if(typeof _message == 'undefined')
 		var message = "";
 		var message = _message;
 	
 	if(typeof _type == 'undefined')
-		var type = namespace.Bookmaak.ui.MESSAGE_TYPE.NOTICE;
+		var type = bookmaak.ui.MESSAGE_TYPE.NOTICE;
 	else if(Object.prototype.toString.call(_type) != '[object String]')
-		var type = namespace.Bookmaak.ui.MESSAGE_TYPE.NOTICE;
+		var type = bookmaak.ui.MESSAGE_TYPE.NOTICE;
 	else
 		var type = _type;
 	switch(type) {
-		case namespace.Bookmaak.ui.MESSAGE_TYPE.SUCCESS:
+		case bookmaak.ui.MESSAGE_TYPE.SUCCESS:
 			elem = ".successbox";
 			break;
-		case namespace.Bookmaak.ui.MESSAGE_TYPE.WARNING:
+		case bookmaak.ui.MESSAGE_TYPE.WARNING:
 			elem = ".warningbox";
 			break;
-		case namespace.Bookmaak.ui.MESSAGE_TYPE.ERROR:
+		case bookmaak.ui.MESSAGE_TYPE.ERROR:
 			elem = ".errorbox";
 			break;
 		default:
-		case namespace.Bookmaak.ui.MESSAGE_TYPE.NOTICE:
+		case bookmaak.ui.MESSAGE_TYPE.NOTICE:
 			elem = ".noticebox";
 			break;
 	}
 
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickConnect()
+ * bookmaak.ui.UiController.onClickConnect()
  * 
  * Called when the user clicks connect.
  **/
-namespace.Bookmaak.ui.UiController.onClickConnect = function() {
+bookmaak.ui.UiController.onClickConnect = function() {
 	
 	var server_url = jQuery("#connect_to_url").val();
 
-	namespace.Bookmaak.controller.Controller.probeServer(server_url, function(probe) {
+	bookmaak.controller.Controller.probeServer(server_url, function(probe) {
 		
 		//TODO for debungin
 //		console.log(probe);
 			if(probe.msg != "")
 				success_text += "("+probe.msg+")";
 				
-			namespace.Bookmaak.ui.UiController.printMessage(success_text,
-					namespace.Bookmaak.ui.MESSAGE_TYPE.SUCCESS);
+			bookmaak.ui.UiController.printMessage(success_text,
+					bookmaak.ui.MESSAGE_TYPE.SUCCESS);
 			
 			showConnectViewConnected(server_url);
 			
 				if(probe.msg)
 					error_text += " - "+probe.msg;
 					
-			namespace.Bookmaak.ui.UiController.printMessage(error_text,
-					namespace.Bookmaak.ui.MESSAGE_TYPE.ERROR);
+			bookmaak.ui.UiController.printMessage(error_text,
+					bookmaak.ui.MESSAGE_TYPE.ERROR);
 		}
 	});
 	
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickDisconnect()
+ * bookmaak.ui.UiController.onClickDisconnect()
  * 
  * Called when the user clicks disconnect.
  **/
-namespace.Bookmaak.ui.UiController.onClickDisconnect = function() {
+bookmaak.ui.UiController.onClickDisconnect = function() {
 	
 	//TODO destroy all crypto objects
 	
 
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickLogin()
+ * bookmaak.ui.UiController.onClickLogin()
  * 
  * Called when the user clicks login.
  **/
-namespace.Bookmaak.ui.UiController.onClickLogin = function() {
+bookmaak.ui.UiController.onClickLogin = function() {
 	
 	var re_login = /^\w+$/;
 	
 		|| Object.prototype.toString.call(_login) != "[object String]"
 		|| !re_login.test(_login)) {
 		
-		namespace.Bookmaak.ui.UiController.printMessage(
+		bookmaak.ui.UiController.printMessage(
 				"Login is invalid.",
-				namespace.Bookmaak.ui.MESSAGE_TYPE.ERROR);
+				bookmaak.ui.MESSAGE_TYPE.ERROR);
 	}
 	else {
 		
 		var login = _login;
 		
-		namespace.Bookmaak.controller.Controller.login(login, function(login) {
+		bookmaak.controller.Controller.login(login, function(login) {
 			
 			if(login.success) {
 				
-				namespace.Bookmaak.ui.UiController.printMessage(
+				bookmaak.ui.UiController.printMessage(
 						"Login successful, you may proceed!",
-						namespace.Bookmaak.ui.MESSAGE_TYPE.SUCCESS);
+						bookmaak.ui.MESSAGE_TYPE.SUCCESS);
 				
 				showManageAccountView();
 			}
 			else {
 				
-				namespace.Bookmaak.ui.UiController.printMessage(
+				bookmaak.ui.UiController.printMessage(
 						"Login failed, maybe register first?",
-						namespace.Bookmaak.ui.MESSAGE_TYPE.WARNING);
+						bookmaak.ui.MESSAGE_TYPE.WARNING);
 				
 				showLoginView();
 			}
 	}
 	else if(Object.prototype.toString.call(login) != '[object String]') {
 		
-		alert("namespace.Bookmaak.ui.UiController.showLoginView: "
+		alert("bookmaak.ui.UiController.showLoginView: "
 				+ "da ging was schief, aber keine panic, nix schlimmes");
 		login = "";
 	}
 
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickRegister()
+ * bookmaak.ui.UiController.onClickRegister()
  * 
  * Called when the user clicks register(to begin registration).
  **/
-namespace.Bookmaak.ui.UiController.onClickRegister = function() {
+bookmaak.ui.UiController.onClickRegister = function() {
 	
 	showRegisterView();
 };
 
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickDoRegister()
+ * bookmaak.ui.UiController.onClickDoRegister()
  * 
  * Called when the user clicks register(to finish registration).
  **/
-namespace.Bookmaak.ui.UiController.onClickDoRegister = function() {
+bookmaak.ui.UiController.onClickDoRegister = function() {
 	
 	//get the fields
 	var _login = jQuery('#register_login').val();
 	}
 	
 	//check if usernamen yet exists
-	namespace.Bookmaak.controller.userExists(_login, function(result) {
+	bookmaak.controller.userExists(_login, function(result) {
 		
 		if(typeof result.exists == undefined) {//error occurred
 			
 	
 	
 	//validate private key
-	if(namespace.Bookmaak.crypto.CryptoUtils.validate_rsa_private_key_pem(_private_key)) {
+	if(bookmaak.crypto.CryptoUtils.validate_rsa_private_key_pem(_private_key)) {
 		
 		var rsa_private_key_pem = _private_key;
 		private_key_is_valid = true;
 			rsa_public_key_pem: public_key
 		};
 		
-		namespace.Bookmaak.controller.Controller.register(registrationData, function(result) {
+		bookmaak.controller.Controller.register(registrationData, function(result) {
 			
 			if(result.success) {
 				
-				namespace.Bookmaak.ui.UiController.printMessage(
+				bookmaak.ui.UiController.printMessage(
 						"Registration successful, you may login now!",
-						namespace.Bookmaak.ui.MESSAGE_TYPE.SUCCESS);
+						bookmaak.ui.MESSAGE_TYPE.SUCCESS);
 				
 				//show the login site
 				showLoginView(registrationData.login);
 			else {
 				
 				//TODO check if this is only on network errors the case
-//				namespace.Bookmaak.ui.UiController.printMessage(
+//				bookmaak.ui.UiController.printMessage(
 //						"Registration failed, try again later.<br/>"
 //						+"If the problem persists, contact the servers administrator.",
-//						namespace.Bookmaak.ui.MESSAGE_TYPE.WARNING);
+//						bookmaak.ui.MESSAGE_TYPE.WARNING);
 				error = true;
 			}
 		});
 	//serious errors
 	if(error) {
 		
-		namespace.Bookmaak.ui.UiController.printMessage(
+		bookmaak.ui.UiController.printMessage(
 				"Registration failed, try again later.<br/>"
 				+"If the problem persists, contact the servers administrator.",
-				namespace.Bookmaak.ui.MESSAGE_TYPE.WARNING);
+				bookmaak.ui.MESSAGE_TYPE.WARNING);
 		
 		//back again
 		showRegisterView(registrationData);
 	|| !public_key_is_valid) {
 		
 		//validation errors
-		namespace.Bookmaak.ui.UiController.printMessage(
+		bookmaak.ui.UiController.printMessage(
 				(!login_is_valid ?			"Login is invalid<br/>" : "")
 				+(login_exists ? 			"Login already exists<br/>" : "")
 				+(!private_key_is_valid ?	"Private key is invalid<br/>" : "")
 				+(!public_key_is_valid ?	"Public key is invalid<br/>" : ""),
-				namespace.Bookmaak.ui.MESSAGE_TYPE.ERROR);
+				bookmaak.ui.MESSAGE_TYPE.ERROR);
 		
 		showRegisterView(registrationData);
 	}
 
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickManageBookmarks()
+ * bookmaak.ui.UiController.onClickManageBookmarks()
  * 
  * Called when the user clicks manage bookmarks..
  **/
-namespace.Bookmaak.ui.UiController.onClickManageBookmarks = function() {
+bookmaak.ui.UiController.onClickManageBookmarks = function() {
 	
 	showManageBookmarksView();
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickImportExport()
+ * bookmaak.ui.UiController.onClickImportExport()
  * 
  * Called when the user clicks import/exprot bookmarks..
  **/
-namespace.Bookmaak.ui.UiController.onClickImportExport = function() {
+bookmaak.ui.UiController.onClickImportExport = function() {
 	
 	//TODO implement option "partial"
 	showManageAccountView("#man_opt_import_export");
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickChangeAccount()
+ * bookmaak.ui.UiController.onClickChangeAccount()
  * 
  * Called when the user clicks change account..
  **/
-namespace.Bookmaak.ui.UiController.onClickChangeAccount = function() {
+bookmaak.ui.UiController.onClickChangeAccount = function() {
 	
 	//TODO implement option "partial"
 	showManageAccountView("#man_opt_change_account");
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickDeleteAccount()
+ * bookmaak.ui.UiController.onClickDeleteAccount()
  * 
  * Called when the user clicks delete account..
  **/
-namespace.Bookmaak.ui.UiController.onClickDeleteAccount = function() {
+bookmaak.ui.UiController.onClickDeleteAccount = function() {
 	
 	//TODO implement option "partial"
 	showManageAccountView("#man_opt_delete_account");
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickLogout()
+ * bookmaak.ui.UiController.onClickLogout()
  * 
  * Called when the user clicks logout..
  **/
-namespace.Bookmaak.ui.UiController.onClickLogout = function() {
+bookmaak.ui.UiController.onClickLogout = function() {
 	
 	//TODO implement option "partial"
 	showManageAccountView("#man_opt_logout");
 	}
 	else if(Object.prototype.toString.call(option_to_show) != '[object String]') {
 		
-		alert("namespace.Bookmaak.ui.UiController.showManageAccountView: "
+		alert("bookmaak.ui.UiController.showManageAccountView: "
 				+"da ging was schief, aber keine panic, nix schlimmes");
 		option_to_show = "";
 	}
 
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickBack()
+ * bookmaak.ui.UiController.onClickBack()
  * 
  * Called when the user clicks back(to account manage view)..
  **/
-namespace.Bookmaak.ui.UiController.onClickBack = function() {
+bookmaak.ui.UiController.onClickBack = function() {
 	
 	showManageAccountView();
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onKeyPressSearch()
+ * bookmaak.ui.UiController.onKeyPressSearch()
  * 
  * Called when the user is typing in the search field..
  **/
-namespace.Bookmaak.ui.UiController.onKeyPressSearch = function() {
+bookmaak.ui.UiController.onKeyPressSearch = function() {
 	
 	//TODO get all option values
 	
 	//TODO call the controller to get the result
 	
-	namespace.Bookmaak.ui.UiController.printMessage("(debug) searching...");
+	bookmaak.ui.UiController.printMessage("(debug) searching...");
 	
 	jQuery("#search_result").show();
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickSearchOptionInTitle()
+ * bookmaak.ui.UiController.onClickSearchOptionInTitle()
  * 
  * Called when the user clicks the radio button to search in title..
  **/
-namespace.Bookmaak.ui.UiController.onClickSearchOptionInTitle = function() {
+bookmaak.ui.UiController.onClickSearchOptionInTitle = function() {
 	
 	//get current value
 	var search_in_title = jQuery("#search_option_title").val();
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickSearchOptionInUrl()
+ * bookmaak.ui.UiController.onClickSearchOptionInUrl()
  * 
  * Called when the user clicks the radio button to search in url..
  **/
-namespace.Bookmaak.ui.UiController.onClickSearchOptionInUrl = function() {
+bookmaak.ui.UiController.onClickSearchOptionInUrl = function() {
 	
 	//get current value
 	var search_in_url = jQuery("#search_option_url").val();
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickSearchOptionInTags()
+ * bookmaak.ui.UiController.onClickSearchOptionInTags()
  * 
  * Called when the user clicks the radio button to search in tags..
  **/
-namespace.Bookmaak.ui.UiController.onClickSearchOptionInTags = function() {
+bookmaak.ui.UiController.onClickSearchOptionInTags = function() {
 	
 	//get current value
 	var search_in_tags = jQuery("#search_option_tags").val();
 };
 
 /**
- * namespace.Bookmaak.ui.UiController.onClickSearchOptionInMetas()
+ * bookmaak.ui.UiController.onClickSearchOptionInMetas()
  * 
  * Called when the user clicks the radio button to search in meta tags..
  **/
-namespace.Bookmaak.ui.UiController.onClickSearchOptionInMetas = function() {
+bookmaak.ui.UiController.onClickSearchOptionInMetas = function() {
 	
 	//get current value
 	var search_in_metas = jQuery("#search_option_metas").val();

src/main/client/ui/connect_view.jade

       option(value='http://localhost:1337')
       option(value='http://localhost:6006')
     input(value='connect', type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickConnect()')
+      onClick='bookmaak.ui.UiController.onClickConnect()')
       
   div#connected.hidden
     label(for='connected_to_url')
       | Connected to:
     input#connected_to_url(type='url', disabled)
     input(value='disconnect', type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickDisconnect()')
+      onClick='bookmaak.ui.UiController.onClickDisconnect()')

src/main/client/ui/index.jade

     script(type='text/javascript', src='./javascript/bookmaak.js')
     
     script 
-      jQuery(document).ready(namespace.Bookmaak.ui.UiController.initUi());
+      jQuery(document).ready(bookmaak.ui.UiController.initUi());
       
-  body(onClick='namespace.Bookmaak.controller.Controller.rng.rng_seed_time();',
-    onKeyPress='namespace.Bookmaak.controller.Controller.rng.rng_seed_time();')
+  body(onClick='bookmaak.controller.Controller.rng.rng_seed_time();',
+    onKeyPress='bookmaak.controller.Controller.rng.rng_seed_time();')
     
     div#messages
       div.successbox

src/main/client/ui/login_view.jade

     | Login(just for development):
   input#login(type='text')
   input(value='Login',    type='button',
-    onClick='namespace.Bookmaak.ui.UiController.onClickLogin()')
+    onClick='bookmaak.ui.UiController.onClickLogin()')
   input(value='Register', type='button',
-    onClick='namespace.Bookmaak.ui.UiController.onClickRegister()')
+    onClick='bookmaak.ui.UiController.onClickRegister()')

src/main/client/ui/manage_account_view.jade

 
   div#manage_options
     input(value='Manage bookmarks',        type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickManageBookmarks()')
+      onClick='bookmaak.ui.UiController.onClickManageBookmarks()')
     input(value='Import/export bookmarks', type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickImportExport()')
+      onClick='bookmaak.ui.UiController.onClickImportExport()')
     input(value='Change account',          type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickChangeAccount()')
+      onClick='bookmaak.ui.UiController.onClickChangeAccount()')
     input(value='Delete account',          type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickDeleteAccount()')
+      onClick='bookmaak.ui.UiController.onClickDeleteAccount()')
     input(value='Logout',                  type='button',
-      onClick='namespace.Bookmaak.ui.UiController.onClickLogout()')
+      onClick='bookmaak.ui.UiController.onClickLogout()')
       
   div#manage
     div#man_opt_import_export.man_opt_option.hidden

src/main/client/ui/manage_bookmarks_view.jade

 div#manage_bookmarks_view.hidden.view
   input(value='Back', type='button',
-    onClick='namespace.Bookmaak.ui.UiController.onClickBack()')
+    onClick='bookmaak.ui.UiController.onClickBack()')
     
   div#search_options
     p
     label(for='search_field')
       | Search:
     input#search_field(type='search', autocomplete='on', autofocus,
-      onKeyPress='namespace.Bookmaak.ui.UiController.onKeyPressSearch()')
+      onKeyPress='bookmaak.ui.UiController.onKeyPressSearch()')
     br
     
     label(for='search_option_title')
       | in title
     input#search_option_title(type='checkbox', checked,
-      onClick='namespace.Bookmaak.ui.UiController.onClickSearchOptionInTitle()')
+      onClick='bookmaak.ui.UiController.onClickSearchOptionInTitle()')
       
     label(for='search_option_url')
       | in url
     input#search_option_url(type='checkbox',
-      onClick='namespace.Bookmaak.ui.UiController.onClickSearchOptionInUrl()')
+      onClick='bookmaak.ui.UiController.onClickSearchOptionInUrl()')
     
     label(for='search_option_tags')
       | in tags
     input#search_option_tags(type='checkbox', checked,
-      onClick='namespace.Bookmaak.ui.UiController.onClickSearchOptionInTags()')
+      onClick='bookmaak.ui.UiController.onClickSearchOptionInTags()')
     
     label(for='search_option_metas')
       | in meta tags
     input#search_option_metas(type='checkbox', checked,
-      onClick='namespace.Bookmaak.ui.UiController.onClickSearchOptionInMetas()')
+      onClick='bookmaak.ui.UiController.onClickSearchOptionInMetas()')
       
   div#search_result.hidden
     p

src/main/client/ui/register_view.jade

   br
   br
   input(value='Register', type='button',
-    onClick='namespace.Bookmaak.ui.UiController.onClickDoRegister()')
+    onClick='bookmaak.ui.UiController.onClickDoRegister()')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.