Skip to content

Commit

Permalink
Remove compressed MantisBT JavaScript
Browse files Browse the repository at this point in the history
The two versions (development and 'production') are out of sync with
each other. As stated before, it is better for us to bundle compressed
'production' versions of the MantisBT JavaScript files when we're
preparing the release packages. This will avoid the issue of JavaScript
files becoming out of sync in the repository (not a good situation).
  • Loading branch information
davidhicks committed Mar 5, 2011
1 parent 8ea1b7a commit f86a9be
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 412 deletions.
1 change: 0 additions & 1 deletion admin/check/check_paths_inc.php
Expand Up @@ -114,7 +114,6 @@
'packages',
'scripts',
'tests',
'javascript' . DIRECTORY_SEPARATOR . 'dev'
);

foreach( $t_developer_directories as $t_developer_directory ) {
Expand Down
5 changes: 2 additions & 3 deletions core/html_api.php
Expand Up @@ -151,9 +151,8 @@ function html_rss_link() {
}

/**
* Prints a <script> tag to include a javascript file.
* This includes either minimal or development file from /javascript depending on whether mantis is set for debug/production use
* @param string $p_filename
* Prints a <script> tag to include a JavaScript file.
* @param string $p_filename Name of JavaScript file (with extension) to include
* @return null
*/
function html_javascript_link( $p_filename) {
Expand Down
101 changes: 100 additions & 1 deletion javascript/bugFilter.js
@@ -1 +1,100 @@
var begin_form='';var form_fields=new Array();var serialized_form_fields=new Array();$(document).ready(function(){var i=0;$('[name=filters_open]').find('input').each(function(){var formname=$(this).parent('form').attr('name');if(formname!='list_queries_open'&&formname!='open_queries'&&formname!='save_query'){if($.inArray($(this).attr('name'),form_fields)==-1){form_fields[i]=$(this).attr('name');i++}}});$.each(form_fields,function(index,value){serialized_form_fields[value]=$('[name=filters_open]').find('[name='+value+']').serialize()});begin_form=$('[name=filters_open]').serialize();$('[:input').live("change",function(){filter_highlight_changes($(this))});$(':checkbox').live("click",function(){filter_highlight_changes($(this))})});function filter_toggle_field_changed(field){var field_type=field.attr('type');var starting_value=serialized_form_fields[field.attr('name')];var current_value=field.serialize();if(field_type=='checkbox'&&current_value==''){current_value=undefined}if(current_value!=starting_value){filter_field_dirty(field)}else{filter_field_clean(field)}}function filter_highlight_changes(item){filter_toggle_field_changed(item);var changed_form=$('[name=filters_open]').serialize();if(begin_form==changed_form){filter_clean_all()}}function filter_named_filter_clean(){var selected_text=$('[name=source_query_id] option:selected').html();if(selected_text.charAt(0)=='*'){$('[name=source_query_id]').removeClass('tainted');var reset_text=selected_text.substring(2,selected_text.length);$('[name=source_query_id] option:selected').html(reset_text)}}function filter_named_filter_dirty(){var stored_query_id=$('[name=source_query_id]').val();if(stored_query_id==-1){return}var selected_text=$('[name=source_query_id] option:selected').html();if(selected_text.charAt(0)!='*'){$('[name=source_query_id] option:selected').prepend('* ');$('[name=source_query_id]').addClass('tainted')}}function filter_field_clean(item){item.parent().removeClass('tainted')}function filter_field_dirty(item){if(!item.parent().hasClass('tainted')){filter_named_filter_dirty();item.parent().addClass('tainted')}}function filter_clean_all(){filter_named_filter_clean();$('.tainted').each(function(){$(this).removeClass('tainted')})}
var begin_form = '';
var form_fields = new Array();
var serialized_form_fields = new Array();
$(document).ready(function(){
var i = 0;
$('[name=filters_open]').find('input').each(function() {
var formname = $(this).parent('form').attr('name');
if( formname != 'list_queries_open' && formname != 'open_queries' && formname != 'save_query' ) {
// serialize the field and add it to an array

if( $.inArray($(this).attr('name'),form_fields) == -1 ) {
form_fields[i] = $(this).attr('name');
i++;
}
}
});
$.each( form_fields, function (index, value) {
serialized_form_fields[value] = $('[name=filters_open]').find('[name=' + value.replace(/[]/g, '\\$1') + ']').serialize();
});

/* Set up events to modify the form css to show when a stored query has been modified */
begin_form = $('[name=filters_open]').serialize();

$('[:input').live("change", function() {
filter_highlight_changes($(this));
});
$(':checkbox').live("click", function() {
filter_highlight_changes($(this));
});
});

function filter_toggle_field_changed(field) {
var field_type = field.attr('type');
var starting_value = serialized_form_fields[field.attr('name')];
var current_value = field.serialize();

// unchecked boxes start as undefined but if checked and then unchecked it
// is no longer undefined so the comparison breaks. Reset it to undefined.
if( field_type=='checkbox' && current_value == '') {
current_value = undefined;
}
if( current_value != starting_value ) {
// field is changed
filter_field_dirty(field);
} else {
// field is not changed
filter_field_clean(field);
}
}

function filter_highlight_changes(item) {
filter_toggle_field_changed( item );

/* Check if form is different that started with */
var changed_form = $('[name=filters_open]').serialize();
if( begin_form == changed_form ) {
filter_clean_all();
}
}

function filter_named_filter_clean() {
/* be sure it's clean whether it's stored filter or not */
var selected_text = $('[name=source_query_id] option:selected').html();
if( selected_text.charAt(0) == '*' ) {
$('[name=source_query_id]').removeClass('tainted');
var reset_text = selected_text.substring(2,selected_text.length);
$('[name=source_query_id] option:selected').html(reset_text);
}
}

function filter_named_filter_dirty() {
var stored_query_id = $('[name=source_query_id]').val();
if( stored_query_id == -1 ) {
/* Only make it dirty if it's a stored filter */
return;
}
/* stored query in filter is tainted */
var selected_text = $('[name=source_query_id] option:selected').html();
if( selected_text.charAt(0) != '*' ) {
$('[name=source_query_id] option:selected').prepend('* ');
$('[name=source_query_id]').addClass('tainted');
}
}

function filter_field_clean( item ) {
item.parent().removeClass('tainted');
}
function filter_field_dirty( item ) {
if( !item.parent().hasClass('tainted') ) {
filter_named_filter_dirty();
item.parent().addClass('tainted');
}
}

function filter_clean_all() {
filter_named_filter_clean();
$('.tainted').each(function() {
$(this).removeClass('tainted');
});
}
100 changes: 0 additions & 100 deletions javascript/dev/bugFilter.js

This file was deleted.

0 comments on commit f86a9be

Please sign in to comment.