diff options
author | Ludovic Pouzenc <lpouzenc@gmail.com> | 2013-10-30 00:51:01 +0100 |
---|---|---|
committer | Ludovic Pouzenc <lpouzenc@gmail.com> | 2013-10-30 00:51:01 +0100 |
commit | 97bd9842f44bb25832f5dd8288372f2199cf3b7b (patch) | |
tree | 336f9affdbd5f0a617071ba6058f6872055951bc | |
parent | 6ab5a946d9b512889d19ae041002cd78156c3ffc (diff) | |
download | editablesite-97bd9842f44bb25832f5dd8288372f2199cf3b7b.tar.gz editablesite-97bd9842f44bb25832f5dd8288372f2199cf3b7b.tar.bz2 editablesite-97bd9842f44bb25832f5dd8288372f2199cf3b7b.zip |
Correction de bugs, amélioration titres admin, traductions.
-rw-r--r-- | code/admin/add.php | 11 | ||||
-rw-r--r-- | code/admin/admin.css | 5 | ||||
-rw-r--r-- | code/admin/admin.js | 3 | ||||
-rw-r--r-- | code/admin/index.php | 6 | ||||
-rw-r--r-- | code/admin/render.php | 17 | ||||
-rwxr-xr-x | dist/scripts/po2mo.sh | 14 | ||||
-rw-r--r-- | locale/en_US.po | 114 | ||||
-rw-r--r-- | locale/fr_FR.po | 119 |
8 files changed, 195 insertions, 94 deletions
diff --git a/code/admin/add.php b/code/admin/add.php index c839e0a..0869dd5 100644 --- a/code/admin/add.php +++ b/code/admin/add.php @@ -9,7 +9,11 @@ // Localization Init l10n_init($site_conf['site_admin_lang']); - $kind=sanitize($_GET, 'kind', '/[^a-z_]+/', 'page'); /* Could be : page, media */ + // URL parameter parsing + $kind = sanitize($_GET, 'kind', '/[^a-z_]+/', 'page'); /* Could be : page, media */ + + // Pre-computed because used twice + $page_title = _('Admin') . ' - ' . ( ($kind=='media')?_('Add a media'):_('Add a page') ); ?> <!DOCTYPE html> <html> @@ -18,9 +22,10 @@ <link rel="stylesheet" href="treeview.css"> <link rel="stylesheet" href="admin.css"> <script type="text/javascript" src="admin.js"></script> -<title><?=($kind=='media')?_('Add media'):_('Add page')?></title> +<title><?=$page_title?></title> </head> <body> +<h1><?=$page_title?></h1> <form> <fieldset> @@ -50,6 +55,8 @@ <input id="fold_add_item" type="button" value="<?=_('Add page')?>" onclick="go_add('<?=$kind?>','item');"> </fieldset> +<input id="fold_back_admin" type="button" value="<?=_('Back to admin')?>" onclick="go_admin_page();"> + </form> </body> </html> diff --git a/code/admin/admin.css b/code/admin/admin.css index f01a35d..f394ef9 100644 --- a/code/admin/admin.css +++ b/code/admin/admin.css @@ -1,3 +1,8 @@ +h1 { + text-align:center; + font-size:160% +} + fieldset { display:inline-block; vertical-align: top; diff --git a/code/admin/admin.js b/code/admin/admin.js index 3d0125d..669658d 100644 --- a/code/admin/admin.js +++ b/code/admin/admin.js @@ -91,6 +91,9 @@ function save_site_props() { } // Admin other actions (with page change or refresh) +function go_admin_page() { + document.location = './'; +} function go_add_form(kind) { document.location = 'add.php?kind=' + encodeURIComponent(kind); } diff --git a/code/admin/index.php b/code/admin/index.php index ddb95b3..dc10206 100644 --- a/code/admin/index.php +++ b/code/admin/index.php @@ -8,6 +8,9 @@ // Localization Init l10n_init($site_conf['site_admin_lang']); + + // Pre-computed because used twice + $page_title = _('Admin'); ?> <!DOCTYPE html> <html> @@ -17,9 +20,10 @@ <link rel="stylesheet" href="admin.css"> <script type="text/javascript" src="microajax.minified.js"></script> <script type="text/javascript" src="admin.js"></script> -<title><?=_('Admin')?></title> +<title><?=$page_title?></title> </head> <body> +<h1><?=$page_title?></h1> <form> <fieldset> diff --git a/code/admin/render.php b/code/admin/render.php index 9d4175e..2d49f01 100644 --- a/code/admin/render.php +++ b/code/admin/render.php @@ -1,14 +1,23 @@ <?php require_once('utils.php'); - need_auth(); // Config loading $site_conf = load_ini_site_conf("content/site_conf.ini"); if ( ! is_array($site_conf) ) trigger_error("Error parsing site_conf.ini", E_USER_ERROR); - // URL params clean-up - $action=sanitize($_GET, 'action', '/[^a-z_]+/', 'preview'); /* Could be : preview, edit, publish */ - $page=sanitize($_GET, 'page', '/[^a-z0-9\/]+/', $site_conf['site_default_page']); // Never put \. in this regex + if (PHP_SAPI === 'cli') { + // In cli mode, take args from the command line + $params=array( + 'action' => 'publish', + 'page' => $argv[1] + ); + } else { + // In web mode, take from args from GET request + $params=&$_GET; + } + // params clean-up + $action=sanitize($params, 'action', '/[^a-z_]+/', 'preview'); /* Could be : preview, edit, publish */ + $page=sanitize($params, 'page', '/[^a-z0-9\/]+/', $site_conf['site_default_page']); // Never put \. in this regex // Template vars init ($page, $page_path, $page_props, $page_tpl_url) $page_path = "content/$page"; diff --git a/dist/scripts/po2mo.sh b/dist/scripts/po2mo.sh deleted file mode 100755 index 79f344d..0000000 --- a/dist/scripts/po2mo.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -srcbase=$1 -dstbase=$2 - -echo "Generating locales..." -for f in $(ls $srcbase/*.po) -do - fname=$(basename "$f") - mo_dir="$dstbase"/${fname%%.po}.utf8/LC_MESSAGES - [ -d "$mo_dir" ] || mkdir -p "$mo_dir" - - #echo msgfmt -o "'$mo_dir/editablesite.mo'" "'$f'" - msgfmt -o "$mo_dir/editablesite.mo" "$f" -done diff --git a/locale/en_US.po b/locale/en_US.po index 2ab1692..34155f5 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: EditableSite\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-28 18:16+0100\n" -"PO-Revision-Date: 2013-10-28 18:16+0100\n" +"POT-Creation-Date: 2013-10-29 23:52+0100\n" +"PO-Revision-Date: 2013-10-29 23:53+0100\n" "Last-Translator: Ludovic Pouzenc <lpouzenc@gmail.com>\n" "Language-Team: \n" "Language: \n" @@ -11,100 +11,138 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-KeywordsList: _;gettext;gettext_noop\n" -"X-Poedit-Basepath: /var/www/EditableSite\n" +"X-Poedit-Basepath: /home/lpouzenc/Bureau/editablesite/\n" "X-Poedit-Language: French\n" "X-Poedit-Country: FRANCE\n" "X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-SearchPath-0: admin\n" +"X-Poedit-SearchPath-0: code\n" + +#: code/admin/add.php:21 +#: code/admin/index.php:63 +msgid "Add media" +msgstr "Add media" + +#: code/admin/add.php:21 +#: code/admin/add.php:50 +#: code/admin/index.php:27 +msgid "Add page" +msgstr "Add page" + +#: code/admin/add.php:27 +#: code/admin/index.php:62 +msgid "Media tree" +msgstr "Media tree" + +#: code/admin/add.php:27 +#: code/admin/index.php:26 +msgid "Page tree" +msgstr "Page tree" + +#: code/admin/add.php:41 +msgid "Media folder" +msgstr "Media folder" + +#: code/admin/add.php:41 +msgid "Page folder" +msgstr "Page folder" + +#: code/admin/add.php:42 +msgid "Folder path" +msgstr "Folder path" + +#: code/admin/add.php:43 +msgid "(choose a folder in the tree)" +msgstr "(choose a folder in the tree)" + +#: code/admin/add.php:45 +msgid "New item name" +msgstr "New item name" + +#: code/admin/add.php:48 +#: code/admin/index.php:42 +#: code/admin/index.php:78 +msgid "Actions" +msgstr "Actions" -#: admin/index.php:57 +#: code/admin/add.php:49 +msgid "Add folder" +msgstr "Add folder" + +#: code/admin/index.php:20 msgid "Admin" msgstr "Admin" -#: admin/index.php:63 -msgid "Page Tree" -msgstr "Page Tree" - -#: admin/index.php:72 +#: code/admin/index.php:38 msgid "Selected page" msgstr "Selected page" -#: admin/index.php:73 +#: code/admin/index.php:39 msgid "Page path" msgstr "Page path" -#: admin/index.php:74 +#: code/admin/index.php:40 msgid "(choose a page in the tree)" msgstr "(choose a page in the tree)" -#: admin/index.php:76 -#: admin/index.php:109 -msgid "Actions" -msgstr "Actions" - -#: admin/index.php:77 +#: code/admin/index.php:43 msgid "Edit page" msgstr "Edit page" -#: admin/index.php:78 +#: code/admin/index.php:44 msgid "Delete page" msgstr "Delete page" -#: admin/index.php:82 +#: code/admin/index.php:48 msgid "Page title" msgstr "Page title" -#: admin/index.php:85 +#: code/admin/index.php:51 msgid "Page description" msgstr "Page description" -#: admin/index.php:88 +#: code/admin/index.php:54 msgid "Page keywords" msgstr "Page keywords" -#: admin/index.php:92 -#: admin/index.php:125 -#: admin/index.php:137 +#: code/admin/index.php:58 +#: code/admin/index.php:94 +#: code/admin/index.php:106 msgid "Save properties" msgstr "Save properties" -#: admin/index.php:96 -msgid "Media Tree" -msgstr "Media Tree" - -#: admin/index.php:105 +#: code/admin/index.php:74 msgid "Selected Media" msgstr "Selected Media" -#: admin/index.php:106 +#: code/admin/index.php:75 msgid "Media path" msgstr "Media path" -#: admin/index.php:107 +#: code/admin/index.php:76 msgid "(choose a media in the tree)" msgstr "(choose a media in the tree)" -#: admin/index.php:111 +#: code/admin/index.php:80 msgid "Delete media" msgstr "Delete media" -#: admin/index.php:115 +#: code/admin/index.php:84 msgid "Media title" msgstr "Media title" -#: admin/index.php:118 +#: code/admin/index.php:87 msgid "Media description" msgstr "Media description" -#: admin/index.php:129 +#: code/admin/index.php:98 msgid "Site properties" msgstr "Site properties" -#: admin/index.php:130 +#: code/admin/index.php:99 msgid "Admin lang" msgstr "Admin lang" -#: admin/index.php:133 +#: code/admin/index.php:102 msgid "Default page" msgstr "Default page" diff --git a/locale/fr_FR.po b/locale/fr_FR.po index 665eb43..b9b7383 100644 --- a/locale/fr_FR.po +++ b/locale/fr_FR.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: EditableSite\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-28 18:15+0100\n" -"PO-Revision-Date: 2013-10-28 20:11+0100\n" +"POT-Creation-Date: 2013-10-30 00:26+0100\n" +"PO-Revision-Date: 2013-10-30 00:26+0100\n" "Last-Translator: Ludovic Pouzenc <lpouzenc@gmail.com>\n" "Language-Team: \n" "Language: \n" @@ -11,100 +11,149 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-KeywordsList: _;gettext;gettext_noop\n" -"X-Poedit-Basepath: /var/www/EditableSite\n" +"X-Poedit-Basepath: /home/lpouzenc/Bureau/editablesite/\n" "X-Poedit-Language: French\n" "X-Poedit-Country: FRANCE\n" "X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-SearchPath-0: admin\n" +"X-Poedit-SearchPath-0: code\n" -#: admin/index.php:57 +#: code/admin/add.php:16 +#: code/admin/index.php:13 msgid "Admin" msgstr "Admin" -#: admin/index.php:63 -msgid "Page Tree" +#: code/admin/add.php:16 +msgid "Add a media" +msgstr "Ajouter un média" + +#: code/admin/add.php:16 +msgid "Add a page" +msgstr "Ajouter une page" + +#: code/admin/add.php:32 +#: code/admin/index.php:66 +msgid "Media tree" +msgstr "Arborescence des médias" + +#: code/admin/add.php:32 +#: code/admin/index.php:30 +msgid "Page tree" msgstr "Arborescence des pages" -#: admin/index.php:72 +#: code/admin/add.php:46 +msgid "Media folder" +msgstr "Dossier du média" + +#: code/admin/add.php:46 +msgid "Page folder" +msgstr "Dossier de la page" + +#: code/admin/add.php:47 +msgid "Folder path" +msgstr "Chemin du dossier" + +#: code/admin/add.php:48 +msgid "(choose a folder in the tree)" +msgstr "(choisir un dossier de l'arbre)" + +#: code/admin/add.php:50 +msgid "New item name" +msgstr "Nom nouvel élément" + +#: code/admin/add.php:53 +#: code/admin/index.php:46 +#: code/admin/index.php:82 +msgid "Actions" +msgstr "Actions" + +#: code/admin/add.php:54 +msgid "Add folder" +msgstr "Ajouter dossier" + +#: code/admin/add.php:55 +#: code/admin/index.php:31 +msgid "Add page" +msgstr "Ajouter page" + +#: code/admin/add.php:58 +msgid "Back to admin" +msgstr "Retour à l'admin" + +#: code/admin/index.php:42 msgid "Selected page" msgstr "Page sélectionnée" -#: admin/index.php:73 +#: code/admin/index.php:43 msgid "Page path" msgstr "Chemin de la page" -#: admin/index.php:74 +#: code/admin/index.php:44 msgid "(choose a page in the tree)" msgstr "(choisir une page de l'arbre)" -#: admin/index.php:76 -#: admin/index.php:109 -msgid "Actions" -msgstr "Actions" - -#: admin/index.php:77 +#: code/admin/index.php:47 msgid "Edit page" msgstr "Éditer" -#: admin/index.php:78 +#: code/admin/index.php:48 msgid "Delete page" msgstr "Supprimer" -#: admin/index.php:82 +#: code/admin/index.php:52 msgid "Page title" msgstr "Titre" -#: admin/index.php:85 +#: code/admin/index.php:55 msgid "Page description" msgstr "Description" -#: admin/index.php:88 +#: code/admin/index.php:58 msgid "Page keywords" msgstr "Mots-clés" -#: admin/index.php:92 -#: admin/index.php:125 -#: admin/index.php:137 +#: code/admin/index.php:62 +#: code/admin/index.php:98 +#: code/admin/index.php:110 msgid "Save properties" msgstr "Sauver les propriétés" -#: admin/index.php:96 -msgid "Media Tree" -msgstr "Arborescence des médias" +#: code/admin/index.php:67 +msgid "Add media" +msgstr "Ajouter média" -#: admin/index.php:105 +#: code/admin/index.php:78 msgid "Selected Media" msgstr "Média sélectionné" -#: admin/index.php:106 +#: code/admin/index.php:79 msgid "Media path" msgstr "Chemin du media" -#: admin/index.php:107 +#: code/admin/index.php:80 msgid "(choose a media in the tree)" msgstr "(choisir un media de l'arbre)" -#: admin/index.php:111 +#: code/admin/index.php:84 msgid "Delete media" msgstr "Supprimer" -#: admin/index.php:115 +#: code/admin/index.php:88 msgid "Media title" msgstr "Titre" -#: admin/index.php:118 +#: code/admin/index.php:91 msgid "Media description" msgstr "Description" -#: admin/index.php:129 +#: code/admin/index.php:102 msgid "Site properties" msgstr "Propriétés du site" -#: admin/index.php:130 +#: code/admin/index.php:103 msgid "Admin lang" msgstr "Langue outil admin" -#: admin/index.php:133 +#: code/admin/index.php:106 msgid "Default page" msgstr "Page par défaut" |