';
-
+ $user = RequestContext::getMain()->getUser();
+ $permisionManager = $this->services->getPermissionManager();
+ $userHasRight = $permisionManager->userHasRight( $user, 'approverevisions' );
+ if ( $noApproved ) {
+ $output .= '
' .
+ wfMessage( "drawioeditor-noapproved", $name )->text();
+ if ( $userHasRight ) {
+ $output .= ' '
+ . wfMessage( "drawioeditor-approve-link" ) . '';
+ }
+ global $egApprovedRevsBlankFileIfUnapproved;
+ if ( $egApprovedRevsBlankFileIfUnapproved ) {
+ $img = null;
+ $edit_ahref = '';
+ }
+ } else {
+ if ( $img ) {
+ if ( !$latest_is_approved ) {
+ $output .= '
' .
+ wfMessage( "drawioeditor-approved-displaywarning" )->text();
+ }
+ if ( $userHasRight ) {
+ $output .= ' '
+ . wfMessage( "drawioeditor-changeapprove-link" ) . '';
+ }
+ }
+ }
/* div around the image */
$output .= '
';
@@ -121,7 +229,6 @@ public function parse( &$parser, $name = null ) {
$output .= '';
$output .= '[';
$output .= $edit_ahref;
- $output .= wfMessage( 'edit' )->text() . '';
$output .= ']';
$output .= '';
$output .= '
';
@@ -135,29 +242,58 @@ public function parse( &$parser, $name = null ) {
}
if ( $opt_interactive ) {
- $img_fmt = '
';
- $img_html = sprintf( $img_fmt, $id, $img_url_ts, $img_style );
+ if ( !$img ) {
+ $img = $repo->findFile( $img_name );
+ }
+ if ( $img ) {
+ $img_fmt = '
';
+ $img_html = sprintf( $img_fmt, $id, $img_url_ts, $img->getUrl(), $img_style );
+ }
} else {
- $img_fmt = '

';
- $img_html = '
';
- $img_html .= sprintf( $img_fmt, $id, $img_url_ts, 'drawio: ' . $dispname, 'drawio: ' . $dispname, $img_style );
- $img_html .= '';
+ if ( !$img ) {
+ $img_fmt = '

';
+ $img_html = '
';
+ $img_html .= sprintf(
+ $img_fmt, $id, $img_url_ts,
+ 'drawio: ' . $dispname, 'drawio: ' . $dispname, $img_style
+ );
+ $img_html .= '';
+ } else {
+ $mxDocumentExtractor = $this->getMXDocumentExtractor( $opt_type, $img->getRepo() );
+ $mxDocument = $mxDocumentExtractor->extractMXDocument( $img );
+ $imageMapGenerator = new ImageMapGenerator();
+ $imageMapName = 'drawio-map-' . $id;
+ $imageMap = $imageMapGenerator->generateImageMap( $mxDocument, $imageMapName );
+ $img_fmt = '

';
+ $img_fmt .= $imageMap;
+ $img_html = '
';
+ $img_html .= sprintf(
+ $img_fmt, $id, $img_url_ts,
+ 'drawio: ' . $dispname, 'drawio: ' . $dispname, $img_style,
+ $imageMapName
+ );
+ $img_html .= '';
+ }
}
/* output image and optionally a placeholder if the image does not exist yet */
- if ( !$img ) {
+ if ( !$img && !$noApproved ) {
// show placeholder
$output .= sprintf( '
' .
- '%s
empty draw.io chart
',
+ '
%s ',
$id, $dispname );
+ } else {
+ // the image or object element must be there in any case
+ // (it's hidden as long as there is no content.)
+ $output .= $img_html;
}
- // the image or object element must be there' in any case (it's hidden as long as there is no content.
- $output .= $img_html;
$output .= '';
/* editor and overlay divs, iframe is added by javascript on demand */
$output .= '