From 0c482df04e1631e12db1fe99e904d6111b17adf1 Mon Sep 17 00:00:00 2001 From: gweltas Date: Sun, 29 Aug 2004 21:22:24 +0000 Subject: Migration of the template of images_infos.php git-svn-id: http://piwigo.org/svn/trunk@506 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/infos_images.php | 162 +++++++++++++++---------------- language/en_UK.iso-8859-1/admin.lang.php | 54 +++++------ template/default/admin/infos_image.vtp | 106 -------------------- template/default/admin/infos_images.tpl | 97 ++++++++++++++++++ 4 files changed, 204 insertions(+), 215 deletions(-) delete mode 100644 template/default/admin/infos_image.vtp create mode 100644 template/default/admin/infos_images.tpl diff --git a/admin/infos_images.php b/admin/infos_images.php index 0cbfb54eb..ad620286f 100644 --- a/admin/infos_images.php +++ b/admin/infos_images.php @@ -51,8 +51,7 @@ if ( isset( $page['cat'] ) ) } else { - $query = 'SELECT id'; - $query.= ' FROM '.PREFIX_TABLE.'categories'; + $query = 'SELECT id FROM '.CATEGORIES_TABLE; $query.= ' WHERE id = '.$_POST['associate']; $query.= ';'; if ( mysql_num_rows( mysql_query( $query ) ) == 0 ) @@ -62,9 +61,8 @@ if ( isset( $page['cat'] ) ) $associate = false; - $query = 'SELECT id,file'; - $query.= ' FROM '.PREFIX_TABLE.'images'; - $query.= ' INNER JOIN '.PREFIX_TABLE.'image_category ON id = image_id'; + $query = 'SELECT id,file FROM '.IMAGES_TABLE; + $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id'; $query.= ' WHERE category_id = '.$page['cat']; $query.= ';'; $result = mysql_query( $query ); @@ -77,9 +75,7 @@ if ( isset( $page['cat'] ) ) $keywords = 'keywords-'.$row['id']; if ( isset( $_POST[$name] ) ) { - $query = 'UPDATE '.PREFIX_TABLE.'images'; - - $query.= ' SET name = '; + $query = 'UPDATE '.IMAGES_TABLE.' SET name = '; if ( $_POST[$name] == '' ) $query.= 'NULL'; else @@ -116,7 +112,7 @@ if ( isset( $page['cat'] ) ) // add link to another category if ( isset( $_POST['check-'.$row['id']] ) and count( $errors ) == 0 ) { - $query = 'INSERT INTO '.PREFIX_TABLE.'image_category'; + $query = 'INSERT INTO '.IMAGE_CATEGORY_TABLE; $query.= ' (image_id,category_id) VALUES'; $query.= ' ('.$row['id'].','.$_POST['associate'].')'; $query.= ';'; @@ -124,18 +120,17 @@ if ( isset( $page['cat'] ) ) $associate = true; } } - update_category( $_POST['associate'] ); + if ( isset( $_POST['associate'] )) update_category( $_POST['associate'] ); if ( $associate ) synchronize_all_users(); //------------------------------------------------------ update general options if ( isset( $_POST['use_common_author'] ) ) { - $query = 'SELECT image_id'; - $query.= ' FROM '.PREFIX_TABLE.'image_category'; + $query = 'SELECT image_id FROM '.IMAGE_CATEGORY_TABLE; $query.= ' WHERE category_id = '.$page['cat']; $result = mysql_query( $query ); while ( $row = mysql_fetch_array( $result ) ) { - $query = 'UPDATE '.PREFIX_TABLE.'images'; + $query = 'UPDATE '.IMAGES_TABLE; if ( $_POST['author_cat'] == '' ) { $query.= ' SET author = NULL'; @@ -155,13 +150,12 @@ if ( isset( $page['cat'] ) ) if ( check_date_format( $_POST['date_creation_cat'] ) ) { $date = date_convert( $_POST['date_creation_cat'] ); - $query = 'SELECT image_id'; - $query.= ' FROM '.PREFIX_TABLE.'image_category'; + $query = 'SELECT image_id FROM '.IMAGE_CATEGORY_TABLE; $query.= ' WHERE category_id = '.$page['cat']; $result = mysql_query( $query ); while ( $row = mysql_fetch_array( $result ) ) { - $query = 'UPDATE '.PREFIX_TABLE.'images'; + $query = 'UPDATE '.IMAGES_TABLE; if ( $_POST['date_creation_cat'] == '' ) { $query.= ' SET date_creation = NULL'; @@ -182,9 +176,8 @@ if ( isset( $page['cat'] ) ) } if ( isset( $_POST['common_keywords'] ) and $_POST['keywords_cat'] != '' ) { - $query = 'SELECT id,keywords'; - $query.= ' FROM '.PREFIX_TABLE.'images'; - $query.= ' INNER JOIN '.PREFIX_TABLE.'image_category ON id = image_id'; + $query = 'SELECT id,keywords FROM '.IMAGES_TABLE; + $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id'; $query.= ' WHERE category_id = '.$page['cat']; $query.= ';'; $result = mysql_query( $query ); @@ -209,8 +202,7 @@ if ( isset( $page['cat'] ) ) // cleaning the keywords array, sometimes, an empty value still remain $keywords = array_remove( $keywords, '' ); // updating the picture with new keywords array - $query = 'UPDATE '.PREFIX_TABLE.'images'; - $query.= ' SET keywords = '; + $query = 'UPDATE '.IMAGES_TABLE.' SET keywords = '; if ( count( $keywords ) == 0 ) { $query.= 'NULL'; @@ -233,8 +225,8 @@ if ( isset( $page['cat'] ) ) } //--------------------------------------------------------- form initialization if( !isset( $_GET['start'] ) - or !is_numeric( $_GET['start'] ) - or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) ) + || !is_numeric( $_GET['start'] ) + || ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) ) { $page['start'] = 0; } @@ -248,41 +240,54 @@ if ( isset( $page['cat'] ) ) $page['start'] = floor( $_GET['num'] / $page['nb_image_page'] ) * $page['nb_image_page']; } - // retrieving category information - $result = get_cat_info( $page['cat'] ); - $cat['name'] = $result['name']; - $cat['nb_images'] = $result['nb_images']; + // Navigation path + $current_category = get_cat_info($_GET['cat_id']); + $url = PHPWG_ROOT_PATH.'admin.php?page=infos_images&cat_id='; + $category_path = get_cat_display_name($current_category['name'], '->', $url); + + $form_action = PHPWG_ROOT_PATH.'admin.php?page=infos_images&cat_id='.$_GET['cat_id']; + if( $page['start']) + { + $form_action.= '&start='.$_GET['start']; + } + + $nav_bar = create_navigation_bar( + $form_action, $current_category['nb_images'],$page['start'], $page['nb_image_page'], '' ); + //----------------------------------------------------- template initialization - $sub = $vtp->Open('./template/'.$user['template'].'/admin/infos_image.vtp'); - $tpl = array( 'infoimage_general','author','infoimage_useforall','submit', - 'infoimage_creation_date','infoimage_detailed','thumbnail', - 'infoimage_title','infoimage_comment', - 'infoimage_creation_date','keywords', - 'infoimage_addtoall','infoimage_removefromall', - 'infoimage_keyword_separation','infoimage_associate', - 'errors_title' ); - templatize_array( $tpl, 'lang', $sub ); - $vtp->setGlobalVar( $sub, 'user_template', $user['template'] ); +$template->set_filenames( array('infos_images'=>'admin/infos_images.tpl') ); +$template->assign_vars(array( + 'CATEGORY'=>$category_path, + 'NAV_BAR'=>$nav_bar, + + 'L_INFOS_TITLE'=>$lang['infoimage_general'], + 'L_AUTHOR'=>$lang['author'], + 'L_INFOS_OVERALL_USE'=>$lang['infoimage_useforall'], + 'L_INFOS_CREATION_DATE'=>$lang['infoimage_creation_date'], + 'L_KEYWORD'=>$lang['keywords'], + 'L_KEYWORD_SEPARATION'=>$lang['infoimage_keyword_separation'], + 'L_INFOS_ADDTOALL'=>$lang['infoimage_addtoall'], + 'L_INFOS_REMOVEFROMALL'=>$lang['infoimage_removefromall'], + 'L_INFOS_DETAIL'=>$lang['infoimage_detailed'], + 'L_THUMBNAIL'=>$lang['thumbnail'], + 'L_INFOS_IMG'=>$lang['infoimage_title'], + 'L_INFOS_COMMENT'=>$lang['comment'], + 'L_INFOS_ASSOCIATE'=>$lang['infoimage_associate'], + 'L_SUBMIT'=>$lang['submit'], + + 'F_ACTION'=>add_session_id($form_action) + )); + //-------------------------------------------------------------- errors display -if ( count( $errors ) != 0 ) +if ( sizeof( $errors ) != 0 ) { - $vtp->addSession( $sub, 'errors' ); - foreach ( $errors as $error ) { - $vtp->addSession( $sub, 'li' ); - $vtp->setVar( $sub, 'li.content', $error ); - $vtp->closeSession( $sub, 'li' ); + $template->assign_block_vars('errors',array()); + for ( $i = 0; $i < sizeof( $errors ); $i++ ) + { + $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i])); } - $vtp->closeSession( $sub, 'errors' ); } //------------------------------------------------------------------------ form - $url = './admin.php?page=infos_images&cat_id='.$page['cat']; - $url.= '&start='.$page['start']; - $vtp->setVar( $sub, 'form_action', add_session_id( $url ) ); - $page['navigation_bar'] = create_navigation_bar( - $url, $cat['nb_images'],$page['start'], $page['nb_image_page'], '' ); - $vtp->setVar( $sub, 'navigation_bar', $page['navigation_bar'] ); - $cat_name = get_cat_display_name( $cat['name'], ' - ', 'font-style:italic;'); - $vtp->setVar( $sub, 'cat_name', $cat_name ); $array_cat_directories = array(); @@ -290,9 +295,8 @@ if ( count( $errors ) != 0 ) ,'date_creation','keywords','storage_category_id' ,'category_id' ); - $query = 'SELECT '.implode( ',', $infos ); - $query.= ' FROM '.PREFIX_TABLE.'images'; - $query.= ' INNER JOIN '.PREFIX_TABLE.'image_category ON id = image_id'; + $query = 'SELECT * FROM '.IMAGES_TABLE; + $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id'; $query.= ' WHERE category_id = '.$page['cat']; $query.= $conf['order_by']; $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page']; @@ -301,56 +305,52 @@ if ( count( $errors ) != 0 ) while ( $row = mysql_fetch_array( $result ) ) { foreach ($infos as $info) { if (!isset($row[$info])) $row[$info] = ''; } - - $vtp->addSession( $sub, 'picture' ); - $vtp->setVar( $sub, 'picture.id', $row['id'] ); - $vtp->setVar( $sub, 'picture.filename', $row['file'] ); - $vtp->setVar( $sub, 'picture.name', $row['name'] ); - $vtp->setVar( $sub, 'picture.author', $row['author'] ); - $vtp->setVar( $sub, 'picture.comment', $row['comment'] ); - $vtp->setVar( $sub, 'picture.keywords', $row['keywords'] ); - $vtp->setVar( $sub, 'picture.date_creation', - date_convert_back( $row['date_creation'] ) ); - $file = get_filename_wo_extension( $row['file'] ); - $vtp->setVar( $sub, 'picture.default_name', $file ); - // creating url to thumbnail - if ( !isset( $array_cat_directories[$row['storage_category_id']] ) ) + if ( !isset( $array_cat_directories[$row['storage_category_id']] ) ) { $array_cat_directories[$row['storage_category_id']] = get_complete_dir( $row['storage_category_id'] ); } $thumbnail_url = $array_cat_directories[$row['storage_category_id']]; $thumbnail_url.= 'thumbnail/'; - $thumbnail_url.= $conf['prefix_thumbnail'].$file.".".$row['tn_ext']; - $vtp->setVar( $sub, 'picture.thumbnail_url', $thumbnail_url ); - $url = './admin.php?page=picture_modify&image_id='.$row['id']; - $vtp->setVar( $sub, 'picture.url', add_session_id( $url ) ); - $vtp->closeSession( $sub, 'picture' ); + $thumbnail_url.= $conf['prefix_thumbnail'].get_filename_wo_extension( $row['file'] ).".".$row['tn_ext']; + + $template->assign_block_vars('picture' ,array( + 'ID_IMG'=>$row['id'], + 'URL_IMG'=>add_session_id( PHPWG_ROOT_PATH.'admin.php?page=picture_modify&image_id='.$row['id'] ), + 'TN_URL_IMG'=>$thumbnail_url, + 'FILENAME_IMG'=>$row['file'], + 'DEFAULTNAME_IMG'=>get_filename_wo_extension( $row['file'] ), + 'NAME_IMG'=>$row['name'], + 'AUTHOR_IMG'=>$row['author'], + 'DATE_IMG'=>date_convert_back( $row['date_creation'] ), + 'KEYWORDS_IMG'=>$row['keywords'], + 'COMMENT_IMG'=>$row['comment'] + )); } + // Virtualy associate a picture to a category // // We only show a List Of Values if the number of categories is less than // $conf['max_LOV_categories'] $query = 'SELECT COUNT(id) AS nb_total_categories'; - $query.= ' FROM '.PREFIX_TABLE.'categories'; - $query.= ';'; + $query.= ' FROM '.CATEGORIES_TABLE.';'; $row = mysql_fetch_array( mysql_query( $query ) ); if ( $row['nb_total_categories'] < $conf['max_LOV_categories'] ) { - $vtp->addSession( $sub, 'associate_LOV' ); + /*$vtp->addSession( $sub, 'associate_LOV' ); $page['plain_structure'] = get_plain_structure( true ); $structure = create_structure( '', array() ); display_categories( $structure, ' ' ); - $vtp->closeSession( $sub, 'associate_LOV' ); + $vtp->closeSession( $sub, 'associate_LOV' );*/ } // else, we only display a small text field, we suppose the administrator // knows the id of its category else { - $vtp->addSession( $sub, 'associate_text' ); - $vtp->closeSession( $sub, 'associate_text' ); + //$vtp->addSession( $sub, 'associate_text' ); + //$vtp->closeSession( $sub, 'associate_text' ); } } //----------------------------------------------------------- sending html code -$vtp->Parse( $handle , 'sub', $sub ); +$template->assign_var_from_handle('ADMIN_CONTENT', 'infos_images'); ?> diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index 710c0d799..6a7afb728 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -216,7 +216,33 @@ $lang['help_access'][2] = '2. On the page of permissions (for a group or a user) if (isset($conf)) $lang['help_infos'][2] = 'If you have any question, do not hesitate to take a look at the forum or ask a question there. The forum (message board) is available on the presentation site of PhpWebGallery.'; +// Image informations +$lang['infoimage_general'] = 'General options for the category'; +$lang['infoimage_useforall'] = 'use for all pictures ?'; +$lang['infoimage_creation_date'] = 'Creation date'; +$lang['infoimage_detailed'] = 'Option for each picture'; +$lang['infoimage_title'] = 'Title'; +$lang['infoimage_keyword_separation'] = '(separate with coma ",")'; +$lang['infoimage_addtoall'] = 'add to all'; +$lang['infoimage_removefromall'] = 'remove from all'; +$lang['infoimage_associate'] = 'Associate to the category'; +// Update +$lang['update_missing_tn'] = 'the thumbnail is missing for'; +$lang['update_disappeared_tn'] = 'the thumbnail disapeared'; +$lang['update_disappeared'] = 'doesn\'t exist'; +$lang['update_part_deletion'] = 'Deletion of images that have no thumbnail or that doesn\'t exist'; +$lang['update_part_research'] = 'Search for new images in the directories'; +$lang['update_research_added'] = 'added'; +$lang['update_research_tn_ext'] = 'thumbnail in'; +$lang['update_nb_new_elements'] = 'elements added in the database'; +$lang['update_nb_del_elements'] = 'elements deleted in the database'; +$lang['update_nb_new_categories'] = 'categories added in the database'; +$lang['update_nb_del_categories'] = 'categories deleted in the database'; +$lang['update_default_title'] = 'Choose an option'; +$lang['update_only_cat'] = 'update categories, not pictures'; +$lang['update_all'] = 'update all'; +$lang['update_sync_metadata_question'] = 'Do you want to synchronize new elements informations with files metadata ?'; $lang['menu_add_user'] = 'add'; $lang['menu_list_user'] = 'list'; @@ -248,30 +274,6 @@ $lang['listuser_button_all'] = 'all'; $lang['listuser_button_invert'] = 'invert'; $lang['listuser_button_create_address'] = 'create mail address'; - - - -$lang['infoimage_general'] = 'General options for the category'; -$lang['infoimage_useforall'] = 'use for all pictures ?'; -$lang['infoimage_creation_date'] = 'creation date'; -$lang['infoimage_detailed'] = 'Option for each picture'; -$lang['infoimage_title'] = 'title'; -$lang['infoimage_comment'] = 'comment'; -$lang['update_missing_tn'] = 'the thumbnail is missing for'; -$lang['update_disappeared_tn'] = 'the thumbnail disapeared'; -$lang['update_disappeared'] = 'doesn\'t exist'; -$lang['update_part_deletion'] = 'Deletion of images that have no thumbnail or that doesn\'t exist'; -$lang['update_part_research'] = 'Search for new images in the directories'; -$lang['update_research_added'] = 'added'; -$lang['update_research_tn_ext'] = 'thumbnail in'; -$lang['update_nb_new_elements'] = 'elements added in the database'; -$lang['update_nb_del_elements'] = 'elements deleted in the database'; -$lang['update_nb_new_categories'] = 'categories added in the database'; -$lang['update_nb_del_categories'] = 'categories deleted in the database'; -$lang['update_default_title'] = 'Choose an option'; -$lang['update_only_cat'] = 'update categories, not pictures'; -$lang['update_all'] = 'update all'; -$lang['update_sync_metadata_question'] = 'Do you want to synchronize new elements informations with files metadata ?'; $lang['tn_width'] = 'width'; $lang['tn_height'] = 'height'; $lang['tn_no_support'] = 'Picture unreachable or no support'; @@ -317,10 +319,6 @@ $lang['group_add_error2'] = 'This name is already used by another group'; $lang['group_confirm'] = 'Are you sure you want to remove this group ?'; $lang['group_list_title'] = 'List of existing groups'; $lang['group_err_unknown'] = 'This group doesn\'t exist in the database'; -$lang['infoimage_keyword_separation'] = '(separate with coma ",")'; -$lang['infoimage_addtoall'] = 'add to all'; -$lang['infoimage_removefromall'] = 'remove from all'; -$lang['infoimage_associate'] = 'Associate to the category'; $lang['stats_pages_seen'] = 'pages seen'; $lang['stats_visitors'] = 'guests'; $lang['stats_empty'] = 'empty history'; diff --git a/template/default/admin/infos_image.vtp b/template/default/admin/infos_image.vtp deleted file mode 100644 index 869b2885b..000000000 --- a/template/default/admin/infos_image.vtp +++ /dev/null @@ -1,106 +0,0 @@ - -
-
{#errors_title}
- -
- -
- - - - - - - - - - - - - - - - - - - -
{#infoimage_general} "{#cat_name}"
{#author}
- - - - {#infoimage_useforall} -
-
{#infoimage_creation_date} [DD/MM/YYYY]
-
- - - - {#infoimage_useforall} -
-
{#keywords} {#infoimage_keyword_separation}
-
- - - - {#infoimage_addtoall} - - {#infoimage_removefromall} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{#infoimage_detailed}
{#navigation_bar}
 {#thumbnail}{#infoimage_title}{#author}{#infoimage_comment}{#infoimage_creation_date}{#keywords}
-
- -
-
{#default_name}
- < - {#infoimage_associate} - - - - - - -
- -
-
\ No newline at end of file diff --git a/template/default/admin/infos_images.tpl b/template/default/admin/infos_images.tpl new file mode 100644 index 000000000..8609c514c --- /dev/null +++ b/template/default/admin/infos_images.tpl @@ -0,0 +1,97 @@ + +
+ +
+ +
+
{L_INFOS_TITLE} "{CATEGORY}"
+ + + + + + + + + + + + + + + + +
{L_AUTHOR}
+ + + + {L_INFOS_OVERALL_USE} +
+
{L_INFOS_CREATION_DATE} [DD/MM/YYYY]
+
+ + + + {L_INFOS_OVERALL_USE} +
+
{L_KEYWORD} {L_KEYWORD_SEPARATION}
+
+ + + + {L_INFOS_ADDTOALL} + + {L_INFOS_REMOVEFROMALL} +
+
+
{L_INFOS_DETAIL}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 {L_THUMBNAIL}{L_INFOS_IMG}{L_AUTHOR}{L_INFOS_COMMENT}{L_INFOS_CREATION_DATE}{L_KEYWORD}
+
+ +
+
{picture.DEFAULTNAME_IMG}
+ < + {L_INFOS_ASSOCIATE} + + + +
+ +
+
\ No newline at end of file -- cgit v1.2.3