Commit e43998cf authored by lindonb's avatar lindonb

[FIX] file gallery: replace legacy action icons with dropdown consistent with...

[FIX] file gallery: replace legacy action icons with dropdown consistent with other listings (also not yet possible to use iconsets for input elements with type = image). Fixes http://dev.tiki.org/item5570
parent d8b0a1db
......@@ -105,77 +105,123 @@
and $view neq 'page'
)}
<div id="sel">
<div>
{if $tiki_p_admin_file_galleries eq 'y'
or $tiki_p_remove_files eq 'y'
or !isset($file_info)
or $tiki_p_admin_file_galleries eq 'y'
or $prefs.fgal_display_zip_option eq 'y'
or $tiki_p_assign_perm_file_gallery eq 'y'
}
{tr}Perform action with checked:{/tr}
{/if}
{if !isset($file_info)}
{if $offset}<input type="hidden" name="offset" value="{$offset}">{/if}
{if $tiki_p_admin_file_galleries eq 'y' or $tiki_p_remove_files eq 'y'}
{icon _id='arrow_right' _tag='input_image' name='movesel' alt="{tr}Move{/tr}" title="{tr}Move Selected Files{/tr}" style='vertical-align: middle;'}
{/if}
{/if}
{if $tiki_p_admin_file_galleries eq 'y' or $tiki_p_remove_files eq 'y'}
{icon _id='cross' _tag='input_image' _confirm="{tr}Are you sure you want to delete the selected files?{/tr}" name='delsel' alt="{tr}Delete{/tr}" style='vertical-align: middle;'}
{/if}
{icon _id='tag_green' _tag='input_image' name='refresh_metadata' alt="{tr}Refresh Metadata{/tr}" style='vertical-align: middle;'}
{if $tiki_p_admin_file_galleries eq 'y'}
{icon _id='arrow_refresh' _tag='input_image' _confirm="{tr}Are you sure you want to reset the default gallery list table settings?{/tr}" name='defaultsel' alt="{tr}Reset to default gallery list table settings{/tr}" style='vertical-align: middle;'}
{/if}
{if $prefs.fgal_display_zip_option eq 'y'}
{icon _id='img/icons/mime/zip.png' _tag='input_image' name='zipsel' alt="{tr}Download the zip{/tr}" style='vertical-align: middle;'}
{/if}
{if $tiki_p_assign_perm_file_gallery eq 'y'}
{icon _id='key' _tag='input_image' name='permsel' alt="{tr}Assign permissions to file galleries{/tr}" title="{tr}Assign permissions to file galleries{/tr}" style='vertical-align: middle;'}
{/if}
</div>
{if !empty($smarty.request.movesel_x) and !isset($file_info)}
<div>
{tr}Move to:{/tr}
<select name="moveto">
{section name=ix loop=$all_galleries}
{if $all_galleries[ix].id ne $galleryId and $all_galleries[ix].perms.tiki_p_upload_files eq 'y' and
($all_galleries[ix].public eq 'y' or $all_galleries[ix].user eq $user)}
<option value="{$all_galleries[ix].id}">
{$all_galleries[ix].label|escape}
{if $tiki_p_admin_file_galleries eq 'y'
or $tiki_p_remove_files eq 'y'
or !isset($file_info)
or $tiki_p_admin_file_galleries eq 'y'
or $prefs.fgal_display_zip_option eq 'y'
or $tiki_p_assign_perm_file_gallery eq 'y'
}
<div class="input-group col-sm-10">
<select name="fgal_actions" class="form-control">
<option value="" selected="selected">
{tr}Select action to perform with checked files or galleries...{/tr}
</option>
{if $tiki_p_assign_perm_file_gallery eq 'y'}
<option value="permsel_x" class="btn btn-link">
{tr}Assign permissions to file galleries{/tr}
</option>
{/if}
{if $tiki_p_admin_file_galleries eq 'y' or $tiki_p_remove_files eq 'y'}
<option value="delsel_x" class="btn btn-link">
{tr}Delete{/tr}
</option>
{/if}
{if $prefs.fgal_display_zip_option eq 'y'}
<option value="zipsel_x" class="btn btn-link">
{tr}Download zip version{/tr}
</option>
{/if}
{if !isset($file_info)}
{if $offset}
<input type="hidden" name="offset" value="{$offset}">
{/if}
{if $tiki_p_admin_file_galleries eq 'y' or $tiki_p_remove_files eq 'y'}
<option value="movesel_x" class="btn btn-link">
{tr}Move{/tr}
</option>
{/if}
<option value="refresh_metadata_x" class="btn btn-link">
{tr}Refresh metadata{/tr}
</option>
{if $tiki_p_admin_file_galleries eq 'y'}
<option value="defaultsel_x" class="btn btn-link">
{tr}Reset to default list view settings{/tr}
</option>
{/if}
{/section}
{/if}
</select>
<input type='submit' name='movesel' value="{tr}Move{/tr}">
<span class="input-group-btn">
<button class="btn btn-primary" form="fgalform" type="submit">
{tr}OK{/tr}
</button>
</span>
</div>
{/if}
{if !empty($movesel_x) and !isset($file_info)}
<div class="panel panel-primary">
<div class="panel-heading">
{tr}Move selected file or gallery{/tr}
</div>
<div class="panel-body">
<div class="form-group">
<label for="moveto" class="col-sm-2">
{tr}Move to:{/tr}
</label>
<div class="col-sm-8">
<select name="moveto" class="form-control">
{section name=ix loop=$all_galleries}
{if $all_galleries[ix].id ne $galleryId and $all_galleries[ix].perms.tiki_p_upload_files eq 'y' and
($all_galleries[ix].public eq 'y' or $all_galleries[ix].user eq $user)}
<option value="{$all_galleries[ix].id}">
{$all_galleries[ix].label|escape}
</option>
{/if}
{/section}
</select>
</div>
</div>
</div>
<div class="panel-footer">
<input type='submit' class="btn btn-primary" form="fgalform" name='movesel' value="{tr}Move{/tr}">
</div>
</div>
{/if}
</div>
{if !empty($perms)}
<div>
{tr}Assign permissions to file galleries{/tr}
<select name="perms[]" multiple="multiple" size="5">
<option value="" />
{foreach from=$perms item=perm}
<option value="{$perm.permName|escape}">{$perm.permName|escape}</option>
{/foreach}
</select>
<select name="groups[]" multiple="multiple" size="5">
{section name=grp loop=$groups}
<option value="{$groups[grp].groupName|escape}" {if $groupName eq $groups[grp].groupName}selected="selected"{/if}>
{$groups[grp].groupName|escape}
</option>
{/section}
</select>
<input class="btn btn-default" type="submit" name="permsel" value="{tr}Assign{/tr}">
<div class="panel panel-primary">
<div class="panel-heading">
{tr}Assign file gallery permissions to groups{/tr}
</div>
<div class="panel-body">
<div class="form-group">
<div class="col-sm-6">
<span class="help-block">
{tr}Permissions{/tr}
</span>
<select name="perms[]" multiple="multiple" size="12" class="form-control">
{foreach from=$perms item=perm}
<option value="{$perm.permName|escape}">{$perm.permName|escape}</option>
{/foreach}
</select>
</div>
<div class="col-sm-6">
<span class="help-block">
{tr}Groups{/tr}
</span>
<select name="groups[]" multiple="multiple" size="12" class="form-control">
{section name=grp loop=$groups}
<option value="{$groups[grp].groupName|escape}" {if $groupName eq $groups[grp].groupName}selected="selected"{/if}>
{$groups[grp].groupName|escape}
</option>
{/section}
</select>
</div>
</div>
</div>
<div class="panel-footer">
<input class="btn btn-primary" type="submit" name="permsel" value="{tr}Assign{/tr}">
</div>
</div>
{/if}
<br style="clear:both"/>
......
......@@ -146,9 +146,11 @@ $smarty->assign('reindex_file_id', -1);
$_REQUEST['view'] = isset($_REQUEST['view']) ? $_REQUEST['view'] : $gal_info['default_view'];
// Execute batch actions
if ($tiki_p_admin_file_galleries == 'y' || $tiki_p_remove_files === 'y') {
if (isset($_REQUEST['delsel_x'])) {
if (!empty($_REQUEST['fgal_actions']) && $_REQUEST['fgal_actions'] === 'delsel_x') {
check_ticket('fgal');
$access->check_authenticity(tra('Are you sure you want to remove that file or gallery?'));
if (isset($_REQUEST['file'])) {
foreach (array_values($_REQUEST['file']) as $file) {
if ($info = $filegallib->get_file_info($file)) {
......@@ -192,8 +194,9 @@ if ($tiki_p_admin_file_galleries == 'y' || $tiki_p_remove_files === 'y') {
}
if ($tiki_p_admin_file_galleries == 'y') {
if (isset($_REQUEST['defaultsel_x'])) {
if (!empty($_REQUEST['fgal_actions']) && $_REQUEST['fgal_actions'] === 'defaultsel_x') {
check_ticket('fgal');
$access->check_authenticity(tra('Are you sure you want to reset to the default gallery list view settings?'));
if (!empty($_REQUEST['subgal'])) {
$filegallib->setDefault(array_values($_REQUEST['subgal']));
} else if (!empty($_REQUEST['galleryId'])) {
......@@ -202,14 +205,14 @@ if ($tiki_p_admin_file_galleries == 'y') {
unset($_REQUEST['view']);
}
if (isset($_REQUEST['refresh_metadata_x'])) {
if (!empty($_REQUEST['fgal_actions']) && $_REQUEST['fgal_actions'] === 'refresh_metadata_x') {
foreach (array_values($_REQUEST['file']) as $file) {
$filegallib->metadataAction($file, 'refresh');
}
}
}
if (isset($_REQUEST['zipsel_x']) && $tiki_p_upload_files == 'y') {
if (!empty($_REQUEST['fgal_actions']) && $_REQUEST['fgal_actions'] === 'zipsel_x' && $tiki_p_upload_files == 'y') {
check_ticket('fgal');
$href = array();
if (isset($_REQUEST['file'])) {
......@@ -226,7 +229,9 @@ if (isset($_REQUEST['zipsel_x']) && $tiki_p_upload_files == 'y') {
die;
}
if (isset($_REQUEST['permsel_x']) && $tiki_p_assign_perm_file_gallery == 'y') {
if (!empty($_REQUEST['fgal_actions']) && $_REQUEST['fgal_actions'] === 'permsel_x'
&& $tiki_p_assign_perm_file_gallery == 'y')
{
$perms = $userlib->get_permissions(0, -1, 'permName_asc', '', 'file galleries');
$smarty->assign_by_ref('perms', $perms['data']);
$groups = $userlib->get_groups(0, -1, 'groupName_asc', '', '', 'n');
......@@ -742,7 +747,7 @@ if (isset($_REQUEST['comment']) && $_REQUEST['comment'] != '' && isset($_REQUEST
// Set display config
if (!isset($_REQUEST['maxRecords']) || $_REQUEST['maxRecords'] <= 0) {
if ($_REQUEST['view'] == 'page' && empty($_REQUEST['fileId'])) {
if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'page' && empty($_REQUEST['fileId'])) {
$_REQUEST['maxRecords'] = 1;
} elseif (isset($gal_info['maxRows']) && $gal_info['maxRows'] > 0) {
$_REQUEST['maxRecords'] = $gal_info['maxRows'];
......@@ -1020,7 +1025,9 @@ if ($prefs['feature_file_galleries_templates'] == 'y') {
$subGalleries = $filegallib->getSubGalleries(( isset($_REQUEST['parentId']) && $galleryId == 0) ? $_REQUEST['parentId'] : $galleryId);
$smarty->assign('treeRootId', $subGalleries['parentId']);
if ($prefs['fgal_show_explorer'] == 'y' || $prefs['fgal_show_path'] == 'y' || isset($_REQUEST['movesel_x']) || isset($_REQUEST["edit_mode"])) {
if ($prefs['fgal_show_explorer'] == 'y' || $prefs['fgal_show_path'] == 'y'
|| $_REQUEST['fgal_actions'] === 'movesel_x' || isset($_REQUEST["edit_mode"]))
{
$gals = array();
foreach ($subGalleries['data'] as $gal) {
$gals[] = array(
......@@ -1039,6 +1046,9 @@ if ($prefs['fgal_show_explorer'] == 'y' || $prefs['fgal_show_path'] == 'y' || is
$smarty->assign('gallery_path', $path['HTML']);
}
$smarty->assign('tree', $filegallib->getTreeHTML($galleryId));
if (!empty($_REQUEST['fgal_actions']) && $_REQUEST['fgal_actions'] === 'movesel_x') {
$smarty->assign('movesel_x', 'y');
}
}
ask_ticket('fgal');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment