media_listing.rhtml
3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<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_link_tag 'application', 'media_listing', :cache => 'cache-media-listing' %>
<%= stylesheet_import 'button', :themed_source => true %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'lowpro' %>
<%= stylesheet_link_tag icon_theme_stylesheet_path %>
</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] %>
<%= javascript_tag(visual_effect( :appear, 'notice')) %>
<% end %>
</div>
<% form_for('uploaded_file', :url => {:action => 'upload_files'}, :html => {:multipart => true}) do |f| %>
<%= hidden_field_tag('media_listing', @media_listing) %>
<%= 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>