|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[gatewiki-commits] SF.net SVN: gatewiki:[1464] trunk/cowRevision: 1464
http://gatewiki.svn.sourceforge.net/gatewiki/?rev=1464&view=rev Author: hcunningham Date: 2009-07-06 21:28:32 +0000 (Mon, 06 Jul 2009) Log Message: ----------- implemented navigation facility, specific to particular directory trees. for example, if you put a list of links in "leftBar.html" in any wiki tree, all pages below the directory containing that file will display those links as a left bar.... Modified Paths: -------------- trunk/cow/doc/cow-backlog.html trunk/cow/doc/cow-backlog.yam trunk/cow/doc/cow-done.html trunk/cow/doc/cow-done.yam trunk/cow/grails-app/conf/Config.groovy trunk/cow/grails-app/controllers/PageController.groovy trunk/cow/grails-app/domain/Wiki.groovy trunk/cow/grails-app/services/PageService.groovy trunk/cow/grails-app/views/layouts/cowpage.gsp trunk/cow/test/integration/DependenciesServiceTests.groovy trunk/cow/test/unit/FileUtilsTests.groovy Modified: trunk/cow/doc/cow-backlog.html =================================================================== --- trunk/cow/doc/cow-backlog.html 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/doc/cow-backlog.html 2009-07-06 21:28:32 UTC (rev 1464) @@ -63,45 +63,46 @@ <li>decide whether to (re-)start the gate-server-redesign stuff from a batch conversion of existing files</li> <li>rename the gate2 layout to gau and delete the old gate.ac.uk layout</li> +<li>add exclusions for / and /help to HtmlTranslator so that links to these + areas are not considered to be missing pages</li> +<li>turn off most of the logging</li> </ul> <ul> <li>add layouts capabilities appropriate for gate.ac.uk and the lifesci work [NA, HC]</li> <ul> - <li>add to gatewiki.html: Customising CoW Layout and Navigation. CoW provides - navigation (sets of links to parts of a site) that can be tailored on a - per-area or per-directory basis, plus layout (CSS styling, page structure, - etc.) that can be tailored on a per-site or per-area basis. Adding - navigation to a directory tree involves adding YAM files to the top of the - tree that contain the links for whichever of various screen areas that you - want to contain them (e.g. top bar, left bar, right bar, footer). These - files have to be named after the corresponding DIV elements of the main - layout (in the default CoW layout, they are called topBar, leftBar, - rightBar and footer; in a CoW running a custom layout they may have - different names). (Note to layout writers: the DIVs that get replaced with - custom navigation must be at the top level of the BODY element in your - layout.)</li> - <li>navigation for specific directory trees [HC]</li> + <li>layouts for particular trees [HC]</li> <ul> - <li>this should all be dealt with at rendering time. otherwise we lose the - ability to work with YAM files outside of CoW. so at the place where CoW - reads the body of a YAM-derived HTML file it should also be given a) the - top directory of the current area tree and b) the current directory - (implicit), and then it should step up the tree looking for the layouts</li> - <li>PC.show, line 90:</li> + <li>test it a bit more</li> + <li>document:</li> <ul> - <li>pageBody = FileUtils.getBody(pageFile)</li> - <li>change this to be PageService.getBody(pageFileDir, wiki.path)</li> - <ul> - <li>this first does an FU.getBody on the page itself, then:</li> - <li>for each layout file in conf.navigation.files</li> - <ul> - <li>find the nearest one to current dir, up the tree to wiki top</li> - <li>get its body</li> - <li>place into the div with the id of the same name</li> - </ul> - </ul> + <li>add to user guide: Customising CoW Layout and Navigation. CoW provides + navigation (sets of links to parts of a site) that can be tailored on + a per-area or per-directory basis, plus layout (CSS styling, page + structure, etc.) that can be tailored on a per-site or per-area basis. + Adding navigation to a directory tree involves adding YAM files to the + top of the tree that contain the links for whichever of various screen + areas that you want to contain them (e.g. top bar, left bar, right + bar, footer). These files have to be named after the corresponding DIV + elements of the main layout (in the default CoW layout, they are + called header, leftBar, rightBar and footer; in a CoW running a custom + layout they may have different names). (Note to layout writers: the + DIVs that get replaced with custom navigation must be at the top level + of the BODY element in your layout.) Because navigation files are + inherited by subtrees, if you have any subdirectories below a + navigation file, the links in the file will have to be absolute (i.e. + start with a "/").</li> + <li>add to developer guide: Navigation for Specific Directory Trees. This + type of navigation is dealt with at rendering time so that we don't + lose the ability to work with YAM files outside of CoW. So at the + place where CoW reads the body of a YAM-derived HTML file it takes a) + the top directory of the current wiki area tree and b) the current + directory (implicit), and then it should step up the tree looking for + all the layouts that are specified in the config (under + navigation.files). Each of those present is added to the page model in + PageController.show, and these become the contents of the relevant + parts of the main layout (e.g. header, leftBar, footer and so on).</li> </ul> </ul> <li>layouts for whole wiki-areas [NA]</li> Modified: trunk/cow/doc/cow-backlog.yam =================================================================== --- trunk/cow/doc/cow-backlog.yam 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/doc/cow-backlog.yam 2009-07-06 21:28:32 UTC (rev 1464) @@ -10,36 +10,41 @@ - decide whether to (re-)start the gate-server-redesign stuff from a batch conversion of existing files - rename the gate2 layout to gau and delete the old gate.ac.uk layout +- add exclusions for / and /help to HtmlTranslator so that links to these + areas are not considered to be missing pages +- turn off most of the logging - add layouts capabilities appropriate for gate.ac.uk and the lifesci work [NA, HC] - - add to gatewiki.html: Customising CoW Layout and Navigation. CoW provides - navigation (sets of links to parts of a site) that can be tailored on a - per-area or per-directory basis, plus layout (CSS styling, page structure, - etc.) that can be tailored on a per-site or per-area basis. Adding - navigation to a directory tree involves adding YAM files to the top of the - tree that contain the links for whichever of various screen areas that you - want to contain them (e.g. top bar, left bar, right bar, footer). These - files have to be named after the corresponding DIV elements of the main - layout (in the default CoW layout, they are called topBar, leftBar, - rightBar and footer; in a CoW running a custom layout they may have - different names). (Note to layout writers: the DIVs that get replaced with - custom navigation must be at the top level of the BODY element in your - layout.) - - navigation for specific directory trees [HC] - - this should all be dealt with at rendering time. otherwise we lose the - ability to work with YAM files outside of CoW. so at the place where CoW - reads the body of a YAM-derived HTML file it should also be given a) the - top directory of the current area tree and b) the current directory - (implicit), and then it should step up the tree looking for the layouts - - PC.show, line 90: - - pageBody = FileUtils.getBody(pageFile) - - change this to be PageService.getBody(pageFileDir, wiki.path) - - this first does an FU.getBody on the page itself, then: - - for each layout file in conf.navigation.files - - find the nearest one to current dir, up the tree to wiki top - - get its body - - place into the div with the id of the same name + - layouts for particular trees [HC] + - test it a bit more; implement on g8rs.net + - document: + - add to user guide: Customising CoW Layout and Navigation. CoW provides + navigation (sets of links to parts of a site) that can be tailored on + a per-area or per-directory basis, plus layout (CSS styling, page + structure, etc.) that can be tailored on a per-site or per-area basis. + Adding navigation to a directory tree involves adding YAM files to the + top of the tree that contain the links for whichever of various screen + areas that you want to contain them (e.g. top bar, left bar, right + bar, footer). These files have to be named after the corresponding DIV + elements of the main layout (in the default CoW layout, they are + called header, leftBar, rightBar and footer; in a CoW running a custom + layout they may have different names). (Note to layout writers: the + DIVs that get replaced with custom navigation must be at the top level + of the BODY element in your layout.) Because navigation files are + inherited by subtrees, if you have any subdirectories below a + navigation file, the links in the file will have to be absolute (i.e. + start with a "/"). + - add to developer guide: Navigation for Specific Directory Trees. This + type of navigation is dealt with at rendering time so that we don't + lose the ability to work with YAM files outside of CoW. So at the + place where CoW reads the body of a YAM-derived HTML file it takes a) + the top directory of the current wiki area tree and b) the current + directory (implicit), and then it should step up the tree looking for + all the layouts that are specified in the config (under + navigation.files). Each of those present is added to the page model in + PageController.show, and these become the contents of the relevant + parts of the main layout (e.g. header, leftBar, footer and so on). - layouts for whole wiki-areas [NA] - add a "areaLayoutName" to Wiki, which would reference a layout GSP in the site-specific plugin; PageLinkTabLib would then use this for the Modified: trunk/cow/doc/cow-done.html =================================================================== --- trunk/cow/doc/cow-done.html 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/doc/cow-done.html 2009-07-06 21:28:32 UTC (rev 1464) @@ -2106,5 +2106,18 @@ populate it from YAM lists, which are the obvious basis for navigation in CoW. so: I guess we won't use this for now</li> </ul> +<li>implemented Navigation for Specific Directory Trees:</li> + <ul> + <li>in PC, where it said pageBody = FileUtils.getBody(pageFile), changed + this to also do PageService.getNavigationModel(pageFileDir, wiki.path)</li> + <ul> + <li>for each layout file in conf.navigation.files</li> + <ul> + <li>find the nearest one to current dir, up the tree to wiki top</li> + <li>get its body</li> + <li>set as var in the model to pass to the layout</li> + </ul> + </ul> + </ul> </ul> </body></html> \ No newline at end of file Modified: trunk/cow/doc/cow-done.yam =================================================================== --- trunk/cow/doc/cow-done.yam 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/doc/cow-done.yam 2009-07-06 21:28:32 UTC (rev 1464) @@ -1444,3 +1444,10 @@ how to have several instances for side bar and so on, and also how to populate it from YAM lists, which are the obvious basis for navigation in CoW. so: I guess we won't use this for now +- implemented Navigation for Specific Directory Trees: + - in PC, where it said pageBody = FileUtils.getBody(pageFile), changed + this to also do PageService.getNavigationModel(pageFileDir, wiki.path) + - for each layout file in conf.navigation.files + - find the nearest one to current dir, up the tree to wiki top + - get its body + - set as var in the model to pass to the layout Modified: trunk/cow/grails-app/conf/Config.groovy =================================================================== --- trunk/cow/grails-app/conf/Config.groovy 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/grails-app/conf/Config.groovy 2009-07-06 21:28:32 UTC (rev 1464) @@ -106,7 +106,7 @@ controller = "gate.cow.GuestLayoutController" } navigation { - // default options: topBar.html leftBar.html rightBar.html footer.html + // default options: header.html leftBar.html rightBar.html footer.html // *note* that these names need to match the div ids in the layout files = [ "leftBar.html" ] // becomes content of leftBar div } Modified: trunk/cow/grails-app/controllers/PageController.groovy =================================================================== --- trunk/cow/grails-app/controllers/PageController.groovy 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/grails-app/controllers/PageController.groovy 2009-07-06 21:28:32 UTC (rev 1464) @@ -109,7 +109,10 @@ response.contentType = thisPage.mimeType response.outputStream << new FileInputStream(pageFile) } - thisPage.putAll( + thisPage.putAll( // add navigation div contents to the model + pageService.getNavigationModel(thisPage.pageFileDir, thisPage.wiki) + ) + thisPage.putAll( // add the body, links and so on [ pageBody: pageBody, pageLinks: pageLinks, errMessage: errMessage, pageTree: pageTree ] ) Modified: trunk/cow/grails-app/domain/Wiki.groovy =================================================================== --- trunk/cow/grails-app/domain/Wiki.groovy 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/grails-app/domain/Wiki.groovy 2009-07-06 21:28:32 UTC (rev 1464) @@ -40,7 +40,6 @@ */ Integer updateInterval - /** Validation */ transient static constraints = { path(blank : false, unique : true, validator : { Modified: trunk/cow/grails-app/services/PageService.groovy =================================================================== --- trunk/cow/grails-app/services/PageService.groovy 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/grails-app/services/PageService.groovy 2009-07-06 21:28:32 UTC (rev 1464) @@ -25,7 +25,7 @@ /** Tasks related to page requests. */ class PageService { - // needed for the GWT application to use this service + /** Information needed for the GWT application to use this service. */ static expose = ["gwt:gate.cow.gwt.client"] /** Analyse the request and return a map modelling this type of page. */ @@ -93,7 +93,6 @@ pm.isPlainText = true } - // thirdparty and solr status pm.searchEnabled = conf.thirdparty && conf.solr.run @@ -109,6 +108,31 @@ return pm.toMap() } // analyse(Map) + /** Get the navigation model for a page. */ + Map getNavigationModel(File pageFileDir, Wiki pageWiki) { + return getNavigationModel(pageFileDir, pageWiki, conf.navigation.files) + } // getNavigationModel(File, File) + + /** Get the navigation model for a page relative to config. */ + Map getNavigationModel(File pageFileDir, Wiki pageWiki, List navFiles) { + Map model = [ : ] + File wikiTopDir = new File(pageWiki.path) + + for(path in navFiles) { + log.debug("looking for nav file called ${path}...") + File navFile = FileUtils.findFileInTree(path, wikiTopDir, pageFileDir) + if(! navFile) + continue + + String divName = navFile.name - ".html" + log.debug("adding nav model entry for DIV ${divName}") + String contents = FileUtils.getBody(navFile) + model.put(divName, contents) + } + + return model + } // getNavigationModel(File, File, Map) + /** * Check the name of a page before to create it. */ Modified: trunk/cow/grails-app/views/layouts/cowpage.gsp =================================================================== --- trunk/cow/grails-app/views/layouts/cowpage.gsp 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/grails-app/views/layouts/cowpage.gsp 2009-07-06 21:28:32 UTC (rev 1464) @@ -27,8 +27,7 @@ } </script> </head> - <body - onload="focusOnSearch(${gate.cow.CowUtils.getConfig().gate.cow.solr.run})"> + <body onload="focusOnSearch(${gate.cow.CowUtils.getConfig().gate.cow.solr.run})"> <div id="topBar"> <span id="topLogo"> <a href="${createLinkTo(dir:'/')}"><g:cowLogo/></a> @@ -37,7 +36,7 @@ <!-- first row header links --> <div id="topLoginEtc"> - <!-- If admin area, id will be null; don't show search box in admin area --> + <!-- If admin area, id will be null; do not show search box in admin area --> <g:if test="${id}"> <g:if test="${gate.cow.CowUtils.getConfig().gate.cow.solr.run}"> <g:form name="searchForm" controller="search" method="post" @@ -93,12 +92,12 @@ </div> - <div id="topBar"></div> - <div id="topSeparator"></div> - <div id="leftBar"></div> + <div id="header">${header}</div> + <div id="topSeparator"> </div> + <div id="leftBar">${leftBar}</div> <g:layoutBody /> - <div id="rightBar"> </div> - <div id="footer"> </div> + <div id="rightBar">${rightBar}</div> + <div id="footer">${footer}</div> <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"/> Modified: trunk/cow/test/integration/DependenciesServiceTests.groovy =================================================================== --- trunk/cow/test/integration/DependenciesServiceTests.groovy 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/test/integration/DependenciesServiceTests.groovy 2009-07-06 21:28:32 UTC (rev 1464) @@ -20,7 +20,6 @@ /** A directory containing yam files for the test wiki */ def testWikiPath = "test/integration/resources/dependencies" - /** A test wiki for the yam files in testWikiPath*/ def testWiki @@ -51,17 +50,13 @@ */ def knownDepsFileName = "dependencies" - /** Defines the string read from knownDepsFileName */ def knownDepsString - /** Test Wiki dependency regeneration */ void testDependencyRegeneration() { - log.info("DependenciesService.testDependencyRegeneration") - // Regenerate dependencies for this wiki dependenciesService.regenerate(testWiki) def regeneratedDeps = dependenciesService.get(testWiki) @@ -76,7 +71,6 @@ // Assert equality of known dependencies with regenerated dependencies assertEquals("Regenerated Dependencies not as expected", knownDepsString, regeneratedDepsString) - } /** Set up the test data */ Modified: trunk/cow/test/unit/FileUtilsTests.groovy =================================================================== --- trunk/cow/test/unit/FileUtilsTests.groovy 2009-07-06 19:40:51 UTC (rev 1463) +++ trunk/cow/test/unit/FileUtilsTests.groovy 2009-07-06 21:28:32 UTC (rev 1464) @@ -27,13 +27,13 @@ String pageString = ''' <body> - <div id="topBar"> </div> + <div id="header"> </div> <div id="leftBar"> </div> <div id="footer"> </div> </body> ''' String expected = '''<body> - <div id="topBar"/> + <div id="header"/> <div id="leftBar"> new text! </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ gatewiki-commits mailing list gatewiki-commits@... https://lists.sourceforge.net/lists/listinfo/gatewiki-commits |
| Free embeddable forum powered by Nabble | Forum Help |