var ancflmgr = null; var ancelid = null; function announce_TitleBlur() { var title = $('tr.title input[name=title]').val() || ''; if (title != '') { title = title.replace(/[^a-zA-Z0-9 _-]+/g, ''); title = title.replace(/^\s{1,}/, ''); title = title.replace(/\s{1,}$/, ''); title = title.replace(/\s{1,}/g, '-'); title = title.replace(/-{2,}/g, '-'); var alias = $('tr.alias input[name=alias]'); if ($(alias).val() == '') { alias.val(title); } } } function announce_ChangeCategory() { var el = $('#id_category'); if ($(el).size()) { $('tr.id_event').hide(); $('tr.show_on_home').hide(); switch ($(el).val()) { case '3': $('tr.id_event').show(); // break omitted case '1': // break omitted case '2': $('tr.show_on_home').show(); break; } } } function announce_ChangeType() { var el = $('input[name^=id_type]'); if ($(el).size()) { var show = []; show[1] = ['video_flv', 'video_mp4', 'video_wmv']; show[2] = ['speakers', 'audio_mp3', 'audio_mp4', 'audio_wma']; show[3] = ['id_poll']; show[4] = ['document']; show[5] = ['additional_image']; $(el).each(function () { var val = $(this).val(); if ($(this).attr('checked')) { for (var i = 0; i < show[val].length; i++) { $('tr.' + show[val][i]).show(); } } else { for (var i = 0; i < show[val].length; i++) { $('tr.' + show[val][i]).hide(); } } }); } } var anclastcat = null; var ancchanged = false; function announce_ReorderHomeChange() { if (ancchanged == true) { if (!confirm('You have reordered elements in this category. Are you sure you would like to leave this category without saving?')) { if (anclastcat != null) { $('select#id_category').val(anclastcat); } return false; } } var form = $('#form_announcement'); $('input[name=action]', form).val('reorder_home'); $(form).submit(); return true; } function announce_ReorderHomeInit() { $('select#id_category').unbind('change'); $('select#id_category').change(function(){announce_ReorderHomeChange();}); anclastcat = $('select#id_category').val(); var f = function () { ancchanged = true; }; $('input[type=button][name=up]').bind('click', f); $('input[type=button][name=down]').bind('click', f); } function fileManager(id) { ancelid = id; ancflmgr = window.open(BASE_URL + '/admin/filemanager', 'ancflmgr', 'height=400,location=no,menubar=no,status=no,toolbar=no,width=300'); ancflmgr.focus(); } function fileTreeCallback(file) { if (ancelid != null) { //ancflmgr.WWW_URL+ancflmgr.category+'/'+file.replace(ancflmgr.WWW_PATH,'') $('#' + ancelid).val(ancflmgr.category.substring(1) + '/' + file.replace(ancflmgr.WWW_PATH,'')); ancelid = null; } ancflmgr.close(); }