From 77cc35dfb4207d5110a2ed49487dc0174fd1823a Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sun, 2 Dec 2007 21:13:47 +0000 Subject: [PATCH] fixes #9 addresses #18 addresses #17 * create an english translation of the templates * change the template directory for smarty depending on the language * move existing templates to german subdirectory --- admin/common.inc.php | 27 +++++++++- admin/templates/{ => de}/directories.html | 2 +- admin/templates/de/error.html | 36 +++++++++++++ admin/templates/{ => de}/error.xml | 0 admin/templates/{ => de}/footer.html | 0 admin/templates/{ => de}/header.html | 0 admin/templates/{ => de}/start.html | 0 admin/templates/{ => de}/users.html | 2 +- admin/templates/en/directories.html | 66 +++++++++++++++++++++++ admin/templates/{ => en}/error.html | 0 admin/templates/en/error.xml | 28 ++++++++++ admin/templates/en/footer.html | 28 ++++++++++ admin/templates/en/header.html | 37 +++++++++++++ admin/templates/en/start.html | 35 ++++++++++++ admin/templates/en/users.html | 64 ++++++++++++++++++++++ 15 files changed, 322 insertions(+), 3 deletions(-) rename admin/templates/{ => de}/directories.html (97%) create mode 100644 admin/templates/de/error.html rename admin/templates/{ => de}/error.xml (100%) rename admin/templates/{ => de}/footer.html (100%) rename admin/templates/{ => de}/header.html (100%) rename admin/templates/{ => de}/start.html (100%) rename admin/templates/{ => de}/users.html (94%) create mode 100644 admin/templates/en/directories.html rename admin/templates/{ => en}/error.html (100%) create mode 100644 admin/templates/en/error.xml create mode 100644 admin/templates/en/footer.html create mode 100644 admin/templates/en/header.html create mode 100644 admin/templates/en/start.html create mode 100644 admin/templates/en/users.html diff --git a/admin/common.inc.php b/admin/common.inc.php index 0c29f1b..3aba89f 100644 --- a/admin/common.inc.php +++ b/admin/common.inc.php @@ -38,7 +38,32 @@ require_once("smarty/libs/Smarty.class.php"); /** Global Smarty template engine instance. */ $smarty = new Smarty(); -$smarty->compile_dir = $davconfig['compile_dir']; + +// negotiate the correct template_dir +if (is_dir(($dir = realpath(implode(DIRECTORY_SEPARATOR, + array($smarty->template_dir, + $_SESSION["language"])))))) { + $smarty->template_dir = $dir; +} else if (is_dir(($dir = realpath(implode(DIRECTORY_SEPARATOR, + array($smarty->template_dir, + substr($_SESSION["language"], + 0, 2))))))) { + $smarty->template_dir = $dir; +} else { + _server_error(sprintf(_("Could not find one of the language directories!\n%s,\n%s"), + implode(DIRECTORY_SEPARATOR, + array($smarty->template_dir, + $_SESSION["language"])), + implode(DIRECTORY_SEPARATOR, + array($smarty->template_dir, + substr($_SESSION["language"], 0, 2))))); +} +$compile_dir = implode(DIRECTORY_SEPARATOR, array($davconfig['compile_dir'], + $_SESSION["language"])); +if (!is_dir($compile_dir)) { + mkdir($compile_dir); +} +$smarty->compile_dir = $compile_dir; /** Handle invalid requests to the application. */ function invalidCall() { diff --git a/admin/templates/directories.html b/admin/templates/de/directories.html similarity index 97% rename from admin/templates/directories.html rename to admin/templates/de/directories.html index c3a148c..89d61a2 100644 --- a/admin/templates/directories.html +++ b/admin/templates/de/directories.html @@ -56,7 +56,7 @@
Gruppen
Die Gruppenberechtigungen dieses Verzeichnisses bearbeiten
löschen
-
Diese Verzeichnis löschen
+
Dieses Verzeichnis löschen
neu
Neues Verzeichnis anlegen
diff --git a/admin/templates/de/error.html b/admin/templates/de/error.html new file mode 100644 index 0000000..0176033 --- /dev/null +++ b/admin/templates/de/error.html @@ -0,0 +1,36 @@ +{* + * Error page template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} + + + DAVAdmin - Ein Fehler ist aufgetreten + + +

DAVAdmin - Ein Fehler ist aufgetreten

+

{$errormsg}

+ + \ No newline at end of file diff --git a/admin/templates/error.xml b/admin/templates/de/error.xml similarity index 100% rename from admin/templates/error.xml rename to admin/templates/de/error.xml diff --git a/admin/templates/footer.html b/admin/templates/de/footer.html similarity index 100% rename from admin/templates/footer.html rename to admin/templates/de/footer.html diff --git a/admin/templates/header.html b/admin/templates/de/header.html similarity index 100% rename from admin/templates/header.html rename to admin/templates/de/header.html diff --git a/admin/templates/start.html b/admin/templates/de/start.html similarity index 100% rename from admin/templates/start.html rename to admin/templates/de/start.html diff --git a/admin/templates/users.html b/admin/templates/de/users.html similarity index 94% rename from admin/templates/users.html rename to admin/templates/de/users.html index 228341c..f48ca6a 100644 --- a/admin/templates/users.html +++ b/admin/templates/de/users.html @@ -41,7 +41,7 @@ {$user.username} {$user.lastname}, {$user.firstname} - bearbeiten{if !$user.loggedin}löschen{/if} + bearbeiten{if !$user.loggedin}löschen{/if} {/foreach} diff --git a/admin/templates/en/directories.html b/admin/templates/en/directories.html new file mode 100644 index 0000000..9c601b5 --- /dev/null +++ b/admin/templates/en/directories.html @@ -0,0 +1,66 @@ +{* + * Directory page template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} +{include file="header.html" title="Directory management"} + + +
+

WebDAV administration

+

Directory management

+ + + + + +{foreach item=dir from=$directories} + + + + + + +{foreachelse} + +{/foreach} + + + + +
DirectoryGroupsincluded files (count and size)
{$dir.name}{foreach item=group from=$dir.groups name=dirloop}{$group}{if !$smarty.foreach.dirloop.last}, {/if}{/foreach}{$dir.filecount}, {$dir.filesize}Groups{if $dir.maydelete}delete{/if}
there are no directories
new
+

Icon description

+
+
groups
+
Edit this directory's group assignments.
+
delete
+
Delete this directory
+
new
+
Create new directory
+
+ +
+
+{include file="footer.html"} \ No newline at end of file diff --git a/admin/templates/error.html b/admin/templates/en/error.html similarity index 100% rename from admin/templates/error.html rename to admin/templates/en/error.html diff --git a/admin/templates/en/error.xml b/admin/templates/en/error.xml new file mode 100644 index 0000000..9434861 --- /dev/null +++ b/admin/templates/en/error.xml @@ -0,0 +1,28 @@ +{* + * Error XML template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} +{$errormsg} \ No newline at end of file diff --git a/admin/templates/en/footer.html b/admin/templates/en/footer.html new file mode 100644 index 0000000..3f5bc68 --- /dev/null +++ b/admin/templates/en/footer.html @@ -0,0 +1,28 @@ +{* + * Page footer template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} + \ No newline at end of file diff --git a/admin/templates/en/header.html b/admin/templates/en/header.html new file mode 100644 index 0000000..73089fd --- /dev/null +++ b/admin/templates/en/header.html @@ -0,0 +1,37 @@ +{* + * Page header template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} + + +{$smarty.server.SERVER_NAME} - WebDAV administration{if $title} - {$title}{/if} + + + + + + \ No newline at end of file diff --git a/admin/templates/en/start.html b/admin/templates/en/start.html new file mode 100644 index 0000000..16b91a8 --- /dev/null +++ b/admin/templates/en/start.html @@ -0,0 +1,35 @@ +{* + * Start page template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} +{include file="header.html"} +

WebDAV Administration

+

Welcome to the WebDAV administration at {$smarty.server.SERVER_NAME}. You have the following options.

+ +{include file="footer.html"} \ No newline at end of file diff --git a/admin/templates/en/users.html b/admin/templates/en/users.html new file mode 100644 index 0000000..cdc0dc4 --- /dev/null +++ b/admin/templates/en/users.html @@ -0,0 +1,64 @@ +{* + * User page template. + * + * @author Jan Dittberner + * @version $Id$ + * @license GPL + * @package DAVAdmin + * + * Copyright (c) 2007 Jan Dittberner + * + * This file is part of DAVAdmin. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + *} +{include file="header.html" title="User management"} + + + +
+

WebDAV administration

+

User management

+ + + + + +{foreach item=user from=$users} + + + + + +{/foreach} + + + + +
User nameFirst name, last name
{$user.username}{$user.lastname}, {$user.firstname}edit{if !$user.loggedin}delete{/if}
new
+

Icon description

+
+
edit
+
Edit this user's data.
+
delete
+
Delete this user's data.
+
new
+
Create new user
+
+ +
+
+{include file="footer.html"}