Monday, November 08, 2010 at 12:01 AM.

system.verbs.apps.Manila.windowTypes.getUsernameAndPassword

on getUsernameAndPassword (adrinfo, adrUsername, adrPassword, flAlwaysRunDialog=false) {
	<<Get the username and password for a Manila site. If they're not present, put up a dialog.
		<<Sun, Aug 20, 2000 at 6:29:02 PM by PBS
		<<Changes:
			<<Mon, Sep 11, 2000 at 12:21:45 PM by PBS
				<<New optional parameter -- flAlwaysRunDialog. If true, put up the dialog no matter what.
	
	manila.windowTypes.initSiteInfo (adrinfo); //create site prefs
	local (siteUrl = nameOf (adrinfo^));
	
	on getFromTable (adrTable) {
		adrUsername^ = string (adrTable^.username); //should be binary
		adrPassword^ = string (adrTable^.password)}; //should be binary
	
	if adrinfo^.flSavePassword {
		getFromTable (adrinfo)}
	else { //get from the temp table, where passwords disappear at end of session
		if defined (system.temp.manila.sites) {
			if defined (system.temp.manila.data.sites.[siteUrl]) {
				getFromTable (@system.temp.manila.data.sites.[siteUrl])}}};
	
	if (((adrUsername^ == "") or (adrPassword^ == "")) or flAlwaysRunDialog) { //put up a dialog
		if manila.windowTypes.dialogs.getPassword (adrinfo, adrUsername, adrPassword) {
			manila.windowTypes.setUsernameAndPassword (adrinfo, adrUsername^, adrPassword^)}
		else {
			adrinfo^.username = "";
			adrinfo^.password = "";
			local (tableName = nameOf (adrinfo^));
			try {delete (@system.temp.manila.data.sites.[tableName])};
			return (false)}};
	
	local (flGotPassword = false);
	if (adrUsername^ != "") and (adrPassword^ != "") {
		flGotPassword = true};
	
	adrUsername^ = string (adrUsername^); //scripts want a string
	adrPassword^ = string (adrPassword^);
	
	return (flGotPassword)}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.