$action = 'edit';
try {
$destinations = $shout->extensions->getExtensions($curaccount);
+ $conferences = $shout->storage->getConferences($curaccount);
$soundfiles = $shout->getRecordings();
} catch (Exception $e) {
$notification->push(_("Problem getting destination information."));
return $menus;
} catch (Exception $e) {
//FIXME: Create a way to notify the user of the failure.
- die(var_dump($e));
+ Horde::logMessage($e, 'ERR');
+ return false;
+ }
+ }
+
+ public function getConferences()
+ {
+ try {
+ $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
+ $account = $_SESSION['shout']['curaccount'];
+ return $shout->storage->getConferences($account);
+ } catch (Exception $e) {
+ //FIXME: Create a way to notify the user of the failure.
Horde::logMessage($e, 'ERR');
return false;
}
throw new Shout_Exception("Not implemented.");
}
+ public function getConferences($account)
+ {
+ $sql = 'SELECT id, room_number, name, pin, options ' .
+ 'FROM conferences ' .
+ 'WHERE account_id = (SELECT id FROM accounts WHERE code = ?);';
+ $args = array($account);
+ $msg = 'SQL query in Shout_Driver_Sql#getConferences(): ' . $sql;
+ Horde::logMessage($msg, 'DEBUG');
+ $sth = $this->_db->prepare($sql);
+ $result = $this->_db->execute($sth, $args);
+ if ($result instanceof PEAR_Error) {
+ throw new Shout_Exception($result);
+ }
+
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if ($row instanceof PEAR_Error) {
+ throw new Shout_Exception($row);
+ }
+
+ $conferences = array();
+ while ($row && !($row instanceof PEAR_Error)) {
+ $roomno = $row['room_number'];
+ $conferences[$roomno] = $row;
+
+ /* Advance to the new row in the result set. */
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
+
+ $result->free();
+ return $conferences;
+ }
+
/**
* Attempts to open a persistent connection to the SQL server.
*
var menuInfo = $H();
var menuActions = $H(<?php echo Horde_Serialize::serialize(Shout::getMenuActions(), Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
var destinations = $H(<?php echo Horde_Serialize::serialize($destinations, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
+var conferences = $H(<?php echo Horde_Serialize::serialize($conferences, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
var soundfiles = $H(<?php echo Horde_Serialize::serialize($soundfiles, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
function empty(p)
var text = document.createTextNode(menuActions.get(action).args.roomno.name);
div.appendChild(text);
- var input = document.createElement('input');
- input.name = 'roomno';
+ var select = document.createElement('select');
+ select.name = 'roomno';
+ conferences.each(function (item) {
+ var option = document.createElement('option');
+ option.value = item.key;
+ var text = document.createTextNode(item.value.name);
+ option.appendChild(text);
+ select.appendChild(option);
+ })
+
if (menuInfo.get(curmenu).actions[digit] != null) {
- input.value = menuInfo.get(curmenu).actions[digit].args.roomno;
+ select.value = menuInfo.get(curmenu).actions[digit].roomno;
}
- div.appendChild(input);
+ div.appendChild(select);
break;
case 'dial':
case 'conference':
var roomno = pair.value.args['roomno'];
if (roomno != null) {
- text = document.createTextNode(roomno);
+ text = document.createTextNode(conferences.get(roomno).name);
} else {
text = document.createTextNode('');
}
cursor: pointer;
}
-ul {
- list-style: none;
- display: inline;
-}
-
#controls {
margin-left: auto;
margin-right: auto;
+ list-style: none;
}
#controls li {
background-image: url('graphics/digit-bg.png');
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-}
-
-.digit:hover {
cursor: pointer;
}
float:left;
margin: 3px;
cursor: pointer;
+ padding: 2px 8px;
}
.button a {