<?
$auth=true;
//primarykey of the table
$primarykey="id";
//table name
$tablename="opentempl";
//title of the administration page
$pagetitle="Page templates";
//name of this file, starting with a slash
$thisfile ="/".array_pop(explode("/", $_SERVER["SCRIPT_NAME"]));
require("../../includes/includes.inc.php");
//get container id
$result = mysql_prefix_query("SELECT id, uid FROM container WHERE cfile='".$thisfile."'");
$container_id= @mysql_result($result,0,'id');
$mailuid= @mysql_result($result,0,'uid');
//workflow support true||flase
$wf=false;
//group list by some row or other table row
$listgroup=false;
//ability to show list of items [true|false]
$overviewitemoption=true;
//ability to add an item [true|false]
$addnewitemoption=true;
//ability to delte an item [true|false]
$deleteitemoption=true;
// format: fieldname,fieldtype,display text
// if you wish to hide a field set the fieldtype to 'hidden'
$records=array(
	array("id","hidden","id",""),
	array("t_name","string","Name","required"),
	array("t_descrip","string","Description",""),
	array("t_img","hidden","Image",""),
	array("t_data","blob","Data<br> <a href=\"opentemplatecode.php\" target=\"_new\">Generate code</a>","required"),
	array("t_file","string","File name","required"),
);
// format: fieldname,fieldtype,display text
$listformat=array(	
	array("t_name", "editlink","Name")
);

// format: fieldname,fieldtype,display text
$grouplistformat=array(	
	array("", "",""),
);
// format: table,where clause for group query, where clause for records
$groupsql=array("", "", "");


// format:  dropdownfieldname => lookuptablename, lookuptableprimarykey, lookuptabledisplayfield, argument
$dropdown = array(
);


//array configuration
$jetstream_nav = array (
		"2.1"		=>  array($jetstream_url . $thisfile => "Overview"),		//2.1 general overview
		"2.2"		=>  array($jetstream_url . $thisfile . "?task=createrecord" => "New template"),	//2.2 New item
		"2.3"		=>  array($jetstream_url . $thisfile . "?task=editrecord&". $primarykey. "=".$$primarykey => "Edit"),//2.3 Change item
);

//general configuration for structure info
$generalconfig = array(
	'keywords'=>'',//meta keywords
	'description'=>'',//meta description
	'robot'=>'index,follow',//robot tags, empty means "index,folow"
	'ondate'=>date("Y-m-d  H:i:s",(time())),//date:time when content should go online, empty is inmediatly online, when aproved
	'offdate'=>date("Y-m-d  H:i:s",(time()+315360000)),//date:time when content should go offline, empty means online for the next ten years
	'comment'=>'',//date:time when content should go offline, empty means online for the next ten years
	'systemtitle'=>$_REQUEST["shorttitle"]//article title for general overview
);

//language
$generallanguage = array(
	"beingedited"=>"This template is locked.",
	"norights"=>"You don't have the right permissions to preform this action.",
	"undeleteunable"=>"This template can not be undeleted (its not deleted).",
);

// First segment is header of informarmation section and Title of link (help, general instructions)
// Other segments a are seen if section is folded out
// Help under list
$hul=array(	'Help'=>'General information',
						''=>'This section of jetbox allows you to administrate the available templates and create your own.',
						'The general idea'=>'Templates are used to separate contents from layout. The template contains all the general layout information for the website, the contents is stored separate. The template feature in Jetbox also allows you to store many different type of pages in one unified way. All the data storage is handled by Jetbox, you don\'t have to create a separate database table for each different page, as opposed to all other containers that don\'t use the integrated templates. Currently Pages and content blocks container use this feature.',
						'More information on templates see'=>'<a href="http://jetbox.streamedge.com/faq.php?p=default&cat=3#a10" target="_blank">http://jetbox.streamedge.com/faq.php?p=default&cat=3#a10</a>',
						'Create your own templates'=>'Select the \'new template\' tab and click on the \'generate code\' link, follow the onscreen instructions.',
);
// Help under form
$huf=array(	'Help'=>'General configuration for templates',
						'Name'=>'Name of template. Choose a descriptive name as this name is shown in the pulldown menu to choose the template from, when creating a new item.',
						'Description'=>'Description of the template, only shown in this administration section.',
						'Data'=>'Holds the data generated by the \'Generate code\' function. First <i>generate</i> the code and past this in this field.',
						'Filename'=>'Location to the html template, which is normaly stored in the opentemplate folder in the root of the Jetbox installation.',
);


//actual login
authenticate();

function listrecords($error='', $blurbtype='notify'){
	general_listrecords($error, $blurbtype);
};
jetstream_footer();