{combine_script id='jquery.ui.slider' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'} {combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"} {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} {literal} {/literal} {footer_script}{literal} $(document).ready(function() { $("select[name=who]").change(function () { $("[name^=who_]").hide(); $("[name=who_"+$(this).prop("value")+"]").show(); checkWhoOptions(); }); function checkWhoOptions() { if ('any_visitor' == $("select[name=who] option:selected").val()) { $("#userAlbumOption").attr("disabled", true); $("#userAlbumInfo").hide(); if (-1 == $("select[name=category] option:selected").val()) { $("select[name=category]").val("0"); checkWhereOptions(); } } else { $("#userAlbumOption").attr("disabled", false); $("#userAlbumInfo").show(); } } checkWhoOptions(); function checkWhereOptions() { var recursive = $("input[name=recursive]"); var create = $("input[name=create_subcategories]"); if ($("select[name=category] option:selected").val() == 0) { $(recursive).attr("disabled", true); $(recursive).attr('checked', true); } else if ($("select[name=category] option:selected").val() == -1) { /* user upload only */ $(recursive).attr("disabled", true).attr('checked', false); $(create).attr("disabled", true).attr('checked', false); } else { $(recursive).removeAttr("disabled"); } if (!$(recursive).is(':checked')) { $(create).attr('checked', false); $(create).attr("disabled", true); } else { $(create).removeAttr("disabled"); } } checkWhereOptions(); $("select[name=category]").change(function() { checkWhereOptions(); }); $("input[name=recursive]").change(function() { checkWhereOptions(); }); $("#displayForm").click(function() { $("[name=add_permission]").show(); $(this).hide(); return false; }); /* ∞ */ /** * find the key from a value in the startStopValues array */ function getSliderKeyFromValue(value, values) { for (var key in values) { if (values[key] == value) { return key; } } return 0; } var nbPhotosValues = [5,10,20,50,100,500,1000,5000,-1]; function getNbPhotosInfoFromIdx(idx) { if (idx == nbPhotosValues.length - 1) { return "{/literal}{'no limit'|@translate}{literal}"; } return sprintf( "{/literal}{'up to %d photos (for each user)'|@translate}{literal}", nbPhotosValues[idx] ); } /* init nb_photos info span */ var nbPhotos_init = getSliderKeyFromValue(jQuery('input[name=nb_photos]').val(), nbPhotosValues); jQuery("#community_nb_photos_info").html(getNbPhotosInfoFromIdx(nbPhotos_init)); jQuery("#community_nb_photos").slider({ range: "min", min: 0, max: nbPhotosValues.length - 1, value: nbPhotos_init, slide: function( event, ui ) { jQuery("#community_nb_photos_info").html(getNbPhotosInfoFromIdx(ui.value)); }, stop: function( event, ui ) { jQuery("input[name=nb_photos]").val(nbPhotosValues[ui.value]); } }); var storageValues = [10,50,100,200,500,1000,5000,-1]; function getStorageInfoFromIdx(idx) { if (idx == storageValues.length - 1) { return "{/literal}{'no limit'|@translate}{literal}"; } return sprintf( "{/literal}{'up to %dMB (for each user)'|@translate}{literal}", storageValues[idx] ); } /* init storage info span */ var storage_init = getSliderKeyFromValue(jQuery('input[name=storage]').val(), storageValues); jQuery("#community_storage_info").html(getStorageInfoFromIdx(storage_init)); jQuery("#community_storage").slider({ range: "min", min: 0, max: storageValues.length - 1, value: storage_init, slide: function( event, ui ) { jQuery("#community_storage_info").html(getStorageInfoFromIdx(ui.value)); }, stop: function( event, ui ) { jQuery("input[name=storage]").val(storageValues[ui.value]); } }); }); {/literal}{/footer_script}

{'Upload Permissions'|@translate} - {'Community'|@translate}

{if not isset($edit)} {'Add a permission'|@translate} {/if}
{if isset($edit)}{'Edit a permission'|@translate}{else}{'Add a permission'|@translate}{/if}

{'Who?'|@translate}

{'Where?'|@translate} {if $community_conf.user_albums}{'(in addition to user album)'|@translate}{/if}


{'Which level of trust?'|@translate}

{'How many photos?'|@translate}

{'no limit'|@translate}

{'How much disk space?'|@translate}

{'no limit'|@translate} {if isset($edit)} {/if}

{'Cancel'|@translate}

{if not empty($permissions)} {foreach from=$permissions item=permission name=permission_loop} {/foreach} {/if}
{'Who?'|@translate} {'Where?'|@translate} {'Options'|@translate} {'Actions'|@translate}
{$permission.WHO} {$permission.WHERE} {$permission.TRUST}{if $permission.RECURSIVE}, {'sub-albums'|@translate}{/if}{if $permission.NB_PHOTOS}, {'%d photos'|@translate|sprintf:$permission.NB_PHOTOS}{/if}{if $permission.STORAGE}, {$permission.STORAGE}MB{/if} {if $permission.CREATE_SUBCATEGORIES} , {'sub-albums creation'|@translate} {/if} {'edit'|@translate} {'delete'|@translate}