From fbaf7e22d1c25f66002cb0d07e54b975a87b50dc Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Wed, 23 Oct 2013 22:25:10 +0200 Subject: [PATCH] Dev Show proper error message on template rename if a template under that name already exists --- application/config/config-defaults.php | 2 +- application/controllers/admin/templates.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/application/config/config-defaults.php b/application/config/config-defaults.php index dd6419a9d1c..6d15ae1b80f 100644 --- a/application/config/config-defaults.php +++ b/application/config/config-defaults.php @@ -559,7 +559,7 @@ * Default is 'stable' * @var string */ -$config['updatenotification'] = 'stable'; +$config['updatenotification'] = 'both'; // === Advanced Setup diff --git a/application/controllers/admin/templates.php b/application/controllers/admin/templates.php index c803695a0e9..b8b40c4c5a4 100644 --- a/application/controllers/admin/templates.php +++ b/application/controllers/admin/templates.php @@ -411,8 +411,10 @@ public function templaterename() $olddirname = Yii::app()->getConfig('usertemplaterootdir') . "/" . returnGlobal('copydir'); if (isStandardTemplate(returnGlobal('newname'))) $this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("This name is reserved for standard template.", "js")); + elseif (file_exists($newdirname)) + $this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("A template with that name already exists.", "js")); elseif (rename($olddirname, $newdirname) == false) - $this->getController()->error(sprintf($clang->gT("Directory could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("Maybe you don't have permission.", "js")); + $this->getController()->error(sprintf($clang->gT("Template could not be renamed to `%s`.", "js"), $newname) . " " . $clang->gT("Maybe you don't have permission.", "js")); else { Survey::model()->updateAll(array( 'template' => $newname ), "template = '{$oldname}'" );