now using PHPGW_APP_TPL, and index.php is using new single template file

This commit is contained in:
Miles Lott 2001-05-10 12:21:16 +00:00
parent 20c373ce1b
commit a17f9909b9
13 changed files with 120 additions and 66 deletions

View File

@ -23,7 +23,7 @@
$phpgw_info["flags"]["enable_contacts_class"] = True;
include("../header.inc.php");
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array("add" => "add.tpl"));
$this = CreateObject("phpgwapi.contacts");

View File

@ -22,7 +22,7 @@
}
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('addressbook'));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array('form' => 'field_form.tpl'));
$t->set_block('form','add','addhandle');
$t->set_block('form','edit','edithandle');

View File

@ -36,7 +36,7 @@
$phpgw->common->phpgw_exit();
}
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array("delete" => "delete.tpl"));
if ($confirm != "true") {

View File

@ -37,7 +37,7 @@
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n"
. "<input type=\"hidden\" name=\"field\" value=\"$field\">\n";
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('addressbook'));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array('field_delete' => 'delete_common.tpl'));
$t->set_var('messages',lang('Are you sure you want to delete this field?'));

View File

@ -34,8 +34,8 @@
$phpgw->common->phpgw_exit();
}
$t = new Template($phpgw->common->get_tpl_dir('addressbook'));
$t->set_file(array('edit' => 'edit.tpl'));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array('edit' => 'edit.tpl'));
if (!$ab_id)
{

View File

@ -26,7 +26,7 @@
Header('Location: ' . $phpgw->link('/addressbook/fields.php',"sort=$sort&query=$query&start=$start"));
}
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('addressbook'));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array('form' => 'field_form.tpl'));
$t->set_block('form','add','addhandle');
$t->set_block('form','edit','edithandle');

View File

@ -31,22 +31,26 @@
$sep = SEP;
if (!$convert) {
$t = new Template($phpgw_info["server"]["app_tpl"]);
if (!$convert)
{
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array("export" => "export.tpl"));
$dir_handle=opendir($phpgw_info["server"]["app_root"].$sep."export");
$i=0; $myfilearray="";
while ($file = readdir($dir_handle)) {
while ($file = readdir($dir_handle))
{
#echo "<!-- ".is_file($phpgw_info["server"]["app_root"].$sep."conv".$sep.$file)." -->";
if ((substr($file, 0, 1) != ".") && is_file($phpgw_info["server"]["app_root"].$sep."export".$sep.$file) ) {
if ((substr($file, 0, 1) != ".") && is_file($phpgw_info["server"]["app_root"].$sep."export".$sep.$file) )
{
$myfilearray[$i] = $file;
$i++;
}
}
closedir($dir_handle);
sort($myfilearray);
for ($i=0;$i<count($myfilearray);$i++) {
for ($i=0;$i<count($myfilearray);$i++)
{
$fname = ereg_replace('_',' ',$myfilearray[$i]);
$conv .= ' <OPTION VALUE="'.$myfilearray[$i].'">'.$fname.'</OPTION>'."\n";
}
@ -72,15 +76,19 @@
$t->pparse("out","export");
$phpgw->common->phpgw_footer();
} else {
}
else
{
include ($phpgw_info["server"]["app_root"].$sep."export".$sep.$conv_type);
$buffer=array();
$this = new export_conv;
// Read in user custom fields, if any
$customfields = array();
while (list($col,$descr) = @each($phpgw_info["user"]["preferences"]["addressbook"])) {
if ( substr($col,0,6) == 'extra_' ) {
while (list($col,$descr) = @each($phpgw_info["user"]["preferences"]["addressbook"]))
{
if ( substr($col,0,6) == 'extra_' )
{
$field = ereg_replace('extra_','',$col);
$field = ereg_replace(' ','_',$field);
$customfields[$field] = ucfirst($field);
@ -91,7 +99,8 @@
"address2" => "address2",
"address3" => "address3"
);
if ($this->type != 'vcard') {
if ($this->type != 'vcard')
{
$this->qfields = $this->stock_contact_fields;# + $extrafields;# + $customfields;
}
@ -104,9 +113,11 @@
$buffer = $this->export_start_file($buffer);
}
for ($i=0;$i<count($this->ids);$i++) {
for ($i=0;$i<count($this->ids);$i++)
{
$buffer = $this->export_start_record($buffer);
while( list($name,$value) = each($this->currentrecord) ) {
while( list($name,$value) = each($this->currentrecord) )
{
$buffer = $this->export_new_attrib($buffer,$name,$value);
}
$buffer = $this->export_end_record($buffer);
@ -117,11 +128,14 @@
$tsvfilename = $phpgw_info['server']['temp_dir'].$sep.$tsvfilename;
if ( ($download == "on") || ($o->type == 'pdb') ) {
if ( ($download == "on") || ($o->type == 'pdb') )
{
// filename, default application/octet-stream, length of file, default nocache True
$phpgw->browser->content_header($tsvfilename,'',strlen($buffer));
echo $buffer;
} else {
}
else
{
echo "<pre>\n";
echo $buffer;
echo "\n</pre>\n";

View File

@ -17,8 +17,7 @@
include('../header.inc.php');
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('addressbook'));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array(
'field_list_t' => 'listfields.tpl',
'field_list' => 'listfields.tpl'));

View File

@ -32,22 +32,26 @@
}
$context = $phpgw_info["server"]["ldap_contact_context"];
if (!$convert) {
$t = new Template($phpgw_info["server"]["app_tpl"]);
if (!$convert)
{
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array("import" => "import.tpl"));
$dir_handle=opendir($phpgw_info["server"]["app_root"].$sep."import");
$i=0; $myfilearray="";
while ($file = readdir($dir_handle)) {
while ($file = readdir($dir_handle))
{
//echo "<!-- ".is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file)." -->";
if ((substr($file, 0, 1) != ".") && is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file) ) {
if ((substr($file, 0, 1) != ".") && is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file) )
{
$myfilearray[$i] = $file;
$i++;
}
}
closedir($dir_handle);
sort($myfilearray);
for ($i=0;$i<count($myfilearray);$i++) {
for ($i=0;$i<count($myfilearray);$i++)
{
$fname = ereg_replace('_',' ',$myfilearray[$i]);
$conv .= '<OPTION VALUE="'.$myfilearray[$i].'">'.$fname.'</OPTION>';
}
@ -75,7 +79,9 @@
$t->set_var("cat_id",$cat_id);
$t->pparse("out","import");
$phpgw->common->phpgw_footer();
} else {
}
else
{
include ($phpgw_info["server"]["app_root"].$sep."import".$sep.$conv_type);
if ($private=="") { $private="public"; }
@ -84,78 +90,108 @@
$this = new import_conv;
$buffer = $this->import_start_file($buffer,$basedn,$context);
$fp=fopen($tsvfile,"r");
if ($this->type == 'csv') {
while ($data = fgetcsv($fp,8000,",")) {
if ($this->type == 'csv')
{
while ($data = fgetcsv($fp,8000,","))
{
$num = count($data);
$row++;
if ($row == 1) {
if ($row == 1)
{
$header = $data;
} else {
}
else
{
$buffer = $this->import_start_record($buffer);
for ($c=0; $c<$num; $c++ ) {
for ($c=0; $c<$num; $c++ )
{
//Send name/value pairs along with the buffer
if ($this->import[$header[$c]]!="" && $data[$c]!="") {
if ($this->import[$header[$c]]!="" && $data[$c]!="")
{
$buffer = $this->import_new_attrib($buffer, $this->import[$header[$c]],$data[$c]);
}
}
$buffer = $this->import_end_record($buffer,$private);
}
}
} elseif ($this->type == 'ldif') {
while ($data = fgets($fp,8000)) {
}
elseif ($this->type == 'ldif')
{
while ($data = fgets($fp,8000))
{
$url = "";
list($name,$value,$extra) = split(':', $data);
if (substr($name,0,2) == 'dn') {
if (substr($name,0,2) == 'dn')
{
$buffer = $this->import_start_record($buffer);
}
$test = trim($value);
if ($name && !empty($test) && $extra) {
if ($name && !empty($test) && $extra)
{
// Probable url string
$url = $test;
$value = $extra;
} elseif ($name && empty($test) && $extra) {
}
elseif ($name && empty($test) && $extra)
{
// Probable multiline encoding
$newval = base64_decode(trim($extra));
$value = $newval;
//echo $name.':'.$value;
}
if ($name && $value) {
if ($name && $value)
{
$test = split(',mail=',$value);
if ($test[1]) {
if ($test[1])
{
$name = "mail";
$value = $test[1];
}
if ($url) {
if ($url)
{
$name = "homeurl";
$value = $url. ':' . $value;
}
//echo '<br>'.$j.': '.$name.' => '.$value;
if ($this->import[$name] != "" && $value != "") {
if ($this->import[$name] != "" && $value != "")
{
$buffer = $this->import_new_attrib($buffer, $this->import[$name],$value);
}
} else {
}
else
{
$buffer = $this->import_end_record($buffer,$private);
}
}
} else {
while ($data = fgets($fp,8000)) {
}
else
{
while ($data = fgets($fp,8000))
{
list($name,$value,$extra) = split(':', $data);
if (strtolower(substr($name,0,5)) == 'begin') {
if (strtolower(substr($name,0,5)) == 'begin')
{
$buffer = $this->import_start_record($buffer);
}
if (substr($value,0,5) == "http") {
if (substr($value,0,5) == "http")
{
$value = $value . ":".$extra;
}
if ($name && $value) {
if ($name && $value)
{
reset($this->import);
while ( list($fname,$fvalue) = each($this->import) ) {
if ( strstr(strtolower($name), $this->import[$fname]) ) {
while ( list($fname,$fvalue) = each($this->import) )
{
if ( strstr(strtolower($name), $this->import[$fname]) )
{
$buffer = $this->import_new_attrib($buffer,$name,$value);
}
}
} else {
}
else
{
$buffer = $this->import_end_record($buffer);
}
}
@ -164,19 +200,25 @@
fclose($fp);
$buffer = $this->import_end_file($buffer,$private,$cat_id);
if ($download == "") {
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" ) {
if ($download == "")
{
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" )
{
// filename, default application/octet-stream, length of file, default nocache True
$phpgw->browser->content_header($tsvfilename,'',strlen($buffer));
echo $buffer;
} else {
}
else
{
echo "<pre>$buffer</pre>";
echo '<a href="'.$phpgw->link("/addressbook/index.php",
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
. '">'.lang("OK").'</a>';
$phpgw->common->phpgw_footer();
}
} else {
}
else
{
echo "<pre>$buffer</pre>";
echo '<a href="'.$phpgw->link("/addressbook/index.php",
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")

View File

@ -20,13 +20,12 @@
include('../header.inc.php');
$t = new Template($phpgw->common->get_tpl_dir('addressbook'));
$t->set_file(array(
'addressbook_header' => 'header.tpl',
'column' => 'column.tpl',
'row' => 'row.tpl',
'addressbook_footer' => 'footer.tpl'
));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array('addressbook_list_t' => 'index.tpl'));
$t->set_block('addressbook_list_t','addressbook_header','addressbook_header');
$t->set_block('addressbook_list_t','column','column');
$t->set_block('addressbook_list_t','row','row');
$t->set_block('addressbook_list_t','addressbook_footer','addressbook_footer');
$this = CreateObject('phpgwapi.contacts');
//$this->delete_all($phpgw_info['user']['account_id']);

View File

@ -92,7 +92,7 @@
echo "<p><center>" . $phpgw->common->error_list($errors) . "</center>";
}
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array(
"preferences" => "preferences.tpl",
));

View File

@ -89,7 +89,7 @@
echo "<B><CENTER>You must select a vcard. (*.vcf)</B></CENTER><BR><BR>";
}
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array("vcardin" => "vcardin.tpl"));
$vcard_header = "<p>&nbsp;<b>" . lang("Address book - VCard in") . "</b><hr><p>";

View File

@ -45,7 +45,7 @@
echo parse_navbar();
}
$t = new Template($phpgw->common->get_tpl_dir('addressbook'));
$t = new Template(PHPGW_APP_TPL);
$t->set_file(array(
'view' => 'view.tpl',
'view_header' => 'view_header.tpl',