[debian-edu-commits] debian-edu/pkg-team/ 02/02: 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
Fri Jul 31 03:26:41 UTC 2015


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

sunweaver pushed a commit to branch master
in repository gosa.

commit 87f3a2cc93798fc5618a70a64fd03dc5f72a4464
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).
---
 ...-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 ae7eb21..6a87aa4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,6 +9,7 @@
 1006_sasl-password-change.patch
 1007_gen-uids-like-gosa26.patch
 1008_enable-csv-import-on-clean-installs.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