<% use obfui::cmn; my ($have_extr,$what,$keytoset,$bases,$limited,$cfgref) = @_; 
    my $samples_only = $cfgref->{product}->{samples_gen} + 0;

    my $is_2inputs = index($keytoset,'encoding') != -1 && $have_extr;
    my $sd = $cfgref->{product}{mode_samples};
    sub dumpcode { $forge->include('block-samples-code',@_,$cfgref); }
 %>
<script language=javascript>
<!--
function ge_by_id(nm)
{
    return document.getElementById(nm);
}
-->
</script>


<% 
    if (!$samples_only) {
	$forge->include('block-switchbase-hint',$have_extr,$what,$limited,1) 
    };
%>

<% if (!$samples_only) { %>
<p>
<a class=noul 
    href=settings.switchbase.$what.1>Go to compact preset switching page</a> that was present in
previous versions of the product.
<p>
<% } %>

<form method=post>
<input type=hidden name=havevals value=1>
<input type=hidden name=keytoset value=<%= $keytoset %>>
<input type=hidden id=newbase name=newbase>



Original code (before protection):<br>

<div class=code-before-protection>
    <% dumpcode($sd,$bases->[0]->[0],$is_2inputs,1) %>
</div>
<p>&nbsp;<p>


<script>
<!--
var _cur_mode_id;
-->
</script>

<div class=code-after-protection>
<% 
  my $idx=0;
  foreach (@$bases) { 
    my ($id,$title,$descr,$iscur,$isprecreated) = @$_; 
    $title =~ s/^SPECIAL BASE[^:]*://g;
    my $is_experimental = $id =~ /minlocals|renamelocals|_minify/;
%>
<% if ($iscur) { %>
    <script>
    <!--
	_cur_mode_id = "<%= $id %>";
    -->
    </script>
<% } %>


    <div class=mode-item>
        <div class=mode-title>
	<% if (!$samples_only) { %>
	    <span class=mode-title>Mode<%= $title %><% if ($is_experimental) { %>
		<b>[EXPERIMENTAL]</b>
	    <% } %>:
	    <small>(<a class=noul href=modes.edit.$id>edit mode</a>)</small>
		</span>
	<% } else { %>
	    <span class=mode-title>Mode <%= $title %>:</span>
	<% } %>
	</div>


	    <% dumpcode($sd,$bases->[$idx++]->[0],$is_2inputs,0) %>  

	<div style='padding-top: 0.5em;'>

	&nbsp;&nbsp;&nbsp;&nbsp;<span class=details-btn>Details
	    <script><!--
		    showHide_setup_parent_div();
		    -->
	    </script>
	    </span><p>

        <div class=x-mode-outer id=alt_m_<%= $id %> style='width: 80%; padding-left: 2em;'>
	<div class=mode>
	<p>
	<% if ($samples_only ? 0 : !$isprecreated) { %><pre><%= $descr %></pre><% 
	} else { 
	    $descr =~ s,(<div class=whentouse>),$1<span class=whentouse>WHEN TO USE:</span>,g;
            $descr =~ s,(<span class=whentouse>WHEN TO USE:</span>)+,<span class=whentouse>WHEN TO USE:</span>,gs;    
	    %><div class=mode-descr><%$ $descr %></div><% } %>
	</div>
	</div>

	</div>
    </div><!--mode item-->

<% }; %>
</div>


<% if (!$samples_only) { %>
<script>
<!--
modesample_clicked(_cur_mode_id);
-->
</script>

<%   if (!@$bases) {
%>
<p>
<b><%= __('You project was created in previous version of the product, that had 
no predefined modes of the specified type to choose from. Please recreate your 
project in this version of the Product to be able to use this menu item.') 
%></b>
<% } %>
</dl>


<p>
<% $forge->include('wgt-submitbtn'); %>
<% $forge->include('wgt-backbtn'); %>
<% } %>

</form>


