via: 0cb41713987185aec7f42c9cff174b6d2757e460 (commit)
from: c2e63f1d8fc269cf17bd85d534c9099af8a454b6 (commit)
= COMMIT LOG ===========================================================
committer: Mathieu Parent
comments:
MediaBrotha: add ability to pass params by using hidden fields
diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Form.php b/sathieu/cisco-xml/lib/MediaBrotha/Form.php
index 08dd4c6..509341a 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Form.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Form.php
@@ -40,6 +40,7 @@ class MediaBrotha_Field {
class MediaBrotha_Form extends ArrayIterator {
private $_title;
+
public function getTitle() {
return $this->_title;
}
diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php
index d859829..0f31ee1 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php
@@ -72,11 +72,20 @@ class MediaBrotha_Frontend_CiscoXML extends MediaBrotha_Frontend_HTTP {
}
public function renderForm(MediaBrotha_Form $form) {
+ foreach($form as $field) {
+ if ($field->get('visibility') === 'hidden') {
+ $params[$field->get('name')] = $field->get('value');
+ }
+ }
$xml = new CiscoIPPhoneInput();
$xml->setCiscoElement('Title', $form->getTitle());
//$xml->setCiscoElement('Prompt', ...);
- $xml->setCiscoElement('URL', $this->rootURL());
+ $xml->setCiscoElement('URL', $this->rootURL().'?'.MediaBrotha_Core::value2hash(http_build_query($params)));
+ $params = Array();
foreach($form as $field) {
+ if ($field->get('visibility') === 'hidden') {
+ continue;
+ }
$flags = 'A';
$xml->setCiscoElement('InputItem',
Array(
@@ -88,6 +97,19 @@ class MediaBrotha_Frontend_CiscoXML extends MediaBrotha_Frontend_HTTP {
);
}
+
+ $xml->setCiscoElement('SoftKeyItem',
+ Array('Name' => 'Search',
+ 'URL' => 'SoftKey:Submit',
+ 'Position' => 1));
+ $xml->setCiscoElement('SoftKeyItem',
+ Array('Name' => '<<',
+ 'URL' => 'SoftKey:<<',
+ 'Position' => 2));
+ $xml->setCiscoElement('SoftKeyItem',
+ Array('Name' => 'Exit',
+ 'URL' => 'SoftKey:Exit',
+ 'Position' => 3));
CiscoXMLObject::HttpHeader();
print $xml;
}
diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php
index c1ea4df..1c0454a 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php
@@ -56,6 +56,7 @@ class MediaBrotha_Frontend_HTML extends MediaBrotha_Frontend_HTTP {
private function _createHTMLDocument($title) {
$this->_xml = new DOMDocument('1.0');
+ $this->_xml->formatOutput = true;
$root = $this->_xml->createElement('html');
$root = $this->_xml->appendChild($root);
@@ -135,6 +136,9 @@ class MediaBrotha_Frontend_HTML extends MediaBrotha_Frontend_HTTP {
$tableElement = $formElement->appendChild($tableElement);
foreach($form as $field) {
+ if ($field->get('visibility') === 'hidden') {
+ continue;
+ }
$trElement = $this->_xml->createElement('tr');
$trElement = $tableElement->appendChild($trElement);
Summary of changes: sathieu/cisco-xml/lib/MediaBrotha/Form.php | 1 + .../lib/MediaBrotha/Frontend/CiscoXML.php | 24 +++++++++++++++++++- .../cisco-xml/lib/MediaBrotha/Frontend/HTML.php | 4 +++ 3 files changed, 28 insertions(+), 1 deletions(-)
this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630
--
FreeSWITCH user-contributed scripts, etc