forked from science-ation/science-ation
Hacked up the editor a bit more.
- Added a "multicheck" input type for languages (english, french) - Added a proof of concept cross reference to the judge class, it pulls the languages out of the judges_language database - Completely broke the save mechanism. - Converted the tableeditor edit routines to read from the input class - Converted the tableeditor edit routines to use assoc arrays, instead of -> (easier to pull from mysql and then add cross references to it.
This commit is contained in:
parent
1e9f68a35e
commit
373b876b1b
@ -34,7 +34,7 @@
|
|||||||
{
|
{
|
||||||
echo "<a href=\"judges_invite.php\">".i18n("Invite Judges")."</a><br />";
|
echo "<a href=\"judges_invite.php\">".i18n("Invite Judges")."</a><br />";
|
||||||
}
|
}
|
||||||
echo "<a href=\"judges_judges.php\">".i18n("Judges List")."</a><br />";
|
echo "<a href=\"judges_judges.php\">".i18n("Manage Judges")."</a> ".i18n("- Add, Delete, Edit, and List judges")."<br />";
|
||||||
echo "<a href=\"judges_teams.php\">".i18n("Manage Judging Teams")."</a><br />";
|
echo "<a href=\"judges_teams.php\">".i18n("Manage Judging Teams")."</a><br />";
|
||||||
echo "<a href=\"judges_teams_members.php\">".i18n("Manage Judging Team Members")."</a><br />";
|
echo "<a href=\"judges_teams_members.php\">".i18n("Manage Judging Team Members")."</a><br />";
|
||||||
echo "<a href=\"judges_timeslots.php\">".i18n("Manage Judging Timeslots")."</a><br />";
|
echo "<a href=\"judges_timeslots.php\">".i18n("Manage Judging Timeslots")."</a><br />";
|
||||||
|
@ -19,19 +19,36 @@ function editor_setup($editor)
|
|||||||
'lastname' => 'Last Name'
|
'lastname' => 'Last Name'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Most of these should be moved to the base class, as they
|
||||||
|
* will be the same for all person groups */
|
||||||
$e = array( 'firstname' => 'First Name',
|
$e = array( 'firstname' => 'First Name',
|
||||||
'lastname' => 'Last Name',
|
'lastname' => 'Last Name',
|
||||||
|
'email' => 'Email Address',
|
||||||
'address' =>"Address 1",
|
'address' =>"Address 1",
|
||||||
'address2' =>"Address 2",
|
'address2' =>"Address 2",
|
||||||
|
'city' => 'City',
|
||||||
|
'province' => 'Province',
|
||||||
|
'postalcode' => 'Postal Code',
|
||||||
|
'phonework' => 'Phone (Work)',
|
||||||
|
'phonecell' => 'Phone (Cell)',
|
||||||
|
'organization' => 'Organization',
|
||||||
|
'language' => 'Language(s)',
|
||||||
'complete' => "Complete" );
|
'complete' => "Complete" );
|
||||||
|
|
||||||
$editor->setTable('judges');
|
$editor->setTable('judges');
|
||||||
$editor->setListFields($l);
|
$editor->setListFields($l);
|
||||||
$editor->setEditFields($e);
|
$editor->setEditFields($e);
|
||||||
|
|
||||||
// $editor->setFieldOptions('complete', array('yes','no'));
|
/* Build an array of langauges that we support */
|
||||||
}
|
$langs = array();
|
||||||
|
$q=mysql_query("SELECT * FROM languages WHERE active='Y'");
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
$langs[$r->lang] = $r->langname;
|
||||||
|
}
|
||||||
|
|
||||||
|
$editor->setFieldOptions('language', $langs);
|
||||||
|
$editor->setFieldInputType('language', 'multicheck');
|
||||||
|
}
|
||||||
|
|
||||||
/* Functions for $this */
|
/* Functions for $this */
|
||||||
|
|
||||||
@ -40,12 +57,34 @@ function judge()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
function load()
|
function load($id)
|
||||||
{
|
{
|
||||||
|
$q=mysql_query("SELECT judges.*
|
||||||
|
FROM judges
|
||||||
|
WHERE judges.id='$id'");
|
||||||
|
echo mysql_error();
|
||||||
|
|
||||||
|
print("Loading Judge ID $id\n");
|
||||||
|
|
||||||
|
/* We assume that the field names in the array we want to return
|
||||||
|
* are the same as those in the database, so we'll turn the entire
|
||||||
|
* query into a single associative array */
|
||||||
|
$j = mysql_fetch_assoc($q);
|
||||||
|
|
||||||
|
/* Now turn on the ones this judge has selected */
|
||||||
|
$q=mysql_query("SELECT languages_lang
|
||||||
|
FROM judges_languages
|
||||||
|
WHERE judges_id='$id'");
|
||||||
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
$j['language'][$r->languages_lang] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
print_r($j);
|
||||||
|
|
||||||
|
return $j;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -72,6 +72,7 @@ if(!$icon_extension)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class
|
* The main class
|
||||||
* @package tableeditor
|
* @package tableeditor
|
||||||
@ -90,6 +91,7 @@ class TableEditor
|
|||||||
var $fieldOptions=array();
|
var $fieldOptions=array();
|
||||||
var $fieldValidation=array();
|
var $fieldValidation=array();
|
||||||
var $fieldDefaults=array();
|
var $fieldDefaults=array();
|
||||||
|
var $fieldInputType=array();
|
||||||
var $fieldInputOptions=array();
|
var $fieldInputOptions=array();
|
||||||
var $fieldFilterList=array();
|
var $fieldFilterList=array();
|
||||||
var $actionButtons=array();
|
var $actionButtons=array();
|
||||||
@ -252,6 +254,11 @@ class TableEditor
|
|||||||
$this->fieldDefaults[$f]=$v;
|
$this->fieldDefaults[$f]=$v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFieldInputType($f, $t)
|
||||||
|
{
|
||||||
|
$this->fieldInputType[$f]=$t;
|
||||||
|
}
|
||||||
|
|
||||||
function setFieldInputOptions($f,$o)
|
function setFieldInputOptions($f,$o)
|
||||||
{
|
{
|
||||||
$this->fieldInputOptions[$f]=$o;
|
$this->fieldInputOptions[$f]=$o;
|
||||||
@ -293,6 +300,101 @@ class TableEditor
|
|||||||
$this->DEBUG=$d;
|
$this->DEBUG=$d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFieldType($f)
|
||||||
|
{
|
||||||
|
$inputtype = '';
|
||||||
|
$inputmaxlen = 0;
|
||||||
|
$inputsize = 0;
|
||||||
|
|
||||||
|
//figure out what kind of input this should be
|
||||||
|
$q=mysql_query("SHOW COLUMNS FROM `{$this->table}` LIKE '$f'");
|
||||||
|
$r=mysql_fetch_object($q);
|
||||||
|
|
||||||
|
if(ereg("([a-z]*)\(([0-9,]*)\)",$r->Type,$regs))
|
||||||
|
{
|
||||||
|
switch($regs[1])
|
||||||
|
{
|
||||||
|
case "varchar":
|
||||||
|
$inputtype="text";
|
||||||
|
$inputmaxlen=$regs[2];
|
||||||
|
if($regs[2]>50) $inputsize=50; else $inputsize=$regs[2];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "int":
|
||||||
|
$inputtype="text";
|
||||||
|
$inputmaxlen=10;
|
||||||
|
$inputsize=10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "decimal":
|
||||||
|
$inputtype="text";
|
||||||
|
$inputmaxlen=10;
|
||||||
|
$inputsize=10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "tinyint":
|
||||||
|
$inputtype="text";
|
||||||
|
$inputmaxlen=5;
|
||||||
|
$inputsize=4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$inputtype="text";
|
||||||
|
$inputmaxlen=$regs[2];
|
||||||
|
if($regs[2]>50) $inputsize=50; else $inputsize=$regs[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(ereg("([a-z]*)",$r->Type,$regs))
|
||||||
|
{
|
||||||
|
switch($regs[1])
|
||||||
|
{
|
||||||
|
case "text":
|
||||||
|
$inputtype="textarea";
|
||||||
|
break;
|
||||||
|
case "date":
|
||||||
|
$inputtype="date";
|
||||||
|
break;
|
||||||
|
case "time":
|
||||||
|
$inputtype="time";
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
//an enum is a select box, but we already know what the options should be
|
||||||
|
//so rip out the options right now and add them
|
||||||
|
$inputtype="select";
|
||||||
|
$enums=substr(ereg_replace("'","",$r->Type),5,-1);
|
||||||
|
$toks=split(",",$enums);
|
||||||
|
foreach($toks as $tok)
|
||||||
|
{
|
||||||
|
$this->fieldOptions[$f][]=$tok;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(substr($f,0,4)=="sel_")
|
||||||
|
{
|
||||||
|
$inputtype="select_or_text";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(substr($f,0,8)=="filename" && $this->uploadPath)
|
||||||
|
{
|
||||||
|
$inputtype="file";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(array_key_exists($f,$this->fieldOptions))
|
||||||
|
{
|
||||||
|
//only change to select if the type is not select_or_Text
|
||||||
|
//if we are already select or text, then the options will appear
|
||||||
|
//first in the list, then any options that arent there by default
|
||||||
|
//will appear under them in the dropdown
|
||||||
|
if($inputtype!="select_or_text")
|
||||||
|
$inputtype="select";
|
||||||
|
}
|
||||||
|
return array($inputtype, $inputmaxlen, $inputsize);
|
||||||
|
}
|
||||||
|
|
||||||
function execute()
|
function execute()
|
||||||
{
|
{
|
||||||
if($_GET['TableEditorAction']=="sort" && $_GET['sort'])
|
if($_GET['TableEditorAction']=="sort" && $_GET['sort'])
|
||||||
@ -569,7 +671,7 @@ class TableEditor
|
|||||||
if(count($this->fieldDefaults))
|
if(count($this->fieldDefaults))
|
||||||
{
|
{
|
||||||
foreach($this->fieldDefaults AS $f=>$n)
|
foreach($this->fieldDefaults AS $f=>$n)
|
||||||
$editdata->$f=$n;
|
$editdata[$f]=$n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($action=="edit")
|
else if($action=="edit")
|
||||||
@ -577,14 +679,17 @@ class TableEditor
|
|||||||
echo "<h2>".i18n("Edit %1",array($this->recordType))."</h2>";
|
echo "<h2>".i18n("Edit %1",array($this->recordType))."</h2>";
|
||||||
echo "<input type=\"hidden\" name=\"TableEditorAction\" value=\"editsave\">";
|
echo "<input type=\"hidden\" name=\"TableEditorAction\" value=\"editsave\">";
|
||||||
echo "<input type=\"hidden\" name=\"editsave\" value=\"{$_GET['edit']}\">";
|
echo "<input type=\"hidden\" name=\"editsave\" value=\"{$_GET['edit']}\">";
|
||||||
$query="SELECT {$this->primaryKey}";
|
$person = new $this->classname();
|
||||||
|
$e = $person->load($_GET['edit']);
|
||||||
|
/* $query="SELECT {$this->primaryKey}";
|
||||||
foreach($this->editfields AS $f=>$n)
|
foreach($this->editfields AS $f=>$n)
|
||||||
$query.=", `$f`";
|
$query.=", `$f`";
|
||||||
$query.=" FROM `{$this->table}`";
|
$query.=" FROM `{$this->table}`";
|
||||||
$query.=" WHERE {$this->primaryKey}='{$_GET['edit']}'";
|
$query.=" WHERE {$this->primaryKey}='{$_GET['edit']}'";
|
||||||
if($this->DEBUG) echo $query;
|
if($this->DEBUG) echo $query;
|
||||||
$editquery=mysql_query($query);
|
$editquery=mysql_query($query);
|
||||||
$editdata=mysql_fetch_object($editquery);
|
$editdata=mysql_fetch_object($editquery);*/
|
||||||
|
$editdata = $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<table class=\"tableedit\">";
|
echo "<table class=\"tableedit\">";
|
||||||
@ -592,107 +697,30 @@ class TableEditor
|
|||||||
{
|
{
|
||||||
echo "<tr><th valign=\"top\">".i18n($n)."</th><td>";
|
echo "<tr><th valign=\"top\">".i18n($n)."</th><td>";
|
||||||
|
|
||||||
//figure out what kind of input this should be
|
/* If we know the input type, assume the user knows what they are doing, else,
|
||||||
$q=mysql_query("SHOW COLUMNS FROM `{$this->table}` LIKE '$f'");
|
* try to query it from the databse */
|
||||||
$r=mysql_fetch_object($q);
|
if(isset($this->fieldInputType[$f])) {
|
||||||
|
$inputtype = $this->fieldInputType[$f];
|
||||||
if(ereg("([a-z]*)\(([0-9,]*)\)",$r->Type,$regs))
|
$inputmaxlen = 0; // FIXME
|
||||||
{
|
$inputsize = 0; // FIXME
|
||||||
switch($regs[1])
|
} else {
|
||||||
{
|
list($inputtype, $inputmaxlen, $inputsize) = $this->getFieldType($f);
|
||||||
case "varchar":
|
|
||||||
$inputtype="text";
|
|
||||||
$inputmaxlen=$regs[2];
|
|
||||||
if($regs[2]>50) $inputsize=50; else $inputsize=$regs[2];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "int":
|
|
||||||
$inputtype="text";
|
|
||||||
$inputmaxlen=10;
|
|
||||||
$inputsize=10;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "decimal":
|
|
||||||
$inputtype="text";
|
|
||||||
$inputmaxlen=10;
|
|
||||||
$inputsize=10;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "tinyint":
|
|
||||||
$inputtype="text";
|
|
||||||
$inputmaxlen=5;
|
|
||||||
$inputsize=4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$inputtype="text";
|
|
||||||
$inputmaxlen=$regs[2];
|
|
||||||
if($regs[2]>50) $inputsize=50; else $inputsize=$regs[2];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(ereg("([a-z]*)",$r->Type,$regs))
|
|
||||||
{
|
|
||||||
switch($regs[1])
|
|
||||||
{
|
|
||||||
case "text":
|
|
||||||
$inputtype="textarea";
|
|
||||||
break;
|
|
||||||
case "date":
|
|
||||||
$inputtype="date";
|
|
||||||
break;
|
|
||||||
case "time":
|
|
||||||
$inputtype="time";
|
|
||||||
break;
|
|
||||||
case "enum":
|
|
||||||
//an enum is a select box, but we already know what the options should be
|
|
||||||
//so rip out the options right now and add them
|
|
||||||
$inputtype="select";
|
|
||||||
$enums=substr(ereg_replace("'","",$r->Type),5,-1);
|
|
||||||
$toks=split(",",$enums);
|
|
||||||
foreach($toks as $tok)
|
|
||||||
{
|
|
||||||
$this->fieldOptions[$f][]=$tok;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(substr($f,0,4)=="sel_")
|
|
||||||
{
|
|
||||||
$inputtype="select_or_text";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(substr($f,0,8)=="filename" && $this->uploadPath)
|
|
||||||
{
|
|
||||||
$inputtype="file";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(array_key_exists($f,$this->fieldOptions))
|
|
||||||
{
|
|
||||||
//only change to select if the type is not select_or_Text
|
|
||||||
//if we are already select or text, then the options will appear
|
|
||||||
//first in the list, then any options that arent there by default
|
|
||||||
//will appear under them in the dropdown
|
|
||||||
if($inputtype!="select_or_text")
|
|
||||||
$inputtype="select";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($inputtype)
|
switch($inputtype)
|
||||||
{
|
{
|
||||||
case "text":
|
case "text":
|
||||||
if($this->fieldInputOptions[$f])
|
if($this->fieldInputOptions[$f])
|
||||||
echo "<input type=\"text\" ".$this->fieldInputOptions[$f]." id=\"$f\" name=\"$f\" value=\"".htmlspecialchars($editdata->$f)."\"/>";
|
echo "<input type=\"text\" ".$this->fieldInputOptions[$f]." id=\"$f\" name=\"$f\" value=\"".htmlspecialchars($editdata[$f])."\"/>";
|
||||||
else
|
else
|
||||||
echo "<input type=\"text\" size=\"$inputsize\" maxlength=\"$inputmaxlen\" id=\"$f\" name=\"$f\" value=\"".htmlspecialchars($editdata->$f)."\"/>";
|
echo "<input type=\"text\" size=\"$inputsize\" maxlength=\"$inputmaxlen\" id=\"$f\" name=\"$f\" value=\"".htmlspecialchars($editdata[$f])."\"/>";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "textarea":
|
case "textarea":
|
||||||
if($this->fieldInputOptions[$f])
|
if($this->fieldInputOptions[$f])
|
||||||
echo "<textarea id=\"$f\" name=\"$f\" ".$this->fieldInputOptions[$f].">".htmlspecialchars($editdata->$f)."</textarea>";
|
echo "<textarea id=\"$f\" name=\"$f\" ".$this->fieldInputOptions[$f].">".htmlspecialchars($editdata[$f])."</textarea>";
|
||||||
else
|
else
|
||||||
echo "<textarea id=\"$f\" name=\"$f\" rows=\"5\" cols=\"50\">".htmlspecialchars($editdata->$f)."</textarea>";
|
echo "<textarea id=\"$f\" name=\"$f\" rows=\"5\" cols=\"50\">".htmlspecialchars($editdata[$f])."</textarea>";
|
||||||
break;
|
break;
|
||||||
case "select":
|
case "select":
|
||||||
if($this->fieldInputOptions[$f])
|
if($this->fieldInputOptions[$f])
|
||||||
@ -705,12 +733,12 @@ class TableEditor
|
|||||||
{
|
{
|
||||||
if(is_array($opt))
|
if(is_array($opt))
|
||||||
{
|
{
|
||||||
if($opt['key'] == $editdata->$f) $sel="selected=\"selected\""; else $sel="";
|
if($opt['key'] == $editdata[$f]) $sel="selected=\"selected\""; else $sel="";
|
||||||
echo "<option $sel value=\"".$opt['key']."\">".i18n($opt['val'])."</option>\n";
|
echo "<option $sel value=\"".$opt['key']."\">".i18n($opt['val'])."</option>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($opt == $editdata->$f) $sel="selected=\"selected\""; else $sel="";
|
if($opt == $editdata[$f]) $sel="selected=\"selected\""; else $sel="";
|
||||||
echo "<option $sel value=\"".$opt."\">".i18n($opt)."</option>\n";
|
echo "<option $sel value=\"".$opt."\">".i18n($opt)."</option>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,7 +759,7 @@ class TableEditor
|
|||||||
{
|
{
|
||||||
foreach($this->fieldOptions[$f] AS $opt)
|
foreach($this->fieldOptions[$f] AS $opt)
|
||||||
{
|
{
|
||||||
if($opt == $editdata->$f) $sel="selected=\"selected\""; else $sel="";
|
if($opt == $editdata[$f]) $sel="selected=\"selected\""; else $sel="";
|
||||||
echo "<option $sel value=\"".$opt."\">".i18n($opt)."</option>\n";
|
echo "<option $sel value=\"".$opt."\">".i18n($opt)."</option>\n";
|
||||||
}
|
}
|
||||||
echo "<option value=\"\">-------------</option>";
|
echo "<option value=\"\">-------------</option>";
|
||||||
@ -743,7 +771,7 @@ class TableEditor
|
|||||||
if(is_array($this->fieldOptions[$f]) && in_array($opt->$f,$this->fieldOptions[$f]))
|
if(is_array($this->fieldOptions[$f]) && in_array($opt->$f,$this->fieldOptions[$f]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if($opt->$f == $editdata->$f) $sel="selected=\"selected\""; else $sel="";
|
if($opt->$f == $editdata[$f]) $sel="selected=\"selected\""; else $sel="";
|
||||||
echo "<option $sel value=\"".$opt->$f."\">".i18n($opt->$f)."</option>\n";
|
echo "<option $sel value=\"".$opt->$f."\">".i18n($opt->$f)."</option>\n";
|
||||||
}
|
}
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
@ -756,8 +784,20 @@ class TableEditor
|
|||||||
else
|
else
|
||||||
echo "<input type=\"text\" size=\"$inputsize\" maxlength=\"$inputmaxlen\" id=\"".$f."_text\" name=\"".$f."_text\" value=\"\" />";
|
echo "<input type=\"text\" size=\"$inputsize\" maxlength=\"$inputmaxlen\" id=\"".$f."_text\" name=\"".$f."_text\" value=\"\" />";
|
||||||
break;
|
break;
|
||||||
|
case "multicheck":
|
||||||
|
$ks = array_keys($this->fieldOptions[$f]);
|
||||||
|
foreach($ks as $k) {
|
||||||
|
if(array_key_exists($k, $editdata[$f])) {
|
||||||
|
$ch = ' checked=checked ';
|
||||||
|
} else {
|
||||||
|
$ch = '';
|
||||||
|
}
|
||||||
|
echo "<input type=\"checkbox\" name=\"{$f}_text\" value=\"\" $ch> {$this->fieldOptions[$f][$k]}<br>";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "date":
|
case "date":
|
||||||
list($yy,$mm,$dd)=split("-",$editdata->$f);
|
list($yy,$mm,$dd)=split("-",$editdata[$f]);
|
||||||
|
|
||||||
//if we put a small width here, then it prevents it from expanding to whatever width it feels like.
|
//if we put a small width here, then it prevents it from expanding to whatever width it feels like.
|
||||||
echo "<table width=\"10\" align=\"left\" cellspacing=0 cellpadding=0>";
|
echo "<table width=\"10\" align=\"left\" cellspacing=0 cellpadding=0>";
|
||||||
@ -773,7 +813,7 @@ class TableEditor
|
|||||||
|
|
||||||
|
|
||||||
case "time":
|
case "time":
|
||||||
list($hh,$mm,$ss)=split(":",$editdata->$f);
|
list($hh,$mm,$ss)=split(":",$editdata[$f]);
|
||||||
|
|
||||||
echo "<table width=\"10\" cellspacing=0 cellpadding=0>";
|
echo "<table width=\"10\" cellspacing=0 cellpadding=0>";
|
||||||
echo "<tr><td class=\"tableedit\">";
|
echo "<tr><td class=\"tableedit\">";
|
||||||
@ -784,24 +824,24 @@ class TableEditor
|
|||||||
echo "</table>";
|
echo "</table>";
|
||||||
break;
|
break;
|
||||||
case "file":
|
case "file":
|
||||||
if($editdata->$f)
|
if($editdata[$f])
|
||||||
{
|
{
|
||||||
if(file_exists($this->uploadPath."/".$editdata->$f))
|
if(file_exists($this->uploadPath."/".$editdata[$f]))
|
||||||
{
|
{
|
||||||
//only show a link to the file if the upload path is inside the document root
|
//only show a link to the file if the upload path is inside the document root
|
||||||
if(strstr(realpath($this->uploadPath),$_SERVER['DOCUMENT_ROOT']))
|
if(strstr(realpath($this->uploadPath),$_SERVER['DOCUMENT_ROOT']))
|
||||||
{
|
{
|
||||||
echo "<A href=\"{$this->uploadPath}/{$editdata->$f}\">{$editdata->$f}</a>";
|
echo "<A href=\"{$this->uploadPath}/{$editdata[$f]}\">{$editdata[$f]}</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo $editdata->$f;
|
echo $editdata[$f];
|
||||||
}
|
}
|
||||||
echo " (".filesize($this->uploadPath."/".$editdata->$f)." bytes) <input type=\"checkbox\" name=\"clear[]\" value=\"$f\">delete<br />";
|
echo " (".filesize($this->uploadPath."/".$editdata[$f])." bytes) <input type=\"checkbox\" name=\"clear[]\" value=\"$f\">delete<br />";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo $editdata->$f." (does not exist)<br />";
|
echo $editdata[$f]." (does not exist)<br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "<input type=\"file\" ".$this->fieldInputOptions[$f]." id=\"$f\" name=\"$f\" />";
|
echo "<input type=\"file\" ".$this->fieldInputOptions[$f]." id=\"$f\" name=\"$f\" />";
|
||||||
@ -810,7 +850,7 @@ class TableEditor
|
|||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
echo "<input type=\"text\" id=\"$f\" name=\"$f\" value=\"".htmlspecialchars($editdata->$f)."\"/>";
|
echo "<input type=\"text\" id=\"$f\" name=\"$f\" value=\"".htmlspecialchars($editdata[$f])."\"/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
@ -1009,7 +1049,7 @@ class TableEditor
|
|||||||
{
|
{
|
||||||
echo "<td valign=\"top\">";
|
echo "<td valign=\"top\">";
|
||||||
//only show a link to the file if the upload path is inside the document root
|
//only show a link to the file if the upload path is inside the document root
|
||||||
if(strstr(realpath($this->uploadPath),$_SERVER['DOCUMENT_ROOT']) && file_exists($this->uploadPath."/".$editdata->$f))
|
if(strstr(realpath($this->uploadPath),$_SERVER['DOCUMENT_ROOT']) && file_exists($this->uploadPath."/".$editdata[$f]))
|
||||||
{
|
{
|
||||||
echo "<A href=\"{$this->uploadPath}/{$r->$f}\">{$r->$f}</a>";
|
echo "<A href=\"{$this->uploadPath}/{$r->$f}\">{$r->$f}</a>";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user