Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1441

Přidáno uživatelem Ondřej Fibich před asi 12 roky(ů)

Upravy:
- procisteni JavaScriptu

Zobrazit rozdíly:

freenetis/branches/network/media/css/m.style.css
margin: 20px;
}
.ico_add {
margin-left: 5px;
}
.grid_table tr td .textarea {
width: 200px;
}
freenetis/branches/network/media/css/style.css
width: auto ! important;
}
.ico_add {
margin-left: 5px;
}
.grid_table tr td .textarea {
width: 200px;
}
freenetis/branches/network/application/libraries/forge/Form_Dropdown.php
if ($add_button)
{
$html .= ' ' . html::anchor(
url_lang::base().$this->data['add_button'],
html::image(array
(
'src' => url::base() . 'media/images/icons/ico_add.gif',
//'class' => 'ico_add',
'id' => $this->data['name'] . '_add_button'
)), array
(
'class' => 'popup-add popup_link',
'title' => $add_button_title
)
$this->data['add_button'], html::image(array
(
'src' => 'media/images/icons/ico_add.gif',
'id' => $this->data['name'] . '_add_button'
)), array
(
'class' => 'popup-add popup_link',
'title' => $add_button_title
)
);
}
freenetis/branches/network/application/views/js/base.php
// After document load
$(document).ready(function()
{
/**
* Reload given element from given URL
* Due to bug in jQuery element has to be given as selector
......
}
// sort unordered grids
$("table").tablesorter();
$('table').tablesorter();
<?php if (!$nobase): ?>
$("#loading-overlay").hide();
$('#loading-overlay').hide();
context = $('html');
var r_get = null;
editorInit = function (){
editorInit = function ()
{
tinyMCE.init({
// General options
entity_encoding : "raw",
......
};
/**
* Contructor of dialog class, creates new dialog
*
* @author Michal
* @param integer id
* @param object parent
*/
* Contructor of dialog class, creates new dialog
*
* @author Michal
* @param integer id
* @param object parent
*/
function Dialog(id, parent)
{
this.id = id;
......
type: 'POST',
url: this._url+glue+'noredirect=1',
data: data,
success: function (data){
success: function (data)
{
if (data.length)
{
// detecting returned data's type by first character
......
// result is html
case '<':
parent._format = 'html';
parent._data = $(data).find("#content-padd");
parent._data = $(data).find('#content-padd');
break;
// result is json
case '{':
parent._format = 'json';
parent._data = jQuery.parseJSON(data);
break;
}
}
......
// set title of dialog
this.setOption('title', $("h2:first", this._data).html());
var status = $('<div>').append($(this._data).find(".status-message").clone()).remove().html();
var status = $('<div>').append($(this._data).find('.status-message').clone()).remove().html();
// remove breadcrumbs and h2
$(this._data).children(".breadcrumbs, h2, .status-message").remove();
$(this._data).children('.breadcrumbs, h2, .status-message').remove();
// remove br only from beginning
while (true)
{
if (!$(this._data).children(":first").is('br'))
if (!$(this._data).children(':first').is('br'))
break;
$(this._data).children(":first").remove();
$(this._data).children(':first').remove();
}
$(this._data).find(".popup_link").each(function (){
$(this._data).find('.popup_link').each(function (){
dialogs.links.add($(this), parent);
});
......
*/
show: function ()
{
this._element.dialog("open");
this._element.dialog('open');
},
/**
......
*/
hide: function ()
{
this._element.dialog("close");
this._element.dialog('close');
},
/**
......
*/
setOption: function (key, value)
{
this._element.dialog("option", key, value);
this._element.dialog('option', key, value);
},
/**
......
*/
getOption: function (key)
{
this._element.dialog("option", key);
this._element.dialog('option', key);
},
/**
......
*/
getFormData: function ()
{
$(".right_dropdown:visible").each(function (){
$("#"+this.id+" option").attr("selected", "selected");
$('.right_dropdown:visible').each(function ()
{
$('#'+this.id+' option').attr('selected', 'selected');
});
return this._element.find("form").serializeArray();
......
};
// adding popup links
$('.popup_link').each(function (){
$('.popup_link').each(function ()
{
dialogs.links.add(($(this)));
});
......
if (parent === undefined)
{
// reload content div with new data
reload_element("#content-padd", window.location.href);
reload_element('#content-padd', window.location.href);
$('html, body').animate({scrollTop: 0}, 'slow');
}
else
......
*
* @author Michal Kliment
*/
$(".dialog form:not(.nopopup)").live("submit", function(){
$('.dialog form:not(.nopopup)').live("submit", function(){
// get dialog
var dialog = dialogs.get($(this).parent());
var glue = ($(this).attr("action").indexOf('?') == -1) ? '?' : '&';
var glue = ($(this).attr('action').indexOf('?') == -1) ? '?' : '&';
var url = $(this).attr("action")+glue+"noredirect=1";
var url = $(this).attr('action')+glue+'noredirect=1';
// find link which open this dialog
var link = dialogs.links.get($(this).parent());
......
dialogs.hide();
// reload content div with new data
reload_element("#content-padd", url);
reload_element('#content-padd', url);
$('html, body').animate({scrollTop: 0}, 'slow');
}
else
......
dialogs.hide();
// reload content div with new data
reload_element("#content-padd", url);
reload_element('#content-padd', url);
$('html, body').animate({scrollTop: 0}, 'slow');
}
else
......
// set up for password checker
$.validator.passwordRating.messages = {
"too-short": "<?php echo __('Too short') ?>",
"very-weak": "<?php echo __('Very weak') ?>",
"weak": "<?php echo __('Weak') ?>",
"good": "<?php echo __('Good') ?>",
"strong": "<?php echo __('Strong') ?>"
'too-short': '<?php echo __('Too short') ?>',
'very-weak': '<?php echo __('Very weak') ?>',
'weak': '<?php echo __('Weak') ?>',
'good': '<?php echo __('Good') ?>',
'strong': '<?php echo __('Strong') ?>'
}
// validate all form
$(".form").validate();
$('.form').validate();
// jQuery tabs
$("#tabs").tabs();
$(".tabs").tabs();
$('#tabs, .tabs').tabs();
// activate date picker on class .date after focus
$(".date").live('focus', function ()
$('.date').live('focus', function ()
{
$(this).datepicker({
dateFormat: "yy-mm-dd",
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
onClose: function(dateText, inst) {
onClose: function(dateText, inst)
{
$(this).trigger('keyup');
}
});
......
// gave focus to focus classed objects
$('.focus').focus();
// opens pop up for adding after on-clicking at add icon
$('.ico_add').live("click", function()
{
var href = ($(this).attr('href') != undefined) ? $(this).attr('href') : $(this).parent().attr('href');
var left = parseInt((screen.availWidth/2) - (500/2));
var top = parseInt((screen.availHeight/2) - (400/2));
var win = window.open(href, 'formpopup', 'width=500,height=400,left='+left+',top='+top);
win.focus();
if (window.opener == null)
window.opener = self;
return false;
});
/* AJAX fulltext search */
......
})();
// AJAX search after keypress
$("#keyword").keypress(function()
$('#keyword').keypress(function()
{
// start search
delay (function ()
{
if ($("#keyword").val().length >=1)
if ($('#keyword').val().length >=1)
{
if (r_get != null)
{
r_get.abort();
r_get = null;
}
$("#whisper").html("<img src='<?php echo url::base() ?>media/images/icons/animations/ajax-loader-big.gif' class='ajax-loader-big'>");
$("#whisper").show('slow');
$('#whisper').html('<img src="<?php echo url::base() ?>media/images/icons/animations/ajax-loader-big.gif" class="ajax-loader-big" />');
$('#whisper').show('slow');
r_get = $.get("<?php echo url_lang::base() ?>search/ajax/", {
q: $("#keyword").val()
r_get = $.get('<?php echo url_lang::base() ?>search/ajax/', {
q: $('#keyword').val()
}, function (data)
{
$("#whisper").html(data);
$('#whisper').html(data);
r_get = null;
});
}
else
$("#whisper").hide('slow');
$('#whisper').hide('slow');
}, 200);
});
// trigger search also after on-click action
$("#keyword").click(function ()
$('#keyword').click(function ()
{
$("#keyword").trigger("keypress");
$('#keyword').trigger('keypress');
});
/* Input helpers */
// fix MAC values in inputs
$(".mac, .mac_address").live("keyup", function ()
$('.mac, .mac_address').live('keyup', function ()
{
$(this).val(str_replace('-', ':', $(this).val()));
});
$(".group-button").click(function (){
$('.group-button').click(function (){
var items = '.' + $(this).parent().parent().attr('id') + '-items';
if ($(items).is(":visible"))
if ($(items).is(':visible'))
{
$(items).hide();
var img = 'add';
......
$(this).parent().toggleClass('disable');
});
$("form").submit(function () {
$("form").children(".form").children().children(":hidden").children().children("input, select, textarea").remove();
$('form').submit(function ()
{
$('form').children('.form').children().children(':hidden').children().children('input, select, textarea').remove();
});
values = new Array();
......
function update_select_multiple()
{
$('select[multiple="multiple"]').not(".v, .left_dropdown, .right_dropdown").each(function (){
$('select[multiple="multiple"]').not('.v, .left_dropdown, .right_dropdown').each(function ()
{
var id = this.id;
var html = $(this).parent().html();
$(this).parent().html("<table style='margin-top: 15px; margin-bottom: 15px;'><tr><td><select id='"+this.id+"_options'></select></td><td><table style='width:100px;text-align:center;'><tr><td><input title='<?php echo __('Remove items') ?>' style='width: 80px' type=button class='dropdown_button right_dropdown_button' id='"+this.id+"_right_button' value='◄ <?php echo __('Remove') ?>'></td></tr><tr><td>&nbsp;</td></tr><tr><td><input title='<?php echo __('Add items') ?>' style='width: 80px' type=button class='dropdown_button left_dropdown_button' id='"+this.id+"_left_button' value='<?php echo __('Add') ?> ►'></td></tr></table></td><td>"+html+"</td></tr><tr><td><input type=text class='dropdown_button_search' id='"+this.id+"_options_button_search'><input type='button' style='width: 30px;' value='X' class='dropdown_button_search_clear' id='"+this.id+"_options_button_search_clear'></td><td>&nbsp;</td><td><input type=text class='dropdown_button_search' id='"+this.id+"_button_search'><input type='button' style='width: 30px;' value='X' class='dropdown_button_search_clear' id='"+this.id+"_button_search_clear'></td></tr></table>");
$("#"+this.id).parent().parent().children("th").css('width', '100px');
$("#"+this.id).addClass('right_dropdown')
$("#"+this.id).removeClass('required')
$("#"+this.id).css('width', '250px');
$('#'+this.id).parent().parent().children("th").css('width', '100px');
$('#'+this.id).addClass('right_dropdown')
$('#'+this.id).removeClass('required')
$('#'+this.id).css('width', '250px');
$("#"+this.id+"_options").css('width', '250px');
$("#"+this.id+"_options").attr("size", $(this).attr("size"));
$("#"+this.id+"_options").attr("multiple", "multiple");
$("#"+this.id+"_options").addClass('left_dropdown');
$('#'+this.id+'_options').css('width', '250px');
$('#'+this.id+'_options').attr("size", $(this).attr("size"));
$('#'+this.id+'_options').attr("multiple", "multiple");
$('#'+this.id+'_options').addClass('left_dropdown');
var options = '';
$("#"+this.id+" option").not(":selected").each(function (){
$('#'+this.id+" option").not(":selected").each(function ()
{
options += '<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>'
$(this).remove();
});
$("#"+this.id+"_options").html(options);
$('#'+this.id+'_options').html(options);
$("#"+this.id+" option").removeAttr("selected");
$('#'+this.id+" option").removeAttr("selected");
values[id] = new Array();
values[id+"_options"] = new Array();
values[id+'_options'] = new Array();
$("#"+id+" option").each(function (){
$('#'+id+" option").each(function ()
{
values[id][values[id].length] = {'key': $(this).attr('value'), 'value': $(this).html()};
});
$("#"+id+"_options option").each(function (){
values[id+"_options"][values[id+"_options"].length] = {'key': $(this).attr('value'), 'value': $(this).html()};
$('#'+id+"_options option").each(function ()
{
values[id+'_options'][values[id+'_options'].length] = {'key': $(this).attr('value'), 'value': $(this).html()};
});
});
......
values: []
};
$("#"+select_id+"_options").children().each(function (){
$('#'+select_id+'_options').children().each(function ()
{
limit.values.push($(this).val());
});
limit.values.push(new_option_id);
reload_element("#"+select_id+"_options", "<?php echo url_lang::base().url_lang::current(0,1) ?>", limit, "#"+select_id);
reload_element('#'+select_id+'_options', "<?php echo url_lang::base().url_lang::current(0,1) ?>", limit, '#'+select_id);
}
$('select[multiple="multiple"] option').live("dblclick", function (){
if ($(this).parent().hasClass('right_dropdown'))
$('select[multiple="multiple"] option').live("dblclick", function ()
{
if ($(this).parent().hasClass('right_dropdown'))
{
var id = $(this).parent().attr('id');
$('#'+id+'_options').append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id, id+'_options');
}
else
{
var id = str_replace('_options', "", $(this).parent().attr('id'));
$('#'+id).append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id+'_options', id);
}
$(this).remove();
$('.dropdown_button_search').trigger('keyup');
});
$(".dropdown_button").live('click', function ()
{
if ($(this).hasClass('right_dropdown_button'))
{
var id = str_replace('_right_button', '', this.id);
$('#'+id+" option:selected").each(function()
{
var id = $(this).parent().attr('id');
$("#"+id+"_options").append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id, id+"_options");
}
else
$('#'+id+'_options').append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id, id+'_options');
$(this).remove();
});
}
else
{
var id = str_replace('_left_button', '', this.id);
$('#'+id+"_options option:selected").each(function()
{
var id = str_replace("_options", "", $(this).parent().attr('id'));
$("#"+id).append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id+"_options", id);
}
$(this).remove();
$(".dropdown_button_search").trigger('keyup');
$('#'+id).append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id+'_options', id);
$(this).remove();
});
}
$('.dropdown_button_search').trigger('keyup');
});
$(".dropdown_button").live('click', function (){
if ($(this).hasClass('right_dropdown_button'))
{
var id = str_replace("_right_button", "", this.id);
$("#"+id+" option:selected").each(function(){
$("#"+id+"_options").append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id, id+"_options");
$(this).remove();
});
}
else
{
var id = str_replace("_left_button", "", this.id);
$("#"+id+"_options option:selected").each(function(){
$("#"+id).append('<option value="'+$(this).attr('value')+'">'+$(this).text()+'</option>');
dropdown_update_values($(this).attr('value'), $(this).text(), id+"_options", id);
$(this).remove();
});
}
$(".dropdown_button_search").trigger('keyup');
});
$(".dropdown_button_search").live('keyup', function (){
$('.dropdown_button_search').live('keyup', function ()
{
var id = str_replace("_button_search", "", this.id);
$("#"+id).html("");
$('#'+id).html("");
for (var i in values[id])
{
if (strtolower(values[id][i]['value']).search(strtolower($(this).val())) != -1)
{
$("#"+id).append('<option value="'+values[id][i]['key']+'">'+values[id][i]['value']+'</option>');
$('#'+id).append('<option value="'+values[id][i]['key']+'">'+values[id][i]['value']+'</option>');
}
}
});
$(".dropdown_button_search_clear").live('click', function(){
var id = str_replace("_clear", "", this.id);
$('.dropdown_button_search_clear').live('click', function()
{
var id = str_replace('_clear', '', this.id);
$("#"+id).val("");
$("#"+id).trigger("keyup");
$('#'+id).val('').trigger('keyup');
});
$("form").submit(function(){
$("form .right_dropdown").each(function (){
$("#"+this.id+" option").attr("selected", "selected");
$('form').submit(function()
{
$('form .right_dropdown').each(function ()
{
$('#'+this.id+" option").attr('selected', true);
});
});
......
return (value == '' || value.match(/^([0-9]+[k|M|G|T]?)(\/[0-9]+[k|M|G|T]?)?$/i));
}, '<?php echo __('Bad format.') ?>');
$("#grid-label").append(" | <span id='export-grid-button' class='hand'><img src='<?php echo url::base() ?>media/images/icons/grid_action/transfer.png'> <?php echo __('Export')?></span>");
$('#grid-label').append(" | <span id='export-grid-button' class='hand'><img src='<?php echo url::base() ?>media/images/icons/grid_action/transfer.png'> <?php echo __('Export')?></span>");
$("#export-grid-button").click(function(){
$('#export-grid-button').click(function()
{
$('#export-form').attr('action', '<?php echo url_lang::base() ?>export/grid');
$('#export-form-html').val($('.grid_table').html());
$('#export-form-filename').val($('#content h2').text());
$export_dialog.dialog('open');
$("#export-form").attr("action", "<?php echo url_lang::base() ?>export/grid");
$("#export-form-html").val($(".grid_table").html());
$("#export-form-filename").val($("#content h2").text());
$export_dialog.dialog("open");
$("#export-form").submit(function (){
$export_dialog.dialog("close");
$('#export-form').submit(function ()
{
$export_dialog.dialog('close');
});
});
$("textarea").not(".wysiwyg").autoResize();
$('textarea').not('.wysiwyg').autoResize();
/* FIX-ME: Commented by Ondřej Fibich at 22.1.2012
* This code causes funanbol import crash

Také k dispozici: Unified diff