From c4409598be84c3bc155f5bb2645b58d14a6a1719 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 7 Jan 2013 15:37:10 +1100 Subject: [PATCH] Minor fixes for VOLUMEs and NODE --- application/classes/Controller/TemplateDefault/View.php | 9 ++++++++- application/classes/Model/NODE.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/application/classes/Controller/TemplateDefault/View.php b/application/classes/Controller/TemplateDefault/View.php index d89c31c..dd7fd69 100644 --- a/application/classes/Controller/TemplateDefault/View.php +++ b/application/classes/Controller/TemplateDefault/View.php @@ -30,7 +30,14 @@ abstract class Controller_TemplateDefault_View extends Controller_TemplateDefaul $select[NULL] = ''; foreach ($o->find_all() as $oo) - $select[$oo->pk()] = $oo->pk(); + // For some tables, are ID is base_64 encoded. + switch ($this->orm) { + case 'VOLUME': $select[base64_encode($oo->pk())] = $oo->pk(); + break; + + default: + $select[$oo->pk()] = $oo->pk(); + } $output .= Form::open(sprintf('%s/detail',strtolower($this->request->controller())),array('id'=>'object_detail')); $output .= sprintf('%s: %s',_('Choose to view'),Form::select('object_name',$select,NULL,array('id'=>'object_name'))); diff --git a/application/classes/Model/NODE.php b/application/classes/Model/NODE.php index 488b187..1dbbe78 100644 --- a/application/classes/Model/NODE.php +++ b/application/classes/Model/NODE.php @@ -512,7 +512,7 @@ class Model_NODE extends ORM_TSM { } public function file_mediaprotection() { - return (int)$this->file_byptype('COPY')/(int)$this->file_byptype('PRIMARY'); + return number_format((int)$this->file_byptype('COPY')/(int)$this->file_byptype('PRIMARY')*100,2); } public function fs() {