Changeset 4147

Show
Ignore:
Timestamp:
06/21/07 22:56:10 (6 years ago)
Author:
fool4kate
Message:

Added recording playback capability

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.3/recordings/functions.inc.php

    r3774 r4147  
    150150   
    151151  foreach ($_REQUEST as $key => $val) { 
    152     $up = strpos($key, "up"); 
    153     $down = strpos($key, "down"); 
    154     $del = strpos($key, "del"); 
     152    if (strpos($key,"_") == 0) { 
     153            $up = strpos($key, "up"); 
     154 
     155      $down = strpos($key, "down"); 
     156      $del = strpos($key, "del"); 
     157    } 
    155158    if ( $up !== false ) { 
    156159      $up = substr($key, 2); 
  • modules/branches/2.3/recordings/page.recordings.php

    r3774 r4147  
    213213  echo "&amp;id=$id>Remove Recording</a> <i style='font-size: x-small'>(Note, does not delete file from computer)</i>"; 
    214214  ?> 
    215   <form name="prompt" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return rec_onsubmit();"> 
     215  <form name="prompt" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return rec_onsubmit();"> 
    216216  <input type="hidden" name="action" value="edited"> 
    217217  <input type="hidden" name="display" value="recordings"> 
     
    238238  $counter = 0; 
    239239  $arraymax = count($files)-1; 
     240  // globals seem to busted in PHP5 define here for now 
     241  $recordings_astsnd_path = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk'; 
     242  $recordings_astsnd_path .= "/sounds/"; 
     243 
    240244  foreach ($files as $item) { 
    241     recordings_display_sndfile($item, $counter, $arraymax); 
     245    recordings_display_sndfile($item, $counter, $arraymax, $recordings_astsnd_path); 
    242246    $counter++; 
    243247  }  
    244   recordings_display_sndfile('', $counter, $arraymax); 
     248  recordings_display_sndfile('', $counter, $arraymax, $recordings_astsnd_path); 
    245249  ?> 
    246250  </table> 
    247251  <input name="Submit" type="submit" value="<?php echo _("Save")?>"></h6> 
     252  <?php recordings_popup_jscript(); ?>   
    248253  <?php recordings_form_jscript(); ?>  
    249254  </form> 
     
    284289} 
    285290 
     291function recordings_popup_jscript() { 
     292?> 
     293        <script language="javascript"> 
     294  <!-- Begin 
     295  function popUp(URL,optionId) { 
     296    var selIndex=optionId.selectedIndex 
     297    var file=optionId.options[selIndex].value 
     298 
     299    /*alert(selIndex);*/ 
     300    if (file != "") 
     301      popup = window.open(URL+file, 'play', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=320,height=110'); 
     302  } 
     303  // End --> 
     304  </script> 
     305<?php 
     306} 
     307 
    286308function recordings_form_jscript() { 
    287309?> 
     
    333355} 
    334356 
    335 function recordings_display_sndfile($item, $count, $max) { 
     357function recordings_display_sndfile($item, $count, $max, $astpath) { 
    336358  // Note that when using this, it needs a <table> definition around it. 
    337359  $astsnd = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk'; 
    338360  $astsnd .= "/sounds/"; 
    339361  $sysrecs = recordings_readdir($astsnd, strlen($astsnd)+1); 
    340   print "<tr><td><select name='sysrec$count'>\n"; 
     362  print "<tr><td><select id='sysrec$count' name='sysrec$count'>\n"; 
    341363  echo '<option value=""'.($item == '' ? ' SELECTED' : '')."></option>\n"; 
    342364  foreach ($sysrecs as $sr) { 
     
    344366  } 
    345367  print "</select></td>\n"; 
     368 
     369  echo "<td>"; 
     370  $audio=$astpath.$item; 
     371  $audio=$astpath; 
     372  $recurl="modules/recordings/popup.php?recording=".$audio; 
     373  echo "<a href='#' type='submit' onClick=\"javascript:popUp('$recurl',document.prompt.sysrec$count); return false;\" input='foo'  >"; 
     374        echo "<img border='0' width='20'  height='20' src='images/play.png' title='Click here to play this recording' />"; 
     375        echo "</img></td>"; 
     376 
    346377  if ($count==0) { 
    347378     print "<td></td>\n";  
    348379  } else { 
    349     echo '<td><input name="up'.$count.'" type="submit" value="'._("Move Up")."\"></td>\n"; 
     380    echo "<img border='0' width='3' height='11' style='float: none; margin-left: 0px; margin-bottom: 0px;' src='images/blank.gif' />"; 
     381    echo '<td><input name="up'.$count.'" width=10 height=20 border=5  title="Move Up" type="image" src="images/scrollup.gif"  value="'._("Move Up").'"/>'; 
     382    print "</td>\n";  
     383  } if ($count > $max) { 
     384    print "<td></td>\n";  
     385  } else { 
     386    echo "<img border='0' width='3' height='11' style='float: none; margin-left: 0px; margin-bottom: 0px;' src='images/blank.gif' />"; 
     387    echo '<td><input name="down'.$count.'" width=10 height=20 border=0 title="Move Down" type="image" src="images/scrolldown.gif"  value="'._("Move Down")."\">\n"; 
     388    echo "<img border='0' width='3' height='11' style='float: none; margin-left: 0px; margin-bottom: 0px;' src='images/blank.gif' />"; 
     389    print "</td>\n";  
    350390  } 
    351   if ($count > $max) { 
    352      print "<td></td>\n";  
    353   } else { 
    354     echo '<td><input name="down'.$count.'" type="submit" value="'._("Move Down")."\"></td>\n"; 
    355   } 
    356   echo '<td><input name="del'.$count.'" type="submit" value="'._("Delete")."\"></td>\n"; 
     391  echo '<td><input name="del'.$count.'" type="image" border=0 title="Delete" src="images/trash.png" value="'._("Delete")."\">\n"; 
     392  echo "<img border='0' width='9' height='11' style='float: none; margin-left: 0px; margin-bottom: 0px;' src='images/blank.gif' />"; 
     393  echo "<img border='0' width='9' height='11' style='float: none; margin-left: 0px; margin-bottom: 0px;' src='images/blank.gif' />"; 
     394  print "</td>\n";  
     395 
    357396  print "</tr>\n"; 
    358397}