<commit_before><?xml version="1.0" encoding="UTF-8"?>
<Module>
	<ModulePrefs title="Login" description="Login to Sevianno over LAS server" author="<NAME>, Chair of Computer Science 5, RWTH Aachen University, Germany" author_email="<EMAIL>">
		<!--Require feature="dynamic-height"/-->
		<Require feature="dynamic-height"/>
	</ModulePrefs>
<Content type="html">
<![CDATA[
	<script src="http://open-app.googlecode.com/files/openapp.js"></script>
	<script src="https://role-project.svn.sourceforge.net/svnroot/role-project/trunk/libraries/iwc/src/main/javascript/iwc.js"></script>
	
<link type="text/css" rel="stylesheet" href="https://raw.github.com/DadaMonad/sevianno/master/css/sevianno-style.css"></style>
<script type="application/javascript" src="https://raw.github.com/DadaMonad/sevianno/master/js/jquery-1.10.2.js"></script>
<script type="application/javascript" src="https://raw.github.com/DadaMonad/sevianno/master/js/jquery-ui-1.10.4.custom.js"></script>
<script type="application/javascript" src="https://raw.github.com/DadaMonad/sevianno/master/js/sevianno-draggable.js"></script>
 <script src="http://dbis.rwth-aachen.de/~nicolaescu/fw/widget/jQuery/jquery-1.5.1.min.js"></script>
	<script src="http://role-is.dbis.rwth-aachen.de/lib/container/json2.js" ></script> 
	<script src="http://dbis.rwth-aachen.de/gadgets/lib/las/storage.js"></script> 
	<script src="http://dbis.rwth-aachen.de/gadgets/lib/las/lasAjaxClient.js"></script>
	<script src="https://raw.github.com/nicolaescu/widgetbundles/master/libraries/DUIClient.js"></script>
	
	<script type="text/javascript"> 
	var lasurl = "http://steen.informatik.rwth-aachen.de:9914/";
	// var lasurl = "http://gentileschi.informatik.rwth-aachen.de:9914/";	
	var appCode = "sevianno2.0"; 
	
	var iwcClient;
	var duiClient;
	var waitingForSession = false;
	
	function isiPad(){
				// For use within iPad developer UIWebView
				var ua = navigator.userAgent;
				var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua);
				return isiPad;
			}			
//----------------------------------------------------------------------------------keli	
	function onFinishMig(intent){
		var restoreSession = {
			"component": "",					
			"action": "RESTORE_LAS_SESSION",
			"data":"",
			"dataType":"",
		};
		waitingForSession = true;
		duiClient.publishToUser(intent);
	};
//-------------------------------------------------------------------------------------
			
	var iwcCallback = function(intent){
//-----------------------------------------------------------------------------------keli
		if (intent.action == "GET_LAS_INFO"){
			var status = lasClient.getStatus();
			if (status == "loggedIn"){
				var extras = {
					"userName": lasClient.getUsername(),
					"session": lasClient.getSessionId()
				}
				var resIntent = {
					"component": "",					
					"action": "LAS_INFO",
					"data":"",
					"dataType":"",
					"extras": extras
				}
				duiClient.publishToUser(resIntent);
			}
		}
		if (intent.action == "LAS_SESSION"){
			if (waitingForSession){
				var userName = intent.extras.userName;
				var sessionId = intent.extras.session;
				waitingForSession = false;
				lasClient.setCustomSessionData(sessionId, userName, lasurl, appCode);
			}
		}
	} 
//------------------------------------------------------------------------------------

	function sendIntent(intent) {
				if(iwc.util.validateIntent(intent)) {
					duiClient.sendIntent(intent);
				}
				else {
					alert("Intent not valid!");
				}
	}
		
	var lasFeedbackHandler = function(statusCode, message) { 
	switch(statusCode) { 
	case Enums.Feedback.Success: 
	case Enums.Feedback.Error: 
	case Enums.Feedback.PingError: 
	case Enums.Feedback.InvocationSuccess: 
	case Enums.Feedback.InvocationWorking: 
	case Enums.Feedback.InvocationAbort: 
	case Enums.Feedback.InvocationError: 
	case Enums.Feedback.Success: 
	// ignore above 
	break; 
	case Enums.Feedback.LoginSuccess: //alert("Logged in successfully!"); 
		document.getElementById("loginForm").innerHTML ="";
		document.getElementById("loginRegistration").innerHTML ="";
		document.getElementById("feedbackDiv").innerHTML = message; 
		var sessionId = lasClient.getSessionId();
			
					serviceName= "xmldbxs-context-service";
					methodName ="instantiateContext";
					parametersAsJSONArray = new Array();
					parametersAsJSONArray[0] = {"type": "String", "value": "vc"};
					parametersAsJSONArray[1] = {"type": "String", "value": "v2"};
					lasClient.invoke(serviceName, methodName, parametersAsJSONArray, instantiateContextHandler) ;
					
		var user = lasClient.getUsername();
					/*
					var intent = {
						"component":"",					
						"action":"ACTION_LOGIN",
						"data":"http://example.org",
						"dataType":"text/html",
						"categories":["example1","example2"],
						"flags":["PUBLISH_LOCAL"],
						"extras":{"sessionId":sessionId, "user":user}
					};
				
					sendIntent(intent);
					*/
					
//--------------------------------------------------------------------------------------------keli					
					var intent = {
						"component":"",					
						"action":"LAS_INFO",
						"data":"",
						"dataType":"",
						"extras":{"session":sessionId, "userName":user}
					};
					duiClient.publishToUser(intent);
//-----------------------------------------------------------------------------------------------

					parametersAsJSONArray = new Array();
					parametersAsJSONArray[0] = {"type": "string", "value": "Hello World!"};
					
					//lasClient.invoke
					
				if (isiPad()){
				var intent = {
						"component":"",					
						"action":"ACTION_MOBILE_LOGGED_IN",
						"data":"http://example.org",
						"dataType":"text/html",
						"categosries":["example1","example2"],
					//	"flags":["PUBLISH_GLOBAL"],
						"extras":{"mobileDevice":"iPad"}
					};
				sendIntent(intent);
				}
		document.getElementById("imgDisconnect").setAttribute("style", "");
		document.getElementById("imgConnect").setAttribute("style", "opacity:0.5");	
		document.getElementById("imgDisconnect").onclick = gui_disconnect;
		document.getElementById("imgConnect").onclick = "";	
	break; 
	case Enums.Feedback.LogoutSuccess: //alert("Logged out successfully!"); 
	// For use within normal web clients 
				
				if (isiPad()){
					var intent = {
							"component":"",					
							"action":"ACTION_MOBILE_LOGGED_OUT",
							"data":"http://example.org",
							"dataType":"text/html",
							"categosries":["example1","example2"],
							"flags":["PUBLISH_GLOBAL"],
							"extras":{"mobileDevice":"iPad"}
						};
	//---------------------------------------------------------------------ke li					
					duiClient.publishToUser(intent);	
	//---------------------------------------------------------------------ke li
					//sendIntent(intent);
				}
	
	var intent = {
						"component":"",					
						"action":"ACTION_LOGOUT",
						"data":"http://example.org",
						"dataType":"text/html",
						"flags":["PUBLISH_GLOBAL"]
					};
		sendIntent(intent);
		document.getElementById("loginForm").innerHTML ='<p>Username: <input type="text" name="user" id="user" size="25" value=""/> </p>	<p>Password: <input type="password" name="pass" id="pass" size="25" value=""/> </p>';
		document.getElementById("feedbackDiv").innerHTML = "";
		document.getElementById("imgConnect").setAttribute("style", "");
		document.getElementById("imgDisconnect").setAttribute("style", "opacity:0.5");
		document.getElementById("imgDisconnect").onclick = "";
		document.getElementById("imgConnect").onclick = gui_connect;	
	break; 
	case Enums.Feedback.LoginError: alert("Login failed! Message: " + message); 
	document.getElementById("feedbackDiv").innerHTML = message; 
	break; 
	case Enums.Feedback.LogoutError: alert("Logout failed! Message: " + message); 
	document.getElementById("feedbackDiv").innerHTML = message; 
	break; 
	case Enums.Feedback.Warning: 
	case Enums.Feedback.PingSuccess: 
	// just ignoring this one... 
	break; 
	default: 
	//ignore it.... 
	break; 
	} 
	
	console.log("Feedback: " + statusCode + ", " + message); 
	
	
	
	}; 
	
	function instantiateContextHandler(status, result){
	 console.log(status);
	 console.log(result);
	}
	
	var lasClient = new LasAjaxClient("sevianno",lasFeedbackHandler); 
	
	
	var gui_connect = function() { 
		var user = document.getElementById("user").value; 
		var pass = document.getElementById("pass").value; 
		
		lasClient.login(user, pass, lasurl, appCode); 
					
					
	}
	
	var gui_disconnect = function() { 
		
		lasClient.logout(); 
		
		}
		
		
		
	function init(){
				//iwcClient = new iwc.Client(["*"]);
				//iwcClient.connect(iwcCallback);

//----------------------------------------------------------------------------------keli				
				duiClient = new DUIClient();
				duiClient.connect(iwcCallback);
			//	duiClient.getWidgetState = getState;
			//	duiClient.changeWithApp = changeWithApp;
			//	duiClient.prepareMigration = prepareMig;
			//	duiClient.updateState = onUpdateState;
			//	duiClient.finishMigration = onFinishMig;
				duiClient.initOK();
//--------------------------------------------------------------------------------------
      var fff = function(ev){ 
              if(ev.keyCode === 13) { 
                gui_connect();
              }
      }
      $("#user").keydown(fff);
      $("#pass").keydown(fff);
	}	
	gadgets.util.registerOnLoadHandler(init);
		
	</script> 
	
	<img src="images/sevianno_small.png"/>
		<section id="loginForm">
      <p>Username: <input type="text" name="user" id="user" size="25" value=""/> </p>
      <p>Password: <input type="password" name="pass" id="pass" size="25" value=""/> </p>
		</section>
		
		<section>
			<p>
				<img id="imgConnect" width="16" src="images/connect.png" alt="Connect" title="Connect to LAS" onClick="gui_connect()"/> 
				<img id="imgDisconnect" width="16" src="images/disconnect.png" alt="Disconnect" title="Disconnect from LAS" onClick="gui_disconnect()"/>
			</p>
		</section>
		
		<section id="loginRegistration">
		<a href="http://vermeer.informatik.rwth-aachen.de:9080/LASRegistration/index.jsp" target="_blank">Register here!</a>
		</section>
		
		
		
		<div id="feedbackDiv"> 
		</div>
 <div id="q" style="height: 3px;" />
		
]]>

</Content>
</Module>
<commit_msg>made everything droppable<commit_after><?xml version="1.0" encoding="UTF-8"?>
<Module>
	<ModulePrefs title="Login" description="Login to Sevianno over LAS server" author="<NAME>, Chair of Computer Science 5, RWTH Aachen University, Germany" author_email="<EMAIL>">
		<Require feature="dynamic-height"/>
	</ModulePrefs>
<Content type="html">
<![CDATA[
	<script src="http://open-app.googlecode.com/files/openapp.js"></script>
	<script src="https://role-project.svn.sourceforge.net/svnroot/role-project/trunk/libraries/iwc/src/main/javascript/iwc.js"></script>
	
<link type="text/css" rel="stylesheet" href="https://raw.github.com/DadaMonad/sevianno/master/css/sevianno-style.css"></style>
<script type="application/javascript" src="https://rawgithub.com/DadaMonad/sevianno/master/js/jquery-1.10.2.js"></script>
<script type="application/javascript" src="https://rawgithub.com/DadaMonad/sevianno/master/js/jquery-ui-1.10.4.custom.js"></script>
<script type="application/javascript" src="https://rawgithub.com/DadaMonad/sevianno/master/js/sevianno-draggable.js"></script>
 <script src="http://dbis.rwth-aachen.de/~nicolaescu/fw/widget/jQuery/jquery-1.5.1.min.js"></script>
	<script src="http://role-is.dbis.rwth-aachen.de/lib/container/json2.js" ></script> 
	<script src="http://dbis.rwth-aachen.de/gadgets/lib/las/storage.js"></script> 
	<script src="http://dbis.rwth-aachen.de/gadgets/lib/las/lasAjaxClient.js"></script>
	<script src="https://raw.github.com/nicolaescu/widgetbundles/master/libraries/DUIClient.js"></script>
	
	<script type="text/javascript"> 
	var lasurl = "http://steen.informatik.rwth-aachen.de:9914/";
	// var lasurl = "http://gentileschi.informatik.rwth-aachen.de:9914/";	
	var appCode = "sevianno2.0"; 
	
	var iwcClient;
	var duiClient;
	var waitingForSession = false;
	
	function isiPad(){
				// For use within iPad developer UIWebView
				var ua = navigator.userAgent;
				var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua);
				return isiPad;
			}			
//----------------------------------------------------------------------------------keli	
	function onFinishMig(intent){
		var restoreSession = {
			"component": "",					
			"action": "RESTORE_LAS_SESSION",
			"data":"",
			"dataType":"",
		};
		waitingForSession = true;
		duiClient.publishToUser(intent);
	};
//-------------------------------------------------------------------------------------
			
	var iwcCallback = function(intent){
//-----------------------------------------------------------------------------------keli
		if (intent.action == "GET_LAS_INFO"){
			var status = lasClient.getStatus();
			if (status == "loggedIn"){
				var extras = {
					"userName": lasClient.getUsername(),
					"session": lasClient.getSessionId()
				}
				var resIntent = {
					"component": "",					
					"action": "LAS_INFO",
					"data":"",
					"dataType":"",
					"extras": extras
				}
				duiClient.publishToUser(resIntent);
			}
		}
		if (intent.action == "LAS_SESSION"){
			if (waitingForSession){
				var userName = intent.extras.userName;
				var sessionId = intent.extras.session;
				waitingForSession = false;
				lasClient.setCustomSessionData(sessionId, userName, lasurl, appCode);
			}
		}
	} 
//------------------------------------------------------------------------------------

	function sendIntent(intent) {
				if(iwc.util.validateIntent(intent)) {
					duiClient.sendIntent(intent);
				}
				else {
					alert("Intent not valid!");
				}
	}
		
	var lasFeedbackHandler = function(statusCode, message) { 
	switch(statusCode) { 
	case Enums.Feedback.Success: 
	case Enums.Feedback.Error: 
	case Enums.Feedback.PingError: 
	case Enums.Feedback.InvocationSuccess: 
	case Enums.Feedback.InvocationWorking: 
	case Enums.Feedback.InvocationAbort: 
	case Enums.Feedback.InvocationError: 
	case Enums.Feedback.Success: 
	// ignore above 
	break; 
	case Enums.Feedback.LoginSuccess: //alert("Logged in successfully!"); 
		document.getElementById("loginForm").innerHTML ="";
		document.getElementById("loginRegistration").innerHTML ="";
		document.getElementById("feedbackDiv").innerHTML = message; 
		var sessionId = lasClient.getSessionId();
			
					serviceName= "xmldbxs-context-service";
					methodName ="instantiateContext";
					parametersAsJSONArray = new Array();
					parametersAsJSONArray[0] = {"type": "String", "value": "vc"};
					parametersAsJSONArray[1] = {"type": "String", "value": "v2"};
					lasClient.invoke(serviceName, methodName, parametersAsJSONArray, instantiateContextHandler) ;
					
		var user = lasClient.getUsername();
					/*
					var intent = {
						"component":"",					
						"action":"ACTION_LOGIN",
						"data":"http://example.org",
						"dataType":"text/html",
						"categories":["example1","example2"],
						"flags":["PUBLISH_LOCAL"],
						"extras":{"sessionId":sessionId, "user":user}
					};
				
					sendIntent(intent);
					*/
					
//--------------------------------------------------------------------------------------------keli					
					var intent = {
						"component":"",					
						"action":"LAS_INFO",
						"data":"",
						"dataType":"",
						"extras":{"session":sessionId, "userName":user}
					};
					duiClient.publishToUser(intent);
//-----------------------------------------------------------------------------------------------

					parametersAsJSONArray = new Array();
					parametersAsJSONArray[0] = {"type": "string", "value": "Hello World!"};
					
					//lasClient.invoke
					
				if (isiPad()){
				var intent = {
						"component":"",					
						"action":"ACTION_MOBILE_LOGGED_IN",
						"data":"http://example.org",
						"dataType":"text/html",
						"categosries":["example1","example2"],
					//	"flags":["PUBLISH_GLOBAL"],
						"extras":{"mobileDevice":"iPad"}
					};
				sendIntent(intent);
				}
		document.getElementById("imgDisconnect").setAttribute("style", "");
		document.getElementById("imgConnect").setAttribute("style", "opacity:0.5");	
		document.getElementById("imgDisconnect").onclick = gui_disconnect;
		document.getElementById("imgConnect").onclick = "";	
	break; 
	case Enums.Feedback.LogoutSuccess: //alert("Logged out successfully!"); 
	// For use within normal web clients 
				
				if (isiPad()){
					var intent = {
							"component":"",					
							"action":"ACTION_MOBILE_LOGGED_OUT",
							"data":"http://example.org",
							"dataType":"text/html",
							"categosries":["example1","example2"],
							"flags":["PUBLISH_GLOBAL"],
							"extras":{"mobileDevice":"iPad"}
						};
	//---------------------------------------------------------------------ke li					
					duiClient.publishToUser(intent);	
	//---------------------------------------------------------------------ke li
					//sendIntent(intent);
				}
	
	var intent = {
						"component":"",					
						"action":"ACTION_LOGOUT",
						"data":"http://example.org",
						"dataType":"text/html",
						"flags":["PUBLISH_GLOBAL"]
					};
		sendIntent(intent);
		document.getElementById("loginForm").innerHTML ='<p>Username: <input type="text" name="user" id="user" size="25" value=""/> </p>	<p>Password: <input type="password" name="pass" id="pass" size="25" value=""/> </p>';
		document.getElementById("feedbackDiv").innerHTML = "";
		document.getElementById("imgConnect").setAttribute("style", "");
		document.getElementById("imgDisconnect").setAttribute("style", "opacity:0.5");
		document.getElementById("imgDisconnect").onclick = "";
		document.getElementById("imgConnect").onclick = gui_connect;	
	break; 
	case Enums.Feedback.LoginError: alert("Login failed! Message: " + message); 
	document.getElementById("feedbackDiv").innerHTML = message; 
	break; 
	case Enums.Feedback.LogoutError: alert("Logout failed! Message: " + message); 
	document.getElementById("feedbackDiv").innerHTML = message; 
	break; 
	case Enums.Feedback.Warning: 
	case Enums.Feedback.PingSuccess: 
	// just ignoring this one... 
	break; 
	default: 
	//ignore it.... 
	break; 
	} 
	
	console.log("Feedback: " + statusCode + ", " + message); 
	
	
	
	}; 
	
	function instantiateContextHandler(status, result){
	 console.log(status);
	 console.log(result);
	}
	
	var lasClient = new LasAjaxClient("sevianno",lasFeedbackHandler); 
	
	
	var gui_connect = function() { 
		var user = document.getElementById("user").value; 
		var pass = document.getElementById("pass").value; 
		
		lasClient.login(user, pass, lasurl, appCode); 
					
					
	}
	
	var gui_disconnect = function() { 
		
		lasClient.logout(); 
		
		}
		
		
		
	function init(){
				//iwcClient = new iwc.Client(["*"]);
				//iwcClient.connect(iwcCallback);

//----------------------------------------------------------------------------------keli				
				duiClient = new DUIClient();
				duiClient.connect(iwcCallback);
			//	duiClient.getWidgetState = getState;
			//	duiClient.changeWithApp = changeWithApp;
			//	duiClient.prepareMigration = prepareMig;
			//	duiClient.updateState = onUpdateState;
			//	duiClient.finishMigration = onFinishMig;
				duiClient.initOK();
//--------------------------------------------------------------------------------------
      var fff = function(ev){ 
              if(ev.keyCode === 13) { 
                gui_connect();
              }
      }
      $("#user").keydown(fff);
      $("#pass").keydown(fff);
	}	
	gadgets.util.registerOnLoadHandler(init);
		
	</script> 
	
	<img src="images/sevianno_small.png"/>
		<section id="loginForm">
      <p>Username: <input type="text" name="user" id="user" size="25" value=""/> </p>
      <p>Password: <input type="password" name="pass" id="pass" size="25" value=""/> </p>
		</section>
		
		<section>
			<p>
				<img id="imgConnect" width="16" src="images/connect.png" alt="Connect" title="Connect to LAS" onClick="gui_connect()"/> 
				<img id="imgDisconnect" width="16" src="images/disconnect.png" alt="Disconnect" title="Disconnect from LAS" onClick="gui_disconnect()"/>
			</p>
		</section>
		
		<section id="loginRegistration">
		<a href="http://vermeer.informatik.rwth-aachen.de:9080/LASRegistration/index.jsp" target="_blank">Register here!</a>
		</section>
		
		
		
		<div id="feedbackDiv"> 
		</div>
 <div id="q" style="height: 3px;" />
		
]]>

</Content>
</Module>

{'fraction_non_alphanumeric': 0.23553226958799714, 'fraction_numerical': 0.006191950464396285, 'mean_word_length': 2.3364055299539173, 'pattern_counts': {'":': 108, '<': 130, '<?xml version=': 2, '>': 130, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '279265', 'n_tokens_mistral': 7806, 'n_tokens_neox': 6351, 'n_words': 976}