media_listing.rhtml 3.42 KB
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= html_language %>" lang="<%= html_language %>">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <%=
      stylesheet_import( %w( media_listing button ) ) + "\n" +
      stylesheet_import( %w( media_listing button ), :themed_source => true )
  %>
  <%= javascript_include_tag :defaults %>
  <%= javascript_include_tag 'lowpro' %>
  <%= icon_theme_stylesheet_tag %>
</head>
<body class='noosfero'>
  <script type="text/javascript">
    /* Adds a class to "msie" to the body element if a Microsoft browser is
     * detected. This is needed to workaround several of their limitations.
     */
    if ( navigator.appVersion.indexOf("MSIE") > -1 ) {
      document.body.className += " msie msie" +
        navigator.appVersion.replace(/^.*MSIE\s+([0-9]+).*$/, "$1");
    }
    function registerDocumentSize() {
      document.body.className = document.body.className.replace(/(^| )docSize.+( |$)/g, " ");
      for ( var x=100; x<=1500; x+=100 ) {
        if ( document.body.clientWidth > x ) {
          document.body.className += " docSize-GT-" + x;
        } else {
          document.body.className += " docSize-LT-" + x;
        }
      }
    }
    registerDocumentSize();
  </script>
  <div id='media-listing-upload'>
    <p><%= _("Include files in some folder or select from the list below to add images and documents to the text editor beside (max size %s)") % UploadedFile.max_size.to_humanreadable %></p>

    <div id="notice" onclick="Element.hide('notice');" style="display:none">
      <% unless flash[:notice].nil? %>
        <%= flash[:notice] unless flash[:notice].nil? %>
        <%= javascript_tag(visual_effect( :appear, 'notice')) %>
      <% end %>
    </div>

    <% form_for('uploaded_file', :url => {:action => 'upload_files'}, :html => {:multipart => true}) do |f| %>
      <%= hidden_field_tag('back_to', @back_to) %>
      <%= render :partial => 'upload_file_form', :locals => { :size => '30' } %>
    <% end %>
  </div><!-- id='media-listing-upload' -->
  <hr/>

  <script type='text/javascript'>
    document.observe("dom:loaded", function() {
      Event.addBehavior.reassignAfterAjax = true;
      Event.addBehavior({
        'div#pagination-images .pagination a' : Remote.Link,
        'div#pagination-documents .pagination a' : Remote.Link
      })
    });
  </script>

  <div id='media-listing'>
    <h3><%= _('Folders') %></h3>
    <p><%= _('Drag images and documents to add them to the text. If needed, resize images by clicking the tree icon on editor.') %></p>

    <div id='media-listing-images'>
      <h4><%= _('Images') %></h4>
      <%= select_folder('', 'folder', 'image_folder_id', @image_folders, {}, :onchange => remote_function(:with => "'image_folder_id=' + value + '&ipage=1'", :url => { :action => :media_listing, :format => 'js' }) ) %>
      <%= render :partial => 'image_thumb', :locals => { :images => @images } %>
    </div><!-- id='media-listing-images' -->
    <div id='media-listing-documents'>
      <h4><%= _('Documents') %></h4>
      <%= select_folder('', 'folder', 'document_folder_id', @document_folders, {}, :onchange => remote_function(:with => "'document_folder_id=' + value + '&dpage=1'", :url => { :action => :media_listing }) ) %>
      <%= render :partial => 'document_link', :locals => { :documents => @documents } %>
    </div><!-- id='media-listing-documents' -->
    <br style="clear:both" />
  </div><!-- id='media-listing' -->
</body>
</html>