$versions{'widget_zone_organizer-ext_lib.pl'} = '06.6.00.0000';

# Contains all sub routines (functions) to organize and sort widgets within template zones.

#######################################################################
#
# AgoraCart and all associated files, except where noted, are
# Copyright 2001 to Present jointly by K-Factor Technologies, Inc.
# and by C E Mayo (aka Mister Ed) at AgoraCart.com & K-Factor.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This copyright notice may not be removed or altered in any way.
#
#######################################################################

{
    local ($modname) = 'widget_zone_organizer';
    register_extension( $modname, 'Widget Zone Organizer',
        $versions{$modname} );
    register_menu( 'display_widget_organizer_screen', 'display_widget_organizer_screen',
        $modname, "Display Widget Organizer and Template Zone Manager Screen" );
    register_menu( 'updateWidgetZonesAndNames', 'save_widget_zone_and_name_updates',
        $modname, 'Write - Save Updates to Widget Zones and Names' );

    add_merchtools_settings_choice(
        'Widget Template Zone Organizer',
        'Widget Template Zone Organizer',
        'display_widget_organizer_screen'
    );


    #@Zone3_column_widgets = ();
    #@Zone4_column_widgets = ('search_box_column|Search Box|Search Column Box|','category_list_column|Categories|Category List Left Justified Column Box|display_category_list_for_templates','price_search_column|Search by Price|Price Search Range Column Box|');
    #@Zone7_column_widgets = ('cart_contents_column|Your Cart|Cart Contents Column Box|display_cart_contents_for_templates','featured_product_basic1_column|Deal of the Week|Standard Column Box|display_featured_product_for_templates','new_products_basic10_column|New Products|Standard List Column Box|display_new_product_for_templates','best_sellers_basic10_column|Best Sellers|Standard List Column Box|display_best_sellers_list_for_templates');

    @master_list_column_widgets = (
        'search_box_column|Search Box|Search Column Box|',
        'category_list_column|Categories|Category List Left Justified Column Box|display_category_list_for_templates',
        'price_search_column|Search by Price|Price Search Range Column Box|',
        'cart_contents_column|Your Cart|Cart Contents Column Box|display_cart_contents_for_templates',
        'featured_product_basic1_column|Deal of the Week|Standard Column Box|display_featured_product_for_templates',
        'new_products_basic10_column|New Products|Standard List Column Box|display_new_product_for_templates',
        'best_sellers_basic10_column|Best Sellers|Standard List Column Box|display_best_sellers_list_for_templates'
    );
    @master_list_horizontal_widgets = ('cart_contents_horizontal|Your Cart|Cart Contents Horizontal|display_cart_contents_horizontal_zones');

    $zone_horizontal_list = 'Zone1|Zone2|Zone5|Zone6|Zone9';

}

#######################################################################
sub save_widget_zone_and_name_updates {

    my ( $myfile, $zone_names_updated, $is_4_column ) = q{};
    my( @values, @temp_widgets_list );
    my ( $new_mgr_checked_string, $new_order_string, $widget_list_string, $zone_name ) = q{};
    my ( @zone_order, @activate_values );
    my ( $count, $array_count ) = 0;
    my %master_names;
    my %master_misc;
    my %widget_is_active;

    require_supporting_libraries( __FILE__, __LINE__, "$sc_hedfut_templates_dir/$sc_headerTemplateRoot/$sc_hedfut_template_manifest" );

    # Add all the widgets together for a comprehensive list
    @temp_widgets_list = @master_list_column_widgets;
    if ( @mgr_template_new_column_widgets ) {
        push(@temp_widgets_list, @mgr_template_new_column_widgets);
    }
    if ( @master_list_horizontal_widgets ) {
        push(@temp_widgets_list, @master_list_horizontal_widgets);
    }
    if ( @mgr_template_new_horizontal_widgets ) {
        push(@temp_widgets_list, @mgr_template_new_horizontal_widgets);
    }

    foreach $widget (@temp_widgets_list) {
        ($key, $widget_title, $widget_template_name, $widget_routine_to_run) = split( /\|/, $widget, 4 );
        $master_names{"$key"} = $widget_title;
        $master_misc{"$key"} = "$widget_template_name|$widget_routine_to_run";
    }

    @zones = split( '\|', $mgr_template_zones_used );
    foreach $zone (@zones) {
        ( $count, $array_count ) = 0;
        $widget_list_string = q{};
        $zone_hash_items = {};
        $active_items_name =  $zone . '_active_items';
        $zone_items_name =  $zone . '_zone_items';
        $new_order_string = 'newOrder' . $zone;
        $new_mgr_checked_string = 'mgr_' . $zone . '_checked';
        $is_4_column = 'yes';
        $zone_name = $zone . '_column_widgets';
        @zone_order = split(/\,/, $in{"$new_order_string"});
        $array_count = @zone_order;
        @activate_values = param("$new_mgr_checked_string");

        if ( $zone_horizontal_list =~ /$zone/ ) {
            $is_4_column = '';
            $zone_name = $zone . '_horizontal_widgets';
        }

        foreach $item (@activate_values) {
            $item =~ /([\w\-\_\+]+)/i; # untaint
            $item = "$1";
            $widget_is_active{"$item"} = 'yes';

            if ( $in{"$item"}  && ( $master_names{"$item"} ne $in{"$item"} ) ) {
                $master_names{"$item"} = $in{"$item"};
            }
        }

        if ( $array_count < 1 ) { @zone_order = @activate_values; }
        foreach $key (@zone_order) {
            if ( $widget_is_active{"$key"} ) {
                $key =~ /([\w\-\_\+]+)/i; # untaint
                $key= "$1";
                $my_string = qq~$key|$master_names{"$key"}|$master_misc{"$key"}~;
                if ( $count > 0 ) { $widget_list_string .= ','; }
                $widget_list_string .= qq|\'$my_string\'|;
                push(@$zone_name, "$my_string"); # for when we display the manager page
                $count++;
            }

        }

        $myset .= "\@$zone_name = \($widget_list_string\);\n";

    } # end foreach @zones


    # Now process ZoneHome widgets
    eval("require_supporting_libraries( __FILE__, __LINE__, \"$sc_template_homezone_file\" );");

if ( $mgr_template_zonehome_enabled eq 'yes' ) {

    foreach $widget (@mgr_template_zonehome_widgets) {
        ($key, $widget_title) = split( /\|/, $widget, 2 );
        $master_names{"$key"} = $widget_title;
    }

    ( $count, $array_count ) = 0;
    @zone_order_home = split(/\,/, $in{'newOrderZoneHome'});
    $array_count = @zone_order_home;
    @activate_home = param('mgr_ZoneHome_checked');
    ( $widget_list_string, $temp_zonehome2_tokens, $temp_zonehome1_tokens ) = q{};

    foreach $item (@activate_home) {
        $item =~ /([\w\-\_\+]+)/i; # untaint
        $item = "$1";
        $widget_is_active{"$item"} = 'yes';
    }

    if ( $array_count < 1 ) { @zone_order_home = @activate_home; }
    foreach $key (@zone_order_home) {
        if ( $widget_is_active{"$key"} ) {
            $key =~ /([\w\-\_\+]+)/i; # untaint
            $key= "$1";
            $my_string = qq~$key|$master_names{"$key"}~;
            if ( $count > 0 ) { $widget_list_string .= ','; }
            $widget_list_string .= qq|\'$my_string\'|;
            push(@ZoneHome_Widgets, "$my_string"); # for when we display the manager page
            if ( $key eq 'jumbotron' ) {
                $temp_zonehome1_tokens .= $sc_template_zonehome_tokens{'jumbotron'};
            }
            else {
                $temp_zonehome2_tokens .= $sc_template_zonehome_tokens{"$key"} . "\n";
            }
            $count++;
        }

    }

    $myset .= "\@ZoneHome_Widgets = \($widget_list_string\);\n";
    $myset .= "\$sc_template_zonehome1_tokens = q|$temp_zonehome1_tokens|;\n";
    $myset .= "\$sc_template_zonehome2_tokens = q|$temp_zonehome2_tokens|;\n";
}

    update_store_settings( 'widgetzones', $myset );  # save widget zone manager settings
    $mgr_success_message = <<ENDOFTEXT;
Widget Zones$zone_names_updated have been successfully Updated
ENDOFTEXT
    display_widget_organizer_screen();
}

#######################################################################

# widgets are organized for diplay using template zones. Not all are utilized
# in a temlate design.  Some zones are for future use.
sub display_widget_organizer_screen {

    my (@zones);
    my %template_zones_enabled;
    my %widget_title;
    %widget_zone_sortables;
    %widget_zone_widgets;
    my $widget_renames = q{};
    my %widgets_seen;

    my $page_output = &$manager_page_header( 'Widget Organizer &amp; Template Zone Manager', '', '', '', '' );

    require_supporting_libraries( __FILE__, __LINE__, "$sc_hedfut_templates_dir/$sc_headerTemplateRoot/$sc_hedfut_template_manifest" );

    if ( @mgr_template_new_column_widgets ) {
        push(@master_list_column_widgets, @mgr_template_new_column_widgets);
    }
    if ( @mgr_template_new_horizontal_widgets ) {
        push(@master_list_horizontal_widgets, @mgr_template_new_horizontal_widgets);
    }

    # First, build lists of currently used widgets.
    @zones = split( '\|', $mgr_template_zones_used );
    foreach $zone (@zones) {
        my $column_widget = 'yes';
        my %widget_is_active;
        my $widget_zone = $zone . '_column_widgets';
        if ( $zone_horizontal_list =~ /$zone/ ) {
            $widget_zone = $zone . '_horizontal_widgets';
            $column_widget = '';
        }
        $template_zones_enabled{"$zone"} = 'yes';
        foreach my $item (@$widget_zone) {
            ($key, $widget_title, $widget_template_name, $widget_routine_to_run) = split( /\|/, $item, 4 );
            if ( $widget_is_active{"$key"} ) {
                $widget_is_active{"$key"} .= '|' . $zone;
            }
            else {
                $widget_is_active{"$key"} = $zone;
            }
            $widget_title{"$key"} = "$widget_title";
            $widget_zone_sortables{"$zone"} .= qq|<li id="$key" class="btn btn-success btn-lg">$widget_title</li>|;
            $temp_checkbox_string = 'mgr_' . $zone . '_checked';
            $widget_zone_widgets{"$zone"} .= <<ENDOFTEXT;
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6" style="margin-bottom: 10px;">
    <div class="input-group">
        <span class="input-group-addon">
            <input type="checkbox" name="$temp_checkbox_string" value="$key" checked>
        </span>
        <label class="form-control">$widget_title</label>
    </div>
</div>
ENDOFTEXT
            if ( $widgets_seen{"$key"} != 1 ) {
                $widget_renames .= <<ENDOFTEXT;
<p><br></p>
<p><b>Widget ID:</b> $key:<input name="$key" type="text" class="form-control" value="$widget_title" required></p>
ENDOFTEXT
            }
            $widgets_seen{"$key"} = 1;
        } # end foreach @$widget_zone

        if ( $column_widget ) {
            foreach my $item (@master_list_column_widgets) {
                ($key, $widget_title, $widget_template_name, $widget_routine_to_run) = split( /\|/, $item, 4 );
                if ( !( $widget_is_active{"$key"} ) ) {
                    $widget_title{"$key"} = "$widget_title";
                    my $temp_checkbox_string = 'mgr_' . $zone . '_checked';
                    $widget_zone_widgets{"$zone"} .= <<ENDOFTEXT;
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6" style="margin-bottom: 10px;">
    <div class="input-group">
        <span class="input-group-addon">
            <input type="checkbox" name="$temp_checkbox_string" value="$key">
        </span>
        <label class="form-control">$widget_title</label>
    </div>
</div>
ENDOFTEXT
                }
            } # end foreach @master_list_column_widgets

        } # end if $column_widget
        else {
            foreach my $item (@master_list_horizontal_widgets) {
                ($key, $widget_title, $widget_template_name, $widget_routine_to_run) = split( /\|/, $item, 4 );
                if ( !( $widget_is_active{"$key"} ) ) {
                    $widget_title{"$key"} = "$widget_title";
                    my $temp_checkbox_string = 'mgr_' . $zone . '_checked';
                    $widget_zone_widgets{"$zone"} .= <<ENDOFTEXT;
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6" style="margin-bottom: 10px;">
    <div class="input-group">
        <span class="input-group-addon">
            <input type="checkbox" name="$temp_checkbox_string" value="$key">
        </span>
        <label class="form-control">$widget_title</label>
    </div>
</div>
ENDOFTEXT
                }
            } # end foreach @master_list_horizontal_widgets

        } # end of else after if $column_widget
    } # end foreach @zones

    # Now process ZoneHome widgets
    eval("require_supporting_libraries( __FILE__, __LINE__, \"$sc_template_homezone_file\" );");

if ( $mgr_template_zonehome_enabled eq 'yes' ) {

    # process currently active ZoneHome widgets
    foreach my $item (@ZoneHome_Widgets) {
        ($key, $widget_title) = split( /\|/, $item, 2 );
        $widget_is_active{"$key"} = 'ZoneHome';
        $widget_zone_sortables{'ZoneHome'} .= qq|<li id="$key" class="btn btn-success btn-lg">$widget_title</li>|;
        $temp_checkbox_string = 'mgr_ZoneHome_checked';
        $widget_zone_widgets{'ZoneHome'} .= <<ENDOFTEXT;
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6" style="margin-bottom: 10px;">
<div class="input-group">
    <span class="input-group-addon">
        <input type="checkbox" name="$temp_checkbox_string" value="$key" checked>
    </span>
    <label class="form-control">$widget_title</label>
</div>
</div>
ENDOFTEXT
    } # end foreach @ZoneHome_Widgets

     # next process the ZoneHome master list. Skip if already done by currently active
    foreach my $item (@mgr_template_zonehome_widgets) {
        ($key, $widget_title) = split( /\|/, $item, 4 );
        if ( !( $widget_is_active{"$key"} ) ) {
            my $temp_checkbox_string = 'mgr_ZoneHome_checked';
            $widget_zone_widgets{'ZoneHome'} .= <<ENDOFTEXT;
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6" style="margin-bottom: 10px;">
<div class="input-group">
<span class="input-group-addon">
    <input type="checkbox" name="$temp_checkbox_string" value="$key">
</span>
<label class="form-control">$widget_title</label>
</div>
</div>
ENDOFTEXT
        }
    } # end foreach @mgr_template_zonehome_widgets

}

    $page_output .= <<ENDOFTEXT;
<h1 class='mgr-page-title'>Widget Zone Manager</h1>
<p><br></p>

<p class="well">This manager allows you to manager your non-product store/site pages that you create. With this manager you can enable/disable (page status), copy, delete, edit, and change the order that your links appear. You may change the settings within as many tabs/groups as needed, then press the <b><i>submit</i></b> button at the very bottom of the page after you are finished making any desired changes. Click on the <i class="fa fa-info-circle"></i> icon next to any setting for more information on the setting.</p>
<p><br></p>

ENDOFTEXT

    if ( $in{'system_edit_success'} ) {
        $page_output .= qq|
<div class="row col-xs-12 col-sm-12 col-md-12 col-lg-12 hidden-xs">
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 bg-success">
    <h4 class="text-primary mgr-center">$mgr_success_message</h4>
    </div>
</div>
<p><br><br><br><br><br></p>
|;
    }

    $page_output .= <<ENDOFTEXT;

<ul class="nav nav-tabs" id="tabs2" role="tablist">
    <li role="presentation" class="active"><a href="#tabs-1" aria-controls="tabs-1" role="tab" data-toggle="tab">Template Widget Zone Map</a></li>
ENDOFTEXT
    if ( $template_zones_enabled{'Zone1'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-2" aria-controls="tabs-2" role="tab" data-toggle="tab">Zone 1</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone2'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-3" aria-controls="tabs-3" role="tab" data-toggle="tab">Zone 2</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone3'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-4" aria-controls="tabs-4" role="tab" data-toggle="tab">Zone 3</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone4'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-5" aria-controls="tabs-5" role="tab" data-toggle="tab">Zone 4</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone5'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-6" aria-controls="tabs-6" role="tab" data-toggle="tab">Zone 5</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone6'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-7" aria-controls="tabs-7" role="tab" data-toggle="tab">Zone 6</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone7'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-8" aria-controls="tabs-8" role="tab" data-toggle="tab">Zone 7</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone8'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-9" aria-controls="tabs-9" role="tab" data-toggle="tab">Zone 8</a></li>
ENDOFTEXT
    }
    if ( $template_zones_enabled{'Zone9'} eq 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-10" aria-controls="tabs-10" role="tab" data-toggle="tab">Zone 9</a></li>
ENDOFTEXT
    }
    if ( $mgr_template_zonehome_enabled = 'yes' ) {
        $page_output .= <<ENDOFTEXT;
        <li role="presentation"><a href="#tabs-13" aria-controls="tabs-13" role="tab" data-toggle="tab">Home Page</a></li>
ENDOFTEXT
    }

    $page_output .= <<ENDOFTEXT;
    <li role="presentation"><a href="#tabs-15" aria-controls="tabs-15" role="tab" data-toggle="tab">Rename Zone Widgets</a></li>
</ul>

<form class="form-horizontal" action="manager.cgi" method="post">
<input type="hidden" name="mgr_seshun" value="$in{'mgr_seshun'}">

<div class="tab-content">
<div class="tab-pane active" id="tabs-1">

<p><br></p>
<h2 class="mgr-page-title"><b>Zone Map</b></h2>
<p><br><br></p>

    <p>Below is the zone visual map to help you locate where each zone is. Widgets have to be created within a template's widget file for each zone type: vertical or horizontal.
    <br><br>Not all columns or zones will be available in templates, for example: if a template only has two columns, the third column zone(s) would not be available.
    <br><br>Currently the following zones are not officially supported in this manager yet: Zone 1 & 2 (headers), Zones 5 & 6 (main content top & bottom), Zone 9 (Footer). However you can still add agorascript to your template(s) in order to include custom widgets in non-supported zone areas.</p>
    <p><br><br></p>


    <div class="container-fluid col-xs-12 col-sm-12 col-md-12 col-lg-12" style="border: 1px solid #000; padding-right: 0; padding-left: 0;">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 6em; display: flex; justify-content: center; align-items: center;">
            <p>Header/Logo Area</p>
        </div>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 2.5em; display: flex; justify-content: center; align-items: center; margin-top: 1px;">
            <p>Sub-Head Area</p>
        </div>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="mainbody" style="padding-right: 0; padding-left: 0;">
            <div id="left column" class="col-xs-3 col-sm-3 col-md-3 col-lg-3" style="padding-right: 0; padding-left: 0;">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 13em; display: flex; justify-content: center; align-items: center; margin-top: 1px; padding-right: 0; padding-left: 0;">
                    <p><b>Zone 3 Left Column - Top</b></p>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 13em; display: flex; justify-content: center; align-items: center; margin-top: 1px; padding-right: 0; padding-left: 0;">
                    <p><b>Zone 4 Left Column - Mid to Bottom</b></p>
                </div>
            </div>

            <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6" style="margin-top: 1px;">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 2.5em; display: flex; justify-content: center; align-items: center;">
                    <p><b>Zone 5 Main Content Area - Top</b></p>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="height: 20em; display: flex; justify-content: center; align-items: center; margin-top: 1px;">
                    <p>Main Content Area / Home Page (ZoneHome) </p>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 2.5em; display: flex; justify-content: center; align-items: center; margin-top: 1px;">
                    <p>Main Content Area - Bottom</p>
                </div>
            </div>

            <div id="right column" class="col-xs-3 col-sm-3 col-md-3 col-lg-3" style="padding-right: 0; padding-left: 0;">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 24em; display: flex;  justify-content: center; align-items: center; margin-top: 2px; padding-right: 0; padding-left: 0;">
                    <p><b>Zone 7 Right Column - Top</b></p>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 2em; display: flex;  justify-content: center; align-items: center; margin-top: 2px; padding-right: 0; padding-left: 0;">
                    <p><br></p>
                </div>
            </div>

        </div>

        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="background-color: #c0c0c0; height: 4em; display: flex; justify-content: center; align-items: center; margin-top: 2px; padding-right: 0; padding-left: 0;">
            <p>Main Footer Area</p>
        </div>


    </div>

    <!-- needed to fix CSS weirdness with border collapsing too soon -->
    <p><br><br></p>
    <h2 class="mgr-page-title"><b>&nbsp;</b></h2> <!-- needed to fix CSS weirdness with border collapsing too soon -->
    <p><br><br></p>


    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 1 -->


<div class="tab-pane" id="tabs-2">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 1 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 1:</b></p>


<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 2 -->


<div class="tab-pane" id="tabs-3">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 2 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 2:</b></p>


<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 3 -->

<div class="tab-pane" id="tabs-4">

    <p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
    <div><span class="divider"></span></div>
    <h2 class="mgr-page-title"><b>Zone 3 Widgets</b></h2>
    <div><span class="divider2"></span></div>
    <div><span class="divider"></span></div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 3:</b></p>

<input id="newOrderZone3" name="newOrderZone3" type="hidden" value="">
<ul id="sortable-Zone3" class="col-xs-12 col-sm-12">
    $widget_zone_sortables{"Zone3"}
</ul>

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Enable / Disable Widgets in Zone 3</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></div></p>

<p class="col-xs-12 col-sm-12"><b>Check or uncheck the boxes below to enable/disable a widget from showing in Zone 3:</b></p>

<ul class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_widgets{"Zone3"}
</ul>

<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 4 -->


<!-- Start of tab 5 -->

<div class="tab-pane" id="tabs-5">

    <p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
    <div><span class="divider"></span></div>
    <h2 class="mgr-page-title"><b>Zone 4 Widgets</b></h2>
    <div><span class="divider2"></span></div>
    <div><span class="divider"></span></div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 4:</b></p>

<input id="newOrderZone4" name="newOrderZone4" type="hidden" value="">
<ul id="sortable-Zone4" class="col-xs-12 col-sm-12">
    $widget_zone_sortables{"Zone4"}
</ul>

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Enable / Disable Widgets in Zone 4</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></div></p>

<p class="col-xs-12 col-sm-12"><b>Check or uncheck the boxes below to enable/disable a widget from showing in Zone 4:</b></p>

<ul class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_widgets{"Zone4"}
</ul>

<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>

<!-- End of tab 5 -->


<div class="tab-pane" id="tabs-6">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 5 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 5:</b></p>

<input id="newOrderZone5" name="newOrderZone5" type="hidden" value="">
<ul id="sortable-Zone5" class="col-xs-12 col-sm-12">
    $widget_zone_sortables{"Zone5"}
</ul>

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Enable / Disable Widgets in Zone 5</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></div></p>

<p class="col-xs-12 col-sm-12"><b>Check or uncheck the boxes below to enable/disable a widget from showing in Zone 5:</b></p>

<ul class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_widgets{"Zone5"}
</ul>



<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>


    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 6 -->


<div class="tab-pane" id="tabs-7">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 6 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 6:</b></p>



<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 7 -->


<div class="tab-pane" id="tabs-8">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 7 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 7:</b></p>

<input id="newOrderZone7" name="newOrderZone7" type="hidden" value="">
<ul id="sortable-Zone7" class="col-xs-12 col-sm-12">
    $widget_zone_sortables{"Zone7"}
</ul>

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Enable / Disable Widgets in Zone 7</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></div></p>

<p class="col-xs-12 col-sm-12"><b>Check or uncheck the boxes below to enable/disable a widget from showing in Zone 7:</b></p>

<ul class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_widgets{"Zone7"}
</ul>

<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 8 -->


<!-- Start of tab 9 -->

<div class="tab-pane" id="tabs-9">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 8 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 8:</b></p>

<input id="newOrderZone8" name="newOrderZone8" type="hidden" value="">
<ul id="sortable-Zone8" class="col-xs-12 col-sm-12">
    $widget_zone_sortables{"Zone8"}
</ul>

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Enable / Disable Widgets in Zone 8</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></div></p>

<p class="col-xs-12 col-sm-12"><b>Check or uncheck the boxes below to enable/disable a widget from showing in Zone 8:</b></p>

<ul class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_widgets{"Zone8"}
</ul>

<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>

<!-- End of tab 9 -->


<div class="tab-pane" id="tabs-10">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Zone 9 Widgets</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear in Zone 9:</b></p>



<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>


    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 10 -->


<div class="tab-pane" id="tabs-13">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Home Page Widgets (ZoneHome)</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Drag and Drop the widgets below to rearrange the order in which they appear on the Home Page main content area:</b></p>

<input id="newOrderZoneHome" name="newOrderZoneHome" type="hidden" value="">
<ul id="sortable-ZoneHome" class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_sortables{'ZoneHome'}
</ul>



<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br><br></p>
<div><span class="divider"></span></div>
<h2 class="mgr-page-title"><b>Enable / Disable Widgets in ZoneHome</b></h2>
<div><span class="divider2"></span></div>
<div><span class="divider"></span></div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></div></p>

<p class="col-xs-12 col-sm-12"><b>Check or uncheck the boxes below to enable/disable a widget from showing in ZoneHome:</b></p>

<ul class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    $widget_zone_widgets{'ZoneHome'}
</ul>

<!-- needed to fix CSS weirdness with border collapsing too soon -->
<p><h2>&nbsp;</h2></p>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>

<!-- End of tab 13 -->


<div class="tab-pane" id="tabs-15">

<p class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><br></p>
<h2 class="mgr-page-title"><b>Rename Widget Titles</b></h2>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

<p class="col-xs-12 col-sm-12"><b>Rename Widget Titles Below</b>. Only active Widgets can be renamed. Once a widget is no longer actively used, the rename will be deleted and revert back the the default title for the widget. If you do not see a desired widget, make sure to activate it one of the zone tabs.<br><br>Note: ZoneHome (Home Page) widgets cannot be renamed here as their titles must be edited/changed directly within ZoneHome widget file (see the "HomePage Widget File" tab in the Template Manager)</p>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

$widget_renames

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>

</div>


<!-- End of tab 15 -->


</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><p><br><br></p></div>
</div>
<input type="hidden" name="system_edit_success" value="yes">
<input name="updateWidgetZonesAndNames" type="hidden" value="Submit">
<button class="btn btn-primary btn-lg mgr-center" style="display: block;">Submit Widget Zone &amp; Name Changes</button>
<p><br><br><br></p>
</form>
ENDOFTEXT


    $page_output .= &$manager_page_footer;
    print $page_output;
}


#######################################################################

1;
