ENHANCEMENT Localization of installation success screen

This commit is contained in:
Ingo Schommer 2012-05-03 17:52:33 +02:00
parent d072f715b7
commit 7c25754cb1
4 changed files with 66 additions and 48 deletions

View File

@ -443,28 +443,16 @@ HTML;
@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'),
);
}
@ -472,10 +460,7 @@ HTML
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 @@ HTML
'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 File

@ -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 File

@ -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 File

@ -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>