Changeset 6180
- Timestamp:
- 07/25/08 10:05:16 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl
r6146 r6180 27 27 } 28 28 29 ######## LAYOUT INFO ######### 30 31 # This layout info should really be in a "panel" table in the freepbx database 32 33 # structure is - Legend, startpos, stoppos, color1, color2 34 @rectangle1 = ("Trunks", 53, 80, "10ff10", "009900"); 35 @rectangle2 = ("Extensions", 1, 40, "1010ff", "099cccc"); 36 @rectangle3 = ("Parking lots", 49, 72, "ffff10", "cc9933"); 37 @rectangle4 = ("Conferences", 45, 68, "006666", "a01000"); 38 @rectangle5 = ("Queues", 41, 64, "ff1010", "a01000"); 39 @rectangles = (\@rectangle1,\@rectangle2,\@rectangle3,\@rectangle4,\@rectangle5); 40 41 ######## BUTTON INFO ######### 42 $buttonsizex = 246; # 1+244+1 from information in op_style.cfg 43 $buttonsizey = 28; # 1+26+1 from information in op_style.cfg 44 $numbuttonsx = 4; 45 $numbuttonsy = 20; 46 47 29 48 ######## STYLE INFO ######### 30 49 $extenpos="2-40"; … … 40 59 41 60 # End of changes 61 62 #automated generation of style-info 63 $extenpos=styleinfo("Extensions"); 64 $trunkpos=styleinfo("Trunks"); 65 $parkingpos=styleinfo("Parking lots"); 66 $confepos=styleinfo("Conferences"); 67 $queuepos=styleinfo("Queues"); 68 42 69 43 70 # Remove or add Zap trunks as needed … … 326 353 my $vmext = @{ $row }[1]; 327 354 my $vmcontext = "default"; 355 # the device tech table should also have a dial context - if not assume from-internal 356 my $context = "from-internal"; 328 357 # database table name for iax2 is just iax but sip and zap are ok 329 358 if ($tech eq "iax2") {$tech = "iax";} … … 337 366 my @values = split('@', $mailbox); 338 367 if (exists($values[0])) {$vmext = $values[0];} 339 if (exists($values[0])) {$vmcontext = $values[1];} 368 if (exists($values[1])) {$vmcontext = $values[1];} 369 #while in this table lets get the dial context as well 370 $statement = "SELECT data from $tech WHERE id = '$id' AND keyword = 'context' "; 371 $result = $dbh->selectall_arrayref($statement); 372 @resultSet = @{$result}; 373 if ( $#resultSet == -1 ) {print "Notice: no context defined\n";} 374 if (exists($resultSet[0][0])) {$context = $resultSet[0][0];} 340 375 } else { print "Table does not exist: $tech\n"; } 341 376 # - Support for real mailbox settings 342 377 378 379 # Support for real VM_PREFIX - 380 my $vmprefix = "*"; 381 if (table_exists($dbh,"globals")) { 382 $statement = "SELECT value from globals WHERE variable = 'VM_PREFIX' "; 383 $result = $dbh->selectall_arrayref($statement); 384 @resultSet = @{$result}; 385 if ( $#resultSet == -1 ) {print "Notice: no VM_PREFIX defined\n";} 386 if (exists($resultSet[0][0])) {$vmprefix = $resultSet[0][0];} 387 } else { print "Table does not exist: global\n"; } 388 # - Support for real VM_PREFIX 343 389 344 390 … … 346 392 $btn=get_next_btn($extenpos,$btn); 347 393 $icon='4'; 348 print EXTEN "[$dial]\nPosition=$btn\nLabel=\"$id : $description\"\nExtension=$id\nContext= from-internal\nIcon=$icon\nVoicemail_Context=$vmcontext\nVoiceMailExt=*$vmext\@from-internal\nPanel_Context=$panelcontext\n";394 print EXTEN "[$dial]\nPosition=$btn\nLabel=\"$id : $description\"\nExtension=$id\nContext=$context\nIcon=$icon\nVoicemail_Context=$vmcontext\nVoiceMailExt=$vmprefix$vmext\@$context\nPanel_Context=$panelcontext\n"; 349 395 } 350 396 … … 360 406 $zapdesc=@{$row}[1]; 361 407 $icon='3'; 408 # zaplines and trunklist share the trunk positions so need to store previous btn on overflow from zaplines 409 my $previousbtn = $btn; 362 410 $btn=get_next_btn($trunkpos,$btn); 411 if ($btn eq 0) {$btn = $previousbtn; last;} 363 412 if ($zapdef eq "Zap/*") { 364 413 $numbuttons=@{$row}[2]-1; … … 382 431 next if ($account eq ""); 383 432 $btn=get_next_btn($trunkpos,$btn); 433 if ($btn eq 0) {last;} 384 434 $statement = "SELECT keyword,data from $table where id=$id and keyword <> 'account' and flags <> 1 order by keyword"; 385 435 my $result = $dbh->selectall_arrayref($statement); … … 419 469 ### Write Parkings lots 420 470 $btn=0; 421 my $parken ;471 my $parken="" ; 422 472 my $extpark ; 423 473 my $parkcontext ; … … 425 475 my $maxparkingslots ; 426 476 427 $maxparkingslots = 0 ;428 do429 {430 $btn=get_next_btn($parkingpos,$btn);431 $maxparkingslots = $maxparkingslots - 1 ;432 }433 while ($btn != 0);434 $maxparkingslots = $maxparkingslots + 1 ;435 436 477 foreach my $row ( @parkings ) { 437 478 if (@{$row}[0] eq "parkingenabled") { … … 449 490 } 450 491 if ($parken eq "s") { 451 for (my $i = 1 ; $i <= $numberlots && $i <= 5; $i++ ) {492 for (my $i = 1 ; $i <= $numberlots ; $i++ ) { 452 493 $btn=get_next_btn($parkingpos,$btn); 494 if ($btn eq 0) {last;} 453 495 $parknum = $extpark + $i ; 454 496 $icon='1'; … … 468 510 foreach my $row ( @confrange ) { 469 511 $btn=get_next_btn($confepos,$btn); 512 if ($btn eq 0) {last;} 470 513 $confenum=@{$row}[0]; 471 514 $confedesc=@{$row}[1]; … … 484 527 foreach my $row ( @queuerange ) { 485 528 $btn=get_next_btn($queuepos,$btn); 529 if ($btn eq 0) {last;} 486 530 $queuename=@{$row}[0]; 487 531 $queuedesc=@{$row}[1]; … … 489 533 print EXTEN "[QUEUE/$queuename]\nPosition=$btn\nLabel=\"$queuedesc\"\nExtension=-1\nContext=from-internal\nIcon=$icon\nPanel_Context=$panelcontext\n"; 490 534 } 535 536 ### Write rectangles 537 538 foreach my $rect ( @rectangles ) { 539 my $comment = @{$rect}[0]; 540 my $color1 = @{$rect}[3]; 541 my $color2 = @{$rect}[4]; 542 my $start = @{$rect}[1]; 543 my $stop = @{$rect}[2]; 544 545 my $xposition = $buttonsizex * int(($start-1)/$numbuttonsy); 546 my $yposition = $buttonsizey * (($start-1)%$numbuttonsy); 547 my $xsize = $buttonsizex * (1 + int(($stop-1)/$numbuttonsy) - int(($start-1)/$numbuttonsy)); 548 my $ysize = $buttonsizey * (1 + (($stop-1)%$numbuttonsy) - (($start-1)%$numbuttonsy)); 549 550 $xsize -= 2; 551 $ysize -= 2; 552 553 $yposition += 32; 554 555 print EXTEN "\n; $comment\n[rectangle]\nx=$xposition\ny=$yposition\nwidth=$xsize\nheight=$ysize\nline_width=0\nline_color=$color1\nfade_color1=$color1\nfade_color2=$color2\nrnd_border=2\nalpha=20\nlayer=bottom\n"; 556 } 557 558 ### Write legends 559 560 foreach my $legend ( @rectangles ) { 561 my $text = @{$legend}[0]; 562 my $start = @{$legend}[1]; 563 564 my $xposition = $buttonsizex * int(($start-1)/$numbuttonsy); 565 my $yposition = $buttonsizey * (($start-1)%$numbuttonsy); 566 567 $xposition += 3; 568 $yposition += 32; 569 570 print EXTEN "\n[LEGEND]\nx=$xposition\ny=$yposition\ntext=$text\nfont_size=18\nfont_family=Arial\nuse_embed_fonts=1\n"; 571 } 572 491 573 } 492 574 … … 542 624 } 543 625 626 627 sub styleinfo { 628 my $legend = shift; 629 foreach my $rect ( @rectangles ) { 630 if ($legend eq @{$rect}[0]) { 631 632 my $start = @{$rect}[1]; 633 my $stop = @{$rect}[2]; 634 635 my $xposition = int(($start-1)/$numbuttonsy); 636 my $yposition = (($start-1)%$numbuttonsy); 637 my $xsize = int(($stop-1)/$numbuttonsy) - int(($start-1)/$numbuttonsy); 638 my $ysize = (($stop-1)%$numbuttonsy) - (($start-1)%$numbuttonsy); 639 640 $styleinfo = ""; 641 if ($ysize > 2) { 642 $styleinfo .= ($start + 1) . "-" . ($start + $ysize) . ","; 643 } 644 elsif ($ysize == 2) { 645 $styleinfo .= ($start + 1) . ","; 646 } 647 648 for (my $i = 1 ; $i <= $xsize ; $i++ ) { 649 if ($ysize > 1) { 650 $styleinfo .= (($i + $xposition) * $numbuttonsy + $yposition + 1) . "-" . (($i + $xposition) * $numbuttonsy + $yposition + $ysize + 1) . ","; 651 } 652 else { 653 $styleinfo .= (($i + $xposition) * $numbuttonsy + $yposition + 1) . ","; 654 } 655 } 656 last; 657 } 658 } 659 return $styleinfo; 660 } freepbx/trunk/amp_conf/htdocs_panel/op_buttons.cfg
r5723 r6180 4 4 include => op_buttons_custom.cfg 5 5 6 ; Old values now auto-generated: 7 6 8 ; Queues 7 [rectangle]8 x=4929 y=3210 width=49111 height=11112 line_width=013 line_color=ff101014 fade_color1=ff101015 fade_color2=a0100016 rnd_border=217 alpha=2018 layer=bottom9 ;[rectangle] 10 ;x=492 11 ;y=32 12 ;width=491 13 ;height=111 14 ;line_width=0 15 ;line_color=ff1010 16 ;fade_color1=ff1010 17 ;fade_color2=a01000 18 ;rnd_border=2 19 ;alpha=20 20 ;layer=bottom 19 21 20 22 ; Conferences 21 [rectangle]22 x=49223 y=14424 width=49125 height=11126 line_width=027 line_color=00666628 fade_color1=00666629 fade_color2=a0100030 rnd_border=231 alpha=2032 layer=bottom23 ;[rectangle] 24 ;x=492 25 ;y=144 26 ;width=491 27 ;height=111 28 ;line_width=0 29 ;line_color=006666 30 ;fade_color1=006666 31 ;fade_color2=a01000 32 ;rnd_border=2 33 ;alpha=20 34 ;layer=bottom 33 35 34 36 ; Parking 35 [rectangle]36 x=49237 y=25638 width=49139 height=8440 line_width=041 line_color=ffff1042 fade_color1=ffff1043 fade_color2=CC993344 rnd_border=245 alpha=2046 layer=bottom37 ;[rectangle] 38 ;x=492 39 ;y=256 40 ;width=491 41 ;height=84 42 ;line_width=0 43 ;line_color=ffff10 44 ;fade_color1=ffff10 45 ;fade_color2=CC9933 46 ;rnd_border=2 47 ;alpha=20 48 ;layer=bottom 47 49 48 50 49 51 ; Trunks 50 [rectangle]51 x=49252 y=34153 width=49154 height=25555 line_width=056 line_color=10ff1057 fade_color1=10ff1058 fade_color2=00990059 rnd_border=260 alpha=2061 layer=bottom52 ;[rectangle] 53 ;x=492 54 ;y=341 55 ;width=491 56 ;height=255 57 ;line_width=0 58 ;line_color=10ff10 59 ;fade_color1=10ff10 60 ;fade_color2=009900 61 ;rnd_border=2 62 ;alpha=20 63 ;layer=bottom 62 64 63 65 ; Extensions 64 [rectangle]65 x=-166 y=3267 width=49168 height=56469 line_width=070 line_color=1010ff71 fade_color1=1010ff72 fade_color2=99CCCC73 rnd_border=274 alpha=1075 layer=bottom66 ;[rectangle] 67 ;x=-1 68 ;y=32 69 ;width=491 70 ;height=564 71 ;line_width=0 72 ;line_color=1010ff 73 ;fade_color1=1010ff 74 ;fade_color2=99CCCC 75 ;rnd_border=2 76 ;alpha=10 77 ;layer=bottom 76 78 77 [LEGEND]78 x=50079 y=34280 text=Trunks81 font_size=1882 font_family=Times New Roman83 use_embed_fonts=179 ;[LEGEND] 80 ;x=500 81 ;y=342 82 ;text=Trunks 83 ;font_size=18 84 ;font_family=Times New Roman 85 ;use_embed_fonts=1 84 86 85 [LEGEND]86 x=50087 y=14488 text=Conferences89 font_size=1890 font_family=Arial91 use_embed_fonts=187 ;[LEGEND] 88 ;x=500 89 ;y=144 90 ;text=Conferences 91 ;font_size=18 92 ;font_family=Arial 93 ;use_embed_fonts=1 92 94 93 [LEGEND]94 x=50095 y=25696 text=Parking lots97 font_size=1898 font_family=Arial99 use_embed_fonts=195 ;[LEGEND] 96 ;x=500 97 ;y=256 98 ;text=Parking lots 99 ;font_size=18 100 ;font_family=Arial 101 ;use_embed_fonts=1 100 102 101 [LEGEND]102 x=500103 y=32104 text=Queues105 font_size=18106 font_family=Arial107 use_embed_fonts=1103 ;[LEGEND] 104 ;x=500 105 ;y=32 106 ;text=Queues 107 ;font_size=18 108 ;font_family=Arial 109 ;use_embed_fonts=1 108 110 109 [LEGEND]110 x=10111 y=32112 text=Extensions113 font_size=18114 font_family=Arial115 use_embed_fonts=1111 ;[LEGEND] 112 ;x=10 113 ;y=32 114 ;text=Extensions 115 ;font_size=18 116 ;font_family=Arial 117 ;use_embed_fonts=1
