From a606fef5aff214f7bbff4290dcd981b2e4a9961f Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 14 Apr 2015 11:36:13 -0400 Subject: [PATCH 1/2] Gracefully handle bad ColReorder deserialization --- airtime_mvc/public/js/airtime/showbuilder/builder.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 139660dd7..3eee4d92f 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -468,9 +468,11 @@ var AIRTIME = (function(AIRTIME){ } a = oData.ColReorder; - for (i = 0, length = a.length; i < length; i++) { - if (typeof(a[i]) === "string") { - a[i] = parseInt(a[i], 10); + if (a) { + for (i = 0, length = a.length; i < length; i++) { + if (typeof(a[i]) === "string") { + a[i] = parseInt(a[i], 10); + } } } From 3695049a6c3a5f4ffbad2355d5372a4913b29274 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 14 Apr 2015 14:35:37 -0400 Subject: [PATCH 2/2] Added Admin_Only decorator and greyed out read-only text-areas --- .../application/forms/helpers/CustomDecorators.php | 14 ++++++++++++++ airtime_mvc/public/css/styles.css | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/forms/helpers/CustomDecorators.php b/airtime_mvc/application/forms/helpers/CustomDecorators.php index f9ad02f8f..43370e7d6 100644 --- a/airtime_mvc/application/forms/helpers/CustomDecorators.php +++ b/airtime_mvc/application/forms/helpers/CustomDecorators.php @@ -12,4 +12,18 @@ class Airtime_Decorator_SuperAdmin_Only extends Zend_Form_Decorator_Abstract return ""; } } +} + +/** Hide a Zend_Form_Element unless you're logged in as an Admin or SuperAdmin. */ +class Airtime_Decorator_Admin_Only extends Zend_Form_Decorator_Abstract +{ + public function render($content) + { + $currentUser = Application_Model_User::getCurrentUser(); + if ($currentUser->isSuperAdmin() || $currentUser->isAdmin()) { + return $content; + } else { + return ""; + } + } } \ No newline at end of file diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index ca50bebd7..3699863ab 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -484,7 +484,7 @@ fieldset.plain { box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; } -input[readonly]{ +input[readonly], textarea[readonly] { background-color:#b1b1b1 }