<{if $isMine}>
  <script type="text/javascript" src="<{$xoops_url}>/modules/tadtools/jqueryCookie/jquery.cookie.js"></script>
  <script type="text/javascript" src="<{$xoops_url}>/modules/tad_web/class/tmt_core.js"></script>
  <script type="text/javascript" src="<{$xoops_url}>/modules/tad_web/class/tmt_spry_linkedselect.js"></script>
  <script type="text/javascript">
    $(document).ready(function() {
      $("#tad_web_config_tabs").tabs({
        active   : $.cookie('activetab'),
        activate : function( event, ui ){
            $.cookie( 'activetab', ui.newTab.index(),{
                expires : 30
            });
        }
      });

      $('#sort').sortable({ opacity: 0.6, cursor: 'move', update: function() {
        var order = $(this).sortable('serialize');
        $.post('save_sort.php?WebID=<{$WebID}>', order, function(theResponse){
            $('#save_msg').html(theResponse);
        });
      }
      });
    });

    function getOptions(destination,val_col)
      {

      var values = [];
      var sel = document.getElementById(destination);
      for (var i=0, n=sel.options.length;i<n;i++) {
        if (sel.options[i].value) values.push(sel.options[i].value);
      }
      document.getElementById(val_col).value=values.join(',');
    }
  </script>

  <div id="tad_web_config_tabs">
    <ul>
      <li><a href='#tad_web_config_tab-1'><{$smarty.const._MD_TCW_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-2'><{$smarty.const._MD_TCW_PLUGIN_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-3'><{$smarty.const._MD_TCW_HEAD_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-4'><{$smarty.const._MD_TCW_LOGO_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-5'><{$smarty.const._MD_TCW_BG_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-6'><{$smarty.const._MD_TCW_COLOR_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-7'><{$smarty.const._MD_TCW_BLOCK_TOOLS}></a></li>
      <li><a href='#tad_web_config_tab-8'><{$smarty.const._MD_TCW_ADMIN_SETUP}></a></li>
    </ul>

    <div id='tad_web_config_tab-1'>
      <div class="row">
        <div class="col-md-7">
          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <h3><{$smarty.const._MD_TCW_CLASS_SETUP}></h3>
            <div class="form-group">
              <div class="col-md-10">
                <input type="text" name="WebName" value="<{$WebName}>" id="WebName" class="validate[required] form-control" placeholder="<{$smarty.const._MD_TCW_CLASS_WEB_NAME}>">
              </div>
              <div class="col-md-2">
                <input type="hidden" name="WebID" value="<{$WebID}>">
                <input type="hidden" name="op" value="update_tad_web">
                <button type="submit" class="btn btn-primary pull-right"><{$smarty.const._TAD_SAVE}></button>
              </div>
            </div>
          </form>

          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <h3><{$smarty.const._MD_TCW_UPLOAD_MY_PHOTO}></h3>
            <div class="form-group">
              <div class="col-md-10">
                <{$upform_teacher}>
              </div>
              <div class="col-md-2">
                <input type="hidden" name="WebID" value="<{$WebID}>">
                <input type="hidden" name="op" value="update_photo">
                <button type="submit" class="btn btn-primary pull-right"><{$smarty.const._TAD_SAVE}></button>
              </div>
            </div>
          </form>

          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <h3><{$smarty.const._MD_TCW_OTHER_CLASS_SETUP}></h3>
            <div class="form-group">
              <div class="col-md-10">
                <input type="text" name="other_web_url" value="<{$other_web_url}>" id="other_web_url" class="form-control" placeholder="http://">
              </div>
              <div class="col-md-2">
                <input type="hidden" name="WebID" value="<{$WebID}>">
                <input type="hidden" name="op" value="save_other_web_url">
                <button type="submit" class="btn btn-primary pull-right"><{$smarty.const._TAD_SAVE}></button>
              </div>
            </div>
          </form>
        </div>
        <div class="col-md-5">
          <{if $teacher_thumb_pic}>
            <img src="<{$teacher_thumb_pic}>" alt="photo" class="img-rounded img-polaroid img-responsive img-thumbnail">
          <{/if}>
        </div>
      </div>
    </div>

    <div id='tad_web_config_tab-2'>
      <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
        <h3>
          <{$smarty.const._MD_TCW_FCNCTION_SETUP}>
        </h3>

        <div id="save_msg"><{$smarty.const._TAD_SORTABLE}></div>
        <table class="table">
          <tr>
            <th><{$smarty.const._MD_TCW_CATE_PLUGIN_ENABLE}></th>
            <th><{$smarty.const._MD_TCW_CATE_PLUGIN_TITLE}></th>
            <th><{$smarty.const._MD_TCW_CATE_PLUGIN_NEW_NAME}></th>
            <th colspan="2"><{$smarty.const._MD_TCW_CATE_PLUGIN_IN_FRONTPAGE}></th>

          </tr>
          <tbody id="sort">
            <{foreach from=$plugins item=plugin}>
              <tr id="tr_<{$plugin.dirname}>">
                <td>
                  <label class="checkbox-inline"><input type="checkbox" name="plugin_enable[<{$plugin.dirname}>]" value="1" <{if $plugin.db.PluginEnable=='1'}>checked="checked"<{elseif $plugin.db.PluginEnable=='0' or $plugin.dirname|in_array:$hide_function}><{else}>checked="checked"<{/if}>><{$plugin.dirname}></label>
                </td>
                <td><{$plugin.config.name}></td>
                <td><input type="text" name="plugin_name[<{$plugin.dirname}>]" value="<{if $plugin.db.PluginTitle}><{$plugin.db.PluginTitle}><{else}><{$plugin.config.name}><{/if}>" class="form-control" style="width: 120px;"></td>
                <td>
                  <{if $plugin.config.common==1}>
                    <label class="checkbox"><input type="checkbox" name="plugin_display[<{$plugin.dirname}>]" value="1" <{if $plugin.db.display=='1'}>checked="checked"<{/if}>></label>
                  <{else}>
                    <input type="hidden" name="plugin_display[<{$plugin.dirname}>]" value="0">
                  <{/if}>
                </td>
                <td>
                  <{if $plugin.config.limit!=''}>
                    <input type="text" name="plugin_limit[<{$plugin.dirname}>]" value="<{if $plugin.db.limit}><{$plugin.db.limit}><{else}><{$plugin.config.limit}><{/if}>" class="form-control" style="width: 50px;">
                  <{/if}>
                </td>
              </tr>
            <{/foreach}>
          </tbody>
        </table>
        <div class="form-group">
          <div class="col-md-12 text-center">
            <input type="hidden" name="WebID" value="<{$WebID}>">
            <input type="hidden" name="op" value="save_plugins">
            <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
          </div>
        </div>
      </form>
    </div>

    <div id='tad_web_config_tab-3'>

      <div class="row">
        <div class="col-md-12">
          <script language="JavaScript">
            $().ready(function(){
              $(".thumb").click(function(){
                var bg=$(this).attr("id");
                $("#head_bg").attr("src","<{$xoops_url}>/uploads/tad_web/<{$WebID}>/head/"+bg);
                $.post("config_ajax.php", {op: "save_head" , filename: bg, WebID: <{$WebID}>});
              });
            });
          </script>

          <h3>
            <{$smarty.const._MD_TCW_HEAD_TOOLS}>
            <small>
              <{$smarty.const._MD_TCW_CLICK_TO_CHANG}>
            </small>
          </h3>

          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <div class="form-group">
              <div class="col-md-12">
                <{$upform_head}>
              </div>
            </div>

            <div class="form-group">
              <div class="col-md-12">
                <{if $all_head}>
                  <{foreach from=$all_head item=head}>
                    <div style="width:100px; height:96px; display:inline-block; margin:4px;">
                      <a href="#top" title="<{$head.file_name}>" class="thumb_link">
                        <label style="width: 100px; height: 70px; background: #000000 url('<{$head.tb_path}>') center center no-repeat; border: 1px solid gray; background-size: contain;" id="<{$head.file_name}>" class="thumb">
                        </label>
                      </a>

                      <label class="del_img_box" style="font-size:12px;" id="del_img<{$head.files_sn}>">
                        <input type="checkbox" value="<{$head.files_sn}>" name="del_file[<{$head.files_sn}>]"> <{$smarty.const._TAD_DEL}>
                      </label>
                    </div>
                  <{/foreach}>
                <{/if}>
              </div>
            </div>

            <div class="text-center">
              <input type="hidden" name="WebID" value="<{$WebID}>">
              <input type="hidden" name="op" value="upload_head">
              <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
            </div>
          </form>
        </div>
      </div>
    </div>

    <div id='tad_web_config_tab-4'>

      <div class="row">
        <div class="col-md-12">
          <script language="JavaScript">
            $().ready(function(){
              $(".logo_thumb").click(function(){
                var logo=$(this).attr("id");
                $("#tad_web_logo").attr("src","<{$xoops_url}>/uploads/tad_web/<{$WebID}>/logo/"+logo);
                $.post("config_ajax.php", {op: "save_logo_pic" , filename: logo, WebID: <{$WebID}>});
              });
            });
          </script>

          <h3>
            <{$smarty.const._MD_TCW_LOGO_TOOLS}>
            <small>
              <{$smarty.const._MD_TCW_CLICK_TO_CHANG}>
            </small>
          </h3>
          <div class="alert alert-info">
            <{$logo_desc}>
          </div>

          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <div class="form-group">
              <div class="col-md-12">
                <{$upform_logo}>
              </div>
            </div>

            <div class="form-group">
              <div class="col-md-12">
                <{if $all_logo}>
                  <{foreach from=$all_logo item=logo}>
                    <div style="width:150px; height:76px; display:inline-block; margin:4px;">
                      <a href="#top">
                        <label style="width: 150px; height: 50px; background: #000000 url('<{$logo.tb_path}>') center center no-repeat; border: 1px solid gray; background-size: contain;" id="<{$logo.file_name}>" class="logo_thumb">
                        </label>
                      </a>

                      <label class="del_img_box" style="font-size:12px;" id="del_img<{$logo.files_sn}>">
                        <input type="checkbox" value="<{$logo.files_sn}>" name="del_file[<{$logo.files_sn}>]"> <{$smarty.const._TAD_DEL}>
                      </label>
                    </div>
                  <{/foreach}>
                <{/if}>
              </div>
            </div>

            <div class="text-center">
              <input type="hidden" name="WebID" value="<{$WebID}>">
              <input type="hidden" name="op" value="upload_logo">
              <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
            </div>
          </form>
        </div>
      </div>
    </div>

    <div id='tad_web_config_tab-5'>

      <div class="row">
        <div class="col-md-12">
          <script language="JavaScript">
            $().ready(function(){
              $(".bg_thumb").click(function(){
                var bg=$(this).attr("id");
                if(bg=="none"){
                  $("body").css("background-image","none");
                  $.post("config_ajax.php", {op: "save_bg" , filename: '', WebID: <{$WebID}>});
                }else{
                  $("body").css("background-image","url('<{$xoops_url}>/uploads/tad_web/<{$WebID}>/bg/"+bg+"')");
                  $(this).css("border","2px solid blue");
                  $.post("config_ajax.php", {op: "save_bg" , filename: bg, WebID: <{$WebID}>});
                }
              });
            });
          </script>

          <h3>
            <{$smarty.const._MD_TCW_BG_TOOLS}>
            <small>
              <{$smarty.const._MD_TCW_CLICK_TO_CHANG}>
            </small>
          </h3>
          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <div class="form-group">
              <div class="col-md-12">
                <{$upform_bg}>
              </div>
            </div>

            <div class="form-group">
              <div class="col-md-12">
                <div style="width:100px; height:96px; display:inline-block; margin:4px;">
                  <label style="width: 80px; height: 80px; background: <{$bg_color}>; border: 1px solid gray; background-size: contain;" id="none" class="bg_thumb">
                  </label>

                  <label class="del_img_box" style="font-size:12px;" id="del_img<{$bg.files_sn}>">
                    <{$smarty.const._MD_TCW_CONFIG_NONE_BG}>
                  </label>
                </div>
                <{if $all_bg}>
                  <{foreach from=$all_bg item=bg}>
                    <div style="width:100px; height:96px; display:inline-block; margin:4px;">
                      <label style="width: 80px; height: 80px; background: #000000 url('<{$bg.tb_path}>') center center no-repeat; border: <{if $bg.file_name == $web_bg}>2px solid red<{else}>1px solid gray<{/if}>; background-size: contain;" id="<{$bg.file_name}>" class="bg_thumb">
                      </label>

                      <label class="del_img_box" style="font-size:12px;" id="del_img<{$bg.files_sn}>">
                        <input type="checkbox" value="<{$bg.files_sn}>" name="del_file[<{$bg.files_sn}>]"> <{$smarty.const._TAD_DEL}>
                      </label>
                    </div>
                  <{/foreach}>
                <{/if}>
              </div>
            </div>

            <div class="text-center">
              <input type="hidden" name="WebID" value="<{$WebID}>">
              <input type="hidden" name="op" value="upload_bg">
              <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
            </div>
          </form>
        </div>
      </div>
    </div>

    <div id='tad_web_config_tab-6'>
      <{$mColorPicker_code}>
      <div class="row">
        <div class="col-md-12">
          <script language="JavaScript">
            function change_color(selector,css_name,css_val){
              $(selector).css(css_name,css_val);
            }
            function save_color(col){
                $.post("config_ajax.php", {op: "save_color" , col_name: $(col).attr('id'), col_val: $(col).val(), WebID: <{$WebID}>});
            }

            $(document).ready(function () {
              $('#container_bg_color').bind('colorpicked', function () {
                save_color(this);
              });
              $('#bg_color').bind('colorpicked', function () {
                save_color(this);
              });
              $('#navbar_bg_top').bind('colorpicked', function () {
                save_color(this);
              });
              $('#navbar_color').bind('colorpicked', function () {
                save_color(this);
              });
              $('#navbar_hover').bind('colorpicked', function () {
                save_color(this);
              });
              $('#navbar_color_hover').bind('colorpicked', function () {
                save_color(this);
              });

            });
          </script>

          <h3>
            <{$smarty.const._MD_TCW_COLOR_TOOLS}>
          </h3>
          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
            <div class="form-group">
              <label class="col-md-2 control-label">
                <{$smarty.const._MD_TCW_MAIN_NAV_TOP_COLOR}>
              </label>
              <div class="col-md-2">
                <input type="text" name="color_setup[navbar_bg_top]" class="form-control color" value="<{$navbar_bg_top}>" id="navbar_bg_top" data-text="true" data-hex="true" onChange="change_color('#tad_web_nav,.sf-menu li','background-color',this.value);" style="width:80px; display: inline-block;">
              </div>
              <div class="col-md-2">
                <{$smarty.const._MD_TCW_MAIN_DEFAULT_COLOR}>: <{$navbar_bg_top}>
              </div>

              <label class="col-md-2 control-label">
                <{$smarty.const._MD_TCW_MAIN_NAV_COLOR}>
              </label>
              <div class="col-md-2">
                <input type="text" name="color_setup[navbar_color]" class="form-control color" value="<{$navbar_color}>" id="navbar_color" data-text="true" data-hex="true" onChange="change_color('.sf-menu a','color',this.value);" style="width:80px; display: inline-block;">
              </div>
              <div class="col-md-2">
                <{$smarty.const._MD_TCW_MAIN_DEFAULT_COLOR}>: <{$navbar_color}>
              </div>
            </div>



            <div class="form-group">
              <label class="col-md-2 control-label">
                <{$smarty.const._MD_TCW_MAIN_NAV_HOVER_BG_COLOR}>
              </label>
              <div class="col-md-2">
                <input type="text" name="color_setup[navbar_hover]" class="form-control color" value="<{$navbar_hover}>" id="navbar_hover" data-text="true" data-hex="true" onChange="change_color('.sf-menu li:hover,.sf-menu li.sfHover','background-color',this.value);" style="width:80px; display: inline-block;">
              </div>
              <div class="col-md-2">
                <{$smarty.const._MD_TCW_MAIN_DEFAULT_COLOR}>: <{$navbar_hover}>
              </div>

              <label class="col-md-2 control-label">
                <{$smarty.const._MD_TCW_MAIN_NAV_HOVER_COLOR}>
              </label>
              <div class="col-md-2">
                <input type="text" name="color_setup[navbar_color_hover]" class="form-control color" value="<{$navbar_color_hover}>" id="navbar_color_hover" data-text="true" data-hex="true" onChange="change_color('.sf-menu a:hover','color',this.value);" style="width:80px; display: inline-block;">
              </div>
              <div class="col-md-2">
                <{$smarty.const._MD_TCW_MAIN_DEFAULT_COLOR}>: <{$navbar_color_hover}>
              </div>
            </div>


            <div class="form-group">
              <label class="col-md-2 control-label">
                <{$smarty.const._MD_TCW_CONTAINER_BG_COLOR}>
              </label>
              <div class="col-md-2">
                <input type="text" name="color_setup[container_bg_color]" class="form-control color" value="<{$container_bg_color}>" id="container_bg_color" data-text="true" data-hex="true" onChange="change_color('#container','background-color',this.value);" style="width:80px; display: inline-block;">
              </div>
              <div class="col-md-2">
                <{$smarty.const._MD_TCW_MAIN_DEFAULT_COLOR}>: <{$container_bg_color}>
              </div>

              <label class="col-md-2 control-label">
                <{$smarty.const._MD_TCW_MAIN_BG_COLOR}>
              </label>
              <div class="col-md-2">
                <input type="text" name="color_setup[bg_color]" class="form-control color" value="<{$bg_color}>" id="bg_color" data-text="true" data-hex="true" onChange="change_color('body','background-color',this.value);" style="width:80px; display: inline-block;">
              </div>
              <div class="col-md-2">
                <{$smarty.const._MD_TCW_MAIN_DEFAULT_COLOR}>: <{$bg_color}>
              </div>
            </div>


            <div class="text-center">
              <input type="hidden" name="WebID" value="<{$WebID}>">
              <input type="hidden" name="op" value="save_all_color">
              <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
            </div>
          </form>
        </div>
      </div>
    </div>

    <div id="tad_web_config_tab-7">
      <div class="row">
        <div class="col-md-5 text-center">
          <h3><{$smarty.const._MD_TCW_BLOCKS_LIST}></h3>
        </div>
        <div class="col-md-2"></div>
        <div class="col-md-5 text-center">
          <h3><{$smarty.const._MD_TCW_BLOCKS_SELECTED}></h3>
        </div>
      </div>
      <div class="row">
        <div class="col-md-12">
          <form action="config.php" method="post" enctype="multipart/form-data" class="form-horizontal" role="form">
          <div class="row">
            <div class="col-md-5">
              <select name="block_repository" id="block_repository" size="12" multiple="multiple" tmt:linkedselect="true" class="form-control">
              <{$block_yet}>
              </select>
            </div>
            <div class="col-md-2 text-center">
              <img src="<{$xoops_url}>/modules/tad_web/images/right.png" onclick="tmt.spry.linkedselect.util.moveOptions('block_repository', 'block_destination');getOptions('block_destination','display_blocks');"><br>
              <img src="<{$xoops_url}>/modules/tad_web/images/left.png" onclick="tmt.spry.linkedselect.util.moveOptions('block_destination' , 'block_repository');getOptions('block_destination','display_blocks');"><br><br>

              <img src="<{$xoops_url}>/modules/tad_web/images/up.png" onclick="tmt.spry.linkedselect.util.moveOptionUp('block_destination');getOptions('block_destination','display_blocks');"><br>
              <img src="<{$xoops_url}>/modules/tad_web/images/down.png" onclick="tmt.spry.linkedselect.util.moveOptionDown('block_destination');getOptions('block_destination','display_blocks');">
              <div class="text-center" style="margin-top: 30px;">
                <input type="hidden" name="display_blocks" id="display_blocks" value="<{$display_blocks}>">
                <input type="hidden" name="op" value="save_block">
                <input type="hidden" name="WebID" value="<{$WebID}>">
                <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
              </div>
            </div>
            <div class="col-md-5">
              <select id="block_destination" size="12" multiple="multiple" tmt:linkedselect="true" class="form-control">
              <{$block_ok}>
              </select>
            </div>
          </div>
          </form>
        </div>
      </div>
    </div>


    <div id="tad_web_config_tab-8">
      <div class="row">
        <div class="col-md-5 text-center">
          <h3><{$smarty.const._MD_TCW_USER_LIST}></h3>
        </div>
        <div class="col-md-2"></div>
        <div class="col-md-5 text-center">
          <h3><{$smarty.const._MD_TCW_USER_SELECTED}></h3>
        </div>
      </div>
      <div class="row">
        <div class="col-md-12">
          <form action="config.php" method="post" class="form-horizontal" role="form">
          <div class="row">
            <div class="col-md-5">
              <select name="adm_repository" id="adm_repository" size="12" multiple="multiple" tmt:linkedselect="true" class="form-control">
              <{$user_yet}>
              </select>
            </div>
            <div class="col-md-2 text-center">
              <img src="<{$xoops_url}>/modules/tad_web/images/right.png" onclick="tmt.spry.linkedselect.util.moveOptions('adm_repository', 'adm_destination');getOptions('adm_destination','web_admins');"><br>
              <img src="<{$xoops_url}>/modules/tad_web/images/left.png" onclick="tmt.spry.linkedselect.util.moveOptions('adm_destination' , 'adm_repository');getOptions('adm_destination','web_admins');"><br><br>

              <img src="<{$xoops_url}>/modules/tad_web/images/up.png" onclick="tmt.spry.linkedselect.util.moveOptionUp('adm_destination');getOptions('adm_destination','web_admins');"><br>
              <img src="<{$xoops_url}>/modules/tad_web/images/down.png" onclick="tmt.spry.linkedselect.util.moveOptionDown('adm_destination');getOptions('adm_destination','web_admins');">
              <div class="text-center" style="margin-top: 30px;">
                <input type="hidden" name="web_admins" id="web_admins" value="<{$web_admins}>">
                <input type="hidden" name="op" value="save_adm">
                <input type="hidden" name="WebID" value="<{$WebID}>">
                <button type="submit" class="btn btn-primary"><{$smarty.const._TAD_SAVE}></button>
              </div>
            </div>
            <div class="col-md-5">
              <select id="adm_destination" size="12" multiple="multiple" tmt:linkedselect="true" class="form-control">
              <{$user_ok}>
              </select>
            </div>
          </div>
          </form>
        </div>
      </div>
    </div>


  </div>
<{/if}>