|
From: creedon <icr...@us...> - 2005-08-13 20:37:59
|
Update of /cvsroot/frontierkernel/odbs/mainResponderRoot/mainResponder/search/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21035 Modified Files: buildSearchTable Log Message: added support for relative file paths Index: buildSearchTable =================================================================== RCS file: /cvsroot/frontierkernel/odbs/mainResponderRoot/mainResponder/search/client/buildSearchTable,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** buildSearchTable 26 Mar 2005 21:46:10 -0000 1.1.1.1 --- buildSearchTable 13 Aug 2005 20:37:52 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:mainResponder.search.client.buildSearchTable ! on buildSearchTable (adrObject, adrSearchTable, adrSitesTable=nil) { ÇBuild a table containing the search preferences for this object. ÇParams: ÇadrObject is the address of the page. ÇadrSearchTable is the address of the search table to build. ÇadrSitesTable (optional) points to a table in config.mainResponder.search.sites to use. ÇThe search table contains: ÇsupportsIndexing: does this database support indexing? This value is the value from user.databases.[dbName].supportsIndexing. ÇflIndexOnCheckIn: does this website want indexing turned on? ÇaddToIndex: XML-RPC procedure name for adding to an index. This comes from config.mainResponder.search, the sites table, or the #search table. ÇrestartIndex: XML-RPC procedure name for restarting a site index. Çdomain: the domain name of the search engine server. Çport: the port number of the search engine server. ÇsiteName: the name of the site this page is in. ÇsiteUrl: the URL of the home page of this site. Çurl: the url of this page. ÇThe search table may contain additional items or fewer items, it's not guaranteed to contain the above and the above only. local (adrUserTable, adrSearchDirectiveTable); local (dbPath); on copyPrefs (adrSource) { //copy preferences from a table into the search table ÇCopy everything but subtables. if defined (adrSource^) { local (i); for i = 1 to sizeOf (adrSource^) { local (adrItem = @adrSource^ [i]); if typeOf (adrItem^) != tableType { table.copy (adrItem, adrSearchTable)}}; return (true)}}; on getSiteRoot (adrObject) { //get the root address of this website local (nomad = adrObject); if typeOf (nomad^) != tableType { nomad = parentOf (nomad^)}; loop { if defined (nomad^.["#ftpSite"]) { return (nomad)}; if defined (nomad^.["#prefs"].ftpSite) { return (nomad)}; if defined (nomad^.["#prefs"].["#ftpSite"]) { return (nomad)}; nomad = parentOf (nomad^); if nomad == nil or nomad == @root { return (nomad)}}}; on getSearchTable (adrObject) { //get the address of the search table for this website local (nomad = adrObject); if typeOf (nomad^) != tableType { nomad = parentOf (nomad^)}; loop { if defined (nomad^.["#search"]) { return (@nomad^.["#search"])}; if defined (nomad^.["#prefs"].search) { return (@nomad^.["#prefs"].search)}; if defined (nomad^.["#prefs"].["#search"]) { return (@nomad^.["#prefs"].["#search"])}; nomad = parentOf (nomad^); if nomad == nil or nomad == @root { return (false)}}}; ÇGet the path to this database. dbPath = window.getFile (table.getRootAddress (adrObject)); ÇFind the entry for this database in user.databases. bundle { Çlocal (dbName = file.fileFromPath (dbPath)) Çif defined (user.databases.[dbName]) ÇadrUserTable = @user.databases.[dbName] ÇLoop through the user.databases table, looking for an entry where the paths match. local (i); local (lowerPath = string.lower (dbPath)); for i = 1 to sizeOf (user.databases) { if defined (user.databases [i].f) { if string.lower (user.databases [i].f) == lowerPath { adrUserTable = @user.databases [i]; break}}}}; ÇIf the user.databases table doesn't exist, or supportsIndexing doesn't exist or is false, return right away. bundle { if adrUserTable == nil { return (false)}; if not defined (adrUserTable^.supportsIndexing) { return (false)}; if not adrUserTable^.supportsIndexing { return (false)}}; ÇCopy the user.databases table into the search table. copyPrefs (adrUserTable); ÇCopy preferences from config.mainResponder.search. copyPrefs (@config.mainResponder.search); ÇNext get the sites table from config.mainResponder.search.sites. (It might not exist, that's okay.) bundle { if adrSitesTable == nil { local (adrSiteRoot = getSiteRoot (adrObject)); //get the root address of this website if (adrSiteRoot != nil) and (adrSiteRoot != @root) { local (i); local (adrTable = @config.mainResponder.search.sites); for i = 1 to sizeOf (adrTable^) { if defined (adrTable^ [i].adrSite) { if adrTable^ [i].adrSite == adrSiteRoot { adrSitesTable = @adrTable^ [i]; break}}}}}}; ÇCopy prefs from the sites table. copyPrefs (adrSitesTable); ÇFind the #search table for this site. It might not exist, that's okay. adrSearchDirectiveTable = getSearchTable (adrObject); ÇCopy prefs from the #search table. copyPrefs (adrSearchDirectiveTable); return (true)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:mainResponder.search.client.buildSearchTable ! on buildSearchTable (adrObject, adrSearchTable, adrSitesTable=nil) { ÇChanges ÇSun, Dec 12, 1999 at 8:34:56 PM by TAC Çadded support for relative file paths ÇBuild a table containing the search preferences for this object. ÇParams: ÇadrObject is the address of the page. ÇadrSearchTable is the address of the search table to build. ÇadrSitesTable (optional) points to a table in config.mainResponder.search.sites to use. ÇThe search table contains: ÇsupportsIndexing: does this database support indexing? This value is the value from user.databases.[dbName].supportsIndexing. ÇflIndexOnCheckIn: does this website want indexing turned on? ÇaddToIndex: XML-RPC procedure name for adding to an index. This comes from config.mainResponder.search, the sites table, or the #search table. ÇrestartIndex: XML-RPC procedure name for restarting a site index. Çdomain: the domain name of the search engine server. Çport: the port number of the search engine server. ÇsiteName: the name of the site this page is in. ÇsiteUrl: the URL of the home page of this site. Çurl: the url of this page. ÇThe search table may contain additional items or fewer items, it's not guaranteed to contain the above and the above only. local (adrUserTable, adrSearchDirectiveTable); local (dbPath); on copyPrefs (adrSource) { //copy preferences from a table into the search table ÇCopy everything but subtables. if defined (adrSource^) { local (i); for i = 1 to sizeOf (adrSource^) { local (adrItem = @adrSource^ [i]); if typeOf (adrItem^) != tableType { table.copy (adrItem, adrSearchTable)}}; return (true)}}; on getSiteRoot (adrObject) { //get the root address of this website local (nomad = adrObject); if typeOf (nomad^) != tableType { nomad = parentOf (nomad^)}; loop { if defined (nomad^.["#ftpSite"]) { return (nomad)}; if defined (nomad^.["#prefs"].ftpSite) { return (nomad)}; if defined (nomad^.["#prefs"].["#ftpSite"]) { return (nomad)}; nomad = parentOf (nomad^); if nomad == nil or nomad == @root { return (nomad)}}}; on getSearchTable (adrObject) { //get the address of the search table for this website local (nomad = adrObject); if typeOf (nomad^) != tableType { nomad = parentOf (nomad^)}; loop { if defined (nomad^.["#search"]) { return (@nomad^.["#search"])}; if defined (nomad^.["#prefs"].search) { return (@nomad^.["#prefs"].search)}; if defined (nomad^.["#prefs"].["#search"]) { return (@nomad^.["#prefs"].["#search"])}; nomad = parentOf (nomad^); if nomad == nil or nomad == @root { return (false)}}}; ÇGet the path to this database. dbPath = window.getFile (table.getRootAddress (adrObject)); ÇFind the entry for this database in user.databases. bundle { Çlocal (dbName = file.fileFromPath (dbPath)) Çif defined (user.databases.[dbName]) ÇadrUserTable = @user.databases.[dbName] ÇLoop through the user.databases table, looking for an entry where the paths match. local (i); local (lowerPath = string.lower (dbPath)); for i = 1 to sizeOf (user.databases) { if defined (user.databases [i].f) { if string.lower (fileSpec (user.databases [i].f)) == lowerPath { // Sun, Dec 12, 1999 at 8:34:56 PM by TAC - added support for relative file paths adrUserTable = @user.databases [i]; break}}}}; ÇIf the user.databases table doesn't exist, or supportsIndexing doesn't exist or is false, return right away. bundle { if adrUserTable == nil { return (false)}; if not defined (adrUserTable^.supportsIndexing) { return (false)}; if not adrUserTable^.supportsIndexing { return (false)}}; ÇCopy the user.databases table into the search table. copyPrefs (adrUserTable); ÇCopy preferences from config.mainResponder.search. copyPrefs (@config.mainResponder.search); ÇNext get the sites table from config.mainResponder.search.sites. (It might not exist, that's okay.) bundle { if adrSitesTable == nil { local (adrSiteRoot = getSiteRoot (adrObject)); //get the root address of this website if (adrSiteRoot != nil) and (adrSiteRoot != @root) { local (i); local (adrTable = @config.mainResponder.search.sites); for i = 1 to sizeOf (adrTable^) { if defined (adrTable^ [i].adrSite) { if adrTable^ [i].adrSite == adrSiteRoot { adrSitesTable = @adrTable^ [i]; break}}}}}}; ÇCopy prefs from the sites table. copyPrefs (adrSitesTable); ÇFind the #search table for this site. It might not exist, that's okay. adrSearchDirectiveTable = getSearchTable (adrObject); ÇCopy prefs from the #search table. copyPrefs (adrSearchDirectiveTable); return (true)} \ No newline at end of file |