2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
2008-01-09 05:18:36 +01:00
|
|
|
/**
|
2008-09-28 15:08:56 +02:00
|
|
|
* A field that will upload files to a page for use within the CMS through an iframe.
|
|
|
|
* If you want to upload files without an iframe, use {@link FileField}.
|
|
|
|
*
|
|
|
|
* @used Image_Upload
|
2008-04-06 06:08:03 +02:00
|
|
|
*
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-files
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class FileIFrameField extends FileField {
|
|
|
|
|
|
|
|
public function Field() {
|
|
|
|
$data = $this->form->getRecord();
|
|
|
|
|
2008-08-20 07:10:15 +02:00
|
|
|
if($data && $data->ID && is_numeric($data->ID)) {
|
2007-07-19 12:40:28 +02:00
|
|
|
$idxField = $this->name . 'ID';
|
|
|
|
$hiddenField = "<input type=\"hidden\" id=\"" . $this->id() . "\" name=\"$idxField\" value=\"" . $this->attrValue() . "\" />";
|
|
|
|
|
|
|
|
$parentClass = $data->class;
|
|
|
|
|
|
|
|
$parentID = $data->ID;
|
|
|
|
$parentField = $this->name;
|
2007-11-12 23:20:54 +01:00
|
|
|
$iframe = "<iframe name=\"{$this->name}_iframe\" src=\"images/iframe/$parentClass/$parentID/$parentField\" style=\"height: 152px; width: 600px; border-style: none;\"></iframe>";
|
2007-07-19 12:40:28 +02:00
|
|
|
|
|
|
|
return $iframe . $hiddenField;
|
|
|
|
|
|
|
|
} else {
|
2008-10-31 03:09:04 +01:00
|
|
|
$this->value = _t('FileIFrameField.NOTEADDFILES', 'You can add files once you have saved for the first time.');
|
2007-07-19 12:40:28 +02:00
|
|
|
return FormField::Field();
|
|
|
|
}
|
|
|
|
}
|
2008-04-06 06:08:03 +02:00
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
|
|
|
?>
|