function check_len() { if(!document.getElementById('id_filef').value.length) { alert("Вы забыли выбрать Excel файл") return false; } return true; } function csv_form_valid() { if (checkbox_checker()) { if (check_len()) { return true; } } return false; } function checkbox_checker3() { if($("input[name='shops'][checked='true']").val()==undefined && $("input[name='points'][checked='true']").val()==undefined && $("input[name='stocks'][checked='true']").val()==undefined) { alert('Вы не выбрали ни одной точки продаж.\n'); return false; } else { //alert('shop selected'); return true; } } function checkbox_checker() { var checkbox_choices_shops = 0; var checkbox_choices_points = 0; var checkbox_choices_stocks = 0; if (document.forms[0].shops !=undefined) { if (document.forms[0].shops.length==undefined) { if(document.forms[0].shops.checked) { checkbox_choices_shops = 1; } } for (counter = 0; counter < document.forms[0].shops.length; counter++) { if (document.forms[0].shops[counter].checked) { checkbox_choices_shops = checkbox_choices_shops + 1; } } } if (document.forms[0].points !=undefined) { if (document.forms[0].points.length==undefined) { if(document.forms[0].points.checked) { checkbox_choices_points = 1; } } for (counter = 0; counter < document.forms[0].points.length; counter++) { if (document.forms[0].points[counter].checked) { checkbox_choices_points = checkbox_choices_points + 1; } } } if (document.forms[0].stocks !=undefined) { if (document.forms[0].stocks.length==undefined) { if(document.forms[0].stocks.checked) { checkbox_choices_stocks = 1; } } for (counter = 0; counter < document.forms[0].stocks.length; counter++) { if (document.forms[0].stocks[counter].checked) { checkbox_choices_stocks = checkbox_choices_stocks + 1; } } } if (checkbox_choices_shops == 0 && checkbox_choices_points == 0 && checkbox_choices_stocks == 0) { msg="Вы не выбрали ни одной точки продаж.\n" alert(msg) return (false); } //document.forms[0].submit(); return (true); } function checkbox_checker2() { var checkbox_choices_shops = 0; var checkbox_choices_points = 0; var checkbox_choices_stocks = 0; if (document.forms[1].shops !=undefined) { if (document.forms[1].shops.length==undefined) { if(document.forms[1].shops.checked) { checkbox_choices_shops = 1; } } for (counter = 0; counter < document.forms[1].shops.length; counter++) { if (document.forms[1].shops[counter].checked) { checkbox_choices_shops = checkbox_choices_shops + 1; } } } if (document.forms[1].points !=undefined) { if (document.forms[1].points.length==undefined) { if(document.forms[1].points.checked) { checkbox_choices_points = 1; } } for (counter = 0; counter < document.forms[1].points.length; counter++) { if (document.forms[1].points[counter].checked) { checkbox_choices_points = checkbox_choices_points + 1; } } } if (document.forms[1].stocks !=undefined) { if (document.forms[1].stocks.length==undefined) { if(document.forms[1].stocks.checked) { checkbox_choices_stocks = 1; } } for (counter = 0; counter < document.forms[1].stocks.length; counter++) { if (document.forms[1].stocks[counter].checked) { checkbox_choices_stocks = checkbox_choices_stocks + 1; } } } if (checkbox_choices_shops == 0 && checkbox_choices_points == 0 && checkbox_choices_stocks == 0) { msg="Вы не выбрали ни одной точки продаж.\n" alert(msg) return (false); } return (true); } function checkbox_checker4() { var checkbox_choices_shops = 0; var checkbox_choices_points = 0; var checkbox_choices_stocks = 0; if (document.forms[0].disc_shops !=undefined) { if (document.forms[0].disc_shops.length==undefined) { if(document.forms[0].disc_shops.checked) { checkbox_choices_shops = 1; } } for (counter = 0; counter < document.forms[0].disc_shops.length; counter++) { if (document.forms[0].disc_shops[counter].checked) { checkbox_choices_shops = checkbox_choices_shops + 1; } } } if (document.forms[0].disc_points !=undefined) { if (document.forms[0].disc_points.length==undefined) { if(document.forms[0].disc_points.checked) { checkbox_choices_points = 1; } } for (counter = 0; counter < document.forms[0].disc_points.length; counter++) { if (document.forms[0].disc_points[counter].checked) { checkbox_choices_points = checkbox_choices_points + 1; } } } if (document.forms[0].disc_stocks !=undefined) { if (document.forms[0].disc_stocks.length==undefined) { if(document.forms[0].disc_stocks.checked) { checkbox_choices_stocks = 1; } } for (counter = 0; counter < document.forms[0].disc_stocks.length; counter++) { if (document.forms[0].disc_stocks[counter].checked) { checkbox_choices_stocks = checkbox_choices_stocks + 1; } } } if (checkbox_choices_shops == 0 && checkbox_choices_points == 0 && checkbox_choices_stocks == 0) { msg="Вы не выбрали ни одной точки продаж.\n" alert(msg) return (false); } return (true); } function switch_obj(div_id) { if (document.getElementById(div_id).style.display=='none') { document.getElementById(div_id).style.display=''; } else { document.getElementById(div_id).style.display='none'; } } function CheckAll() { for (var i = 0; i < document.FormList.elements.length; i++) { if(document.FormList.elements[i].type == 'checkbox'){ document.FormList.elements[i].checked = !(document.FormList.elements[i].checked); } } } function SubmitControl(tocheack) { if (document.all || document.getElementById) { for (i=0; i < tocheack.length;i++) { if(tocheack.elements[i].type.toLowerCase()=="submit"||tocheack.elements[i].type.toLowerCase()=="reset") { tocheack.elements[i].disabled = true } } } } function loadIHelp(id) { $.get("/shops_admin/ajax_ihelp/", {id: id }, function(data){ $("#ihelp_"+id).html(data); }); } function show_tooltip(name,width) { jQuery.get("/shops_admin/ajax_ihelp/", {id: name}, function(data){ $("#ihelp_details_"+name).html(data); }); jQuery("#tooltip_" + name).css("width", width+"px"); jQuery("#tooltip_" + name).show('slow'); }; function hide_tooltip(name) { jQuery("#tooltip_" + name).hide('slow'); } function saveIHelp(id) { caption = document.getElementById('id_caption_'+id).value; details = document.getElementById('id_details_'+id).value; width = document.getElementById('id_width_'+id).value; $.post("/shops_admin/ajax_ihelp/", {id: id, caption:caption, details:details, width:width}, function(data){ $("#ihelp_saved_"+id).html('Сохранено'); }); } function get_description(id, obj_id, obj_type, is_mod, is_global){ if (is_mod){ if(is_global){ var templ_id = $('#id_module_template_block').val(); }else{ var templ_id = $('#id_module_template').val(); } }else{ var templ_id = $('#id_template').val(); } $.get("/shops_admin/ajax_get_template_name/", { templ_id:templ_id, is_mod: is_mod, is_global: is_global, obj_id: obj_id, obj_type: obj_type} , function(data){ $("#"+id).html(data); }); } function imgType(){ var e = $("input[name='img_type']:checked").val(); if (e == 'upload'){ $('#div_upload').show(); $('#div_choose').hide(); $('#div_dropbox').hide(); }else if (e == 'choose'){ $('#div_upload').hide(); $('#div_choose').show(); $('#div_dropbox').hide(); }else{ $('#div_upload').hide(); $('#div_choose').hide(); $('#div_dropbox').show(); loadDropbox('/'); } } function imgTypeDef(){ var e = $("input[name='img_type_def']:checked").val(); if (e == 'upload'){ $('#div_upload_def').show(); $('#div_choose_def').hide(); $('#div_dropbox_def').hide(); } else if (e == 'choose'){ $('#div_upload_def').hide(); $('#div_choose_def').show(); $('#div_dropbox_def').hide(); }else{ $('#div_upload_def').hide(); $('#div_choose_def').hide(); $('#div_dropbox_def').show(); loadDropboxDef('/'); } } function imgTypeFiles(){ var e = $("input[name='img_type']:checked").val(); if (e == 'upload'){ $('#div_upload').show(); $('#div_dropbox').hide(); }else{ $('#div_upload').hide(); $('#div_dropbox').show(); loadDropboxFiles('/'); } } if (typeof jQuery != 'undefined') { $(function(){ if (($("input[name='img_type']:checked")).length){ var e = $("input[name='img_type']:checked").val(); if (e != 'upload'){ imgType(); } var e2 = $("input[name='img_type_def']:checked").val(); if (e2 != 'upload'){ imgTypeDef(); } } }); } function loadDropboxDef(folder){ $.get("/shops_admin/ajax_load_dropbox/", {folder: folder, radio:1 }, function(data){ $("#div_droplist_def").html(data); }); } function loadDropbox(folder){ $.get("/shops_admin/ajax_load_dropbox/", {folder: folder, radio:0 }, function(data){ $("#div_droplist").html(data); }); } function loadDropboxFiles(folder){ $.get("/shops_admin/ajax_load_dropbox/", {folder: folder, radio:0, files: 1 }, function(data){ $("#div_droplist").html(data); }); } function loadBank(radio){ var v = $('#id_img_folder').val(); $.get("/shops_admin/ajax_load_img_bank/", {folder: v, radio:radio }, function(data){ $("#div_img_bank").html(data); }); } function loadBankDef(radio){ var v = $('#id_img_folder_def').val(); $.get("/shops_admin/ajax_load_img_bank/", {folder: v, radio:radio }, function(data){ $("#div_img_bank_def").html(data); }); }