Changesets can be listed by changeset number.
The Git repository is here.
Changeset 140
New <r:linked_directory_listing dir="search_directory" /> tag, to clear
Ticket #62. Associated environment.rb change to indicate document root
physical location without exposing that through an editable part of the
CMS, just in case the CMS security is breached. Added new Radiant
stylesheet, now included by the master layout in the databse, which
includes the main site stylesheet itself. All this does for now is make
PRE text look a bit better; fits well with the CVS repository structure
pages.
- Comitted by: adh
- Date: Wednesday November 01 00:11:38 2006 (over 18 years ago)
Affected files:
- rool/rails/radiant/trunk/public/stylesheets/risc_os_open.css
- rool/rails/radiant/trunk/app/models/page_context.rb (diff)
- rool/rails/radiant/trunk/config/environment.rb (diff)
rool/rails/radiant/trunk/app/models/page_context.rb:
prev. | current | |
end | ||
# | ||
415 | # <r:linked_directory_listing dir="search_directory" /> | |
416 | # | |
417 | # Returns a series of <li>...</li> containers enumerating items in the | |
418 | # given directory and any subdirectories it contains. Pass the path to | |
419 | # the topmost folder relative to document root in the 'dirs' attribute. | |
420 | # | |
421 | # Certain magic directories are ignored (CVS, .svn). | |
422 | # | |
423 | define_tag 'linked_directory_listing' do |tag| | |
424 | unless dir = tag.attr['dir'] | |
425 | raise TagError.new("`linked_directory_listing' tag must contain `dir' attribute") | |
426 | end | |
427 | ||
428 | recursive_directory_list_in_li_tags(PATH_TO_DOCUMENT_ROOT, dir) | |
429 | end | |
430 | ||
431 | # | |
# <r:find url="value_to_find">...</r:find> | ||
# | ||
# Inside this tag all page related tags refer to the tag found at the 'url' attribute. | ||
... | ... | |
def postgres? | ||
ActiveRecord::Base.connection.adapter_name =~ /postgres/i | ||
end | ||
592 | ||
def build_regexp_for(tag,attribute_name) | ||
ignore_case = tag.attr.has_key?('ignore_case') && tag.attr['ignore_case']=='false' ? nil : true | ||
begin | ||
... | ... | |
end | ||
return regexp | ||
end | ||
602 | ||
603 | # Support the linked_directory_listing tag. | |
604 | # | |
605 | def recursive_directory_list_in_li_tags(base, dir) | |
606 | ||
607 | # Based on: | |
608 | # | |
609 | # http://www.oreillynet.com/onjava/blog/2006/03/recursive_directory_list_with.html | |
610 | ||
611 | excludes = [ 'CVS', '.svn' ] | |
612 | html = '' | |
613 | ||
614 | dir = base + dir | |
615 | ||
616 | Find.find(dir) do |path| | |
617 | if FileTest.directory?(path) | |
618 | if excludes.include?(File.basename(path)) | |
619 | Find.prune # Don't look any further into this directory. | |
620 | else | |
621 | next | |
622 | end | |
623 | else | |
624 | leaf = File.basename(path) | |
625 | mod = File.mtime(path) | |
626 | link = "#{path[base.length..-1]}?#{mod.tv_sec}" | |
627 | size = number_to_human_size(File.size(path)) | |
628 | ||
629 | html << "<li><a href=\"#{link}\"><b>#{leaf}</b></a> (#{size})<br /><small>Last modified #{mod}</small></li>" | |
630 | end | |
631 | end | |
632 | ||
633 | html = '<li>There are no files currently available.</li>' if html.empty? | |
634 | return html | |
635 | end | |
636 | ||
637 | # Ripped straight out of ActionView::Helpers::NumberHelper. | |
638 | # | |
639 | def number_to_human_size(size) | |
640 | case | |
641 | when size < 1.kilobyte: '%d Bytes' % size | |
642 | when size < 1.megabyte: '%.1f KB' % (size / 1.0.kilobyte) | |
643 | when size < 1.gigabyte: '%.1f MB' % (size / 1.0.megabyte) | |
644 | when size < 1.terabyte: '%.1f GB' % (size / 1.0.gigabyte) | |
645 | else '%.1f TB' % (size / 1.0.terabyte) | |
646 | end.sub('.0', '') | |
647 | rescue | |
648 | nil | |
649 | end | |
end |
rool/rails/radiant/trunk/config/environment.rb:
prev. | current | |
# Location of application relative to document root in terms of | ||
# URLs (i.e. according to the web server configuration, not the | ||
15 | ||
15 | # filesystem location). Location of that server document root, as | |
16 | # a physical path. | |
PATH_PREFIX = '/rails/radiant' | ||
19 | PATH_TO_DOCUMENT_ROOT = '/home/adh/www' | |
require 'radius' | ||