Skip to content

Commit

Permalink
Item1268: improved visibility of row separators in browsers other tha…
Browse files Browse the repository at this point in the history
…n Firefox; compressed long javascript; ran perltidy

git-svn-id: http://svn.foswiki.org/trunk@3124 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
ArthurClemens authored and ArthurClemens committed Mar 15, 2009
1 parent fec1286 commit 6c12056
Show file tree
Hide file tree
Showing 5 changed files with 1,148 additions and 1,093 deletions.
45 changes: 24 additions & 21 deletions EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/Core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use Foswiki::Plugins::EditTablePlugin::Data;
my $DEFAULT_FIELD_SIZE = 16;
my $PLACEHOLDER_BUTTONROW_TOP = 'PLACEHOLDER_BUTTONROW_TOP';
my $PLACEHOLDER_BUTTONROW_BOTTOM = 'PLACEHOLDER_BUTTONROW_BOTTOM';
my $PLACEHOLDER_SEPARATOR_SEARCH_RESULTS = 'PLACEHOLDER_SEPARATOR_SEARCH_RESULTS';
my $PLACEHOLDER_SEPARATOR_SEARCH_RESULTS =
'PLACEHOLDER_SEPARATOR_SEARCH_RESULTS';
my $HTML_TAGS =
qr'var|ul|u|tt|tr|th|td|table|sup|sub|strong|strike|span|small|samp|s|pre|p|ol|li|kbd|ins|img|i|hr|h|font|em|div|dfn|del|code|cite|center|br|blockquote|big|b|address|acronym|abbr|a';

Expand Down Expand Up @@ -171,9 +172,9 @@ sub processText {
my $topic = $query->param('ettabletopic') || $inTopic;
my $web = $query->param('ettableweb') || $inWeb;

my $paramTableNr = $query->param('ettablenr') || 0;
my $tableNr = 0; # current EditTable table
my $isParamTable = 0;
my $paramTableNr = $query->param('ettablenr') || 0;
my $tableNr = 0; # current EditTable table
my $isParamTable = 0;
my $rowNr = 0; # current row number; starting at 1
my $doEdit = 0;
my $allowedToEdit = 0;
Expand Down Expand Up @@ -201,8 +202,8 @@ sub processText {
}
my $tableData = $tableMatrix{$web}{$topic};

handleSearchResultsBelowEditTables($topicText, $paramTableNr, $tableData);
handleSearchResultsBelowEditTables( $topicText, $paramTableNr, $tableData );

my $editTableObjects = $tableData->{editTableObjects};

# ========================================
Expand Down Expand Up @@ -501,21 +502,20 @@ s/$PATTERN_TABLE_ROW/handleTableRow( $1, $2, $tableNr, $isNewRow, $rowNr, $doEdi
# END WRITE OUT PROCESSED ROWS
# ========================================


# ========================================
# START PUT PROCESSED TABLE BACK IN TEXT
my $resultText = join( "", @result );

my $searchResultsText = $editTableObject->{'searchResults'} || '';
$resultText .= $searchResultsText;
my $searchResultsText = $editTableObject->{'searchResults'} || '';
$resultText .= $searchResultsText;

$resultText = "$editTableTag\n$resultText";

Foswiki::Func::writeDebug(
"EditTablePlugin::Core::processText - after processing, resultText before expandCommonVariables:$resultText"
) if $Foswiki::Plugins::EditTablePlugin::debug;

# ========================================
# ========================================
# FORM END
my $rowCount = 0;
if ( ( $mode & $MODE->{READ} ) && !$doEdit ) {
Expand All @@ -535,7 +535,7 @@ s/$PATTERN_TABLE_ROW/handleTableRow( $1, $2, $tableNr, $isNewRow, $rowNr, $doEdi

# END FORM END
# ========================================

# button row at top or bottom
if ( ( $mode & $MODE->{READ} ) ) {
my $pos = $params{'buttonrow'} || 'bottom';
Expand All @@ -551,7 +551,7 @@ s/$PATTERN_TABLE_ROW/handleTableRow( $1, $2, $tableNr, $isNewRow, $rowNr, $doEdi
$resultText =~ s/$PLACEHOLDER_BUTTONROW_BOTTOM/$buttonRow/go;
}
}

# render variables (only in view mode)
$resultText = Foswiki::Func::expandCommonVariables($resultText)
if ( !$doEdit && ( $mode & $MODE->{READ} ) );
Expand Down Expand Up @@ -1648,22 +1648,25 @@ For instance:
=cut

sub handleSearchResultsBelowEditTables {

# my $text = $_[0]
# my $editTableNr = $_[1]
# my $tableData = $_[2]

$_[0] =~ s/(<!--%EDITTABLESTUB{([0-9]+)}%-->\s+)((\s*)\|.*\|)\s+/addSearchResultsTableTextToTableObject($_[2], $_[1], $1, $2, $3)/geos;

$_[0] =~
s/(<!--%EDITTABLESTUB{([0-9]+)}%-->\s+)((\s*)\|.*\|)\s+/addSearchResultsTableTextToTableObject($_[2], $_[1], $1, $2, $3)/geos;
}

sub addSearchResultsTableTextToTableObject {
my ($inTableData, $inEditTableNr, $inTag, $inTableNumber, $inTableText) = @_;

my ( $inTableData, $inEditTableNr, $inTag, $inTableNumber, $inTableText ) =
@_;

# do not offer expanded table in edit mode
return "$inTag$inTableText\n" if ($inEditTableNr == $inTableNumber);
return "$inTag$inTableText\n" if ( $inEditTableNr == $inTableNumber );

$inTableData->{editTableObjects}->[ $inTableNumber - 1 ]->{searchResults} =
"$inTableText\n";

$inTableData->{editTableObjects}->[$inTableNumber - 1]->{searchResults} = "$inTableText\n";

return $inTag;
}

Expand Down
10 changes: 5 additions & 5 deletions EditTablePlugin/lib/Foswiki/Plugins/EditTablePlugin/build.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
# Build for EditTablePlugin
#
BEGIN {
foreach my $pc (split(/:/, $ENV{FOSWIKI_LIBS})) {
unshift @INC, $pc;
}
foreach my $pc ( split( /:/, $ENV{FOSWIKI_LIBS} ) ) {
unshift @INC, $pc;
}
}

use Foswiki::Contrib::Build;

# Create the build object
$build = new Foswiki::Contrib::Build( 'EditTablePlugin' );
$build = new Foswiki::Contrib::Build('EditTablePlugin');

# Build the target on the command line, or the default target
$build->build($build->{target});
$build->build( $build->{target} );

19 changes: 6 additions & 13 deletions EditTablePlugin/pub/System/EditTablePlugin/edittable.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
background:none;
}
.editTableActionSelectedCell {
background-color:#069;
background:#069;
}
.foswikiTableEven textarea,
.foswikiTableEven .editTableTextarea,
Expand All @@ -47,16 +47,15 @@
margin:0 2px;
}
.editTableRowSeparator {
padding:0;
margin:0;
line-height:1px;
border:none;
background-color:#fff;
background-color:#eee;
height:4px;
cursor:default;
}
.editTableRowSeparatorHover {
.editTableMoveMode .editTableRowSeparator {
}
.editTableMoveMode .editTableRowSeparatorHover {
background-color:#069;
height:10px;
cursor:move;
}
.editTableMoveMode .editTableActionCell img {
Expand All @@ -65,9 +64,3 @@
.editTableMoveMode .editTableActionSelectedCell img {
visibility:visible;
}
.editTableMoveMode .editTableRowSeparator {
/**/
}
.editTableMoveMode .editTableRowSeparator {
background-image:url(separator_bg_anim.gif);
}
Loading

0 comments on commit 6c12056

Please sign in to comment.