Changeset 5601
- Timestamp:
- 03/01/12 14:51:37 (12 years ago)
- Location:
- trunk/prototype
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/api/datalayer.js
r5592 r5601 745 745 DataLayer.move( concept, id, data[URI].id ); 746 746 747 DataLayer.put( concept, id, data[URI], false );747 DataLayer.put( concept, data[URI].id || id, data[URI], false ); 748 748 } 749 749 … … 833 833 if ( source === null ) return null; 834 834 835 // All non-objects use value semantics and don't need explict copying. 836 835 // All non-objects use value semantics and don't need explict copying. 836 if ( typeof source !== 'object' ) return source; 837 837 838 838 if( !depth || !(depth instanceof RecursionHelper) ) depth = new RecursionHelper(depth); … … 1085 1085 var newResult = []; 1086 1086 1087 for( var i = 0; i < result.length; i++ ) 1088 newResult[i] = $.extend( {}, result[i] ); 1087 $.each( result, function( i, res ){ 1088 newResult[ i ] = $.extend( {}, res ); 1089 }); 1089 1090 1090 1091 this.put( concept, id, newResult, false ); -
trunk/prototype/modules/filters/filter-list.ejs
r5539 r5601 7 7 <li class="rule <%= (data.rules[i].name=='vacation')?'vacation':'' %>" title="<%= data.rules[i].name %>"> 8 8 <strong class="title <%= (data.rules[i].enabled)? 'enable':'disable' %>"><%= data.rules[i].name %></strong> 9 <input type="hidden" class="id" value="<%= data.rules[i].id %>"> 9 10 <dl class="rule-briefing"> 10 11 <dt>Critérios:</dt> -
trunk/prototype/modules/filters/filters.js
r5598 r5601 185 185 186 186 }), 187 enabled : "enabled",187 enabled : true, 188 188 applyMessages: allMessages? !$.isEmptyObject( selectedMessages ) ? 189 189 keys( selectedMessages ) : allMessages : "" … … 676 676 $(".ui-dialog-titlebar").after("<div class='dialog-head-buttonpane ui-dialog-buttonpane ui-widget-content ui-helper-clearfix' style='background-color: rgb(224, 238, 238); '><div class='ui-dialog-buttonset header-buttonpane'></div></div>"); 677 677 $(".dialog-head-buttonpane").css("padding", "5px"). 678 find(".header-buttonpane").html("<a href='#' class='button add' title='Adicionar nova regra'>Nova regra</a>< a href='#' class='button add vacation' title='Adicionar regra 'Fora do escritorio''>Fora do escritorio</a>").find(".button").button();678 find(".header-buttonpane").html("<a href='#' class='button add' title='Adicionar nova regra'>Nova regra</a><!--<a href='#' class='button add vacation' title='Adicionar regra 'Fora do escritorio''>Fora do escritorio</a>-->").find(".button").button(); 679 679 680 680 $(".ui-dialog-buttonpane.ui-widget-content").css("background-color", "#E0EEEE"); … … 752 752 }).click(function(){ 753 753 var id = $(this).parents("li.rule").find('.title').html(); 754 DataLayer.put( 'filter', id, { enabled: "disable"});754 DataLayer.put( 'filter', id, { enabled: false }); 755 755 DataLayer.commit("filter"); 756 756 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); … … 764 764 }).click(function(){ 765 765 var id = $(this).parents("li.rule").find('.title').html(); 766 DataLayer.put( 'filter', id, { enabled: "enabled"});766 DataLayer.put( 'filter', id, { enabled: true }); 767 767 DataLayer.commit("filter"); 768 768 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); -
trunk/prototype/modules/filters/interceptors/FilterMapping.php
r5539 r5601 81 81 foreach( $rules as $name => $data ) 82 82 { 83 //if($data['enabled'] )84 //continue;83 if( !$data['enabled'] ) 84 continue; 85 85 86 86 $criteria = $data['criteria']; … … 121 121 $require_vacation = true; 122 122 $vacation = true; 123 $script_match = "vacation";124 break;123 //$script_match = "vacation"; 124 continue; 125 125 default: 126 126 $script_criteria .= "header :"; … … 191 191 $require_vacation = true; 192 192 $action[$k]['parameter'] = "\"" . $action[$k]['parameter'] . "\""; 193 $ script_action = " :subject \"Fora do Escritório\" " . $action[$k]['parameter'] . ";";193 $vacation_action = " :subject \"Fora do Escritório\" " . $action[$k]['parameter'] . ";"; 194 194 $vacation = true; 195 break;195 continue; 196 196 case 'setflag': 197 197 $require_flag = true; … … 201 201 break; 202 202 } 203 if ($vacation == false)$script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n ";203 /*if ($vacation == false)*/ $script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n "; 204 204 } 205 205 206 if ($vacation == false)$script_action .= "}";206 /*if ($vacation == false)*/ $script_action .= "}"; 207 207 208 208 $script_rules .= $script_match . $script_criteria . $script_action . "\r\n"; … … 224 224 } 225 225 226 if( $vacation ) 227 { 228 $script_rules .= "vacation" . $vacation_action . "\r\n"; 229 } 230 226 231 $json_data = json_encode($rules); 227 232 … … 313 318 public function applySieveFilter( &$uri , &$result , &$criteria , $original ) 314 319 { 320 $result['id'] = $uri['id']; 321 315 322 if( $original['properties']['applyMessages'] ) 316 323 { 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 $imap = Controller::service( 'Imap' );332 333 324 $filter = Controller::read($uri); 325 326 $proc = array(); 327 $proc['keep'] = false; 328 329 foreach ($filter['actions'] as $v){ 330 if($v['type'] == 'keep') 331 $proc['keep'] = true; 332 else{ 333 $proc['type'] = $v['type']; 334 $proc['parameter'] = $v['parameter']; 335 } 336 } 337 338 $imap = Controller::service( 'Imap' ); 339 $imap->apliSieveFilter($original['properties']['applyMessages'] , $proc ); 340 return $result; 334 341 } 335 342 } … … 373 380 */ 374 381 public function setRule( &$uri , &$params , &$criteria , $original ) 375 { 376 if( !$this->rules )382 { 383 if( !$this->rules ) 377 384 $this->rules = $this->getRules(); 378 379 $params['id'] = isset($params['id']) ? $params['id'] : $params['name']; 380 $update = false; 381 382 foreach( $this->rules as $i => $rule ) 383 if( $update = ($rule['id'] === $params['id']) ) 384 { 385 $this->rules[$i] = $params; 386 break; 387 } 388 389 if( !$update ) 390 $this->rules[] = $params; 391 392 $content = $this->formatSieveScript( $this->rules ); 393 394 $params = array( 'name' => $this->service->config['user'], 395 'content' => $content, 396 'active' => true ); 385 386 $uri['id'] = $params['id'] = isset($params['id']) ? $params['id'] : urlencode($params['name']); 387 388 $i = 0; 389 390 for( ;$this->rules[$i] && $this->rules[$i]['id'] !== $params['id']; $i++ ); 391 392 $this->rules[$i] = $params; 393 394 $params = array( 'name' => $this->service->config['user'], 395 'content' => $this->formatSieveScript( $this->rules ), 396 'active' => true ); 397 397 } 398 398 … … 414 414 public function deleteRule( &$uri, &$params, &$criteria, $original ) 415 415 { 416 if( !$this->rules ) 417 418 416 if( !$this->rules ) { 417 $this->rules = $this->getRules(); 418 } 419 419 $params['id'] = $uri['id']; 420 420 421 421 $update = false; 422 423 $rules = array(); 422 424 423 425 foreach( $this->rules as $i => $rule ) 424 if( $rule['id'] === $uri['id'] ) 425 unset( $this->rules[$i] ); 426 426 if( $rule['id'] !== $uri['id'] ) 427 $rules[] = $this->rules[$i]; 428 429 $this->rules = $rules; 430 427 431 $uri['id'] = ''; 428 432 … … 433 437 $URI = Controller::URI( $uri['concept'], $this->service->config['user'] ); 434 438 $this->service->update( $URI, $params ); 435 439 436 440 return( false ); 437 441 }
Note: See TracChangeset
for help on using the changeset viewer.