Module: nagvis Branch: master Commit: 7e2083668ea55a97876ec0f3c93847f193f4cc28 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=7e2083668ea55a97876ec0f3c93847f193f4cc28
Author: LaMi <[email protected]> Date: Sat Feb 13 14:38:08 2010 +0100 #19 Implemented clone mechanism in WUI for regular objects --- share/frontend/wui/classes/WuiMap.php | 15 +++++++++++---- share/frontend/wui/images/internal/delete.png | Bin 2196 -> 0 bytes share/frontend/wui/images/internal/help_icon.png | Bin 471 -> 0 bytes share/frontend/wui/images/internal/modify.png | Bin 1839 -> 0 bytes share/frontend/wui/images/internal/move.png | Bin 2185 -> 0 bytes share/frontend/wui/js/wui.js | 6 +++++- share/server/core/classes/CoreModMap.php | 7 ++++++- share/server/core/classes/WuiViewMapAddModify.php | 14 ++++++++++++++ 8 files changed, 36 insertions(+), 6 deletions(-) diff --git a/share/frontend/wui/classes/WuiMap.php b/share/frontend/wui/classes/WuiMap.php index 697978e..d483968 100644 --- a/share/frontend/wui/classes/WuiMap.php +++ b/share/frontend/wui/classes/WuiMap.php @@ -638,20 +638,27 @@ class WuiMap extends GlobalMap { $tooltipText .= "<ul class='nav'>"; // Edit link - $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/internal/modify.png)'" + $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/modify.png)'" ." href=\"#\" onclick=\"popupWindow('".$this->CORE->getLang()->getText('change')."'," ."getSyncRequest('".$this->CORE->getMainCfg()->getValue('paths', 'htmlbase')."/server/core/ajax_handler.php?mod=Map&act=addModify&do=modify&map=".$this->MAPCFG->getName()."&type=".$obj['type']."&id=".$obj['id']."',true,false));contextHide();\">" ."<span>".$this->CORE->getLang()->getText('change')."</span></a></li>"; - // Position/Size link on textboxes/lines + // Position/Size link on lines if($obj['type'] == 'line' || (isset($obj['view_type']) && $obj['view_type'] == 'line')) { - $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/internal/move.png)'" + $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/move.png)'" ." href=\"javascript:objid=".$obj['id'].";get_click('".$obj['type']."',2,'modify');\" onclick=\"contextHide();\">" ."<span>".$this->CORE->getLang()->getText('positionSize')."</span></a></li>"; } + // Show clone link only for icons + if(isset($obj['view_type']) && $obj['view_type'] == 'icon') { + $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/clone.png)'" + ." href=\"javascript:get_click('".$obj['type']."', 1, 'clone');\" onclick=\"contextHide();\">" + ."<span>".$this->CORE->getLang()->getText('Clone')."</span></a></li>"; + } + // Delete link - $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/internal/delete.png)'" + $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/delete.png)'" ." href='#' onclick='deleteMapObject(\"box_".$obj['type']."_".$obj['id']."\");contextHide();return false;'>" ."<span>".$this->CORE->getLang()->getText('delete')."</span></a></li>"; diff --git a/share/frontend/wui/images/internal/delete.png b/share/frontend/wui/images/internal/delete.png deleted file mode 100644 index fb78d9f..0000000 Binary files a/share/frontend/wui/images/internal/delete.png and /dev/null differ diff --git a/share/frontend/wui/images/internal/help_icon.png b/share/frontend/wui/images/internal/help_icon.png deleted file mode 100644 index 61bce83..0000000 Binary files a/share/frontend/wui/images/internal/help_icon.png and /dev/null differ diff --git a/share/frontend/wui/images/internal/modify.png b/share/frontend/wui/images/internal/modify.png deleted file mode 100644 index 80a1172..0000000 Binary files a/share/frontend/wui/images/internal/modify.png and /dev/null differ diff --git a/share/frontend/wui/images/internal/move.png b/share/frontend/wui/images/internal/move.png deleted file mode 100644 index 2732a4a..0000000 Binary files a/share/frontend/wui/images/internal/move.png and /dev/null differ diff --git a/share/frontend/wui/js/wui.js b/share/frontend/wui/js/wui.js index d60a647..ac4391a 100644 --- a/share/frontend/wui/js/wui.js +++ b/share/frontend/wui/js/wui.js @@ -327,8 +327,12 @@ function get_click_pos(e) { } follow_mouse = false; - if(action_click == 'add') { + if(action_click == 'add' || action_click == 'clone') { link = oGeneralProperties.path_server+'?mod=Map&act=addModify&do=add&map='+mapname+'&type='+objtype+'&coords='+coords+'&viewType='+viewType; + + if(action_click == 'add') { + link += '&clone='+objid; + } } else if(action_click == 'modify') { link = oGeneralProperties.path_server+'?mod=Map&act=addModify&do=modify&map='+mapname+'&type='+objtype+'&id='+objid+'&coords='+coords; } diff --git a/share/server/core/classes/CoreModMap.php b/share/server/core/classes/CoreModMap.php index ccc1ee9..774d6ba 100644 --- a/share/server/core/classes/CoreModMap.php +++ b/share/server/core/classes/CoreModMap.php @@ -219,7 +219,8 @@ class CoreModMap extends CoreModule { 'type' => MATCH_OBJECTTYPE, 'id' => MATCH_INTEGER_EMPTY, 'viewType' => MATCH_VIEW_TYPE_SERVICE_EMPTY, - 'coords' => MATCH_STRING_NO_SPACE_EMPTY); + 'coords' => MATCH_STRING_NO_SPACE_EMPTY, + 'clone' => MATCH_INTEGER_EMPTY); $aVals = $this->getCustomOptions($aOpts); // Initialize unset optional attributes @@ -235,6 +236,10 @@ class CoreModMap extends CoreModule { $aVals['viewType'] = ''; } + if(!isset($aVals['clone'])) { + $aVals['clone'] = ''; + } + $VIEW = new WuiViewMapAddModify($this->AUTHENTICATION, $this->AUTHORISATION); $VIEW->setOpts($aVals); $sReturn = json_encode(Array('code' => $VIEW->parse())); diff --git a/share/server/core/classes/WuiViewMapAddModify.php b/share/server/core/classes/WuiViewMapAddModify.php index d185b80..f916fc6 100644 --- a/share/server/core/classes/WuiViewMapAddModify.php +++ b/share/server/core/classes/WuiViewMapAddModify.php @@ -120,6 +120,20 @@ class WuiViewMapAddModify { break; case 'add': + if($this->aOpts['clone'] !== '') { + // Get the options of the object to clone from map + foreach($this->MAPCFG->getValidTypeKeys($this->aOpts['type']) as $i => $key) { + if($key !== 'x' && $key !== 'y' && $key !== 'y' && $key !== 'object_id') { + $val = $this->MAPCFG->getValue($this->aOpts['type'], $this->aOpts['clone'], $key, true); + + if($val !== false) { + $ret .= 'document.addmodify.elements[\''.$key.'\'].value=\''.$val.'\';'; + $ret .= 'toggleDefaultOption(\''.$key.'\');'; + } + } + } + } + if($this->aOpts['coords'] != '') { $val_coords = explode(',', $this->aOpts['coords']); if(count($val_coords) == 2) { ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
