Index: branches/unlabeled/unlabeled-1.44.2/kernel/admin_templates/incs/form_blocks.tpl
===================================================================
diff -u -r5518 -r5736
--- branches/unlabeled/unlabeled-1.44.2/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 5518)
+++ branches/unlabeled/unlabeled-1.44.2/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 5736)
@@ -88,6 +88,10 @@
" id="" tabindex="" size="" class="">
+
+ ()
+
+ [upload]" id="[upload]" value="">
|
|
Index: branches/unlabeled/unlabeled-1.1.2/core/kernel/utility/formatters/upload_formatter.php
===================================================================
diff -u -r4950 -r5736
--- branches/unlabeled/unlabeled-1.1.2/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 4950)
+++ branches/unlabeled/unlabeled-1.1.2/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 5736)
@@ -27,8 +27,8 @@
$this->FullPath = FULL_PATH.$this->DestinationPath;
}
- if (getArrayValue($value, 'upload') && getArrayValue($value, 'error') == UPLOAD_ERR_NO_FILE)
- {
+ if (getArrayValue($value, 'upload') && getArrayValue($value, 'error') == UPLOAD_ERR_NO_FILE) {
+ // file was not uploaded this time, but was uploaded before, then use previously uploaded file (from db)
return getArrayValue($value, 'upload');
}
@@ -95,7 +95,32 @@
return $ret;
}
+
+ function Format($value, $field_name, &$object, $format=null)
+ {
+ if ( is_null($value) ) return '';
+ $options = $object->GetFieldOptions($field_name);
+ if ( isset($format) ) $options['format'] = $format;
+ $tc_value = $this->TypeCast($value, $options);
+ if( ($tc_value === false) || ($tc_value != $value) ) return $value; // for leaving badly formatted date on the form
+
+ if (isset($options['format'])) {
+ switch ($options['format']) {
+ case 'full_url':
+ $upload_dir = isset($options['upload_dir']) ? $options['upload_dir'] : $this->DestinationPath;
+ return rtrim($this->Application->BaseURL(), '/').$upload_dir.$tc_value;
+ break;
+
+ default:
+ return sprintf($options['format'], $tc_value);
+ break;
+ }
+ }
+
+ return $tc_value;
+ }
+
function ValidateFileName($path, $name)
{
$parts = pathinfo($name);