|
From: <abe...@us...> - 2010-02-02 00:55:04
|
Revision: 3748
http://astlinux.svn.sourceforge.net/astlinux/?rev=3748&view=rev
Author: abelbeck
Date: 2010-02-02 00:54:57 +0000 (Tue, 02 Feb 2010)
Log Message:
-----------
Web interface, add support for upgrade-asterisk-sounds in the System tab
Modified Paths:
--------------
branches/0.7/package/webinterface/altweb/admin/prefs.php
branches/0.7/package/webinterface/altweb/admin/system.php
branches/0.7/package/webinterface/altweb/common/version.php
Modified: branches/0.7/package/webinterface/altweb/admin/prefs.php
===================================================================
--- branches/0.7/package/webinterface/altweb/admin/prefs.php 2010-02-02 00:54:21 UTC (rev 3747)
+++ branches/0.7/package/webinterface/altweb/admin/prefs.php 2010-02-02 00:54:57 UTC (rev 3748)
@@ -228,6 +228,8 @@
fwrite($fp, $value."\n");
$value = 'system_firmware_repository_url = "'.trim($_POST['repository_url']).'"';
fwrite($fp, $value."\n");
+ $value = 'system_asterisk_sounds_url = "'.trim($_POST['sounds_url']).'"';
+ fwrite($fp, $value."\n");
if (($value = trim(preg_replace('/[^a-zA-Z0-9._ -]+/', '', $_POST['dn_org_name']))) !== '') {
$value = 'dn_org_name_cmdstr = "'.$value.'"';
@@ -682,12 +684,19 @@
$value = 'module reload';
}
putHtml('<input type="text" size="28" maxlength="64" value="'.$value.'" name="asterisk_reload" /></td></tr>');
+
putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Repository URL:</td><td colspan="4">');
if (($value = getPREFdef($global_prefs, 'system_firmware_repository_url')) === '') {
$value = 'http://mirror.astlinux.org/firmware';
}
putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="repository_url" /></td></tr>');
+ putHtml('<tr class="dtrow1"><td style="text-align: right;" colspan="2">Sounds Pkg URL:</td><td colspan="4">');
+ if (($value = getPREFdef($global_prefs, 'system_asterisk_sounds_url')) === '') {
+ $value = 'http://downloads.asterisk.org/pub/telephony/sounds';
+ }
+ putHtml('<input type="text" size="48" maxlength="128" value="'.$value.'" name="sounds_url" /></td></tr>');
+
putHtml('<tr class="dtrow0"><td colspan="6"> </td></tr>');
putHtml('<tr class="dtrow0"><td class="dialogText" style="text-align: left;" colspan="6">');
Modified: branches/0.7/package/webinterface/altweb/admin/system.php
===================================================================
--- branches/0.7/package/webinterface/altweb/admin/system.php 2010-02-02 00:54:21 UTC (rev 3747)
+++ branches/0.7/package/webinterface/altweb/admin/system.php 2010-02-02 00:54:57 UTC (rev 3748)
@@ -15,6 +15,7 @@
// 09-20-2008, Added firmware check, upgrade, show, revert
// 04-25-2009, Added Restore Basic Configuration
// 12-12-2009, Added System Shutdown/Halt
+// 02-01-2010, Added Asterisk Sounds upgrade, remove, show
//
// System location of rc.conf file
$CONFFILE = '/etc/rc.conf';
@@ -29,6 +30,36 @@
$REPOSITORY_URL = 'http://mirror.astlinux.org/firmware';
}
+if (($SOUNDS_URL = getPREFdef($global_prefs, 'system_asterisk_sounds_url')) === '') {
+ $SOUNDS_URL = 'http://downloads.asterisk.org/pub/telephony/sounds';
+}
+
+$sounds_type_menu = array (
+ '' => 'none',
+ 'core' => 'core',
+ 'extra' => 'extra',
+ 'moh' => 'moh'
+);
+
+$sounds_lang_menu = array (
+ 'en' => 'english',
+ 'es' => 'spanish',
+ 'fr' => 'french',
+ 'de' => 'german',
+ 'nl' => 'dutch',
+ 'it' => 'italian',
+ 'se' => 'swedish'
+);
+
+$sounds_codec_menu = array (
+ 'ulaw' => 'ulaw',
+ 'alaw' => 'alaw',
+ 'gsm' => 'gsm',
+ 'wav' => 'wav',
+ 'g729' => 'g729',
+ 'g722' => 'g722'
+);
+
// Function: putACTIONresult
//
function putACTIONresult($result_str, $status) {
@@ -259,6 +290,34 @@
header('Location: '.$myself.'?firmware_action='.$action.'&result='.$result);
exit;
}
+ } elseif (isset($_POST['sounds_submit'])) {
+ $result = 99;
+ $action = $_POST['sounds_action'];
+ if (isset($_POST['sounds_type'], $_POST['sounds_lang'], $_POST['sounds_codec']) &&
+ ($_POST['sounds_type'] !== '' || $action === 'show')) {
+ $type = $_POST['sounds_type'];
+ $lang = $_POST['sounds_lang'];
+ $codec = $_POST['sounds_codec'];
+ $file = '/usr/sbin/upgrade-asterisk-sounds';
+ $std_err = ' 2>/dev/null';
+ if ($action === 'upgrade') {
+ $result_str = @system($file.' '.$action.' '.$type.' '.$lang.' '.$codec.' "'.$SOUNDS_URL.'"'.$std_err, $status);
+ putACTIONresult($result_str, $status);
+ exit;
+ } elseif ($action === 'remove') {
+ $result_str = @system($file.' '.$action.' '.$type.' '.$lang.' '.$codec.' "'.$SOUNDS_URL.'"'.$std_err, $status);
+ putACTIONresult($result_str, $status);
+ exit;
+ } elseif ($action === 'show') {
+ $result_str = @system($file.' '.$action.$std_err, $status);
+ putACTIONresult($result_str, $status);
+ exit;
+ }
+ } else {
+ $result = 9;
+ header('Location: '.$myself.'?sounds_action='.$action.'&result='.$result);
+ exit;
+ }
} elseif (isset($_FILES['restore'])) {
$result = 1;
$error = $_FILES['restore']['error'];
@@ -322,6 +381,12 @@
$firmware_action = 'check';
}
+ if (isset($_GET['sounds_action'])) {
+ $sounds_action = $_GET['sounds_action'];
+ } else {
+ $sounds_action = 'upgrade';
+ }
+
putHtml("<center>");
if (isset($_GET['result'])) {
$result = $_GET['result'];
@@ -341,6 +406,8 @@
putHtml('<p style="color: red;">No Action, check "Confirm" for this action.</p>');
} elseif ($result == 8) {
putHtml('<p style="color: red;">No Action, unable to open file.</p>');
+ } elseif ($result == 9) {
+ putHtml('<p style="color: red;">No Action, select a sound package type, language and CODEC for this action.</p>');
} elseif ($result == 10) {
putHtml('<p style="color: green;">System is Rebooting... back in <span id="count_down"><script language="JavaScript" type="text/javascript">document.write(count_down_secs);</script></span> seconds.</p>');
} elseif ($result == 11) {
@@ -415,12 +482,12 @@
if (is_file($file = '/var/log/asterisk/messages')) {
putHtml('<option value="'.$file.'">asterisk logs</option>');
}
+ if (is_file($file = '/mnt/kd/webgui-staff-activity.log')) {
+ putHtml('<option value="'.$file.'">Staff Activity log</option>');
+ }
if (is_file($file = '/var/log/openvpn.log')) {
putHtml('<option value="'.$file.'">OpenVPN Server log</option>');
}
- if (is_file($file = '/mnt/kd/webgui-staff-activity.log')) {
- putHtml('<option value="'.$file.'">Staff Activity log</option>');
- }
if (is_file($file = '/var/log/openvpnclient.log')) {
putHtml('<option value="'.$file.'">OpenVPN Client log</option>');
}
@@ -536,7 +603,45 @@
putHtml('<strong>Repository URL:</strong> '.$REPOSITORY_URL);
putHtml('</td></tr>');
+if (is_file('/usr/sbin/upgrade-asterisk-sounds')) {
putHtml('<tr><td style="text-align: center;" colspan="2">');
+ putHtml('<h2>Asterisk Sounds Packages:</h2>');
+ putHtml('</td></tr><tr><td class="dialogText" style="text-align: center;" colspan="2">');
+ putHtml('Package:');
+ putHtml('<select name="sounds_type">');
+ foreach ($sounds_type_menu as $key => $value) {
+ putHtml('<option value="'.$key.'">'.$value.'</option>');
+ }
+ putHtml('</select>');
+ putHtml('–');
+ putHtml('<select name="sounds_lang">');
+ foreach ($sounds_lang_menu as $key => $value) {
+ putHtml('<option value="'.$key.'">'.$value.'</option>');
+ }
+ putHtml('</select>');
+ putHtml('–');
+ putHtml('<select name="sounds_codec">');
+ foreach ($sounds_codec_menu as $key => $value) {
+ putHtml('<option value="'.$key.'">'.$value.'</option>');
+ }
+ putHtml('</select>');
+ putHtml('</td></tr><tr><td class="dialogText" style="text-align: center;" colspan="2">');
+ putHtml('<select name="sounds_action">');
+ $sel = ($sounds_action === 'upgrade') ? ' selected="selected"' : '';
+ putHtml('<option value="upgrade"'.$sel.'>Upgrade/Install</option>');
+ $sel = ($sounds_action === 'remove') ? ' selected="selected"' : '';
+ putHtml('<option value="remove"'.$sel.'>Remove</option>');
+ $sel = ($sounds_action === 'show') ? ' selected="selected"' : '';
+ putHtml('<option value="show"'.$sel.'>Show Installed</option>');
+ putHtml('</select>');
+ putHtml('–');
+ putHtml('<input type="submit" value="Sounds Package" name="sounds_submit" />');
+ putHtml('</td></tr><tr><td class="dialogText" style="text-align: center;" colspan="2">');
+ putHtml('<strong>Sounds Pkg URL:</strong> '.$SOUNDS_URL);
+ putHtml('</td></tr>');
+}
+
+ putHtml('<tr><td style="text-align: center;" colspan="2">');
putHtml('<h2>System Shutdown/Halt:</h2>');
putHtml('</td></tr><tr><td class="dialogText" style="text-align: center;" colspan="2">');
putHtml('<input type="submit" value="Shutdown" name="submit_shutdown" />');
Modified: branches/0.7/package/webinterface/altweb/common/version.php
===================================================================
--- branches/0.7/package/webinterface/altweb/common/version.php 2010-02-02 00:54:21 UTC (rev 3747)
+++ branches/0.7/package/webinterface/altweb/common/version.php 2010-02-02 00:54:57 UTC (rev 3748)
@@ -1,6 +1,6 @@
<?php
// version.php for AstLinux Alternate Web Interface
-$GUI_VERSION = '1.6.12';
+$GUI_VERSION = '1.6.13';
?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|