Changeset 1326

Show
Ignore:
Timestamp:
03/18/11 21:34:09 (2 years ago)
Author:
Torben Brodt
Message:

fixes for custom gmap input

Location:
g-map
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • g-map/files/lib/data/gmap/GmapApi.class.php

    r1309 r1326  
    4040        } 
    4141         
     42        /** 
     43         * @var array<string> 
     44         */ 
    4245        public function getFields() { 
    4346                if(defined('GMAP_CUSTOMINPUT') && $const = GMAP_CUSTOMINPUT && !empty($const)) { 
    44                         $cols = explode(",", GMAP_CUSTOMINPUT); 
     47                        $tmp = explode(",", GMAP_CUSTOMINPUT); 
     48                        $cols = array(); 
     49                        foreach($tmp as $field) { 
     50                                $col = User::getUserOptionID($field); 
     51                                if($col) { 
     52                                        $cols[] = $field; 
     53                                } 
     54                        } 
    4555                } else { 
    4656                        $cols = array('location'); 
     
    4959        } 
    5060         
     61        /** 
     62         * @var string 
     63         */ 
    5164        public function getColumn() { 
    5265                $cols = array(); 
  • g-map/optionals/de.easy-coding.wcf.map.custominput/acptemplates/mapCustomInput.tpl

    r1306 r1326  
    88                        <a href="#" onclick="return changeCustomInput('{$opt.optionName}')"> 
    99                                <h3 class="itemListTitle"> 
    10                                         {$opt.optionName} 
     10                                        {lang}wcf.user.option.{$opt.optionName}{/lang} 
    1111                                </h3> 
    1212                        </a> 
  • g-map/optionals/de.easy-coding.wcf.map.custominput/files/lib/system/event/listener/MapCustomInputListener.class.php

    r1306 r1326  
    22// wcf imports 
    33require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); 
     4require_once(WCF_DIR.'lib/data/gmap/GmapApi.class.php'); 
    45 
    56/** 
     
    1213 */ 
    1314class MapCustomInputListener implements EventListener { 
     15 
     16        public function validate($tmp) { 
     17                $cols = array(); 
     18                foreach($tmp as $field) { 
     19                        $col = User::getUserOptionID($field); 
     20                        if($col) { 
     21                                $cols[] = $col; 
     22                        } 
     23                } 
     24                return $cols; 
     25        } 
     26 
    1427        /** 
    1528         * @see EventListener::execute() 
     
    2336                switch($eventName) { 
    2437                        case 'readData': 
     38                                 
    2539                                $this->current = explode(",", $eventObj->activeOptions['gmap_custominput']['optionValue']); 
     40                                $this->current = $this->validate($this->current); 
     41                                $eventObj->activeOptions['gmap_custominput']['optionValue'] = implode(",", $this->current); 
    2642                                $this->getOptionIDs(); 
    2743                                $this->readOptions(); 
     
    5975                                        document.getElementById("gmap_custominputDiv").appendChild(d); 
    6076                                         
     77                                        var d = document.getElementById("gmap_custominput").value = ""; 
    6178                                        document.getElementById("gmap_custominput").style.display = "none"; 
    6279                                });