Permalink
Browse files

ENHANCEMENT Localization of installation success screen

  • Loading branch information...
1 parent d072f71 commit 7c25754cb1056e51402056982be6a783c9fec87b @chillu chillu committed May 3, 2012
View
65 code/controllers/ContentController.php
@@ -443,39 +443,24 @@ function successfullyinstalled() {
@file_get_contents($url);
}
- $title = new Varchar("Title");
- $content = new HTMLText("Content");
- $username = Convert::raw2xml(Session::get('username'));
- $password = Convert::raw2xml(Session::get('password'));
- $title->setValue("Installation Successful");
global $project;
- $tutorialOnly = ($project == 'tutorial') ? "<p>This website is a simplistic version of a SilverStripe 2 site. To extend this, please take a look at <a href=\"http://doc.silverstripe.org/doku.php?id=tutorials\">our new tutorials</a>.</p>" : '';
- $content->setValue(<<<HTML
- <p style="margin: 1em 0"><b>Congratulations, SilverStripe has been successfully installed.</b></p>
-
- $tutorialOnly
- <p>You can start editing your site's content by opening <a href="admin/">the CMS</a>. <br />
- &nbsp; &nbsp; Email: $username<br />
- &nbsp; &nbsp; Password: $password<br />
- </p>
- <div style="background:#fcf8f2; border-radius:4px; border: 1px solid #ffc28b; padding:5px; margin:5px;"><img src="cms/images/dialogs/alert.gif" style="border: none; margin-right: 10px; float: left; height:48px; width:48px" /><p style="color: #cb6a1c; margin-bottom:0;">For security reasons you should now delete the install files, unless you are planning to reinstall later (<em>requires admin login, see above</em>). The web server also now only needs write access to the "assets" folder, you can remove write access from all other folders. <a href="home/deleteinstallfiles" style="text-align: center;">Click here to delete the install files.</a></p></div>
-HTML
-);
-
+ $data = new ArrayData(array(
+ 'Project' => Convert::raw2xml($project),
+ 'Username' => Convert::raw2xml(Session::get('username')),
+ 'Password' => Convert::raw2xml(Session::get('password')),
+ ));
+
return array(
- "Title" => $title,
- "Content" => $content,
+ "Title" => DBField::create_field('Varchar', "Title", "Installation Successful"),
+ "Content" => $data->renderWith('Install_successfullyinstalled'),
);
}
function deleteinstallfiles() {
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
$title = new Varchar("Title");
- $content = new HTMLText("Content");
- $tempcontent = '';
- $username = Convert::raw2xml(Session::get('username'));
- $password = Convert::raw2xml(Session::get('password'));
+ $content = new HTMLText('Content');
// We can't delete index.php as it might be necessary for URL routing without mod_rewrite.
// There's no safe way to detect usage of mod_rewrite across webservers,
@@ -487,39 +472,23 @@ function deleteinstallfiles() {
'index.html'
);
+ $unsuccessful = new ArrayList();
foreach($installfiles as $installfile) {
if(file_exists(BASE_PATH . '/' . $installfile)) {
@unlink(BASE_PATH . '/' . $installfile);
}
if(file_exists(BASE_PATH . '/' . $installfile)) {
- $unsuccessful[] = $installfile;
+ $unsuccessful->push(new ArrayData(array('File' => $installfile)));
}
}
- if(isset($unsuccessful)) {
- $title->setValue("Unable to delete installation files");
- $tempcontent = "<p style=\"margin: 1em 0\">Unable to delete installation files. Please delete the files below manually:</p><ul>";
- foreach($unsuccessful as $unsuccessfulFile) {
- $tempcontent .= "<li>$unsuccessfulFile</li>";
- }
- $tempcontent .= "</ul>";
- } else {
- $title->setValue("Deleted installation files");
- $tempcontent = <<<HTML
-<p style="margin: 1em 0">Installation files have been successfully deleted.</p>
-HTML
- ;
- }
-
- $tempcontent .= <<<HTML
- <p style="margin: 1em 0">You can start editing your site's content by opening <a href="admin/">the CMS</a>. <br />
- &nbsp; &nbsp; Email: $username<br />
- &nbsp; &nbsp; Password: $password<br />
- </p>
-HTML
- ;
- $content->setValue($tempcontent);
+ $data = new ArrayData(array(
+ 'Username' => Convert::raw2xml(Session::get('username')),
+ 'Password' => Convert::raw2xml(Session::get('password')),
+ 'UnsuccessfulFiles' => $unsuccessful
+ ));
+ $content->setValue($data->renderWith('Install_deleteinstallfiles'));
return array(
"Title" => $title,
View
8 lang/en.yml
@@ -151,11 +151,19 @@ en:
CMS: CMS
DRAFTSITE: 'Draft Site'
DRAFT_SITE_ACCESS_RESTRICTION: 'You must log in with your CMS password in order to view the draft or archived content. <a href="%s">Click here to go back to the published site.</a>'
+ Email: Email
+ InstallFilesDeleted: 'Installation files have been successfully deleted.'
+ InstallSecurityWarning: 'For security reasons you should now delete the install files, unless you are planning to reinstall later (<em>requires admin login, see above</em>). The web server also now only needs write access to the "assets" folder, you can remove write access from all other folders. <a href="{link}" style="text-align: center;">Click here to delete the install files.</a>'
+ InstallSuccessCongratulations: 'SilverStripe has been successfully installed.'
LOGGEDINAS: 'Logged in as'
LOGIN: Login
LOGOUT: 'Log out'
NOTLOGGEDIN: 'Not logged in'
PUBLISHEDSITE: 'Published Site'
+ Password: Password
+ PostInstallTutorialIntro: 'This website is a simplistic version of a SilverStripe 2 site. To extend this, please take a look at {link}.'
+ StartEditing: 'You can start editing your site\''s content by opening <a href="{link}">the CMS</a>.'
+ UnableDeleteInstall: 'Unable to delete installation files. Please delete the files below manually'
VIEWPAGEIN: 'View Page in:'
ErrorPage:
400: '400 - Bad Request'
View
21 templates/Includes/Install_deleteinstallfiles.ss
@@ -0,0 +1,21 @@
+<% if UnsuccessfulFiles %>
+ <p style=\"margin: 1em 0\">
+ <%t ContentController.UnableDeleteInstall "Unable to delete installation files. Please delete the files below manually" %>:
+ </p>
+
+ <ul>
+ <% control UnsuccessfulFiles %>
+ <li>$File</li>
+ <% end_control %>
+ </ul>
+<% else %>
+ <p style="margin: 1em 0">
+ <%t ContentController.InstallFilesDeleted "Installation files have been successfully deleted." %>
+ </p>
+ <p style="margin: 1em 0">
+ <%t ContentController.StartEditing 'You can start editing your site\'s content by opening <a href="{link}">the CMS</a>.' link="admin/" %>.
+ <br />
+ &nbsp; &nbsp; <%t ContentController.Email "Email" %>: $Username<br />
+ &nbsp; &nbsp; <%t ContentController.Password "Password" %>: $Password<br />
+ </p>
+<% end_if %>
View
20 templates/Includes/Install_successfullyinstalled.ss
@@ -0,0 +1,20 @@
+<p style="margin: 1em 0">
+ <b><%t ContentController.InstallSuccessCongratulations "SilverStripe has been successfully installed." %></b>
+</p>
+
+<% if Project == 'tutorial' %>
+ <%t ContentController.PostInstallTutorialIntro 'This website is a simplistic version of a SilverStripe 2 site. To extend this, please take a look at {link}.' link='<a href="http://doc.silverstripe.org/doku.php?id=tutorials">our new tutorials</a>' %>
+<% end_if %>
+
+<p>
+ <%t ContentController.StartEditing 'You can start editing your site\'s content by opening <a href="{link}">the CMS</a>.' link="admin/" %>
+ <br />
+ &nbsp; &nbsp; <%t ContentController.Email "Email" %>: $Username<br />
+ &nbsp; &nbsp; <%t ContentController.Password "Password" %>: $Password<br />
+</p>
+<div style="background:#fcf8f2; border-radius:4px; border: 1px solid #ffc28b; padding:5px; margin:5px;">
+ <img src="cms/images/dialogs/alert.gif" style="border: none; margin-right: 10px; float: left; height:48px; width:48px" />
+ <p style="color: #cb6a1c; margin-bottom:0;">
+ <%t ContentController.InstallSecurityWarning 'For security reasons you should now delete the install files, unless you are planning to reinstall later (<em>requires admin login, see above</em>). The web server also now only needs write access to the "assets" folder, you can remove write access from all other folders. <a href="{link}" style="text-align: center;">Click here to delete the install files.</a>' link="home/deleteinstallfiles" %>
+ </p>
+</div>

0 comments on commit 7c25754

Please sign in to comment.