From c78b9c0f83204c1805c9f1fc858bddefc2402e17 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 17 Feb 2009 22:00:17 +0100 Subject: Enable in setup.xml Support for override in the album --- generators.c | 10 +++++++--- items.c | 3 ++- items.h | 1 + sample/src/setup.xml | 6 ++++++ sample/src/subdir/CIAF_2/index.xml | 7 +------ setup.c | 2 ++ setup.h | 1 + 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/generators.c b/generators.c index c6df9c0..356c434 100644 --- a/generators.c +++ b/generators.c @@ -166,7 +166,8 @@ generate_image (TGallerySetup *setup, modify_exif (big_dst, setup->erase_exif_thumbnail, setup->add_copyright); g_free (big_dst); - if (item->force_fullsize || (! item->force_nofullsize && ! items->nofullsize)) + if (item->force_fullsize || (items->fullsize && ! item->force_nofullsize) || + (! item->force_nofullsize && ! items->nofullsize && ! setup->nofullsize)) { s1 = g_path_get_dirname(dst); orig_dst = g_strconcat (s1, "/", IMG_ORIG_DIR, "/", *img_src, NULL); @@ -623,6 +624,7 @@ write_html_image (TGallerySetup *setup, gboolean res; int level, old_parent_item_index; gboolean override_title_meta; + gboolean image_fullsize; fin = fopen (template_src, "r"); @@ -688,7 +690,9 @@ write_html_image (TGallerySetup *setup, /* Retrieve image sizes of preview and original image */ get_image_sizes (big_dst, &img_big_w, &img_big_h); - if (item->force_fullsize || (! item->force_nofullsize && ! parent_items->nofullsize)) + image_fullsize = item->force_fullsize || (parent_items->fullsize && ! item->force_nofullsize) || + (! item->force_nofullsize && ! parent_items->nofullsize && ! setup->nofullsize); + if (image_fullsize) get_image_sizes (orig_dst, &img_orig_w, &img_orig_h); @@ -709,7 +713,7 @@ write_html_image (TGallerySetup *setup, if (strstr (buffer, "")) { in_img_fullsize_link = FALSE; free (b); - if (item->force_fullsize || (! item->force_nofullsize && ! parent_items->nofullsize)) + if (image_fullsize) b = strdup (buf_img_fullsize_link); else continue; } diff --git a/items.c b/items.c index 5e4bf4a..986fd6c 100644 --- a/items.c +++ b/items.c @@ -88,6 +88,7 @@ parse_album_xml (const char *filename, TAlbum *index) index->meta_keywords = xml_file_get_node_value (xml, "/gallery/general/meta/keywords/text()"); index->nofullsize = xml_file_get_node_present (xml, "/gallery/general/nofullsize"); + index->fullsize = xml_file_get_node_present (xml, "/gallery/general/fullsize"); /* Section Items */ count = xml_file_node_get_children_count (xml, "/gallery/items/*"); @@ -142,7 +143,7 @@ parse_album_xml (const char *filename, TAlbum *index) g_free (s); s = g_strdup_printf ("/gallery/items/*[%d]/fullsize", i + 1); - item->force_fullsize = (xml_file_get_node_present (xml, s) || item->path == NULL); + item->force_fullsize = xml_file_get_node_present (xml, s); g_free (s); s = g_strdup_printf ("/gallery/items/*[%d]/hidden", i + 1); diff --git a/items.h b/items.h index 8bb7502..9fd6822 100644 --- a/items.h +++ b/items.h @@ -52,6 +52,7 @@ typedef struct { char *meta_description; char *meta_keywords; gboolean nofullsize; + gboolean fullsize; } TAlbum; typedef struct { diff --git a/sample/src/setup.xml b/sample/src/setup.xml index 7b8c6b0..84cc639 100644 --- a/sample/src/setup.xml +++ b/sample/src/setup.xml @@ -39,6 +39,12 @@ + + + + + + diff --git a/sample/src/subdir/CIAF_2/index.xml b/sample/src/subdir/CIAF_2/index.xml index c5e25ca..988ef97 100644 --- a/sample/src/subdir/CIAF_2/index.xml +++ b/sample/src/subdir/CIAF_2/index.xml @@ -7,41 +7,36 @@ mezinárodní letiště Brno - Tuřany
http://www.airshow.cz/18-CZ-CIAF-07-Home.html
]]> + - L-159 ALCA http://www.airshow.cz/115-CZ-Letecka-technika-L159.html]]> - L-159 ALCA http://www.airshow.cz/115-CZ-Letecka-technika-L159.html]]> - L-159 ALCA http://www.airshow.cz/115-CZ-Letecka-technika-L159.html]]> - Bell-412 - Péter Besenyei - EXTRA 300S http://www.airshow.cz/157-CZ-CIAF-07-Besenyei-Peter.html]]> - Péter Besenyei - EXTRA 300S http://www.airshow.cz/157-CZ-CIAF-07-Besenyei-Peter.html]]> diff --git a/setup.c b/setup.c index 40da036..d9b9464 100644 --- a/setup.c +++ b/setup.c @@ -133,6 +133,8 @@ parse_setup_xml (const char *filename, TGallerySetup *setup) setup->use_inpage_links = s ? strcasecmp (s, "yes") == 0 : TRUE; /* default to TRUE */ if (s) g_free (s); + setup->nofullsize = xml_file_get_node_present (xml, "/gallery_setup/images/nofullsize"); + xml_parser_close (xml); #ifdef __DEBUG_ALL__ diff --git a/setup.h b/setup.h index 8affdd6..eea4b17 100644 --- a/setup.h +++ b/setup.h @@ -54,6 +54,7 @@ typedef struct { unsigned long preview_portrait_height; char *border_style; + gboolean nofullsize; gboolean preload; gboolean use_iptc_exif; -- cgit v1.2.3