This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  42292a3ed53f4c58e3958c4b55ddde3cc5c32e13 (commit)
      from  eb6ea29a0075235987e11d81538d9bc373139ae7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=42292a3ed53f4c58e3958c4b55ddde3cc5c32e13

commit 42292a3ed53f4c58e3958c4b55ddde3cc5c32e13
Author: Franck Villaume <[email protected]>
Date:   Fri May 31 10:02:24 2019 +0000

    tweak hgweb to support iframe.resizer

diff --git a/src/common/include/plugins_utils.php 
b/src/common/include/plugins_utils.php
index f52c858..b841da6 100644
--- a/src/common/include/plugins_utils.php
+++ b/src/common/include/plugins_utils.php
@@ -1,7 +1,7 @@
 <?php
 /**
  * Copyright 2010 (c) Mélanie Le Bail
- * Copyright 2014,2015 Franck Villaume - TrivialDev
+ * Copyright 2014,2015, 2019, Franck Villaume - TrivialDev
  * Copyright 2015, Sieu Truc
  * http://fusionforge.org
  *
@@ -63,7 +63,7 @@ function htmlIframe($url, $poub = array()) {
        }
 }
 
-function htmlIframeResizer($url, $poub = array()) {
+function htmlIframeResizer($url, $poub = array(), $resizeOpt = array()) {
        global $HTML, $group_id;
        $project = group_get_object($group_id);
        if (isset($poub['id'])) {
@@ -83,8 +83,12 @@ function htmlIframeResizer($url, $poub = array()) {
                echo html_e('iframe', array('src' => $url, 'id' => $id, 'width' 
=> '100%', 'frameborder' =>0), '', false);
                html_use_iframeresizer();
                echo $HTML->getJavascripts();
+               $optionString = '';
+               foreach ($resizeOpt as $key => $value) {
+                       $optionString .= $key.':'.$value.',';
+               }
                echo '<script type="text/javascript">//<![CDATA[
-                       jQuery(\'#'.$id.'\').iFrameResize();
+                       jQuery(\'#'.$id.'\').iFrameResize({'.$optionString.'});
                        function messageHandler (evt) {
                                var matches = 
jQuery(\'#'.$id.'\')[0].src.match(/^(https?\:\/\/[^\/?#]+)(?:[\/?#]|$)/i);
                                var domain = matches && matches[1];
diff --git a/src/plugins/scmhg/bin/install.sh b/src/plugins/scmhg/bin/install.sh
index 774286e..a96babf 100755
--- a/src/plugins/scmhg/bin/install.sh
+++ b/src/plugins/scmhg/bin/install.sh
@@ -6,6 +6,7 @@ source $(forge_get_config 
source_path)/post-install.d/common/service.inc
 plugindir=$(forge_get_config plugins_path)/scmhg
 hgwebcgi=$(ls -1 /usr/share/doc/mercurial-*/hgweb.cgi 
/usr/share/doc/mercurial/examples/hgweb.cgi 
/usr/share/doc/packages/mercurial/hgweb.cgi 2>/dev/null | tail -1)
 hgtemplatesdir=$(ls -1d /usr/lib*/python*/site-packages/mercurial/templates 
/usr/share/mercurial/templates 2>/dev/null | tail -1)
+use_ssl=$(forge_get_config use_ssl scmhg)
 
 case "$1" in
     configure)
@@ -13,6 +14,15 @@ case "$1" in
        if [ -z "$hgwebcgi" -o -z "$hgtemplatesdir" ]; then echo "Cannot find 
required directories"; exit 1; fi
        ln -nfs $hgwebcgi                 $plugindir/cgi-bin/
        ln -nfs $plugindir/etc/fflog.tmpl $hgtemplatesdir
+       # support iframeresizer in paper theme
+       if [ -z "$use_ssl" ]; then
+               protocol='http://';
+       else
+               protocol='https://';
+       fi
+       if [ -z "`grep '/scripts/iframe-resizer/iframeResizer.contentWindow.js' 
$hgtemplatesdir/paper/header.tmpl`" ]; then
+               echo '<script type="text/javascript" 
src="'$protocol$(forge_get_config 
scm_host)'/scripts/iframe-resizer/iframeResizer.contentWindow.js"></script>' >> 
$hgtemplatesdir/paper/header.tmpl
+       fi
        ;;
     remove)
        rm -rf $plugindir/cgi-bin/
diff --git a/src/plugins/scmhg/common/HgPlugin.class.php 
b/src/plugins/scmhg/common/HgPlugin.class.php
index d16253a..e66d418 100644
--- a/src/plugins/scmhg/common/HgPlugin.class.php
+++ b/src/plugins/scmhg/common/HgPlugin.class.php
@@ -4,7 +4,7 @@
  *
  * Copyright 2009, Roland Mas
  * Copyright 2012, Denise Patzker
- * Copyright 2012-2014,2017-2018, Franck Villaume - TrivialDev
+ * Copyright 2012-2014,2017-2019, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -294,7 +294,7 @@ Offer DAV or SSH access.");
                        if ($params['commit']) {
                                $iframesrc .= '/rev/'.$params['commit'];
                        }
-                       echo '<iframe src="'.$iframesrc.'" id="scmhg_iframe" 
style="width:100%; height:400px;" frameborder="0" ></iframe>';
+                       htmlIframeResizer($iframesrc, array('id'=>'scmhg', 
'absolute'=>true), array('minHeight' => 400));
                }
        }
 

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/plugins_utils.php        | 10 +++++++---
 src/plugins/scmhg/bin/install.sh            | 10 ++++++++++
 src/plugins/scmhg/common/HgPlugin.class.php |  4 ++--
 3 files changed, 19 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to