Esempio n. 1
0
/**
 * HTML Header JS
 */
function create_albumJS()
{
    global $_zp_admin_tab, $_zp_admin_subtab, $_zp_gallery;
    if ($_zp_admin_tab == 'users') {
        $albums = $_zp_gallery->getAlbums(0);
        ?>
	<script type="text/javascript">
		// <!-- <![CDATA[
		<?php 
        seoFriendlyJS();
        ?>
		var albumArray = ['<?php 
        echo implode("','", $albums);
        ?>
'];

		function updateFolder(nameObj, folderID, checkboxID, msg1) {
			var autogen = document.getElementById(checkboxID).checked;
			var folder = document.getElementById(folderID);
			var name = nameObj.value;
			var fname = "";
			var fnamesuffix = "";
			var count = 1;
			var errorDiv = document.getElementById("foldererror");
			if (autogen && name != "") {
				fname = seoFriendlyJS(name);
				while (contains(albumArray, fname + fnamesuffix)) {
					fnamesuffix = "-"+count;
					count++;
				}
			}
			folder.value = fname + fnamesuffix;
			$('#newalbumcheckbox').prop('checked',true);
			if (contains(albumArray, folder)) {
				errorDiv.style.display = "inline";
				errorDiv.innerHTML = msg1;
				$('#newalbumcheckbox').prop('checked',false);
			} else {
				errorDiv.style.display = "none";
				$('#newalbumcheckbox').prop('checked',true);
			}
		}

		function albumSelect() {
			var errorDiv = document.getElementById("foldererror");
			if (contains(albumArray, $('#folderdisplay').val())) {
				errorDiv.style.display = "inline";
				errorDiv.innerHTML = '<?php 
        echo gettext('That name is already used.');
        ?>
';
				$('#newalbumcheckbox').prop('checked',false);
			} else {
				errorDiv.style.display = "none";
				$('#newalbumcheckbox').prop('checked',true);
			}
		}
		// ]]> -->
	</script>
	<?php 
    }
}
Esempio n. 2
0
				</div>
				<?php 
}
$rootrights = zp_apply_filter('upload_root_ui', accessAllAlbums(UPLOAD_RIGHTS));
if ($rootrights || !empty($albumlist)) {
    echo gettext("Upload to:");
    if (isset($_GET['new'])) {
        $checked = ' checked="checked"';
    } else {
        $checked = '';
    }
    ?>
				<script type="text/javascript">
					// <!-- <![CDATA[
	<?php 
    seoFriendlyJS();
    ?>
					function buttonstate(good) {
						$('#albumtitleslot').val($('#albumtitle').val());
						$('#publishalbumslot').val($('#publishalbum').prop('checked'));
						if (good) {
							$('#fileUploadbuttons').show();
						} else {
							$('#fileUploadbuttons').hide();
						}
					}
					function publishCheck() {
						$('#publishalbumslot').val($('#publishalbum').prop('checked'));
					}
					function albumSelect() {
						var sel = document.getElementById('albumselectmenu');