Logo Search packages:      
Sourcecode: nagvis version File versions  Download package

WuiAddModify::fillFields (  ) 

Fills the fields of the form with values

Returns:
Array JS Code
Author:
Lars Michelsen <lars@vertical-visions.de>

Definition at line 73 of file WuiAddModify.php.

Referenced by getForm().

                            {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method WuiAddModify::fillFields()');
            $ret = Array();
            
            switch($this->prop['action']) {
                  case 'modify':
                        if($this->prop['coords'] != '') {
                              $myval = $this->prop['id'];
                              $val_coords = explode(',',$this->prop['coords']);
                              if ($this->prop['type'] == 'textbox') {
                                    $objwidth = $val_coords[2] - $val_coords[0];
                                    $ret[] = 'document.addmodify.elements[\'x\'].value=\''.$val_coords[0].'\';';
                                    $ret[] = 'document.addmodify.elements[\'y\'].value=\''.$val_coords[1].'\';';
                                    $ret[] = 'document.addmodify.elements[\'w\'].value=\''.$objwidth.'\';';
                              } else {
                                    $ret[] = 'document.addmodify.elements[\'x\'].value=\''.$val_coords[0].','.$val_coords[2].'\';';
                                    $ret[] = 'document.addmodify.elements[\'y\'].value=\''.$val_coords[1].','.$val_coords[3].'\';';
                              }
                        }
                  break;
                  // if the action specified in the URL is "add", we set the object coordinates (that we retrieve from the mycoords parameter)
                  case 'add':
                        if($this->prop['coords'] != '') {
                              $val_coords = explode(',',$this->prop['coords']);
                              if(count($val_coords) == 2) {             
                                    $ret[] = 'document.addmodify.elements[\'x\'].value=\''.$val_coords[0].'\';';
                                    $ret[] = 'document.addmodify.elements[\'y\'].value=\''.$val_coords[1].'\';';
                              } elseif(count($val_coords) == 4) {
                                    if ($this->prop['type'] == 'textbox') {
                                          $objwidth = $val_coords[2] - $val_coords[0];
                                          
                                          $ret[] = 'document.addmodify.elements[\'x\'].value=\''.$val_coords[0].'\';';
                                          $ret[] = 'document.addmodify.elements[\'y\'].value=\''.$val_coords[1].'\';';
                                          $ret[] = 'document.addmodify.elements[\'w\'].value=\''.$objwidth.'\';';
                                    } else {
                                          $ret[] = 'document.addmodify.elements[\'x\'].value=\''.$val_coords[0].','.$val_coords[2].'\';';
                                          $ret[] = 'document.addmodify.elements[\'y\'].value=\''.$val_coords[1].','.$val_coords[3].'\';';
                                    }           
                              }
                        }
                  break;
            }
            
            if (DEBUG&&DEBUGLEVEL&1) debug('End method WuiAddModify::fillFields(): Array(JS)');
            return $ret;
      }


Generated by  Doxygen 1.6.0   Back to index