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

system.verbs.apps.xmlStorageSystem.nodeTypes.users.commands.getUsersOutline

on getUsersOutline (usersXmlUrl, adroutline = @xmlStorageSystem.data.usersOutline, flSignedOnOnly = true, flMessages = true) {
	<<Changes
		<<Friday, August 04, 2000 at 1:01:06 PM by DW
			<<New script. Builds an outline containing the names of each of the currently signed-on users.
		<<Monday, August 07, 2000 at 1:49:03 PM by DW
			<<Use op.attributes.addgroup to add the attributes to each headline.
		<<Sunday, August 13, 2000 at 12:39:56 AM by DW
			<<Accomodate format changes on OurFavoriteSongs.Com.
		<<Tuesday, August 15, 2000 at 1:00:12 PM by DW
			<<Grab each users' email address from the users.xml file link it into the headline.
		<<Thursday, August 17, 2000 at 10:54:53 AM by DW
			<<If you want a list of all users, call it with flSignedOnOnly false.
		<<Thursday, August 17, 2000 at 8:57:21 PM by DW
			<<Give the top-level headline attributes, of type "users" so you can expand/collapse to refresh it.
		<<Sunday, August 20, 2000 at 6:24:55 PM by DW
			<<If the window already exists, re-use it, so it retains its size and shape. If it's new, zoom it after opening.
		<<Monday, August 21, 2000 at 10:59:48 AM by DW
			<<Sort the user list by name, not by email address.
		<<Saturday, September 02, 2000 at 12:22:22 PM by PBS
			<<Over-ride tcp.httpClient messages.
		<<Wednesday, September 20, 2000 at 2:22:43 PM by PBS
			<<Call playlist.httpClient so the script can accept OPML documents.
		<<Fri, Sep 22, 2000 at 4:52:21 PM by PBS
			<<Check the offline status before getting the users outline.
	if defined (tcp.isOffline) {
		if tcp.isOffline () { //PBS 09/22/00: check offline status
			return (false)}};
	local (flnewoutline = false);
	if not defined (adroutline^) {
		new (outlinetype, adroutline);
		flnewoutline = true};
	local (oldtarget = target.set (adroutline));
	if not flnewoutline {
		op.firstsummit ();
		op.deletesubs ()};
	op.setlinetext (clock.now ());
	bundle { //add atts to the top-level headline
		local (atts);
		new (tabletype, @atts);
		atts.type = "users";
		atts.flSignedOnOnly = flSignedOnOnly;
		atts.xmlUrl = usersXmlUrl;
		op.attributes.addgroup (@atts)};
	if flMessages { //PBS 09/02/00: over-ride tcp.httpClient messages
		if flSignedOnOnly {
			msg ("Getting signed-on users outline...")}
		else {
			msg ("Getting all users outline...")}};
	local (urlParts = string.urlSplit (usersXmlUrl));
	local (port = 80);
	if urlParts[2] contains ":" {
		port = string.nthField (urlParts[2], ':', 2);
		urlParts[2] = string.nthField (urlParts[2], ':', 1)};
	local (xmltext = string.httpResultSplit (tcp.httpClient (server:urlParts[2], port:port, path:urlParts[3], flMessages:false, flAcceptOpml:true)));
	local (xstruct);
	xml.compile (xmltext, @xstruct);
	local (adrusers = xml.getaddress (@xstruct, "users"));
	local (userslist = xml.getaddresslist (adrusers, "user"), adruser, insertdir = right);
	for adruser in userslist {
		op.insert (xml.getattribute (adruser, "name")^, insertdir); insertdir = down;
		local (atts);
		new (tabletype, @atts);
		atts.type = "user";
		atts.url = xml.getattribute (adruser, "url")^;
		atts.email = xml.getattribute (adruser, "email")^;
		atts.userAgent = xml.getattribute (adruser, "userAgent")^;
		atts.whenLoggedOn = xml.getattribute (adruser, "whenLoggedOn")^;
		op.attributes.addgroup (@atts)};
	op.sort ();
	op.firstsummit ();
	if not window.isOpen (adroutline) {
		edit (adroutline, "Users")};
	if flnewoutline {
		window.zoom (adroutline)};
	try {target.set (oldtarget)};
	msg (""); //PBS 09/02/00: clear messages
	return (true)};
bundle { //testing
	getUsersOutline ("http://www.ourfavoritesongs.com/users.xml")}



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.