From 1f75bb1180a29145dcabadf01fdcc8beb316e568 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 18 Nov 2020 14:17:26 -0800 Subject: [PATCH] Plugin Builder: improved handling of decimal fields. Added a 'readonly' checkbox to table field options. --- e107_admin/plugin.php | 17 ++++++++++++++--- e107_languages/English/admin/lan_plugin.php | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index 5b9c51d7a..e1dc06a74 100755 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -4573,6 +4573,7 @@ TEMPLATE; function form($table,$fieldArray) { + $frm = e107::getForm(); $modes = array( @@ -4632,8 +4633,10 @@ TEMPLATE; ".EPL_ADLAN_169." ".EPL_ADLAN_170." ".EPL_ADLAN_171." - ".EPL_ADLAN_172." - ".EPL_ADLAN_173." + ".EPL_ADLAN_172." + ".EPL_ADLAN_173." + R/O + ".EPL_ADLAN_174." ".EPL_ADLAN_175." ".EPL_ADLAN_176." @@ -4657,6 +4660,7 @@ TEMPLATE; ".$frm->checkbox($this->table."[fields][".$name."][inline]", true, $this->guess($name, $val,'inline'))." ".$frm->checkbox($this->table."[fields][".$name."][validate]", true)." ".$frm->checkbox($this->table."[fields][".$name."][fieldpref]", true, $this->guess($name, $val,'fieldpref'))." + ".$frm->checkbox($this->table."[fields][".$name."][readonly]", true)." ".$frm->text($this->table."[fields][".$name."][help]",'', 50,'size=medium')." ".$frm->text($this->table."[fields][".$name."][readParms]",'', 60,'size=small')." ".$frm->text($this->table."[fields][".$name."][writeParms]",'', 60,'size=small'). @@ -4739,8 +4743,9 @@ TEMPLATE; case 'decimal': case 'double': case 'float': + $array = array( - "number" => EPL_ADLAN_189, + "number" => EPL_ADLAN_182, "dropdown" => EPL_ADLAN_190, "method" => EPL_ADLAN_191, "hidden" => EPL_ADLAN_192, @@ -5037,6 +5042,10 @@ TEMPLATE; { $value = 'safestr'; } + elseif($type === 'decimal' || $type === 'float') + { + $value = 'float'; + } else { $value = 'int'; @@ -5611,6 +5620,7 @@ $text .= " "'filter' => '0'", "'inline' => '1'", "'validate' => '1'", + "'readonly' => '1'", // ", 'fieldpref' => '1'", "'type' => ''", "'data' => ''", @@ -5629,6 +5639,7 @@ $text .= " "'filter' => false", "'inline' => true", "'validate' => true", + "'readonly' => true", // "", "'type' => null", "'data' => null", diff --git a/e107_languages/English/admin/lan_plugin.php b/e107_languages/English/admin/lan_plugin.php index f0071eb77..7da48c6a4 100644 --- a/e107_languages/English/admin/lan_plugin.php +++ b/e107_languages/English/admin/lan_plugin.php @@ -311,4 +311,6 @@ define("EPL_ADLAN_254", "This will check your plugin's language files for errors define("EPL_ADLAN_255", "Overwrite Files"); define("EPL_ADLAN_256", "Skipped [x] (already exists)"); +define ("EPL_ADLAN_257","Readonly"); +