<?
/* index.php: $pubmodule, $pubtask, $pubitemid */
$pubcatid = $_REQUEST["catid"];
$pubsubjectid = $_REQUEST["subjectid"];
$pubgroupid = $_REQUEST["groupid"];

// filter forms..
$filterseedtype=$_POST['seedtype'];
if (($filterseedtype=="")||($filterseedtype==null)) $filterseedtype=0;
?>

<script type="text/javascript">

// ................................................................................
// user-interaction handlers..
// ................................................................................

function config_button_addspi() {
  document.location='index.php?module=crawler&task=newsearch';
}

function config_button_editspi(spipkey) {
  document.location='index.php?module=crawler&task=initspi&itemid='+spipkey;
}

function config_button_viewspi(spipkey) {
  document.location='index.php?module=config&task=spiview&itemid='+spipkey;
}

function config_button_deletespi(spipkey) {
  document.location='index.php?module=config&task=spidelete&itemid='+spipkey;
}

function config_button_addsavedsearch() {
  document.location='index.php?module=crawler&task=newsearch';
}

function config_button_editsavedsearch(savedpkey) {
  document.location='index.php?module=crawler&task=initsaved&itemid='+savedpkey;
}

function config_button_viewsavedsearch(savedpkey) {
  document.location='index.php?module=config&task=savedview&itemid='+savedpkey;
}

function config_button_deletesavedsearch(savedpkey) {
  document.location='index.php?module=config&task=saveddelete&itemid='+savedpkey;
}

function config_button_addseed() {
  document.location='index.php?module=config&task=seedadd';
}

function config_button_editseed(seedpkey) {
  document.location='index.php?module=config&task=seededit&itemid='+seedpkey;
}

function config_button_viewseed(seedpkey) {
  document.location='index.php?module=config&task=seedview&itemid='+seedpkey;
}

function config_button_deleteseed(seedpkey) {
  document.location='index.php?module=config&task=seeddelete&itemid='+seedpkey;
}

function config_button_savespi() {
  document.configform.job.value='config_spiadd'; document.configform.submit();
}

function config_button_updatespi() {
  document.configform.job.value='config_spiedit'; document.configform.submit();
}

function config_button_purgespi() {
  document.configform.job.value='config_spiremove'; document.configform.submit();
}

function config_button_savesavedsearch() {
  document.configform.job.value='config_savedadd'; document.configform.submit();
}

function config_button_updatesavedsearch() {
  document.configform.job.value='config_savededit'; document.configform.submit();
}

function config_button_purgesavedsearch() {
  document.configform.job.value='config_savedremove'; document.configform.submit();
}

function config_button_saveseed() {
  if (validateForm()==true) {
    document.configform.job.value='config_seedadd'; document.configform.submit();
  }
}

function config_button_updateseed() {
  if (validateForm()==true) {
    document.configform.job.value='config_seededit'; document.configform.submit();
  }
}

function config_button_purgeseed() {
  document.configform.job.value='config_seedremove'; document.configform.submit();
}

function config_button_addlist() {
  document.location='index.php?module=config&task=listadd';
}

function config_button_editlist(listpkey) {
  document.location='index.php?module=config&task=listedit&itemid='+listpkey;
}

function config_button_viewlist(listpkey) {
  document.location='index.php?module=config&task=listview&itemid='+listpkey;
}

function config_button_deletelist(listpkey) {
  document.location='index.php?module=config&task=listdelete&itemid='+listpkey;
}

function config_button_savelist() {
  if (validateForm()==true) {
    document.configform.job.value='config_listadd'; document.configform.submit();
  }
}

function config_button_updatelist() {
  if (validateForm()==true) {
    document.configform.job.value='config_listedit'; document.configform.submit();
  }
}

function config_button_purgelist() {
  document.configform.job.value='config_listremove'; document.configform.submit();
}

function config_button_printlist() {
  document.configform.job.value='config_listprint'; document.configform.submit();
}

function config_button_unshortlist(pagepkey) {
  if (confirm('Are you sure to remove this page from the List?')) {
    document.configform.page_pkey.value=pagepkey;
    document.configform.job.value='config_unshortlist';
    document.configform.submit();
  }
}

function config_button_back() {
  history.go(-1);
}

</script>

<?

// ................................................................................
// model..
// ................................................................................

include_once('models/crawlerModel.php');
include_once('models/templateModel.php');
$mycrawlerModel=new crawlerModel;
$mytemplateModel=new templateModel;

?>

<?

// ................................................................................
// data retrieval functions..
// ................................................................................


// ................................................................................
// data modifications functions..
// ................................................................................


// ................................................................................
// default to list view if none specified..
// ................................................................................
if ($pubtask=="") $pubtask="main";

// ................................................................................
// display page header..
// ................................................................................

$pagetitle="Configuration";
if (($pubtask=="main")||($pubtask=="submenu")) {
  $subtitle="Configurations Menu";
} else if ($pubtask=="spi") {
  $subtitle="Manage SPI";
} else if ($pubtask=="saved") {
  $subtitle="Manage Saved Crawls";
} else if ($pubtask=="seeds") {
  $subtitle="Manage Seeds";
} else if ($pubtask=="spiedit") {
  $subtitle="Edit SPI";
} else if ($pubtask=="spiview") {
  $subtitle="View SPI";
} else if ($pubtask=="spidelete") {
  $subtitle="Delete SPI";
} else if ($pubtask=="savededit") {
  $subtitle="Edit Saved Crawl";
} else if ($pubtask=="savedview") {
  $subtitle="View Saved Crawl";
} else if ($pubtask=="saveddelete") {
  $subtitle="Delete Saved Crawl";
} else if ($pubtask=="seedadd") {
  $subtitle="Add Seed URL";
} else if ($pubtask=="seededit") {
  $subtitle="Edit Seed URL";
} else if ($pubtask=="seedview") {
  $subtitle="View Seed URL";
} else if ($pubtask=="seeddelete") {
  $subtitle="Delete Seed URL";
} else if ($pubtask=="lists") {
  $subtitle="Manage Lists";
} else if ($pubtask=="listadd") {
  $subtitle="Add List";
} else if ($pubtask=="listedit") {
  $subtitle="Edit List";
} else if ($pubtask=="listview") {
  $subtitle="View List";
} else if ($pubtask=="listdelete") {
  $subtitle="Delete List";
} else {
  $subtitle="Error: Invalid Option";
}

include_once('views/general-header.tpl');

// TODO: Later to show list of available variables here if in DEBUG mode!!

// ................................................................................
// display main area..
// ................................................................................

if (($pubtask=="main")||($pubtask=="submenu")) {

  include_once('views/config-submenu.tpl');

} else if (($pubtask=="spi")&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  if ($pubuserrole>=2) {
    if ($pubgroupid!="") {
      $spi_list = $mycrawlerModel->getlist_spis($pubgroupid);
    } else {
      $spi_list = $mycrawlerModel->getlist_spis();
    }
  } else {
    $spi_list = $mycrawlerModel->getlist_spis($pubusergrouppkey);
  }
  include_once('views/spi-list.tpl');

} else if ((($pubtask=="spiadd")||($pubtask=="spiedit"))&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  $spi_data = $mycrawlerModel->getdata_spi($pubitemid);
  include_once('views/spi-edit.tpl');

} else if ((($pubtask=="spiview")||($pubtask=="spidelete"))&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  $spi_data = $mycrawlerModel->getdata_spi($pubitemid);
  include_once('views/spi-view.tpl');

} else if (($pubtask=="saved")&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  if ($pubuserrole>=2) {
    if ($pubgroupid!="") {
      $saved_list = $mycrawlerModel->getlist_savedcrawls($pubgroupid);
    } else {
      $saved_list = $mycrawlerModel->getlist_savedcrawls();
    }
  } else {
    $saved_list = $mycrawlerModel->getlist_savedcrawls($pubusergrouppkey);
  }
  include_once('views/saved-list.tpl');

} else if ((($pubtask=="savedadd")||($pubtask=="savededit"))&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  $savedsearch_data = $mycrawlerModel->getdata_savedsearch($pubitemid);
  include_once('views/savedsearch-edit.tpl');

} else if ((($pubtask=="savedview")||($pubtask=="saveddelete"))&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  $savedsearch_data = $mycrawlerModel->getdata_savedsearch($pubitemid);
  include_once('views/savedsearch-view.tpl');

} else if (($pubtask=="seeds")&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  if ($pubuserrole>=2) {
    if ($pubgroupid!="") {
      $seed_list = $mycrawlerModel->getlist_seeds($pubgroupid,"",$filterseedtype);
    } else {
      $seed_list = $mycrawlerModel->getlist_seeds("","",$filterseedtype);
    }
  } else {
    $seed_list = $mycrawlerModel->getlist_seeds($pubusergrouppkey,"",$filterseedtype);
  }
  include_once('views/seed-list.tpl');

} else if ((($pubtask=="seedadd")||($pubtask=="seededit"))&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  $seed_data = $mycrawlerModel->getdata_seed($pubitemid);
  include_once('views/seed-edit.tpl');

} else if ((($pubtask=="seedview")||($pubtask=="seeddelete"))&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  $seed_data = $mycrawlerModel->getdata_seed($pubitemid);
  include_once('views/seed-view.tpl');

} else if (($pubtask=="lists")&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  if ($pubuserrole>=2) {
    if ($pubgroupid!="") {
      $list_list = $mytemplateModel->getlist_lists($pubgroupid);
    } else {
      $list_list = $mytemplateModel->getlist_lists();
    }
  } else {
    $list_list = $mytemplateModel->getlist_lists($pubusergrouppkey);
  }
  include_once('views/list-list.tpl');

} else if ((($pubtask=="listadd")||($pubtask=="listedit"))&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  $list_data = $mytemplateModel->getdata_list($pubitemid);
  include_once('views/list-edit.tpl');

} else if ((($pubtask=="listview")||($pubtask=="listdelete"))&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  $list_data = $mytemplateModel->getdata_list($pubitemid);
  $item_list = $mytemplateModel->getlist_listitems($pubitemid);
  include_once('views/list-view.tpl');

} else {
  include_once('views/general-invalidtask.php');
}

// ...............................................................................
// display button options area..
// ...............................................................................

$prevurl = explode('/',$_SESSION['Xpreviousurl']);
$prevfile = $prevurl[count($prevurl)-1];
if ($prevfile=='inputController.php') $backstatus="style='display: none;'";

if (($pubtask=="main")||($pubtask=="submenu")) {

  echo "<br><hr size=1>";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="spi")&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"add\" id=\"add\" onClick=\"config_button_addspi();\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add New SPI</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="spiadd")&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"save\" id=\"save\" onClick=\"config_button_savespi();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Save SPI</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="spiedit")&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"update\" id=\"update\" onClick=\"config_button_updatespi();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Update SPI</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="spiview")&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"edit\" id=\"edit\" onClick=\"javascript:config_button_editspi('".$spi_data['spi_pkey']."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Edit&nbsp;</button>&nbsp;";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"javascript:config_button_deletespi('".$spi_data['spi_pkey']."');\"><img src='gfx/options/b_drop.png' class='actionbutton'>&nbsp;&nbsp;Delete</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"javascript:config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="spidelete")&&(($pubuseraccess['access_config_managespi']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<font color='#ff0000'><b>ARE YOU SURE TO PERMANENTLY DELETE THIS SPECIAL PURPOSE INDEX?</b></font><br><br>";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"config_button_purgespi();\">&nbsp;Yes, Delete SPI&nbsp;</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<brp><hr size=1><br>";

} else if (($pubtask=="saved")&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"add\" id=\"add\" onClick=\"config_button_addsavedsearch();\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add New Saved Crawl</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="savedadd")&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"save\" id=\"save\" onClick=\"config_button_savesavedsearch();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Save Saved Crawl</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="savededit")&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"update\" id=\"update\" onClick=\"config_button_updatesavedsearch();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Update Saved Crawl</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="savedview")&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"edit\" id=\"edit\" onClick=\"javascript:config_button_editsavedsearch('".$savedsearch_data['savedsearch_pkey']."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Edit&nbsp;</button>&nbsp;";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"javascript:config_button_deletesavedsearch('".$savedsearch_data['savedsearch_pkey']."');\"><img src='gfx/options/b_drop.png' class='actionbutton'>&nbsp;&nbsp;Delete</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"javascript:config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="saveddelete")&&(($pubuseraccess['access_config_managesaved']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<font color='#ff0000'><b>ARE YOU SURE TO PERMANENTLY DELETE THIS SAVED CRAWL?</b></font><br><br>";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"config_button_purgesavedsearch();\">&nbsp;Yes, Delete Saved Crawl&nbsp;</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<brp><hr size=1><br>";

} else if (($pubtask=="seeds")&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"add\" id=\"add\" onClick=\"config_button_addseed();\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add New Seed URL</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="seedadd")&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"save\" id=\"save\" onClick=\"config_button_saveseed();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Save Seed URL</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="seededit")&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"update\" id=\"update\" onClick=\"config_button_updateseed();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Update Seed URL</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="seedview")&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"edit\" id=\"edit\" onClick=\"javascript:config_button_editseed('".$seed_data['seed_pkey']."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Edit&nbsp;</button>&nbsp;";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"javascript:config_button_deleteseed('".$seed_data['seed_pkey']."');\"><img src='gfx/options/b_drop.png' class='actionbutton'>&nbsp;&nbsp;Delete</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"javascript:config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="seeddelete")&&(($pubuseraccess['access_config_manageseeds']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<font color='#ff0000'><b>ARE YOU SURE TO PERMANENTLY DELETE THIS SEED URL?</b></font><br><br>";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"config_button_purgeseed();\">&nbsp;Yes, Delete Seed URL&nbsp;</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<brp><hr size=1><br>";

} else if (($pubtask=="lists")&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"add\" id=\"add\" onClick=\"config_button_addlist();\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add New List</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="listadd")&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"save\" id=\"save\" onClick=\"config_button_savelist();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Save List</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="listedit")&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"update\" id=\"update\" onClick=\"config_button_updatelist();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Update List</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="listview")&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"edit\" id=\"edit\" onClick=\"javascript:config_button_editlist('".$list_data['list_pkey']."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Edit&nbsp;</button>&nbsp;";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"javascript:config_button_deletelist('".$list_data['list_pkey']."');\"><img src='gfx/options/b_drop.png' class='actionbutton'>&nbsp;&nbsp;Delete</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"javascript:config_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Select Template ";
  echo "<select name='template_pkey' id='template_pkey' style='width: 200px;'>";
  include_once("views/object-selecttemplatelist.tpl");
  echo "</select>&nbsp;";
  echo "<button name=\"print\" id=\"print\" onClick=\"javascript:config_button_printlist();\">&nbsp;<img src='gfx/options/b_print1.png' class='actionbutton'>&nbsp;&nbsp;Print&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";
  echo "</form>";

} else if (($pubtask=="listdelete")&&(($pubuseraccess['access_config_managelists']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<font color='#ff0000'><b>ARE YOU SURE TO PERMANENTLY DELETE THIS LIST?</b></font><br><br>";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"config_button_purgelist();\">&nbsp;Yes, Delete List&nbsp;</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"config_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<brp><hr size=1><br>";

}

// ................................................................................
// display page footer..
// ................................................................................

include_once('views/general-footer.tpl');

?>