Project "FreeSWITCH user-contributed scripts, etc" received a push.

branch: master updated

       via: ee436d35144c7d85629d2c7356db64d5f392d1ff (commit)
      from: abd1a5786ac8079d735ede53515dbaedd8324acd (commit)


= COMMIT LOG ===========================================================
committer: Mathieu Parent
comments: 
MediaBrotha:
- do not display the _default action
- ensure session arrays are set
- limit MenuItem > Name to 64 chars
- Cisco IP Phone need a field flag of 1 char

diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Backend.php b/sathieu/cisco-xml/lib/MediaBrotha/Backend.php
index 8e56562..f85b59f 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Backend.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Backend.php
@@ -67,6 +67,16 @@ abstract class MediaBrotha_Backend {
 	}
 
 	// Actions
+	final public function getVisibleMediaActions(MediaBrotha_Media $media) {
+		$actions = Array();
+		foreach ($this->getMediaActions($media) as $action) {
+			if ($action{0} !== '_') {
+				$actions[] = $action;
+			}
+		}
+		return $actions;
+	}
+
 	public function getMediaActions(MediaBrotha_Media $media) {
 		return Array();
 	}
diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Core.php b/sathieu/cisco-xml/lib/MediaBrotha/Core.php
index f241c66..9e53e13 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Core.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Core.php
@@ -43,6 +43,12 @@ class MediaBrotha_Core {
 			if (!session_start()) {
 				throw new Exception('Unable to start session');
 			}
+			if (!isset($_SESSION['HASHES'])) {
+				$_SESSION['HASHES'] = Array();
+			}
+			if (!isset($_SESSION['CALLBACK'])) {
+				$_SESSION['CALLBACK'] = Array();
+			}
 			MediaBrotha_Core::_unhashRequest();
 			MediaBrotha_Core::loadBackend('Root');
 		} catch (Exception $e) {
@@ -200,9 +206,6 @@ class MediaBrotha_Core {
 	}
 
 	private static function _unhashRequest() {
-		if (!isset($_SESSION['HASHES'])) {
-			$_SESSION['HASHES'] = Array();
-		}
 		if (isset($_SERVER["QUERY_STRING"])) {
 			$tmp = explode('&', $_SERVER["QUERY_STRING"]);
 			foreach ($tmp as $h) {
diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php
index 1bf85b7..d859829 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/CiscoXML.php
@@ -43,7 +43,7 @@ class MediaBrotha_Frontend_CiscoXML extends MediaBrotha_Frontend_HTTP {
 				($item->getMimeEncoding() ? ('mime_encoding='.urlencode($item->getMimeEncoding()).'&') : '').
 				'uri='.urlencode($item->getURI()));
 		$this->_xml->setCiscoElement('MenuItem',
-			Array('Name' => $item->getDisplayName(), 'URL' => $url));
+			Array('Name' => $item->getDisplayName(64), 'URL' => $url));
 	}
 	public function finish($item) {
 		$pos = 1;
@@ -52,7 +52,7 @@ class MediaBrotha_Frontend_CiscoXML extends MediaBrotha_Frontend_HTTP {
 			'URL' => 'SoftKey:Select',
 			'Position' => $pos++));
 		foreach (MediaBrotha_Core::getBackends() as $backend) {
-			foreach ($backend->getMediaActions($item) as $action) {
+			foreach ($backend->getVisibleMediaActions($item) as $action) {
 				$this->_xml->setCiscoElement('SoftKeyItem',
 					Array('Name' => $action,
 					'URL' => 'QueryStringParam:'.MediaBrotha_Core::value2hash('action='.$action.'&backend='.$backend->getBackendName()),
@@ -77,12 +77,13 @@ class MediaBrotha_Frontend_CiscoXML extends MediaBrotha_Frontend_HTTP {
 		//$xml->setCiscoElement('Prompt', ...);
 		$xml->setCiscoElement('URL', $this->rootURL());
 		foreach($form as $field) {
+			$flags = 'A';
 			$xml->setCiscoElement('InputItem',
 				Array(
 					'DisplayName' => $field->get('display_name'),
 					'QueryStringParam' => $field->get('name'),
 					'DefaultValue' => $field->get('value'),
-					'InputFlags' => '',
+					'InputFlags' => $flags,
 				)
 			);
 			
diff --git a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php
index f6d4015..c1ea4df 100644
--- a/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php
+++ b/sathieu/cisco-xml/lib/MediaBrotha/Frontend/HTML.php
@@ -40,7 +40,7 @@ class MediaBrotha_Frontend_HTML extends MediaBrotha_Frontend_HTTP {
 				'uri='.urlencode($media->getURI()));
 
 		foreach (MediaBrotha_Core::getBackends() as $backend) {
-			foreach ($backend->getMediaActions($media) as $action) {
+			foreach ($backend->getVisibleMediaActions($media) as $action) {
 				$tag = $this->_xml->createElement($tag_name);
 				$tag = $parent->appendChild($tag);
 
========================================================================

Summary of changes:
 sathieu/cisco-xml/lib/MediaBrotha/Backend.php      |   10 ++++++++++
 sathieu/cisco-xml/lib/MediaBrotha/Core.php         |    9 ++++++---
 .../lib/MediaBrotha/Frontend/CiscoXML.php          |    7 ++++---
 .../cisco-xml/lib/MediaBrotha/Frontend/HTML.php    |    2 +-
 4 files changed, 21 insertions(+), 7 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