Changeset 6180

Show
Ignore:
Timestamp:
07/25/08 10:05:16 (4 months ago)
Author:
p_lindheimer
Message:

closes #2945 and #2699 proper VM_PREFIX and dynamic screen space allocation, ref #2686 modified

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/bin/retrieve_op_conf_from_mysql.pl

    r6146 r6180  
    2727} 
    2828 
     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 
    2948######## STYLE INFO ######### 
    3049$extenpos="2-40"; 
     
    4059 
    4160# 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 
    4269 
    4370# Remove or add Zap trunks as needed 
     
    326353                my $vmext = @{ $row }[1]; 
    327354                my $vmcontext = "default"; 
     355                # the device tech table should also have a dial context - if not assume from-internal 
     356                my $context = "from-internal"; 
    328357                # database table name for iax2 is just iax but sip and zap are ok 
    329358                if ($tech eq "iax2") {$tech = "iax";} 
     
    337366                        my @values = split('@', $mailbox); 
    338367                        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];}                     
    340375                } else { print "Table does not exist: $tech\n"; } 
    341376                # - Support for real mailbox settings 
    342377                 
     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 
    343389                 
    344390                 
     
    346392                $btn=get_next_btn($extenpos,$btn); 
    347393                $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"; 
    349395        } 
    350396         
     
    360406                $zapdesc=@{$row}[1]; 
    361407                $icon='3'; 
     408                # zaplines and trunklist share the trunk positions so need to store previous btn on overflow from zaplines 
     409                my $previousbtn = $btn; 
    362410                $btn=get_next_btn($trunkpos,$btn); 
     411                if ($btn eq 0) {$btn = $previousbtn; last;} 
    363412                if ($zapdef eq "Zap/*") { 
    364413                        $numbuttons=@{$row}[2]-1; 
     
    382431                next if ($account eq ""); 
    383432                $btn=get_next_btn($trunkpos,$btn); 
     433                if ($btn eq 0) {last;} 
    384434                $statement = "SELECT keyword,data from $table where id=$id and keyword <> 'account' and flags <> 1 order by keyword"; 
    385435                my $result = $dbh->selectall_arrayref($statement); 
     
    419469        ### Write Parkings lots 
    420470        $btn=0; 
    421         my $parken
     471        my $parken=""
    422472        my $extpark ; 
    423473        my $parkcontext ; 
     
    425475        my $maxparkingslots ; 
    426476         
    427         $maxparkingslots = 0 ; 
    428         do 
    429         { 
    430                 $btn=get_next_btn($parkingpos,$btn); 
    431                 $maxparkingslots = $maxparkingslots - 1 ; 
    432         } 
    433         while ($btn != 0); 
    434         $maxparkingslots = $maxparkingslots + 1 ; 
    435  
    436477        foreach my $row ( @parkings ) { 
    437478                if (@{$row}[0] eq "parkingenabled") { 
     
    449490        } 
    450491        if ($parken eq "s") { 
    451                 for (my $i = 1 ; $i <= $numberlots && $i <= 5 ; $i++ ) { 
     492                for (my $i = 1 ; $i <= $numberlots ; $i++ ) { 
    452493                        $btn=get_next_btn($parkingpos,$btn); 
     494                        if ($btn eq 0) {last;} 
    453495                        $parknum = $extpark + $i ; 
    454496                        $icon='1'; 
     
    468510        foreach my $row ( @confrange ) { 
    469511                $btn=get_next_btn($confepos,$btn); 
     512                if ($btn eq 0) {last;} 
    470513                $confenum=@{$row}[0]; 
    471514                $confedesc=@{$row}[1]; 
     
    484527        foreach my $row ( @queuerange ) { 
    485528                $btn=get_next_btn($queuepos,$btn); 
     529                if ($btn eq 0) {last;} 
    486530                $queuename=@{$row}[0]; 
    487531                $queuedesc=@{$row}[1]; 
     
    489533                print EXTEN "[QUEUE/$queuename]\nPosition=$btn\nLabel=\"$queuedesc\"\nExtension=-1\nContext=from-internal\nIcon=$icon\nPanel_Context=$panelcontext\n"; 
    490534        } 
     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         
    491573} 
    492574 
     
    542624} 
    543625 
     626 
     627sub 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  
    44include => op_buttons_custom.cfg 
    55 
     6; Old values now auto-generated: 
     7 
    68; Queues 
    7 [rectangle] 
    8 x=492 
    9 y=32 
    10 width=491 
    11 height=111 
    12 line_width=0 
    13 line_color=ff1010 
    14 fade_color1=ff1010 
    15 fade_color2=a01000 
    16 rnd_border=2 
    17 alpha=20 
    18 layer=bottom 
     9;[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 
    1921 
    2022; Conferences 
    21 [rectangle] 
    22 x=492 
    23 y=144 
    24 width=491 
    25 height=111 
    26 line_width=0 
    27 line_color=006666 
    28 fade_color1=006666 
    29 fade_color2=a01000 
    30 rnd_border=2 
    31 alpha=20 
    32 layer=bottom 
     23;[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 
    3335 
    3436; Parking 
    35 [rectangle] 
    36 x=492 
    37 y=256 
    38 width=491 
    39 height=84 
    40 line_width=0 
    41 line_color=ffff10 
    42 fade_color1=ffff10 
    43 fade_color2=CC9933 
    44 rnd_border=2 
    45 alpha=20 
    46 layer=bottom 
     37;[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 
    4749 
    4850 
    4951; Trunks 
    50 [rectangle] 
    51 x=492 
    52 y=341 
    53 width=491 
    54 height=255 
    55 line_width=0 
    56 line_color=10ff10 
    57 fade_color1=10ff10 
    58 fade_color2=009900 
    59 rnd_border=2 
    60 alpha=20 
    61 layer=bottom 
     52;[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 
    6264 
    6365; Extensions 
    64 [rectangle] 
    65 x=-1 
    66 y=32 
    67 width=491 
    68 height=564 
    69 line_width=0 
    70 line_color=1010ff 
    71 fade_color1=1010ff 
    72 fade_color2=99CCCC 
    73 rnd_border=2 
    74 alpha=10 
    75 layer=bottom 
     66;[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 
    7678 
    77 [LEGEND] 
    78 x=500 
    79 y=342 
    80 text=Trunks 
    81 font_size=18 
    82 font_family=Times New Roman   
    83 use_embed_fonts=1 
     79;[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 
    8486 
    85 [LEGEND] 
    86 x=500 
    87 y=144 
    88 text=Conferences 
    89 font_size=18 
    90 font_family=Arial 
    91 use_embed_fonts=1 
     87;[LEGEND] 
     88;x=500 
     89;y=144 
     90;text=Conferences 
     91;font_size=18 
     92;font_family=Arial 
     93;use_embed_fonts=1 
    9294 
    93 [LEGEND] 
    94 x=500 
    95 y=256 
    96 text=Parking lots 
    97 font_size=18 
    98 font_family=Arial 
    99 use_embed_fonts=1 
     95;[LEGEND] 
     96;x=500 
     97;y=256 
     98;text=Parking lots 
     99;font_size=18 
     100;font_family=Arial 
     101;use_embed_fonts=1 
    100102 
    101 [LEGEND] 
    102 x=500 
    103 y=32 
    104 text=Queues 
    105 font_size=18 
    106 font_family=Arial 
    107 use_embed_fonts=1 
     103;[LEGEND] 
     104;x=500 
     105;y=32 
     106;text=Queues 
     107;font_size=18 
     108;font_family=Arial 
     109;use_embed_fonts=1 
    108110 
    109 [LEGEND] 
    110 x=10 
    111 y=32 
    112 text=Extensions 
    113 font_size=18 
    114 font_family=Arial 
    115 use_embed_fonts=1 
     111;[LEGEND] 
     112;x=10 
     113;y=32 
     114;text=Extensions 
     115;font_size=18 
     116;font_family=Arial 
     117;use_embed_fonts=1 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads