Restrict "Suggest an article" to comunity blogs

(ActionItem1732)

<%
  if @page.parent && @page.parent.has_posts? && @page.parent.feed
    add_rss_feed_to_head(@page.parent.name, @page.parent.feed.url)
  end
%>

<div<%= " class='logged-in'" if user %>>
  <% if @page.allow_post_content?(user) || @page.allow_publish_content?(user) %>

      <% if @page.allow_post_content?(user) %>
        <%= link_to content_tag( 'span', label_for_edit_article(@page) ),
            profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }),
            :class => 'button with-text icon-edit' %>
        <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
          <% if @page != profile.home_page && !@page.has_posts? %>
            <%= link_to content_tag( 'span', _('Delete') ),
              profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page }),
              :class => 'button with-text icon-delete' %>
          <% end %>
          <% if !environment.enabled?('disable_cms') && !@page.folder? %>
            <% if profile.kind_of?(Person) %>
              <%= link_to content_tag( 'span', _('Spread this') ),
                  profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }),
                  :class => 'button with-text icon-spread' %>
            <% elsif profile.kind_of?(Community) && environment.portal_community %>
              <%= link_to content_tag( 'span', _('Spread this') ),
                  profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }),
                  :class => 'button with-text icon-spread' %>
            <% end %>
          <% end %>
        <% end %>
      <% end %>
      <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
        <% if !@page.gallery? %>
          <%= link_to _('Add translation'),
              profile.admin_url.merge(:controller => 'cms', :action => 'new',
                                      :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)),
                                      :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }),
              :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %>
          <%= lightbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %>
        <% end %>
        <% if (@page.folder? && !@page.has_posts?) || (@page.parent && @page.parent.folder? && !@page.parent.has_posts?) %>
          <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %>
        <% end %>
      <% end %>
      <% if profile.kind_of?(Enterprise) && @page.gallery? %>
        <%= button('upload-file', _('Upload files'), :controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent)) %>
      <% end %>

  <% else %>
    <% if profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) %>
      <%= link_to content_tag( 'span', _('Suggest an article') ), profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}), :class => 'button with-text icon-new' %>
    <% end %>
  <% end %>
  <%= article_translations(@page) %>

    <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
    <%= article_title(@page, :no_link => true) %>

<% if !@page.tags.empty? %>

    <%= _("This article's tags:") %>
    <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }.join("\n") %>

<% end %>

<% if @page.display_hits? %>

    <%= n_('Viewed one time', 'Viewed %{num} times', @page.hits) % { :num => @page.hits } %>

<% end %>

<% if @page.parent && !@page.parent.path.blank? %>

  <%= button(:back, _('Go back to %s') % @page.parent.short_title, @page.parent.url) %>

<% end %>

<%= render :partial => 'shared/disabled_enterprise' %>

<% cache(@page.cache_key(params, user)) do %>
  <div class="<%="article-body article-body-" + @page.css_class_name %>">
    <% options = @page.image? ? {:gallery_view => true} : {} %>
    <%= article_to_html(@page, options) %>

<% end %>

<% if ! @page.categories.empty? %>

<%= _('Categories') %>

    <%= @page.categories.map {|item| link_to_category(item, false) }.join(", ") %>

<% end %>

<%= display_source_info(@page) %>

<%
  # AddThis Button
  if block_given? && web2_conf['addthis']
      opts = web2_conf['addthis']
%>

<% end %>

  <% if @page.accept_comments? %>
  <h3 <%= 'class="no-comments-yet"' if @comments.size == 0 %>>
    <%= number_of_comments(@page) %>

  <%= render :partial => 'comment', :collection => @comments %>
  <%= render :partial => 'comment_form' %>
  <% end %>

<%
  if @page.parent && @page.parent.has_posts? && @page.parent.feed
    add_rss_feed_to_head(@page.parent.name, @page.parent.feed.url)
  end
%>

<div<%= " class='logged-in'" if user %>>
  <% if @page.allow_post_content?(user) || @page.allow_publish_content?(user) %>

      <% if @page.allow_post_content?(user) %>
        <%= link_to content_tag( 'span', label_for_edit_article(@page) ),
            profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }),
            :class => 'button with-text icon-edit' %>
        <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
          <% if @page != profile.home_page && !@page.has_posts? %>
            <%= link_to content_tag( 'span', _('Delete') ),
              profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page }),
              :class => 'button with-text icon-delete' %>
          <% end %>
          <% if !environment.enabled?('disable_cms') && !@page.folder? %>
            <% if profile.kind_of?(Person) %>
              <%= link_to content_tag( 'span', _('Spread this') ),
                  profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }),
                  :class => 'button with-text icon-spread' %>
            <% elsif profile.kind_of?(Community) && environment.portal_community %>
              <%= link_to content_tag( 'span', _('Spread this') ),
                  profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }),
                  :class => 'button with-text icon-spread' %>
            <% end %>
          <% end %>
        <% end %>
      <% end %>
      <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
        <% if !@page.gallery? %>
          <%= link_to _('Add translation'),
              profile.admin_url.merge(:controller => 'cms', :action => 'new',
                                      :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)),
                                      :type => @page.type, :article => { :translation_of_id => @page.native_translation.id }),
              :class => 'button with-text icon-locale' if @page.translatable? && !@page.native_translation.language.blank? %>
          <%= lightbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %>
        <% end %>
        <% if (@page.folder? && !@page.has_posts?) || (@page.parent && @page.parent.folder? && !@page.parent.has_posts?) %>
          <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %>
        <% end %>
      <% end %>
      <% if profile.kind_of?(Enterprise) && @page.gallery? %>
        <%= button('upload-file', _('Upload files'), :controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent)) %>
      <% end %>

  <% else %>
    <% if profile.community? %>
      <%= link_to content_tag( 'span', _('Suggest an article') ), profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}), :class => 'button with-text icon-new' %>
    <% end %>
  <% end %>
  <%= article_translations(@page) %>

    <%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
    <%= article_title(@page, :no_link => true) %>

<% if !@page.tags.empty? %>

    <%= _("This article's tags:") %>
    <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }.join("\n") %>

<% end %>

<% if @page.display_hits? %>

    <%= n_('Viewed one time', 'Viewed %{num} times', @page.hits) % { :num => @page.hits } %>

<% end %>

<% if @page.parent && !@page.parent.path.blank? %>

  <%= button(:back, _('Go back to %s') % @page.parent.short_title, @page.parent.url) %>

<% end %>

<%= render :partial => 'shared/disabled_enterprise' %>

<% cache(@page.cache_key(params, user)) do %>
  <div class="<%="article-body article-body-" + @page.css_class_name %>">
    <% options = @page.image? ? {:gallery_view => true} : {} %>
    <%= article_to_html(@page, options) %>

<% end %>

<% if ! @page.categories.empty? %>

<%= _('Categories') %>

    <%= @page.categories.map {|item| link_to_category(item, false) }.join(", ") %>

<% end %>

<%= display_source_info(@page) %>

<%
  # AddThis Button
  if block_given? && web2_conf['addthis']
      opts = web2_conf['addthis']
%>

<% end %>

  <% if @page.accept_comments? %>
  <h3 <%= 'class="no-comments-yet"' if @comments.size == 0 %>>
    <%= number_of_comments(@page) %>

  <%= render :partial => 'comment', :collection => @comments %>
  <%= render :partial => 'comment_form' %>
  <% end %>


updated menu layout

updated menu layout

  <title>The Best of ... on Hacker News</title>
  <meta name="description" content="The best comments on Hacker News, charts, PDF export.">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

            <form action="" method="POST" id="target">
              The best
              <select name="limit" id="limit">
                <option value="10">10</option>
                <option value="25">25</option>
                <option value="50">50</option>
                <option value="75">75</option>
                <option value="100" selected>100</option>
              </select>
              comments by <input type="text" id="username" name="username">
              <input class="not-field" name="show-html" type="submit" onclick="hn.generateChart(); return false;" value="Show" />
              <input class="not-field" name="show-pdf" type="button" onclick="$('#target').submit();" value="PDF eBook" />
            </form>

            permalink |
            button |
            about

      powered by
      hnsearch and
      pdfcrowd |
      source |
      feedback: redpill27@gmail.com

      <input class="perm-visible" readonly="readonly" type="text" value="" size="60";/>

      <% if (c.error !== undefined) { %>
        <%= c.error %>
      <% } %>

        This page requires JavaScript enabled.

Distribution of Comments

The markers are clickable, the size is proportional to the comment length.

  <title>The Best of ... on Hacker News</title>
  <meta name="description" content="The best comments on Hacker News, charts, PDF export.">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

            permalink

            <form action="" method="POST" id="target">
              The best
              <select name="limit" id="limit">
                <option value="10">10</option>
                <option value="25">25</option>
                <option value="50">50</option>
                <option value="75">75</option>
                <option value="100" selected>100</option>
              </select>
              comments by <input type="text" id="username" name="username">
              <input class="not-field" name="show-html" type="submit" onclick="hn.generateChart(); return false;" value="Show" />
              <input class="not-field" name="show-pdf" type="button" onclick="$('#target').submit();" value="PDF E-book" />
            </form>

            about

      powered by
      hnsearch and
      pdfcrowd |
      source |
      feedback: redpill27@gmail.com

      <input class="perm-visible" readonly="readonly" type="text" value="" size="60";/>

      <% if (c.error !== undefined) { %>
        <%= c.error %>
      <% } %>

        This page requires JavaScript enabled.

Distribution of Comments

The markers are clickable, the size is proportional to the comment length.


Fixed label issue

Fixed label issue

<%= 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%' %>
    <%= f.yes_no :disallow_comments, :vertical => true, :description => 'requires page connection to be set' %>

    <% 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>


git-svn-id: http://svn.castleproject.org:8080/svn/castle/trunk@239 73e77b4c-caa6-f847-a29a-24ab75ae54b6

<% @page_title = "Home" %>
<% @main_title = "Welcome" %>
<%= render "/home/deflinks" %>

Castle is a small collection of tools and a simple inversion of control
container intended to work together to make development of
applications (enterprise and server like) easier.

While we don't pursue a paradigm shift, we do aim to
provide a reference to create application with a nice
design and simpler code and yet adhere to values of pragmatic programmers
like orthogonality and reversibility.

To achieve good design, Castle promotes

Separation of concerns

Component oriented programming

Aspect oriented programming

Our sub projects help us delivering this capabilities to
the CLI. They are totally independent and can be used alone
as well.

Castle container

Castle Container is a very simple inversion of control
container which can combine facilities to grow orthogonally.
For example, you can add a NHibernate facility - thus allowing your
data access components can have references to NHibernate sessions -
 and use our AOP facility which will allow your components to use mixins
and interceptors.

These facilities work side-by-side, without interfering
or depending on each other, to provide you a set of features.

News

26-01-05: Introducing Castle - Part II

   New article
   published on CodeProject.com describing how to use Castle on Rails and the NHibernate
   Facility.

21-01-05: Facilities Documentation

   We've release the documentation for the facilities
   developed so far, including integrations with Aspect#, NHibernate and iBatis.Net,
   and transaction management.

21-01-05: Beta 1 Released

   The beta 1 version of MicroKernel and Windsor, plus Castle on Rails and
   the Facilities are now available for download.

27-12-04: Introducing Castle - Part I

   New article
   published on CodeProject.com describing how inversion of control might benefit
   the design of applications, and how Castle Project fits in this scenario.

Mailing list

If you want to discuss features, ask question or anything related, please check our
mailing lists.

How to contribute

For those interested in join the project rest assured that we welcome any effort.
But please read this first and come on board!

Free counter

<% @page_title = "Home" %>
<% @main_title = "Welcome" %>
<%= render "/home/deflinks" %>

Castle is a small collection of tools and a simple inversion of control
container intended to work together to make development of
applications (enterprise and server like) easier.

While we don't pursue a paradigm shift, we do aim to
provide a reference to create application with a nice
design and yet adhere to values of pragmatic programmers
like orthogonality and reversibility.

To achieve good design, Castle promotes

Component oriented programming

Aspect oriented programming

Separation of concerns

Our sub projects help us delivering this capabilities to
the CLI. They are totally independent and can be used alone
as well.

Castle container

Castle Container is a very simple inversion of control
container which can combine facilities to grow orthogonally.
For example, you can add a NHibernate facility - thus allowing your
data access components can have references to NHibernate sessions -
 and use our AOP facility which will allow your components to use mixins
and interceptors.

These facilities work side-by-side, without interfering
or depending on each other, to provide you a set of features.

News

21-01-05: Facilities Documentation

   We release the documentation for the facilities
   developed so far, including integrations with Aspect#, NHibernate and iBatis.Net,
   and transaction management.

21-01-05: Beta 1 Released

   The beta 1 version of MicroKernel and Windsor, plus Castle on Rails and
   the Facilities are now available for download.

27-12-04: Introducing Castle - Part I

   New article
   published on CodeProject.com describing how inversion of control might benefit
   the design of applications, and how Castle Project fits in this scenario.

12-12-04: PestControl Sample Application

   PestControl is an application
   to manage builds, but its underlying goal is to depict the benefits
   of using Castle's Windsor and Castle on Rails.

12-12-04: New Alpha-2 Release

   New release for the Inversion of Control,
   Castle on Rails and Prevalence packages.

12-10-04: Castle on Rails

   First draft of documentation
   explaining what Castle on Rails is, how to use it and what tasks are
   pending for it.

12-05-04: Who is using Dynamic Proxy?

   New section under DynamicProxy area.

11-22-04: Containers documentation

   Documentation for MicroKernel and Windsor are
   now available.
   Click here to access it.

11-22-04: Alpha-1 Released

   First release of all pieces that
   constitues the project is now available.
   Click here to download

11-19-04: New site is up and running

   The http://www.castleproject.org is released.

Mailing list

If you want to discuss features, ask question or anything related, please subscribe to
castle-devel mailing list.

Free counter


ds: fixed css zindex and coloring

ds: fixed css zindex and coloring

<style>
div#query_review_parent {
    position: absolute;
    top: 1px;
    left: 1px;
		z-index: 100000;
}

div.query_review_container {
    float: left;
}

div.query_review {
	height: 18px;
	margin: 1px;
	opacity: 0.75;
	padding-left: 3px;
	padding-right: 3px;
	border: 1px solid black;
	font-size: 12px;
	font-weight: bold;
  text-align: left;
}

div.query_review.sql_ok {
	background-color: #090;
	color: #020;
}

div.query_review.sql_warning {
	background-color: #FAE100;
	color: #F05000;
}

div.query_review.sql_critical {
	background-color: #F99;
	color: #A00;
}

div.query_review.sql_disabled {
	background-color: #BBB;
	color: #555;
}

div.query_review a {
	color: inherit;
	text-decoration: none;
}

div.query_review_details {
	width: 900px;
	height: 600px;
	opacity: 0.9;
	margin: 1px;
	padding: 2px;
	border: 1px solid black;
	font-size: 12px;
	overflow: auto;
	background-color: #DDD;
  text-align: left;
  text-indent: 0px;
  color: black;
}

div.query_review_details p {
	margin: 2px 0 2px 0;
	padding: 0px;
}

div.query_review_details a {
	color: #29ABE2;
}

div.query_review_details ul {
	list-style-type: circle;
	padding-left: 15px;
}

div.query_review_details li {
  clear: both;
}

div.query_review_details code {
	white-space: normal;
	line-height: 120%;
}

div.query_review_details .title {
	font-weight: bold;
}

div.query_review_details .indent {
	padding-left: 10px;
}

div.query_review_details .number {
	font-weight: bold;
}

div.query_review_details .bad {
	color: #900;
}

div.query_review_details .good {
	color: #090;
}

div.query_review_details div.divider {
	width: 504px;
	position: relative;
	left: -2px;
	height: 1px;
	border-top: 1px dashed black;
	margin: 2px 0 2px 0;
}

div.query_review_details .small {
	font-size: 10px;
}

div.query_review_details .tbpadded {
	padding-top: 3px;
	padding-bottom: 3px;
}

div.query_review_details .trace {
	background-color: #0C1021;
	color: #7F908A;
	padding: 5px;
	margin-right: 30px;
}

div.query_review_details .trace .bold {
	color: white;
}

div.query_review_details div.spectrum_container {
	margin-top: 4px;
	width: 35px;
	display: block;
	float: left;
	position: relative;
	height: 14px;
	margin-right: 5px;
}

div.query_review_details div.spectrum_elem {
	width: 1px;
	display: block;
	float: left;
	height: 10px;
}
div.query_review_details div.spectrum_pointer {
	width: 2px;
	display: block;
	float: left;
	position: absolute;
	height: 14px;
	background-color: black;
	top: -2px;
}

div.query_review_details table {
	background-color: white;
	border: 1px solid gray;
	padding: 0px;
	margin: 0px;
}

div.query_review_details tbody {
	border: 0px;
	padding: 0px;
	margin: 0px;
}

div.query_review_details thead {
	border-bottom: 1px solid gray;
	padding: 0px;
	margin: 0px;
}

div.query_review_details tr {
	border: 0px;
	padding: 0px;
	margin: 0px;
}

div.query_review_details td {
	border: 0px;
	padding: 0px;
	margin: 0px;
    overflow: hidden;
}

div.query_review_details th {
	border-bottom: 1px solid gray;
	padding: 0px;
	margin: 0px;
}

</style>

<style>
.sql {
	color: black;
}
.sql .String {
	color: #009933;
}
.sql .Keyword {
	color: #0000FF;
}
.sql .Constant {
	color: #6782D3;
}
.sql .Number {
	color: #0066FF;
}
.sql .Comment {
   color: #0066FF;
   font-style: italic;
}
</style>

<script type="text/javascript">
//Super lame show/hide functions so we don't need any 3rd party JS libs
function query_review_show(id) {
	document.getElementById(id).style.display = "block";
}

function query_review_hide(id) {
	document.getElementById(id).style.display = "none";
}
function query_review_toggle(id) {
	if(document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "block";
	} else {
		document.getElementById(id).style.display = "none";
	}
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function ignore_list() {
	var ignore_list = readCookie("query_review_ignore_list")
	if (!ignore_list)
		ignore_list = []
	else
		ignore_list = ignore_list.split(",")
	return ignore_list
}

function add_ignore_hash(h){
	var list = ignore_list();
	list[list.length] = h
	createCookie("query_review_ignore_list", list.join(","))
}

function remove_ignore_hash(h) {
	var list = ignore_list();
	var new_list = []
	for(var i=0; i<list.length; i++)
	{
		if(list[i].toString() != h.toString()) {
			new_list[new_list.length] = list[i]
		}
	}
	createCookie("query_review_ignore_list", new_list.join(","))
}
</script>

<style>
div#query_review_parent {
    position: absolute;
    top: 1px;
    left: 1px;
}

div.query_review_container {
    float: left;
}

div.query_review {
	height: 18px;
	margin: 1px;
	opacity: 0.75;
	padding-left: 3px;
	padding-right: 3px;
	border: 1px solid black;
	font-size: 12px;
	font-weight: bold;
  text-align: left;
}

div.query_review.sql_ok {
	background-color: #090;
	color: #020;
}

div.query_review.sql_warning {
	background-color: #FAE100;
	color: #F05000;
}

div.query_review.sql_critical {
	background-color: #F99;
	color: #A00;
}

div.query_review.sql_disabled {
	background-color: #BBB;
	color: #555;
}

div.query_review a {
	color: inherit;
	text-decoration: none;
}

div.query_review_details {
/*	position: absolute;
	top: 21px;
	left: 1px;*/
	width: 900px;
	height: 600px;
	opacity: 0.9;
	margin: 1px;
	padding: 2px;
	border: 1px solid black;
	font-size: 12px;
	overflow: auto;
	background-color: #DDD;
  text-align: left;
  text-indent: 0px;
}

div.query_review_details p {
	margin: 2px 0 2px 0;
	padding: 0px;
}

div.query_review_details a {
	color: #29ABE2;
}

div.query_review_details ul {
	list-style-type: circle;
	padding-left: 15px;
}

div.query_review_details li {
  clear: both;
}

div.query_review_details code {
	white-space: normal;
	line-height: 120%;
}

div.query_review_details .title {
	font-weight: bold;
}

div.query_review_details .indent {
	padding-left: 10px;
}

div.query_review_details .number {
	font-weight: bold;
}

div.query_review_details .bad {
	color: #900;
}

div.query_review_details .good {
	color: #090;
}

div.query_review_details div.divider {
	width: 504px;
	position: relative;
	left: -2px;
	height: 1px;
	border-top: 1px dashed black;
	margin: 2px 0 2px 0;
}

div.query_review_details .small {
	font-size: 10px;
}

div.query_review_details .tbpadded {
	padding-top: 3px;
	padding-bottom: 3px;
}

div.query_review_details .trace {
	background-color: #0C1021;
	color: #7F908A;
	padding: 5px;
	margin-right: 30px;
}

div.query_review_details .trace .bold {
	color: white;
}

div.query_review_details div.spectrum_container {
	margin-top: 4px;
	width: 35px;
	display: block;
	float: left;
	position: relative;
	height: 14px;
	margin-right: 5px;
}

div.query_review_details div.spectrum_elem {
	width: 1px;
	display: block;
	float: left;
	height: 10px;
}
div.query_review_details div.spectrum_pointer {
	width: 2px;
	display: block;
	float: left;
	position: absolute;
	height: 14px;
	background-color: black;
	top: -2px;
}

div.query_review_details table {
	background-color: white;
	border: 1px solid gray;
	padding: 0px;
	margin: 0px;
}

div.query_review_details tbody {
	border: 0px;
	padding: 0px;
	margin: 0px;
}

div.query_review_details thead {
	border-bottom: 1px solid gray;
	padding: 0px;
	margin: 0px;
}

div.query_review_details tr {
	border: 0px;
	padding: 0px;
	margin: 0px;
}

div.query_review_details td {
	border: 0px;
	padding: 0px;
	margin: 0px;
    overflow: hidden;
}

div.query_review_details th {
	border-bottom: 1px solid gray;
	padding: 0px;
	margin: 0px;
}

</style>

<style>
.sql {
	color: black;
}
.sql .String {
	color: #009933;
}
.sql .Keyword {
	color: #0000FF;
}
.sql .Constant {
	color: #6782D3;
}
.sql .Number {
	color: #0066FF;
}
.sql .Comment {
   color: #0066FF;
   font-style: italic;
}
</style>

<script type="text/javascript">
//Super lame show/hide functions so we don't need any 3rd party JS libs
function query_review_show(id) {
	document.getElementById(id).style.display = "block";
}

function query_review_hide(id) {
	document.getElementById(id).style.display = "none";
}
function query_review_toggle(id) {
	if(document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "block";
	} else {
		document.getElementById(id).style.display = "none";
	}
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function ignore_list() {
	var ignore_list = readCookie("query_review_ignore_list")
	if (!ignore_list)
		ignore_list = []
	else
		ignore_list = ignore_list.split(",")
	return ignore_list
}

function add_ignore_hash(h){
	var list = ignore_list();
	list[list.length] = h
	createCookie("query_review_ignore_list", list.join(","))
}

function remove_ignore_hash(h) {
	var list = ignore_list();
	var new_list = []
	for(var i=0; i<list.length; i++)
	{
		if(list[i].toString() != h.toString()) {
			new_list[new_list.length] = list[i]
		}
	}
	createCookie("query_review_ignore_list", new_list.join(","))
}
</script>


set widget_counter to 0 if undefined

set widget_counter to 0 if undefined

<% # TODO HACK => widget_counter is not set when inserting this partial with attach.rjs %>
<% widget_counter ||= 0 %>
<li id="<%= widget.dom_id("#{prefix}-widget") %>" class="widget<%= ' selected-widget' if @article && @article.assets.include?(widget) %>">
<% if prefix == 'attached' -%>

    <%= link_to asset_image_for(widget), widget.public_filename %>

      <%= text_field_tag :version, (widget.respond_to?(:label) ? widget.label : nil), :id => widget.dom_id("#{prefix}-widget-version"), :class => 'txt' %>
      <a href="#" class="label-widget" id="<%= widget.dom_id("label-#{prefix}-widget") %>">Save

<% else -%>
  <%= link_to asset_image_for(widget), widget.public_filename %>
<% end -%>
  <%= image_tag('mephisto/icons/8-em-cross.png', :size => '16x16', :id => widget.dom_id("detach-#{prefix}-widget"),
        :style => 'display:none', :class => 'detach-widget') %>
  <%= image_tag('mephisto/icons/8-em-plus.png', :size => '16x16', :id => widget.dom_id("attach-#{prefix}-widget"),
        :style => 'display:none', :class => 'attach-widget') %>

<% if widget_counter.remainder(4).zero? && widget_counter > 0 %>
<% end %>


Label the filter bar

Label the filter bar

Questionnaires

<%= javascript_include_tag "layout.js" %>

    <%= link_to_function "Create questionnaire", "selectTab('create_questionnaire');"%>

    <%= link_to_function "Import questionnaire", "selectTab('import_questionnaire');"%>

Create a new questionnaire

		<% ae_form_for(:questionnaire, @questionnaire, :url => questionnaires_path, :html => {:id => "create_questionnaire"}) do |f| %>
		  <%= f.text_field "title" %>
			<%= submit_tag "Create" %>
		<% end %>

Import a questionnaire

	  <% form_tag(questionnaires_path, :multipart => true) do %>
		  JQML file to import
		  <input type="file" name="file" />
			<%= submit_tag "Import" %>
		<% end %>

<% p = logged_in? ? logged_in_person : nil-%>

  <% form_tag({}, {:method => "get"}) do  %>

        Search filters
        Title: <%= text_field_tag "title", params[:title] %>
        Tag: <%= text_field_tag "tag", params[:tag] %>
        <%= submit_tag "Search" %>

  <% end %>

	<% for questionnaire in @questionnaires %>
		<%= render :partial => "summary", :locals => {:questionnaire => questionnaire} %>
	<% end %>

<%= will_paginate @questionnaires %>

Questionnaires

<%= javascript_include_tag "layout.js" %>

    <%= link_to_function "Create questionnaire", "selectTab('create_questionnaire');"%>

    <%= link_to_function "Import questionnaire", "selectTab('import_questionnaire');"%>

Create a new questionnaire

		<% ae_form_for(:questionnaire, @questionnaire, :url => questionnaires_path, :html => {:id => "create_questionnaire"}) do |f| %>
		  <%= f.text_field "title" %>
			<%= submit_tag "Create" %>
		<% end %>

Import a questionnaire

	  <% form_tag(questionnaires_path, :multipart => true) do %>
		  JQML file to import
		  <input type="file" name="file" />
			<%= submit_tag "Import" %>
		<% end %>

<% p = logged_in? ? logged_in_person : nil-%>

  <% form_tag({}, {:method => "get"}) do  %>

        Title: <%= text_field_tag "title", params[:title] %>
        Tag: <%= text_field_tag "tag", params[:tag] %>
        <%= submit_tag "Search" %>

  <% end %>

	<% for questionnaire in @questionnaires %>
		<%= render :partial => "summary", :locals => {:questionnaire => questionnaire} %>
	<% end %>

<%= will_paginate @questionnaires %>


Add maximiseMap() and minimiseMap() functions to the edit page to allow the size of the editing area to be toggled.

<% if API_STATUS == :offline %>

The OpenStreetMap database is currently offline while
   essential database maintenance work is carried out.

<% elsif API_STATUS == :readonly %>

The OpenStreetMap database is currently in read-only mode while
   essential database maintenance work is carried out.

<% elsif !@user.data_public? %>

You haven't set your edits to be public.

You can't use the online editor unless you do so. You can set your edits as public from your
<%= link_to 'user page', {:controller => 'user', :action => 'account', :display_name => @user.display_name}%>.

(Find out why this is the case.)

<% else %>
<% content_for :greeting do %>
<% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
<%= link_to_function 'home', "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)" %> |
<% end %>
<% end %>

<%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
<%= render :partial => 'search' %>

<% session[:token] = @user.tokens.create.token unless session[:token] %>

<% if params['mlon'] and params['mlat'] %>
	<% lon =  h(params['mlon']) %>
	<% lat =  h(params['mlat'])  %>
	<% zoom =  h(params['zoom'] || '14') %>
<% elsif @user and params['lon'].nil? and params['lat'].nil? and params['gpx'].nil? %>
	<% lon =  @user.home_lon %>
	<% lat =  @user.home_lat %>
	<% zoom = '14' %>
<% else %>
	<% lon =  h(params['lon'] || 'null') %>
	<% lat =  h(params['lat'] || 'null') %>
	<% zoom =  h(params['zoom'] || '14') %>
<% end %>

	You need a Flash player to use Potlatch, the
    OpenStreetMap Flash editor. You can download Flash Player from Adobe.com.

    Several other options are also available
    for editing OpenStreetMap.

<%= javascript_include_tag 'swfobject.js' %>

<% end %>


Show section even if you have no email subscriptions.

<% @title = h(@display_user.name) + (@is_you ? " (you)" : "") %>

<% if (@same_name_users.size >= 1) %>

There is more than one person who uses this site and has this name.
    One of them is shown below, you may mean a different one: <% for @same_name_user in @same_name_users %>
        <%= user_link(@same_name_user) %>
    <% end %>
<% end%>

<% if @is_you && @undescribed_requests.size > 0 %>

Please go to the following requests, and let us
        know if there was information in the recent responses to them.

        <% for undescribed_request in @undescribed_requests %>

<%=request_link(undescribed_request)%>

        <% end %>

            Thanks very much - this will help others find useful stuff. We'll
            also, if you need it, give advice on what to do next about your
            requests.

<% end %>

Track this person

    <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>

On this page

    FOI requests

Annotations
    <% if @is_you %>

Email subscriptions
    <% end %>

<%=@title%>

        Joined WhatDoTheyKnow in <%= year_from_date(@display_user.created_at) %>
        <% if !@user.nil? && @user.admin_page_links? %>
        (<%= link_to "admin", user_admin_url(@display_user) %>)
        <% end %>

        <%= link_to "Send message to " + h(@display_user.name), contact_user_url(:id => @display_user.id) %>
        <% if @is_you %>
            (just to see how it works)

<%= link_to "Change your password", signchange_url() %>
        <% end %>

    <% if not @is_you %>

            If you are <%=h @display_user.name %>, <%= link_to "sign in", signin_url(:r => request.request_uri) %> to change your password or alter your subscriptions.

    <% end %>

    <% if !@xapian_requests.nil? %>
        <% if @xapian_requests.results.empty? %>
            <% if @page == 1 %>

Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %>

<%= @is_you ? 'You have' : 'This person has' %>
                made no Freedom of Information requests using this site.

            <% end %>
        <% else %>

                <%= @is_you ? 'Your ' : "This person's " %>
                <%=pluralize(@display_user.info_requests.size, "Freedom of Information request") %>

                <%= @page_desc %>

            <% for result in @xapian_requests.results %>
                <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
            <% end %>

            <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.info_requests.size) %>
        <% end %>
    <% else %>

Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %>

The search index is currently offline, so we can't show the Freedom of Information requests this person has made.

    <% end %>

    <% if !@xapian_comments.nil? %>
        <% if @xapian_comments.results.empty? %>
            <% if @page == 1 %>

<%= @is_you ? 'Your' : 'This person\'s' %> annotations

None made.

            <% end %>
        <% else %>

                <%= @is_you ? 'Your ' : "This person's " %>
                <%=pluralize(@display_user.visible_comments.size, "annotation") %>

                <%= @page_desc %>

            <% for result in @xapian_comments.results %>
                <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
            <% end %>

            <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.visible_comments.size) %>
        <% end %>
    <% end %>

    <% if @is_you %>
        <% if @track_things.empty? %>

 Your email subscriptions

None made.

        <% else %>

 Your <%=pluralize(@track_things.size, "email subscription") %>

            <% if @track_things_grouped.size == 1 %>
                <% form_tag :controller => 'track', :action => 'delete_all_type' do %>

                        <%=TrackThing.track_type_description(@track_things[0].track_type)%>
                        <%= hidden_field_tag 'track_type', @track_things[0].track_type %>
                        <%= hidden_field_tag 'user', @display_user.id %>
                        <%= hidden_field_tag 'r', request.request_uri %>
                        <% if @track_things.size > 1 %>
                            <%= submit_tag "unsubscribe all" %>
                        <% end %>

                <% end %>
            <% end %>
            <% for track_type, track_things in @track_things_grouped %>
                <% if @track_things_grouped.size > 1 %>
                    <% form_tag :controller => 'track', :action => 'delete_all_type' do %>

                            <%=TrackThing.track_type_description(track_type)%>
                            <%= hidden_field_tag 'track_type', track_type %>
                            <%= hidden_field_tag 'user', @display_user.id %>
                            <%= hidden_field_tag 'r', request.request_uri %>
                            <% if track_things.size > 1 %>
                                <%= submit_tag "unsubscribe all" %>
                            <% end %>

                    <% end %>
                <% end %>

                <% for track_thing in track_things %>

                        <% form_tag :controller => 'track', :action => 'update', :track_id => track_thing.id do %>

                                <%= track_thing.params[:list_description] %>
                                <%= hidden_field_tag 'track_medium', "delete", { :id => 'track_medium_' + track_thing.id.to_s } %>
                                <%= hidden_field_tag 'r', request.request_uri, { :id => 'r_' + track_thing.id.to_s }  %>
                                <%= submit_tag "unsubscribe" %>

                        <% end %>

                <% end %>

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

<% @title = h(@display_user.name) + (@is_you ? " (you)" : "") %>

<% if (@same_name_users.size >= 1) %>

There is more than one person who uses this site and has this name.
    One of them is shown below, you may mean a different one: <% for @same_name_user in @same_name_users %>
        <%= user_link(@same_name_user) %>
    <% end %>
<% end%>

<% if @is_you && @undescribed_requests.size > 0 %>

Please go to the following requests, and let us
        know if there was information in the recent responses to them.

        <% for undescribed_request in @undescribed_requests %>

<%=request_link(undescribed_request)%>

        <% end %>

            Thanks very much - this will help others find useful stuff. We'll
            also, if you need it, give advice on what to do next about your
            requests.

<% end %>

Track this person

    <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>

On this page

    FOI requests

Annotations
    <% if @is_you %>

Email subscriptions
    <% end %>

<%=@title%>

        Joined WhatDoTheyKnow in <%= year_from_date(@display_user.created_at) %>
        <% if !@user.nil? && @user.admin_page_links? %>
        (<%= link_to "admin", user_admin_url(@display_user) %>)
        <% end %>

        <%= link_to "Send message to " + h(@display_user.name), contact_user_url(:id => @display_user.id) %>
        <% if @is_you %>
            (just to see how it works)

<%= link_to "Change your password", signchange_url() %>
        <% end %>

    <% if not @is_you %>

            If you are <%=h @display_user.name %>, <%= link_to "sign in", signin_url(:r => request.request_uri) %> to change your password or alter your subscriptions.

    <% end %>

    <% if !@xapian_requests.nil? %>
        <% if @xapian_requests.results.empty? %>
            <% if @page == 1 %>

Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %>

<%= @is_you ? 'You have' : 'This person has' %>
                made no Freedom of Information requests using this site.

            <% end %>
        <% else %>

                <%= @is_you ? 'Your ' : "This person's " %>
                <%=pluralize(@display_user.info_requests.size, "Freedom of Information request") %>

                <%= @page_desc %>

            <% for result in @xapian_requests.results %>
                <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
            <% end %>

            <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.info_requests.size) %>
        <% end %>
    <% else %>

Freedom of Information requests made by <%= @is_you ? 'you' : 'this person' %>

The search index is currently offline, so we can't show the Freedom of Information requests this person has made.

    <% end %>

    <% if !@xapian_comments.nil? %>
        <% if @xapian_comments.results.empty? %>
            <% if @page == 1 %>

<%= @is_you ? 'Your' : 'This person\'s' %> annotations

None made.

            <% end %>
        <% else %>

                <%= @is_you ? 'Your ' : "This person's " %>
                <%=pluralize(@display_user.visible_comments.size, "annotation") %>

                <%= @page_desc %>

            <% for result in @xapian_comments.results %>
                <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
            <% end %>

            <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.visible_comments.size) %>
        <% end %>
    <% end %>

    <% if @is_you and not @track_things.empty? %>

            Your <%=pluralize(@track_things.size, "email subscription") %>
            <% if @track_things_grouped.size == 1 %>
                <% form_tag :controller => 'track', :action => 'delete_all_type' do %>

                        <%=TrackThing.track_type_description(@track_things[0].track_type)%>
                        <%= hidden_field_tag 'track_type', @track_things[0].track_type %>
                        <%= hidden_field_tag 'user', @display_user.id %>
                        <%= hidden_field_tag 'r', request.request_uri %>
                        <% if @track_things.size > 1 %>
                            <%= submit_tag "unsubscribe all" %>
                        <% end %>

                <% end %>
            <% end %>

        <% for track_type, track_things in @track_things_grouped %>
            <% if @track_things_grouped.size > 1 %>
                <% form_tag :controller => 'track', :action => 'delete_all_type' do %>

                        <%=TrackThing.track_type_description(track_type)%>
                        <%= hidden_field_tag 'track_type', track_type %>
                        <%= hidden_field_tag 'user', @display_user.id %>
                        <%= hidden_field_tag 'r', request.request_uri %>
                        <% if track_things.size > 1 %>
                            <%= submit_tag "unsubscribe all" %>
                        <% end %>

                <% end %>
            <% end %>

            <% for track_thing in track_things %>

                    <% form_tag :controller => 'track', :action => 'update', :track_id => track_thing.id do %>

                            <%= track_thing.params[:list_description] %>
                            <%= hidden_field_tag 'track_medium', "delete", { :id => 'track_medium_' + track_thing.id.to_s } %>
                            <%= hidden_field_tag 'r', request.request_uri, { :id => 'r_' + track_thing.id.to_s }  %>
                            <%= submit_tag "unsubscribe" %>

                    <% end %>

            <% end %>

        <% end %>
    <% end %>