210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
# File 'lib/zena/use/upload.rb', line 210
def upload_field(opts = {})
uuid = opts[:uuid] || @uuid
dom = opts[:dom] || 'node'
case opts[:type].to_s
when 'onclick'
link = link_to_remote(_("change"), :update=>'upload_field', :url => get_uf_documents_path(:uuid => @uuid), :method => :get, :complete=>"['file', 'upload_field'].each(Element.toggle);")
<<-TXT
<label for='attachment'>#{_('file')}</label>
<div id="file" class='toggle_div'>#{link}</div>
<div id="upload_field" class='toggle_div' style='display:none;'></div>
TXT
else
attach_file_id, attach_url_id = "af#{uuid}", "au#{uuid}"
onchange = %Q{onchange="Zena.get_filename(this,'#{dom}_title'); $('#{dom}_title').focus(); $('#{dom}_title').select();"}
<<-TXT
<div id='#{attach_file_id}' class='attach'><label for='attachment' onclick=\"['#{attach_file_id}', '#{attach_url_id}'].each(Element.toggle);\">#{_('file')} / <span class='off'>#{_('url')}</span></label>
<input style='line-height:1.5em;' id="attachment#{uuid}" name="attachment" #{onchange} class='file' type='file'/></div>
<div id='#{attach_url_id}' class='attach' style='display:none;'><label for='url' onclick=\"['#{attach_file_id}', '#{attach_url_id}'].each(Element.toggle);\"><span class='off'>#{_('file')}</span> / #{_('url')}</label>
<input style='line-height:1.5em;' size='30' id='attachment_url' type='text' #{onchange} name='attachment_url'/><br/></div>
TXT
end
end
|