[debian-edu-commits] debian-edu/pkg-team/ 01/08: debian/patches: Add 1009_fix-insertDhcp-icon-in-dhcp-section-overview.patch. Fix label stripping in GOsa²'s image() function. This fixes displaying the insertDhcp* icon in the DHCP service plugin. (Closes: #794117).

Mike Gabriel sunweaver at debian.org
Mon Aug 24 19:49:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch debian/jessie/updates
in repository gosa.

commit c621a40e8d4001343e5b615174ca4fc80adfcea0
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Jul 31 05:26:11 2015 +0200

    debian/patches: Add 1009_fix-insertDhcp-icon-in-dhcp-section-overview.patch. Fix label stripping in GOsa²'s image() function. This fixes displaying the insertDhcp* icon in the DHCP service plugin. (Closes: #794117).
    
    Conflicts (resolved by Mike Gabriel):
    	debian/patches/series
---
 ...-insertDhcp-icon-in-dhcp-section-overview.patch | 62 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 63 insertions(+)

diff --git a/debian/patches/1009_fix-insertDhcp-icon-in-dhcp-section-overview.patch b/debian/patches/1009_fix-insertDhcp-icon-in-dhcp-section-overview.patch
new file mode 100644
index 0000000..df00fc3
--- /dev/null
+++ b/debian/patches/1009_fix-insertDhcp-icon-in-dhcp-section-overview.patch
@@ -0,0 +1,62 @@
+Description: Fix label extraction from image paths
+Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+Abstract:
+ The DHCP service plugin uses image() function calls like this kind:
+ .
+ $editImgIns = image('images/lists/element.png[new]', 'insertDhcp_%s', _("Insert new DHCP section"));
+ .
+ The "[new] part of the image file name is used for referencing the
+ style sheet of the image label.
+ .
+ The upstream version of the image function now does three things:
+ .
+   1. Check if the image itself has a style sheet (if not, bail out).
+      ^^^^ Here the function bails out, as it cannot find a style sheet
+           for "element.png[new]". The label needs to be substracted first.
+
+   2. Check if a label name has been appended to the image file name.
+   3. If (2), check if the label style sheet exists (if not, die).
+   4. If (3), then strip the "[<label>]" part from the file name.
+ .
+ We change this to:
+   1. Check if a label name has been appended to the image file name.
+      (if so, substract that label name from the path name of the image).
+   2. Check if the image itself has a style sheet (if not, bail out).
+   3. Check if the label style sheet exist (if not, die).
+
+--- a/gosa-core/include/functions.inc
++++ b/gosa-core/include/functions.inc
+@@ -3576,16 +3576,19 @@
+   }
+   $styles= session::global_get('img-styles');
+ 
++  /* Extract labels from path */
++  preg_match("/(.*\.png)\[(.*)\]$/", $path, $matches);
++
++  if (count($matches) == 3) {
++    $path = $matches[1];
++    $label= $matches[2];
++  }
++
+   /* If there's nothing available, just return nothing */
+   if (!array_key_exists($path, $styles)) {
+     return "";
+   }
+ 
+-  /* Extract labels from path */
+-  if (preg_match("/\.png\[(.*)\]$/", $path, $matches)) {
+-    $label= $matches[1];
+-  }
+-
+   $lbl= "";
+   if ($label) {
+     if (isset($styles["images/label-".$label.".png"])) {
+@@ -3593,8 +3596,6 @@
+     } else {
+       die("Invalid label specified: $label\n");
+     }
+-
+-    $path= preg_replace("/\[.*\]$/", "", $path);
+   }
+ 
+   // Non middle layout?
diff --git a/debian/patches/series b/debian/patches/series
index fa9b4fc..6431df8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,6 +5,7 @@
 1002_trim-decrypt.patch
 1003_RequestHeader-no-underscores-apache24.patch
 1004_fix-typos-in-man-pages.patch
+1009_fix-insertDhcp-icon-in-dhcp-section-overview.patch
 2001_fix-smarty-location.patch
 2002_fix-template-location.patch
 2003_fix-class-mapping.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/gosa.git



More information about the debian-edu-commits mailing list