Changeset 94

Show
Ignore:
Timestamp:
16/10/08 19:03:47 (3 months ago)
Author:
royger
Message:

* Fixed Cookies #215
* Fixed error adding user #214
* Fixed empty form action #205
* Fixed autoload #191
* Added javascript event improvements by tn123 #187
* Fixed install problem on FreeBSD #212

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wtorrent/lib/cls/Web.cls.php

    r93 r94  
    1717 
    1818Original class done by David Marco Martinez 
    19 Modified by Roger Pau Monné 
    20 */ 
     19Modified by Roger Pau Monn�/ 
    2120abstract class Web 
    2221{ 
     
    166165        public function getURL() 
    167166        { 
    168                 return $_SERVER['REQUEST_URI']; 
     167                return $this->_server['REQUEST_URI']; 
    169168        } 
    170169        /** 
     
    322321                $this->message[] = $message;  
    323322        } 
    324  
    325323        abstract protected function construct( ); 
    326324} 
  • trunk/wtorrent/lib/inc/string.inc.php

    r93 r94  
    5252        if (!get_magic_quotes_gpc()) 
    5353        { 
    54                 return
     54                return $var
    5555        } 
    5656        return _unescape_internal($var); 
     
    5858function html( $str ) 
    5959{ 
    60         $str = str_replace( array( '�'� ), array( 'ñ', 'Ñ' ), $str ); 
     60        $str = str_replace( array( 'Ò', '—' ), array( 'ñ', 'Ñ' ), $str ); 
    6161        return preg_replace( '/[^\x00-\x7F]/e', '"&#".ord("$0").";"', $str ); 
    6262 
     
    9999        '}' => '}', 
    100100        '~' => '~', 
    101         '' => '€', 
    102         '' => '‚', 
    103         '' => 'Œ', 
    104         '' => 'Ž', 
    105         '' => '‘', 
    106         '' => '’', 
    107         '' => '“', 
    108         '' => '”', 
    109         '' => '•', 
    110         '' => '–', 
    111         '' => '—', 
    112         '' => '˜', 
    113         '' => '™', 
    114         '' => 'š', 
    115         '' => '›', 
    116         '' => 'œ', 
    117         '' => 'Ÿ', 
    118         '' => '¡', 
    119         '' => '¢', 
    120         '' => '£', 
    121         '' => '¤', 
    122         '' => '¥', 
    123         '' => '¦', 
    124         '' => '§', 
    125         '' => '¨', 
    126         '' => '©', 
    127         '' => 'ª', 
    128         '' => '«', 
    129         '' => '¬', 
    130         '' => '­', 
    131         '' => '®', 
    132         '' => '¯', 
    133         '' => '°', 
    134         '' => '±', 
    135         '' => '²', 
    136         '' => '³', 
    137         '' => '´', 
    138         '' => 'µ', 
    139         '' => '¶', 
    140         '' => '·', 
    141         '' => '¸', 
    142         '' => '¹', 
    143         '' => 'º', 
    144         '' => '»', 
    145         '' => '¼', 
    146         '' => '½', 
    147         '' => '¾', 
    148         '' => '¿', 
    149         ' => 'À', 
    150         ' => 'Á', 
    151         ' => 'Â', 
    152         ' => 'Ã', 
    153         ' => 'Ä', 
    154         ' => 'Å', 
    155         ' => 'Æ', 
    156         ' => 'Ç', 
    157         ' => 'È', 
    158         ' => 'É', 
    159         ' => 'Ê', 
    160         ' => 'Ë', 
    161         ' => 'Ì', 
    162         ' => 'Í', 
    163         ' => 'Î', 
    164         ' => 'Ï', 
    165         ' => 'Ð', 
    166         ' => 'Ñ', 
    167         ' => 'Ò', 
    168         ' => 'Ó', 
    169         ' => 'Ô', 
    170         ' => 'Õ', 
    171         ' => 'Ö', 
    172         ' => '×', 
    173         ' => 'Ø', 
    174         ' => 'Ù', 
    175         ' => 'Ú', 
    176         ' => 'Û', 
    177         ' => 'Ü', 
    178         ' => 'Ý', 
    179         ' => 'Þ', 
    180         ' => 'ß', 
    181         '=> 'à', 
    182         '=> 'á', 
    183         '=> 'â', 
    184         '=> 'ã', 
    185         '=> 'ä', 
    186         '=> 'å', 
    187         '=> 'æ', 
    188         '=> 'ç', 
    189         '=> 'è', 
    190         '=> 'é', 
    191         '=> 'ê', 
    192         '=> 'ë', 
    193         '=> 'ì', 
    194         '=> 'í', 
    195         '=> 'î', 
    196         '=> 'ï', 
    197         '> 'ð', 
    198         '> 'ñ', 
    199         '> 'ò', 
    200         '> 'ó', 
    201         '> 'ô', 
    202         '> 'õ', 
    203         '> 'ö', 
    204         '> '÷', 
    205         ' 'ø', 
    206         ' 'ù', 
    207         ' 'ú', 
    208         ' 'û', 
    209         ''ü', 
    210         ''ý', 
    211         '' => 'þ', 
    212         '' => 'ÿ', 
    213         '' => 'Œ', 
    214         '' => 'œ', 
    215         '' => 'Š', 
    216         '' => 'š', 
    217         '' => 'Ÿ', 
    218         '' => 'ˆ', 
    219         '' => '˜', 
    220         '' => '–', 
    221         '' => '—', 
    222         '' => '‘', 
    223         '' => '’', 
    224         '' => '‚', 
    225         '' => '“', 
    226         '' => '”', 
    227         '' => '„', 
    228         '' => '†', 
    229         '' => '‡', 
    230         '' => '‰', 
    231         '' => '‹', 
    232         '' => '›' ); 
     101        'Ä' => '€', 
     102        'Ç' => '‚', 
     103        'å' => 'Œ', 
     104        'é' => 'Ž', 
     105        'ë' => '‘', 
     106        'í' => '’', 
     107        'ì' => '“', 
     108        'î' => '”', 
     109        'ï' => '•', 
     110        'ñ' => '–', 
     111        'ó' => '—', 
     112        'ò' => '˜', 
     113        'ô' => '™', 
     114        'ö' => 'š', 
     115        'õ' => '›', 
     116        'ú' => 'œ', 
     117        'ü' => 'Ÿ', 
     118        '°' => '¡', 
     119        '¢' => '¢', 
     120        '£' => '£', 
     121        '§' => '¤', 
     122        '' => '¥', 
     123        '' => '¦', 
     124        'ß' => '§', 
     125        '®' => '¨', 
     126        '©' => '©', 
     127        '' => 'ª', 
     128        '´' => '«', 
     129        '¨' => '¬', 
     130        '' => '­', 
     131        'Æ' => '®', 
     132        'Ø' => '¯', 
     133        '' => '°', 
     134        '±' => '±', 
     135        '' => '²', 
     136        '' => '³', 
     137        '¥' => '´', 
     138        'µ' => 'µ', 
     139        '' => '¶', 
     140        '' => '·', 
     141        '' => '¸', 
     142        'π' => '¹', 
     143        '' => 'º', 
     144        'ª' => '»', 
     145        'º' => '¼', 
     146        'Ω' => '½', 
     147        'æ' => '¾', 
     148        'ø' => '¿', 
     149        '¿' => 'À', 
     150        '¡' => 'Á', 
     151        '¬' => 'Â', 
     152        '√' => 'Ã', 
     153        'ƒ' => 'Ä', 
     154        '≈' => 'Å', 
     155        '∆' => 'Æ', 
     156        '«' => 'Ç', 
     157        '»' => 'È', 
     158        '…' => 'É', 
     159        ' ' => 'Ê', 
     160        'À' => 'Ë', 
     161        'Ã' => 'Ì', 
     162        'Õ' => 'Í', 
     163        'Œ' => 'Î', 
     164        'œ' => 'Ï', 
     165        '–' => 'Ð', 
     166        '—' => 'Ñ', 
     167        '“' => 'Ò', 
     168        '”' => 'Ó', 
     169        '‘' => 'Ô', 
     170        '’' => 'Õ', 
     171        '÷' => 'Ö', 
     172        '◊' => '×', 
     173        'ÿ' => 'Ø', 
     174        'Ÿ' => 'Ù', 
     175        '⁄' => 'Ú', 
     176        '€' => 'Û', 
     177        '‹' => 'Ü', 
     178        '›' => 'Ý', 
     179        'fi' => 'Þ', 
     180        'fl' => 'ß', 
     181        '‡' => 'à', 
     182        '·' => 'á', 
     183        '‚' => 'â', 
     184        '„' => 'ã', 
     185        '‰' => 'ä', 
     186        'Â' => 'å', 
     187        'Ê' => 'æ', 
     188        'Á' => 'ç', 
     189        'Ë' => 'è', 
     190        'È' => 'é', 
     191        'Í' => 'ê', 
     192        'Î' => 'ë', 
     193        'Ï' => 'ì', 
     194        'Ì' => 'í', 
     195        'Ó' => 'î', 
     196        'Ô' => 'ï', 
     197        '' => 'ð', 
     198        'Ò' => 'ñ', 
     199        'Ú' => 'ò', 
     200        'Û' => 'ó', 
     201        'Ù' => 'ô', 
     202        'ı' => 'õ', 
     203        'ˆ' => 'ö', 
     204        '˜' => '÷', 
     205        '¯' => 'ø', 
     206        '˘' => 'ù', 
     207        '˙' => 'ú', 
     208        '˚' => 'û', 
     209        '¸' => 'ü', 
     210        '˝' => 'ý', 
     211        '˛' => 'þ', 
     212        'ˇ' => 'ÿ', 
     213        'å' => 'Œ', 
     214        'ú' => 'œ', 
     215        'ä' => 'Š', 
     216        'ö' => 'š', 
     217        'ü' => 'Ÿ', 
     218        'à' => 'ˆ', 
     219        'ò' => '˜', 
     220        'ñ' => '–', 
     221        'ó' => '—', 
     222        'ë' => '‘', 
     223        'í' => '’', 
     224        'Ç' => '‚', 
     225        'ì' => '“', 
     226        'î' => '”', 
     227        'Ñ' => '„', 
     228        'Ü' => '†', 
     229        'á' => '‡', 
     230        'â' => '‰', 
     231        'ã' => '‹', 
     232        'õ' => '›' ); 
    233233} 
    234234?> 
  • trunk/wtorrent/lib/inc/utils.inc.php

    r4 r94  
    2727function autoload( ) 
    2828{ 
    29         //$str  = 'if( file_exists( \'../lib/cls/\'.$file ) ) require_once( \'../lib/cls/\'.$file );'; 
    30         $str  = 'if( false );'; 
    3129        foreach( func_get_args( ) as $dir ) 
    32                 $str .= 'elseif( file_exists( \''.$dir.'\'.$file ) ) require_once( \''.$dir.'\'.$file );'; 
    33  
     30        { 
     31                $str .= 'if(file_exists(\'' . $dir . '/\' . $file)) require_once(\'' . $dir . '/\' . $file);'; 
     32        } 
    3433        $cmd = 
    3534        'function __autoload( $cls ) 
  • trunk/wtorrent/wt/cls/AddT.cls.php

    r93 r94  
    1818class AddT extends rtorrent 
    1919{ 
    20  
    2120        public function construct() 
    2221        { 
     
    145144                $purl = parse_url( $url ); 
    146145                return implode( 
    147                         '; ', 
     146                        ';', 
    148147                        $this->_db->queryColumnAll( 
    149                                 'SELECT id, value, hostname FROM cookie WHERE userid = ? AND hostname LIKE ?', 
     148                                'SELECT value FROM cookie WHERE userid = ? AND hostname LIKE ?', 
    150149                                $this->getIdUser(), 
    151150                                "%{$purl['host']}%" 
  • trunk/wtorrent/wt/cls/Admin.cls.php

    r93 r94  
    2222                if(isset($this->_request['adduser'])) $this->addUser($this->_request['user'], $this->_request['passwd'], $this->_request['admin'], $this->_request['default_dir'], $this->_request['force_dir']); 
    2323                if(isset($this->_request['delete'])) $this->deleteUsers($this->_request['users']); 
    24                  
     24 
    2525                if(!$this->setClient()) 
    2626                        return false; 
    27                  
     27 
    2828                if(isset($this->_request['ch_dw'])) $this->setDownLimit($this->_request['down_rate']); 
    2929                if(isset($this->_request['ch_up'])) $this->setUploadLimit($this->_request['up_rate']); 
     
    4343 
    4444        public function showUsers() 
    45    
     45       
    4646                return $this->_db->queryAll('SELECT user, id, admin, dir, force_dir FROM tor_passwd'); 
    47    
    48     public function deleteUsers($users) 
    49    
     47       
     48       public function deleteUsers($users) 
     49       
    5050                if (!count($users) > 0) 
    5151                { 
     
    5656                $this->_db->modifyMany('DELETE FROM tor_passwd WHERE id = ?', $list); 
    5757                $this->addMessage($this->_str['info_users_deleted']); 
    58    
    59     public function addUser($user, $passwd, $admin, $dir, $force_dir) 
    60    
     58       
     59       public function addUser($user, $passwd, $admin, $dir, $force_dir) 
     60       
    6161                if (empty($user) || empty($passwd)) 
    62               { 
     62              { 
    6363                        $this->addMessage($this->_str['err_users_add']); 
    6464                        return; 
     
    6767                $admin = $admin == 'on' ? 1 : 0; 
    6868                $force_dir = $force_dir == 'on' ? 1 : 0; 
    69                 $this->db->modify( 
    70                         'INSERT INTO tor_passwd (user, passwd, admin, dir, force_dir', 
     69                $this->_db->modify('INSERT INTO tor_passwd(user, passwd, admin, dir, force_dir) VALUES(?, ?, ?, ?, ?)', 
    7170                        $user, 
    7271                        md5($passwd), 
     
    7473                        $dir, 
    7574                        $force_dir 
    76                 ); 
     75                       ); 
    7776                $this->addMessage($this->_str['info_users_added']); 
    78    
    79     protected function setPerm() 
    80    
    81       $this->admin = true; 
    82    
    83     private function setDownLimit($limit) 
    84    
    85       $message = new xmlrpcmsg("set_download_rate", array(new xmlrpcval($limit*1024, 'int'))); 
     77       
     78       protected function setPerm() 
     79       
     80              $this->admin = true; 
     81       
     82       private function setDownLimit($limit) 
     83       
     84              $message = new xmlrpcmsg("set_download_rate", array(new xmlrpcval($limit*1024, 'int'))); 
    8685                $result = $this->client->send($message); 
    8786                //print_r($result); 
     
    9089                else 
    9190                        $this->addMessage($this->_str['err_down_limit']);        
    92    
    93     private function setUploadLimit($limit) 
    94    
    95       $message = new xmlrpcmsg("set_upload_rate", array(new xmlrpcval($limit*1024, 'int'))); 
     91       
     92       private function setUploadLimit($limit) 
     93       
     94              $message = new xmlrpcmsg("set_upload_rate", array(new xmlrpcval($limit*1024, 'int'))); 
    9695                $result = $this->client->send($message); 
    9796                if($result->errno == 0) 
     
    9998                else 
    10099                        $this->addMessage($this->_str['err_up_limit']);  
    101    
     100       
    102101} 
  • trunk/wtorrent/wt/js/ajax.js

    r91 r94  
    7777                } 
    7878                this.lastMain = originalRequest.request.options.parameters; 
    79                 this.events.reloadTorrent(this.main.torrentHandler.bindAsEventListener(this.main), this.main.torrentMouseOverHandler.bindAsEventListener(this.main), this.main.torrentMouseOutHandler.bindAsEventListener(this.main)); 
    80                 this.events.reloadTorrentTabs(this.main.torrentTabsHandler.bindAsEventListener(this.main)); 
    81                 this.events.reloadListButtons(this.main.torrentListButtons.bindAsEventListener(this.main)); 
    82                 this.events.reloadSortButtons(this.main.torrentSort.bindAsEventListener(this.main)); 
     79                this.events.rebindAllHandlers(); 
    8380                postAjax(); 
    8481        }, 
     
    9087                $(id).removeClassName('loading'); 
    9188                this.display.openTorrent(id); 
    92                 afterFinish(); 
     89                this.events.rebindAllHandlers(); 
     90                if (afterFinish) { 
     91                        afterFinish(); 
     92                } 
    9393        }, 
    9494        /* Reload main frame */ 
  • trunk/wtorrent/wt/js/control.js

    r91 r94  
    55                this.display = new DisplayActions(effects); 
    66                this.events = new EventHandler(); 
    7                 this.ajax = new AjaxHandler('index.php', this.display, this, this.events, {loadingMain: 'loadingMain', loadingMessages: 'loadingMessages', loadingTorrent: 'loadingTorrent'}); 
     7                this.ajax = new AjaxHandler( 
     8                        'index.php', 
     9                        this.display, 
     10                        this, 
     11                        this.events, 
     12                        { 
     13                                loadingMain: 'loadingMain', 
     14                                loadingMessages: 'loadingMessages', 
     15                                loadingTorrent: 'loadingTorrent' 
     16                        } 
     17                ); 
    818                /* Add all events listeners */ 
    919                /* Torrent event listening */ 
    10                 this.events.bindTorrent(this.torrentHandler.bindAsEventListener(this), this.torrentMouseOverHandler.bindAsEventListener(this), this.torrentMouseOutHandler.bindAsEventListener(this)); 
    11                 /* Top tabs listener */ 
    12                 this.events.reloadViewTabs(this.viewTabsHandler.bindAsEventListener(this)); 
    13                 /* Left torrent tabs listener */ 
    14                 this.events.bindTorrentTabs(this.torrentTabsHandler.bindAsEventListener(this)); 
    15                 /* Torrent List buttons listener */ 
    16                 this.events.bindListButtons(this.torrentListButtons.bindAsEventListener(this)); 
    17                 /* Torrent change priority listener */ 
    18                 this.events.bindPriorityTorrent(this.torrentPriorityHandler.bindAsEventListener(this)); 
    19                 /* Sort buttons */ 
    20                 this.events.bindSortButtons(this.torrentSort.bindAsEventListener(this)); 
    21                 /* Reload Main */ 
    22                 this.events.reloadReloadMain(this.ajax.reloadMain.bindAsEventListener(this.ajax)); 
     20                var events = { 
     21                        '.torrent': { 
     22                                'click': 'torrentHandler', 
     23                                'mouseover': 'torrentMouseOverHandler', 
     24                                'mouseout': 'torrentMouseOutHandler' 
     25                        }, 
     26                        '#tabs': { 
     27                                'click': 'viewTabsHandler' 
     28                        }, 
     29                        '.tabsLeft': { 
     30                                'click': 'torrentTabsHandler' 
     31                        }, 
     32                        '#torrentListButtons': { 
     33                                'click': 'torrentListButtons', 
     34                        }, 
     35                        '.priority': { 
     36                                'click': 'torrentPriorityHandler' 
     37                        }, 
     38                        '#listTorrentsHead': { 
     39                                'click': 'torrentSort' 
     40                        }, 
     41                        '#refresh': { 
     42                                'click': 'reloadMain' 
     43                        }, 
     44                        '.filesButtons': { 
     45                                'click': 'torrentFilesHandler' 
     46                        }, 
     47                        '.trackersButtons': { 
     48                                'click': 'torrentTrackersHandler' 
     49                        } 
     50                }; 
     51                 
     52                for (var evt in events)  
     53                { 
     54                        var actions = events[evt]; 
     55                        for (var action in actions) 
     56                        { 
     57                                this.events.bindHandler(evt, action, this[actions[action]].bind(this)); 
     58                        } 
     59                } 
    2360        }, 
    2461        /* Event handlers */ 
     
    3673                                /* The tab is empty, prepare content to load */ 
    3774                                var showLoad = this.ajax.showLoadTorrent.bind(this.ajax, id); 
    38                                 var afterFinish = this.events.reloadPriorityTorrent.bind(this.events, this.torrentPriorityHandler.bindAsEventListener(this)); 
     75                                var afterFinish = this.events.rebindAllHandlers(this.events); 
    3976                                var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 
    4077                                var url = 'cls=General&tpl=details&hash=' + id; 
     
    86123        }, 
    87124        confirmTorrentAction: function(el, message) { 
    88                 var torrent_names = ''; 
    89                 var t; 
     125                 
     126                // make me an array 
    90127                if(!Object.isArray(el))  
    91128                { 
    92                         t = el.up('.torrent').down('.name'); 
    93                         torrent_names = '"' + (Prototype.Browser.IE ? t.innerText : t.textContent).replace(/^\s+|\s+$/g, '') + '"'; 
    94                 } else { 
    95                         el.each( 
    96                                 function(el) { 
    97                                         t = el.up('.torrent').down('.name'); 
    98                                         torrent_names = torrent_names + "\n\"" + (Prototype.Browser.IE ? t.innerText : t.textContent).replace(/^\s+|\s+$/g, '') + '"'; 
    99                                 } 
    100                         ); 
    101                 } 
    102                 return confirm(message.replace(/%S/g, torrent_names)); 
     129                        el = [el]; 
     130                } 
     131                // Cannot confirm changed for empty list 
     132                if (!el.length) { 
     133                        return false; 
     134                } 
     135                // reduce the elements array to a string 
     136                var torrents = '\n"' + el.map( 
     137                        function(el ) { 
     138                                el = el.up('.torrent').down('.name'); 
     139                                return (Prototype.Browser.IE ? el.innerText : el.textContent).replace(/^\s+|\s+$/g, ''); 
     140                        } 
     141                ).join('",\n"') + '"'; 
     142                // remove the initial linebreak, but only if we process just one torrent 
     143                if (el.length == 1) 
     144                { 
     145                        torrents = torrents.slice(1); 
     146                } 
     147                return confirm(message.replace(/%S/g, torrents)); 
    103148        }, 
    104149        /* Buttons handler */ 
     
    140185                /* Do the call */ 
    141186                this.ajax.load('messages', url, showLoad, showResponse); 
    142                 this.ajax.reloadMain(); 
     187                this.reloadMain(); 
    143188        }, 
    144189        /* View tabs handler */ 
     
    173218                var url = 'cls=' + cls + '&tpl=details&hash=' + id; 
    174219                var showLoad = this.ajax.showLoadTorrent.bind(this.ajax, id); 
    175                 var afterFinish = this.events.bindTorrentTab.bind(this.events, this.torrentPriorityHandler.bindAsEventListener(this), this.torrentFilesHandler.bindAsEventListener(this), this.torrentTrackersHandler.bindAsEventListener(this)); 
     220                var afterFinish = this.events.rebindAllHandlers.bind(this.events); 
    176221                var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 
    177222                this.ajax.load('tab' + id, url, showLoad, showResponse); 
     
    228273                var showResponse = this.ajax.showResponseMessages.bind(this.ajax); 
    229274                this.ajax.load('messages', url, showLoad, showResponse); 
    230                 this.ajax.reloadMain(); 
     275                this.reloadMain(); 
    231276        }, 
    232277        /* Torrent Priority Handler */ 
     
    243288                var url = 'cls=General&tpl=details&hash=' + id; 
    244289                var showLoad = this.ajax.showLoadTorrent.bind(this.ajax, id); 
    245                 var afterFinish = this.events.bindTorrentTab.bind(this.events, this.torrentPriorityHandler.bindAsEventListener(this), this.torrentFilesHandler.bindAsEventListener(this), this.torrentTrackersHandler.bindAsEventListener(this)); 
     290                var afterFinish = this.events.rebindAllHandlers(this.events); 
    246291                var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 
    247292                this.ajax.load('tab' + id, url, showLoad, showResponse); 
     
    253298                if(el.hasClassName('filesPriority')) 
    254299                { 
    255                         var params = getChecked('.files' + id); 
    256                         var ids = new Array(); 
    257                         params.each( 
    258                                 function(e) { 
    259                                         ids.push(e.identify().split('_')[1]); 
    260                                 } 
    261                         ); 
     300                        var ids = getChecked('.files' + id).map(function(e) { return e.identify().split('_')[1]; }); 
     301 
     302                        var param1 = $('sf' + id).options[$('sf' + id).selectedIndex].value; 
    262303                        var param2 = ids.join('~');      
    263                         var param1 = $('sf' + id).options[$('sf' + id).selectedIndex].value; 
    264304 
    265305                        var url = 'cls=commands&tpl=commands&command=files&param=' + id + '&param1=' + param1 + '&param2=' + param2; 
     
    270310                        var url = 'cls=Files&tpl=details&hash=' + id; 
    271311                        var showLoad = this.ajax.showLoadTorrent.bind(this.ajax, id); 
    272                         var afterFinish = this.events.bindTorrentTab.bind(this.events, this.torrentPriorityHandler.bindAsEventListener(this), this.torrentFilesHandler.bindAsEventListener(this), this.torrentTrackersHandler.bindAsEventListener(this)); 
    273                         var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 
     312                        var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id); 
    274313                        this.ajax.load('tab' + id, url, showLoad, showResponse); 
    275314                } 
     
    310349                        var url = 'cls=Tracker&tpl=details&hash=' + id; 
    311350                        var showLoad = this.ajax.showLoadTorrent.bind(this.ajax, id); 
    312                         var afterFinish = this.events.bindTorrentTab.bind(this.events, this.torrentPriorityHandler.bindAsEventListener(this), this.torrentFilesHandler.bindAsEventListener(this), this.torrentTrackersHandler.bindAsEventListener(this)); 
    313                         var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 
     351                        var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id); 
    314352                        this.ajax.load('tab' + id, url, showLoad, showResponse); 
    315353                } 
     
    332370                if(el.hasClassName('asc')) 
    333371                { 
    334                         this.ajax.reloadMain(el.up().identify(), 'asc'); 
     372                        this.reloadMain(el.up().identify(), 'asc'); 
     373                        return; 
    335374                } 
    336375                if(el.hasClassName('des')) 
    337376                { 
    338                         this.ajax.reloadMain(el.up().identify(), 'desc'); 
    339                 } 
     377                        this.reloadMain(el.up().identify(), 'desc'); 
     378                        return; 
     379                } 
     380        }, 
     381        reloadMain: function(sortType, sortOrder) 
     382        { 
     383                if (sortType && sortOrder) 
     384                { 
     385                        this._sortType = sortType; 
     386                        this._sortOrder = sortOrder; 
     387                } 
     388                this.ajax.reloadMain(this._sortType, this._sortOrder); 
    340389        } 
    341390}); 
     391 
     392var EventHandler = Class.create({ 
     393        _bindings: {}, 
     394        /* Initial binding */ 
     395        initialize: function() { 
     396        }, 
     397        bindHandler: function(cls, type, handler) { 
     398                if (!(cls in this._bindings)) { 
     399                        this._bindings[cls] = {}; 
     400                } 
     401                if (!(type in this._bindings[cls])) { 
     402                        this._bindings[cls][type] = []; 
     403                } 
     404                this._bindings[cls][type].push(handler); 
     405                this.rebindHandlers(cls); 
     406        }, 
     407        rebindHandlers: function(cls) { 
     408                var elts = $$(cls); 
     409                if (!elts.length) { 
     410                        return; 
     411                } 
     412                if (!(cls in this._bindings)) { 
     413                        return; 
     414                } 
     415                var bindings = this._bindings[cls]; 
     416                for (var type in bindings) { 
     417                        bindings[type].each( 
     418                                function(h) { 
     419                                        elts.each( 
     420                                                function(e) { 
     421                                                        e.stopObserving(type, h); 
     422                                                        e.observe(type, h); 
     423                                                } 
     424                                        ); 
     425                                } 
     426                        ); 
     427                } 
     428                                         
     429        }, 
     430        rebindAllHandlers: function() { 
     431                for (var cls in this._bindings) { 
     432                        this.rebindHandlers(cls); 
     433                } 
     434        } 
     435}); 
     436 
     437var DisplayActions = Class.create({ 
     438        /* Use scriptaculous or not */ 
     439        initialize: function(effects) { 
     440                if(effects == null) 
     441                { 
     442                        this.effects = true; 
     443                } else { 
     444                        this.effects = effects; 
     445                } 
     446        }, 
     447        /* Toggle torrent frame */ 
     448        toggleTorrent: function(id) { 
     449                if(this.effects) 
     450                { 
     451                        new Effect.toggle('ttab' + id, 'blind', {duration:0.5}); 
     452                } else { 
     453                        $('ttab' + id).toggle(); 
     454                } 
     455        }, 
     456        /* Open torrent info */ 
     457        openTorrent: function(id) { 
     458                if(this.effects) 
     459                { 
     460                        new Effect.BlindDown('ttab' + id, {duration:0.5}); 
     461                } else { 
     462                        $('ttab' + id).show(); 
     463                } 
     464        }, 
     465        /* Close torrent info */ 
     466        closeTorrent: function(id) { 
     467                if(this.effects) 
     468                { 
     469                        new Effect.BlindUp('ttab' + id, {duration:0.5}); 
     470                } else { 
     471                        $('ttab' + id).hide(); 
     472                } 
     473        } 
     474}); 
  • trunk/wtorrent/wt/tpl/admin.tpl.php

    r74 r94  
    2828        </form> 
    2929        <br /> 
    30         <form method="post" action=""> 
     30        <form method="post" action="{$web->getURL()}"> 
    3131                {include file="common/title.tpl.php" text=$str.add_user} 
    3232                <div style="text-align: left; float: none; display: block; padding-left: 40px; margin-bottom: 10px;"> 
  • trunk/wtorrent/wt/tpl/index.tpl.php

    r93 r94  
    1010        <script src="{$DIR_JS}scriptaculous/scriptaculous.js?load=effects" type="text/javascript" charset="utf-8"></script> 
    1111        <script src="{$DIR_JS}prototip.js" type="text/javascript" charset="utf-8"></script> 
    12         {*<script src="{$DIR_JS}javasc.js" type="text/javascript" charset="utf-8"></script>*} 
    1312        <script src="{$DIR_JS}control.js" type="text/javascript" charset="utf-8"></script> 
    1413        <script src="{$DIR_JS}ajax.js" type="text/javascript" charset="utf-8"></script> 
    15         <script src="{$DIR_JS}display.js" type="text/javascript" charset="utf-8"></script> 
    16         <script src="{$DIR_JS}events.js" type="text/javascript" charset="utf-8"></script> 
    1714        <script src="{$DIR_JS}func.js" type="text/javascript" charset="utf-8"></script> 
    1815  {include file="loading.tpl.php" assign="loading"} 
  • trunk/wtorrent/wt/tpl/login.tpl.php

    r74 r94  
    44<div id="login_m"> 
    55  <div id="login"> 
    6     <form id="form-login" action="" method="post"> 
     6    <form id="form-login" action="{$web->getURL()}" method="post"> 
    77      <p id="login-username"> 
    88        <label for="userf">{$str.user}:</label>