Skip to content

Commit

Permalink
Dev Show proper error message on template rename if a template under …
Browse files Browse the repository at this point in the history
…that name already exists
  • Loading branch information
c-schmitz committed Oct 23, 2013
1 parent d008906 commit fbaf7e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/config/config-defaults.php
Expand Up @@ -559,7 +559,7 @@
* Default is 'stable'
* @var string
*/
$config['updatenotification'] = 'stable';
$config['updatenotification'] = 'both';


// === Advanced Setup
Expand Down
4 changes: 3 additions & 1 deletion application/controllers/admin/templates.php
Expand Up @@ -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}'" );
Expand Down

0 comments on commit fbaf7e2

Please sign in to comment.