My package wiki v0.3 - http://developer.symbian.org/wiki/index.php/My_Package_Widget#Current_version
authorvictorp@symbian.org
Thu, 06 May 2010 13:01:45 +0100
changeset 44 48bcd0bbc1ab
parent 43 a6c61f6ea350
child 48 02d03cbfc733
My package wiki v0.3 - http://developer.symbian.org/wiki/index.php/My_Package_Widget#Current_version
mypackage_wrt/ForumPostForm.js
mypackage_wrt/Info.plist
mypackage_wrt/Login.js
mypackage_wrt/Main.js
mypackage_wrt/RssReader.js
mypackage_wrt/builds.js
mypackage_wrt/package dashboard.wgz
--- a/mypackage_wrt/ForumPostForm.js	Wed May 05 11:52:23 2010 +0100
+++ b/mypackage_wrt/ForumPostForm.js	Thu May 06 13:01:45 2010 +0100
@@ -324,7 +324,9 @@
 		else {
 			settings.previousView = uiManager.currentView;
 		}
-		uiManager.hideNotification();
+		if (isHideNotifications) {
+			uiManager.hideNotification();
+		}
 		settings.show();
 }
 
--- a/mypackage_wrt/Info.plist	Wed May 05 11:52:23 2010 +0100
+++ b/mypackage_wrt/Info.plist	Thu May 06 13:01:45 2010 +0100
@@ -7,7 +7,7 @@
         <key>Identifier</key>
         <string>mypackage.org.symbian.developer.widget</string>
         <key>Version</key>
-        <string>0.2a</string>
+        <string>0.3</string>
         <key>MainHTML</key>
         <string>index.html</string>
         <key>AllowNetworkAccess</key>
--- a/mypackage_wrt/Login.js	Wed May 05 11:52:23 2010 +0100
+++ b/mypackage_wrt/Login.js	Thu May 06 13:01:45 2010 +0100
@@ -12,9 +12,12 @@
 var loginUrlContent = null;
 var loginUrlHttpReq = null;
 var loginCallback = null;
+var logincompleted=null;
+
 
 var isHideNotifications = true;
 function login(callback){
+	debuglog.debug("Starting login");
 	if ( forumUsername == null || forumPassword == null ) {
 		loginInitiated = true;
 		loginInitiatedCallback = callback;
@@ -24,6 +27,7 @@
 	loginCallback = callback;
 	loginInitiated = false;
 	loginInitiatedCallback = null;
+	//sflogout();
 	uiManager.showNotification(-1, "wait", "Please wait...", -1);	
 	
 	var parameters =  symbianOrgLoginUsernameField + "=" + forumUsername
@@ -32,6 +36,7 @@
 			  + "&referrer="+symbianOrgBaseUrl;
 	loginUrlHttpReq = new Ajax();
     loginUrlHttpReq.onreadystatechange = loginComplete;
+
 	
     // initiate the request
 	loginUrlHttpReq.open('POST', symbianOrgLoginUrl +"?referer="+symbianOrgBaseUrl, true);
@@ -42,7 +47,15 @@
 	loginUrlHttpReq.send(parameters);
 }
 
+function loginfailed(myerror){
+	debuglog.debug("login failed with error " + myerror);
+	uiManager.showNotification(2000, "warning", "Login failed "+ myerror);
+	isHideNotifications=false;
+	//promptForPassword();
+	
+}
 function loginComplete(){
+	debuglog.debug("login completed called");
 	if ( loginUrlHttpReq == null ) {
 		return;
 	}
@@ -54,13 +67,18 @@
         responseStatus = loginUrlHttpReq.status;
     } catch (noStatusException) {}
     if (readyState == 4) {
-
+		debuglog.debug("ready state found");
 		if (responseStatus < 300) {
 			
 			var content = loginUrlHttpReq.responseText;
+			if (content.indexOf("<title>Symbian developer community - log in</title>")!=-1) {
+				loginfailed("- Bad Credentials");
+				return;
+			}
+			
 			if (content.indexOf("LoginWelcome") == -1) {
-				uiManager.showNotification(3000, "warning", "Login failed.");
-				promptForPassword();
+				loginfailed(null);
+				return;
 			}
 			else {
 				if (loginCallback != null) {
@@ -72,15 +90,13 @@
 			    vbCookieGet.onreadystatechange = forumCookieHarvestComplete;
 				vbCookieGet.open('GET', vburl, true);
 				vbCookieGet.send(null);
-			}
+				}
 		} else if (responseStatus < 400) {
 			// do nothing, this must be a redirect
 		} else {
-			uiManager.hideNotification();
-			uiManager.showNotification(3000, "warning", "Login failed.");
-			promptForPassword();
+			loginfailed("- HTTP error " + responseStatus);
 		}
-    }
+    } 
 }
 
 function forumCookieHarvestComplete () {
@@ -88,4 +104,7 @@
 		uiManager.hideNotification();
 	}
 	isHideNotifications = true;
+	logincompleted=true;
+	debuglog.debug("cookie harvested");
 }
+
--- a/mypackage_wrt/Main.js	Wed May 05 11:52:23 2010 +0100
+++ b/mypackage_wrt/Main.js	Thu May 06 13:01:45 2010 +0100
@@ -14,6 +14,7 @@
 
 // Reference to the WRTKit user interface manager and main view.
 var uiManager;
+var debuglog=null;
 
 // Global settings / URLs and such
 
@@ -30,6 +31,7 @@
 var symbianOrgNewThreadUrl = symbianOrgBaseUrl+"/forum/newthread.php?";
 var symbianOrgNewReplyUrl = symbianOrgBaseUrl+"/forum/newreply.php?";
 var symbianOrgLoginUrl = symbianOrgBaseUrlSsl+"/main/user_profile/login.php";
+var symbianOrgLogoutUrl = symbianOrgBaseUrl+"/action/logoutAction.php";
 var symbianOrgLoginUsernameField = "username";
 var symbianOrgLoginPasswordField = "password";
 var forumUsername = null;
@@ -56,7 +58,7 @@
 var wikiBaseUrl = symbianOrgBaseUrl+"/wiki/index.php";
 
 // Update variables
-var myversion = "0.2a";
+var myversion = "0.3";
 var versionWikiPageUrl = wikiBaseUrl + "/My_Package_Widget";
 var versionWikiPageString = "Current widget version is [";
 var downloadUrl = "http://tiny.symbian.org/mypackage";
@@ -114,8 +116,10 @@
 
 // Called from the onload event handler to initialize the widget.
 function init() {
-	
-    // set tab-navigation mode and show softkeys
+	 debuglog= new Logger();
+	 debuglog.level=debuglog.LOG_LEVEL_DEBUG;
+	 
+	// set tab-navigation mode and show softkeys
     // (only if we are in the WRT environment)
     if (window.widget) {
         widget.setNavigationEnabled(false);
@@ -313,8 +317,9 @@
 	
 	if ( loginInitiated ) {
 		login(loginInitiatedCallback);
+		bugzilla.update(firstboot);
 	}
-	bugzilla.update(firstboot);
+	login(bugzilla.update(firstboot));
 }
 
 // Opens a URL in a separate browser window
--- a/mypackage_wrt/RssReader.js	Wed May 05 11:52:23 2010 +0100
+++ b/mypackage_wrt/RssReader.js	Thu May 06 13:01:45 2010 +0100
@@ -58,7 +58,7 @@
 			}
 			this.feedPresenter.addFooterItems();
 		}
-		uiManager.hideNotification();
+		if (isHideNotifications) {uiManager.hideNotification();}
 		//code to update feeds
 		if (this.UpdateButton) {
 			this.UpdateButton.setText( this.ButtonText + " (" + this.feedItemControls.length + ")");
@@ -140,6 +140,8 @@
 				});
 	    }
 		uiManager.showNotification(-1, "wait", "Loading feed...", -1);
+		isHideNotifications=true;
+		
 	}
 }
 
--- a/mypackage_wrt/builds.js	Wed May 05 11:52:23 2010 +0100
+++ b/mypackage_wrt/builds.js	Thu May 06 13:01:45 2010 +0100
@@ -54,7 +54,8 @@
 		var content = BuildpageAjax.responseText;
 		var ind = content.indexOf(startbuild);
 		if (ind == -1) {
-			uiManager.showNotification(3000, "warning", "Failed to find start.");
+			uiManager.showNotification(3000, "Warning", "Build Results - Package Not Found");
+			debuglog.debug("Build package page with wrong format");
 			return;
 		}
 	
@@ -80,7 +81,7 @@
 			ind3 = content.indexOf("</h4>",ind2);
 		}
 				
-		uiManager.hideNotification();
+		//uiManager.hideNotification();
 		
 	}
 	
Binary file mypackage_wrt/package dashboard.wgz has changed