Fixed issue with form being submitted twice

<%= "Lock Information".t %>

    <%= 'Access Control:'.t %>

<% if @lock_options.access_control == 'lock' %>
  <%= "ONLY selected profiles may access this page".t %>
<% elsif @lock_options.access_control == 'unlock' -%>
   <%= "All users EXCEPT those with selected profiles may access this page".t %>
<% else -%>
  <%= "[Access Control Not Set]".t %>
<% end -%>

  <% if @lock_options.options.include?('override') %>
    ( <%= "Overrides Previous Locks" %> )
  <% end -%>

    <%= 'Affected Users:'.t %>

<% if @mod.user_roles('access').length == 0 %>
  [<%= 'No Selected Profiles'.t %>]
<% else -%>
  <% @mod.user_roles('access').each do |cls| %>
    <%= cls.name %>

  <% end -%>
<% end -%>

  <%= "Lockout Redirect:".t %>

    <%= @redirect_page ? @redirect_page.node_path : "[No Page Selected]".t %>

<% admin_form_for :lock, @lock_options, :html => {:id => 'lock_form', :onsubmit => 'LockEditor.submitForm(); return false;' }  do  |f| -%>
  <%= f.radio_buttons :access_control, [ [  'Only Allow Selected', 'lock'], ['Allow All except Selected','unlock' ] ],:vertical => true, :label => 'Lock Type' %>

  <% cms_subfields_for :mod,@mod do |sf| -%>
    <%= sf.ordered_selection_list('access_authorized',UserClass,:id_field => 'identifier',:options =>  Role.authorized_options(:all), :sortable => false, :vertical => true, :label => 'Affected Users') %>
  <% end -%>

  <%= f.page_selector :redirect, :label => 'On Lockout Redirect Users To:', :vertical => true %>
  <%= f.check_boxes :options, [ [ 'Override Previous Locks','override' ] ], :label => '',:vertical => true %>

  <%= f.cancel_submit_buttons 'Cancel','Update', { :onclick=>'LockEditor.hideEdit();' } , { } -%>
<% end -%>

<%= "Lock Information".t %>

    <%= 'Access Control:'.t %>

<% if @lock_options.access_control == 'lock' %>
  <%= "ONLY selected profiles may access this page".t %>
<% elsif @lock_options.access_control == 'unlock' -%>
   <%= "All users EXCEPT those with selected profiles may access this page".t %>
<% else -%>
  <%= "[Access Control Not Set]".t %>
<% end -%>

  <% if @lock_options.options.include?('override') %>
    ( <%= "Overrides Previous Locks" %> )
  <% end -%>

    <%= 'Affected Users:'.t %>

<% if @mod.user_roles('access').length == 0 %>
  [<%= 'No Selected Profiles'.t %>]
<% else -%>
  <% @mod.user_roles('access').each do |cls| %>
    <%= cls.name %>

  <% end -%>
<% end -%>

  <%= "Lockout Redirect:".t %>

    <%= @redirect_page ? @redirect_page.node_path : "[No Page Selected]".t %>

<% admin_form_for :lock, @lock_options, :html => {:id => 'lock_form', :onsubmit => 'LockEditor.submitForm(); return false;' }  do  |f| -%>
  <%= f.radio_buttons :access_control, [ [  'Only Allow Selected', 'lock'], ['Allow All except Selected','unlock' ] ],:vertical => true, :label => 'Lock Type' %>

  <% cms_subfields_for :mod,@mod do |sf| -%>
    <%= sf.ordered_selection_list('access_authorized',UserClass,:id_field => 'identifier',:options =>  Role.authorized_options(:all), :sortable => false, :vertical => true, :label => 'Affected Users') %>
  <% end -%>

  <%= f.page_selector :redirect, :label => 'On Lockout Redirect Users To:', :vertical => true %>
  <%= f.check_boxes :options, [ [ 'Override Previous Locks','override' ] ], :label => '',:vertical => true %>

  <%= f.cancel_submit_buttons 'Cancel','Update', { :onclick=>'LockEditor.hideEdit();' } , { :onclick=>'LockEditor.submitForm();' } -%>
<% end -%>


Fix #532 http://code.google.com/p/activescaffold/issues/detail?id=532 Show rows as readonly in subform when row is not authorized for update Show blank row in subform if row is authorized for create even when it's not authorized for update

<% record_column = column -%>
<% readonly = (@record.readonly? or not @record.authorized_for?(:action => :update)) -%>
<% action = @record.new_record? ? :create : (readonly ? :read : nil) -%>
<% show_actions = false -%>
<% active_scaffold_config_for(@record.class).subform.columns.each :for => @record.class, :action => action, :flatten => true do |column| %>
  <%
  next unless in_subform?(column, parent_record)
  show_actions = true
  column = column.clone
  column.form_ui ||= :select if column.association
  -%>

    <% unless readonly and not @record.new_record? -%>
      <%= render :partial => form_partial_for_column(column), :locals => { :column => column, :scope => scope } -%>
    <% else -%>

<%= get_column_value(@record, column) -%>

    <% end -%>

<% end -%>
<% if show_actions -%>

    <%= link_to_function as_('Remove'), '$(this).up(".association-record").remove()', { :class => "destroy" } if @record.authorized_for?(:action => :destroy) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent]) %>
    <% unless @record.new_record? %>
    <input type="hidden" name="<%= "record#{scope}[id]" -%>" value="<%= @record.id -%>" />
    <% end -%>

<% end -%>

<% record_column = column -%>
<% readonly = (@record.readonly? or not @record.authorized_for?(:action => :update)) -%>
<% action = @record.new_record? ? :create : (readonly ? :read : nil) -%>
<% show_actions = false -%>
<% active_scaffold_config_for(@record.class).subform.columns.each :for => @record.class, :action => action, :flatten => true do |column| %>
  <%
  next unless in_subform?(column, parent_record)
  show_actions = true
  column = column.clone
  column.form_ui ||= :select if column.association
  -%>

    <% unless readonly and not @record.new_record? -%>
      <%= render :partial => form_partial_for_column(column), :locals => { :column => column, :scope => scope } -%>
    <% else -%>

        <%= get_column_value(@record, column) -%>
        <%= hidden_field :record, column.name, active_scaffold_input_options(column, scope) -%>

    <% end -%>

<% end -%>
<% if show_actions -%>

    <%= link_to_function as_('Remove'), '$(this).up(".association-record").remove()', { :class => "destroy" } if @record.authorized_for?(:action => :destroy) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent]) %>
    <% unless @record.new_record? %>
    <input type="hidden" name="<%= "record#{scope}[id]" -%>" value="<%= @record.id -%>" />
    <% end -%>

<% end -%>


comment out unapi div until we actually get it working

<% if controller.controller_name() == 'request' %>
<body onload="<%= display_closest_web_results? -%><%= remote_function(:url => { :action => :do_background_services, :id=>@context_object_handler.id, :background_id=>@background_id }, :success=>"showIDs(request.responseText)")-%>">
<% else %>

<%end%>

<% if @user_request %>

<% end %>

<% if controller.controller_name() == 'request' %>
<body onload="<%= display_closest_web_results? -%><%= remote_function(:url => { :action => :do_background_services, :id=>@context_object_handler.id, :background_id=>@background_id }, :success=>"showIDs(request.responseText)")-%>">
<% else %>

<%end%>

<% if @user_request %>

<abbr class="unapi-id" title="<%= CGI.escape(@user_request.referent.to_context_object.kev) %>">

<% end %>


r214: Removed elapsed time from dashboard for now, to get the build passing. We'll refactor and put this back in later.

<div id="project_<%= project.name %>" class="project build_<%= project.last_build_status %>">

        <%= link_to project.name, :controller => 'builds', :action => 'show', :project => project.name %>

      <% recent_builds = project.last_five_builds %>

      <%= recent_builds.first ? 'build ' : 'Never built' %>

      <% unless recent_builds.empty? %>

          <% recent_builds.each do |build| %>

<%= link_to_build(project, build) %>

          <% end %>

      <% end %>

      <% form_remote_tag( :url => { :action => 'force_build' }) do %>
           <%= hidden_field_tag("project",project.name) %>
           <%= submit_tag 'Build now' %>
      <% end %>

    <%= display_builder_state(project.builder_state_and_activity) %>

    <% if project.last_build_status == "success" %>
        Build finished in  <%= project.last_build.elapsed_time %> seconds
    <% end %>


use booking title as link to show in list

Listing bookings

    <%= sort_header 'title' %>
    <%= sort_header 'value_date' %>
    <%= sort_header 'credit_account_id' %>
    <%= sort_header 'debit_account_id' %>
    <%= sort_header 'amount' %>

<% for booking in @bookings %>

    <%= link_to h(booking.title), :action => 'show', :id => booking %>
    <span id="time_ago_in_words_<%=booking.id %>" style="display: none"><%= link_to_function time_ago_in_words(booking.value_date), "toggle('time_ago_in_words_#{booking.id}', 'date_#{booking.id}')" unless booking.value_date.nil?%><span id="date_<%=booking.id %>"><%= link_to_function booking.value_date.strftime('%d.%m.%Y'), "toggle('date_#{booking.id}', 'time_ago_in_words_#{booking.id}')"  unless booking.value_date.nil? %>
    <%=link_to h(booking.credit_account.title), :controller => :accounts, :action => :show, :id => booking.credit_account unless booking.credit_account.nil? %>
    <%=link_to h(booking.debit_account.title), :controller => :accounts, :action => :show, :id => booking.debit_account unless booking.debit_account.nil? %>
    <%=h number_to_currency(booking.rounded_amount, :unit => "CHF ")  %>

    <%= link_to 'Edit', :action => 'edit', :id => booking %>
    <%= link_to 'Destroy', { :action => 'destroy', :id => booking }, :confirm => 'Are you sure?', :method => :post %>

<% end %>

<%= link_to 'Previous page', { :page => @booking_pages.current.previous } if @booking_pages.current.previous %>
<%= link_to 'Next page', { :page => @booking_pages.current.next } if @booking_pages.current.next %>

<%= link_to 'New booking', :action => 'new' %>

Listing bookings

    <%= sort_header 'title' %>
    <%= sort_header 'value_date' %>
    <%= sort_header 'credit_account_id' %>
    <%= sort_header 'debit_account_id' %>
    <%= sort_header 'amount' %>

<% for booking in @bookings %>

    <%=h booking.title%>
    <span id="time_ago_in_words_<%=booking.id %>" style="display: none"><%= link_to_function time_ago_in_words(booking.value_date), "toggle('time_ago_in_words_#{booking.id}', 'date_#{booking.id}')" unless booking.value_date.nil?%><span id="date_<%=booking.id %>"><%= link_to_function booking.value_date.strftime('%d.%m.%Y'), "toggle('date_#{booking.id}', 'time_ago_in_words_#{booking.id}')"  unless booking.value_date.nil? %>
    <%=link_to h(booking.credit_account.title), :controller => :accounts, :action => :show, :id => booking.credit_account unless booking.credit_account.nil? %>
    <%=link_to h(booking.debit_account.title), :controller => :accounts, :action => :show, :id => booking.debit_account unless booking.debit_account.nil? %>
    <%=h number_to_currency(booking.rounded_amount, :unit => "CHF ")  %>

    <%= link_to 'Show', :action => 'show', :id => booking %>
    <%= link_to 'Edit', :action => 'edit', :id => booking %>
    <%= link_to 'Destroy', { :action => 'destroy', :id => booking }, :confirm => 'Are you sure?', :method => :post %>

<% end %>

<%= link_to 'Previous page', { :page => @booking_pages.current.previous } if @booking_pages.current.previous %>
<%= link_to 'Next page', { :page => @booking_pages.current.next } if @booking_pages.current.next %>

<%= link_to 'New booking', :action => 'new' %>


Add wise4 glue to mysystem_sc.html

Add wise4 glue to mysystem_sc.html

<% # SPROUTCORE DEFAULT INDEX TEMPLATE
   # This template provide provides a basic wrapper for a SproutCore client.
   # Most of the time, it will be sufficient for your own needs.  However, if
   # you need to create your own template, you can do so by copying this file
   # into your client, naming it 'index.rhtml' and then adding the options
   # :layout => 'lib/index' to your Buildfile.
   #
   # See the comments in this file for more information on what you can
   # change.
-%>
<!DOCTYPE html>
<html<% unless @content_for_html5_manifest.blank? %> manifest="app.manifest"<% end %>>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8<%= config.chrome_frame ? ',chrome=1' : '' %>" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="<%= config.status_bar_style || 'default' %>" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="apple-touch-icon<%= '-precomposed' if config.precomposed_icon %>" href="<%= sc_static(config.icon || 'sproutcore-logo.png') %>" />
	  <link rel="apple-touch-startup-image" media="screen and (orientation:portrait)" href="<%= sc_static(config.startup_image_portrait || 'sproutcore-startup-portrait.png') %>" />
	  <link rel="apple-touch-startup-image" media="screen and (orientation:landscape)" href="<%= sc_static(config.startup_image_landscape || 'sproutcore-startup-landscape.png') %>" />
	  <link rel="shortcut icon" href="<%= sc_static(config.favicon || 'favicon.ico') %>" type="image/x-icon" />

<% # Set the 'title' in your config to alter this setting %>
    <title><%= title %></title>
<% #
   # You may choose to load one or more bootstrap resources.  These are
   # JS targets that you would like to load at the top of the page.  Specify
   # these in your Buildfile with the 'bootstrap' config.
-%>
  <%= bootstrap %>

  <% # begin WISE4 glue -%>

  <% # End WISE4 glue -%>

<% #
   # This line should appear in your head area to include the stylesheets
   # generated by your client.  If you need to include your own
   # stylesheets, you don't need to change it here.  Instead use the
   # required option in your config.
-%>
   <%= stylesheets_for_client %>
   <%= @content_for_page_styles %>

<% # The theme CSS class is added automatically based on your chosen theme.
   # If you need to specify a custom theme name, use CONFIG.theme_name
-%>
  <body class="<%= [theme_name(:default => 'sc-theme'), 'focus'].compact.join(' ') %>">
<% # This section is used to setup additional optional class names on the
   # body content based on JS-selected conditions.  Use this to make sure you
   # show the proper CSS as soon as the page appears.
-%>
<%= inline_javascript('sproutcore/bootstrap:setup_body_class_names') %>

<% #
   # This is where you root body element will appear.  To cause your
   # content to appear here, just declare content_for('body') in one of
   # your partials.
-%>
<%= @content_for_body %>
<% #
   # This is where your loading screen will appear.  To add a loading screen
   # just declare content_for('loading') in one of your partials. If you use
   # sc-gen to generate your app, it will create a file called loading.rhtml
   # under english.lproj. You can insert the desired content there.
-%>
<% unless @content_for_loading.blank? %>

<%= @content_for_loading %>

<% end -%>

  {
    "MySystem.Link": {
      "link1": {
        "guid": "link1",
        "text": "First link",
        "startNode": "1",
        "startTerminal": "a",
        "endNode": "2",
        "endTerminal": "b",
        "color": "#FF0000"
      },
      "link2": {
        "guid": "link2",
        "text": "Second link",
        "startNode": "1",
        "startTerminal": "a",
        "endNode": "3",
        "endTerminal": "b",
        "color": "#FF0000"
      }
    },
    "MySystem.Node": {
      "1": {
        "guid": "1",
        "image": "/static/my_system/en/current/resources/clay_red_tn.png",
        "title": "A Node",
        "transformer": false,
        "inLinks": [],
        "outLinks": [
          "link1",
          "link2"
        ],
        "position": {
          "x": 160,
          "y": 160
        },
        "transformations": [
          "trans1"
        ]
      },
      "2": {
        "guid": "2",
        "image": "/static/my_system/en/current/resources/hand_tn.png",
        "title": "B Node",
        "transformer": false,
        "inLinks": [
          "link1"
        ],
        "outLinks": [],
        "position": {
          "x": 310,
          "y": 10
        }
      },
      "3": {
        "guid": "3",
        "image": "/static/my_system/en/current/resources/lightbulb_tn.png",
        "title": "Third Node",
        "transformer": false,
        "inLinks": [
          "link2"
        ],
        "outLinks": [],
        "position": {
          "x": 10,
          "y": 10
        }
      }
    },
    "MySystem.Story": {
      "1": {
        "guid": 1,
        "storyHtml": "<p>Make a system diagram to help explain how <i>both</i> the sun and people's actions affect the Earth's climate.</p><ul><li>Where does energy come from?</li><li>How does energy move?</li><li>Where does energy go?</li><li>How does energy change?</li></ul>"
      }
    },
    "MySystem.StorySentence": {
      "ss1": {
        "guid": "ss1",
        "order": 1,
        "bodyText": "First..."
      },
      "ss2": {
        "guid": "ss2",
        "order": 2,
        "bodyText": "Then..."
      },
      "ss3": {
        "guid": "ss3",
        "order": 3,
        "bodyText": "Finally..."
      }
    }
  }

<% #
   # This is where the resources you declare will appear.  By default anything
   # you add to partials will be added to this section unless you specify
   # otherwise.  Note that resources are initially hidden so you can pull them
   # apart as needed on page load.
-%>
<% unless @content_for_resources.blank? %>

      <%= @content_for_resources -%>

<% end -%>
<% #
   # This line should appear at the bottom of your page to include your
   # generated JavaScript and any libraries you reference.  If you need
   # to include other javascripts, add them to the :requires option of
   # your client in routes.rb instead of changing it here.
-%>
<%= javascripts_for_client %>
<% unless @content_for_page_javascript.blank? %>
<%= @content_for_page_javascript %>
<% end -%>
<% #
   # If you use old-style view helpers in your page, this method must be
   # called to actually add the page views to your HTML.  Normally this will
   # not generate any content.
-%>
<% #render_page_views -%>
<% # Older SproutCore applications need SC.didLoad to be called after onload.
   # This is no longer required by SproutCore so it is off by default.  To
   # reenable set use_window_onload = true in yur config.
-%>
<% if config.use_window_onload %>

<% end -%>
<% #
   # The final content section can be used to add any last minute setup you
   # need to do before the page ends.  This is required for loading unit
   # tests among other things.
-%>
<%= @content_for_final -%>
<%
  #disable main if the application is loaded in design mode
%>
<%= @content_for_designer -%>

<% # SPROUTCORE DEFAULT INDEX TEMPLATE
   # This template provide provides a basic wrapper for a SproutCore client.
   # Most of the time, it will be sufficient for your own needs.  However, if
   # you need to create your own template, you can do so by copying this file
   # into your client, naming it 'index.rhtml' and then adding the options
   # :layout => 'lib/index' to your Buildfile.
   #
   # See the comments in this file for more information on what you can
   # change.
-%>
<!DOCTYPE html>
<html<% unless @content_for_html5_manifest.blank? %> manifest="app.manifest"<% end %>>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8<%= config.chrome_frame ? ',chrome=1' : '' %>" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="<%= config.status_bar_style || 'default' %>" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="apple-touch-icon<%= '-precomposed' if config.precomposed_icon %>" href="<%= sc_static(config.icon || 'sproutcore-logo.png') %>" />
	  <link rel="apple-touch-startup-image" media="screen and (orientation:portrait)" href="<%= sc_static(config.startup_image_portrait || 'sproutcore-startup-portrait.png') %>" />
	  <link rel="apple-touch-startup-image" media="screen and (orientation:landscape)" href="<%= sc_static(config.startup_image_landscape || 'sproutcore-startup-landscape.png') %>" />
	  <link rel="shortcut icon" href="<%= sc_static(config.favicon || 'favicon.ico') %>" type="image/x-icon" />

<% # Set the 'title' in your config to alter this setting %>
    <title><%= title %></title>
<% #
   # You may choose to load one or more bootstrap resources.  These are
   # JS targets that you would like to load at the top of the page.  Specify
   # these in your Buildfile with the 'bootstrap' config.
-%>
  <%= bootstrap %>

<% #
   # This line should appear in your head area to include the stylesheets
   # generated by your client.  If you need to include your own
   # stylesheets, you don't need to change it here.  Instead use the
   # required option in your config.
-%>
   <%= stylesheets_for_client %>
   <%= @content_for_page_styles %>

<% # The theme CSS class is added automatically based on your chosen theme.
   # If you need to specify a custom theme name, use CONFIG.theme_name
-%>
  <body class="<%= [theme_name(:default => 'sc-theme'), 'focus'].compact.join(' ') %>">
<% # This section is used to setup additional optional class names on the
   # body content based on JS-selected conditions.  Use this to make sure you
   # show the proper CSS as soon as the page appears.
-%>
<%= inline_javascript('sproutcore/bootstrap:setup_body_class_names') %>

<% #
   # This is where you root body element will appear.  To cause your
   # content to appear here, just declare content_for('body') in one of
   # your partials.
-%>
<%= @content_for_body %>
<% #
   # This is where your loading screen will appear.  To add a loading screen
   # just declare content_for('loading') in one of your partials. If you use
   # sc-gen to generate your app, it will create a file called loading.rhtml
   # under english.lproj. You can insert the desired content there.
-%>
<% unless @content_for_loading.blank? %>

<%= @content_for_loading %>

<% end -%>

  {
    "MySystem.Link": {
      "link1": {
        "guid": "link1",
        "text": "First link",
        "startNode": "1",
        "startTerminal": "a",
        "endNode": "2",
        "endTerminal": "b",
        "color": "#FF0000"
      },
      "link2": {
        "guid": "link2",
        "text": "Second link",
        "startNode": "1",
        "startTerminal": "a",
        "endNode": "3",
        "endTerminal": "b",
        "color": "#FF0000"
      }
    },
    "MySystem.Node": {
      "1": {
        "guid": "1",
        "image": "/static/my_system/en/current/resources/clay_red_tn.png",
        "title": "A Node",
        "transformer": false,
        "inLinks": [],
        "outLinks": [
          "link1",
          "link2"
        ],
        "position": {
          "x": 160,
          "y": 160
        },
        "transformations": [
          "trans1"
        ]
      },
      "2": {
        "guid": "2",
        "image": "/static/my_system/en/current/resources/hand_tn.png",
        "title": "B Node",
        "transformer": false,
        "inLinks": [
          "link1"
        ],
        "outLinks": [],
        "position": {
          "x": 310,
          "y": 10
        }
      },
      "3": {
        "guid": "3",
        "image": "/static/my_system/en/current/resources/lightbulb_tn.png",
        "title": "Third Node",
        "transformer": false,
        "inLinks": [
          "link2"
        ],
        "outLinks": [],
        "position": {
          "x": 10,
          "y": 10
        }
      }
    },
    "MySystem.Story": {
      "1": {
        "guid": 1,
        "storyHtml": "<p>Make a system diagram to help explain how <i>both</i> the sun and people's actions affect the Earth's climate.</p><ul><li>Where does energy come from?</li><li>How does energy move?</li><li>Where does energy go?</li><li>How does energy change?</li></ul>"
      }
    },
    "MySystem.StorySentence": {
      "ss1": {
        "guid": "ss1",
        "order": 1,
        "bodyText": "First..."
      },
      "ss2": {
        "guid": "ss2",
        "order": 2,
        "bodyText": "Then..."
      },
      "ss3": {
        "guid": "ss3",
        "order": 3,
        "bodyText": "Finally..."
      }
    }
  }

<% #
   # This is where the resources you declare will appear.  By default anything
   # you add to partials will be added to this section unless you specify
   # otherwise.  Note that resources are initially hidden so you can pull them
   # apart as needed on page load.
-%>
<% unless @content_for_resources.blank? %>

      <%= @content_for_resources -%>

<% end -%>
<% #
   # This line should appear at the bottom of your page to include your
   # generated JavaScript and any libraries you reference.  If you need
   # to include other javascripts, add them to the :requires option of
   # your client in routes.rb instead of changing it here.
-%>
<%= javascripts_for_client %>
<% unless @content_for_page_javascript.blank? %>
<%= @content_for_page_javascript %>
<% end -%>
<% #
   # If you use old-style view helpers in your page, this method must be
   # called to actually add the page views to your HTML.  Normally this will
   # not generate any content.
-%>
<% #render_page_views -%>
<% # Older SproutCore applications need SC.didLoad to be called after onload.
   # This is no longer required by SproutCore so it is off by default.  To
   # reenable set use_window_onload = true in yur config.
-%>
<% if config.use_window_onload %>

<% end -%>
<% #
   # The final content section can be used to add any last minute setup you
   # need to do before the page ends.  This is required for loading unit
   # tests among other things.
-%>
<%= @content_for_final -%>
<%
  #disable main if the application is loaded in design mode
%>
<%= @content_for_designer -%>


fixing subform width problem in firefox (only for updates)

<%
parent_record = @record
associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name)
associated = associated.sort_by {|r| r.id} unless column.association.options.has_key?(:order)

show_blank_record = (column.plural_association? or (column.singular_association? and associated.empty?))
show_blank_record = false if column.through_association?
show_blank_record = false unless column.association.klass.authorized_for?(:action => :create)

-%>

<%= column.label -%>

  <% @record = column.association.klass.new -%>
  <%= render :partial => 'form_association_header', :locals => {:parent_record => parent_record} %>

  <tbody id="<%= sub_form_list_id(:association => column.name) %>">
    <% associated.each_index do |index| %>
    <% @record = associated[index] -%>
    <% if @record.errors.count -%>

      <td colspan="<%= active_scaffold_config_for(@record.class).subform.columns.length + 1 %>">
        <%= error_messages_for :record %>

    <% end %>
    <tr class="association-record <%= 'association-record-new' if @record.new_record? -%>">
      <% scope = column.plural_association? ? "[#{column.name}][#{@record.id}]" : "[#{column.name}]" -%>
      <%= render :partial => 'form_association_record', :locals => {:scope => scope, :parent_record => parent_record} %>

    <% end -%>

    <% if show_blank_record -%>
    <% @record = column.association.klass.new -%>

      <% scope = column.plural_association? ? "[#{column.name}][#{generate_temporary_id}]" : "[#{column.name}]" -%>
      <%= render :partial => 'form_association_record', :locals => {:scope => scope, :parent_record => parent_record} %>

    <% end -%>

<%= render :partial => 'form_association_footer', :locals => {:parent_record => parent_record, :column => column, :associated => associated} -%>

<% @record = parent_record -%>

<%
parent_record = @record
associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name)
associated = associated.sort_by {|r| r.id} unless column.association.options.has_key?(:order)

show_blank_record = (column.plural_association? or (column.singular_association? and associated.empty?))
show_blank_record = false if column.through_association?
show_blank_record = false unless column.association.klass.authorized_for?(:action => :create)

-%>

<%= column.label -%>

  <% @record = column.association.klass.new -%>
  <%= render :partial => 'form_association_header', :locals => {:parent_record => parent_record} %>

  <tbody id="<%= sub_form_list_id(:association => column.name) %>">
    <% associated.each_index do |index| %>
    <% @record = associated[index] -%>
    <% if @record.errors.count -%>

        <%= error_messages_for :record %>

    <% end %>
    <tr class="association-record <%= 'association-record-new' if @record.new_record? -%>">
      <% scope = column.plural_association? ? "[#{column.name}][#{@record.id}]" : "[#{column.name}]" -%>
      <%= render :partial => 'form_association_record', :locals => {:scope => scope, :parent_record => parent_record} %>

    <% end -%>

    <% if show_blank_record -%>
    <% @record = column.association.klass.new -%>

      <% scope = column.plural_association? ? "[#{column.name}][#{generate_temporary_id}]" : "[#{column.name}]" -%>
      <%= render :partial => 'form_association_record', :locals => {:scope => scope, :parent_record => parent_record} %>

    <% end -%>

<%= render :partial => 'form_association_footer', :locals => {:parent_record => parent_record, :column => column, :associated => associated} -%>

<% @record = parent_record -%>


Minor fix to default layout to ensure content div wraps around all floating children divs

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="<%= I18n.locale %>">

        <% if @profile_photo_javascript %>

            <link rel="stylesheet" href="/stylesheets/jquery.Jcrop.css" type="text/css" >
        <% end %>

        <title>
        <% if @title %>
            <%=@title%> - <%= site_name %>
        <% else %>
            <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
        <% end %>
        </title>

        <link rel="shortcut icon" href="/favicon.ico">
	<%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet", :media => "all" %>
	<%= stylesheet_link_tag 'fonts', :rel => "stylesheet", :media => "all"  %>
	<%= stylesheet_link_tag 'theme', :rel => "stylesheet", :media => "all"  %>
	<%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print"  %>
	<% if !params[:print_stylesheet].nil? %>
         <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all"  %>
	<% end %>
	<%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %>
	<%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%>

        <%= stylesheet_link_tag 'custom', :title => "Main", :rel => "stylesheet"  %>
        <% if force_registration_on_new_request %>
        <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet"  %>
        <% end %>

        <% if @feed_autodetect %>
            <% for feed in @feed_autodetect %>
                <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>">
                <% if feed[:has_json] %>
                    <link rel="alternate" type="application/json" title="JSON version of <%=h feed[:title] %>" href="<%=h feed[:url]%>.json">
                <% end %>
            <% end %>
        <% end %>
        <% if @has_json %>
            <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h main_url(request.request_uri) %>.json">
        <% end %>

        <% if @no_crawl %>
            <meta name="robots" content="noindex, nofollow">
        <% end %>

    <%= render :partial => 'general/before_head_end' %>

    <body <%= "class='front'" if params[:action] == 'frontpage' %>>

    <% if force_registration_on_new_request && !@user %>
    <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>

    <% end %>

<% # code for popup advert for a campaign etc.
=begin

Close

    [ message goes here ]

Close

=end
%>

<%= render :partial => 'general/locale_switcher' %>

        <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>

          <% if @user %>
              <%= _('Hello, {{username}}!', :username => h(@user.name))%>

                <% if @user %>
                    <%=link_to _("My profile"), user_url(@user) %>
                <% end %>

              <%= link_to _("Sign out"), signout_url(:r => request.request_uri) %>
          <% else %>
              <%= link_to _("Sign in or sign up"), signin_url(:r => request.request_uri) %>
          <% end %>

        <% end %>

            <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "navigation_search_form"}) do %>

                   <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query" } %>
                   <%= image_submit_tag('search-button.png') %>

            <% end %>

        <%= render :partial => 'general/orglink' %>

        <%= render :partial => 'general/topnav' %>

            <% if flash[:notice] %>

<%= flash[:notice] %>

            <% end %>
            <% if flash[:error] %>

<%= flash[:error] %>

            <% end %>

            <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
            <%= yield :layout %>

    <%= render :partial => 'general/footer' %>

    <%= render :partial => 'general/before_body_end' %>

X
<%= _("Paste this link into emails, tweets, and anywhere else:") %>

<input type="text">


Add piwik

Add piwik

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

        <%= javascript_include_tag :defaults %>

        <title>
        <% if @title %>
            <%=@title%> - WhatDoTheyKnow
        <% else %>
            WhatDoTheyKnow - file and explore Freedom of Information (FOI) requests
        <% end %>
        </title>
        <%
            # Angie, just change this to true / false :)
            yucky = false
        %>
        <%= stylesheet_link_tag 'yucky-green', :title => "Yucky Green", :rel => yucky ? "stylesheet" : "alternate stylesheet" %>
        <%= stylesheet_link_tag 'main', :title => "Main", :rel => yucky ? "alternate stylesheet" : "stylesheet"  %>

        <% if @feed_autodetect %>
            <% for feed in @feed_autodetect %>
                <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>">
            <% end %>
        <% end %>

            WhatDoTheyKnow?

            Make and explore Freedom of Information requests

		a site by mysociety.org

        <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "navigation_search_form"}) do %>

               <%= text_field_tag 'query', params[:query], { :size => 25, :id => "navigation_search_query" } %>
               <%= submit_tag "Search" %>

        <% end %>

Make request

<%= link_to "View requests", request_list_url(:view => nil) %>

<%= link_to "View authorities", list_public_bodies_url(:tag => 'other') %>

			<% if @user %>

<%=link_to "My requests", user_url(@user) %>

			<% end %>

<%= link_to "About", about_url %>

		<% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>

			<% if @user %>
				Hello, <%=h(@user.name)%>!
				(<%= link_to "Sign out", signout_url(:r => request.request_uri) %>)
			<% else %>
				Hello! (<%= link_to "Sign in or sign up", signin_url(:r => request.request_uri) %>)
			<% end %>

		<% end %>

            <% if flash[:notice] %>

<%= flash[:notice] %>

            <% end %>
            <% if flash[:error] %>

<%= flash[:error] %>

            <% end %>

            <div id="<%= controller.controller_name + "_" + controller.action_name %>">
            <%= yield :layout %>

        Built by mySociety ... and you.
        Get the source code (is on Rails).
        Dedicated to Chris Lightfoot.

<% if MySociety::Config.get("DOMAIN", '127.0.0.1:3000') == 'www.whatdotheyknow.com'  %>

<% end %>


Changed length of notes under images on show_images from 40 to 300 chars.

<% if @observation.images.length > 0 %>
  <%= :images.t %>:

<% end %>

<% if check_permission(@observation.user_id) %>
  <%= link_to(:show_observation_add_images.t, :controller => 'image', :action => 'add_image', :id => @observation.id) %>

  <%= link_to(:show_observation_reuse_image.t, :controller => 'image', :action => 'reuse_image', :id => @observation.id) %>

  <% if @observation.images.length > 0 %>
    <%= link_to(:show_observation_remove_images.t, :controller => 'image', :action => 'remove_images', :id => @observation.id) %>

  <% end %>
<% end %>

  <% done = {}
  for image in [@observation.thumb_image] + @observation.images
    if image && !done[image.id]
      done[image.id] = true %>

        <%= link_to(image_tag(sprintf("thumb/%d.jpg", image.id)) + '
' +
                      image.unique_format_name.t,
                    :controller => 'image', :action => 'show_image', :id => image.id, :params => search_params) %>

        <% if image.notes && image.notes != '' %>

            <%= str = image.notes[0..300].tl
            str += '...' if image.notes.length > 301
            str %>

        <% end %>

    <% end %>
  <% end %>

<% if @observation.images.length > 0 %>
  <%= :images.t %>:

<% end %>

<% if check_permission(@observation.user_id) %>
  <%= link_to(:show_observation_add_images.t, :controller => 'image', :action => 'add_image', :id => @observation.id) %>

  <%= link_to(:show_observation_reuse_image.t, :controller => 'image', :action => 'reuse_image', :id => @observation.id) %>

  <% if @observation.images.length > 0 %>
    <%= link_to(:show_observation_remove_images.t, :controller => 'image', :action => 'remove_images', :id => @observation.id) %>

  <% end %>
<% end %>

  <% done = {}
  for image in [@observation.thumb_image] + @observation.images
    if image && !done[image.id]
      done[image.id] = true %>

        <%= link_to(image_tag(sprintf("thumb/%d.jpg", image.id)) + '
' +
                      image.unique_format_name.t,
                    :controller => 'image', :action => 'show_image', :id => image.id, :params => search_params) %>

        <% if image.notes && image.notes != '' %>

            <%= str = image.notes[0..40].tl
            str += '...' if image.notes.length > 41
            str %>

        <% end %>

    <% end %>
  <% end %>


update generators to handle player records properly

<%
require 'rubygems'
require 'pokerstats/hand_statistics'
%>

class CreatePokerstats < ActiveRecord::Migration
  def self.up
	  create_table :hand_statistics do |t|
		<%= HandStatistics.hand_statistics_migration_data -%>
	    t.timestamps
	  end
	  create_table :player_statistics do |t|
		t.integer :hand_statistic_id
		t.integer :player_id
		<%= HandStatistics.player_statistics_migration_data -%>
	    t.timestamps
	  end
	  create_table :player
	    t.string :name
	  end
  end

  def self.down
	drop_table :player
    drop_table :player_statistics
	drop_table :hand_statistics
  end
end

<%
require 'rubygems'
require 'pokerstats/hand_statistics'
%>

class CreatePokerstats < ActiveRecord::Migration
  def self.up
	  create_table :hand_statistics do |t|
		<%= HandStatistics.hand_statistics_migration_data -%>
	    t.timestamps
	  end
	  create_table :player_statistics do |t|
		t.integer :hand_statistics_id
		<%= HandStatistics.player_statistics_migration_data -%>
	    t.timestamps
	  end
  end

  def self.down
    drop_table :player_statistics
	drop_table :hand_statistics
  end
end


資産表を修正。

資産表を修正。

git-svn-id: d766b2a131eb5d649bacb6a45bc0bcd899bdfdb3@528 c938ebee-df10-0410-95fc-be8c4b0ebdd5

    資産合計
    <%= number_with_delimiter(@assets.sum) %>円

        正の資産		期末残高

      <% @assets.plus.each do |account| %>
        <%= book_line :name => account.name, :percentage => account.percentage, :amount => account.balance %>
     <% end %>

合計	<%= number_with_delimiter(@assets.plus.sum) %>

    <%= pie_graph(@assets.plus, 'percentage', 'name', nil, nil, 'right_pie') %>

        負の資産		期末残高

      <% @assets.minus.each do |account| %>
        <%= book_line :name => account.name, :percentage => account.percentage, :amount => account.balance %>
      <% end %>

合計	<%= number_with_delimiter(@assets.minus.sum) %>

      <%= pie_graph(@assets.minus, 'percentage', 'name', nil, nil, 'left_pie') %>

    資産合計
    <%= number_with_delimiter(@assets.sum) %>円

        正の資産		期末残高

      <% @assets.plus.each do |account| %>
        <%= book_line :name => account.name, :percentage => account.percentage, :amount => account.balance %>
     <% end %>

合計	<%= number_with_delimiter(@assets.plus.sum) %>

    <%= pie_graph(@assets.plus, 'percentage', 'name', 'right_pie') %>

        負の資産		期末残高

      <% @assets.minus.each do |account| %>
        <%= book_line :name => account.name, :percentage => account.percentage, :amount => account.balance %>
      <% end %>

合計	<%= number_with_delimiter(@assets.minus.sum) %>

      <%= pie_graph(@assets.minus, 'percentage', 'name', 'left_pie') %>


ActionItem44: fixing English

ActionItem44: fixing English

git-svn-id: 43659daf80e124e0b603d67096418e58e4f21099@2002 3f533792-8f58-4932-b0fe-aaf55b0a4547

<%= _('e-Mail configuration') %>

<% form_tag(:action => 'save') do %>

    <%= check_box :user, :enable_email  %>
    <%= _('Enable e-mail %s') % profile.email_addresses.join(', ') %>

      <%= _("Marking this option gives you an e-mail account with the address above. You'll be able to access a webmail from your user menu.") %>

  <% button_bar do %>
    <%= submit_button :save, _('Save') %>
    <%= button :back, _('Back to control panel'), :controller => 'profile_editor' %>
  <% end %>
<% end %>

<%= _('e-Mail configuration') %>

<% form_tag(:action => 'save') do %>

    <%= check_box :user, :enable_email  %>
    <%= _('Enable e-mail %s') % profile.email_addresses.join(', ') %>

      <%= _("Marking this options gives you an e-mail account with the address above. You'll be able to access a webmail from your user menu.") %>

  <% button_bar do %>
    <%= submit_button :save, _('Save') %>
    <%= button :back, _('Back to control panel'), :controller => 'profile_editor' %>
  <% end %>
<% end %>


don't add redirect hidden field if there is no redirect

Create Your Account

	Choose your user name and password.

	After clicking "signup", login to crabgrass, and join or create a group.

<%= error_messages_for :user %>
<% form_for :user do |f| -%>

Your login name

<%= f.text_field :login %>

Your Password

<%= f.password_field :password %>

Confirm Password

<%= f.password_field :password_confirmation %>

<%= submit_tag 'Sign up' %>

<%= hidden_field_tag 'redirect', params[:redirect] if params[:redirect] %>

<% end -%>

Create Your Account

	Choose your user name and password.

	After clicking "signup", login to crabgrass, and join or create a group.

<%= error_messages_for :user %>
<% form_for :user do |f| -%>

Your login name

<%= f.text_field :login %>

Your Password

<%= f.password_field :password %>

Confirm Password

<%= f.password_field :password_confirmation %>

<%= submit_tag 'Sign up' %>

<%= hidden_field_tag 'redirect', params[:redirect] %>

<% end -%>


minor: make pagination links span all columns

in moderation page list that is.

    Title
    Type
    Created At
    Created By

<%= will_paginate @pages %>

  <% @pages.each do |page| %>
    <tr class="<%=cycle('row_0', 'row_1')%>">
      <%= link_to page.title, page_url(page) %>
      <%=h page.type %>
      <%=h page.created_at.strftime("%d %b, %Y ") %>
      <%=h page.created_by_login %>
      <% if @current_view == 'pending' %>

          <%= button_to "Approve", :action => "approve", :params => {:id => page.id, :view => @current_view} %>
        <%= button_to "Trash", :action => "trash", :params => {:id => page.id, :view => @current_view} %>
      <% elsif @current_view == 'vetted' %>

          <%= button_to "Trash", :action => "trash", :params => {:id => page.id, :view => @current_view} %>
      <% elsif @current_view == 'deleted' %>

          <%= button_to "Undelete", :action => "undelete", :params => {:id => page.id, :view => @current_view} %>
      <% elsif @current_view == 'public requested' %>

            <%= link_to "Make Public", { :action => 'update_public', :id => page.id, :view => @current_view, :public => true }, :method => :post %> <%= link_to "Deny", { :action => 'update_public', :id => page.id, :view => @current_view, :public => false }, :method => :post  %>

          <%#= button_to "Public", :action => "update_public", :params => {:id => page.id, :view => @current_view, :public => true } %>
          <%#= button_to "Deny", :action => "update_public", :params => {:id => page.id, :view => @current_view, :public => false} %>

      <% elsif @current_view == 'public' %>

            <%= link_to "Remove Public", { :action => 'remove_public', :id => page.id, :view => @current_view }, :method => :post %>

          <%#= button_to "Remove Public", :action => "remove_public", :params => {:id => page.id, :view => @current_view} %>
      <%end%>

  <% end %>

<%= will_paginate @pages %>


customer name shouldn't be editable for internal customer

<%= error_messages_for 'customer' %>

<% if !@customer.internal_customer? %>

<%=_ 'Name' %><%= text_field 'customer', 'name'  %>

<% end %>

<%=_ 'Contact email' %><%= text_field 'customer', 'contact_email'  %>

<%=_ 'Contact name' %><%= text_field 'customer', 'contact_name'  %>

<%=_ 'Client CSS' %><%= text_area 'customer', 'css'  %>

<%= error_messages_for 'customer' %>

<% if @customer.internal_customer? %>

<%=_ 'Name' %><%= text_field 'customer', 'name'  %>

<% end %>

<%=_ 'Contact email' %><%= text_field 'customer', 'contact_email'  %>

<%=_ 'Contact name' %><%= text_field 'customer', 'contact_name'  %>

<%=_ 'Client CSS' %><%= text_area 'customer', 'css'  %>


Add warning about regex censor rules.

Add warning about regex censor rules.

<%= error_messages_for 'censor_rule' %>

  <%=_("Applies to")%>
  <% unless info_request.nil? %>
    <%= request_link(info_request)%>
    <%= request_admin_link(info_request, "(admin)", "btn btn-info")%>
    <%= hidden_field 'censor_rule', 'info_request_id', { :value => info_request.id } %>
  <% end %>
  <% unless user.nil? %>
    <%= user_link(user) %>
    <%= user_admin_link(user, "admin", "btn btn-info") %>
    <%= hidden_field 'censor_rule', 'user_id', { :value => user.id } %>
<% end %>

  Is it regexp replacement?

    <%= check_box 'censor_rule', 'regexp' %>

      Leave unchecked if you are not sure about this

  Text

    <%= text_field 'censor_rule', 'text', :class => "span3" %>

      that you want to remove, case sensitive

  Replacement

    <%= text_field 'censor_rule', 'replacement', :class => "span3"  %>

      put it in [square brackets], e.g. [personal information removed]. applies to text in emails and HTML conversions of binaries; binaries themselves must stay the same length and the replacement is just a bunch of 'x's

  Comment for this edit

    <%= text_area 'censor_rule', 'last_edit_comment', :rows => 2, :class => "span6"  %>

      put purpose of the rule, and why the change

Warning and notes:

 This does replace text in binary files, but for
      most formats only in a naive way. It works well on surprisingly many Word documents. Notably
      it doesn't even do UCS-2 (unicode sometimes used in Word). There is also special code
      which works on some PDFs. Please carefully check all attachments have
      changed in the way you expect, and haven't become corrupted.

You may need to manually rebuild the search index afterwards. You can redact
      things by individual request or by user by adding the censor rule from the
      appropriate page.  If you need to redact across a whole
      authority, it will be easy enough to make code changes to add it, so do ask.

         Regexp rules that are hard to process will really slow down request display. Please only use regexps if you really need to.


Fix to show editor, not front end form

Fix to show editor, not front end form

<%= form_tag('',:method => 'post', :class => 'admin_form full_page_form') %>
<% cms_subfields_for :entry, @entry do |f| %>

    <%= f.text_field :title, :vertical => true, :required => true, :style=>'width:100%' %>
    <%= f.filemanager_image :domain_file_id, :vertical => true, :label => 'Post Image (Optional)' %>
    <%= f.text_field :permalink, :label => 'Permalink (Leave blank to have one created for you)', :vertical => true, :style => 'width:100%;', :noun => 'Permalink' %>
    <%= f.text_field :author, :vertical => true, :style=>'width:100%' %>
    <%= f.editor_area :body, :vertical => true, :required => true, :rows => 35, :style=>'width:100%', :content_filter => @blog.content_filter %>

    <%= f.header "Additional Fields" %>
    <%= f.text_field :preview_title, :vertical => true, :size => 80, :label => 'Preview Title (Optional)' %>
    <%= f.editor_area :preview, :vertical => true, :rows => 12, :label => 'Preview (Optional)', :style=>'width:100%', :content_filter => @blog.content_filter %>
    <%= f.text_field :keywords, :vertical => true, :style=>'width:100%' %>
    <%= f.filemanager_file :media_file_id, :vertical => true, :label => 'Local Media (.mp3 or .flv file)' %>
    <%= f.text_field :embedded_media, :vertical => true, :label => 'Embedded Media (Paste entire <object ...> block)', :style => 'width:100%' %>

    <% if @blog.content_model -%>
      <%= f.header "Custom Fields (%s)" / @blog.content_model.name %>
      <% cms_subfields_for 'entry[data_model]', @entry.data_model do |cf| -%>
        <% @blog.content_model.content_model_fields.each do |field| -%>
          <%= field.form_field(cf, :vertical => true, :editor => true) %>
        <% end -%>
      <% end -%>
    <% end -%>

    <%= f.submit_tag @entry.id ? 'Update Entry' : 'Create Entry' %>

      Categories

      <input type='text' name='new_category' id='new_category' onkeypress='if(SCMS.isEnter(event)) { PostEditor.createCategory(); return false; } else { return true; }' size='15'><input type='button' value='New' onclick='PostEditor.createCategory();' />

        <% @categories.each do |category| -%>
<label for='category_<%= category.id %>'><input type='checkbox' id='category_<%= category.id %>' name='categories[]' value='<%= category.id %>' <%= 'checked="checked"' if @selected_category_ids.include?(category.id)  %> /><%= h category.name %>

       <% end -%>

        Tags

      <textarea name='entry[tag_names]' id='entry_tags' style='width:200px; height:100px;'><%= h @entry.tag_names %></textarea>

      <button onclick='PostEditor.selectTags(); return false;'>Select Tags</button>

        Publication Status

    <input onclick='PostEditor.updateStatus();' id='entry_status_draft' name='update_entry[status]' value='draft' <%= "checked='checked'" if @entry.status == 'draft' %> type='radio'><%= "Draft".t %>

    <input onclick='PostEditor.updateStatus();' id='entry_status_preview' name='update_entry[status]' value='preview' <%= "checked='checked'" if @entry.status == 'preview' %> type='radio'><%= "Preview".t %>

    <input onclick='PostEditor.updateStatus();' id='entry_status_published' name='update_entry[status]' value='publish_now' <%= "checked='checked'" if @entry.status == 'published' && @entry.published_at  && @entry.published_at < Time.now %> type='radio'><%= "Published".t  %>

    <input onclick='PostEditor.updateStatus();' id='entry_status_post_date' name='update_entry[status]' value='post_date' type='radio'  <%= "checked='checked'" if @entry.status == 'published' && ( !@entry.published_at  || @entry.published_at > Time.now ) %> type='radio'><%= "Post Date".t  %>

      <% if @entry.errors.on(:published_at) %>

Invalid Date

    <% end -%>
      <%= f.datetime_field :published_at, :label => '',:unstyled => true, :blank => true, :disabled => !(@entry.status == 'published' && ( !@entry.published_at  || @entry.published_at > Time.now ) ) %>

        <%= f.submit_tag @entry.id ? 'Update Entry' : 'Create Entry',:unstyled => true %>

<% end -%>
</form>

<%= form_tag('',:method => 'post', :class => 'admin_form full_page_form') %>
<% cms_subfields_for :entry, @entry do |f| %>

    <%= f.text_field :title, :vertical => true, :required => true, :style=>'width:100%' %>
    <%= f.filemanager_image :domain_file_id, :vertical => true, :label => 'Post Image (Optional)' %>
    <%= f.text_field :permalink, :label => 'Permalink (Leave blank to have one created for you)', :vertical => true, :style => 'width:100%;', :noun => 'Permalink' %>
    <%= f.text_field :author, :vertical => true, :style=>'width:100%' %>
    <%= f.editor_area :body, :vertical => true, :required => true, :rows => 35, :style=>'width:100%', :content_filter => @blog.content_filter %>

    <% if @blog.content_model -%>
      <%= f.header "Custom Fields (%s)" / @blog.content_model.name %>
      <% cms_subfields_for 'entry[data_model]', @entry.data_model do |cf| -%>
        <% @blog.content_model.content_model_fields.each do |field| -%>
          <%= field.form_field(cf, :vertical => true) %>
        <% end -%>
      <% end -%>
    <% end -%>

    <%= f.header "Additional Fields" %>
    <%= f.text_field :preview_title, :vertical => true, :size => 80, :label => 'Preview Title (Optional)' %>
    <%= f.editor_area :preview, :vertical => true, :rows => 12, :label => 'Preview (Optional)', :style=>'width:100%', :content_filter => @blog.content_filter %>
    <%= f.text_field :keywords, :vertical => true, :style=>'width:100%' %>
    <%= f.filemanager_file :media_file_id, :vertical => true, :label => 'Local Media (.mp3 or .flv file)' %>
    <%= f.text_field :embedded_media, :vertical => true, :label => 'Embedded Media (Paste entire <object ...> block)', :style => 'width:100%' %>
    <%= f.submit_tag @entry.id ? 'Update Entry' : 'Create Entry' %>

      Categories

      <input type='text' name='new_category' id='new_category' onkeypress='if(SCMS.isEnter(event)) { PostEditor.createCategory(); return false; } else { return true; }' size='15'><input type='button' value='New' onclick='PostEditor.createCategory();' />

        <% @categories.each do |category| -%>
<label for='category_<%= category.id %>'><input type='checkbox' id='category_<%= category.id %>' name='categories[]' value='<%= category.id %>' <%= 'checked="checked"' if @selected_category_ids.include?(category.id)  %> /><%= h category.name %>

       <% end -%>

        Tags

      <textarea name='entry[tag_names]' id='entry_tags' style='width:200px; height:100px;'><%= h @entry.tag_names %></textarea>

      <button onclick='PostEditor.selectTags(); return false;'>Select Tags</button>

        Publication Status

    <input onclick='PostEditor.updateStatus();' id='entry_status_draft' name='update_entry[status]' value='draft' <%= "checked='checked'" if @entry.status == 'draft' %> type='radio'><%= "Draft".t %>

    <input onclick='PostEditor.updateStatus();' id='entry_status_preview' name='update_entry[status]' value='preview' <%= "checked='checked'" if @entry.status == 'preview' %> type='radio'><%= "Preview".t %>

    <input onclick='PostEditor.updateStatus();' id='entry_status_published' name='update_entry[status]' value='publish_now' <%= "checked='checked'" if @entry.status == 'published' && @entry.published_at  && @entry.published_at < Time.now %> type='radio'><%= "Published".t  %>

    <input onclick='PostEditor.updateStatus();' id='entry_status_post_date' name='update_entry[status]' value='post_date' type='radio'  <%= "checked='checked'" if @entry.status == 'published' && ( !@entry.published_at  || @entry.published_at > Time.now ) %> type='radio'><%= "Post Date".t  %>

      <% if @entry.errors.on(:published_at) %>

Invalid Date

    <% end -%>
      <%= f.datetime_field :published_at, :label => '',:unstyled => true, :blank => true, :disabled => !(@entry.status == 'published' && ( !@entry.published_at  || @entry.published_at > Time.now ) ) %>

        <%= f.submit_tag @entry.id ? 'Update Entry' : 'Create Entry',:unstyled => true %>

<% end -%>
</form>


ActionItem42: linking to "Join this community"

git-svn-id: 43659daf80e124e0b603d67096418e58e4f21099@1382 3f533792-8f58-4932-b0fe-aaf55b0a4547

  <% if logged_in? %>

<%= link_to _('Join this community'), :profile => user.identifier, :controller => 'memberships', :action => 'join', :id => profile.id %>

  <% end %>


Fix for reference to nil object. Fixes https://github.com/mysociety/alaveteli/issues/705.

<%
if !info_request_event.nil? && info_request_event.event_type == 'response'
    incoming_message = info_request_event.incoming_message
end

if not incoming_message.nil?
%>
    <div class="incoming correspondence" id="incoming-<%=incoming_message.id.to_s%>">

            <% if !incoming_message.safe_mail_from.nil? && incoming_message.safe_mail_from.strip != @info_request.public_body.name.strip %>
                <%= _("From:") %> <%=h incoming_message.safe_mail_from %>

            <% end %>
            <% if incoming_message.safe_mail_from.nil? || (incoming_message.mail_from_domain == @info_request.public_body.request_email_domain) %>
                <%=h @info_request.public_body.name %>

            <% end %>

<%= simple_date(incoming_message.sent_at) %>

        <%= render :partial => 'bubble', :locals => { :incoming_message => incoming_message, :body => incoming_message.get_body_for_html_display(@collapse_quotes), :attachments => incoming_message.get_attachments_for_display }  %>

            <% if !@user.nil? && @user.admin_page_links? %>
                <%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> |
            <% end %>
            <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %>

<%
elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
    outgoing_message = info_request_event.outgoing_message
    %>
    <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">

        <%= _("From:") %> <%=h @info_request.user_name %>

<%= simple_date(info_request_event.created_at) %>

        <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil }  %>

            <% if outgoing_message.status == 'ready' && !@info_request.is_external? %>
                 Warning: This message has not yet been sent for an unknown reason.
            <% end %>

            <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %>

<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
    <div class="outgoing correspondence" id="outgoing-<%=info_request_event.outgoing_message.id.to_s%>">

            <%= simple_date(info_request_event.created_at) %>

            Sent
            <% if info_request_event.outgoing_message.message_type == 'initial_request' %>
                request
            <% elsif info_request_event.outgoing_message.message_type == 'followup' %>
                a follow up
            <% else %>
                <% raise "unknown message_type" %>
            <% end %>

            to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.

<% elsif info_request_event.event_type == 'comment'
    comment = info_request_event.comment
%>
    <%= render :partial => 'comment/single_comment', :locals => { :comment => comment } %>
<% end %>

<%
if !info_request_event.nil? && info_request_event.event_type == 'response'
    incoming_message = info_request_event.incoming_message
end

if not incoming_message.nil?
%>
    <div class="incoming correspondence" id="incoming-<%=incoming_message.id.to_s%>">

            <% if !incoming_message.safe_mail_from.nil? && incoming_message.safe_mail_from.strip != @info_request.public_body.name.strip %>
                <%= _("From:") %> <%=h incoming_message.safe_mail_from %>

            <% end %>
            <% if incoming_message.safe_mail_from.nil? || (incoming_message.mail_from_domain == @info_request.public_body.request_email_domain) %>
                <%=h @info_request.public_body.name %>

            <% end %>

<%= simple_date(incoming_message.sent_at) %>

        <%= render :partial => 'bubble', :locals => { :incoming_message => incoming_message, :body => incoming_message.get_body_for_html_display(@collapse_quotes), :attachments => incoming_message.get_attachments_for_display }  %>

            <% if !@user.nil? && @user.admin_page_links? %>
                <%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> |
            <% end %>
            <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %>

<%
elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
    outgoing_message = info_request_event.outgoing_message
    %>
    <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">

        <%= _("From:") %> <%=h @info_request.user_name %>

<%= simple_date(info_request_event.created_at) %>

        <%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil }  %>

            <% if outgoing_message.status == 'ready' && !@info_request.is_external? %>
                 Warning: This message has not yet been sent for an unknown reason.
            <% end %>

            <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %>

<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
    <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">

            <%= simple_date(info_request_event.created_at) %>

            Sent
            <% if info_request_event.outgoing_message.message_type == 'initial_request' %>
                request
            <% elsif info_request_event.outgoing_message.message_type == 'followup' %>
                a follow up
            <% else %>
                <% raise "unknown message_type" %>
            <% end %>

            to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.

<% elsif info_request_event.event_type == 'comment'
    comment = info_request_event.comment
%>
    <%= render :partial => 'comment/single_comment', :locals => { :comment => comment } %>
<% end %>


Add display name and email to signup page.  (closes #190)

git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@435 820eb932-12ee-0310-9ca8-eeb645f39767

<%= start_form_tag :action=> "signup" %>

Signup

  <%= error_messages_for 'user' %>

  Desired login:

  <%= text_field "user", "login", :size => 30 %>

  Choose password:

  <%= password_field "user", "password", :size => 30 %>

  Confirm password:

  <%= password_field "user", "password_confirmation", :size => 30 %>

  Display name:

  <%= text_field "user", "name", :size => 30 %>

  Email address:

  <%= text_field "user", "email", :size => 30 %>

<input type="submit" value="Signup »" class="primary" />

<%= end_form_tag %>

<%= start_form_tag :action=> "signup" %>

Signup

  <%= error_messages_for 'user' %>

  Desired login:

  <%= text_field "user", "login", :size => 30 %>

  Choose password:

  <%= password_field "user", "password", :size => 30 %>

  Confirm password:

  <%= password_field "user", "password_confirmation", :size => 30 %>

<input type="submit" value="Signup »" class="primary" />

<%= end_form_tag %>


Use a simple form and submit button for the search box - we don't want the extra params from generated form tags and don't need csrf protection here. The unique csrf token presumably is preventing the serving of search results from the cache.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="<%= I18n.locale %>">

        <title>
        <% if @title %>
            <%=@title%> - <%= site_name %>
        <% else %>
            <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
        <% end %>
        </title>

        <link rel="shortcut icon" href="/favicon.ico">

        <%= render :partial => 'general/stylesheet_includes' %>
        <% if session[:using_admin] %>
          <%= stylesheet_link_tag "/adminbootstraptheme/stylesheets/admin", :title => "Main", :rel => "stylesheet" %>
        <% end %>

        <%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %>
        <% if @profile_photo_javascript %>

            <link rel="stylesheet" href="/stylesheets/jquery.Jcrop.css" type="text/css" >
        <% end %>

        <% if @feed_autodetect %>
            <% for feed in @feed_autodetect %>
                <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>">
                <% if feed[:has_json] %>
                    <link rel="alternate" type="application/json" title="JSON version of <%=h feed[:title] %>" href="<%=h feed[:url]%>.json">
                <% end %>
            <% end %>
        <% end %>
        <% if @has_json %>
            <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h main_url(request.request_uri, '.json') %>">
        <% end %>

        <% if @no_crawl %>
            <meta name="robots" content="noindex, nofollow">
        <% end %>

        <%= render :partial => 'general/before_head_end' %>

    <body class="<%= 'front' if params[:action] == 'frontpage' %>">
    <% if Configuration::force_registration_on_new_request && !@user %>
    <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>

    <% end %>

<% if session[:using_admin] %>
  <%= render :partial => 'admin_general/admin_navbar' %>
<% end %>

<% if !@popup_banner.blank? %>

<%= _('Close') %>

  <%= @popup_banner %>

<%= _('Close') %>

<% end %>

<%= render :partial => 'general/locale_switcher' %>

        <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>

          <% if @user %>
              <%= _('Hello, {{username}}!', :username => h(@user.name))%>

                <% if @user %>
                    <%=link_to _("My requests"), show_user_requests_path(:url_name => @user.url_name) %>
                    <%=link_to _("My profile"), show_user_profile_path(:url_name => @user.url_name) %>
                    <%=link_to _("My wall"), show_user_wall_path(:url_name => @user.url_name) %>
                <% end %>

              <%= link_to _("Sign out"), signout_url(:r => request.request_uri) %>
          <% else %>
              <%= link_to _("Sign in or sign up"), signin_url(:r => request.request_uri) %>
          <% end %>

        <% end %>

          <form id="navigation_search_form" method="post" action="/search">

                 <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query" } %>
                 <input id="navigation_search_button" type="submit" value="search">

           </form>

        <%= render :partial => 'general/orglink' %>

        <%= render :partial => 'general/topnav' %>

            <% if flash[:notice] %>

<%= flash[:notice] %>

            <% end %>
            <% if flash[:error] %>

<%= flash[:error] %>

            <% end %>

            <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
            <%= yield :layout %>

    <%= render :partial => 'general/footer' %>

X
<%= _("Paste this link into emails, tweets, and anywhere else:") %>

<input type="text">

    <%
      unless Configuration::ga_code.empty? || (@user && @user.super?) %>

      <% end %>

      <%= render :partial => 'general/before_body_end' %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="<%= I18n.locale %>">

        <title>
        <% if @title %>
            <%=@title%> - <%= site_name %>
        <% else %>
            <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
        <% end %>
        </title>

        <link rel="shortcut icon" href="/favicon.ico">

        <%= render :partial => 'general/stylesheet_includes' %>
        <% if session[:using_admin] %>
          <%= stylesheet_link_tag "/adminbootstraptheme/stylesheets/admin", :title => "Main", :rel => "stylesheet" %>
        <% end %>

        <%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %>
        <% if @profile_photo_javascript %>

            <link rel="stylesheet" href="/stylesheets/jquery.Jcrop.css" type="text/css" >
        <% end %>

        <% if @feed_autodetect %>
            <% for feed in @feed_autodetect %>
                <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>">
                <% if feed[:has_json] %>
                    <link rel="alternate" type="application/json" title="JSON version of <%=h feed[:title] %>" href="<%=h feed[:url]%>.json">
                <% end %>
            <% end %>
        <% end %>
        <% if @has_json %>
            <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h main_url(request.request_uri, '.json') %>">
        <% end %>

        <% if @no_crawl %>
            <meta name="robots" content="noindex, nofollow">
        <% end %>

        <%= render :partial => 'general/before_head_end' %>

    <body class="<%= 'front' if params[:action] == 'frontpage' %>">
    <% if Configuration::force_registration_on_new_request && !@user %>
    <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>

    <% end %>

<% if session[:using_admin] %>
  <%= render :partial => 'admin_general/admin_navbar' %>
<% end %>

<% if !@popup_banner.blank? %>

<%= _('Close') %>

  <%= @popup_banner %>

<%= _('Close') %>

<% end %>

<%= render :partial => 'general/locale_switcher' %>

        <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>

          <% if @user %>
              <%= _('Hello, {{username}}!', :username => h(@user.name))%>

                <% if @user %>
                    <%=link_to _("My requests"), show_user_requests_path(:url_name => @user.url_name) %>
                    <%=link_to _("My profile"), show_user_profile_path(:url_name => @user.url_name) %>
                    <%=link_to _("My wall"), show_user_wall_path(:url_name => @user.url_name) %>
                <% end %>

              <%= link_to _("Sign out"), signout_url(:r => request.request_uri) %>
          <% else %>
              <%= link_to _("Sign in or sign up"), signin_url(:r => request.request_uri) %>
          <% end %>

        <% end %>

            <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "navigation_search_form"}) do %>

                   <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query" } %>
                   <%= submit_tag 'search', :id => "navigation_search_button"  %>

            <% end %>

        <%= render :partial => 'general/orglink' %>

        <%= render :partial => 'general/topnav' %>

            <% if flash[:notice] %>

<%= flash[:notice] %>

            <% end %>
            <% if flash[:error] %>

<%= flash[:error] %>

            <% end %>

            <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
            <%= yield :layout %>

    <%= render :partial => 'general/footer' %>

X
<%= _("Paste this link into emails, tweets, and anywhere else:") %>

<input type="text">

    <%
      unless Configuration::ga_code.empty? || (@user && @user.super?) %>

      <% end %>

      <%= render :partial => 'general/before_body_end' %>


added cancel button to tag area

added cancel button to tag area

<%
  toggle = "Element.toggle($('tag-form')); Element.toggle($('tags'))"
  tags = @page.tags.collect{|t| t.name}.join(" ")
-%>
<% form_remote_tag :url => {:controller => "pages", :action => "tag", :id => @page},
  :complete => toggle,
  :html => {:id => 'tag-form', :style => "display:none"},
  :update => "tags" do -%>
<%= text_field_tag "tag_list", tags %>
<%= hidden_field_tag "form_id", 'tag-form' %>
<%= submit_tag("Save") %>
<%= button_to_function "Cancel", toggle %>
<% end -%>

<%= render :partial => "pages/tags"%>

<% form_tag = 'tag-form' %>
<%= form_remote_tag :url => {:controller => "pages", :action => "tag", :id => @page},
      :complete => "Element.toggle($('tag-form')); Element.toggle($('tags'))",
      :update => "tags",
      :html => {:id => 'tag-form', :style => "display:none"} %>
<%= text_field_tag "tag_list",
      @page.tags.collect{|t| t.name}.join(" "),
      :size => 40 %>
<%= hidden_field_tag "form_id", 'tag-form' %>
<%= submit_tag("Save")  %>
<%= end_form_tag %>

<%= render :partial => "pages/tags"%>


Increase font size for diff mail

Increase font size for diff mail

        Project: <%= link_to @project.name, @project_url %>

        Revision: <%= link_to @changeset.revision, @changeset_url %>

        Author: <%= h(@author) %>

        Summary: <%= @changeset.short_comments %>

        Details: <%= @changeset.long_comments %>

        Please take a moment to review this checkin.

<%= format_diff @diff %>
<%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer) %>


Adjust pop-up size

Adjust pop-up size

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="<%= I18n.locale %>">

        <% if @profile_photo_javascript %>

            <link rel="stylesheet" href="/stylesheets/jquery.Jcrop.css" type="text/css" >
        <% end %>

        <title>
        <% if @title %>
            <%=@title%> - <%= site_name %>
        <% else %>
            <%= site_name %> - <%= _('Make and browse Freedom of Information (FOI) requests') %>
        <% end %>
        </title>

        <link rel="shortcut icon" href="/favicon.ico">
	<%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet", :media => "all" %>

	<%= stylesheet_link_tag 'theme', :rel => "stylesheet", :media => "all"  %>
	<%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "print"  %>
	<% if !params[:print_stylesheet].nil? %>
         <%= stylesheet_link_tag 'print', :rel => "stylesheet", :media => "all"  %>
	<% end %>
	<%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %>
	<%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%>

        <%= stylesheet_link_tag '../asktheeu-theme/stylesheets/asktheeu.css', :title => "Main", :rel => "stylesheet"  %>
        <% if force_registration_on_new_request %>
        <%= stylesheet_link_tag 'jquery.fancybox-1.3.4', :rel => "stylesheet"  %>
        <% end %>

        <% if @feed_autodetect %>
            <% for feed in @feed_autodetect %>
                <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>">
                <% if feed[:has_json] %>
                    <link rel="alternate" type="application/json" title="JSON version of <%=h feed[:title] %>" href="<%=h feed[:url]%>.json">
                <% end %>
            <% end %>
        <% end %>
        <% if @has_json %>
            <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h main_url(request.request_uri) %>.json">
        <% end %>

        <% if @no_crawl %>
            <meta name="robots" content="noindex, nofollow">
        <% end %>

    <%= render :partial => 'general/before_head_end' %>

    <body <%= "class='front'" if params[:action] == 'frontpage' %>>

    <% if force_registration_on_new_request && !@user %>
    <%= javascript_include_tag 'jquery.fancybox-1.3.4.pack' %>

    <% end %>

<% # code for popup advert for a campaign etc.
=begin

Close

    [ message goes here ]

Close

=end
%>

<%= render :partial => 'general/locale_switcher' %>

        <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>

          <% if @user %>
              <%= _('Hello, {{username}}!', :username => h(@user.name))%>

                <% if @user %>
                    <%=link_to _("My profile"), user_url(@user) %>
                <% end %>

              <%= link_to _("Sign out"), signout_url(:r => request.request_uri) %>
          <% else %>
              <%= link_to _("Sign in or sign up"), signin_url(:r => request.request_uri) %>
          <% end %>

        <% end %>

            <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "navigation_search_form"}) do %>

                   <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query" } %>
                   <%= image_submit_tag('search-button.png') %>

            <% end %>

        <%= render :partial => 'general/orglink' %>

        <%= render :partial => 'general/topnav' %>

            <% if flash[:notice] %>

<%= flash[:notice] %>

            <% end %>
            <% if flash[:error] %>

<%= flash[:error] %>

            <% end %>

            <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>">
            <%= yield :layout %>

    <%= render :partial => 'general/footer' %>

    <%= render :partial => 'general/before_body_end' %>

X
<%= _("Paste this link into emails, tweets, and anywhere else:") %>

<input type="text">


Use user_or_you_capital_link instead of hand-rolling

<div class="comment_in_request" id="comment-<%=comment.id.to_s%>">

        <%# When not logged in, but mid-comment-leaving, there'll be no comment.user %>
        <%= comment.user ? user_or_you_capital_link(comment.user) : "You" %>
        left an annotation (<%= simple_date(comment.created_at || Time.now) %>)

<%= comment.get_body_for_html_display %>

        <% if !comment.id.nil? %>
            <%= link_to "Link to this", comment_url(comment) %>
            <% if !@user.nil? && @user.admin_page_links? %>
                | <%= link_to "Admin", admin_url("request/edit_comment/" + comment.id.to_s) %>
            <% end %>

        <% end %>

<div class="comment_in_request" id="comment-<%=comment.id.to_s%>">

        <%# When not logged in, but mid-comment-leaving, there'll be no comment.user %>
        <%= !comment.user || (!@user.nil? && @user.id == comment.user.id) ? "You" : user_link(comment.user) %>
        left an annotation (<%= simple_date(comment.created_at || Time.now) %>)

<%= comment.get_body_for_html_display %>

        <% if !comment.id.nil? %>
            <%= link_to "Link to this", comment_url(comment) %>
            <% if !@user.nil? && @user.admin_page_links? %>
                | <%= link_to "Admin", admin_url("request/edit_comment/" + comment.id.to_s) %>
            <% end %>

        <% end %>


Added require of Digest MD5, since it is not always loaded.

<%
  #Register appserver.
  begin
    appsrv = _hb
  rescue NameError
    appsrv = _kas
  end

  #Support for the PHP-version... Comes handy when converting PHP to Ruby...
  if !_get["path"]
    trans = {
      "picture" => "path"
    }

    if _get["edgesize"]
      _get["rounded_corners"] = (_get["edgesize"].to_f / 3.0).to_i
    end

    if _get["edgeborder"]
      if _get["edgeborder"].length == 6
        _get["border_color"] = "##{_get["edgeborder"]}"
      else
        _get["border_color"] = _get["edbeborder"]
      end
    end

    if _get["edgeborder"]
      _get["border"] = 1
    end

    trans.each do |key, val|
      _get[val] = _get[key] if _get[key]
    end
  end

  #Base64-encoding of path.
  if _get["path64"]
    require "base64"
    _get["path"] = Base64.decode64(_get["path64"])
  end

  require "digest/md5"
	idstr = Digest::MD5.hexdigest("#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")

	if !_get["path"] or !File.exists?(_get["path"])
    print "File does not exist: '#{_get["path"]}'.\n"
    exit
  end

	time_orig = File.mtime(_get["path"])

	tmp_use = false
	tmp_write = false
	if Knj::CONFIG["webscripts_image"]
		tmp_use = true
		tmp_path = "#{Knj::CONFIG["webscripts_image"]["tmp_path"]}/#{idstr}"
		tmp_exists = File.exists?(tmp_path)
		tmp_write = true if !tmp_exists

		if !tmp_write and tmp_exists
			time_cache = File.mtime(tmp_path)

			if time_orig > time_cache
				tmp_write = true
			end
		end
	end

	if _get["force"] == "true" or _get["force"] == "1"
    force = true
  else
    force = false
  end

	notchanged = false

	if _httpsession.handler.modified_since and time_cache and _httpsession.handler.modified_since.utc.to_s == time_cache.utc.to_s
    notchanged = true
  elsif _httpsession.handler.modified_since and _httpsession.handler.modified_since.utc.to_s == time_orig.utc.to_s
    notchanged = true
  end

  if notchanged and !force
    _httpsession.resp.status = 304
    exit
  end

	if !tmp_use or tmp_write or force
    blob_cont = nil
    Ruby_process::Cproxy.run do |data|
      subproc = data[:subproc]
      subproc.static(:Object, :require, "rubygems")
      subproc.static(:Object, :require, "#{Knj.knjrbfw_path}/../knjrbfw.rb")
      subproc.static(:Object, :require, "RMagick")
      subproc.static(:Dir, :chdir, File.dirname(__FILE__))

      pic = subproc.static("Magick::Image", :read, _get["path"]).first

      if !pic
        print "Could not open image from '#{_get["path"]}'."
        exit
      end

      pic.format = "png"

      pic_columns = pic.columns.__rp_marshal
      pic_rows = pic.rows.__rp_marshal

      width = pic_columns
      height = pic_rows

      height = _get["height"].to_i if _get["height"]
      width = _get["width"].to_i if _get["width"]

      if _get["smartsize"]
        if pic_columns > pic_rows
          width = _get["smartsize"].to_i
          height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
        else
          height = _get["smartsize"].to_i
          width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
        end
      end

      if _get["maxwidth"]
        maxwidth = _get["maxwidth"].to_i

        if width > maxwidth
          height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
          width = maxwidth
        end
      end

      if _get["maxheight"]
        maxheight = _get["maxheight"].to_i

        if height > maxheight
          width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
          height = maxheight
        end
      end

      if _get["width"] and _get["height"]
        width = _get["width"].to_i
        height = _get["height"].to_i
      end

      if height != pic_rows or width != pic_columns
        pic = pic.resize_to_fit(width.to_i, height.to_i)
      end

      if _get["rounded_corners"]
        args = {:img => pic, :radius => _get["rounded_corners"].to_i}

        if _get["border"] and _get["border_color"]
          args[:border] = _get["border"].to_i
          args[:border_color] = _get["border_color"]
        end

        #Call rounded_corners with the proxy-hash.
        subproc.static("Knj::Image", :rounded_corners, args)
      end

      pic.write(tmp_path) if tmp_write or force
    end
	end

	appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
  appsrv.header("Content-Type", "image/png")
  _httpsession.force_fileread(tmp_path)
%>

<%
  #Register appserver.
  begin
    appsrv = _hb
  rescue NameError
    appsrv = _kas
  end

  #Support for the PHP-version... Comes handy when converting PHP to Ruby...
  if !_get["path"]
    trans = {
      "picture" => "path"
    }

    if _get["edgesize"]
      _get["rounded_corners"] = (_get["edgesize"].to_f / 3.0).to_i
    end

    if _get["edgeborder"]
      if _get["edgeborder"].length == 6
        _get["border_color"] = "##{_get["edgeborder"]}"
      else
        _get["border_color"] = _get["edbeborder"]
      end
    end

    if _get["edgeborder"]
      _get["border"] = 1
    end

    trans.each do |key, val|
      _get[val] = _get[key] if _get[key]
    end
  end

  #Base64-encoding of path.
  if _get["path64"]
    require "base64"
    _get["path"] = Base64.decode64(_get["path64"])
  end

	idstr = Digest::MD5.hexdigest("#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")

	if !_get["path"] or !File.exists?(_get["path"])
    print "File does not exist: '#{_get["path"]}'.\n"
    exit
  end

	time_orig = File.mtime(_get["path"])

	tmp_use = false
	tmp_write = false
	if Knj::CONFIG["webscripts_image"]
		tmp_use = true
		tmp_path = "#{Knj::CONFIG["webscripts_image"]["tmp_path"]}/#{idstr}"
		tmp_exists = File.exists?(tmp_path)
		tmp_write = true if !tmp_exists

		if !tmp_write and tmp_exists
			time_cache = File.mtime(tmp_path)

			if time_orig > time_cache
				tmp_write = true
			end
		end
	end

	if _get["force"] == "true" or _get["force"] == "1"
    force = true
  else
    force = false
  end

	notchanged = false

	if _httpsession.handler.modified_since and time_cache and _httpsession.handler.modified_since.utc.to_s == time_cache.utc.to_s
    notchanged = true
  elsif _httpsession.handler.modified_since and _httpsession.handler.modified_since.utc.to_s == time_orig.utc.to_s
    notchanged = true
  end

  if notchanged and !force
    _httpsession.resp.status = 304
    exit
  end

	if !tmp_use or tmp_write or force
    blob_cont = nil
    Ruby_process::Cproxy.run do |data|
      subproc = data[:subproc]
      subproc.static(:Object, :require, "rubygems")
      subproc.static(:Object, :require, "#{Knj.knjrbfw_path}/../knjrbfw.rb")
      subproc.static(:Object, :require, "RMagick")
      subproc.static(:Dir, :chdir, File.dirname(__FILE__))

      pic = subproc.static("Magick::Image", :read, _get["path"]).first

      if !pic
        print "Could not open image from '#{_get["path"]}'."
        exit
      end

      pic.format = "png"

      pic_columns = pic.columns.__rp_marshal
      pic_rows = pic.rows.__rp_marshal

      width = pic_columns
      height = pic_rows

      height = _get["height"].to_i if _get["height"]
      width = _get["width"].to_i if _get["width"]

      if _get["smartsize"]
        if pic_columns > pic_rows
          width = _get["smartsize"].to_i
          height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
        else
          height = _get["smartsize"].to_i
          width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
        end
      end

      if _get["maxwidth"]
        maxwidth = _get["maxwidth"].to_i

        if width > maxwidth
          height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
          width = maxwidth
        end
      end

      if _get["maxheight"]
        maxheight = _get["maxheight"].to_i

        if height > maxheight
          width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
          height = maxheight
        end
      end

      if _get["width"] and _get["height"]
        width = _get["width"].to_i
        height = _get["height"].to_i
      end

      if height != pic_rows or width != pic_columns
        pic = pic.resize_to_fit(width.to_i, height.to_i)
      end

      if _get["rounded_corners"]
        args = {:img => pic, :radius => _get["rounded_corners"].to_i}

        if _get["border"] and _get["border_color"]
          args[:border] = _get["border"].to_i
          args[:border_color] = _get["border_color"]
        end

        #Call rounded_corners with the proxy-hash.
        subproc.static("Knj::Image", :rounded_corners, args)
      end

      pic.write(tmp_path) if tmp_write or force
    end
	end

	appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
  appsrv.header("Content-Type", "image/png")
  _httpsession.force_fileread(tmp_path)
%>


Added UID to the hash to avoid access exceptions.

<%
  #Register appserver.
  begin
    appsrv = _hb
  rescue NameError
    appsrv = _kas
  end

  #Support for the PHP-version... Comes handy when converting PHP to Ruby...
  if !_get["path"]
    trans = {
      "picture" => "path"
    }

    if _get["edgesize"]
      _get["rounded_corners"] = (_get["edgesize"].to_f / 3.0).to_i
    end

    if _get["edgeborder"]
      if _get["edgeborder"].length == 6
        _get["border_color"] = "##{_get["edgeborder"]}"
      else
        _get["border_color"] = _get["edbeborder"]
      end
    end

    if _get["edgeborder"]
      _get["border"] = 1
    end

    trans.each do |key, val|
      _get[val] = _get[key] if _get[key]
    end
  end

  #Base64-encoding of path.
  if _get["path64"]
    require "base64"
    _get["path"] = Base64.decode64(_get["path64"])
  end

  require "digest/md5"
	idstr = Digest::MD5.hexdigest("#{Process.euid}_#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")

	if !_get["path"] or !File.exists?(_get["path"])
    print "File does not exist: '#{_get["path"]}'.\n"
    exit
  end

	time_orig = File.mtime(_get["path"])
	tmp_write = false
	if Knj::CONFIG["webscripts_image"]
		tmp_path = "#{Knj::CONFIG["webscripts_image"]["tmp_path"]}/#{idstr}"
	else
    tmp_path = "#{Knj::Os.tmpdir}/knjrbfw_image_#{idstr}"
  end

  tmp_exists = File.exists?(tmp_path)
  tmp_write = true unless tmp_exists

  if !tmp_write and tmp_exists
    time_cache = File.mtime(tmp_path)

    if time_orig > time_cache
      tmp_write = true
    end
  end

	if _get["force"] == "true" or _get["force"] == "1"
    force = true
  else
    force = false
  end

	notchanged = false

	if _httpsession.handler.modified_since and time_cache and _httpsession.handler.modified_since.utc.to_s == time_cache.utc.to_s
    notchanged = true
  elsif _httpsession.handler.modified_since and _httpsession.handler.modified_since.utc.to_s == time_orig.utc.to_s
    notchanged = true
  end

  if notchanged and !force
    _httpsession.resp.status = 304
    exit
  end

	if tmp_write or force
    blob_cont = nil

    raise "RMagick has not been loaded. If loaded through here bugs will occur. Load in beginning of script." unless ::Kernel.const_defined?(:Magick)
    pic = Magick::Image.read(_get["path"]).first

    if !pic
      print "Could not open image from '#{_get["path"]}'."
      exit
    end

    pic.format = "png"

    pic_columns = pic.columns
    pic_rows = pic.rows

    width = pic_columns
    height = pic_rows

    height = _get["height"].to_i if _get["height"]
    width = _get["width"].to_i if _get["width"]

    if _get["width"] && !_get["height"]
      height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
    elsif _get["height"] && !_get["width"]
      width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
    end

    if _get["smartsize"]
      if pic_columns > pic_rows
        width = _get["smartsize"].to_i
        height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
      else
        height = _get["smartsize"].to_i
        width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
      end
    end

    if _get["maxwidth"]
      maxwidth = _get["maxwidth"].to_i

      if width > maxwidth
        height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
        width = maxwidth
      end
    end

    if _get["maxheight"]
      maxheight = _get["maxheight"].to_i

      if height > maxheight
        width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
        height = maxheight
      end
    end

    if _get["width"] and _get["height"]
      width = _get["width"].to_i
      height = _get["height"].to_i
    end

    if height != pic_rows or width != pic_columns
      pic = pic.resize_to_fill(width.to_i, height.to_i)
    end

    if _get["rounded_corners"]
      args = {:img => pic, :radius => _get["rounded_corners"].to_i}

      if _get["border"] and _get["border_color"]
        args[:border] = _get["border"].to_i
        args[:border_color] = _get["border_color"]
      end

      #Call rounded_corners with the proxy-hash.
      Knj::Image.rounded_corners(args)
    end

    pic.write(tmp_path) if tmp_write or force
	end

  raise "Picture was not written: '#{tmp_path}'." if !tmp_path || !File.exists?(tmp_path)

	appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
  appsrv.header("Content-Type", "image/png")
  _httpsession.force_fileread(tmp_path)
%>

<%
  #Register appserver.
  begin
    appsrv = _hb
  rescue NameError
    appsrv = _kas
  end

  #Support for the PHP-version... Comes handy when converting PHP to Ruby...
  if !_get["path"]
    trans = {
      "picture" => "path"
    }

    if _get["edgesize"]
      _get["rounded_corners"] = (_get["edgesize"].to_f / 3.0).to_i
    end

    if _get["edgeborder"]
      if _get["edgeborder"].length == 6
        _get["border_color"] = "##{_get["edgeborder"]}"
      else
        _get["border_color"] = _get["edbeborder"]
      end
    end

    if _get["edgeborder"]
      _get["border"] = 1
    end

    trans.each do |key, val|
      _get[val] = _get[key] if _get[key]
    end
  end

  #Base64-encoding of path.
  if _get["path64"]
    require "base64"
    _get["path"] = Base64.decode64(_get["path64"])
  end

  require "digest/md5"
	idstr = Digest::MD5.hexdigest("#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")

	if !_get["path"] or !File.exists?(_get["path"])
    print "File does not exist: '#{_get["path"]}'.\n"
    exit
  end

	time_orig = File.mtime(_get["path"])
	tmp_write = false
	if Knj::CONFIG["webscripts_image"]
		tmp_path = "#{Knj::CONFIG["webscripts_image"]["tmp_path"]}/#{idstr}"
	else
    tmp_path = "#{Knj::Os.tmpdir}/knjrbfw_image_#{idstr}"
  end

  tmp_exists = File.exists?(tmp_path)
  tmp_write = true unless tmp_exists

  if !tmp_write and tmp_exists
    time_cache = File.mtime(tmp_path)

    if time_orig > time_cache
      tmp_write = true
    end
  end

	if _get["force"] == "true" or _get["force"] == "1"
    force = true
  else
    force = false
  end

	notchanged = false

	if _httpsession.handler.modified_since and time_cache and _httpsession.handler.modified_since.utc.to_s == time_cache.utc.to_s
    notchanged = true
  elsif _httpsession.handler.modified_since and _httpsession.handler.modified_since.utc.to_s == time_orig.utc.to_s
    notchanged = true
  end

  if notchanged and !force
    _httpsession.resp.status = 304
    exit
  end

	if tmp_write or force
    blob_cont = nil

    raise "RMagick has not been loaded. If loaded through here bugs will occur. Load in beginning of script." unless ::Kernel.const_defined?(:Magick)
    pic = Magick::Image.read(_get["path"]).first

    if !pic
      print "Could not open image from '#{_get["path"]}'."
      exit
    end

    pic.format = "png"

    pic_columns = pic.columns
    pic_rows = pic.rows

    width = pic_columns
    height = pic_rows

    height = _get["height"].to_i if _get["height"]
    width = _get["width"].to_i if _get["width"]

    if _get["width"] && !_get["height"]
      height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
    elsif _get["height"] && !_get["width"]
      width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
    end

    if _get["smartsize"]
      if pic_columns > pic_rows
        width = _get["smartsize"].to_i
        height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
      else
        height = _get["smartsize"].to_i
        width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
      end
    end

    if _get["maxwidth"]
      maxwidth = _get["maxwidth"].to_i

      if width > maxwidth
        height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
        width = maxwidth
      end
    end

    if _get["maxheight"]
      maxheight = _get["maxheight"].to_i

      if height > maxheight
        width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
        height = maxheight
      end
    end

    if _get["width"] and _get["height"]
      width = _get["width"].to_i
      height = _get["height"].to_i
    end

    if height != pic_rows or width != pic_columns
      pic = pic.resize_to_fill(width.to_i, height.to_i)
    end

    if _get["rounded_corners"]
      args = {:img => pic, :radius => _get["rounded_corners"].to_i}

      if _get["border"] and _get["border_color"]
        args[:border] = _get["border"].to_i
        args[:border_color] = _get["border_color"]
      end

      #Call rounded_corners with the proxy-hash.
      Knj::Image.rounded_corners(args)
    end

    pic.write(tmp_path) if tmp_write or force
	end

  raise "Picture was not written: '#{tmp_path}'." if !tmp_path || !File.exists?(tmp_path)

	appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
  appsrv.header("Content-Type", "image/png")
  _httpsession.force_fileread(tmp_path)
%>