Changeset 1419
- Timestamp:
- 03/16/08 15:44:13
- Files:
-
- HTTP/WikiContentService.lua (modified) (2 diffs)
- HTTP/WikiDateService.lua (modified) (2 diffs)
- HTTP/WikiDateService.txt (modified) (1 diff)
- HTTP/WikiIndexService.lua (modified) (2 diffs)
- HTTP/WikiIndexService.txt (modified) (1 diff)
- HTTP/WikiSearchService.lua (modified) (3 diffs)
- HTTP/WikiSearchService.txt (modified) (1 diff)
- HTTP/WikiService.lua (modified) (1 diff)
- HTTP/etc/bullet1.png (added)
- HTTP/etc/bullet2.png (added)
- HTTP/etc/bullet3.png (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
HTTP/WikiContentService.lua
r1411 r1419 34 34 local HTML = WikiService.HTML 35 35 local Path = WikiService.Path 36 local Tag = WikiService.Tag 36 37 37 38 local os = require( 'os' ) … … 84 85 85 86 return aTitle 86 end87 88 local function Tag( aModification )89 local aDay = os.date( '!%A', aModification )90 local anHour = tonumber( os.date( '!%I', aModification ) )91 local aMeridian = os.date( '!%p', aModification )92 local aTag = nil93 local aLabel = nil94 95 if Today( aModification ) then96 aLabel = ( 'Edited today around %d %s' ):format( anHour, aMeridian )97 aTag = 198 elseif Yesterday( aModification ) then99 aLabel = ( 'Edited yesterday around %d %s' ):format( anHour, aMeridian )100 aTag = 2101 elseif ThisWeek( aModification ) then102 aLabel = ( 'Edited last %s around %d %s' ):format( aDay, anHour, aMeridian )103 aTag = 3104 end105 106 if aTag and aLabel then107 return ( '<img src=\'/etc/tag%d.png\' alt=\'tag\' title=\'%s\' class=\'navigation\' style=\'vertical-align: text-bottom;\' height=\'16\' width=\'16\'/>' ):format( aTag, aLabel )108 end109 87 end 110 88 HTTP/WikiDateService.lua
r1410 r1419 30 30 local HTML = WikiService.HTML 31 31 local Path = WikiService.Path 32 local Tag = WikiService.Tag 32 33 33 34 local os = require( 'os' ) … … 247 248 aNameTemplate[ 'href' ] = Encode( aURL.path ) 248 249 aNameTemplate[ 'name' ] = Encode( aContent.title ) 250 aNameTemplate[ 'tag' ] = Tag( aContent.modification, true ) 249 251 250 252 aTemplate[ 'names' ] = aNameTemplate HTTP/WikiDateService.txt
r1220 r1419 5 5 <ul> 6 6 [t:names] 7 <li><a href='[v:href]' title='[v:name]'>[v:name]</a> </li>7 <li><a href='[v:href]' title='[v:name]'>[v:name]</a>[v:tag]</li> 8 8 [/t:names] 9 9 </ul> HTTP/WikiIndexService.lua
r1410 r1419 29 29 local HTML = WikiService.HTML 30 30 local Path = WikiService.Path 31 local Tag = WikiService.Tag 31 32 32 33 local getmetatable = getmetatable … … 166 167 167 168 aNameTemplate[ 'href' ] = Encode( aURL.path ) 168 aNameTemplate[ 'name' ] = aContent.title 169 aNameTemplate[ 'name' ] = Encode( aContent.title ) 170 aNameTemplate[ 'tag' ] = Tag( aContent.modification, true ) 169 171 170 172 aTemplate[ 'names' ] = aNameTemplate HTTP/WikiIndexService.txt
r1220 r1419 5 5 <ul> 6 6 [t:names] 7 <li><a href='[v:href]' title='[v:name]'>[v:name]</a> </li>7 <li><a href='[v:href]' title='[v:name]'>[v:name]</a>[v:tag]</li> 8 8 [/t:names] 9 9 </ul> HTTP/WikiSearchService.lua
r1418 r1419 30 30 local HTML = WikiService.HTML 31 31 local Path = WikiService.Path 32 local Tag = WikiService.Tag 32 33 33 34 local getmetatable = getmetatable … … 134 135 aNameTemplate[ 'href' ] = Encode( aURL.path ) 135 136 aNameTemplate[ 'name' ] = Encode( aContent.title ) 137 aNameTemplate[ 'tag' ] = Tag( aContent.modification, true ) 136 138 137 139 aTemplate[ 'hits' ] = aNameTemplate … … 144 146 aNameTemplate[ 'href' ] = Encode( aURL.path ) 145 147 aNameTemplate[ 'name' ] = Encode( aContent.title ) 148 aNameTemplate[ 'tag' ] = Tag( aContent.modification, true ) 146 149 147 150 if not someNames[ aContent.name ] then HTTP/WikiSearchService.txt
r1220 r1419 3 3 <ul> 4 4 [t:hits] 5 <li><a href='[v:href]' title='[v:name]'>[v:name]</a> </li>5 <li><a href='[v:href]' title='[v:name]'>[v:name]</a>[v:tag]</li> 6 6 [/t:hits] 7 7 </ul> 8 8 <ul> 9 9 [t:names] 10 <li><a href='[v:href]' title='[v:name]'>[v:name]</a> </li>10 <li><a href='[v:href]' title='[v:name]'>[v:name]</a>[v:tag]</li> 11 11 [/t:names] 12 12 </ul> HTTP/WikiService.lua
r1380 r1419 312 312 end 313 313 314 function Tag( aModification, isSmall ) 315 local aDay = os.date( '!%A', aModification ) 316 local anHour = tonumber( os.date( '!%I', aModification ) ) 317 local aMeridian = os.date( '!%p', aModification ) 318 local aTag = nil 319 local aLabel = nil 320 321 if Today( aModification ) then 322 aLabel = ( 'Edited today around %d %s' ):format( anHour, aMeridian ) 323 aTag = 1 324 elseif Yesterday( aModification ) then 325 aLabel = ( 'Edited yesterday around %d %s' ):format( anHour, aMeridian ) 326 aTag = 2 327 elseif ThisWeek( aModification ) then 328 aLabel = ( 'Edited last %s around %d %s' ):format( aDay, anHour, aMeridian ) 329 aTag = 3 330 end 331 332 if aTag and aLabel then 333 local aType = 'tag' 334 335 if isSmall then 336 aType = 'bullet' 337 end 338 339 return ( '<img src=\'/etc/%s%d.png\' alt=\'tag\' title=\'%s\' class=\'navigation\' style=\'vertical-align: text-bottom;\' height=\'16\' width=\'16\'/>' ):format( aType, aTag, aLabel ) 340 end 341 end 342 314 343 -------------------------------------------------------------------------------- 315 344 -- Metamethods