|
From: creedon <icr...@us...> - 2006-02-06 00:20:45
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10012 Modified Files: revert close new openUrl save viewInBrowser saveAs saveAsHtml open saveAsPlainText Log Message: update run callbacks to deal with the callback table not being there Index: saveAs =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands/saveAs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** saveAs 1 Nov 2005 19:21:37 -0000 1.3 --- saveAs 6 Feb 2006 00:20:38 -0000 1.4 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.saveAs ! on saveAs (adrItem=nil) { ÇChanges Ç11/1/05; 9:30:04 AM by TAC Çfix for items created with New menu not being saved when using File menu Save As menu item in Frontier Ç9/21/05; 11:34:38 AM by TAC Çchanged to actually do a save as, as opposed to a save Çonly do export for non Frontier envrionments ÇHandle the Save As command. if adrItem == nil { //default to frontmost window adrItem = window.frontmost ()}; on saveDatabaseAs () { local (f = file.fileFromPath (window.getFile (table.getRootAddress (adrItem)))); if file.putFileDialog ("", @f) { fileMenu.saveCopy (f)}}; if not defined (adrItem^) { // save root adrItem = @root; saveDatabaseAs (); return (true)}; on runCallbacks (adrCallback) { //call callbacks if defined (adrCallback^) { local (flConsumed = false); local (adrScript); for adrScript in adrCallback { try { //11/30/00 JES while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; flConsumed = adrScript^ (adrItem, flClosing)}; if flConsumed { return (true)}}}; return (false)}; if runCallbacks (@user.tools.commandCallbacks.saveAs) { return (true)}; if system.environment.isRadio { if defined (user.pike.commandCallbacks) { if runCallbacks (@user.pike.commandCallbacks.saveAs) { return (true)}}}; bundle { //look for a windowType that handles this command local (type, adrType); if window.attributes.getOne ("type", @type, adrItem) { if Frontier.tools.windowTypes.findWindowType (type, @adrType, adrItem) { if defined (adrType^.save) { if adrType^.saveAs (adrItem) { window.attributes.setOne ("lastSaved", timeModified (adrItem), adrItem); saveDatabase (); return (true)} else { return (false)}}}}}; if system.environment.isRadio { bundle { //if this is an outline window, save as an opml file local (adrType); if Frontier.tools.windowTypes.findWindowType ("outlinerFile", @adrType) { if adrType^.saveAs (adrItem) { return (true)}}}; export.commands.export ()}; // Do we want to call the odb-export code here? if not (system.environment.isRadio) { // save windows created by the new menu or opened from the file system local (f = window.getFile (adrItem)); if f == "" or file.type (f) != 'TABL' { return (fileMenu.saveAs ())}}; saveDatabaseAs (); return (true)}; Çbundle // testing ÇsaveAs () \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.saveAs ! on saveAs (adrItem=nil) { ÇChanges Ç2/5/06; 11:14:02 AM by TAC Çupdate run callbacks to deal with the callback table not being there Ç11/1/05; 9:30:04 AM by TAC Çfix for items created with New menu not being saved when using File menu Save As menu item in Frontier Ç9/21/05; 11:34:38 AM by TAC Çchanged to actually do a save as, as opposed to a save Çonly do export for non Frontier envrionments ÇHandle the Save As command. if adrItem == nil { //default to frontmost window adrItem = window.frontmost ()}; on saveDatabaseAs () { local (f = file.fileFromPath (window.getFile (table.getRootAddress (adrItem)))); if file.putFileDialog ("", @f) { fileMenu.saveCopy (f)}}; if not defined (adrItem^) { // save root adrItem = @root; saveDatabaseAs (); return (true)}; on runCallbacks (stringAddress) { //call callbacks if defined (stringAddress^) { local (flConsumed = false); local (adrScript); for adrScript in @stringAddress^ { try { //11/30/00 JES while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; flConsumed = adrScript^ (adrItem, flClosing)}; if flConsumed { return (true)}}}; return (false)}; if runCallbacks ("user.tools.commandCallbacks.saveAs") { return (true)}; if system.environment.isRadio { if runCallbacks ("user.pike.commandCallbacks.saveAs") { return (true)}}; bundle { //look for a windowType that handles this command local (type, adrType); if window.attributes.getOne ("type", @type, adrItem) { if Frontier.tools.windowTypes.findWindowType (type, @adrType, adrItem) { if defined (adrType^.save) { if adrType^.saveAs (adrItem) { window.attributes.setOne ("lastSaved", timeModified (adrItem), adrItem); saveDatabase (); return (true)} else { return (false)}}}}}; if system.environment.isRadio { bundle { //if this is an outline window, save as an opml file local (adrType); if Frontier.tools.windowTypes.findWindowType ("outlinerFile", @adrType) { if adrType^.saveAs (adrItem) { return (true)}}}; export.commands.export ()}; // Do we want to call the odb-export code here? if not (system.environment.isRadio) { // save windows created by the new menu or opened from the file system local (f = window.getFile (adrItem)); if f == "" or file.type (f) != 'TABL' { return (fileMenu.saveAs ())}}; saveDatabaseAs (); return (true)}; Çbundle // testing ÇsaveAs () \ No newline at end of file Index: openUrl =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands/openUrl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** openUrl 26 Mar 2005 19:42:54 -0000 1.1.1.1 --- openUrl 6 Feb 2006 00:20:38 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.openUrl ! on openUrl (url=nil, flOpenInPlace=false, adroutline=nil) { ÇCalled when the user chooses Open URL... from the File menu. Handle RSS, outlineDocuments, and .xml. (Have to handle .xml because we can't differentiate it from outlineDocuments based on URL alone.) ÇWed, Aug 30, 2000 at 9:15:27 PM by PBS ÇChanges: Ç6/4/02; 3:58:23 PM by JES ÇWhen opening an OPML file, save the ownerName and ownerEmail from the head in the cache, and set corresponding windowType attributes. Ç6/1/02; 7:31:55 PM by JES ÇChanged the requirement that the URL's extension represents a type that can be opened in the outliner, so that if a key string like rss or opml is present anywhere in the URL, Radio will get a shot at opening the URL in the outliner. Fixes opening of Moreover's RSS feeds in Radio's outliner, for example. Ç5/15/02; 6:09:24 PM by JES ÇIf an address is passed in for adroutline, and the object specified by url cannot be converted to an outline, throw an error. Ç4/18/02; 4:27:35 PM by JES ÇWhen opening an RSS file, create the new window as read-only. Ç3/31/02; 7:36:52 PM by JES ÇFixed a bug which would cause an error opening an outline: flAcceptOpml has already been given a value. Ç3/31/02; 6:27:06 PM by JES ÇCall tcp.httpClient with flAcceptOpml true. Ç3/26/02; 11:02:59 PM by JES ÇFor opml and rss, if there's a cloud element, add it and the adrCloud attributes to the window. Ç3/24/02; 5:50:17 PM by JES ÇIf xmltext is defined in the cache table, use that text instead of reading the URL, and then delete the cached text. Ç3/24/02; 12:58:27 AM by JES ÇNew optional parameter, adroutline, specifies the address of the object to load the outline into. Ç3/23/02; 3:40:14 PM by JES ÇOptimization: Cache the type, so we don't have to store xmltext or xstruct in the cache table. Ç3/23/02; 2:30:20 PM by JES ÇImplement size-based caching of RSS and OPML outlines. If the file's size is different from the size of the cached copy, we reload it. Size is determined by requesting only the HTTP headers from the server, if possible. Ç12/1/01; 5:16:14 PM by JES ÇWhen inserting sub-outlines, temporarily set outline display to false, so screen updates will be smoother. Ç11/5/01; 4:37:01 PM by JES ÇFixed a bug opening urls like http://www.scripting.com/. They have no extension, so we have to read the url to determine the docType. Ç10/28/01; 6:12:44 PM by JES ÇOnly read the url if the extension matches one of the extensionsToOpenInRadio: xml, opml, rss and rdf. (More may be added later.) Ç10/22/01; 5:04:48 PM by JES ÇFollow redirects when opening the URL. Ç10/22/01; 4:55:58 PM by JES ÇFix bug when adding Manila site node: the port and server attributes were reversed in the call to playlist.manila.commands.addManilaSiteNode. Ç08/10/01; 8:43:47 PM by JES ÇNew optional parameter, flOpenInPlace. If true, outline type windows are inserted as a sub-heading of the frontmost outline window. Ç12/31/00; 5:32:12 PM by JES ÇOn Macs, convert opml to Mac text when converting to an outline. Ç11/30/00; 12:16:04 AM by JES ÇDereference callback addresses in a try block in case a tool's odb is not opened Ç09/30/00; 12:37:16 PM by PBS ÇCall callbacks at user.pike.commandCallbacks.openUrl. Ç09/22/00; 4:57:55 PM by PBS ÇCheck offline status. Ç09/20/00; 2:04:28 PM by PBS ÇCall playlist.httpClient rather than tcp.httpClient. Ç09/16/00; 11:20:13 AM by PBS ÇOpen HTML files in the Web browser. Ç09/16/00; 3:42:06 PM by PBS ÇOpen OPML documents the same way outlineDocuments are opened. local (flOnline = true); if defined (tcp.isOffline) { flOnline = not (tcp.isOffline ())}; if not flOnline { //PBS 09/22/00: check offline status return (false)}; if url == nil { if defined (user.tools.prefs.lastOpenedUrl) { url = user.tools.prefs.lastOpenedUrl} else { if defined (user.tools.prefs.lastRssUrl) { url = user.tools.prefs.lastRssUrl} else { if defined (user.tools.prefs.lastOutlineUrl) { url = user.tools.prefs.lastOutlineUrl}}}; if not (dialog.ask ("Open URL:", @url)) { return (false)}}; bundle { //clean up the URL if not (string.lower (url) contains "://") { url = "http://" + url}; try { //check to see if it needs a trailing slash string.urlSplit (url)} else { url = url + "/"}}; if url contains " " { url = string.replaceAll (url, " ", "%20")}; //many outlineDocument URLs have spaces in them local (frontWindow = window.frontmost ()); on runCallbacks (adrCallback) { //call callbacks if defined (adrCallback^) { local (adrScript); for adrScript in adrCallback { try { //11/30/00 JES while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; if adrScript^ (url) { return (true)}}}}; return (false)}; if runCallbacks (@user.tools.commandCallbacks.openUrl) { return (true)}; if system.environment.isRadio { if defined (user.pike.commandCallbacks.openUrl) { if runCallbacks (@user.pike.commandCallbacks.openUrl) { return (true)}}}; local (urllist = string.urlsplit (url)); Çlocal (extension = string.lower (string.nthField (urllist[3], ".", string.countFields (urllist[3], ".")))) local (extensionsToOpenInRadio = {"xml", "opml", "rss", "rdf"}); local (flOpenInRadio = false); bundle { //set flOpenInRadio local (ext, lowerUrl = string.lower (url)); for ext in extensionsToOpenInRadio { if lowerUrl contains ext { flOpenInRadio = true; break}}}; if flOpenInRadio { local (adrincache); on isDocType (typeName) { if defined (adrincache^.type) { if adrincache^.type == typeName { if defined (adrincache^.xstruct) { delete (@adrincache^.xstruct)}; return (true)}}; if defined (adrincache^.xstruct) { //get the type, and cache the cloud info if available try { local (adrtopelement = xml.getAddress (@adrincache^.xstruct, typeName)); adrincache^.type = typeName; try { //if there's a cloud element, create a cloud table in the cache local (adrcloud); case adrincache^.type { "opml" { local (adrhead = xml.getAddress (adrtopelement, "head")); adrcloud = xml.getAddress (adrhead, "cloud")}; "rss" { local (adrchannel = xml.getAddress (adrtopelement, "channel")); adrcloud = xml.getAddress (adrchannel, "cloud")}}; if adrcloud != nil { local (adrcloudatts = @adrcloud^.["/atts"]); new (tableType, @adrincache^.cloud); local (nomad); for nomad in adrcloudatts { adrincache^.cloud.[nameOf (nomad^)] = nomad^}}}; delete (@adrincache^.xstruct); return (true)}}; return (false)}; on getTextFromUrl (url) { //get xmltext, set adrincache local (adrcache = @system.temp.frontier.openUrlCache); if not defined (adrcache^) { new (tableType, adrcache)}; adrincache = @adrcache^.[url]; if not defined (adrincache^) { new (tableType, adrincache)}; if not defined (adrincache^.ctXmlBytes) { adrincache^.ctXmlBytes = 0}; local (urllist = string.urlsplit (url)); local (s = "", headertext, resultheaders, flgotsizefastway = false, sizexmltext); if defined (adrincache^.xmltext) { sizexmltext = sizeOf (adrincache^.xmltext); flgotsizefastway = true} else { headertext = tcp.httpClient (server:urllist [2], path:urllist [3], ctFollowRedirects:5, flMessages:false, flJustHeaders:true, flAcceptOpml:true); new (tabletype, @resultheaders); webserver.util.parseHeaders (headertext, @resultheaders); if defined (resultheaders.["Content-Length"]) { try { sizexmltext = number (resultheaders.["Content-Length"]); flgotsizefastway = true}}}; if not flgotsizefastway { s = string.httpResultSplit (tcp.httpClient (server:urllist [2], path:urllist [3], ctFollowRedirects:5, flAcceptOpml:true)); sizexmltext = sizeof (s)}; if adrincache^.ctXmlBytes != sizexmltext { if s == "" { //we haven't read the xml yet if defined (adrincache^.xmltext) { //but we do have a cached copy someone provided for us -- use that s = adrincache^.xmltext} else { //read the url s = string.httpResultSplit (tcp.httpClient (server:urllist [2], path:urllist [3], flMEssages:false, flAcceptOpml:true, ctFollowRedirects:5))}}; if not defined (adrincache^.xmltext) { adrincache^.xmltext = s}; try { //try to compile the text xml.compile (s, @adrincache^.xstruct); local (nomad = @adrincache^.xstruct); nomad = xml.getAddress (nomad, "opml"); nomad = xml.getAddress (nomad, "head"); try {adrincache^.ownerName = xml.getValue (nomad, "ownerName") }; try {adrincache^.ownerEmail = xml.getValue (nomad, "ownerEmail") }}; if defined (adrincache^.outline) { delete (@adrincache^.outline)}; adrincache^.ctXmlBytes = sizexmltext; };Çreturn (s) Çelse Çreturn (adrincache^.xmltext)}; on insertInOutline (adr) { local (oldTarget = target.get ()); target.set (frontWindow); local (oldDisplay = op.getDisplay ()); op.setDisplay (false); op.insertOutline (adr, right); op.setDisplay (oldDisplay); try {target.set (oldTarget)}}; on setCloudAttribute () { if not flOpenInPlace { if defined (adrincache^.cloud) { window.attributes.setOne ("cloudInfo", adrincache^.cloud, adr); local (adrcloud, nomad); nomad = parentOf (adr^); nomad = @nomad^.["/atts"]; adrcloud = @nomad^.cloudInfo; window.attributes.setOne ("adrCloud", adrcloud, adr)}}}; getTextFromUrl (url); if isDocType ("rss") or isDocType ("RDF") { //handle an RSS file local (adr); if adroutline == nil { Frontier.tools.windowTypes.commands.new (true, adradrwindow:@adr)} else { adr = adroutline}; if defined (adrincache^.outline) { adr^ = adrincache^.outline} else { op.rsstooutline (adrincache^.xmltext, adr, url); adrincache^.outline = adr^; delete (@adrincache^.xmltext)}; local (oldTarget = target.set (adr)); local (title = op.getlinetext ()); if adroutline == nil { // set window attributes window.attributes.setOne ("lastSaved", timeModified (adr), adr); window.attributes.setOne ("title", title, adr); window.attributes.setOne ("flReadOnly", true, adr)}; if flOpenInPlace and typeOf (frontWindow^) == outlineType { insertInOutline (adr); delete (parentOf (adr^))} else { //open the new window if adroutline == nil { edit (adr, title, true)}}; bundle { //set attributes setCloudAttribute ()}; try {target.set (oldTarget)}; if adroutline == nil { //set last read urls user.tools.prefs.lastRssUrl = url; user.tools.prefs.lastOpenedUrl = url}; return (true)}; if isDocType ("opml") or isDocType ("outlineDocument") { local (urllist = string.urlsplit (url)); local (title = string.nthField (urllist[3], '/', string.countFields (urllist[3], '/'))); if title == "" {title = nil}; //let Frontier.tools.windowTypes.commands.new set the title local (adr); if adroutline == nil { Frontier.tools.windowTypes.commands.new (true, title, @adr)} else { adr = adroutline}; if defined (adrincache^.outline) { adr^ = adrincache^.outline} else { if system.environment.isMac { //12/31/00 JES: convert to Mac text op.xmltooutline (latinToMac.convert (adrincache^.xmltext), adr)} else { op.xmltooutline (adrincache^.xmltext, adr)}; adrincache^.outline = adr^; delete (@adrincache^.xmltext)}; if adroutline == nil { // set window attributes setCloudAttribute (); window.attributes.setOne ("lastSaved", timeModified (adr), adr); if defined (adrincache^.ownerEmail) { window.attributes.setOne ("ownerEmail", adrincache^.ownerEmail, adr)}; if defined (adrincache^.ownerName) { window.attributes.setOne ("ownerName", adrincache^.ownerName, adr)}}; if flOpenInPlace and typeOf (frontWindow^) == outlineType { insertInOutline (adr); delete (parentOf (adr^))} else { //open the new window if adroutline == nil { edit (adr, title)}}; if adroutline == nil { //set last read urls user.tools.prefs.lastOutlineUrl = url; user.tools.prefs.lastOpenedUrl = url}; return (true)}; if isDocType ("externalEditorInfo") { //adding a Manila site node local (siteUrl = url); siteUrl = string.popSuffix (siteUrl, '/'); //pop externalEditorInfo.xml siteUrl = string.popSuffix (siteUrl, '/'); //pop /xml/ siteUrl = siteUrl + "/"; //add trailing slash local (adrtype); if not Frontier.tools.windowTypes.findWindowType ("manilaSite", @adrtype) { return (false)}; adrtype^.openManilaSite (siteUrl); user.tools.prefs.lastOpenedUrl = url; return (true)}}; if adroutline == nil { Frontier.tools.commands.openUrl (url); //opens the URL in the browser if defined (system.temp.frontier.openUrlCache.[url] ) { //we don't cache these delete (@system.temp.frontier.openUrlCache.[url] )}} else { scriptError ("Could not open the url, \"" + url + "\", because it could not be converted to an outline.")}; user.tools.prefs.lastOpenedUrl = url; return (true)}; Çbundle //testing Çbundle //add to existing outline ÇopenUrl ("http://radio.weblogs.com/0001000/rss.xml", true) ÇopenUrl ("http://radio.weblogs.com/0001000/gems/blogroll.opml", true) ÇopenUrl ("http://jake.editthispage.com/xml/externalEditorInfo.xml", true) Çbundle //open in new window ÇopenUrl ("http://p.moreover.com/cgi-local/page?c=CRM%20news&o=rss") ÇopenUrl ("http://radio.weblogs.com/0001000/gems/publications.opml") \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.openUrl ! on openUrl (url=nil, flOpenInPlace=false, adroutline=nil) { ÇChanges Ç2/5/06; 11:14:02 AM by TAC Çupdate run callbacks to deal with the callback table not being there Ç2002 Ç6/4/02; 3:58:23 PM by JES ÇWhen opening an OPML file, save the ownerName and ownerEmail from the head in the cache, and set corresponding windowType attributes. Ç6/1/02; 7:31:55 PM by JES ÇChanged the requirement that the URL's extension represents a type that can be opened in the outliner, so that if a key string like rss or opml is present anywhere in the URL, Radio will get a shot at opening the URL in the outliner. Fixes opening of Moreover's RSS feeds in Radio's outliner, for example. Ç5/15/02; 6:09:24 PM by JES ÇIf an address is passed in for adroutline, and the object specified by url cannot be converted to an outline, throw an error. Ç4/18/02; 4:27:35 PM by JES ÇWhen opening an RSS file, create the new window as read-only. Ç3/31/02; 7:36:52 PM by JES ÇFixed a bug which would cause an error opening an outline: flAcceptOpml has already been given a value. Ç3/31/02; 6:27:06 PM by JES ÇCall tcp.httpClient with flAcceptOpml true. Ç3/26/02; 11:02:59 PM by JES ÇFor opml and rss, if there's a cloud element, add it and the adrCloud attributes to the window. Ç3/24/02; 5:50:17 PM by JES ÇIf xmltext is defined in the cache table, use that text instead of reading the URL, and then delete the cached text. Ç3/24/02; 12:58:27 AM by JES ÇNew optional parameter, adroutline, specifies the address of the object to load the outline into. Ç3/23/02; 3:40:14 PM by JES ÇOptimization: Cache the type, so we don't have to store xmltext or xstruct in the cache table. Ç3/23/02; 2:30:20 PM by JES ÇImplement size-based caching of RSS and OPML outlines. If the file's size is different from the size of the cached copy, we reload it. Size is determined by requesting only the HTTP headers from the server, if possible. Ç2001 Ç12/1/01; 5:16:14 PM by JES ÇWhen inserting sub-outlines, temporarily set outline display to false, so screen updates will be smoother. Ç11/5/01; 4:37:01 PM by JES ÇFixed a bug opening urls like http://www.scripting.com/. They have no extension, so we have to read the url to determine the docType. Ç10/28/01; 6:12:44 PM by JES ÇOnly read the url if the extension matches one of the extensionsToOpenInRadio: xml, opml, rss and rdf. (More may be added later.) Ç10/22/01; 5:04:48 PM by JES ÇFollow redirects when opening the URL. Ç10/22/01; 4:55:58 PM by JES ÇFix bug when adding Manila site node: the port and server attributes were reversed in the call to playlist.manila.commands.addManilaSiteNode. Ç08/10/01; 8:43:47 PM by JES ÇNew optional parameter, flOpenInPlace. If true, outline type windows are inserted as a sub-heading of the frontmost outline window. Ç2000 Ç12/31/00; 5:32:12 PM by JES ÇOn Macs, convert opml to Mac text when converting to an outline. Ç11/30/00; 12:16:04 AM by JES ÇDereference callback addresses in a try block in case a tool's odb is not opened Ç09/30/00; 12:37:16 PM by PBS ÇCall callbacks at user.pike.commandCallbacks.openUrl. Ç09/22/00; 4:57:55 PM by PBS ÇCheck offline status. Ç09/20/00; 2:04:28 PM by PBS ÇCall playlist.httpClient rather than tcp.httpClient. Ç09/16/00; 11:20:13 AM by PBS ÇOpen HTML files in the Web browser. Ç09/16/00; 3:42:06 PM by PBS ÇOpen OPML documents the same way outlineDocuments are opened. ÇCalled when the user chooses Open URL... from the File menu. Handle RSS, outlineDocuments, and .xml. (Have to handle .xml because we can't differentiate it from outlineDocuments based on URL alone.) ÇWed, Aug 30, 2000 at 9:15:27 PM by PBS local (flOnline = true); if defined (tcp.isOffline) { flOnline = not (tcp.isOffline ())}; if not flOnline { //PBS 09/22/00: check offline status return (false)}; if url == nil { if defined (user.tools.prefs.lastOpenedUrl) { url = user.tools.prefs.lastOpenedUrl} else { if defined (user.tools.prefs.lastRssUrl) { url = user.tools.prefs.lastRssUrl} else { if defined (user.tools.prefs.lastOutlineUrl) { url = user.tools.prefs.lastOutlineUrl}}}; if not (dialog.ask ("Open URL:", @url)) { return (false)}}; bundle { //clean up the URL if not (string.lower (url) contains "://") { url = "http://" + url}; try { //check to see if it needs a trailing slash string.urlSplit (url)} else { url = url + "/"}}; if url contains " " { url = string.replaceAll (url, " ", "%20")}; //many outlineDocument URLs have spaces in them local (frontWindow = window.frontmost ()); on runCallbacks (stringAddress) { //call callbacks if defined (stringAddress^) { local (adrScript); for adrScript in @stringAddress^ { try { //11/30/00 JES while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; if adrScript^ (url) { return (true)}}}}; return (false)}; if runCallbacks ("user.tools.commandCallbacks.openUrl") { return (true)}; if system.environment.isRadio { if runCallbacks ("user.pike.commandCallbacks.openUrl") { return (true)}}; local (urllist = string.urlsplit (url)); Çlocal (extension = string.lower (string.nthField (urllist[3], ".", string.countFields (urllist[3], ".")))) local (extensionsToOpenInRadio = {"xml", "opml", "rss", "rdf"}); local (flOpenInRadio = false); bundle { //set flOpenInRadio local (ext, lowerUrl = string.lower (url)); for ext in extensionsToOpenInRadio { if lowerUrl contains ext { flOpenInRadio = true; break}}}; if flOpenInRadio { local (adrincache); on isDocType (typeName) { if defined (adrincache^.type) { if adrincache^.type == typeName { if defined (adrincache^.xstruct) { delete (@adrincache^.xstruct)}; return (true)}}; if defined (adrincache^.xstruct) { //get the type, and cache the cloud info if available try { local (adrtopelement = xml.getAddress (@adrincache^.xstruct, typeName)); adrincache^.type = typeName; try { //if there's a cloud element, create a cloud table in the cache local (adrcloud); case adrincache^.type { "opml" { local (adrhead = xml.getAddress (adrtopelement, "head")); adrcloud = xml.getAddress (adrhead, "cloud")}; "rss" { local (adrchannel = xml.getAddress (adrtopelement, "channel")); adrcloud = xml.getAddress (adrchannel, "cloud")}}; if adrcloud != nil { local (adrcloudatts = @adrcloud^.["/atts"]); new (tableType, @adrincache^.cloud); local (nomad); for nomad in adrcloudatts { adrincache^.cloud.[nameOf (nomad^)] = nomad^}}}; delete (@adrincache^.xstruct); return (true)}}; return (false)}; on getTextFromUrl (url) { //get xmltext, set adrincache local (adrcache = @system.temp.frontier.openUrlCache); if not defined (adrcache^) { new (tableType, adrcache)}; adrincache = @adrcache^.[url]; if not defined (adrincache^) { new (tableType, adrincache)}; if not defined (adrincache^.ctXmlBytes) { adrincache^.ctXmlBytes = 0}; local (urllist = string.urlsplit (url)); local (s = "", headertext, resultheaders, flgotsizefastway = false, sizexmltext); if defined (adrincache^.xmltext) { sizexmltext = sizeOf (adrincache^.xmltext); flgotsizefastway = true} else { headertext = tcp.httpClient (server:urllist [2], path:urllist [3], ctFollowRedirects:5, flMessages:false, flJustHeaders:true, flAcceptOpml:true); new (tabletype, @resultheaders); webserver.util.parseHeaders (headertext, @resultheaders); if defined (resultheaders.["Content-Length"]) { try { sizexmltext = number (resultheaders.["Content-Length"]); flgotsizefastway = true}}}; if not flgotsizefastway { s = string.httpResultSplit (tcp.httpClient (server:urllist [2], path:urllist [3], ctFollowRedirects:5, flAcceptOpml:true)); sizexmltext = sizeof (s)}; if adrincache^.ctXmlBytes != sizexmltext { if s == "" { //we haven't read the xml yet if defined (adrincache^.xmltext) { //but we do have a cached copy someone provided for us -- use that s = adrincache^.xmltext} else { //read the url s = string.httpResultSplit (tcp.httpClient (server:urllist [2], path:urllist [3], flMEssages:false, flAcceptOpml:true, ctFollowRedirects:5))}}; if not defined (adrincache^.xmltext) { adrincache^.xmltext = s}; try { //try to compile the text xml.compile (s, @adrincache^.xstruct); local (nomad = @adrincache^.xstruct); nomad = xml.getAddress (nomad, "opml"); nomad = xml.getAddress (nomad, "head"); try {adrincache^.ownerName = xml.getValue (nomad, "ownerName") }; try {adrincache^.ownerEmail = xml.getValue (nomad, "ownerEmail") }}; if defined (adrincache^.outline) { delete (@adrincache^.outline)}; adrincache^.ctXmlBytes = sizexmltext}}; Çreturn (s) Çelse Çreturn (adrincache^.xmltext) on insertInOutline (adr) { local (oldTarget = target.get ()); target.set (frontWindow); local (oldDisplay = op.getDisplay ()); op.setDisplay (false); op.insertOutline (adr, right); op.setDisplay (oldDisplay); try {target.set (oldTarget)}}; on setCloudAttribute () { if not flOpenInPlace { if defined (adrincache^.cloud) { window.attributes.setOne ("cloudInfo", adrincache^.cloud, adr); local (adrcloud, nomad); nomad = parentOf (adr^); nomad = @nomad^.["/atts"]; adrcloud = @nomad^.cloudInfo; window.attributes.setOne ("adrCloud", adrcloud, adr)}}}; getTextFromUrl (url); if isDocType ("rss") or isDocType ("RDF") { //handle an RSS file local (adr); if adroutline == nil { Frontier.tools.windowTypes.commands.new (true, adradrwindow:@adr)} else { adr = adroutline}; if defined (adrincache^.outline) { adr^ = adrincache^.outline} else { op.rsstooutline (adrincache^.xmltext, adr, url); adrincache^.outline = adr^; delete (@adrincache^.xmltext)}; local (oldTarget = target.set (adr)); local (title = op.getlinetext ()); if adroutline == nil { // set window attributes window.attributes.setOne ("lastSaved", timeModified (adr), adr); window.attributes.setOne ("title", title, adr); window.attributes.setOne ("flReadOnly", true, adr)}; if flOpenInPlace and typeOf (frontWindow^) == outlineType { insertInOutline (adr); delete (parentOf (adr^))} else { //open the new window if adroutline == nil { edit (adr, title, true)}}; bundle { //set attributes setCloudAttribute ()}; try {target.set (oldTarget)}; if adroutline == nil { //set last read urls user.tools.prefs.lastRssUrl = url; user.tools.prefs.lastOpenedUrl = url}; return (true)}; if isDocType ("opml") or isDocType ("outlineDocument") { local (urllist = string.urlsplit (url)); local (title = string.nthField (urllist[3], '/', string.countFields (urllist[3], '/'))); if title == "" {title = nil}; //let Frontier.tools.windowTypes.commands.new set the title local (adr); if adroutline == nil { Frontier.tools.windowTypes.commands.new (true, title, @adr)} else { adr = adroutline}; if defined (adrincache^.outline) { adr^ = adrincache^.outline} else { if system.environment.isMac { //12/31/00 JES: convert to Mac text op.xmltooutline (latinToMac.convert (adrincache^.xmltext), adr)} else { op.xmltooutline (adrincache^.xmltext, adr)}; adrincache^.outline = adr^; delete (@adrincache^.xmltext)}; if adroutline == nil { // set window attributes setCloudAttribute (); window.attributes.setOne ("lastSaved", timeModified (adr), adr); if defined (adrincache^.ownerEmail) { window.attributes.setOne ("ownerEmail", adrincache^.ownerEmail, adr)}; if defined (adrincache^.ownerName) { window.attributes.setOne ("ownerName", adrincache^.ownerName, adr)}}; if flOpenInPlace and typeOf (frontWindow^) == outlineType { insertInOutline (adr); delete (parentOf (adr^))} else { //open the new window if adroutline == nil { edit (adr, title)}}; if adroutline == nil { //set last read urls user.tools.prefs.lastOutlineUrl = url; user.tools.prefs.lastOpenedUrl = url}; return (true)}; if isDocType ("externalEditorInfo") { //adding a Manila site node local (siteUrl = url); siteUrl = string.popSuffix (siteUrl, '/'); //pop externalEditorInfo.xml siteUrl = string.popSuffix (siteUrl, '/'); //pop /xml/ siteUrl = siteUrl + "/"; //add trailing slash local (adrtype); if not Frontier.tools.windowTypes.findWindowType ("manilaSite", @adrtype) { return (false)}; adrtype^.openManilaSite (siteUrl); user.tools.prefs.lastOpenedUrl = url; return (true)}}; if adroutline == nil { Frontier.tools.commands.openUrl (url); //opens the URL in the browser if defined (system.temp.frontier.openUrlCache.[url] ) { //we don't cache these delete (@system.temp.frontier.openUrlCache.[url] )}} else { scriptError ("Could not open the url, \"" + url + "\", because it could not be converted to an outline.")}; user.tools.prefs.lastOpenedUrl = url; return (true)}; Çbundle //testing Çbundle //add to existing outline ÇopenUrl ("http://radio.weblogs.com/0001000/rss.xml", true) ÇopenUrl ("http://radio.weblogs.com/0001000/gems/blogroll.opml", true) ÇopenUrl ("http://jake.editthispage.com/xml/externalEditorInfo.xml", true) Çbundle //open in new window ÇopenUrl ("http://p.moreover.com/cgi-local/page?c=CRM%20news&o=rss") ÇopenUrl ("http://radio.weblogs.com/0001000/gems/publications.opml") \ No newline at end of file Index: saveAsHtml =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands/saveAsHtml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** saveAsHtml 26 Mar 2005 19:42:56 -0000 1.1.1.1 --- saveAsHtml 6 Feb 2006 00:20:38 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.saveAsHtml ! on saveAsHtml (adr=nil, adrFilepath=nil, flPreview=false) { ÇChanges Ç12/26/00; 3:52:29 PM by PBS ÇWorks for odb outlines as well as local outlines. Ç12/13/00; 5:52:54 PM by PBS ÇCreated. Save a document as HTML on the local file system. if adr == nil { adr = window.frontMost ()}; on runCallbacks (adrCallback) { //call callbacks local (adrScript); for adrScript in adrCallback { try { while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; if adrScript^ (adrItem) { return (true)}}}; return (false)}; if defined (user.tools.commandCallbacks.saveAsHtml) { if runCallbacks (@user.tools.commandCallbacks.saveAsHtml) { return (true)}}; if system.environment.isRadio { if defined (user.pike.commandCallbacks.saveAsHtml) { if runCallbacks (@user.pike.commandCallbacks.saveAsHtml) { return (true)}}}; local (adrtype); ÇFind the saveAsHtml script for this window type. if Frontier.tools.windowTypes.findWindowType (adradrtable:@adrtype, adrwindow:adr) { if defined (adrtype^.saveAsHtml) { if adrtype^.saveAsHtml (adr, adrFilepath, flPreview) { return (false)}}}; ÇFor outlineType windows, we use the outlineFile windowType's saveAsHtml script to save the window. case typeOf (adr^) { tableType; scriptType; outlineType { if Frontier.tools.windowTypes.findWindowType ("outlinerFile", @adrtype) { if not adrtype^.saveAsHtml (adr, adrFilepath, flPreview) { return (false)}}}}; return (true); Çbundle //this code moved to Frontier.tools.data.windowTypes.outlinerFile.saveAsHtml Çlocal (extension = user.html.prefs.fileExtension) Ç Çlocal (title, fname) Çif window.attributes.getOne ("title", @title, adr) Çfname = title Çif string.lower (fname) endsWith ".opml" Çfname = string.popSuffix (fname) Çelse //base the title on the title of the window Çtitle = window.getTitle (adr) Çif string.lower (title) == string.lower (string.popFileFromAddress (adr)) Çlocal (parts = string.parseAddress (string.popFileFromAddress (adr))) Çlocal (ct = sizeOf (parts)) Çfname = parts [ct] Çif ct > 1 Çfname = parts [ct - 1] + "." + fname Ç Çlocal (maxCharsMac = 31 - sizeOf (extension)) Ç Çif system.environment.isMac Çif sizeOf (fname) > maxCharsMac Çif ct > 1 Çfname = parts [ct] Çif system.environment.isMac Çif sizeOf (fname) > maxCharsMac Çfname = string.mid (fname, 1, 26) Çfname = fname + extension Ç Çlocal (f = fname) Çif file.putFileDialog ("Save " + title + " as HTML:", @f) Çpike.saveOutlineAsHtml (adrItem, f)}; Çbundle //test code ÇsaveAsHtml (window.frontmost ()) \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.saveAsHtml ! on saveAsHtml (adr=nil, adrFilepath=nil, flPreview=false) { ÇChanges Ç2/5/06; 11:14:02 AM by TAC Çupdate run callbacks to deal with the callback table not being there Ç12/26/00; 3:52:29 PM by PBS ÇWorks for odb outlines as well as local outlines. Ç12/13/00; 5:52:54 PM by PBS ÇCreated. Save a document as HTML on the local file system. if adr == nil { adr = window.frontMost ()}; on runCallbacks (stringAddress) { //call callbacks if defined (stringAddress^) { local (adrScript); for adrScript in @stringAddress^ { try { while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; if adrScript^ (adrItem) { return (true)}}}}; return (false)}; if runCallbacks ("user.tools.commandCallbacks.saveAsHtml") { return (true)}; if system.environment.isRadio { if runCallbacks ("user.pike.commandCallbacks.saveAsHtml") { return (true)}}; local (adrtype); ÇFind the saveAsHtml script for this window type. if Frontier.tools.windowTypes.findWindowType (adradrtable:@adrtype, adrwindow:adr) { if defined (adrtype^.saveAsHtml) { if adrtype^.saveAsHtml (adr, adrFilepath, flPreview) { return (false)}}}; ÇFor outlineType windows, we use the outlineFile windowType's saveAsHtml script to save the window. case typeOf (adr^) { tableType; scriptType; outlineType { if Frontier.tools.windowTypes.findWindowType ("outlinerFile", @adrtype) { if not adrtype^.saveAsHtml (adr, adrFilepath, flPreview) { return (false)}}}}; return (true); }; Çbundle //this code moved to Frontier.tools.data.windowTypes.outlinerFile.saveAsHtml Çlocal (extension = user.html.prefs.fileExtension) Ç Çlocal (title, fname) Çif window.attributes.getOne ("title", @title, adr) Çfname = title Çif string.lower (fname) endsWith ".opml" Çfname = string.popSuffix (fname) Çelse //base the title on the title of the window Çtitle = window.getTitle (adr) Çif string.lower (title) == string.lower (string.popFileFromAddress (adr)) Çlocal (parts = string.parseAddress (string.popFileFromAddress (adr))) Çlocal (ct = sizeOf (parts)) Çfname = parts [ct] Çif ct > 1 Çfname = parts [ct - 1] + "." + fname Ç Çlocal (maxCharsMac = 31 - sizeOf (extension)) Ç Çif system.environment.isMac Çif sizeOf (fname) > maxCharsMac Çif ct > 1 Çfname = parts [ct] Çif system.environment.isMac Çif sizeOf (fname) > maxCharsMac Çfname = string.mid (fname, 1, 26) Çfname = fname + extension Ç Çlocal (f = fname) Çif file.putFileDialog ("Save " + title + " as HTML:", @f) Çpike.saveOutlineAsHtml (adrItem, f) Çbundle //test code ÇsaveAsHtml (window.frontmost ()) \ No newline at end of file Index: revert =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands/revert,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** revert 1 Oct 2005 17:26:02 -0000 1.2 --- revert 6 Feb 2006 00:20:38 -0000 1.3 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.revert ! on revert (adr = nil) { ÇChanges Ç9/21/05; 3:24:55 PM by TAC Çchanged confirmatation dialog to do the safe option by default Çchanged to actually do a revert for Frontier Ç2000 Ç11/30/00; 12:17:04 AM by JES ÇDereference callback addresses in a try block in case a tool's odb is not opened Ç10/03/00; 6:39:09 PM by PBS ÇCallbacks can be addresses. Ç07/24/00; 12:37:39 PM by PBS ÇHandle reverting local XML outline documents. ÇFri, Jul 7, 2000 at 11:00:09 PM by AR ÇCall any scripts in user.pike.commandCallbacks.revert ÇIf one of the scripts returns true, we're done Ç03/24/00; 7:24:20 PM by PBS ÇThis command was seriously broken -- now it's fixed. It works again for advanced items and stories. ÇRevert a window. if adr == nil { try { adr = window.frontmost ()} else { return (false)}}; on askForConfirmation (s) { return (!dialog.twoWay ("Discard all changes made to " + s + "?", "Cancel", "Discard"))}; on runCallbacks (adrcallbacks) { if defined (adrcallbacks^) { local (adrcallback); for adrcallback in adrcallbacks { try { //11/30/00 JES while typeOf (adrcallback^) == addressType { //follow addresses adrcallback = adrcallback^}; flConsumed = adrcallback^ (adr)}; if flConsumed { return (true)}}}; return (false)}; if runCallbacks (@user.tools.commandCallbacks.revert) { return (true)}; if system.environment.isRadio { if defined (user.pike.commandCallbacks) { if runCallbacks (@user.pike.commandCallbacks.revert) { return (true)}}}; bundle { //run the windowType script if it exists local (type); if window.attributes.getOne ("type", @type, adr) { local (adrtype); if Frontier.tools.windowTypes.findWindowType (type, @adrtype, adr) { if defined (adrtype^.revert) { if Frontier.tools.windowTypes.isWindowDirty (adr) { local (title = window.getTitle (adr)); window.attributes.getOne ("title", @title, adr); //we don't care if this doesn't work if askForConfirmation (title) { local (adrNewWindow); if adrtype^.revert (adr, @adrNewWindow) { ÇlastSaved may already have been set by the windowType, but we do it here too just in case. window.attributes.setOne ("lastSaved", timeModified (adrNewWindow), adrNewWindow); return (true)}}}}}}}; if system.environment.isRadio { return (false)} else { local (s = file.fileFromPath (window.getFile (adr))); if askForConfirmation (s) { fileMenu.revert ()}}; return (true); Çbundle //old code for reverting Manila windows Çif adrItem!= nil Çlocal (flConsumed = false) Çif defined (user.pike.commandCallbacks.revert) Çlocal (adrcallback) Çfor adrcallback in @user.pike.commandCallbacks.revert Çtry //11/30/00 JES Çwhile typeOf (adrcallback^) == addressType //follow addresses Çadrcallback = adrcallback^ ÇflConsumed = adrcallback^ (adrItem) Çif flConsumed Çbreak Çif not flConsumed Çon askForConfirmation (s) Çreturn (dialog.twoWay ("Discard all changes made to " + s + "?", "Discard", "Cancel")) Ç Çbundle //PBS 07/24/00: handle local outlines Çif pike.isLocalOutline (adrItem) Çlocal (adrTable = parentOf (adrItem^)) Çif defined (adrTable^.f) Çif file.exists (adrTable^.f) Çlocal (title = adrTable^.title) Çif askForConfirmation (title) Çwindow.close (adrItem) Çpike.commands.open (adrTable^.f) ÇfileMenu.save () Çreturn (true) Ç Çlocal (windowType = pike.getWindowType (adrItem)) Çif windowType != "" Çlocal (adrTable = parentOf (adrItem^)) Çcase windowType //can't revert "newStories" Ç"advancedItems" Çif not askForConfirmation ("the " + adrTable^.iteminfo.type) Çreturn (false) Çlocal (handlerName = pike.advancedItemToHandlerName (adrTable^.itemInfo.type)) Çlocal (t = manila.[handlerName].get (@adrTable^.siteInfo)) ÇadrTable^.itemInfo.body = string (t.body) Çpike.commands.editAdvancedItem (adrTable^.siteInfo, adrTable^.itemInfo, false) Ç"savedStories" Çlocal (adrStory = @adrTable^.storyinfo) Çif not askForConfirmation ("\"" + adrStory^.subject + "\"") Çreturn (false) ÇadrStory^ = manila.message.get (@adrTable^.siteinfo, adrStory^.msgnum) Çif defined (adrStory^.bodyType) Çif string.lower (adrStory^.bodyType) == "text/x-outline-tabbed" ÇadrStory^.body = string (adrStory^.outline) Çpike.commands.editStory (adrTable^.siteInfo, adrTable^.storyInfo, false) Ç ÇfileMenu.save () Ç Çreturn (true)}; Çbundle // testing Çrevert (window.frontmost ()) \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.revert ! on revert (adr = nil) { ÇChanges Ç2/5/06; 11:14:02 AM by TAC Çupdate run callbacks to deal with the callback table not being there Ç9/21/05; 3:24:55 PM by TAC Çchanged confirmatation dialog to do the safe option by default Çchanged to actually do a revert for Frontier Ç2000 Ç11/30/00; 12:17:04 AM by JES ÇDereference callback addresses in a try block in case a tool's odb is not opened Ç10/03/00; 6:39:09 PM by PBS ÇCallbacks can be addresses. Ç07/24/00; 12:37:39 PM by PBS ÇHandle reverting local XML outline documents. ÇFri, Jul 7, 2000 at 11:00:09 PM by AR ÇCall any scripts in user.pike.commandCallbacks.revert ÇIf one of the scripts returns true, we're done Ç03/24/00; 7:24:20 PM by PBS ÇThis command was seriously broken -- now it's fixed. It works again for advanced items and stories. ÇRevert a window. if adr == nil { try { adr = window.frontmost ()} else { return (false)}}; on askForConfirmation (s) { return (!dialog.twoWay ("Discard all changes made to " + s + "?", "Cancel", "Discard"))}; on runCallbacks (stringAddress) { if defined (stringAddress^) { local (adrcallback); for adrcallback in @stringAddress^ { try { //11/30/00 JES while typeOf (adrcallback^) == addressType { //follow addresses adrcallback = adrcallback^}; flConsumed = adrcallback^ (adr)}; if flConsumed { return (true)}}}; return (false)}; if runCallbacks ("user.tools.commandCallbacks.revert") { return (true)}; if system.environment.isRadio { if runCallbacks ("user.pike.commandCallbacks.revert") { return (true)}}; bundle { //run the windowType script if it exists local (type); if window.attributes.getOne ("type", @type, adr) { local (adrtype); if Frontier.tools.windowTypes.findWindowType (type, @adrtype, adr) { if defined (adrtype^.revert) { if Frontier.tools.windowTypes.isWindowDirty (adr) { local (title = window.getTitle (adr)); window.attributes.getOne ("title", @title, adr); //we don't care if this doesn't work if askForConfirmation (title) { local (adrNewWindow); if adrtype^.revert (adr, @adrNewWindow) { ÇlastSaved may already have been set by the windowType, but we do it here too just in case. window.attributes.setOne ("lastSaved", timeModified (adrNewWindow), adrNewWindow); return (true)}}}}}}}; if system.environment.isRadio { return (false)} else { local (s = file.fileFromPath (window.getFile (adr))); if askForConfirmation (s) { fileMenu.revert ()}}; return (true); }; Çbundle //old code for reverting Manila windows Çif adrItem!= nil Çlocal (flConsumed = false) Çif defined (user.pike.commandCallbacks.revert) Çlocal (adrcallback) Çfor adrcallback in @user.pike.commandCallbacks.revert Çtry //11/30/00 JES Çwhile typeOf (adrcallback^) == addressType //follow addresses Çadrcallback = adrcallback^ ÇflConsumed = adrcallback^ (adrItem) Çif flConsumed Çbreak Çif not flConsumed Çon askForConfirmation (s) Çreturn (dialog.twoWay ("Discard all changes made to " + s + "?", "Discard", "Cancel")) Ç Çbundle //PBS 07/24/00: handle local outlines Çif pike.isLocalOutline (adrItem) Çlocal (adrTable = parentOf (adrItem^)) Çif defined (adrTable^.f) Çif file.exists (adrTable^.f) Çlocal (title = adrTable^.title) Çif askForConfirmation (title) Çwindow.close (adrItem) Çpike.commands.open (adrTable^.f) ÇfileMenu.save () Çreturn (true) Ç Çlocal (windowType = pike.getWindowType (adrItem)) Çif windowType != "" Çlocal (adrTable = parentOf (adrItem^)) Çcase windowType //can't revert "newStories" Ç"advancedItems" Çif not askForConfirmation ("the " + adrTable^.iteminfo.type) Çreturn (false) Çlocal (handlerName = pike.advancedItemToHandlerName (adrTable^.itemInfo.type)) Çlocal (t = manila.[handlerName].get (@adrTable^.siteInfo)) ÇadrTable^.itemInfo.body = string (t.body) Çpike.commands.editAdvancedItem (adrTable^.siteInfo, adrTable^.itemInfo, false) Ç"savedStories" Çlocal (adrStory = @adrTable^.storyinfo) Çif not askForConfirmation ("\"" + adrStory^.subject + "\"") Çreturn (false) ÇadrStory^ = manila.message.get (@adrTable^.siteinfo, adrStory^.msgnum) Çif defined (adrStory^.bodyType) Çif string.lower (adrStory^.bodyType) == "text/x-outline-tabbed" ÇadrStory^.body = string (adrStory^.outline) Çpike.commands.editStory (adrTable^.siteInfo, adrTable^.storyInfo, false) Ç ÇfileMenu.save () Ç Çreturn (true) Çbundle // testing Çrevert (window.frontmost ()) \ No newline at end of file Index: saveAsPlainText =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands/saveAsPlainText,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** saveAsPlainText 26 Mar 2005 19:42:56 -0000 1.1.1.1 --- saveAsPlainText 6 Feb 2006 00:20:38 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.saveAsPlainText ! on saveAsPlainText (adr=nil, adrFilepath=nil) { ÇSave as plain text. Remember that this document is a plain text document -- always save it as plain text. Ç12/15/00; 5:04:18 PM by PBS ÇChanges: Ç12/29/00; 2:55:43 PM by PBS ÇSave non file-based outlines -- such as the notepad -- as plain text. if adr == nil { adr = window.frontMost ()}; bundle { //run callbacks on runCallbacks (adrtable) { local (flConsumed = false); if defined (adrtable^) { local (adrcallback); for adrcallback in adrtable { try { //11/30/00 JES while typeOf (adrcallback^) == addressType { adrcallback = adrcallback^}; flConsumed = adrcallback^ (adr)}; if flConsumed { return (true)}}}; return (false)}; if runCallbacks (@user.tools.commandCallbacks.saveAsPlainText) { return (true)}; if system.environment.isRadio { if defined (user.pike.commandCallbacks.saveAsPlainText) { if runCallbacks (@user.pike.commandCallbacks.saveAsPlainText) { return (true)}}}}; local (adrType); bundle { //if there's a windowType that handles this command, call it if Frontier.tools.windowTypes.findWindowType (adradrtable:@adrtype, adrwindow:adr) { if defined (adrtype^.saveAsPlainText) { if adrtype^.saveAsPlainText (adr, adrFilepath) { return (false)}}}}; case typeOf (adr^) { //we only know how to render outlines and tables at this time scriptType; outlineType { local (adrtype); if Frontier.tools.windowTypes.findWindowType ("outlinerFile", @adrtype) { if defined (adrtype^.saveAsPlainText) { if not adrtype^.saveAsPlainText (adr) { return (false)}}}; Çbundle //old code Çlocal (adrParentTable = parentOf (adrItem^)) Çlocal (title = window.getTitle (adrItem)) Çif not window.attributes.getOne ("title", @title, adrItem) //base the filename on the window title Çlocal (l = string.parseAddress (adrItem)) Çlocal (ct = sizeOf (l)) Çif ct > 1 Çtitle = l[ct-1] + "." + l[ct] Çelse Çtitle = l[ct] Çif system.environment.isMac //shorten the filename Çif sizeOf (title) > 27 Çtitle = l[ct] Çif sizeOf (title) > 27 Çtitle = string.mid (title, 1, 27) Çif string.lower (title) endsWith ".opml" Çtitle = string.popSuffix (title) Çif string.lower (title) endsWith ".txt" Çtitle = string.popSuffix (title) Çtitle = title + ".txt" Çlocal (fname = title) Çlocal (f = fname) Çif file.putFileDialog ("Save as plain text:", @f) Çpike.saveAsPlainText (adrItem, f) Çlocal (s = string (adrItem^)) Çif system.environment.isWindows //add linefeeds Çs = string.replaceAll (s, "\r", "\r\n") Çlocal (creator = 'Radu') Çif string.lower (f) endsWith ".py" //special case for Python scripts Çcreator = 'Pyth' Çfile.writeWholeFile (f, s, 'TEXT', creator, clock.now ()) Çbundle //old code fragment Çlocal (adrTable = parentOf (adrOutline^)) ÇadrTable^.title = file.fileFromPath (f) Çwindow.setTitle (adrOutline, adrTable^.title) ÇadrTable^.f = f ÇadrTable^.lastSaved = clock.now () ÇadrTable^.flOutlineDocument = false ÇadrTable^.flPlainText = true Çreturn (Frontier.tools.windowTypes.commands.open (f))}}; Çelse //not a local, file-based outline, but something like the notepad Çlocal (title = window.getTitle (adrItem)) Çlocal (adrTable = pike.newWindow (title, false, false)) ÇadrTable^.outline = adrItem^ Çwindow.getPosition (adrItem, @horiz, @vert) Çedit (@adrTable^.outline, windowTitle:title) Çwindow.setPosition (@adrTable^.outline, horiz + 15, vert + 15) Çpike.commands.save (@adrTable^.outline) if adrFilepath != nil { //tell the caller where the file is -- used for View in Browser adrFilepath^ = f}; return (true)}; bundle { //debugging saveAsPlainText (window.frontmost ())} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.saveAsPlainText ! on saveAsPlainText (adr=nil, adrFilepath=nil) { ÇChanges Ç2/5/06; 11:14:02 AM by TAC Çupdate run callbacks to deal with the callback table not being there Ç12/29/00; 2:55:43 PM by PBS ÇSave non file-based outlines -- such as the notepad -- as plain text. Ç12/15/00; 5:04:18 PM by PBS Çcreated ÇSave as plain text. Remember that this document is a plain text document -- always save it as plain text. if adr == nil { adr = window.frontMost ()}; bundle { //run callbacks on runCallbacks (stringAddress) { local (flConsumed = false); if defined (stringAddress^) { local (adrcallback); for adrcallback in @stringAddress^ { try { //11/30/00 JES while typeOf (adrcallback^) == addressType { adrcallback = adrcallback^}; flConsumed = adrcallback^ (adr)}; if flConsumed { return (true)}}}; return (false)}; if runCallbacks ("user.tools.commandCallbacks.saveAsPlainText") { return (true)}; if system.environment.isRadio { if runCallbacks ("user.pike.commandCallbacks.saveAsPlainText") { return (true)}}}; local (adrType); bundle { //if there's a windowType that handles this command, call it if Frontier.tools.windowTypes.findWindowType (adradrtable:@adrtype, adrwindow:adr) { if defined (adrtype^.saveAsPlainText) { if adrtype^.saveAsPlainText (adr, adrFilepath) { return (false)}}}}; case typeOf (adr^) { //we only know how to render outlines and tables at this time scriptType; outlineType { local (adrtype); if Frontier.tools.windowTypes.findWindowType ("outlinerFile", @adrtype) { if defined (adrtype^.saveAsPlainText) { if not adrtype^.saveAsPlainText (adr) { return (false)}}}}}; Çbundle //old code Çlocal (adrParentTable = parentOf (adrItem^)) Çlocal (title = window.getTitle (adrItem)) Çif not window.attributes.getOne ("title", @title, adrItem) //base the filename on the window title Çlocal (l = string.parseAddress (adrItem)) Çlocal (ct = sizeOf (l)) Çif ct > 1 Çtitle = l[ct-1] + "." + l[ct] Çelse Çtitle = l[ct] Çif system.environment.isMac //shorten the filename Çif sizeOf (title) > 27 Çtitle = l[ct] Çif sizeOf (title) > 27 Çtitle = string.mid (title, 1, 27) Çif string.lower (title) endsWith ".opml" Çtitle = string.popSuffix (title) Çif string.lower (title) endsWith ".txt" Çtitle = string.popSuffix (title) Çtitle = title + ".txt" Çlocal (fname = title) Çlocal (f = fname) Çif file.putFileDialog ("Save as plain text:", @f) Çpike.saveAsPlainText (adrItem, f) Çlocal (s = string (adrItem^)) Çif system.environment.isWindows //add linefeeds Çs = string.replaceAll (s, "\r", "\r\n") Çlocal (creator = 'Radu') Çif string.lower (f) endsWith ".py" //special case for Python scripts Çcreator = 'Pyth' Çfile.writeWholeFile (f, s, 'TEXT', creator, clock.now ()) Çbundle //old code fragment Çlocal (adrTable = parentOf (adrOutline^)) ÇadrTable^.title = file.fileFromPath (f) Çwindow.setTitle (adrOutline, adrTable^.title) ÇadrTable^.f = f ÇadrTable^.lastSaved = clock.now () ÇadrTable^.flOutlineDocument = false ÇadrTable^.flPlainText = true Çreturn (Frontier.tools.windowTypes.commands.open (f)) Çelse //not a local, file-based outline, but something like the notepad Çlocal (title = window.getTitle (adrItem)) Çlocal (adrTable = pike.newWindow (title, false, false)) ÇadrTable^.outline = adrItem^ Çwindow.getPosition (adrItem, @horiz, @vert) Çedit (@adrTable^.outline, windowTitle:title) Çwindow.setPosition (@adrTable^.outline, horiz + 15, vert + 15) Çpike.commands.save (@adrTable^.outline) if adrFilepath != nil { //tell the caller where the file is -- used for View in Browser adrFilepath^ = f}; return (true)}; bundle { //debugging saveAsPlainText (window.frontmost ())} \ No newline at end of file Index: close =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/Frontier/tools/windowTypes/commands/close,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** close 1 Oct 2005 17:26:02 -0000 1.2 --- close 6 Feb 2006 00:20:38 -0000 1.3 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.Frontier.tools.windowTypes.commands.close ! on close (adr=nil) { ÇClose a window. ÇChanges Ç9/14/05; 3:40:04 PM by TAC Çuse new window.close flDialog parameter Çonly hide database windows if system.environment.isRadio is true Ç07/03/01; 12:32:56 AM by JES ÇMigrated form pike.commands.close. Ç11/30/00; 12:09:26 AM by JES ÇDereference callback addresses in a try block in case a tool's odb is not opened Ç09/30/00; 12:51:56 PM by PBS ÇCall callbacks. if adr == nil { //close the frontmost window adr = window.frontmost ()}; if not defined (adr^) { //close the Find & Replace Dialog or the About window window.close (adr); return (true)}; on runCallbacks (adrCallbackTable, adrWindow) { if defined (adrCallbackTable^) { local (flConsumed = false); local (adrScript); for adrScript in adrCallbackTable { try { //11/30/00 JES while typeOf (adrScript^) == addressType { //follow addresses adrScript = adrScript^}; return (adrScript^ (adrWindow))}}}; //address is parameter return (false)}; if runCallbacks (@user.tools.commandCallbacks.close, adr) { return (true)}; if system.environment.isRadio { //legacy support for user.pike.commandCallbacks if defined (user.pike) { if defined (user.pike.commandCallbacks) { if runCallbacks (@user.pike.commandCallbacks.close, adr) { return (true)}}}}; if nameO... [truncated message content] |