function customHead() { ?> <script type="text/javascript"> $(document).ready(function() { $("#dialog-widget-delete").dialog({ autoOpen: false, modal: true, title: '<?php echo osc_esc_js(__('Delete widget')); ?> ' }); }); // dialog delete function function delete_dialog(widget_id) { $("#dialog-widget-delete input[name='id']").attr('value', widget_id); $("#dialog-widget-delete").dialog('open'); return false; } </script> <?php }
function customHead() { echo '<script type="text/javascript" src="' . osc_current_admin_theme_js_url('jquery.validate.min.js') . '"></script>'; ?> <script type="text/javascript"> $(document).ready(function() { $("#dialog-widget-delete").dialog({ autoOpen: false, modal: true, title: '<?php echo osc_esc_js(__('Delete widget')); ?> ' }); }); // dialog delete function function delete_dialog(widget_id) { $("#dialog-widget-delete input[name='id']").attr('value', widget_id); $("#dialog-widget-delete").dialog('open'); return false; } </script> <?php }
function fjs_search() { echo "\n"; ?> var sQuery = '<?php echo osc_esc_js(osc_get_preference('keyword_placeholder', 'seeker')); ?> ' ; $(document).ready(function(){ var element = $('input[name="sPattern"]'); element.focus(function(){ $(this).prev().hide(); }).blur(function(){ if($(this).val() == '') { $(this).prev().show(); } }).prev().click(function(){ $(this).hide(); $(this).next().focus(); }); if(element.val() != ''){ element.prev().hide(); } }); function doSearch() { var sPattern = $('input[name=sPattern]'); if(sPattern.val() == ''){ return false; } return true; } <?php }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function() { // dialog delete $("#dialog-delete-theme").dialog({ autoOpen: false, modal: true, title: '<?php echo osc_esc_js(__('Delete theme')); ?> ' }); }); // dialog delete function function delete_dialog(theme) { $("#dialog-delete-theme input[name='webtheme']").attr('value', theme); $("#dialog-delete-theme").dialog('open'); return false; } </script> <?php }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ // Code for form validation $("form[name=currency_form]").validate({ rules: { pk_c_code: { required: true, minlength: 3, maxlength: 3 }, s_name: { required: true, minlength: 1 } }, messages: { pk_c_code: { required: '<?php echo osc_esc_js(__('Currency code: this field is required')); ?> .', minlength: '<?php echo osc_esc_js(__('Currency code: this field is required')); ?> .', maxlength: '<?php echo osc_esc_js(__('Currency code: this field is required')); ?> .' }, s_name: { required: '<?php echo osc_esc_js(__('Name: this field is required')); ?> .', minlength: '<?php echo osc_esc_js(__('Name: this field is required')); ?> .' } }, wrapper: "li", errorLabelContainer: "#error_list", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); }, submitHandler: function(form){ $('button[type=submit], input[type=submit]').attr('disabled', 'disabled'); form.submit(); } }); }); </script> <?php }
function customHead() { ?> <script type="text/javascript" src="<?php echo osc_current_admin_theme_js_url('jquery.validate.min.js'); ?> "></script> <script type="text/javascript"> $(document).ready(function(){ // Code for form validation $("form[name=currency_form]").validate({ rules: { pk_c_code: { required: true, minlength: 3, maxlength: 3 }, s_name: { required: true, minlength: 1 } }, messages: { pk_c_code: { required: '<?php echo osc_esc_js(__('Currency code: this field is required')); ?> .', minlength: '<?php echo osc_esc_js(__('Currency code: this field is required')); ?> .', maxlength: '<?php echo osc_esc_js(__('Currency code: this field is required')); ?> .' }, s_name: { required: '<?php echo osc_esc_js(__('Name: this field is required')); ?> .', minlength: '<?php echo osc_esc_js(__('Name: this field is required')); ?> .' } }, wrapper: "li", errorLabelContainer: "#error_list", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); } }); }); </script> <?php }
function customHead() { $all = osc_get_preference('location_todo'); if ($all == '') { $all = 0; } $worktodo = LocationsTmp::newInstance()->count(); ?> <script type="text/javascript"> function reload() { window.location = '<?php echo osc_admin_base_url(true) . '?page=tools&action=locations'; ?> '; } function ajax_() { $.ajax({ type: "POST", url: '<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=location_stats&<?php echo osc_csrf_token_url(); ?> ', dataType: 'json', success: function(data) { if(data.status=='done') { $('span#percent').html(100); }else{ var pending = data.pending; var all = <?php echo osc_esc_js($all); ?> ; var percent = parseInt( ((all-pending)*100) / all ); $('span#percent').html(percent); ajax_(); } } }); } $(document).ready(function(){ if(<?php echo $worktodo; ?> > 0) { ajax_(); } }); </script> <?php }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ // Code for form validation $.validator.addMethod('customrule', function(value, element) { if($('input:radio[name=purge_searches]:checked').val()=='custom') { if($("#custom_queries").val()=='') { return false; } } return true; }); $("form[name=searches_form]").validate({ rules: { custom_queries: { digits: true, customrule: true } }, messages: { custom_queries: { digits: '<?php echo osc_esc_js(__('Custom number: this field must only contain numeric characters')); ?> .', customrule: '<?php echo osc_esc_js(__('Custom number: this field cannot be left empty')); ?> .' } }, wrapper: "li", errorLabelContainer: "#error_list", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); }, submitHandler: function(form){ $('button[type=submit], input[type=submit]').attr('disabled', 'disabled'); form.submit(); } }); }); </script> <?php }
function cookie_load() { ?> <script type="text/javascript" > $(document).ready(function () { var options = new Object(); <?php if (osc_get_preference('accept', 'cookie') == 1) { echo 'options.cookieAcceptButton = true;'; } if (osc_get_preference('decline', 'cookie') == 1) { echo 'options.cookieDeclineButton = true;'; } if (osc_get_preference('reset', 'cookie') == 1) { echo 'options.cookieResetButton = true;'; } echo "options.cookiePolicyLink = '" . osc_esc_js(osc_get_preference('policy_link', 'cookie')) . "';"; echo "options.cookieWhatAreTheyLink = '" . osc_esc_js(osc_get_preference('what_are_link', 'cookie')) . "';"; echo "options.cookieAnalyticsMessage = '" . str_replace("'", "\\'", osc_get_preference('analytics_msg', 'cookie')) . "';"; echo "options.cookieMessage = '" . str_replace("'", "\\'", osc_get_preference('non_analytics_msg', 'cookie')) . "';"; if (osc_get_preference('analytics_id', 'cookie') != '') { ?> options.cookieAnalytics = true; if (jQuery.cookie('cc_cookie_decline') == "cc_cookie_decline") { } else { var _gaq = _gaq || []; _gaq.push(['_setAccount', '<?php echo osc_get_preference('analytics_id', 'cookie'); ?> ']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document. getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); } <?php } else { echo 'options.cookieAnalytics = false;'; } ?> $.cookieCuttr(options); }); </script> <?php }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ $('input:hidden[name="installed"]').each(function() { $(this).parent().parent().children().css('background', 'none'); if( $(this).val() == '1' ) { if( $(this).attr("enabled") == 1 ) { $(this).parent().parent().css('background-color', '#EDFFDF'); } else { $(this).parent().parent().css('background-color', '#FFFFDF'); } } else { $(this).parent().parent().css('background-color', '#FFF0DF'); } }); // dialog delete $("#dialog-uninstall").dialog({ autoOpen: false, modal: true, title: '<?php echo osc_esc_js( __('Uninstall plugin') ); ?>' }); $('.plugin-tooltip').each(function(){ $(this).osc_tooltip('<?php echo osc_esc_js(__('Problems with this plugin? Ask for support.')); ?>',{layout:'gray-tooltip',position:{x:'right',y:'middle'}}); }); }); // dialog delete function function uninstall_dialog(plugin, title) { $("#dialog-uninstall input[name='plugin']").attr('value', plugin); $("#dialog-uninstall").dialog('option', 'title', title); $("#dialog-uninstall").dialog('open'); return false; } </script> <?php }
} else { ?> <?php $i = 1; while (osc_has_alerts()) { ?> <div class="userItem" > <div class="title-has-actions"> <h3><?php _e('Alert', 'osclassclsx'); ?> <?php echo $i; ?> </h3> <a onclick="javascript:return confirm('<?php echo osc_esc_js(__('This action can\'t be undone. Are you sure you want to continue?', 'benderw')); ?> ');" href="<?php echo osc_user_unsubscribe_alert_url(); ?> "><?php _e('Delete this alert', 'osclassclsx'); ?> </a><div class="clear"></div></div> <div> <?php osc_current_web_theme_path('loop.php'); ?> <?php if (osc_count_items() == 0) { ?>
?> ', ''); } <?php } ?> <?php if (osc_locale_dec_point() != '') { ?> var tmp = price.split('<?php echo osc_esc_js(osc_locale_dec_point()); ?> '); if(tmp.length>2) { price = tmp[0]+'<?php echo osc_esc_js(osc_locale_dec_point()); ?> '+tmp[1]; } <?php } ?> $("#price").prop("value", price); }); }); <?php } ?> </script> <?php osc_current_web_theme_path('footer.php');
private function toDatatablesFormat() { $this->result['iTotalRecords'] = $this->total; $this->result['iTotalDisplayRecords'] = $this->total_filtered; $this->result['sEcho'] = $this->sEcho; $this->result['aaData'] = array(); if (count($this->media) == 0) { return; } $count = 0; foreach ($this->media as $aRow) { $row = array(); $row[] = '<input type="checkbox" name="id[]" value="' . $aRow['pk_i_id'] . '" />'; $row[] = '<div id="media_list_pic"><img src="' . osc_apply_filter('resource_path', osc_base_url() . $aRow['s_path']) . $aRow['pk_i_id'] . '_thumbnail.' . $aRow['s_extension'] . '" style="max-width: 60px; max-height: 60px;" /></div> <div id="media_list_filename">' . $aRow['s_content_type']; $row[] = '<a onclick="javascript:return confirm(\'' . osc_esc_js(__('This action can not be undone. Are you sure you want to continue?')) . '\')" href="' . osc_admin_base_url(true) . '?page=media&action=delete&id[]=' . $aRow['pk_i_id'] . '" id="dt_link_delete">' . __('Delete') . '</a>'; $row[] = '<a target="_blank" href="' . osc_item_url_ns($aRow['fk_i_item_id']) . '">item #' . $aRow['fk_i_item_id'] . '</a>'; $row[] = $aRow['dt_pub_date']; $count++; $this->result['aaData'][] = $row; } }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ // users autocomplete $('input[name="user"]').attr( "autocomplete", "off" ); $('#user,#fUser').autocomplete({ source: "<?php echo osc_admin_base_url(true); ?>?page=ajax&action=userajax", //+$('input[name="user"]').val(), // &term= minLength: 0, select: function( event, ui ) { if(ui.item.id=='') return false; $('#userId').val(ui.item.id); $('#fUserId').val(ui.item.id); }, search: function() { $('#userId').val(''); $('#fUserId').val(''); } }); $('.ui-autocomplete').css('zIndex', 10000); // check_all bulkactions $("#check_all").change(function(){ var isChecked = $(this).prop("checked"); $('.col-bulkactions input').each( function() { if( isChecked == 1 ) { this.checked = true; } else { this.checked = false; } }); }); // dialog delete $("#dialog-user-delete").dialog({ autoOpen: false, modal: true }); // dialog filters $('#display-filters').dialog({ autoOpen: false, modal: true, width: 700, title: '<?php echo osc_esc_js( __('Filters') ); ?>' }); $('#btn-display-filters').click(function(){ $('#display-filters').dialog('open'); return false; }); // dialog bulk actions $("#dialog-bulk-actions").dialog({ autoOpen: false, modal: true }); $("#bulk-actions-submit").click(function() { $("#datatablesForm").submit(); }); $("#bulk-actions-cancel").click(function() { $("#datatablesForm").attr('data-dialog-open', 'false'); $('#dialog-bulk-actions').dialog('close'); }); // dialog bulk actions function $("#datatablesForm").submit(function() { if( $("#bulk_actions option:selected").val() == "" ) { return false; } if( $("#datatablesForm").attr('data-dialog-open') == "true" ) { return true; } $("#dialog-bulk-actions .form-row").html($("#bulk_actions option:selected").attr('data-dialog-content')); $("#bulk-actions-submit").html($("#bulk_actions option:selected").text()); $("#datatablesForm").attr('data-dialog-open', 'true'); $("#dialog-bulk-actions").dialog('open'); return false; }); // /dialog bulk actions }); // dialog delete function function delete_dialog(item_id) { $("#dialog-user-delete input[name='id[]']").attr('value', item_id); $("#dialog-user-delete").dialog('open'); return false; } </script> <?php }
$.getJSON( "<?php echo osc_base_url(true); ?> ?page=ajax&action=check_username_availability", {"s_username": $("#s_username").attr("value")}, function(data){ clearInterval(cInterval); if(data.exists==0) { $("#available").text('<?php echo osc_esc_js(__("The username is available", "modern")); ?> '); } else { $("#available").text('<?php echo osc_esc_js(__("The username is NOT available", "modern")); ?> '); } } ); }, 1000); } }); }); </script> </head> <body> <?php osc_current_web_theme_path('header.php');
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ // Code for form validation $("form[name=permalinks_form]").validate({ rules: { rewrite_item_url: { required: true, minlength: 1 }, rewrite_page_url: { required: true, minlength: 1 }, rewrite_cat_url: { required: true, minlength: 1 }, rewrite_search_url: { required: true, minlength: 1 }, rewrite_search_country: { required: true, minlength: 1 }, rewrite_search_region: { required: true, minlength: 1 }, rewrite_search_city: { required: true, minlength: 1 }, rewrite_search_city_area: { required: true, minlength: 1 }, rewrite_search_category: { required: true, minlength: 1 }, rewrite_search_user: { required: true, minlength: 1 }, rewrite_search_pattern: { required: true, minlength: 1 }, rewrite_contact: { required: true, minlength: 1 }, rewrite_feed: { required: true, minlength: 1 }, rewrite_language: { required: true, minlength: 1 }, rewrite_item_mark: { required: true, minlength: 1 }, rewrite_item_send_friend: { required: true, minlength: 1 }, rewrite_item_contact: { required: true, minlength: 1 }, rewrite_item_activate: { required: true, minlength: 1 }, rewrite_item_edit: { required: true, minlength: 1 }, rewrite_item_delete: { required: true, minlength: 1 }, rewrite_item_resource_delete: { required: true, minlength: 1 }, rewrite_user_login: { required: true, minlength: 1 }, rewrite_user_dashboard: { required: true, minlength: 1 }, rewrite_user_logout: { required: true, minlength: 1 }, rewrite_user_register: { required: true, minlength: 1 }, rewrite_user_activate: { required: true, minlength: 1 }, rewrite_user_activate_alert: { required: true, minlength: 1 }, rewrite_user_profile: { required: true, minlength: 1 }, rewrite_user_items: { required: true, minlength: 1 }, rewrite_user_alerts: { required: true, minlength: 1 }, rewrite_user_recover: { required: true, minlength: 1 }, rewrite_user_forgot: { required: true, minlength: 1 }, rewrite_user_change_password: { required: true, minlength: 1 }, rewrite_user_change_email: { required: true, minlength: 1 }, rewrite_user_change_username: { required: true, minlength: 1 }, rewrite_user_change_email_confirm: { required: true, minlength: 1 } }, messages: { rewrite_item_url: { required: '<?php echo osc_esc_js(__("Listings url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Listings url: this field is required")); ?> .' }, rewrite_page_url: { required: '<?php echo osc_esc_js(__("Page url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Page url: this field is required")); ?> .' }, rewrite_cat_url: { required: '<?php echo osc_esc_js(__("Categories url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Categories url: this field is required")); ?> .' }, rewrite_search_url: { required: '<?php echo osc_esc_js(__("Search url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search url: this field is required")); ?> .' }, rewrite_search_country: { required: '<?php echo osc_esc_js(__("Search country: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search country: this field is required")); ?> .' }, rewrite_search_region: { required: '<?php echo osc_esc_js(__("Search region: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search region: this field is required")); ?> .' }, rewrite_search_city: { required: '<?php echo osc_esc_js(__("Search city: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search city: this field is required")); ?> .' }, rewrite_search_city_area: { required: '<?php echo osc_esc_js(__("Search city area: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search city area: this field is required")); ?> .' }, rewrite_search_category: { required: '<?php echo osc_esc_js(__("Search category: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search category: this field is required")); ?> .' }, rewrite_search_user: { required: '<?php echo osc_esc_js(__("Search user: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search user: this field is required")); ?> .' }, rewrite_search_pattern: { required: '<?php echo osc_esc_js(__("Search pattern: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Search pattern: this field is required")); ?> .' }, rewrite_contact: { required: '<?php echo osc_esc_js(__("Contact url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Contact url: this field is required")); ?> .' }, rewrite_feed: { required: '<?php echo osc_esc_js(__("Feed url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Feed url: this field is required")); ?> .' }, rewrite_language: { required: '<?php echo osc_esc_js(__("Language url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Language url: this field is required")); ?> .' }, rewrite_item_mark: { required: '<?php echo osc_esc_js(__("Listing mark url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Listing mark url: this field is required")); ?> .' }, rewrite_item_send_friend: { required: '<?php echo osc_esc_js(__("Listing send friend url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Listing send friend url: this field is required")); ?> .' }, rewrite_item_contact: { required: '<?php echo osc_esc_js(__("Listing contact url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Listing contact url: this field is required")); ?> .' }, rewrite_item_new: { required: '<?php echo osc_esc_js(__("New listing url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("New listing url: this field is required")); ?> .' }, rewrite_item_activate: { required: '<?php echo osc_esc_js(__("Activate listing url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Activate listing url: this field is required")); ?> .' }, rewrite_item_edit: { required: '<?php echo osc_esc_js(__("Edit listing url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Edit listing url: this field is required")); ?> .' }, rewrite_item_delete: { required: '<?php echo osc_esc_js(__("Delete listing url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Delete listing url: this field is required")); ?> .' }, rewrite_item_resource_delete: { required: '<?php echo osc_esc_js(__("Delete listing resource url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Delete listing resource url: this field is required")); ?> .' }, rewrite_user_login: { required: '<?php echo osc_esc_js(__("Login url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Login url: this field is required")); ?> .' }, rewrite_user_dashboard: { required: '<?php echo osc_esc_js(__("User dashboard url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("User dashboard url: this field is required")); ?> .' }, rewrite_user_logout: { required: '<?php echo osc_esc_js(__("Logout url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Logout url: this field is required")); ?> .' }, rewrite_user_register: { required: '<?php echo osc_esc_js(__("User register url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("User register url: this field is required")); ?> .' }, rewrite_user_activate: { required: '<?php echo osc_esc_js(__("Activate user url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Activate user url: this field is required")); ?> .' }, rewrite_user_activate_alert: { required: '<?php echo osc_esc_js(__("Activate alert url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Activate alert url: this field is required")); ?> .' }, rewrite_user_profile: { required: '<?php echo osc_esc_js(__("User profile url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("User profile url: this field is required")); ?> .' }, rewrite_user_items: { required: '<?php echo osc_esc_js(__("User listings url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("User listings url: this field is required")); ?> .' }, rewrite_user_alerts: { required: '<?php echo osc_esc_js(__("User alerts url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("User alerts url: this field is required")); ?> .' }, rewrite_user_recover: { required: '<?php echo osc_esc_js(__("Recover user url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Recover user url: this field is required")); ?> .' }, rewrite_user_forgot: { required: '<?php echo osc_esc_js(__("User forgot url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("User forgot url: this field is required")); ?> .' }, rewrite_user_change_password: { required: '<?php echo osc_esc_js(__("Change password url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Change password url: this field is required")); ?> .' }, rewrite_user_change_email: { required: '<?php echo osc_esc_js(__("Change email url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Change email url: this field is required")); ?> .' }, rewrite_user_change_username: { required: '<?php echo osc_esc_js(__("Change username url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Change username url: this field is required")); ?> .' }, rewrite_user_change_email_confirm: { required: '<?php echo osc_esc_js(__("Change email confirm url: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Change email confirm url: this field is required")); ?> .' } }, wrapper: "li", errorLabelContainer: "#error_list", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); }, submitHandler: function(form){ $('button[type=submit], input[type=submit]').attr('disabled', 'disabled'); form.submit(); } }); }); function showhide() { $("#inner_rules").toggle(); if($("#show_hide a").html()=='<?php echo osc_esc_js(__('Show rules')); ?> ') { $("#show_hide a").html('<?php echo osc_esc_js(__('Hide rules')); ?> '); resetLayout(); } else { $("#show_hide a").html('<?php echo osc_esc_js(__('Show rules')); ?> ') } } $(function() { $("#rewrite_enabled").click(function(){ $("#custom_rules").toggle(); }); }); </script> <?php }
$.getJSON( "<?php echo osc_base_url(true); ?> ?page=ajax&action=check_username_availability", {"s_username": $("#s_username").attr("value")}, function(data){ clearInterval(cInterval); if(data.exists==0) { $("#available").text('<?php echo osc_esc_js(__("The username is available", "bender")); ?> '); } else { $("#available").text('<?php echo osc_esc_js(__("The username is NOT available", "bender")); ?> '); } } ); }, 1000); } }); }); </script> <div class="form-container form-horizontal"> <div class="resp-wrapper"> <ul id="error_list"></ul> <form action="<?php
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ // Code for form validation $("form[name=settings_form]").validate({ rules: { pageTitle: { required: true, minlength: 1 }, contactEmail: { required: true, email: true }, num_rss_items: { required: true, digits: true }, max_latest_items_at_home: { required: true, digits: true }, default_results_per_page: { required: true, digits: true } }, messages: { pageTitle: { required: '<?php echo osc_esc_js(__("Page title: this field is required")); ?> .', minlength: '<?php echo osc_esc_js(__("Page title: this field is required")); ?> .' }, contactEmail: { required: '<?php echo osc_esc_js(__("Email: this field is required")); ?> .', email: '<?php echo osc_esc_js(__("Invalid email address")); ?> .' }, num_rss_items: { required: '<?php echo osc_esc_js(__("Listings shown in RSS feed: this field is required")); ?> .', digits: '<?php echo osc_esc_js(__("Listings shown in RSS feed: this field must only contain numeric characters")); ?> .' }, max_latest_items_at_home: { required: '<?php echo osc_esc_js(__("Latest listings shown: this field is required")); ?> .', digits: '<?php echo osc_esc_js(__("Latest listings shown: this field must only contain numeric characters")); ?> .' }, default_results_per_page: { required: '<?php echo osc_esc_js(__("The search page shows: this field is required")); ?> .', digits: '<?php echo osc_esc_js(__("The search page shows: this field must only contain numeric characters")); ?> .' } }, wrapper: "li", errorLabelContainer: "#error_list", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); }, submitHandler: function(form){ $('button[type=submit], input[type=submit]').attr('disabled', 'disabled'); form.submit(); } }); $("#market_disconnect").on('click', function() { var x = confirm('<?php _e('You are going to be disconnected from the Market, all your plugins and themes downloaded will remain installed and configured but you will not be able to update or download new plugins and themes. Are you sure?'); ?> '); if(x) { window.location = '<?php echo osc_admin_base_url(true); ?> ?page=settings&action=market_disconnect&<?php echo osc_csrf_token_url(); ?> '; } }) }); function custom_date(date_format) { $.getJSON( "<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=date_format", {"format" : date_format}, function(data){ if(data.str_formatted!='') { $("#custom_date").html(' <?php _e('Preview'); ?> : ' + data.str_formatted) } else { $("#custom_date").html(''); } } ); } function custom_time(time_format) { $.getJSON( "<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=date_format", {"format" : time_format}, function(data){ if(data.str_formatted!='') { $("#custom_time").html(' <?php _e('Preview'); ?> : ' + data.str_formatted) } else { $("#custom_time").html(''); } } ); } </script> <?php }
$(".sub_button").click(function(){ $.post('<?php echo osc_base_url(true); ?> ', {email:$("#alert_email").val(), userid:$("#alert_userId").val(), alert:$("#alert").val(), page:"ajax", action:"alerts"}, function(data){ if(data==1) { swal('<?php echo osc_esc_js(__('You have sucessfully subscribed to the alert', 'pop')); ?> '); } else if(data==-1) { swal('<?php echo osc_esc_js(__('Invalid email address', 'pop')); ?> '); } else { swal('<?php echo osc_esc_js(__('Could not subscribe to this alert', 'pop')); ?> '); }; }); return false; }); }); </script> <div class="alert_form"> <h3> <strong><?php _e('Subscribe to this search', 'pop'); ?> </strong>
echo osc_admin_base_url(true); ?> ?page=ajax&action=check_market", {"code" : $(this).attr('href').replace('#','')}, function(data){ if(data!=null) { $("#market_thumb").attr('src',data.s_thumbnail); $("#market_code").attr("value", data.s_slug); $("#market_name").html(data.s_title); $("#market_version").html(data.s_version); $("#market_author").html(data.s_contact_name); $("#market_url").attr('href',data.s_source_file); $('#market_installer').dialog({ modal:true, title: '<?php echo osc_esc_js(__('Osclass Market')); ?> ', width:485 }); } } ); return false; }); </script> </div> <!-- /themes list --> <?php osc_current_admin_theme_path('parts/footer.php');
$('.iframe-category').remove(); }); $(".jsMessage p").attr('class', 'ok'); message += ret.msg; $('.iframe-category').parent().parent().find('.name').html(ret.text); } else { $(".jsMessage p").attr('class', 'error'); message += ret.msg; } $(".jsMessage").fadeIn("fast"); $(".jsMessage p").html(message); $('div.content_list_<?php echo osc_category_id(); ?> ').html(''); }, error: function(){ $(".jsMessage").fadeIn("fast"); $(".jsMessage p").attr('class', ''); $(".jsMessage p").html('<?php echo osc_esc_js(__('Ajax error, please try again.')); ?> '); } }) return false; }); oscTab(); }); </script>
function customHead() { ?> <script type="text/javascript"> tinyMCE.init({ mode : "textareas", width: "100%", height: "440px", language: 'en', theme_advanced_toolbar_align : "left", theme_advanced_toolbar_location : "top", plugins : [ "advlist autolink lists link image charmap preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste" ], entity_encoding : "raw", theme_advanced_buttons1_add : "forecolorpicker,fontsizeselect", theme_advanced_buttons2_add: "media", theme_advanced_buttons3: "", theme_advanced_disable : "styleselect,anchor", relative_urls : false, remove_script_host : false, convert_urls : false }); $(document).ready(function(){ // dialog filters $('#dialog-test-it').dialog({ autoOpen: false, modal: true, width: 360, minHeight: 42, title: '<?php echo osc_esc_js(__('Send email')); ?> ' }); $('#btn-display-test-it').click(function(){ $('#dialog-test-it').dialog('open'); return false; }); $('#btn-test-it').click(function() { var name = $('input[name*="#s_title"]:visible').attr('name'); var locale = name.replace("#s_title",""); var idTinymce = locale+"#s_text"; $.post('<?php echo osc_admin_base_url(true); ?> ', { page: 'ajax', action: 'test_mail_template', email: $('input[name="test_email"]:visible').val(), title: $('input[name*="s_title"]:visible').val(), body: tinyMCE.get(idTinymce).getContent({format : 'html'}) }, function(data) { alert(data.html); }, 'json'); return false; }); }); </script> <?php }
function customHead() { ?> <script type="text/javascript" src="<?php echo osc_current_admin_theme_js_url('jquery.validate.min.js'); ?> "></script> <?php ItemForm::location_javascript_new('admin'); ?> <script type="text/javascript"> // autocomplete users $(document).ready(function(){ $('#filter-select').change( function () { var option = $(this).find('option:selected').attr('value') ; // clean values $('#fPattern,#fUser,#fItemId').attr('value', ''); if(option == 'oPattern') { $('#fPattern').removeClass('hide'); $('#fUser, #fItemId').addClass('hide'); } else if(option == 'oUser'){ $('#fUser').removeClass('hide'); $('#fPattern, #fItemId').addClass('hide'); } else { $('#fItemId').removeClass('hide'); $('#fPattern, #fUser').addClass('hide'); } }); $('input[name="user"]').attr( "autocomplete", "off" ); $('#user,#fUser').autocomplete({ source: "<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=userajax"+$('input[name="user"]').val(), // &term= minLength: 0, select: function( event, ui ) { if(ui.item.id=='') return false; $('#userId').val(ui.item.id); $('#fUserId').val(ui.item.id); }, search: function() { $('#userId').val(''); $('#fUserId').val(''); } }); // dialog delete $("#dialog-item-delete").dialog({ autoOpen: false, modal: true, title: '<?php echo osc_esc_js(__('Delete listing')); ?> ' }); // dialog bulk actions $("#dialog-bulk-actions").dialog({ autoOpen: false, modal: true }); $("#bulk-actions-submit").click(function() { $("#datatablesForm").submit(); }); $("#bulk-actions-cancel").click(function() { $("#datatablesForm").attr('data-dialog-open', 'false'); $('#dialog-bulk-actions').dialog('close'); }); // dialog bulk actions function $("#datatablesForm").submit(function() { if( $("#bulk_actions option:selected").val() == "" ) { return false; } if( $("#datatablesForm").attr('data-dialog-open') == "true" ) { return true; } $("#dialog-bulk-actions .form-row").html($("#bulk_actions option:selected").attr('data-dialog-content')); $("#bulk-actions-submit").html($("#bulk_actions option:selected").text()); $("#datatablesForm").attr('data-dialog-open', 'true'); $("#dialog-bulk-actions").dialog('open'); return false; }); // dialog filters $('#display-filters').dialog({ autoOpen: false, modal: true, width: 700, title: '<?php echo osc_esc_js(__('Filters')); ?> ' }); $('#btn-display-filters').click(function(){ $('#display-filters').dialog('open'); return false; }); // check_all bulkactions $("#check_all").change(function(){ var isChecked = $(this+':checked').length; $('.col-bulkactions input').each( function() { if( isChecked == 1 ) { this.checked = true; } else { this.checked = false; } }); }); }); // dialog delete function function delete_dialog(item_id) { $("#dialog-item-delete input[name='id[]']").attr('value', item_id); $("#dialog-item-delete").dialog('open'); return false; } </script> <?php }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ $('input:hidden[name="installed"]').each(function() { $(this).parent().parent().children().css('background', 'none') ; if( $(this).val() == '1' ) { if( $(this).attr("enabled") == 1 ) { $(this).parent().parent().css('background-color', '#EDFFDF') ; } else { $(this).parent().parent().css('background-color', '#FFFFDF') ; } } else { $(this).parent().parent().css('background-color', '#FFF0DF') ; } }); // dialog delete $("#dialog-uninstall").dialog({ autoOpen: false, modal: true, title: '<?php echo osc_esc_js(__('Uninstall plugin')); ?> ' }); }); // dialog delete function function uninstall_dialog(plugin) { $("#dialog-uninstall input[name='plugin']").attr('value', plugin); $("#dialog-uninstall").dialog('open'); return false; } </script> <?php }
* as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public * License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $sQuery = osc_get_preference('keyword_placeholder', 'modern_theme'); ?> <script type="text/javascript"> var sQuery = '<?php echo osc_esc_js($sQuery); ?> ' ; $(document).ready(function(){ if($('input[name=sPattern]').val() == sQuery) { $('input[name=sPattern]').css('color', 'gray'); } $('input[name=sPattern]').click(function(){ if($('input[name=sPattern]').val() == sQuery) { $('input[name=sPattern]').val(''); $('input[name=sPattern]').css('color', ''); } }); $('input[name=sPattern]').blur(function(){ if($('input[name=sPattern]').val() == '') {
function customHead() { $users = __get("users"); $max = __get("max"); $item = __get("item"); $users_by_country = __get("users_by_country"); $users_by_region = __get("users_by_region"); $latest_users = __get("latest_users"); ?> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <?php if (count($users) > 0) { ?> <script type="text/javascript"> // Load the Visualization API and the piechart package. google.load('visualization', '1', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. google.setOnLoadCallback(drawChart); // Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and // draws it. function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', '<?php echo osc_esc_js(__('Date')); ?> ',0,1); data.addColumn('number', '<?php echo osc_esc_js(__('New users')); ?> '); <?php $k = 0; echo "data.addRows(" . count($users) . ");"; foreach ($users as $date => $num) { echo "data.setValue(" . $k . ', 0, "' . $date . '");'; echo "data.setValue(" . $k . ", 1, " . $num . ");"; $k++; } ?> // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.AreaChart(document.getElementById('placeholder')); chart.draw(data, { colors:['#058dc7','#e6f4fa'], areaOpacity: 0.1, lineWidth:3, hAxis: { gridlines:{ color: '#333', count: 3 }, viewWindow:'explicit', showTextEvery: 2, slantedText: false, textStyle:{ color: '#058dc7', fontSize: 10 } }, vAxis: { gridlines:{ color: '#DDD', count: 4, style: 'dooted' }, viewWindow:'explicit', baselineColor:'#bababa' }, pointSize: 6, legend: 'none', chartArea:{ left:10, top:10, width:"95%", height:"80%" } }); var data_country = new google.visualization.DataTable(); data_country.addColumn('string', '<?php _e('Country'); ?> '); data_country.addColumn('number', '<?php _e('Users per country'); ?> '); data_country.addRows(<?php echo count($users_by_country); ?> ); <?php foreach ($users_by_country as $k => $v) { echo "data_country.setValue(" . $k . ", 0, '" . ($v['s_country'] == NULL ? __('Unknown') : $v['s_country']) . "');"; echo "data_country.setValue(" . $k . ", 1, " . $v['num'] . ");"; } ?> // Create and draw the visualization. new google.visualization.PieChart(document.getElementById('by_country')).draw(data_country, {title:null,height: 200}); var data_region = new google.visualization.DataTable(); data_region.addColumn('string', '<?php _e('Region'); ?> '); data_region.addColumn('number', '<?php _e('Users per region'); ?> '); data_region.addRows(<?php echo count($users_by_region); ?> ); <?php foreach ($users_by_region as $k => $v) { echo "data_region.setValue(" . $k . ", 0, '" . ($v['s_region'] == NULL ? __('Unknown') : $v['s_region']) . "');"; echo "data_region.setValue(" . $k . ", 1, " . $v['num'] . ");"; } ?> // Create and draw the visualization. new google.visualization.PieChart(document.getElementById('by_region')).draw(data_region, {title:null,height: 200}); } </script> <?php } }
public static function location_javascript($path = "front") { ?> <script type="text/javascript"> $(document).ready(function(){ $("#countryId").live("change",function(){ var pk_c_code = $(this).val(); <?php if ($path == "admin") { ?> var url = '<?php echo osc_admin_base_url(true) . "?page=ajax&action=regions&countryId="; ?> ' + pk_c_code; <?php } else { ?> var url = '<?php echo osc_base_url(true) . "?page=ajax&action=regions&countryId="; ?> ' + pk_c_code; <?php } ?> var result = ''; if(pk_c_code != '') { $("#regionId").attr('disabled',false); $("#cityId").attr('disabled',true); $.ajax({ type: "POST", url: url, dataType: 'json', success: function(data){ var length = data.length; if(length > 0) { result += '<option value=""><?php _e("Select a region..."); ?> </option>'; for(key in data) { result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>'; } $("#region").before('<select name="regionId" id="regionId" ></select>'); $("#region").remove(); $("#city").before('<select name="cityId" id="cityId" ></select>'); $("#city").remove(); $("#regionId").val(""); } else { $("#regionId").before('<input type="text" name="region" id="region" />'); $("#regionId").remove(); $("#cityId").before('<input type="text" name="city" id="city" />'); $("#cityId").remove(); } $("#regionId").html(result); $("#cityId").html('<option selected value=""><?php _e("Select a city..."); ?> </option>'); } }); } else { // add empty select $("#region").before('<select name="regionId" id="regionId" ><option value=""><?php _e("Select a region..."); ?> </option></select>'); $("#region").remove(); $("#city").before('<select name="cityId" id="cityId" ><option value=""><?php _e("Select a city..."); ?> </option></select>'); $("#city").remove(); if( $("#regionId").length > 0 ){ $("#regionId").html('<option value=""><?php _e("Select a region..."); ?> </option>'); } else { $("#region").before('<select name="regionId" id="regionId" ><option value=""><?php _e("Select a region..."); ?> </option></select>'); $("#region").remove(); } if( $("#cityId").length > 0 ){ $("#cityId").html('<option value=""><?php _e("Select a city..."); ?> </option>'); } else { $("#city").before('<select name="cityId" id="cityId" ><option value=""><?php _e("Select a city..."); ?> </option></select>'); $("#city").remove(); } $("#regionId").attr('disabled',true); $("#cityId").attr('disabled',true); } }); $("#regionId").live("change",function(){ var pk_c_code = $(this).val(); <?php if ($path == "admin") { ?> var url = '<?php echo osc_admin_base_url(true) . "?page=ajax&action=cities®ionId="; ?> ' + pk_c_code; <?php } else { ?> var url = '<?php echo osc_base_url(true) . "?page=ajax&action=cities®ionId="; ?> ' + pk_c_code; <?php } ?> var result = ''; if(pk_c_code != '') { $("#cityId").attr('disabled',false); $.ajax({ type: "POST", url: url, dataType: 'json', success: function(data){ var length = data.length; if(length > 0) { result += '<option selected value=""><?php _e("Select a city..."); ?> </option>'; for(key in data) { result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>'; } $("#city").before('<select name="cityId" id="cityId" ></select>'); $("#city").remove(); } else { result += '<option value=""><?php _e('No results'); ?> </option>'; $("#cityId").before('<input type="text" name="city" id="city" />'); $("#cityId").remove(); } $("#cityId").html(result); } }); } else { $("#cityId").attr('disabled',true); } }); if( $("#regionId").attr('value') == "") { $("#cityId").attr('disabled',true); } if($("#countryId").length != 0) { if( $("#countryId").attr('type').match(/select-one/) ) { if( $("#countryId").attr('value') == "") { $("#regionId").attr('disabled',true); } } } /** * Validate form */ // Validate description without HTML. $.validator.addMethod( "minstriptags", function(value, element) { altered_input = strip_tags(value); if (altered_input.length < 3) { return false; } else { return true; } }, "<?php _e("Description: needs to be longer"); ?> ." ); // Code for form validation $("form[name=item]").validate({ rules: { catId: { required: true, digits: true }, <?php if (osc_price_enabled_at_items()) { ?> price: { maxlength: 15 }, currency: "required", <?php } ?> <?php if (osc_images_enabled_at_items()) { ?> "photos[]": { accept: "<?php echo osc_allowed_extension(); ?> " }, <?php } ?> <?php if ($path == 'front') { ?> contactName: { minlength: 3, maxlength: 35 }, contactEmail: { required: true, email: true }, <?php } ?> regionId: { required: true, digits: true }, cityId: { required: true, digits: true }, cityArea: { minlength: 3, maxlength: 50 }, address: { minlength: 3, maxlength: 100 } }, messages: { catId: "<?php _e('Choose one category'); ?> .", <?php if (osc_price_enabled_at_items()) { ?> price: { maxlength: "<?php _e("Price: no more than 50 characters"); ?> ." }, currency: "<?php _e("Currency: make your selection"); ?> .", <?php } ?> <?php if (osc_images_enabled_at_items()) { ?> "photos[]": { accept: "<?php printf(__("Photo: must be %s"), osc_allowed_extension()); ?> ." }, <?php } ?> <?php if ($path == 'front') { ?> contactName: { minlength: "<?php _e("Name: enter at least 3 characters"); ?> .", maxlength: "<?php _e("Name: no more than 35 characters"); ?> ." }, contactEmail: { required: "<?php _e("Email: this field is required"); ?> .", email: "<?php _e("Invalid email address"); ?> ." }, <?php } ?> regionId: "<?php _e("Select a region"); ?> .", cityId: "<?php _e("Select a city"); ?> .", cityArea: { minlength: "<?php _e("City area: enter at least 3 characters"); ?> .", maxlength: "<?php _e("City area: no more than 50 characters"); ?> ." }, address: { minlength: "<?php _e("Address: enter at least 3 characters"); ?> .", maxlength: "<?php _e("Address: no more than 100 characters"); ?> ." } }, errorLabelContainer: "#error_list", wrapper: "li", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); } }); }); /** * Strip HTML tags to count number of visible characters. */ function strip_tags(html) { if (arguments.length < 3) { html=html.replace(/<\/?(?!\!)[^>]*>/gi, ''); } else { var allowed = arguments[1]; var specified = eval("["+arguments[2]+"]"); if (allowed){ var regex='</?(?!(' + specified.join('|') + '))\b[^>]*>'; html=html.replace(new RegExp(regex, 'gi'), ''); } else{ var regex='</?(' + specified.join('|') + ')\b[^>]*>'; html=html.replace(new RegExp(regex, 'gi'), ''); } } return html; } function delete_image(id, item_id,name, secret) { //alert(id + " - "+ item_id + " - "+name+" - "+secret); var result = confirm('<?php echo osc_esc_js(__("This action can't be undone. Are you sure you want to continue?")); ?> '); if(result) { $.ajax({ type: "POST", url: '<?php echo osc_base_url(true); ?> ?page=ajax&action=delete_image&id='+id+'&item='+item_id+'&code='+name+'&secret='+secret, dataType: 'json', success: function(data){ var class_type = "error"; if(data.success) { $("div[name="+name+"]").remove(); class_type = "ok"; } var flash = $("#flash_js"); var message = $('<div>').addClass('pubMessages').addClass(class_type).attr('id', 'FlashMessage').html(data.msg); flash.html(message); $("#FlashMessage").slideDown('slow').delay(3000).slideUp('slow'); } }); } } </script> <?php }
echo osc_get_canonical(); ?> "/> <?php } ?> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="Expires" content="Fri, Jan 01 1970 00:00:00 GMT" /> <script type="text/javascript"> var fileDefaultText = '<?php echo osc_esc_js(__('No file selected', 'modern')); ?> '; var fileBtnText = '<?php echo osc_esc_js(__('Choose File', 'modern')); ?> '; </script> <?php osc_enqueue_style('style', osc_current_web_theme_url('style.css')); osc_enqueue_style('tabs', osc_current_web_theme_url('tabs.css')); osc_enqueue_style('jquery-ui-datepicker', osc_assets_url('css/jquery-ui/jquery-ui.css')); osc_register_script('jquery-uniform', osc_current_web_theme_js_url('jquery.uniform.js'), 'jquery'); osc_register_script('global', osc_current_web_theme_js_url('global.js')); osc_enqueue_script('jquery'); osc_enqueue_script('jquery-ui'); osc_enqueue_script('jquery-uniform'); osc_enqueue_script('tabber'); osc_enqueue_script('global');
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ // Code for form validation $("form[name=comments_form]").validate({ rules: { num_moderate_comments: { required: true, digits: true }, comments_per_page: { required: true, digits: true } }, messages: { num_moderate_comments: { required: '<?php echo osc_esc_js(__("Moderated comments: this field is required")); ?> .', digits: '<?php echo osc_esc_js(__("Moderated comments: this field must only contain numeric characters")); ?> .' }, comments_per_page: { required: '<?php echo osc_esc_js(__("Comments per page: this field is required")); ?> .', digits: '<?php echo osc_esc_js(__("Comments per page: this field must only contain numeric characters")); ?> .' } }, wrapper: "li", errorLabelContainer: "#error_list", invalidHandler: function(form, validator) { $('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'}); }, submitHandler: function(form){ $('button[type=submit], input[type=submit]').attr('disabled', 'disabled'); form.submit(); } }); if( !$('input[name="moderate_comments"]').is(':checked') ) { $('.comments_approved').css('display', 'none'); } $('input[name="moderate_comments"]').bind('change', function() { if( $(this).is(':checked') ) { $('.comments_approved').css('display', ''); } else { $('.comments_approved').css('display', 'none'); } }); }); </script> <?php }
function customHead() { ?> <script type="text/javascript"> document.write('<style type="text/css">.tabber{ display:none; }</style>'); </script> <style> .placeholder { background-color: #cfcfcf; } .footest .category_div { opacity: 0.8; } .list-categories li { opacity: 1 !important; } .category_div { background: #ffffff; } .alert-custom { background-color: #FDF5D9; border-bottom: 1px solid #EEDC94; color: #404040; } .cat-hover, .cat-hover .category_row{ background-color:#fffccc !important; background:#fffccc !important; } </style> <script type="text/javascript"> $(function() { $('.category_div').on('mouseenter',function(){ $(this).addClass('cat-hover'); }).on('mouseleave',function(){ $(this).removeClass('cat-hover'); }); var list_original = ''; $('.sortable').nestedSortable({ disableNesting: 'no-nest', forcePlaceholderSize: true, handle: '.handle', helper: 'clone', listType: 'ul', items: 'li', maxLevels: 4, opacity: .6, placeholder: 'placeholder', revert: 250, tabSize: 25, tolerance: 'pointer', toleranceElement: '> div', create: function(event, ui) { }, start: function(event, ui) { list_original = $('.sortable').nestedSortable('serialize'); $(ui.helper).addClass('footest'); $(ui.helper).prepend('<div style="opacity: 1 !important; padding:5px;" class="alert-custom"><?php echo osc_esc_js(__('Note: You must expand the category in order to make it a subcategory.')); ?> </div>'); }, stop: function(event, ui) { $(".jsMessage").fadeIn("fast"); $(".jsMessage p").attr('class', ''); $(".jsMessage p").html('<img height="16" width="16" src="<?php echo osc_current_admin_theme_url('images/loading.gif'); ?> "> <?php echo osc_esc_js(__('This action could take a while.')); ?> '); var list = ''; list = $('.sortable').nestedSortable('serialize'); var array_list = $('.sortable').nestedSortable('toArray'); var l = array_list.length; for(var k = 0; k < l; k++ ) { if( array_list[k].item_id == $(ui.item).find('div').attr('category_id') ) { if( array_list[k].parent_id == 'root' ) { $(ui.item).closest('.toggle').show(); } break; } } if( !$(ui.item).parent().hasClass('sortable') ) { $(ui.item).parent().addClass('subcategory'); } if(list_original != list) { var plist = array_list.reduce(function ( total, current, index ) { total[index] = {'c' : current.item_id, 'p' : current.parent_id}; return total; }, {}); $.ajax({ type: 'POST', url: "<?php echo osc_admin_base_url(true) . "?page=ajax&action=categories_order&" . osc_csrf_token_url(); ?> ", data: {'list' : plist}, context: document.body, success: function(res){ var ret = eval( "(" + res + ")"); var message = ""; if( ret.error ) { $(".jsMessage p").attr('class', 'error'); message += ret.error; } if( ret.ok ){ $(".jsMessage p").attr('class', 'ok'); message += ret.ok; } $(".jsMessage").show(); $(".jsMessage p").html(message); }, error: function(){ $(".jsMessage").fadeIn("fast"); $(".jsMessage p").attr('class', ''); $(".jsMessage p").html('<?php echo osc_esc_js(__('Ajax error, please try again.')); ?> '); } }); list_original = list; } } }); $(".toggle").bind("click", function(e) { var list = $(this).parents('li').first().find('ul'); var lili = $(this).closest('li').find('ul').find('li').find('ul'); var li = $(this).closest('li').first(); if( $(this).hasClass('status-collapsed') ) { $(li).removeClass('no-nest'); $(list).show(); $(lili).hide(); $(this).removeClass('status-collapsed').addClass('status-expanded'); $(this).html('-'); } else { $(li).addClass('no-nest'); $(list).hide(); $(this).removeClass('status-expanded').addClass('status-collapsed'); $(this).html('+'); } }); // dialog delete $("#dialog-delete-category").dialog({ autoOpen: false, modal: true }); $("#category-delete-submit").click(function() { var id = $("#dialog-delete-category").attr('data-category-id'); var url = '<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=delete_category&<?php echo osc_csrf_token_url(); ?> &id=' + id; $.ajax({ url: url, context: document.body, success: function(res) { var ret = eval( "(" + res + ")"); var message = ""; if( ret.error ) { message += ret.error; $(".jsMessage p").attr('class', 'error'); } if( ret.ok ) { message += ret.ok; $(".jsMessage p").attr('class', 'ok'); $('#list_'+id).fadeOut("slow"); $('#list_'+id).remove(); } $(".jsMessage").show(); $(".jsMessage p").html(message); }, error: function() { $(".jsMessage").show(); $(".jsMessage p").attr('class', ''); $(".jsMessage p").html("<?php echo osc_esc_js(__('Ajax error, try again.')); ?> "); } }); $('#dialog-delete-category').dialog('close'); $('body,html').animate({ scrollTop: 0 }, 500); return false; }); }); list_original = $('.sortable').nestedSortable('serialize'); function show_iframe(class_name, id) { if($('.content_list_'+id+' .iframe-category').length == 0){ $('.iframe-category').remove(); var name = 'frame_'+ id; var id_ = 'frame_'+ id; var url = '<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=category_edit_iframe&id=' + id; $.ajax({ url: url, context: document.body, success: function(res){ $('div.' + class_name).html(res); $('div.' + class_name).fadeIn("fast"); } }); } else { $('.iframe-category').remove(); } return false; } function delete_category(id) { $("#dialog-delete-category").attr('data-category-id', id); $("#dialog-delete-category").dialog('open'); return false; } function enable_cat(id) { var enabled; $(".jsMessage").fadeIn("fast"); $(".jsMessage p").attr('class', ''); $(".jsMessage p").html('<img height="16" width="16" src="<?php echo osc_current_admin_theme_url('images/loading.gif'); ?> "> <?php echo osc_esc_js(__('This action could take a while.')); ?> '); if( $('div[category_id=' + id + ']').hasClass('disabled') ) { enabled = 1; } else { enabled = 0; } var url = '<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=enable_category&<?php echo osc_csrf_token_url(); ?> &id=' + id + '&enabled=' + enabled; $.ajax({ url: url, context: document.body, success: function(res) { var ret = eval( "(" + res + ")"); var message = ""; if(ret.error) { message += ret.error; $(".jsMessage p").attr('class', 'error'); } if(ret.ok) { if( enabled == 0 ) { $('div[category_id=' + id + ']').addClass('disabled'); $('div[category_id=' + id + ']').removeClass('enabled'); $('div[category_id=' + id + ']').find('a.enable').text('<?php _e('Enable'); ?> '); for(var i = 0; i < ret.affectedIds.length; i++) { id = ret.affectedIds[i].id; $('div[category_id=' + id + ']').addClass('disabled'); $('div[category_id=' + id + ']').removeClass('enabled'); $('div[category_id=' + id + ']').find('a.enable').text('<?php _e('Enable'); ?> '); } } else { $('div[category_id=' + id + ']').removeClass('disabled'); $('div[category_id=' + id + ']').addClass('enabled'); $('div[category_id=' + id + ']').find('a.enable').text('<?php _e('Disable'); ?> '); for(var i = 0; i < ret.affectedIds.length; i++) { id = ret.affectedIds[i].id; $('div[category_id=' + id + ']').removeClass('disabled'); $('div[category_id=' + id + ']').addClass('enabled'); $('div[category_id=' + id + ']').find('a.enable').text('<?php _e('Disable'); ?> '); } } message += ret.ok; $(".jsMessage p").attr('class', 'ok'); } $(".jsMessage").show(); $(".jsMessage p").html(message); }, error: function(){ $(".jsMessage").show(); $(".jsMessage p").attr('class', ''); $(".jsMessage p").html("<?php echo osc_esc_js(__('Ajax error, try again.')); ?> "); } }); } </script> <?php }