Index: trunk/admin/album.php
===================================================================
--- trunk/admin/album.php (revision 13013)
+++ trunk/admin/album.php (revision 13013)
@@ -0,0 +1,92 @@
+add('properties', l10n('Properties'), $admin_album_base_url.'-properties');
+$tabsheet->add('sort_order', l10n('Manage photo ranks'), $admin_album_base_url.'-sort_order');
+
+if ('private' == $category['status'])
+{
+ $tabsheet->add('permissions', l10n('Permissions'), $admin_album_base_url.'-permissions');
+}
+
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
+// | Load the tab |
+// +-----------------------------------------------------------------------+
+
+if ('properties' == $page['tab'])
+{
+ include(PHPWG_ROOT_PATH.'admin/cat_modify.php');
+}
+elseif ('sort_order' == $page['tab'])
+{
+ include(PHPWG_ROOT_PATH.'admin/element_set_ranks.php');
+}
+elseif ('permissions' == $page['tab'])
+{
+ $_GET['cat'] = $_GET['cat_id'];
+ include(PHPWG_ROOT_PATH.'admin/cat_perm.php');
+}
+else
+{
+ include(PHPWG_ROOT_PATH.'admin/album_'.$page['tab'].'.php');
+}
+?>
Index: trunk/admin/cat_list.php
===================================================================
--- trunk/admin/cat_list.php (revision 13004)
+++ trunk/admin/cat_list.php (revision 13013)
@@ -298,5 +298,5 @@
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
- 'U_EDIT' => $base_url.'cat_modify&cat_id='.$category['id'],
+ 'U_EDIT' => $base_url.'album-'.$category['id'],
'IS_VIRTUAL' => empty($category['dir'])
Index: trunk/admin/cat_modify.php
===================================================================
--- trunk/admin/cat_modify.php (revision 13004)
+++ trunk/admin/cat_modify.php (revision 13013)
@@ -164,5 +164,8 @@
}
- array_push($page['infos'], l10n('Album updated successfully'));
+ // we redirect to hide/show the "permissions" tab if the category status
+ // has changed
+ $_SESSION['page_infos'] = array(l10n('Album updated successfully'));
+ redirect($admin_album_base_url);
}
elseif (isset($_POST['set_random_representant']))
@@ -179,73 +182,5 @@
pwg_query($query);
}
-elseif (isset($_POST['submitAdd']))
-{
- $output_create = create_virtual_category(
- $_POST['virtual_name'],
- (0 == $_POST['parent'] ? null : $_POST['parent'])
- );
-
- if (isset($output_create['error']))
- {
- array_push($page['errors'], $output_create['error']);
- }
- else
- {
- // Virtual album creation succeeded
- //
- // Add the information in the information list
- array_push($page['infos'], $output_create['info']);
-
- // Link the new category to the current category
- associate_categories_to_categories(
- array($_GET['cat_id']),
- array($output_create['id'])
- );
-
- // information
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album photos associated to the following albums: %s'),
- '
- '
- .get_cat_display_name_from_id($output_create['id'])
- .'
'
- )
- );
- }
-}
-elseif (isset($_POST['submitDestinations'])
- and isset($_POST['destinations'])
- and count($_POST['destinations']) > 0)
-{
- associate_categories_to_categories(
- array($_GET['cat_id']),
- $_POST['destinations']
- );
-
- $category_names = array();
- foreach ($_POST['destinations'] as $category_id)
- {
- array_push(
- $category_names,
- get_cat_display_name_from_id($category_id)
- );
- }
-
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album photos associated to the following albums: %s'),
- '- '.implode('
- ', $category_names).'
'
- )
- );
-}
-
-$query = '
-SELECT *
- FROM '.CATEGORIES_TABLE.'
- WHERE id = '.$_GET['cat_id'].'
-;';
-$category = pwg_db_fetch_assoc( pwg_query( $query ) );
+
// nullable fields
foreach (array('comment','dir','site_id', 'id_uppercat') as $nullable)
@@ -269,11 +204,11 @@
$navigation = get_cat_display_name_cache(
$category['uppercats'],
- get_root_url().'admin.php?page=cat_modify&cat_id='
+ get_root_url().'admin.php?page=album-'
);
-$form_action = get_root_url().'admin.php?page=cat_modify&cat_id='.$_GET['cat_id'];
+$form_action = $admin_album_base_url.'-properties';
//----------------------------------------------------- template initialization
-$template->set_filename( 'categories', 'cat_modify.tpl');
+$template->set_filename( 'album_properties', 'cat_modify.tpl');
$base_url = get_root_url().'admin.php?page=';
@@ -304,6 +239,4 @@
),
- 'MAIL_CONTENT' => empty($_POST['mail_content'])
- ? '' : stripslashes($_POST['mail_content']),
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_modify',
@@ -318,12 +251,4 @@
}
-
-if ('private' == $category['status'])
-{
- $template->assign( 'U_MANAGE_PERMISSIONS',
- $base_url.'cat_perm&cat='.$category['id']
- );
-}
-
// manage album elements link
if ($category['has_images'])
@@ -333,5 +258,40 @@
$base_url.'batch_manager&cat='.$category['id']
);
-}
+
+ $query = '
+SELECT
+ COUNT(image_id),
+ MIN(DATE(date_available)),
+ MAX(DATE(date_available))
+ FROM '.IMAGES_TABLE.'
+ JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id
+ WHERE category_id = '.$category['id'].'
+;';
+ list($image_count, $min_date, $max_date) = pwg_db_fetch_row(pwg_query($query));
+
+ if ($min_date == $max_date)
+ {
+ $intro = sprintf(
+ l10n('This album contains %d photos, added on %s.'),
+ $image_count,
+ format_date($min_date)
+ );
+ }
+ else
+ {
+ $intro = sprintf(
+ l10n('This album contains %d photos, added between %s and %s.'),
+ $image_count,
+ format_date($min_date),
+ format_date($max_date)
+ );
+ }
+}
+else
+{
+ $intro = l10n('This album contains no photo.');
+}
+
+$template->assign('INTRO', $intro);
$template->assign(
@@ -353,7 +313,5 @@
$template->assign(
array(
- 'CAT_FULL_DIR' => preg_replace('/\/$/',
- '',
- $category['cat_full_dir'] )
+ 'CAT_FULL_DIR' => preg_replace('/\/$/', '', $category['cat_full_dir'])
)
);
@@ -431,143 +389,7 @@
}
-
-// create virtual in parent and link
-$query = '
-SELECT id,name,uppercats,global_rank
- FROM '.CATEGORIES_TABLE.'
-;';
-display_select_cat_wrapper(
- $query,
- array(),
- 'create_new_parent_options'
- );
-
-
-// destination categories
-$query = '
-SELECT id,name,uppercats,global_rank
- FROM '.CATEGORIES_TABLE.'
- WHERE id != '.$category['id'].'
-;';
-display_select_cat_wrapper(
- $query,
- array(),
- 'category_destination_options'
- );
-
-// info by email to an access granted group of category informations
-if (isset($_POST['submitEmail']) and !empty($_POST['group']))
-{
- set_make_full_url();
-
- /* TODO: if $category['representative_picture_id']
- is empty find child representative_picture_id */
- if (!empty($category['representative_picture_id']))
- {
- $query = '
-SELECT id, file, path, representative_ext
- FROM '.IMAGES_TABLE.'
- WHERE id = '.$category['representative_picture_id'].'
-;';
-
- $result = pwg_query($query);
- if (pwg_db_num_rows($result) > 0)
- {
- $element = pwg_db_fetch_assoc($result);
-
- $img_url = '';
- }
- }
-
- if (!isset($img_url))
- {
- $img_url = '';
- }
-
- // TODO Mettre un array pour traduction subjet
- pwg_mail_group(
- $_POST['group'],
- get_str_email_format(true), /* TODO add a checkbox in order to choose format*/
- get_l10n_args('[%s] Visit album %s',
- array($conf['gallery_title'], $category['name'])),
- 'cat_group_info',
- array
- (
- 'IMG_URL' => $img_url,
- 'CAT_NAME' => $category['name'],
- 'LINK' => make_index_url(
- array(
- 'category' => array(
- 'id' => $category['id'],
- 'name' => $category['name'],
- 'permalink' => $category['permalink']
- ))),
- 'CPL_CONTENT' => empty($_POST['mail_content'])
- ? '' : stripslashes($_POST['mail_content'])
- ),
- '' /* TODO Add listbox in order to choose Language selected */);
-
- unset_make_full_url();
-
- $query = '
-SELECT
- name
- FROM '.GROUPS_TABLE.'
- WHERE id = '.$_POST['group'].'
-;';
- list($group_name) = pwg_db_fetch_row(pwg_query($query));
-
- array_push(
- $page['infos'],
- sprintf(
- l10n('An information email was sent to group "%s"'),
- $group_name
- )
- );
-}
-
-if ('private' == $category['status'])
-{
- $query = '
-SELECT
- group_id
- FROM '.GROUP_ACCESS_TABLE.'
- WHERE cat_id = '.$category['id'].'
-;';
-}
-else
-{
- $query = '
-SELECT
- id AS group_id
- FROM '.GROUPS_TABLE.'
-;';
-}
-$group_ids = array_from_query($query, 'group_id');
-
-if (count($group_ids) > 0)
-{
- $query = '
-SELECT
- id,
- name
- FROM '.GROUPS_TABLE.'
- WHERE id IN ('.implode(',', $group_ids).')
- ORDER BY name ASC
-;';
- $template->assign('group_mail_options',
- simple_hash_from_query($query, 'id', 'name')
- );
-}
-
trigger_action('loc_end_cat_modify');
//----------------------------------------------------------- sending html code
-$template->assign_var_from_handle('ADMIN_CONTENT', 'categories');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'album_properties');
?>
Index: trunk/admin/cat_perm.php
===================================================================
--- trunk/admin/cat_perm.php (revision 13004)
+++ trunk/admin/cat_perm.php (revision 13013)
@@ -167,8 +167,8 @@
get_cat_display_name_from_id(
$page['cat'],
- 'admin.php?page=cat_modify&cat_id='
+ 'admin.php?page=album-'
),
'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_perm',
- 'F_ACTION' => get_root_url().'admin.php?page=cat_perm&cat='.$page['cat']
+ 'F_ACTION' => $admin_album_base_url.'-permissions',
)
);
Index: trunk/admin/element_set_ranks.php
===================================================================
--- trunk/admin/element_set_ranks.php (revision 13004)
+++ trunk/admin/element_set_ranks.php (revision 13013)
@@ -181,5 +181,5 @@
$navigation = get_cat_display_name_cache(
$category['uppercats'],
- get_root_url().'admin.php?page=cat_modify&cat_id='
+ get_root_url().'admin.php?page=album-'
);
Index: trunk/admin/include/functions.php
===================================================================
--- trunk/admin/include/functions.php (revision 13004)
+++ trunk/admin/include/functions.php (revision 13013)
@@ -1992,4 +1992,5 @@
return 0;
+ case 'album':
case 'cat_list':
case 'cat_modify':
Index: trunk/admin/include/photos_add_direct_process.inc.php
===================================================================
--- trunk/admin/include/photos_add_direct_process.inc.php (revision 13004)
+++ trunk/admin/include/photos_add_direct_process.inc.php (revision 13013)
@@ -253,5 +253,5 @@
;';
list($count) = pwg_db_fetch_row(pwg_query($query));
- $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&cat_id=');
+ $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=album-');
// information
Index: trunk/admin/picture_modify.php
===================================================================
--- trunk/admin/picture_modify.php (revision 13004)
+++ trunk/admin/picture_modify.php (revision 13013)
@@ -361,5 +361,5 @@
get_cat_display_name_cache(
$row['uppercats'],
- get_root_url().'admin.php?page=cat_modify&cat_id=',
+ get_root_url().'admin.php?page=album-',
false
);
Index: trunk/admin/themes/default/template/cat_modify.tpl
===================================================================
--- trunk/admin/themes/default/template/cat_modify.tpl (revision 13004)
+++ trunk/admin/themes/default/template/cat_modify.tpl (revision 13013)
@@ -1,31 +1,5 @@
-
-{include file='include/autosize.inc.tpl'}
-{include file='include/resize.inc.tpl'}
-
-
{'Edit album'|@translate}
+ {$CATEGORIES_NAV} › {'Edit album'|@translate} {$TABSHEET_TITLE}
-
-{$CATEGORIES_NAV}
-
-
- {if cat_admin_access($CAT_ID)}
-
- {/if}
- {if isset($U_MANAGE_ELEMENTS) }
-
- {/if}
-
-
- {if isset($U_MANAGE_PERMISSIONS) }
-
- {/if}
- {if isset($U_SYNC) }
-
- {/if}
- {if isset($U_DELETE) }
-
- {/if}
-