[% sections.title = '.title' | ml %] [% dw.ml("Backlink", { 'link' => "$site.root/customize/advanced/",'text' => dw.ml('.back2'),}) %] [% dw.ml("Actionlink", {'link' => "" _ dw.ml('.nav.yourlayers') _ "", }) %] [% UNLESS noactions %]
[%- authas_html -%]
[% END %] [%# edit mode %] [% IF id %] [%# set up start of output %] [% sections.title = '.editstyle.title' | ml %]
[% dw.ml("Backlink", {'text' => dw.ml('.back2styles'), 'link' => "$site.root/customize/advanced/styles$getextra" }) %] [%# no style id, process actions for non-edit mode %] [%# and load in data necessary for style list %] [% ELSE %] [%# set up page header %]

[% dw.ml('.yourstyles.header') %]

[%# show style listing %] [% IF ustyle.keys %] [% journalbase = u.journal_base %] [% FOREACH styleid IN sortedustyles %] [% END %] [% ELSE %] [% END %]
[% dw.form_auth() %] [% styleid == u.s2_style ? "" _ dw.ml('.yourstyles.layername', {'name' => ehtml(ustyle.$styleid), 'aopts' => "href='$journalbase/?s2id=$styleid'", 'id' => styleid}) _ "" : dw.ml('.yourstyles.layername', {'name' => ehtml(ustyle.$styleid), 'aopts' => "href='$journalbase/?s2id=$styleid'", 'id' => styleid}) %]
[% form.submit(name = 'action:edit', value = dw.ml('.btn.edit')) %] [% confirm_msg = dw.ml('.delete.confirm', {'id' => styleid}) %] [% form.submit(name = 'action:delete', value = dw.ml('.btn.delete') , 'onclick' => "return confirm('$confirm_msg')", disabled => noactions ) %] [% form.submit(name = 'action:usestyle', value = dw.ml('.btn.use'), 'disabled' => (styleid == u.s2_style || noactions)) %]
[% dw.ml('.yourstyles.none') %]
[% END %] [%### show create / edit form %] [% extra = id ? "?id=$id" : '' %] [% extra = extra != '' ? extra _ getextra_amp : extra _ getextra %]
[% dw.form_auth() %] [%# create a new style, or change the name of the style currently being edited %] [%# note: this little bit of code appears whether there is an id passed or not. %] [%# the textbox just has a different purpose depending on the context. %]

[% id ? dw.ml('.styleoptions.header') : dw.ml('.createstyle.header') %]

[% dw.ml('.createstyle.label.name') %] [% form.textbox('name' => 'stylename', 'size' => '30', 'maxlength' => '255', 'value' => (post.stylename.defined ? post.stylename : style.name) ) %] [% form.submit(name = 'action:create', value = dw.ml('.btn.create'), disabled = noactions ) UNLESS id %]
[%# if no id to edit, we're finished %] [% UNLESS id %]
[% RETURN %] [% END %] [%# from here on we have $pub, $ulay, and $style filled in %] [%# sub to take a layer type, core, and parent layout %] [%# and return a list of options to feed to LJ::html_select() %] [% BLOCK layerselect %] [% results = layerselect_sub(type, b2lid) %] [% lid = results.lid %] [% opts = results.opts %] [% dis = opts.size > 2 ? 0 : 1 %] [% sel = ( lid && ! ( pub.$lid && pub.$lid.s2lid ) && ! ulay.$lid ) ? "_other" : lid %] [%# returns html_select to caller %] [% form.select( 'name' => type, 'id' => "select_$type", 'onChange' => "showOther('$type')", 'selected' => sel, 'disabled' => dis , items => opts) %] [% END %] [% BLOCK layerother %] [% actionchange = "action:change" %] [% other_name = "other_$name" %] [% olid = post.actionchange ? post.other_name : style.layer.$name %] [% disp = 'none' %] [% IF olid && ! pub.$olid && ! ulay.$olid %] [% disp = 'inline' %] [% val = olid %] [% END %]
[% dw.ml('.stylelayers.label.layerid') %] [% form.textbox( 'name' => "other_$name", 'id' => "other_$name", 'size' => 6, 'value' => val ) %]
[% END %] [%### core version %]

[% dw.ml('.stylelayers.header') %]

[% dw.ml('.stylelayers.label.coreversion') %] [% PROCESS layerselect type = 'core', b2lid = 0 %] [% form.hidden( name = 'core_hidden', value = core) %] [% form.submit(name = 'action:change', value = dw.ml('.btn.change'), disabled = dis) %]
[%### i18nc / layout %] [%# i18nc %] [%# layout %]
[% dw.ml('.stylelayers.label.corelanguage') %] [% PROCESS layerselect type = 'i18nc', b2lid = core %] [% PROCESS layerother name = 'i18nc' %]
[% dw.ml('.stylelayers.label.layout') %] [% PROCESS layerselect type = 'layout', b2lid = core %] [% PROCESS layerother name ='layout' %] [% form.submit(name = "action:change", value = dw.ml('.btn.change'), disabled = dis) %]
[%# do we need to show the rest of the form? %] [% UNLESS layout %] [% RETURN %] [% END %] [%### theme / i18n / user %] [%# theme %]
[% dw.ml('.stylelayers.label.language') %] [% PROCESS layerselect type = 'i18n', b2lid = layout %] [% PROCESS layerother name = 'i18n' %]
[% dw.ml('.stylelayers.label.theme') %] [% PROCESS layerselect type = 'theme', b2lid = layout %] [% PROCESS layerother name = 'theme' %]
[% dw.ml('.stylelayers.label.user2') %] [% PROCESS layerselect type = 'user', b2lid = layout %] [% PROCESS layerother name = 'user' %]
  [% form.submit(name = 'action:savechanges', value = dw.ml('.btn.savechanges'), disabled = noactions) %]
[%# end edit form %] [% sections.head = BLOCK %] [% END %]