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 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) (limited to 'code/admin/add.php') 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 @@ ?>
- +

- +
- +
-- cgit v1.2.3