ACC SHELL
// two styles paths passed to tiny_mce
//styles = "css/styles.css";
styles = "/www/css/mce_rules.css";
$(document).ready(function(){
// rewrite dates to human friendly
dt2human();
// helpy
$('.m-help span').addClass('m-help-in');
$('.m-help[class!="m-help-in"]').hover(function(){
$(this).addClass("hover-help");
$('.hover-help span').show("fast");
});
$('.m-help').mouseout(function(){
$(this).removeClass("hover-help");
$('.m-help span').stop(true,true).hide("fast");
});
// focuses
$('input, textarea').focus(function(){
// TODO: str_replace
$('._'+$(this).attr('name').replace("[","-").replace("]","")+' span').show('fast');
})
$('input, textarea').blur(function(){
$('._'+$(this).attr('name').replace("[","-").replace("]","")+' span').stop(true,true).hide('fast');
})
if('datepicker' in $( ".datepicker" )){
$( ".datepicker" ).datepicker();
$( ".format" ).change(function() {
$( ".datepicker" ).datepicker( "option", "dateFormat", "yy-mm-dd" );
});
}
})
if(window.tinyMCE != undefined){
tinyMCE.init({
content_css : "/views/_default/www/css/mce.css",
convert_urls : false,
relative_urls : false,
//plugins: "table, fullscreen",
plugins : "autolink,lists,spellchecker,pagebreak,style,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
entities : "38,amp,34,quot,60,lt,62,gt",
mode : "specific_textareas",
editor_selector : "mce",
theme : "advanced",
theme_advanced_buttons1 : "bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,link,anchor,image,removeformat,|,formatselect,fontsizeselect,code", // cleanup,unlink
theme_advanced_buttons2 : "tablecontrols,|,hr,outdent,indentsub,sup,charmap,iespell,media,|,undo,redo,fullscreen", // visualaid
theme_advanced_buttons3 : "",
language : "en",
theme_advanced_path : true,
theme_advanced_toolbar_location : 'bottom',
//theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
theme_advanced_blockformats : "h1,h2,h3",
theme_advanced_toolbar_align : "center",
theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
theme_advanced_more_colors : 1,
theme_advanced_row_height : 23,
theme_advanced_resize_horizontal : 1,
theme_advanced_resizing_use_cookie : 1,
theme_advanced_font_sizes : "1,2,4,5",
theme_advanced_font_selector : "span"
});
}
var citac_odeslanych = 0;
var citac_prijatych = 0;
var preteceni = 0;
var errors = "";
function display_error(name,cont){
$('#error_'+name).html(cont);
}
function control_input(name,form_name,only_error,ajax_path,tagtyp){
elements = document.getElementsByName(name);
element = elements[elements.length-1];
value = element.value;
if(tagtyp=="checkbox"){
value = (element.checked?"0":"1");
}
if(!only_error || element.className.indexOf(' not_valid') != -1){
processAjax(form_name,"value="+value+"&name="+name+"&citac="+citac_odeslanych+"&only_error="+only_error+"&ajax_path="+ajax_path,ajax_path); //treti parametr.... +others
citac_odeslanych++;
}
}
function processAjax(form_name,parameters,ajax_path) {
var http_request = false;
var request = "form_name="+form_name+"&"+parameters;
if (window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (error) {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
}
http_request.onreadystatechange = function() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
if(http_request.responseText!=""){
//alert(http_request.responseText);
if(document.getElementById('in')) document.getElementById('in').innerHTML = http_request.responseText;
eval(http_request.responseText);
}
}
}
};
http_request.open('POST', ajax_path, true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send(request);
}
function dt2human (){
var e = $(".date, .datetime, .datetimesec");
var re1 = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
var re2 = /^(\d+)\-(\d+)\-(\d+)$/;
var re3 = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)$/;
for(var i=0;i<e.length;i++){
if (re1.exec(e[i].value)) e[i].value = (RegExp.$3*1+". "+RegExp.$2*1+". "+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5); //+":"+RegExp.$6
if (re2.exec(e[i].value)) e[i].value = (RegExp.$3*1+". "+RegExp.$2*1+". "+RegExp.$1);
if (re3.exec(e[i].value)) e[i].value = (RegExp.$3*1+". "+RegExp.$2*1+". "+RegExp.$1+" "+RegExp.$4+":"+RegExp.$5);
}
}
ACC SHELL 2018