Skip to content

Technical changes in Piwigo 14

Linty edited this page Feb 5, 2024 · 7 revisions

New search

  • search_rules.tpl was removed
  • In template index.tpl, variable $U_SEARCH_RULES is no longer provided.

In order to implement the new search, please include in your themes the following :

{if !empty($SEARCH_ID)}
  {include file='themes/default/template/include/search_filters.inc.tpl'}
{/if}

It will add all the filters available on the search so you can use them.

Also add the elseif condition after thumbnails section :

{if !empty($THUMBNAILS)}
<div class="loader"><img src="{$ROOT_URL}{$themeconf.img_dir}/ajax_loader.gif"></div>

<ul class="thumbnails" id="thumbnails">
  {$THUMBNAILS}
</ul>

{else if !empty($SEARCH_ID)}
<div class="mcs-no-result">
  <div class="text">
    <span class="top">{'No results are available.'|@translate}</span>
    <span class="bot">{'You can try to edit your filters and perform a new search.'|translate}</span>
  </div>
</div>
{/if}

Search in this set

@@ -12,6 +15,11 @@
 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">
 <div class="titrePage{if isset($chronology.TITLE)} calendarTitleBar{/if}">
        <ul class="categoryActions">
+{if isset($SEARCH_IN_SET_ACTION) and $SEARCH_IN_SET_ACTION}
+    {combine_css path="themes/default/vendor/fontello/css/gallery-icon.css" order=-10}
+    <li id="cmdSearchInSet"><a href="{$SEARCH_IN_SET_URL}" title="{'Search in this set'|translate}" class="pwg-state-default pwg-button">
+      <span class="pwg-icon gallery-icon-search-folder"></span><span class="pwg-button-text">{'Search in this set'|translate}</span>
+    </a></li>
+{/if}
@@ -157,6 +159,14 @@
 {include file=$FILE_CHRONOLOGY_VIEW}
 {/if}

+{if isset($SEARCH_IN_SET_BUTTON) and $SEARCH_IN_SET_BUTTON}
+<div class="mcs-side-results search-in-set-button">
+  <div>
+    <p><a href="{$SEARCH_IN_SET_URL}" class="gallery-icon-search-folder">{'Search in this set'|translate}</a></p>
+  </div>
+</div>
+{/if}
+

For the CSS, keep in mind that you can overload it so it fits you theme's style. Currently the search's CSS is done only for modus, for other themes, you'll need to overload it.

New album editor

Piwigo 14 gets a brand new album editor in the administration. The HTML code is different, the way the form is validated is different (AJAX submited) so it will obviously break any plugin that adds fields in the form. We recommend that you simply put your plugin custom fields in a separate tab of the album editor. This way it's easier to control how you validated the form.

See an example of form parameter moved from the "properties" tab to a dedicated tab : plugin Community, commit d286e834

We have identified a few plugins which modified the album editor properties tab :

~/www/piwigo_master_13/plugins % find . -name "*.php" | xargs grep album_properties      
./ExtendedDescription/include/admin.inc.php:      $target = 'album_properties';
./TakeATour/tours/manage_albums/config.inc.php:  $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter');
./TakeATour/tours/first_contact/config.inc.php:  $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter');
./FCKEditor/fckeditor.php:    $template->set_prefilter('album_properties', 'add_remove_button');
./title/initadmin.php:  $template->set_prefilter('album_properties', 'titleAadminfT');
./meta/initadmin.php:  $template->set_prefilter('album_properties', 'metaAadminfT');
./community/main.inc.php:  $template->set_prefilter('album_properties', 'community_cat_modify_prefilter');
./delete_hit_rate/initadmin.php:        $template->set_prefilter('album_properties', 'plugdphrAT');

ExtendedDescription and FCKEditor are pure front-end modifier of the description textarea, without interacting with form validation, so no problem. TakeATour is special and not really concerned by the problem described here.

delete_hit_rate adds an action button (not a field in the form) so it should stay as an action link in the new album editor actions.

community, title and meta must be adapted.