From ef40bdc69152658ea6660787f4c1e4283f7fed5f Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sat, 2 Nov 2013 20:32:28 +0100 Subject: CSS fix avec des colonnes qui font réellement 50% + changement ergo pour ajout/suppr page/media MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/admin/add.php | 51 +++++++++++++++++++++++-- code/admin/admin.css | 19 ++++++++-- code/admin/index.php | 26 +++++++------ code/admin/utils.php | 4 +- dist/build_all.sh | 2 +- locale/en_US.po | 104 ++++++++++++++++++++++++++++----------------------- locale/fr_FR.po | 104 ++++++++++++++++++++++++++++----------------------- 7 files changed, 195 insertions(+), 115 deletions(-) diff --git a/code/admin/add.php b/code/admin/add.php index cb2ff16..02622fc 100644 --- a/code/admin/add.php +++ b/code/admin/add.php @@ -2,6 +2,31 @@ require_once('utils.php'); need_auth(); + function add_fold($kind,$path,$name) { + $fullpath=(($kind=='media')?'media/':'content/').$path.'/'.$name; +echo $fullpath . "\n"; + return mkdir($fullpath); + } + + function add_media($path,$name) { + //TODO + } + + function add_page($path,$name) { + if ( $res=add_fold('page',$path,$name) ) { + $props = array( + 'page_template' => 'default', + 'page_layout' => 'article', + 'page_title' => '(missing)', + 'page_description' => '(missing)', + 'page_keywords' => '(missing)' + ); + $ini_path="content/$path/$name/props.ini"; + $res=write_ini_file($props, $ini_path, false); + } + return $res; + } + // 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); @@ -11,9 +36,26 @@ // URL parameter parsing $kind = sanitize($_GET, 'kind', RE_IDENTIFIER_CLEANER, 'page'); /* Could be : page, media */ + $action=sanitize($_GET, 'action', RE_IDENTIFIER_CLEANER, 'preview'); /* Could be : none, add_fold, add_item */ + $path = sanitize($_GET, 'path', RE_RELPATH_CLEANER, ''); + $name = sanitize($_GET, 'name', RE_IDENTIFIER_CLEANER, ''); // Pre-computed because used twice - $page_title = _('Admin') . ' - ' . ( ($kind=='media')?_('Add a media'):_('Add a page') ); + $page_title = _('Admin') . ' - ' . ( ($kind=='media')?_('Add or remove a media'):_('Add or remove a page') ); + + $res=null; + switch ($action) { + case 'add_fold': + $res=add_fold($kind,$path,$name); + break; + case 'add_item': + if ( $kind=='media' ) { + $res=add_media($path,$name); + } else { + $res=add_page($path,$name); + } + break; + } ?> @@ -28,6 +70,7 @@

+
@@ -41,20 +84,20 @@ ?>
- +

- +
- +
diff --git a/code/admin/admin.css b/code/admin/admin.css index f394ef9..6561044 100644 --- a/code/admin/admin.css +++ b/code/admin/admin.css @@ -3,17 +3,30 @@ h1 { font-size:160% } -fieldset { +form { + text-align:center; /* For inner inline blocks */ +} + +span.inline_half { + margin: 0; + padding: 0; display:inline-block; vertical-align: top; - margin: 0.5em; - width:45%; + width:50%; + min-width:28em; + text-align:left; /* Clear parent trick */ +} + +fieldset { + margin: 0 0.5em 0.5em 0.5em; } + fieldset>label { display:inline-block; text-align:right; width: 12em; } + .tree_add { display:block; float:right; diff --git a/code/admin/index.php b/code/admin/index.php index dc10206..8cf1b39 100644 --- a/code/admin/index.php +++ b/code/admin/index.php @@ -26,9 +26,10 @@

+
- +
- +
@@ -45,7 +46,8 @@ - + +

@@ -61,10 +63,10 @@
- +
- +
- +

- - +
@@ -97,7 +99,7 @@
- +
@@ -109,7 +111,9 @@
- +
+ +
diff --git a/code/admin/utils.php b/code/admin/utils.php index 9612535..4db2d2d 100644 --- a/code/admin/utils.php +++ b/code/admin/utils.php @@ -77,8 +77,8 @@ function is_ress($kind, $path) { switch ($kind) { - case 'page': return is_file($path.'/props.ini'); - case 'media': return substr($path, -4)=='.jpg' && is_file($path); + case 'page': return ( is_dir($path) && is_file($path.'/props.ini') ); + case 'media': return ( substr($path, -4)=='.jpg' && is_file($path) ); default : return FALSE; } } diff --git a/dist/build_all.sh b/dist/build_all.sh index 33b3e36..a50fefd 100755 --- a/dist/build_all.sh +++ b/dist/build_all.sh @@ -73,7 +73,7 @@ echo "Adjusting perms..." ( cd $dstbase/$buildname || exit 1 find -type d -print0 | xargs -0r chmod 775 - find admin/ -type d -print0 | xargs -0r chmod 755 + chmod 755 admin/ admin/locale find -type f -name '*.php' -print0 | xargs -0r chmod 755 find -type f \! -name '*.php' -print0 | xargs -0r chmod 644 find admin/content -type f -print0 | xargs -0r chmod 664 diff --git a/locale/en_US.po b/locale/en_US.po index 948a564..02e72b6 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-30 13:58+0100\n" -"PO-Revision-Date: 2013-10-30 13:58+0100\n" +"POT-Creation-Date: 2013-11-02 20:31+0100\n" +"PO-Revision-Date: 2013-11-02 20:31+0100\n" "Last-Translator: Ludovic Pouzenc \n" "Language-Team: \n" "Language: \n" @@ -17,142 +17,152 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SearchPath-0: code\n" -#: code/admin/add.php:16 +#: code/admin/add.php:44 #: code/admin/index.php:13 msgid "Admin" msgstr "Admin" -#: code/admin/add.php:16 -msgid "Add a media" -msgstr "Add a media" +#: code/admin/add.php:44 +msgid "Add or remove a media" +msgstr "Add or remove a media" -#: code/admin/add.php:16 -msgid "Add a page" -msgstr "Add a page" +#: code/admin/add.php:44 +msgid "Add or remove a page" +msgstr "Add or remove a page" -#: code/admin/add.php:32 -#: code/admin/index.php:66 +#: code/admin/add.php:75 +#: code/admin/index.php:68 msgid "Media tree" msgstr "Media tree" -#: code/admin/add.php:32 -#: code/admin/index.php:30 +#: code/admin/add.php:75 +#: code/admin/index.php:31 msgid "Page tree" msgstr "Page tree" -#: code/admin/add.php:46 +#: code/admin/add.php:89 msgid "Selected folder" msgstr "Selected folder" -#: code/admin/add.php:47 +#: code/admin/add.php:90 msgid "Folder path" msgstr "Folder path" -#: code/admin/add.php:48 +#: code/admin/add.php:91 msgid "(choose a folder in the tree)" msgstr "(choose a folder in the tree)" -#: code/admin/add.php:50 +#: code/admin/add.php:93 msgid "New item name" msgstr "New item name" -#: code/admin/add.php:53 -#: code/admin/index.php:46 -#: code/admin/index.php:82 +#: code/admin/add.php:96 +#: code/admin/index.php:47 +#: code/admin/index.php:84 msgid "Actions" msgstr "Actions" -#: code/admin/add.php:54 +#: code/admin/add.php:97 msgid "Add folder" msgstr "Add folder" -#: code/admin/add.php:55 -#: code/admin/index.php:31 +#: code/admin/add.php:98 msgid "Add page" msgstr "Add page" -#: code/admin/add.php:58 +#: code/admin/add.php:101 msgid "Back to admin" msgstr "Back to admin" -#: code/admin/index.php:42 +#: code/admin/index.php:32 +msgid "Add/Delete page" +msgstr "Admin" + +#: code/admin/index.php:43 msgid "Selected page" msgstr "Selected page" -#: code/admin/index.php:43 +#: code/admin/index.php:44 msgid "Page path" msgstr "Page path" -#: code/admin/index.php:44 +#: code/admin/index.php:45 msgid "(choose a page in the tree)" msgstr "(choose a page in the tree)" -#: code/admin/index.php:47 +#: code/admin/index.php:48 msgid "Edit page" msgstr "Edit page" -#: code/admin/index.php:48 +#: code/admin/index.php:49 msgid "Delete page" msgstr "Delete page" -#: code/admin/index.php:52 +#: code/admin/index.php:50 +msgid "Rename page" +msgstr "Rename page" + +#: code/admin/index.php:54 msgid "Page title" msgstr "Page title" -#: code/admin/index.php:55 +#: code/admin/index.php:57 msgid "Page description" msgstr "Page description" -#: code/admin/index.php:58 +#: code/admin/index.php:60 msgid "Page keywords" msgstr "Page keywords" -#: code/admin/index.php:62 -#: code/admin/index.php:98 -#: code/admin/index.php:110 +#: code/admin/index.php:64 +#: code/admin/index.php:100 +#: code/admin/index.php:112 msgid "Save properties" msgstr "Save properties" -#: code/admin/index.php:67 -msgid "Add media" -msgstr "Add media" +#: code/admin/index.php:69 +msgid "Add/Delete media" +msgstr "Add/Delete media" -#: code/admin/index.php:78 +#: code/admin/index.php:80 msgid "Selected Media" msgstr "Selected Media" -#: code/admin/index.php:79 +#: code/admin/index.php:81 msgid "Media path" msgstr "Media path" -#: code/admin/index.php:80 +#: code/admin/index.php:82 msgid "(choose a media in the tree)" msgstr "(choose a media in the tree)" -#: code/admin/index.php:84 +#: code/admin/index.php:86 msgid "Delete media" msgstr "Delete media" -#: code/admin/index.php:88 +#: code/admin/index.php:90 msgid "Media title" msgstr "Media title" -#: code/admin/index.php:91 +#: code/admin/index.php:93 msgid "Media description" msgstr "Media description" -#: code/admin/index.php:102 +#: code/admin/index.php:104 msgid "Site properties" msgstr "Site properties" -#: code/admin/index.php:103 +#: code/admin/index.php:105 msgid "Admin lang" msgstr "Admin lang" -#: code/admin/index.php:106 +#: code/admin/index.php:108 msgid "Default page" msgstr "Default page" +#~ msgid "Add media" +#~ msgstr "Add media" + #~ msgid "Media folder" #~ msgstr "Media folder" diff --git a/locale/fr_FR.po b/locale/fr_FR.po index 7368072..6efef74 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-30 13:58+0100\n" -"PO-Revision-Date: 2013-10-30 13:58+0100\n" +"POT-Creation-Date: 2013-11-02 20:30+0100\n" +"PO-Revision-Date: 2013-11-02 20:31+0100\n" "Last-Translator: Ludovic Pouzenc \n" "Language-Team: \n" "Language: \n" @@ -17,142 +17,152 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SearchPath-0: code\n" -#: code/admin/add.php:16 +#: code/admin/add.php:44 #: code/admin/index.php:13 msgid "Admin" msgstr "Admin" -#: code/admin/add.php:16 -msgid "Add a media" -msgstr "Ajouter un média" +#: code/admin/add.php:44 +msgid "Add or remove a media" +msgstr "Ajouter ou supprimer un média" -#: code/admin/add.php:16 -msgid "Add a page" -msgstr "Ajouter une page" +#: code/admin/add.php:44 +msgid "Add or remove a page" +msgstr "Ajouter ou supprimer une page" -#: code/admin/add.php:32 -#: code/admin/index.php:66 +#: code/admin/add.php:75 +#: code/admin/index.php:68 msgid "Media tree" msgstr "Arborescence des médias" -#: code/admin/add.php:32 -#: code/admin/index.php:30 +#: code/admin/add.php:75 +#: code/admin/index.php:31 msgid "Page tree" msgstr "Arborescence des pages" -#: code/admin/add.php:46 +#: code/admin/add.php:89 msgid "Selected folder" msgstr "Dossier sélectionné" -#: code/admin/add.php:47 +#: code/admin/add.php:90 msgid "Folder path" msgstr "Chemin du dossier" -#: code/admin/add.php:48 +#: code/admin/add.php:91 msgid "(choose a folder in the tree)" msgstr "(choisir un dossier de l'arbre)" -#: code/admin/add.php:50 +#: code/admin/add.php:93 msgid "New item name" msgstr "Nom nouvel élément" -#: code/admin/add.php:53 -#: code/admin/index.php:46 -#: code/admin/index.php:82 +#: code/admin/add.php:96 +#: code/admin/index.php:47 +#: code/admin/index.php:84 msgid "Actions" msgstr "Actions" -#: code/admin/add.php:54 +#: code/admin/add.php:97 msgid "Add folder" msgstr "Ajouter dossier" -#: code/admin/add.php:55 -#: code/admin/index.php:31 +#: code/admin/add.php:98 msgid "Add page" msgstr "Ajouter page" -#: code/admin/add.php:58 +#: code/admin/add.php:101 msgid "Back to admin" msgstr "Retour à l'admin" -#: code/admin/index.php:42 +#: code/admin/index.php:32 +msgid "Add/Delete page" +msgstr "Ajouter/Supprimer Page" + +#: code/admin/index.php:43 msgid "Selected page" msgstr "Page sélectionnée" -#: code/admin/index.php:43 +#: code/admin/index.php:44 msgid "Page path" msgstr "Chemin de la page" -#: code/admin/index.php:44 +#: code/admin/index.php:45 msgid "(choose a page in the tree)" msgstr "(choisir une page de l'arbre)" -#: code/admin/index.php:47 +#: code/admin/index.php:48 msgid "Edit page" msgstr "Éditer" -#: code/admin/index.php:48 +#: code/admin/index.php:49 msgid "Delete page" msgstr "Supprimer" -#: code/admin/index.php:52 +#: code/admin/index.php:50 +msgid "Rename page" +msgstr "Renommer" + +#: code/admin/index.php:54 msgid "Page title" msgstr "Titre" -#: code/admin/index.php:55 +#: code/admin/index.php:57 msgid "Page description" msgstr "Description" -#: code/admin/index.php:58 +#: code/admin/index.php:60 msgid "Page keywords" msgstr "Mots-clés" -#: code/admin/index.php:62 -#: code/admin/index.php:98 -#: code/admin/index.php:110 +#: code/admin/index.php:64 +#: code/admin/index.php:100 +#: code/admin/index.php:112 msgid "Save properties" msgstr "Sauver les propriétés" -#: code/admin/index.php:67 -msgid "Add media" -msgstr "Ajouter média" +#: code/admin/index.php:69 +msgid "Add/Delete media" +msgstr "Ajouter/Supprimer Média" -#: code/admin/index.php:78 +#: code/admin/index.php:80 msgid "Selected Media" msgstr "Média sélectionné" -#: code/admin/index.php:79 +#: code/admin/index.php:81 msgid "Media path" msgstr "Chemin du media" -#: code/admin/index.php:80 +#: code/admin/index.php:82 msgid "(choose a media in the tree)" msgstr "(choisir un media de l'arbre)" -#: code/admin/index.php:84 +#: code/admin/index.php:86 msgid "Delete media" msgstr "Supprimer" -#: code/admin/index.php:88 +#: code/admin/index.php:90 msgid "Media title" msgstr "Titre" -#: code/admin/index.php:91 +#: code/admin/index.php:93 msgid "Media description" msgstr "Description" -#: code/admin/index.php:102 +#: code/admin/index.php:104 msgid "Site properties" msgstr "Propriétés du site" -#: code/admin/index.php:103 +#: code/admin/index.php:105 msgid "Admin lang" msgstr "Langue outil admin" -#: code/admin/index.php:106 +#: code/admin/index.php:108 msgid "Default page" msgstr "Page par défaut" +#~ msgid "Add media" +#~ msgstr "Ajouter média" + #~ msgid "Media folder" #~ msgstr "Dossier du média" -- cgit v1.2.3