<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

  /*===================================================
    ShowThemes()
  ===================================================*/

  function ShowThemes() {

    // vars global configuration
    global $active_theme, $admin_template_path, $theme_path, $active_theme, $all_themes, $theme, $tbl_class, $is_active;

    // vars url & form

    // vars messages
    global $msg;

    // vars template
    global $theme_name, $file_name;

    // get themes

    $handle=opendir($theme_path);
    while ($file = readdir($handle)) {
      if($file[0]==".") { }
      elseif($file=="indexu_theme.idf") { }
      else $themes[] = $file;
    }
    closedir($handle);

    sort($themes);

    $i=0;
    foreach($themes as $theme) {

      clearstatcache();

      if($i%2) $tbl_class = "tbl_light";
      else $tbl_class = "tbl_light2";
      $i++;
      
      if($theme==$active_theme) {
        $is_active = "<img src=../admin_tpl/images/green_rect.gif border=0 title='Now active' alt='Now active'>";
      }
      else {
        $is_active = "<img src=../admin_tpl/images/yellow_rect.gif border=0 title='Not active' alt='Not active'>";
      }

      $all_themes .= EvalTemplate($admin_template_path . "template_manager_rows.html",
                     "\$theme,\$is_active,\$tbl_class");
    }

    DisplayTemplate($admin_template_path . "template_manager_form.html", "\$all_themes");
  }


  /*===================================================
    main
  ===================================================*/

  include "../application.php";

  RunPreFilter(__FILE__);

  DisplayTemplate($admin_template_path . "header.html");
  ShowThemes();
  DisplayTemplate($admin_template_path . "footer.html");

  RunPostFilter(__FILE__);

?>