Author: Lars Michelsen <[email protected]>
Date: Sun Dec 25 00:56:19 2011 +0100
Committer: Lars Michelsen <[email protected]>
Commit-Date: Sun Dec 25 00:56:19 2011 +0100
Showing dummy shape image when configured shape does not exist
---
ChangeLog | 1 +
install.sh | 2 +-
share/server/core/classes/objects/NagVisShape.php | 14 ++++++++++++--
share/userfiles/images/shapes/std_dummy.png | Bin 0 -> 2307 bytes
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7674845..479eafe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
1.6.3
Frontend
+ * Showing dummy shape image when configured shape does not exist
* Bugfix: Preventing loops in relative coords
* Bugfix: Preventing JS error when trying to position objects relative but
no target object can be found
diff --git a/install.sh b/install.sh
index f95e214..f51a2fb 100755
--- a/install.sh
+++ b/install.sh
@@ -1508,7 +1508,7 @@ if [ "$INSTALLER_ACTION" = "update" -a "$NAGVIS_VER_OLD"
!= "UNKNOWN" ]; then
restore "$USERFILES_DIR/images/iconsets/" "iconset files" "/20x20.png
/std_*_*.png /demo_*.png"
LINE="Restoring custom shapes..."
- restore "$USERFILES_DIR/images/shapes/" "shapes" "*demo*png"
+ restore "$USERFILES_DIR/images/shapes/" "shapes" "*demo*png
/std_dummy.png"
LINE="Restoring custom templates..."
restore "$USERFILES_DIR/templates/" "templates" "/default.*"
diff --git a/share/server/core/classes/objects/NagVisShape.php
b/share/server/core/classes/objects/NagVisShape.php
index a8e6cee..4a5d1cb 100644
--- a/share/server/core/classes/objects/NagVisShape.php
+++ b/share/server/core/classes/objects/NagVisShape.php
@@ -42,6 +42,7 @@ class NagVisShape extends NagVisStatelessObject {
$this->icon = $icon;
$this->type = 'shape';
+
parent::__construct($CORE);
}
@@ -54,6 +55,9 @@ class NagVisShape extends NagVisStatelessObject {
* @author Lars Michelsen <[email protected]>
*/
public function parseJson() {
+ // Checks wether the shape exists or not
+ $this->fetchIcon();
+
return parent::parseJson();
}
@@ -73,12 +77,18 @@ class NagVisShape extends NagVisStatelessObject {
/**
* PUBLIC fetchIcon()
*
- * Just a dummy here (Shape won't need an icon)
+ * Is executed to detect missing shape images. Is not doing anything
+ * when the shape image is an URL.
*
* @author Lars Michelsen <[email protected]>
*/
public function fetchIcon() {
- // Nothing to do here, icon is set in constructor
+ if($this->icon[0] != '[') {
+ if(!file_exists(parent::$iconPath . $this->icon)
+ && !file_exists(parent::$iconPathLocal . $this->icon)) {
+ $this->icon = 'std_dummy.png';
+ }
+ }
}
# End public methods
diff --git a/share/userfiles/images/shapes/std_dummy.png
b/share/userfiles/images/shapes/std_dummy.png
new file mode 100644
index 0000000..31f487d
Binary files /dev/null and b/share/userfiles/images/shapes/std_dummy.png differ
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins