Changeset 94
- Timestamp:
- 16/10/08 19:03:47 (3 months ago)
- Files:
-
- trunk/wtorrent/lib/cls/Web.cls.php (modified) (3 diffs)
- trunk/wtorrent/lib/inc/string.inc.php (modified) (3 diffs)
- trunk/wtorrent/lib/inc/utils.inc.php (modified) (1 diff)
- trunk/wtorrent/wt/cls/AddT.cls.php (modified) (2 diffs)
- trunk/wtorrent/wt/cls/Admin.cls.php (modified) (7 diffs)
- trunk/wtorrent/wt/js/ajax.js (modified) (2 diffs)
- trunk/wtorrent/wt/js/control.js (modified) (11 diffs)
- trunk/wtorrent/wt/js/display.js (deleted)
- trunk/wtorrent/wt/js/events.js (deleted)
- trunk/wtorrent/wt/tpl/admin.tpl.php (modified) (1 diff)
- trunk/wtorrent/wt/tpl/index.tpl.php (modified) (1 diff)
- trunk/wtorrent/wt/tpl/login.tpl.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wtorrent/lib/cls/Web.cls.php
r93 r94 17 17 18 18 Original class done by David Marco Martinez 19 Modified by Roger Pau Monné 20 */ 19 Modified by Roger Pau Monn�/ 21 20 abstract class Web 22 21 { … … 166 165 public function getURL() 167 166 { 168 return $ _SERVER['REQUEST_URI'];167 return $this->_server['REQUEST_URI']; 169 168 } 170 169 /** … … 322 321 $this->message[] = $message; 323 322 } 324 325 323 abstract protected function construct( ); 326 324 } trunk/wtorrent/lib/inc/string.inc.php
r93 r94 52 52 if (!get_magic_quotes_gpc()) 53 53 { 54 return ;54 return $var; 55 55 } 56 56 return _unescape_internal($var); … … 58 58 function html( $str ) 59 59 { 60 $str = str_replace( array( ' �'�), array( 'ñ', 'Ñ' ), $str );60 $str = str_replace( array( 'Ò', '—' ), array( 'ñ', 'Ñ' ), $str ); 61 61 return preg_replace( '/[^\x00-\x7F]/e', '"&#".ord("$0").";"', $str ); 62 62 … … 99 99 '}' => '}', 100 100 '~' => '~', 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 'õ' => '›' ); 233 233 } 234 234 ?> trunk/wtorrent/lib/inc/utils.inc.php
r4 r94 27 27 function autoload( ) 28 28 { 29 //$str = 'if( file_exists( \'../lib/cls/\'.$file ) ) require_once( \'../lib/cls/\'.$file );';30 $str = 'if( false );';31 29 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 } 34 33 $cmd = 35 34 'function __autoload( $cls ) trunk/wtorrent/wt/cls/AddT.cls.php
r93 r94 18 18 class AddT extends rtorrent 19 19 { 20 21 20 public function construct() 22 21 { … … 145 144 $purl = parse_url( $url ); 146 145 return implode( 147 '; ',146 ';', 148 147 $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 ?', 150 149 $this->getIdUser(), 151 150 "%{$purl['host']}%" trunk/wtorrent/wt/cls/Admin.cls.php
r93 r94 22 22 if(isset($this->_request['adduser'])) $this->addUser($this->_request['user'], $this->_request['passwd'], $this->_request['admin'], $this->_request['default_dir'], $this->_request['force_dir']); 23 23 if(isset($this->_request['delete'])) $this->deleteUsers($this->_request['users']); 24 24 25 25 if(!$this->setClient()) 26 26 return false; 27 27 28 28 if(isset($this->_request['ch_dw'])) $this->setDownLimit($this->_request['down_rate']); 29 29 if(isset($this->_request['ch_up'])) $this->setUploadLimit($this->_request['up_rate']); … … 43 43 44 44 public function showUsers() 45 {45 { 46 46 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 { 50 50 if (!count($users) > 0) 51 51 { … … 56 56 $this->_db->modifyMany('DELETE FROM tor_passwd WHERE id = ?', $list); 57 57 $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 { 61 61 if (empty($user) || empty($passwd)) 62 {62 { 63 63 $this->addMessage($this->_str['err_users_add']); 64 64 return; … … 67 67 $admin = $admin == 'on' ? 1 : 0; 68 68 $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(?, ?, ?, ?, ?)', 71 70 $user, 72 71 md5($passwd), … … 74 73 $dir, 75 74 $force_dir 76 );75 ); 77 76 $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'))); 86 85 $result = $this->client->send($message); 87 86 //print_r($result); … … 90 89 else 91 90 $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'))); 96 95 $result = $this->client->send($message); 97 96 if($result->errno == 0) … … 99 98 else 100 99 $this->addMessage($this->_str['err_up_limit']); 101 }100 } 102 101 } trunk/wtorrent/wt/js/ajax.js
r91 r94 77 77 } 78 78 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(); 83 80 postAjax(); 84 81 }, … … 90 87 $(id).removeClassName('loading'); 91 88 this.display.openTorrent(id); 92 afterFinish(); 89 this.events.rebindAllHandlers(); 90 if (afterFinish) { 91 afterFinish(); 92 } 93 93 }, 94 94 /* Reload main frame */ trunk/wtorrent/wt/js/control.js
r91 r94 5 5 this.display = new DisplayActions(effects); 6 6 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 ); 8 18 /* Add all events listeners */ 9 19 /* 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 } 23 60 }, 24 61 /* Event handlers */ … … 36 73 /* The tab is empty, prepare content to load */ 37 74 var showLoad = this.ajax.showLoadTorrent.bind(this.ajax, id); 38 var afterFinish = this.events.re loadPriorityTorrent.bind(this.events, this.torrentPriorityHandler.bindAsEventListener(this));75 var afterFinish = this.events.rebindAllHandlers(this.events); 39 76 var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 40 77 var url = 'cls=General&tpl=details&hash=' + id; … … 86 123 }, 87 124 confirmTorrentAction: function(el, message) { 88 var torrent_names = '';89 var t;125 126 // make me an array 90 127 if(!Object.isArray(el)) 91 128 { 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)); 103 148 }, 104 149 /* Buttons handler */ … … 140 185 /* Do the call */ 141 186 this.ajax.load('messages', url, showLoad, showResponse); 142 this. ajax.reloadMain();187 this.reloadMain(); 143 188 }, 144 189 /* View tabs handler */ … … 173 218 var url = 'cls=' + cls + '&tpl=details&hash=' + id; 174 219 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); 176 221 var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 177 222 this.ajax.load('tab' + id, url, showLoad, showResponse); … … 228 273 var showResponse = this.ajax.showResponseMessages.bind(this.ajax); 229 274 this.ajax.load('messages', url, showLoad, showResponse); 230 this. ajax.reloadMain();275 this.reloadMain(); 231 276 }, 232 277 /* Torrent Priority Handler */ … … 243 288 var url = 'cls=General&tpl=details&hash=' + id; 244 289 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); 246 291 var showResponse = this.ajax.showResponseTorrent.bind(this.ajax, id, afterFinish); 247 292 this.ajax.load('tab' + id, url, showLoad, showResponse); … … 253 298 if(el.hasClassName('filesPriority')) 254 299 { 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; 262 303 var param2 = ids.join('~'); 263 var param1 = $('sf' + id).options[$('sf' + id).selectedIndex].value;264 304 265 305 var url = 'cls=commands&tpl=commands&command=files¶m=' + id + '¶m1=' + param1 + '¶m2=' + param2; … … 270 310 var url = 'cls=Files&tpl=details&hash=' + id; 271 311 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); 274 313 this.ajax.load('tab' + id, url, showLoad, showResponse); 275 314 } … … 310 349 var url = 'cls=Tracker&tpl=details&hash=' + id; 311 350 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); 314 352 this.ajax.load('tab' + id, url, showLoad, showResponse); 315 353 } … … 332 370 if(el.hasClassName('asc')) 333 371 { 334 this.ajax.reloadMain(el.up().identify(), 'asc'); 372 this.reloadMain(el.up().identify(), 'asc'); 373 return; 335 374 } 336 375 if(el.hasClassName('des')) 337 376 { 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); 340 389 } 341 390 }); 391 392 var 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 437 var 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 28 28 </form> 29 29 <br /> 30 <form method="post" action=" ">30 <form method="post" action="{$web->getURL()}"> 31 31 {include file="common/title.tpl.php" text=$str.add_user} 32 32 <div style="text-align: left; float: none; display: block; padding-left: 40px; margin-bottom: 10px;"> trunk/wtorrent/wt/tpl/index.tpl.php
r93 r94 10 10 <script src="{$DIR_JS}scriptaculous/scriptaculous.js?load=effects" type="text/javascript" charset="utf-8"></script> 11 11 <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>*}13 12 <script src="{$DIR_JS}control.js" type="text/javascript" charset="utf-8"></script> 14 13 <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>17 14 <script src="{$DIR_JS}func.js" type="text/javascript" charset="utf-8"></script> 18 15 {include file="loading.tpl.php" assign="loading"} trunk/wtorrent/wt/tpl/login.tpl.php
r74 r94 4 4 <div id="login_m"> 5 5 <div id="login"> 6 <form id="form-login" action=" " method="post">6 <form id="form-login" action="{$web->getURL()}" method="post"> 7 7 <p id="login-username"> 8 8 <label for="userf">{$str.user}:</label>
