Changeset 4804
- Timestamp:
- 09/08/09 16:22:20 (3 years ago)
- Location:
- trunk/FlowchartPlugin/lib/Foswiki/Plugins
- Files:
-
- 2 edited
-
FlowchartPlugin.pm (modified) (5 diffs)
-
FlowchartPlugin/build.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/FlowchartPlugin/lib/Foswiki/Plugins/FlowchartPlugin.pm
r4803 r4804 14 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details, published at 16 # GNU General Public License for more details, published at 17 17 # http://www.gnu.org/copyleft/gpl.html 18 18 … … 22 22 # ========================= 23 23 use vars qw( 24 $web $topic $user $installWeb $VERSION $RELEASE $pluginName25 $debug $exampleCfgVar26 );24 $web $topic $user $installWeb $VERSION $RELEASE $pluginName 25 $debug $exampleCfgVar 26 ); 27 27 28 28 # This should always be $Rev$ so that Foswiki can determine the checked-in … … 36 36 our $RELEASE = '09 Sep 2009'; 37 37 38 our $pluginName = 'FlowchartPlugin'; # Name of this Plugin39 40 our $NO_PREFS_IN_TOPIC = 1; # don't get preferences from plugin topic38 our $pluginName = 'FlowchartPlugin'; # Name of this Plugin 39 40 our $NO_PREFS_IN_TOPIC = 1; # don't get preferences from plugin topic 41 41 42 42 # ========================= 43 sub initPlugin 44 { 43 sub initPlugin { 45 44 ( $topic, $web, $user, $installWeb ) = @_; 46 45 47 46 # Get plugin debug flag 48 $debug = Foswiki::Func::getPluginPreferencesFlag( "DEBUG" ); 49 50 # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... 51 $exampleCfgVar = Foswiki::Func::getPluginPreferencesValue( "EXAMPLE" ) || "default"; 47 $debug = Foswiki::Func::getPluginPreferencesFlag("DEBUG"); 48 49 # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... 50 $exampleCfgVar = Foswiki::Func::getPluginPreferencesValue("EXAMPLE") 51 || "default"; 52 52 53 53 # Plugin correctly initialized 54 Foswiki::Func::writeDebug( "- Foswiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK" ) if $debug; 54 Foswiki::Func::writeDebug( 55 "- Foswiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK") 56 if $debug; 55 57 return 1; 56 58 } 57 59 58 59 60 # ========================= 60 sub commonTagsHandler 61 { 61 sub commonTagsHandler { 62 62 ### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead 63 63 64 Foswiki::Func::writeDebug( "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )" ) if $debug; 64 Foswiki::Func::writeDebug( 65 "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )") 66 if $debug; 65 67 66 68 # do custom extension rule, like for example: 67 69 $_[0] =~ s/%FLOWCHART%/&mostraFluxograma($_[0], $_[1], $_[2], '')/ge; 68 $_[0] =~ s/%FLOWCHART\{([^\n]*?)\}%/&mostraFluxograma($_[0], $_[1], $_[2], $1)/ge; 70 $_[0] =~ 71 s/%FLOWCHART\{([^\n]*?)\}%/&mostraFluxograma($_[0], $_[1], $_[2], $1)/ge; 69 72 $_[0] =~ s/\s*%FLOWCHART_BR%\s*/ /g; 70 73 $_[0] =~ s/%FLOWCHART_START%//g; … … 74 77 my %fluxItens; 75 78 my $totItens = 0; 76 my %caixa = ( 77 'w' => 0, 78 'h' => 0, 79 'areaX' => 0, 80 'areaY' => 0, 81 'bigerPosX' => 1, 82 'bigerPosY' => 1, 83 'color_start' => 'c0d8c0', 84 'color_end' => 'b0b8c0', 85 'color_end-error' => 'e0a0a0', 86 'color_action' => 'c0d0e0', 87 'color_question' => 'e0d0c0', 88 'style' => 'fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible;' 79 my %caixa = ( 80 'w' => 0, 81 'h' => 0, 82 'areaX' => 0, 83 'areaY' => 0, 84 'bigerPosX' => 1, 85 'bigerPosY' => 1, 86 'color_start' => 'c0d8c0', 87 'color_end' => 'b0b8c0', 88 'color_end-error' => 'e0a0a0', 89 'color_action' => 'c0d0e0', 90 'color_question' => 'e0d0c0', 91 'style' => 92 'fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible;' 89 93 ); 90 94 my %seta = ( 91 'N' => "M 5,0 L 0,10 L 5,8 L 10,10 L 5,0 z",92 'S' => "M 5,10 L 0,0 L 5,2 L 10,0 L 5,10 z",93 'L' => "M 10,5 L 0,0 L 2,5 L 0,10 L 10,5 z",94 'O' => "M 0,5 L 10,0 L 8,5 L 10,10 L 0,5 z",95 'style' => 'stroke:none;fill:#707070;'95 'N' => "M 5,0 L 0,10 L 5,8 L 10,10 L 5,0 z", 96 'S' => "M 5,10 L 0,0 L 5,2 L 10,0 L 5,10 z", 97 'L' => "M 10,5 L 0,0 L 2,5 L 0,10 L 10,5 z", 98 'O' => "M 0,5 L 10,0 L 8,5 L 10,10 L 0,5 z", 99 'style' => 'stroke:none;fill:#707070;' 96 100 ); 97 101 my $textSize = 17; 98 my $styleText = "font-size:${textSize}px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;stroke:none;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr-tb;"; 99 my $styleLinha = 'stroke-width:2px;stroke:#000000;stroke-opacity:0.40;fill:none;'; 100 101 102 sub mostraFluxograma 103 { 104 my ( $text, $topic, $web, $params ) = @_; 105 my $myPub = Foswiki::Func::getPubDir() ."/$web/$topic"; 106 my $mapImg = Foswiki::Func::readFile( "$myPub/flowchartMapImg_$topic.txt" ); 107 108 $style = Foswiki::Func::extractNameValuePair( $params, 'tag-style' ) || 109 Foswiki::Func::getPluginPreferencesValue( 'TAG_STYLE' ) || 110 'border:1px dotted #505050;'; 111 112 return "$mapImg 102 my $styleText = 103 "font-size:${textSize}px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;stroke:none;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr-tb;"; 104 my $styleLinha = 105 'stroke-width:2px;stroke:#000000;stroke-opacity:0.40;fill:none;'; 106 107 sub mostraFluxograma { 108 my ( $text, $topic, $web, $params ) = @_; 109 my $myPub = Foswiki::Func::getPubDir() . "/$web/$topic"; 110 my $mapImg = Foswiki::Func::readFile("$myPub/flowchartMapImg_$topic.txt"); 111 112 $style = 113 Foswiki::Func::extractNameValuePair( $params, 'tag-style' ) 114 || Foswiki::Func::getPluginPreferencesValue('TAG_STYLE') 115 || 'border:1px dotted #505050;'; 116 117 return "$mapImg 113 118 <img src=\"\%ATTACHURL%/flowchart_$topic.png\" usemap=\"#flowchart_$topic\" style=\"$style\" alt=\"flowchart_$topic\"/>"; 114 119 } 115 120 116 sub desenhaFluxograma 117 { 118 my ( $text, $topic, $web, $params ) = @_; 119 my $myPub = Foswiki::Func::getPubDir() ."/$web/$topic"; 120 my $percentReduce; 121 122 $caixa{'w'} = Foswiki::Func::extractNameValuePair( $params, 'item-w' ) || 123 Foswiki::Func::getPluginPreferencesValue('ITEM_WIDTH') || 124 140; 125 $caixa{'h'} = Foswiki::Func::extractNameValuePair( $params, 'item-h' ) || 126 Foswiki::Func::getPluginPreferencesValue('ITEM_HEIGHT') || 127 40; 128 $caixa{'areaX'} = Foswiki::Func::extractNameValuePair( $params, 'area-w' ) || 129 Foswiki::Func::getPluginPreferencesValue('ITEM_AREA_W') || 130 180; 131 $caixa{'areaY'} = Foswiki::Func::extractNameValuePair( $params, 'area-h' ) || 132 Foswiki::Func::getPluginPreferencesValue('ITEM_AREA_H') || 133 70; 134 $percentReduce = Foswiki::Func::extractNameValuePair( $params, 'percent' ) || 135 Foswiki::Func::getPluginPreferencesValue('PERCENT_IMG') || 136 70; 137 $textSize = Foswiki::Func::extractNameValuePair( $params, 'text-size' ) || 138 Foswiki::Func::getPluginPreferencesValue('TEXT_SIZE') || 139 17; 140 141 $text =~ s/.*%FLOWCHART_START%(.*)$/$1/ if ( $text =~ m/%FLOWCHART_START%/ ); 142 $text =~ s/(.*)%FLOWCHART_STOP%.*$/$1/ if ( $text =~ m/%FLOWCHART_STOP%/ ); 143 my ( $id, $title, $goto, $gotoYes, $gotoNo, $color ); 144 foreach $line ( split /\n/, $text ) { 145 if ( $line =~ m/^---[+][+][ ]+(.+)/ ) { 146 registerLastItem($id, $title, $type, $goto, $gotoYes, $gotoNo, $color); 147 ( $id, $title, $type, $goto, $gotoYes, $gotoNo, $color ) = 148 ( '', '', 'action', '', '', '', '' ); 149 $title .= $1; 150 } 151 #if ( $line =~ m/^[ ][ ][ ]\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Não tá funcionando Porra! 152 if ( $line =~ m/^\s\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Isso tá errado e funciona. Merda! 153 $id = $2 if ( lc($1) eq 'id' ); 154 $type = $2 if ( lc($1) eq 'type' ); 155 $goto = $2 if ( lc($1) eq 'goto' ); 156 $gotoYes = $2 if ( lc($1) eq 'yes' ); 157 $gotoNo = $2 if ( lc($1) eq 'no' ); 158 $color = $2 if ( lc($1) eq 'color' ); 159 } 160 } 161 registerLastItem($id, $title, $type, $goto, $gotoYes, $gotoNo, $color); 162 163 my $error = ''; 164 my $svg = &montaSVG($topic, $web); 165 my $mapImg = &montaMapImg($topic, $web, $percentReduce); 166 unless (-d $myPub){ 167 mkdir $myPub or die "can't create directory $myPub"; 168 } 169 Foswiki::Func::saveFile( "$myPub/flowchart_$topic.svg", $svg ); 170 Foswiki::Func::saveFile( "$myPub/flowchartMapImg_$topic.txt", $mapImg ); 171 system ("convert", "$myPub/flowchart_$topic.svg", 172 '-resize', $percentReduce.'%x'.$percentReduce.'%', "$myPub/flowchart_$topic.png"); 173 } 174 175 my $itemPositionDefault = 1; # will be 1 only to the frist! 121 sub desenhaFluxograma { 122 my ( $text, $topic, $web, $params ) = @_; 123 my $myPub = Foswiki::Func::getPubDir() . "/$web/$topic"; 124 my $percentReduce; 125 126 $caixa{'w'} = 127 Foswiki::Func::extractNameValuePair( $params, 'item-w' ) 128 || Foswiki::Func::getPluginPreferencesValue('ITEM_WIDTH') 129 || 140; 130 $caixa{'h'} = 131 Foswiki::Func::extractNameValuePair( $params, 'item-h' ) 132 || Foswiki::Func::getPluginPreferencesValue('ITEM_HEIGHT') 133 || 40; 134 $caixa{'areaX'} = 135 Foswiki::Func::extractNameValuePair( $params, 'area-w' ) 136 || Foswiki::Func::getPluginPreferencesValue('ITEM_AREA_W') 137 || 180; 138 $caixa{'areaY'} = 139 Foswiki::Func::extractNameValuePair( $params, 'area-h' ) 140 || Foswiki::Func::getPluginPreferencesValue('ITEM_AREA_H') 141 || 70; 142 $percentReduce = 143 Foswiki::Func::extractNameValuePair( $params, 'percent' ) 144 || Foswiki::Func::getPluginPreferencesValue('PERCENT_IMG') 145 || 70; 146 $textSize = 147 Foswiki::Func::extractNameValuePair( $params, 'text-size' ) 148 || Foswiki::Func::getPluginPreferencesValue('TEXT_SIZE') 149 || 17; 150 151 $text =~ s/.*%FLOWCHART_START%(.*)$/$1/ 152 if ( $text =~ m/%FLOWCHART_START%/ ); 153 $text =~ s/(.*)%FLOWCHART_STOP%.*$/$1/ if ( $text =~ m/%FLOWCHART_STOP%/ ); 154 my ( $id, $title, $goto, $gotoYes, $gotoNo, $color ); 155 foreach $line ( split /\n/, $text ) { 156 if ( $line =~ m/^---[+][+][ ]+(.+)/ ) { 157 registerLastItem( $id, $title, $type, $goto, $gotoYes, $gotoNo, 158 $color ); 159 ( $id, $title, $type, $goto, $gotoYes, $gotoNo, $color ) = 160 ( '', '', 'action', '', '', '', '' ); 161 $title .= $1; 162 } 163 164 #if ( $line =~ m/^[ ][ ][ ]\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Não tá funcionando Porra! 165 if ( $line =~ m/^\s\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) 166 { # Isso tá errado e funciona. Merda! 167 $id = $2 if ( lc($1) eq 'id' ); 168 $type = $2 if ( lc($1) eq 'type' ); 169 $goto = $2 if ( lc($1) eq 'goto' ); 170 $gotoYes = $2 if ( lc($1) eq 'yes' ); 171 $gotoNo = $2 if ( lc($1) eq 'no' ); 172 $color = $2 if ( lc($1) eq 'color' ); 173 } 174 } 175 registerLastItem( $id, $title, $type, $goto, $gotoYes, $gotoNo, $color ); 176 177 my $error = ''; 178 my $svg = &montaSVG( $topic, $web ); 179 my $mapImg = &montaMapImg( $topic, $web, $percentReduce ); 180 unless ( -d $myPub ) { 181 mkdir $myPub or die "can't create directory $myPub"; 182 } 183 Foswiki::Func::saveFile( "$myPub/flowchart_$topic.svg", $svg ); 184 Foswiki::Func::saveFile( "$myPub/flowchartMapImg_$topic.txt", $mapImg ); 185 system( "convert", "$myPub/flowchart_$topic.svg", '-resize', 186 $percentReduce . '%x' . $percentReduce . '%', 187 "$myPub/flowchart_$topic.png" ); 188 } 189 190 my $itemPositionDefault = 1; # will be 1 only to the frist! 176 191 my $firstItemId; 177 192 my $lastItemId; 178 sub registerLastItem 179 { 180 use Encode; 181 my ($id, $title, $type, $goto, $gotoYes, $gotoNo, $color) = @_; 182 if ( $title ) { 183 $totItens++; 184 $id =~ s/\s*([^ ]*)\s*/$1/g; 185 $id =~ s/[^a-zA-Z0-9]/_/g; 186 $id = "fluxIten$totItens" if ( !$id ); 187 #$title = `echo $title | iconv -t utf-8`; # convert to utf-8 by shell 188 #$title = encode("utf8", decode("iso-8859-1", $title)); # convert to utf-8 from iso 189 $title = encode("utf8", $title); # convert to utf-8 (from anything?) 190 $fluxItens{$id} = { 191 'title' => $title, 192 'type' => lc $type, 193 'goto' => $goto, 194 'gotoYes' => $gotoYes, 195 'gotoNo' => $gotoNo, 196 'x' => $itemPositionDefault, 197 'y' => $itemPositionDefault, 198 'color' => $color 199 }; 200 if ( $itemPositionDefault == 1 ) { # Yeah... this is the first item. 201 $firstItemId = $id; 202 $itemPositionDefault = 0 # to the other ones, the position is not defined. 203 } else { 204 if ( $fluxItens{$lastItemId}->{'type'} =~ m/question|end|end-error/ ) { 205 $fluxItens{$lastItemId}->{'goto'} = ''; 206 if ( lc $fluxItens{$lastItemId}->{'gotoYes'} eq 'next' ){ 207 $fluxItens{$lastItemId}->{'gotoYes'} = $id; 208 } 209 if ( lc $fluxItens{$lastItemId}->{'gotoNo'} eq 'next' ){ 210 $fluxItens{$lastItemId}->{'gotoNo'} = $id; 211 } 212 } else { 213 my $goto = lc $fluxItens{$lastItemId}->{'goto'}; 214 if ( $goto eq '' || $goto eq 'next' ) { 215 $fluxItens{$lastItemId}->{'goto'} = $id; 216 } 217 } 218 } 219 $lastItemId = $id; 220 } 221 } 222 223 sub montaSVG 224 { 225 my ( $topic, $web ) = @_; 226 227 my $svg = '<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 193 194 sub registerLastItem { 195 use Encode; 196 my ( $id, $title, $type, $goto, $gotoYes, $gotoNo, $color ) = @_; 197 if ($title) { 198 $totItens++; 199 $id =~ s/\s*([^ ]*)\s*/$1/g; 200 $id =~ s/[^a-zA-Z0-9]/_/g; 201 $id = "fluxIten$totItens" if ( !$id ); 202 203 #$title = `echo $title | iconv -t utf-8`; # convert to utf-8 by shell 204 #$title = encode("utf8", decode("iso-8859-1", $title)); # convert to utf-8 from iso 205 $title = encode( "utf8", $title ); # convert to utf-8 (from anything?) 206 $fluxItens{$id} = { 207 'title' => $title, 208 'type' => lc $type, 209 'goto' => $goto, 210 'gotoYes' => $gotoYes, 211 'gotoNo' => $gotoNo, 212 'x' => $itemPositionDefault, 213 'y' => $itemPositionDefault, 214 'color' => $color 215 }; 216 if ( $itemPositionDefault == 1 ) { # Yeah... this is the first item. 217 $firstItemId = $id; 218 $itemPositionDefault = 219 0 # to the other ones, the position is not defined. 220 } 221 else { 222 if ( 223 $fluxItens{$lastItemId}->{'type'} =~ m/question|end|end-error/ ) 224 { 225 $fluxItens{$lastItemId}->{'goto'} = ''; 226 if ( lc $fluxItens{$lastItemId}->{'gotoYes'} eq 'next' ) { 227 $fluxItens{$lastItemId}->{'gotoYes'} = $id; 228 } 229 if ( lc $fluxItens{$lastItemId}->{'gotoNo'} eq 'next' ) { 230 $fluxItens{$lastItemId}->{'gotoNo'} = $id; 231 } 232 } 233 else { 234 my $goto = lc $fluxItens{$lastItemId}->{'goto'}; 235 if ( $goto eq '' || $goto eq 'next' ) { 236 $fluxItens{$lastItemId}->{'goto'} = $id; 237 } 238 } 239 } 240 $lastItemId = $id; 241 } 242 } 243 244 sub montaSVG { 245 my ( $topic, $web ) = @_; 246 247 my $svg = 248 '<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 228 249 << Created with FlowchartPlugin for Foswiki >> 229 250 << Get it from http://foswiki.org/Extensions/FlowchartPlugin >> 230 251 This flowchart was based on: 231 ' . Foswiki::Func::getViewUrl( $web, $topic ) .'252 ' . Foswiki::Func::getViewUrl( $web, $topic ) . ' 232 253 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->'; 233 254 234 $svg .= &encaixaItemRecursive(); 235 $svg .= &linkItensRecursive(); 236 237 return '<?xml version="1.0" encoding="UTF-8"?> 238 <svg xmlns="http://www.w3.org/2000/svg"'. 239 ' width="'. ( $caixa{bigerPosX} * $caixa{areaX} ) .'px"'. 240 ' height="'. ( $caixa{bigerPosY} * $caixa{areaY} ) .'px">'."\n$svg\n</svg>"; 241 } 242 243 sub encaixaItemRecursive 244 { 245 my $id = $_[0]; 246 my $svg = "\n"; 247 if ( !$id ) { # it is the first item 248 $id = $firstItemId; 249 $_[1] = 1; 250 $_[2] = 1; 251 } else { 252 if ( $fluxItens{$id}->{x} ) { 253 return ''; # it's already defined. 254 } 255 $fluxItens{$id}->{x} = $_[1]; 256 $fluxItens{$id}->{y} = $_[2]; 257 } 258 $caixa{x} = $fluxItens{$id}->{x} * $caixa{areaX} - ( ($caixa{areaX}+$caixa{w}) / 2); 259 $caixa{y} = $fluxItens{$id}->{y} * $caixa{areaY} - ( ($caixa{areaY}+$caixa{h}) / 2); 260 my $color = $caixa{ 'color_'.$fluxItens{$id}->{type} }; 261 $color = $fluxItens{$id}->{color} if ( $fluxItens{$id}->{color} ne '' ); 262 if ( $fluxItens{$id}->{type} eq 'start' ) { 263 $svg .= ' <rect id="caixa_'.$id.'" x="'.$caixa{x}.'" y="'.$caixa{y}.'" 264 rx="'.($caixa{'h'}/3).'" ry="'.($caixa{h}/3).'" 265 width="'.$caixa{'w'}.'" height="'.$caixa{h}.'" 266 style="fill:#'.$color.';'.$caixa{style}.'" />'; 267 } 268 if ( $fluxItens{$id}->{type} eq 'action' ) { 269 $svg .= ' <rect id="caixa_'.$id.'" x="'.$caixa{x}.'" y="'.$caixa{y}.'" 270 width="'.$caixa{'w'}.'" height="'.$caixa{h}.'" 271 style="fill:#'.$color.';'.$caixa{style}.'" />'; 272 } 273 if ( $fluxItens{$id}->{type} eq 'question' ) { 274 #transform="matrix(escalaX, inclinaY, inclinaX, escalaY, posX, posY)" 275 $svg .= ' <path id="caixa_'.$id.'" 255 $svg .= &encaixaItemRecursive(); 256 $svg .= &linkItensRecursive(); 257 258 return '<?xml version="1.0" encoding="UTF-8"?> 259 <svg xmlns="http://www.w3.org/2000/svg"' 260 . ' width="' 261 . ( $caixa{bigerPosX} * $caixa{areaX} ) . 'px"' 262 . ' height="' 263 . ( $caixa{bigerPosY} * $caixa{areaY} ) . 'px">' 264 . "\n$svg\n</svg>"; 265 } 266 267 sub encaixaItemRecursive { 268 my $id = $_[0]; 269 my $svg = "\n"; 270 if ( !$id ) { # it is the first item 271 $id = $firstItemId; 272 $_[1] = 1; 273 $_[2] = 1; 274 } 275 else { 276 if ( $fluxItens{$id}->{x} ) { 277 return ''; # it's already defined. 278 } 279 $fluxItens{$id}->{x} = $_[1]; 280 $fluxItens{$id}->{y} = $_[2]; 281 } 282 $caixa{x} = 283 $fluxItens{$id}->{x} * $caixa{areaX} - 284 ( ( $caixa{areaX} + $caixa{w} ) / 2 ); 285 $caixa{y} = 286 $fluxItens{$id}->{y} * $caixa{areaY} - 287 ( ( $caixa{areaY} + $caixa{h} ) / 2 ); 288 my $color = $caixa{ 'color_' . $fluxItens{$id}->{type} }; 289 $color = $fluxItens{$id}->{color} if ( $fluxItens{$id}->{color} ne '' ); 290 if ( $fluxItens{$id}->{type} eq 'start' ) { 291 $svg .= 292 ' <rect id="caixa_' 293 . $id . '" x="' 294 . $caixa{x} . '" y="' 295 . $caixa{y} . '" 296 rx="' . ( $caixa{'h'} / 3 ) . '" ry="' . ( $caixa{h} / 3 ) . '" 297 width="' . $caixa{'w'} . '" height="' . $caixa{h} . '" 298 style="fill:#' . $color . ';' . $caixa{style} . '" />'; 299 } 300 if ( $fluxItens{$id}->{type} eq 'action' ) { 301 $svg .= 302 ' <rect id="caixa_' 303 . $id . '" x="' 304 . $caixa{x} . '" y="' 305 . $caixa{y} . '" 306 width="' . $caixa{'w'} . '" height="' . $caixa{h} . '" 307 style="fill:#' . $color . ';' . $caixa{style} . '" />'; 308 } 309 if ( $fluxItens{$id}->{type} eq 'question' ) { 310 311 #transform="matrix(escalaX, inclinaY, inclinaX, escalaY, posX, posY)" 312 $svg .= ' <path id="caixa_' . $id . '" 276 313 d="M 0.4,0.0 L 0.6,0.0 L 1.0,0.3 L 1.0,0.7 L 0.6,1.0 L 0.4,1.0 L 0.0,0.7 L 0.0,0.3 L 0.4,0.0 z" 277 transform="matrix('.$caixa{'w'}.', 0,0, '.$caixa{'h'}.', '.$caixa{x}.','.$caixa{y}.')" 278 style="fill:#'.$color.';'.$caixa{style}.'" />'; 279 } 280 if ( $fluxItens{$id}->{type} eq 'end' || $fluxItens{$id}->{type} eq 'end-error' ) { 281 $svg .= ' <rect id="caixa_'.$id.'" x="'.$caixa{x}.'" y="'.$caixa{y}.'" 282 rx="'.($caixa{'h'}/3).'" ry="'.($caixa{h}/3).'" 283 width="'.$caixa{'w'}.'" height="'.$caixa{h}.'" 284 style="fill:#'.$color.';'.$caixa{style}.'" />'; 285 } 286 $svg .= "\n".' <text xml:space="preserve" id="text_'.$id.'" style="'.$styleText.'">'; 287 my $tilteLineX = $fluxItens{$id}->{x} * $caixa{areaX} - ( $caixa{areaX} / 2 ); 288 my $tilteLineY = $fluxItens{$id}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ); 289 foreach $tilteLine ( split /%FLOWCHART_BR%/, $fluxItens{$id}->{title} ) { 290 $tilteLine =~ s/<nop>//g; 291 $tilteLine =~ s/^\s*([^\s].*[^\s])\s*$/$1/; 292 $svg .= "<tspan x=\"$tilteLineX\" y=\"$tilteLineY\">$tilteLine</tspan>"; 293 $tilteLineY += $textSize; 294 } 295 $svg .= '</text>'; 296 if ( $fluxItens{$id}->{'goto'} ne '' ) { 297 $caixa{bigerPosY} = ($_[2]+1) if ( $caixa{bigerPosY} < ($_[2]+1) ); 298 $svg .= &encaixaItemRecursive ( $fluxItens{$id}->{'goto'}, $_[1], ($_[2]+1) ); 299 } 300 my $gotoYesAlreadyExists; 301 if ( $fluxItens{$id}->{'gotoYes'} ne '' ) { 302 $caixa{bigerPosY} = ($_[2]+1) if ( $caixa{bigerPosY} < ($_[2]+1) ); 303 if ( $fluxItens{$fluxItens{$id}->{'gotoYes'}}->{x} == 0 ) { 304 $gotoYesAlreadyExists = 0; 305 $svg .= &encaixaItemRecursive ( $fluxItens{$id}->{'gotoYes'}, $_[1], ($_[2]+1) ); 306 } else { 307 $gotoYesAlreadyExists = 1; # The next already exists. The gotoNo can go down! 308 } 309 } 310 if ( $fluxItens{$id}->{'gotoNo'} ne '' ) { 311 if ( $gotoYesAlreadyExists ) { 312 $svg .= &encaixaItemRecursive ( $fluxItens{$id}->{'gotoNo'}, $_[1], ($_[2]+1) ); 313 } else { 314 $caixa{bigerPosX}++ if ( $fluxItens{$fluxItens{$id}->{'gotoNo'}}->{x} == 0 ); 315 if ( $fluxItens{$fluxItens{$id}->{'gotoNo'}}->{x} == 0 ) { 316 $fluxItens{$fluxItens{$id}->{'gotoNo'}}->{'firstInTheColumn'} = 1; 317 $svg .= &encaixaItemRecursive ( $fluxItens{$id}->{'gotoNo'}, $caixa{bigerPosX}, $_[2] ); 318 } 319 } 320 } 321 return $svg 322 } 323 324 sub linkItensRecursive 325 { 326 my $idFrom = $_[0]; 327 my $svg = "\n\n"; 328 329 if ( !$idFrom ) { # it is the first item 330 $idFrom = $firstItemId; 331 } 332 333 if ( $fluxItens{$idFrom}->{linked} ) { 334 return ''; # it's already defined. 335 } 336 $fluxItens{$idFrom}->{linked} = 1; 337 338 if ( $fluxItens{$idFrom}->{'goto'} eq '' && 339 $fluxItens{$idFrom}->{'gotoYes'} eq '' && 340 $fluxItens{$idFrom}->{'gotoNo'} eq '' ) { 341 return ''; # it is the end. 342 } 343 344 # d="M Ponto1 C Guia1 Guia2 Ponto2" 345 my ( $iniX,$iniY, $endX,$endY, $guideIniX,$guideIniY, $guideEndX,$guideEndY, $setaType, $exitBy ); 346 my $gotoYesExitBy; 347 348 if ( $fluxItens{$idFrom}->{'goto'} ne '' ) { 349 $idTo = $fluxItens{$idFrom}->{'goto'}; 350 ( $iniX,$iniY, $endX,$endY, $guideIniX,$guideIniY, $guideEndX,$guideEndY, $setaType, $exitBy ) = 351 &getLinkLine( $idFrom, $idTo ); 352 $svg .= " <path id=\"form_${idFrom}_to_$idTo\" 314 transform="matrix(' 315 . $caixa{'w'} 316 . ', 0,0, ' 317 . $caixa{'h'} . ', ' 318 . $caixa{x} . ',' 319 . $caixa{y} . ')" 320 style="fill:#' . $color . ';' . $caixa{style} . '" />'; 321 } 322 if ( $fluxItens{$id}->{type} eq 'end' 323 || $fluxItens{$id}->{type} eq 'end-error' ) 324 { 325 $svg .= 326 ' <rect id="caixa_' 327 . $id . '" x="' 328 . $caixa{x} . '" y="' 329 . $caixa{y} . '" 330 rx="' . ( $caixa{'h'} / 3 ) . '" ry="' . ( $caixa{h} / 3 ) . '" 331 width="' . $caixa{'w'} . '" height="' . $caixa{h} . '" 332 style="fill:#' . $color . ';' . $caixa{style} . '" />'; 333 } 334 $svg .= "\n" 335 . ' <text xml:space="preserve" id="text_' 336 . $id 337 . '" style="' 338 . $styleText . '">'; 339 my $tilteLineX = 340 $fluxItens{$id}->{x} * $caixa{areaX} - ( $caixa{areaX} / 2 ); 341 my $tilteLineY = 342 $fluxItens{$id}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ); 343 foreach $tilteLine ( split /%FLOWCHART_BR%/, $fluxItens{$id}->{title} ) { 344 $tilteLine =~ s/<nop>//g; 345 $tilteLine =~ s/^\s*([^\s].*[^\s])\s*$/$1/; 346 $svg .= "<tspan x=\"$tilteLineX\" y=\"$tilteLineY\">$tilteLine</tspan>"; 347 $tilteLineY += $textSize; 348 } 349 $svg .= '</text>'; 350 if ( $fluxItens{$id}->{'goto'} ne '' ) { 351 $caixa{bigerPosY} = ( $_[2] + 1 ) 352 if ( $caixa{bigerPosY} < ( $_[2] + 1 ) ); 353 $svg .= &encaixaItemRecursive( $fluxItens{$id}->{'goto'}, 354 $_[1], ( $_[2] + 1 ) ); 355 } 356 my $gotoYesAlreadyExists; 357 if ( $fluxItens{$id}->{'gotoYes'} ne '' ) { 358 $caixa{bigerPosY} = ( $_[2] + 1 ) 359 if ( $caixa{bigerPosY} < ( $_[2] + 1 ) ); 360 if ( $fluxItens{ $fluxItens{$id}->{'gotoYes'} }->{x} == 0 ) { 361 $gotoYesAlreadyExists = 0; 362 $svg .= &encaixaItemRecursive( $fluxItens{$id}->{'gotoYes'}, 363 $_[1], ( $_[2] + 1 ) ); 364 } 365 else { 366 $gotoYesAlreadyExists = 367 1; # The next already exists. The gotoNo can go down! 368 } 369 } 370 if ( $fluxItens{$id}->{'gotoNo'} ne '' ) { 371 if ($gotoYesAlreadyExists) { 372 $svg .= &encaixaItemRecursive( $fluxItens{$id}->{'gotoNo'}, 373 $_[1], ( $_[2] + 1 ) ); 374 } 375 else { 376 $caixa{bigerPosX}++ 377 if ( $fluxItens{ $fluxItens{$id}->{'gotoNo'} }->{x} == 0 ); 378 if ( $fluxItens{ $fluxItens{$id}->{'gotoNo'} }->{x} == 0 ) { 379 $fluxItens{ $fluxItens{$id}->{'gotoNo'} } 380 ->{'firstInTheColumn'} = 1; 381 $svg .= &encaixaItemRecursive( $fluxItens{$id}->{'gotoNo'}, 382 $caixa{bigerPosX}, $_[2] ); 383 } 384 } 385 } 386 return $svg; 387 } 388 389 sub linkItensRecursive { 390 my $idFrom = $_[0]; 391 my $svg = "\n\n"; 392 393 if ( !$idFrom ) { # it is the first item 394 $idFrom = $firstItemId; 395 } 396 397 if ( $fluxItens{$idFrom}->{linked} ) { 398 return ''; # it's already defined. 399 } 400 $fluxItens{$idFrom}->{linked} = 1; 401 402 if ( $fluxItens{$idFrom}->{'goto'} eq '' 403 && $fluxItens{$idFrom}->{'gotoYes'} eq '' 404 && $fluxItens{$idFrom}->{'gotoNo'} eq '' ) 405 { 406 return ''; # it is the end. 407 } 408 409 # d="M Ponto1 C Guia1 Guia2 Ponto2" 410 my ( 411 $iniX, $iniY, $endX, $endY, $guideIniX, 412 $guideIniY, $guideEndX, $guideEndY, $setaType, $exitBy 413 ); 414 my $gotoYesExitBy; 415 416 if ( $fluxItens{$idFrom}->{'goto'} ne '' ) { 417 $idTo = $fluxItens{$idFrom}->{'goto'}; 418 ( 419 $iniX, $iniY, $endX, $endY, $guideIniX, 420 $guideIniY, $guideEndX, $guideEndY, $setaType, $exitBy 421 ) = &getLinkLine( $idFrom, $idTo ); 422 $svg .= " <path id=\"form_${idFrom}_to_$idTo\" 353 423 d=\"M $iniX,$iniY C $guideIniX,$guideIniY $guideEndX,$guideEndY $endX,$endY\" 354 424 style=\"$styleLinha\" />\n"; 355 $svg .= ' <path id="seta_to_'.$idTo.'" d="'. $seta{$setaType} .'" 356 transform="translate('.($endX-5).','.($endY-5).')" style="'.$seta{style}.'" />'; 357 $svg .= &linkItensRecursive($idTo); 358 } 359 if ( $fluxItens{$idFrom}->{'gotoYes'} ne '' ) { 360 $idTo = $fluxItens{$idFrom}->{'gotoYes'}; 361 ( $iniX,$iniY, $endX,$endY, $guideIniX,$guideIniY, $guideEndX,$guideEndY, $setaType, $exitBy ) = 362 &getLinkLine( $idFrom, $idTo ); 363 $gotoYesExitBy = $exitBy; 364 $svg .= " <path id=\"form_${idFrom}_to_$idTo\" 425 $svg .= ' <path id="seta_to_' . $idTo . '" d="' . $seta{$setaType} . '" 426 transform="translate(' 427 . ( $endX - 5 ) . ',' 428 . ( $endY - 5 ) 429 . ')" style="' 430 . $seta{style} . '" />'; 431 $svg .= &linkItensRecursive($idTo); 432 } 433 if ( $fluxItens{$idFrom}->{'gotoYes'} ne '' ) { 434 $idTo = $fluxItens{$idFrom}->{'gotoYes'}; 435 ( 436 $iniX, $iniY, $endX, $endY, $guideIniX, 437 $guideIniY, $guideEndX, $guideEndY, $setaType, $exitBy 438 ) = &getLinkLine( $idFrom, $idTo ); 439 $gotoYesExitBy = $exitBy; 440 $svg .= " <path id=\"form_${idFrom}_to_$idTo\" 365 441 d=\"M $iniX,$iniY C $guideIniX,$guideIniY $guideEndX,$guideEndY $endX,$endY\" 366 442 style=\"$styleLinha\" />\n"; 367 $svg .= ' <path id="seta_to_'.$idTo.'" d="'. $seta{$setaType} .'" 368 transform="translate('.($endX-5).','.($endY-5).')" style="'.$seta{style}.'" />'; 369 $svg .= "\n <circle cx=\"$iniX\" cy=\"$iniY\" r=\"2.5\" stroke=\"none\" fill=\"green\"/>"; 370 $svg .= &linkItensRecursive($idTo); 371 } 372 if ( $fluxItens{$idFrom}->{'gotoNo'} ne '' ) { 373 $idTo = $fluxItens{$idFrom}->{'gotoNo'}; 374 ( $iniX,$iniY, $endX,$endY, $guideIniX,$guideIniY, $guideEndX,$guideEndY, $setaType, $exitBy ) = 375 &getLinkLine( $idFrom, $idTo ); 376 if ( $exitBy eq $gotoYesExitBy ) { 377 $iniX += 5 if ( $exitBy eq 'N' || $exitBy eq 'S' ); 378 $iniY -= 5 if ( $exitBy eq 'L' || $exitBy eq 'O' ); 379 } 380 $svg .= " <path id=\"form_${idFrom}_to_$idTo\" 443 $svg .= ' <path id="seta_to_' . $idTo . '" d="' . $seta{$setaType} . '" 444 transform="translate(' 445 . ( $endX - 5 ) . ',' 446 . ( $endY - 5 ) 447 . ')" style="' 448 . $seta{style} . '" />'; 449 $svg .= 450 "\n <circle cx=\"$iniX\" cy=\"$iniY\" r=\"2.5\" stroke=\"none\" fill=\"green\"/>"; 451 $svg .= &linkItensRecursive($idTo); 452 } 453 if ( $fluxItens{$idFrom}->{'gotoNo'} ne '' ) { 454 $idTo = $fluxItens{$idFrom}->{'gotoNo'}; 455 ( 456 $iniX, $iniY, $endX, $endY, $guideIniX, 457 $guideIniY, $guideEndX, $guideEndY, $setaType, $exitBy 458 ) = &getLinkLine( $idFrom, $idTo ); 459 if ( $exitBy eq $gotoYesExitBy ) { 460 $iniX += 5 if ( $exitBy eq 'N' || $exitBy eq 'S' ); 461 $iniY -= 5 if ( $exitBy eq 'L' || $exitBy eq 'O' ); 462 } 463 $svg .= " <path id=\"form_${idFrom}_to_$idTo\" 381 464 d=\"M $iniX,$iniY C $guideIniX,$guideIniY $guideEndX,$guideEndY $endX,$endY\" 382 465 style=\"$styleLinha\" />\n"; 383 $svg .= ' <path id="seta_to_'.$idTo.'" d="'. $seta{$setaType} .'" 384 transform="translate('.($endX-5).','.($endY-5).')" style="'.$seta{style}.'" />'; 385 $svg .= "\n <circle cx=\"$iniX\" cy=\"$iniY\" r=\"2.5\" stroke=\"none\" fill=\"red\"/>"; 386 $svg .= &linkItensRecursive($idTo); 387 } 388 389 return $svg 390 } 391 392 sub getLinkLine 393 { 394 my ( $idFrom, $idTo ) = @_; 395 my ( $iniX,$iniY, $endX,$endY, $guideIniX,$guideIniY, $guideEndX,$guideEndY, $setaType, $exitBy ); 396 397 if ( $fluxItens{$idFrom}->{x} < $fluxItens{$idTo}->{x} ) { 398 if ( $fluxItens{$idFrom}->{y} == $fluxItens{$idTo}->{y} ) { # Case 1 399 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 400 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 401 $endX = ($fluxItens{$idTo}->{x}-1) * $caixa{areaX} + ( ($caixa{areaX}-$caixa{w}) / 2 ); 402 $endY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 403 if( ($fluxItens{$idFrom}->{x}+1) == $fluxItens{$idTo}->{x} ) { 404 $guideIniX = $iniX + (($caixa{areaX}-$caixa{w})/2); $guideIniY = $iniY; 405 $guideEndX = $endX - (($caixa{areaX}-$caixa{w})/2); $guideEndY = $endY; 406 } else { 407 $guideIniX = $iniX + ($caixa{areaX}/2); $guideIniY = $iniY + ($caixa{areaY}/4); 408 $guideEndX = $endX - ($caixa{areaX}/2); $guideEndY = $endY - ($caixa{areaY}/4); 409 } 410 $setaType = 'L'; 411 $exitBy = 'L'; 412 } 413 if ( $fluxItens{$idFrom}->{y} < $fluxItens{$idTo}->{y} ) { # Case 2 414 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 415 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 416 $endX = ($fluxItens{$idTo}->{x}-1) * $caixa{areaX} + ( ($caixa{areaX}-$caixa{w}) / 2 ); 417 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 418 if( ($fluxItens{$idFrom}->{x}+1) == $fluxItens{$idTo}->{x} ) { 419 $guideIniX = $endX + ($caixa{areaX}-$caixa{w}); $guideIniY = $iniY; 420 $guideEndX = $iniX - ($caixa{areaX}-$caixa{w}); $guideEndY = $endY; 421 } else { 422 $guideIniX = ( $iniX + $endX ) / 2; $guideIniY = $iniY; 423 $guideEndX = ( $iniX + $endX ) / 2; $guideEndY = $endY; 424 } 425 $setaType = 'L'; 426 $exitBy = 'L'; 427 } 428 if ( $fluxItens{$idFrom}->{y} > $fluxItens{$idTo}->{y} ) { # Case 3 429 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( $caixa{areaX} / 2 ) - ($caixa{w}/8); 430 $iniY = ($fluxItens{$idFrom}->{y}-1) * $caixa{areaY} + ( ($caixa{areaY}-$caixa{h}) / 2 ); 431 $endX = ($fluxItens{$idTo}->{x}-1) * $caixa{areaX} + ( ($caixa{areaX}-$caixa{w}) / 2 ); 432 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 433 $guideIniX = $iniX; $guideIniY = $iniY - $caixa{areaY}; 434 $guideEndX = $endX - ($caixa{areaX}/2); $guideEndY = $endY; 435 $setaType = 'L'; 436 $exitBy = 'N'; 437 } 438 } 439 if ( $fluxItens{$idFrom}->{x} > $fluxItens{$idTo}->{x} ) { 440 if ( $fluxItens{$idFrom}->{y} == $fluxItens{$idTo}->{y} ) { # Case 4 441 $iniX = ($fluxItens{$idFrom}->{x}-1) * $caixa{areaX} + ( ($caixa{areaX}-$caixa{w}) / 2 ); 442 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 443 $endX = $fluxItens{$idTo}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 444 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 445 if( ($fluxItens{$idFrom}->{x}+1) == $fluxItens{$idTo}->{x} ) { 446 $guideIniX = $iniX - (($caixa{areaX}-$caixa{w})/2); $guideIniY = $iniY; 447 $guideEndX = $endX + (($caixa{areaX}-$caixa{w})/2); $guideEndY = $endY; 448 } else { 449 $guideIniX = $iniX - ($caixa{areaX}/2); $guideIniY = $iniY + ($caixa{areaY}/4); 450 $guideEndX = $endX + ($caixa{areaX}/2); $guideEndY = $endY - ($caixa{areaY}/4); 451 } 452 $setaType = 'O'; 453 $exitBy = 'O'; 454 } 455 if ( $fluxItens{$idFrom}->{y} < $fluxItens{$idTo}->{y} ) { # Case 5 456 $iniX = ($fluxItens{$idFrom}->{x}-1) * $caixa{areaX} + ( ($caixa{areaX}-$caixa{w}) / 2 ); 457 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 458 $endX = $fluxItens{$idTo}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 459 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 460 if( ($fluxItens{$idFrom}->{x}-1) == $fluxItens{$idTo}->{x} ) { 461 $guideIniX = $endX - ($caixa{areaX}-$caixa{w}); $guideIniY = $iniY; 462 $guideEndX = $iniX + ($caixa{areaX}-$caixa{w}); $guideEndY = $endY; 463 } else { 464 $guideIniX = ( $iniX + $endX ) / 2; $guideIniY = $iniY; 465 $guideEndX = ( $iniX + $endX ) / 2; $guideEndY = $endY; 466 } 467 $setaType = 'O'; 468 $exitBy = 'O'; 469 } 470 if ( $fluxItens{$idFrom}->{y} > $fluxItens{$idTo}->{y} ) { # Case 6 471 if ( $fluxItens{$idFrom}->{'firstInTheColumn'} ) { 472 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( $caixa{areaX} / 2 ) - ($caixa{w}/8); 473 $iniY = ($fluxItens{$idFrom}->{y}-1) * $caixa{areaY} + ( ($caixa{areaY}-$caixa{h}) / 2 ); 474 $guideIniX = $iniX; $guideIniY = $iniY - $caixa{areaY}; 475 $exitBy = 'N'; 476 } else { 477 $iniX = ($fluxItens{$idFrom}->{x}-1) * $caixa{areaX} + ( ($caixa{areaX}-$caixa{w}) / 2 ); 478 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 479 $exitBy = 'O'; 480 } 481 $endX = $fluxItens{$idTo}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 482 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 483 if ( ! $fluxItens{$idFrom}->{'firstInTheColumn'} ) { 484 if( ($fluxItens{$idFrom}->{x}-1) == $fluxItens{$idTo}->{x} ) { 485 $guideIniX = $endX - ($caixa{areaX}-$caixa{w}); $guideIniY = $iniY; 486 } else { 487 $guideIniX = ( $iniX + $endX ) / 2; $guideIniY = $iniY; 488 } 489 } 490 if( ($fluxItens{$idFrom}->{x}-1) == $fluxItens{$idTo}->{x} ) { 491 $guideEndX = $iniX + ($caixa{areaX}-$caixa{w}); $guideEndY = $endY; 492 } else { 493 $guideEndX = ( $iniX + $endX ) / 2; $guideEndY = $endY; 494 } 495 $guideEndX = $endX + ($caixa{areaX}/2); $guideEndY = $endY; 496 $setaType = 'O'; 497 } 498 } 499 if ( $fluxItens{$idFrom}->{x} == $fluxItens{$idTo}->{x} ) { 500 if ( $fluxItens{$idFrom}->{y} < $fluxItens{$idTo}->{y} ) { # Case 7 501 if ( ($fluxItens{$idFrom}->{y}+1) == $fluxItens{$idTo}->{y} ) { # Case 7.a 502 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( $caixa{areaX} / 2 ); 503 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( ($caixa{areaY}-$caixa{h}) / 2 ); 504 $endY = ($fluxItens{$idTo}->{y}-1) * $caixa{areaY} + ( ($caixa{areaY}-$caixa{h}) / 2 ); 505 $endX = $iniX; 506 $guideIniX = $iniX; $guideIniY = $iniY; 507 $guideEndX = $endX; $guideEndY = $endY; 508 $setaType = 'S'; 509 $exitBy = 'S'; 510 } else { # . . . . . . . . . . . . . . . . . . . . . . . . . . # Case 7.b 511 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 512 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 513 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 514 $endX = $iniX; 515 $guideIniX = $iniX + ( $caixa{areaX}-$caixa{w} )/1.5; $guideIniY = $iniY; 516 $guideEndX = $endX + ( $caixa{areaX}-$caixa{w} )*1.5; $guideEndY = $endY; 517 $setaType = 'O'; 518 $exitBy = 'L'; 519 } 520 } 521 if ( $fluxItens{$idFrom}->{y} > $fluxItens{$idTo}->{y} ) { # Case 8 522 $iniX = $fluxItens{$idFrom}->{x} * $caixa{areaX} - ( ($caixa{areaX}-$caixa{w}) / 2 ); 523 $iniY = $fluxItens{$idFrom}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) + ($caixa{h}/6); 524 $endY = $fluxItens{$idTo}->{y} * $caixa{areaY} - ( $caixa{areaY} / 2 ) - ($caixa{h}/6); 525 $endX = $iniX; 526 $guideIniX = $iniX + ( $caixa{areaX}-$caixa{w} )/1.5; $guideIniY = $iniY; 527 $guideEndX = $endX + ( $caixa{areaX}-$caixa{w} )*1.5; $guideEndY = $endY; 528 $setaType = 'O'; 529 $exitBy = 'L'; 530 } 531 } 532 533 return ( $iniX,$iniY, $endX,$endY, $guideIniX,$guideIniY, $guideEndX,$guideEndY, $setaType, $exitBy ); 534 } 535 536 sub montaMapImg 537 { 538 my ( $topic, $web, $perReduce ) = @_; 539 $reduce = $perReduce / 100; 540 return '<map name="flowchart_'.$topic.'">'. &encaixaMapImg($topic, $web, $reduce) ."\n</map>"; 541 } 542 sub encaixaMapImg 543 { 544 my ( $topic, $web, $reduce, $id ) = @_; 545 my $mapImg = "\n"; 546 if ( !$id ) { # it is the first item 547 $id = $firstItemId; 548 } 549 550 if ( $fluxItens{$id}->{maped} ) { 551 return ''; # it's already defined. 552 } 553 $fluxItens{$id}->{maped} = 1; 554 555 my $URL = Foswiki::Func::getViewUrl( $web, $topic ); 556 my $title = $fluxItens{$id}->{title}; 557 $title = encode( "iso-8859-1", decode("utf-8", $title) ); # convert from utf-8 to iso 558 $title =~ s/%FLOWCHART_BR%/ /g; $title =~ s/\"/\'/g; $title =~ s/\s+/ /g; 559 my $anchor = $title; 560 $anchor =~ s/[^a-zA-Z0-9]/_/g; $anchor =~ s/_+/_/g; $anchor =~ s/(^_*|_*$)//g; 561 my $x = ( $fluxItens{$id}->{x} * $caixa{areaX} - ( ($caixa{areaX}+$caixa{w}) / 2) ) * $reduce; 562 my $y = ( $fluxItens{$id}->{y} * $caixa{areaY} - ( ($caixa{areaY}+$caixa{h}) / 2) ) * $reduce; 563 my $w = $caixa{w} * $reduce; 564 my $h = $caixa{h} * $reduce; 565 $mapImg .= ' <area href="'.$URL.'#'.$anchor.'" title="'.$title.'"'; 566 $mapImg .= ' shape="rect" coords="'.$x.','.$y.','.($x+$w).','.($y+$h).'">'; 567 568 if ( $fluxItens{$id}->{'goto'} ne '' ) { 569 $mapImg .= &encaixaMapImg( $topic, $web, $reduce, $fluxItens{$id}->{'goto'} ); 570 } 571 if ( $fluxItens{$id}->{'gotoYes'} ne '' ) { 572 $mapImg .= &encaixaMapImg( $topic, $web, $reduce, $fluxItens{$id}->{'gotoYes'} ); 573 } 574 if ( $fluxItens{$id}->{'gotoNo'} ne '' ) { 575 $mapImg .= &encaixaMapImg( $topic, $web, $reduce, $fluxItens{$id}->{'gotoNo'} ); 576 } 577 578 return $mapImg; 466 $svg .= ' <path id="seta_to_' . $idTo . '" d="' . $seta{$setaType} . '" 467 transform="translate(' 468 . ( $endX - 5 ) . ',' 469 . ( $endY - 5 ) 470 . ')" style="' 471 . $seta{style} . '" />'; 472 $svg .= 473 "\n <circle cx=\"$iniX\" cy=\"$iniY\" r=\"2.5\" stroke=\"none\" fill=\"red\"/>"; 474 $svg .= &linkItensRecursive($idTo); 475 } 476 477 return $svg; 478 } 479 480 sub getLinkLine { 481 my ( $idFrom, $idTo ) = @_; 482 my ( 483 $iniX, $iniY, $endX, $endY, $guideIniX, 484 $guideIniY, $guideEndX, $guideEndY, $setaType, $exitBy 485 ); 486 487 if ( $fluxItens{$idFrom}->{x} < $fluxItens{$idTo}->{x} ) { 488 if ( $fluxItens{$idFrom}->{y} == $fluxItens{$idTo}->{y} ) { # Case 1 489 $iniX = 490 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 491 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 492 $iniY = 493 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 494 ( $caixa{areaY} / 2 ) + 495 ( $caixa{h} / 6 ); 496 $endX = 497 ( $fluxItens{$idTo}->{x} - 1 ) * $caixa{areaX} + 498 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 499 $endY = 500 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 501 ( $caixa{areaY} / 2 ) - 502 ( $caixa{h} / 6 ); 503 if ( ( $fluxItens{$idFrom}->{x} + 1 ) == $fluxItens{$idTo}->{x} ) { 504 $guideIniX = $iniX + ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 505 $guideIniY = $iniY; 506 $guideEndX = $endX - ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 507 $guideEndY = $endY; 508 } 509 else { 510 $guideIniX = $iniX + ( $caixa{areaX} / 2 ); 511 $guideIniY = $iniY + ( $caixa{areaY} / 4 ); 512 $guideEndX = $endX - ( $caixa{areaX} / 2 ); 513 $guideEndY = $endY - ( $caixa{areaY} / 4 ); 514 } 515 $setaType = 'L'; 516 $exitBy = 'L'; 517 } 518 if ( $fluxItens{$idFrom}->{y} < $fluxItens{$idTo}->{y} ) { # Case 2 519 $iniX = 520 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 521 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 522 $iniY = 523 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 524 ( $caixa{areaY} / 2 ) + 525 ( $caixa{h} / 6 ); 526 $endX = 527 ( $fluxItens{$idTo}->{x} - 1 ) * $caixa{areaX} + 528 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 529 $endY = 530 $fluxItens{$idTo}->{y} * $caixa{areaY} - 531 ( $caixa{areaY} / 2 ) - 532 ( $caixa{h} / 6 ); 533 if ( ( $fluxItens{$idFrom}->{x} + 1 ) == $fluxItens{$idTo}->{x} ) { 534 $guideIniX = $endX + ( $caixa{areaX} - $caixa{w} ); 535 $guideIniY = $iniY; 536 $guideEndX = $iniX - ( $caixa{areaX} - $caixa{w} ); 537 $guideEndY = $endY; 538 } 539 else { 540 $guideIniX = ( $iniX + $endX ) / 2; 541 $guideIniY = $iniY; 542 $guideEndX = ( $iniX + $endX ) / 2; 543 $guideEndY = $endY; 544 } 545 $setaType = 'L'; 546 $exitBy = 'L'; 547 } 548 if ( $fluxItens{$idFrom}->{y} > $fluxItens{$idTo}->{y} ) { # Case 3 549 $iniX = 550 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 551 ( $caixa{areaX} / 2 ) - 552 ( $caixa{w} / 8 ); 553 $iniY = 554 ( $fluxItens{$idFrom}->{y} - 1 ) * $caixa{areaY} + 555 ( ( $caixa{areaY} - $caixa{h} ) / 2 ); 556 $endX = 557 ( $fluxItens{$idTo}->{x} - 1 ) * $caixa{areaX} + 558 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 559 $endY = 560 $fluxItens{$idTo}->{y} * $caixa{areaY} - 561 ( $caixa{areaY} / 2 ) - 562 ( $caixa{h} / 6 ); 563 $guideIniX = $iniX; 564 $guideIniY = $iniY - $caixa{areaY}; 565 $guideEndX = $endX - ( $caixa{areaX} / 2 ); 566 $guideEndY = $endY; 567 $setaType = 'L'; 568 $exitBy = 'N'; 569 } 570 } 571 if ( $fluxItens{$idFrom}->{x} > $fluxItens{$idTo}->{x} ) { 572 if ( $fluxItens{$idFrom}->{y} == $fluxItens{$idTo}->{y} ) { # Case 4 573 $iniX = 574 ( $fluxItens{$idFrom}->{x} - 1 ) * $caixa{areaX} + 575 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 576 $iniY = 577 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 578 ( $caixa{areaY} / 2 ) + 579 ( $caixa{h} / 6 ); 580 $endX = 581 $fluxItens{$idTo}->{x} * $caixa{areaX} - 582 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 583 $endY = 584 $fluxItens{$idTo}->{y} * $caixa{areaY} - 585 ( $caixa{areaY} / 2 ) - 586 ( $caixa{h} / 6 ); 587 if ( ( $fluxItens{$idFrom}->{x} + 1 ) == $fluxItens{$idTo}->{x} ) { 588 $guideIniX = $iniX - ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 589 $guideIniY = $iniY; 590 $guideEndX = $endX + ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 591 $guideEndY = $endY; 592 } 593 else { 594 $guideIniX = $iniX - ( $caixa{areaX} / 2 ); 595 $guideIniY = $iniY + ( $caixa{areaY} / 4 ); 596 $guideEndX = $endX + ( $caixa{areaX} / 2 ); 597 $guideEndY = $endY - ( $caixa{areaY} / 4 ); 598 } 599 $setaType = 'O'; 600 $exitBy = 'O'; 601 } 602 if ( $fluxItens{$idFrom}->{y} < $fluxItens{$idTo}->{y} ) { # Case 5 603 $iniX = 604 ( $fluxItens{$idFrom}->{x} - 1 ) * $caixa{areaX} + 605 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 606 $iniY = 607 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 608 ( $caixa{areaY} / 2 ) + 609 ( $caixa{h} / 6 ); 610 $endX = 611 $fluxItens{$idTo}->{x} * $caixa{areaX} - 612 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 613 $endY = 614 $fluxItens{$idTo}->{y} * $caixa{areaY} - 615 ( $caixa{areaY} / 2 ) - 616 ( $caixa{h} / 6 ); 617 if ( ( $fluxItens{$idFrom}->{x} - 1 ) == $fluxItens{$idTo}->{x} ) { 618 $guideIniX = $endX - ( $caixa{areaX} - $caixa{w} ); 619 $guideIniY = $iniY; 620 $guideEndX = $iniX + ( $caixa{areaX} - $caixa{w} ); 621 $guideEndY = $endY; 622 } 623 else { 624 $guideIniX = ( $iniX + $endX ) / 2; 625 $guideIniY = $iniY; 626 $guideEndX = ( $iniX + $endX ) / 2; 627 $guideEndY = $endY; 628 } 629 $setaType = 'O'; 630 $exitBy = 'O'; 631 } 632 if ( $fluxItens{$idFrom}->{y} > $fluxItens{$idTo}->{y} ) { # Case 6 633 if ( $fluxItens{$idFrom}->{'firstInTheColumn'} ) { 634 $iniX = 635 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 636 ( $caixa{areaX} / 2 ) - 637 ( $caixa{w} / 8 ); 638 $iniY = 639 ( $fluxItens{$idFrom}->{y} - 1 ) * $caixa{areaY} + 640 ( ( $caixa{areaY} - $caixa{h} ) / 2 ); 641 $guideIniX = $iniX; 642 $guideIniY = $iniY - $caixa{areaY}; 643 $exitBy = 'N'; 644 } 645 else { 646 $iniX = 647 ( $fluxItens{$idFrom}->{x} - 1 ) * $caixa{areaX} + 648 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 649 $iniY = 650 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 651 ( $caixa{areaY} / 2 ) + 652 ( $caixa{h} / 6 ); 653 $exitBy = 'O'; 654 } 655 $endX = 656 $fluxItens{$idTo}->{x} * $caixa{areaX} - 657 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 658 $endY = 659 $fluxItens{$idTo}->{y} * $caixa{areaY} - 660 ( $caixa{areaY} / 2 ) - 661 ( $caixa{h} / 6 ); 662 if ( !$fluxItens{$idFrom}->{'firstInTheColumn'} ) { 663 if ( 664 ( $fluxItens{$idFrom}->{x} - 1 ) == $fluxItens{$idTo}->{x} ) 665 { 666 $guideIniX = $endX - ( $caixa{areaX} - $caixa{w} ); 667 $guideIniY = $iniY; 668 } 669 else { 670 $guideIniX = ( $iniX + $endX ) / 2; 671 $guideIniY = $iniY; 672 } 673 } 674 if ( ( $fluxItens{$idFrom}->{x} - 1 ) == $fluxItens{$idTo}->{x} ) { 675 $guideEndX = $iniX + ( $caixa{areaX} - $caixa{w} ); 676 $guideEndY = $endY; 677 } 678 else { 679 $guideEndX = ( $iniX + $endX ) / 2; 680 $guideEndY = $endY; 681 } 682 $guideEndX = $endX + ( $caixa{areaX} / 2 ); 683 $guideEndY = $endY; 684 $setaType = 'O'; 685 } 686 } 687 if ( $fluxItens{$idFrom}->{x} == $fluxItens{$idTo}->{x} ) { 688 if ( $fluxItens{$idFrom}->{y} < $fluxItens{$idTo}->{y} ) { # Case 7 689 if ( ( $fluxItens{$idFrom}->{y} + 1 ) == $fluxItens{$idTo}->{y} ) 690 { # Case 7.a 691 $iniX = 692 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 693 ( $caixa{areaX} / 2 ); 694 $iniY = 695 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 696 ( ( $caixa{areaY} - $caixa{h} ) / 2 ); 697 $endY = 698 ( $fluxItens{$idTo}->{y} - 1 ) * $caixa{areaY} + 699 ( ( $caixa{areaY} - $caixa{h} ) / 2 ); 700 $endX = $iniX; 701 $guideIniX = $iniX; 702 $guideIniY = $iniY; 703 $guideEndX = $endX; 704 $guideEndY = $endY; 705 $setaType = 'S'; 706 $exitBy = 'S'; 707 } 708 else 709 { # . . . . . . . . . . . . . . . . . . . . . . . . . . # Case 7.b 710 $iniX = 711 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 712 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 713 $iniY = 714 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 715 ( $caixa{areaY} / 2 ) + 716 ( $caixa{h} / 6 ); 717 $endY = 718 $fluxItens{$idTo}->{y} * $caixa{areaY} - 719 ( $caixa{areaY} / 2 ) - 720 ( $caixa{h} / 6 ); 721 $endX = $iniX; 722 $guideIniX = $iniX + ( $caixa{areaX} - $caixa{w} ) / 1.5; 723 $guideIniY = $iniY; 724 $guideEndX = $endX + ( $caixa{areaX} - $caixa{w} ) * 1.5; 725 $guideEndY = $endY; 726 $setaType = 'O'; 727 $exitBy = 'L'; 728 } 729 } 730 if ( $fluxItens{$idFrom}->{y} > $fluxItens{$idTo}->{y} ) { # Case 8 731 $iniX = 732 $fluxItens{$idFrom}->{x} * $caixa{areaX} - 733 ( ( $caixa{areaX} - $caixa{w} ) / 2 ); 734 $iniY = 735 $fluxItens{$idFrom}->{y} * $caixa{areaY} - 736 ( $caixa{areaY} / 2 ) + 737 ( $caixa{h} / 6 ); 738 $endY = 739 $fluxItens{$idTo}->{y} * $caixa{areaY} - 740 ( $caixa{areaY} / 2 ) - 741 ( $caixa{h} / 6 ); 742 $endX = $iniX; 743 $guideIniX = $iniX + ( $caixa{areaX} - $caixa{w} ) / 1.5; 744 $guideIniY = $iniY; 745 $guideEndX = $endX + ( $caixa{areaX} - $caixa{w} ) * 1.5; 746 $guideEndY = $endY; 747 $setaType = 'O'; 748 $exitBy = 'L'; 749 } 750 } 751 752 return ( 753 $iniX, $iniY, $endX, $endY, $guideIniX, 754 $guideIniY, $guideEndX, $guideEndY, $setaType, $exitBy 755 ); 756 } 757 758 sub montaMapImg { 759 my ( $topic, $web, $perReduce ) = @_; 760 $reduce = $perReduce / 100; 761 return 762 '<map name="flowchart_' 763 . $topic . '">' 764 . &encaixaMapImg( $topic, $web, $reduce ) 765 . "\n</map>"; 766 } 767 768 sub encaixaMapImg { 769 my ( $topic, $web, $reduce, $id ) = @_; 770 my $mapImg = "\n"; 771 if ( !$id ) { # it is the first item 772 $id = $firstItemId; 773 } 774 775 if ( $fluxItens{$id}->{maped} ) { 776 return ''; # it's already defined. 777 } 778 $fluxItens{$id}->{maped} = 1; 779 780 my $URL = Foswiki::Func::getViewUrl( $web, $topic ); 781 my $title = $fluxItens{$id}->{title}; 782 $title = 783 encode( "iso-8859-1", decode( "utf-8", $title ) ) 784 ; # convert from utf-8 to iso 785 $title =~ s/%FLOWCHART_BR%/ /g; 786 $title =~ s/\"/\'/g; 787 $title =~ s/\s+/ /g; 788 my $anchor = $title; 789 $anchor =~ s/[^a-zA-Z0-9]/_/g; 790 $anchor =~ s/_+/_/g; 791 $anchor =~ s/(^_*|_*$)//g; 792 my $x = 793 ( $fluxItens{$id}->{x} * $caixa{areaX} - 794 ( ( $caixa{areaX} + $caixa{w} ) / 2 ) ) * $reduce; 795 my $y = 796 ( $fluxItens{$id}->{y} * $caixa{areaY} - 797 ( ( $caixa{areaY} + $caixa{h} ) / 2 ) ) * $reduce; 798 my $w = $caixa{w} * $reduce; 799 my $h = $caixa{h} * $reduce; 800 $mapImg .= 801 ' <area href="' . $URL . '#' . $anchor . '" title="' . $title . '"'; 802 $mapImg .= 803 ' shape="rect" coords="' 804 . $x . ',' 805 . $y . ',' 806 . ( $x + $w ) . ',' 807 . ( $y + $h ) . '">'; 808 809 if ( $fluxItens{$id}->{'goto'} ne '' ) { 810 $mapImg .= 811 &encaixaMapImg( $topic, $web, $reduce, $fluxItens{$id}->{'goto'} ); 812 } 813 if ( $fluxItens{$id}->{'gotoYes'} ne '' ) { 814 $mapImg .= 815 &encaixaMapImg( $topic, $web, $reduce, $fluxItens{$id}->{'gotoYes'} ); 816 } 817 if ( $fluxItens{$id}->{'gotoNo'} ne '' ) { 818 $mapImg .= 819 &encaixaMapImg( $topic, $web, $reduce, $fluxItens{$id}->{'gotoNo'} ); 820 } 821 822 return $mapImg; 579 823 } 580 824 581 825 # ========================= 582 sub afterSaveHandler 583 { 826 sub afterSaveHandler { 584 827 ### my ( $text, $topic, $web, $error ) = @_; # do not uncomment, use $_[0], $_[1]... instead 585 828 586 Foswiki::Func::writeDebug( "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )" ) if $debug; 587 829 Foswiki::Func::writeDebug( 830 "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )") 831 if $debug; 832 588 833 my $web = $_[2]; 589 834 $web =~ s/(\/)/\./g; … … 592 837 # my $tempFileName = $Foswiki::cfg{TempfileDir} . '/' . $web . '_' . $_[1] . '.txt'; 593 838 # Foswiki::Func::saveFile( $tempFileName, 'ini' ); 594 839 595 840 # Hire is the right position to create the image. 596 841 if ( $_[0] =~ m/%FLOWCHART%/ ) { 597 &desenhaFluxograma($_[0], $_[1], $_[2], '');842 &desenhaFluxograma( $_[0], $_[1], $_[2], '' ); 598 843 } 599 844 if ( $_[0] =~ m/%FLOWCHART\{([^\n]*?)\}%/ ) { 600 &desenhaFluxograma($_[0], $_[1], $_[2], $1);845 &desenhaFluxograma( $_[0], $_[1], $_[2], $1 ); 601 846 } 602 847 } -
trunk/FlowchartPlugin/lib/Foswiki/Plugins/FlowchartPlugin/build.pl
r3335 r4804 4 4 # 5 5 BEGIN { 6 foreach my $pc (split(/:/, $ENV{FOSWIKI_LIBS})) {7 unshift @INC, $pc;8 }6 foreach my $pc ( split( /:/, $ENV{FOSWIKI_LIBS} ) ) { 7 unshift @INC, $pc; 8 } 9 9 } 10 10 … … 12 12 13 13 # Create the build object 14 $build = new Foswiki::Contrib::Build( 'FlowchartPlugin');14 $build = new Foswiki::Contrib::Build('FlowchartPlugin'); 15 15 16 16 # Build the target on the command line, or the default target 17 $build->build( $build->{target});17 $build->build( $build->{target} ); 18 18
Note: See TracChangeset
for help on using the changeset viewer.
