[%# TT conversion of editicons.bml # # Authors: # Jen Griffin # # Copyright (c) 2017 by Dreamwidth Studios, LLC. # # This program is free software; you may redistribute it and/or modify it # under the same terms as Perl itself. For a copy of the license, please # reference 'perldoc perlartistic' or 'perldoc perlgpl'. # %] [%- CALL dw.active_resource_group( "foundation" ) -%] [%- sections.title = '.title' | ml -%] [%- dw.need_res( "stc/editicons.css", "js/editicons.js" ) -%] [%- USE Scalar; # needed to force scalar return context for keywords -%]
[% authas_html %]
[%- INCLUDE components/errors.tt errors = errors -%] [%- IF messages.size > 0 -%] [%- FOREACH msg = messages -%]
[% msg %]
[%- END -%] [%- END -%] [%- IF num_icons >= max_icons -%]
[% '.error.icon.quota' | ml( num = max_icons ) %]
[%- ELSE -%]

[% '.upload.header' | ml %]

[% '.upload.about' | ml %]

[% '.upload.desc' | ml %]

[%# can't use auto-label with ml strings that contain HTML formats -%] [% form.radio( name = "src", id = "radio_file", value = "file", class = "radio", accesskey = dw.ml( '.fromfile.key' ), selected = 1 ) %]

[%# can't use auto-label with ml strings that contain HTML formats -%] [% form.radio( name = "src", id = "radio_url", value = "url", class = "radio", accesskey = dw.ml( '.fromurl.key' ), selected = formdata.urlpic_0.length ) %]
[% form.textbox( name = "urlpic_0", id = "urlpic_0", class = "text inline", style = 'margin: 0em 0em 0.5em 2em;' ) %]

[% '.upload.formats.desc' | ml %]


[% form.textbox( name = "keywords_0", id = "keywords_0", class = "text" ) %] [% help_icon( 'upic_keywords' ) %]

[% '.upload.label.keywords.desc' | ml %]

[% form.textbox( name = "comments_0", id = "comments_0", class = "text", maxlength = maxlength.comment ) %] [% help_icon( 'upic_comments' ) %]

[% '.upload.label.comment.desc' | ml %]

[% form.textbox( name = "descriptions_0", id = "descriptions_0", class = "text", maxlength = maxlength.description ) %] [% help_icon( 'upic_descriptions' ) %]

[% '.upload.label.description.desc' | ml %] [% alttext_faq( dw.ml( '.upload.label.description.faq' ) ) %]

[%# can't use auto-label with ml strings that contain HTML formats -%] [% form.checkbox( name = 'make_default', id = 'make_default_0', accesskey = dw.ml( '.makedefault.key' ), value = 0, selected = num_icons ? 0 : 1 ) %]

[%- num_remaining = max_icons - num_icons -%] [%- IF num_remaining >= 2 -%]

[%- END -%]

[% form.submit( class="large", value = dw.ml( ".upload.btn.proceed" ), disabled = uploads_disabled ) %]

[%- END -%] [%- IF ! num_icons -%]

[% '.edit.nopics.header' | ml %]

[% '.edit.nopics.desc' | ml %]

[%- ELSE -%]
[% dw.form_auth %]

[% '.edit.icons.header' | ml %]

[% '.edit.icons.desc' | ml %]

[%- IF uses_default_keywords -%]
[% '.edit.nokeywords' | ml %]
[%- END -%]

[% '.icon.countstatus' | ml( current = num_icons, max = max_icons ) %] [% '.icon.viewall' | ml( aopts = "href='" _ u.allpics_base _ "'" ) %]

[%- IF num_icons >= max_icons -%]

[% 'cprod.editpics.text7.v1' | ml( num = max_icons ) %]

[%- END -%]

[%- IF sort_by_kw -%] [% '.icon.sort.default' | ml %] | [% '.icon.sort.keyword' | ml %] [%- ELSE -%] [% '.icon.sort.default' | ml %] | [% '.icon.sort.keyword' | ml %] [%- END -%]

[%- FOREACH pic IN icons; pid = pic.id -%]
[% pic.imgtag %] [%# FIXME: if no keywords then light grey text and empty out when you click in it #%]
[% form.textbox( name = "kw_$pid", id = "kw_$pid", class = "text", value = pic.scalar.keywords, disabled = pic.inactive, onfocus = display_rename ? "\$(\'rename_div_$pid\').style.display = \'block\';" : "" ) %] [% form.hidden( name = "kw_orig_$pid", value = pic.scalar.keywords ) %]
[%- IF display_rename -%]
[%- IF u.userpic_have_mapid -%] [% form.checkbox( label = dw.ml( ".edit.label.rename" ), name = "rename_keyword_$pid", value = 1, class = 'checkbox', id = "rename_keyword_$pid", disabled = uploads_disabled ) %] [%- ELSE -%] [% 'error.iconkw.rename.disabled' | ml %] [%- END -%]
[%- END -%]
[% form.textbox( name = "com_$pid", id = "com_$pid", class = "text", value = pic.comment, disabled = pic.inactive, maxlength = maxlength.comment ) %] [% form.hidden( name = "com_orig_$pid", value = pic.comment ) %]
[% form.textbox( name = "desc_$pid", id = "desc_$pid", class = "text", value = pic.description, disabled = pic.inactive, maxlength = maxlength.description ) %] [% form.hidden( name = "desc_orig_$pid", value = pic.description ) %]
[% form.radio( label = dw.ml( ".edit.label.default" ), name = "defaultpic", value = pid, class = 'radio', id = "def_$pid", selected = pic.is_default, disabled = pic.inactive ) %] [% form.checkbox( label = dw.ml( ".edit.label.delete" ), name = "delete_$pid", value = 1, class = 'checkbox', id = "del_$pid", disabled = uploads_disabled ) %] [%- IF pic.inactive -%] [%- '  [' _ dw.ml('userpic.inactive') _ '] ' -%] [%- help_icon( 'userpic_inactive' ) -%] [%# we need to indicate explicitly that this is disabled due to # being inactive, in case it becomes active again between page # render and page submit %] [% form.hidden( name = "pic_inactive_$pid", value = 1 ) %] [%- END -%]

[%- END -%]

[% form.radio( label = dw.ml( ".edit.label.nodefault" ), name = "defaultpic", value = 0, class = 'radio', id = "nodefpic", selected = u.userpic.defined ? 0 : 1 ) %]

[% form.submit( class="large", value = dw.ml( ".edit.btn.save" ), name = 'action:save' ) %]
[%- END -%]