root/modules/branches/2.4/gabcast/page.gabcast.php

Revision 5400, 6.3 kB (checked in by p_lindheimer, 4 years ago)

add dest registry support to gabcast

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to LF
Line 
1 <?php
2 /* $Id:$ */
3 //This program is free software; you can redistribute it and/or
4 //modify it under the terms of the GNU General Public License
5 //as published by the Free Software Foundation; either version 2
6 //of the License, or (at your option) any later version.
7 //
8 //This program is distributed in the hope that it will be useful,
9 //but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //GNU General Public License for more details.
12
13 $iam = 'gabcast'; //used for switch on config.php
14 $type = 'tool';
15
16 // look for form post
17 isset($_POST['action'])?$postaction = $_POST['action']:$postaction='';
18
19 switch ($postaction) {
20   case "add":
21     gabcast_add($_POST['ext'],$_POST['channbr'],$_POST['pin']);
22     needreload();
23     redirect_standard();
24   break;
25   case "delete":
26     gabcast_del($_POST['ext']);
27     needreload();
28     redirect_standard();
29   break;
30   case "edit":
31     gabcast_edit($_POST['ext'],$_POST['channbr'],$_POST['pin']);
32     needreload();
33     redirect_standard('ext');
34   break;
35 }
36
37 // look for get
38 isset($_GET['action'])?$action = $_GET['action']:$action='';
39 isset($_GET['ext'])?$ext=$_GET['ext']:$ext='';
40
41 switch ($action) {
42   case "add":
43     gabcast_sidebar($ext, $type, $iam);
44     gabcast_show(null, $type, $iam);
45   break;
46   case "edit":
47     gabcast_sidebar($ext, $type, $iam);
48     gabcast_show($ext, $type, $iam);
49   break;
50   default:
51     gabcast_sidebar(null, $type, $iam);
52     gabcast_text();
53   break;
54 }
55
56
57 function gabcast_text() {
58 ?>
59
60 <div>
61   This
62   <a class=info href="http://www.gabcast.com" target=_new>Gabcast
63     <span>
64       Gabcast is a social broadcasting
65       platform that offers virtual communities, individuals, and organizations an easy
66       way to create and distribute audio content.<br><br>Visit www.gabcast.com for more info.
67     </span>
68   </a> module allows you to:
69   <ul>
70     <li>Link extensions to Gabcast channels. It creates a feature code (which defaults to <u>*422</u> "gab" - you can change this in
71     <a href="config.php?type=setup&display=featurecodeadmin">Feature Code Admin</a>)  which allows you to log directly into your Gabcast account.  This is ideal for personal podcasting!
72    
73     <li>Define a Gabcast channel as a Destination for other modules.  For example, you can direct a DID or IVR menu option directly to Gabcast. This is ideal for group and public podcasting!
74   </ul>
75 </div>
76
77
78 <div style=;margin-top:20px;>
79   <?php echo gabcast_player();?>
80 </div>
81 <?php
82 }
83
84 function gabcast_show($xtn, $type, $iam) {
85  
86   //get settings if editing
87   if(!empty($xtn)) {
88     $thisxtn = gabcast_get($xtn);
89     if(!is_array($thisxtn)) {
90       echo "Error: cannot retreive Gabcast info for this extension";
91       return;
92     }
93     $player = gabcast_player($thisxtn[1]);
94     $action = 'edit';
95     
96     //draw delete button
97     echo <<< End_Of_Delete
98     <form method="POST" action="{$_SERVER['PHP_SELF']}?type={$type}&display={$iam}">
99     <input type="hidden" name="action" value="delete">
100     <input type="hidden" name="ext" value="{$thisxtn[0]}">
101     <input type="submit" value="delete settings"></form>
102 End_Of_Delete;
103   }
104     $usage_list = framework_display_destination_usage(gabcast_getdest($xtn));
105     if (!empty($usage_list)) {
106     ?>
107       <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a>
108     <?php
109     }
110 ?>
111   <hr>
112 <?php
113  
114   if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
115     $thisxtn['ext'] = $_REQUEST['ext'];
116     $thisxtn[0] = $_REQUEST['ext'];
117     $player = "";
118     $action = 'add';
119     
120     echo '<div style=margin-bottom:10px;>You <u>must</u> have a Gabcast account & channel to use this feature.  Visit <a href="http://www.gabcast.com" target="_blank">www.gabcast.com</a> to sign up. <u>It\'s a free service</u>!</div>';
121   }
122  
123   echo <<< End_Of_Html
124
125   <form method="POST" action="{$_SERVER['PHP_SELF']}?type={$type}&display={$iam}&action={$action}">
126     <input type="hidden" name="action" value="{$action}">
127     <div>
128       Gabcast Channel Number:
129       <input size="10" type="text" name="channbr" value="{$thisxtn[1]}">
130     </div>
131     <div>
132       Gabcast Channel Password:
133       <input size="10" type="text" name="pin" value="{$thisxtn[2]}">
134     </div>
135     <div>
136       Link to Extension/User Number:
137       <input size="10" type="text" name="ext" value="{$thisxtn[0]}">
138     </div>
139     <div>
140       <input type="submit">
141     </div>
142     <div style="margin-top:20px;">
143       {$player}
144     </div>
145   </form>
146  
147 End_Of_Html;
148 }
149
150 function gabcast_sidebar($sel, $type, $iam) {
151         echo "</div><div class='rnav'>\n";
152         echo "<ul><li><a id='".($sel==''?'current':'std')."' ";
153         echo "href='config.php?type={$type}&amp;display={$iam}&amp;action=add'>"._("Add Gabcast Channel")."</a></li>";
154         //get the list of paging groups
155         $resarr = gabcast_list();
156         if ($resarr) {
157                 foreach ($resarr as $resar) {
158                         $cursel = $resar[0];
159                         echo "<li><a id=\"".($sel==$cursel ? 'current':'std');
160                         echo "\" href=\"config.php?type=${type}&amp;display=";
161                         echo "${iam}&amp;ext=${cursel}&amp;action=edit\">";
162                         echo _("Ext")." ${cursel} -> "._("Chan")." ${resar[1]} </a></li>";
163                 }
164         }
165         echo "</ul></div><div class='content'><h2>"._("Gabcast Configuration")."</h2>\n";
166 }
167
168 function gabcast_player($chanid = false) {
169   if ($chanid) {
170     $title = _("<h4>The latest episodes in channel #{$chanid}").":</h4>";
171     $feed = "http://www.gabcast.com/casts/{$chanid}/rss/rss.xml";
172   } else {
173     $title = _("<h4>The latest episodes across all channels").":</h4>";
174     $feed = "http://www.gabcast.com/casts/feeds/latest.xml";
175   }
176  
177   return $title.'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="300" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"><param name="movie" value="http://www.gabcast.com/mp3play/mp3player.swf?file='.$feed.'&config=http://www.gabcast.com/mp3play/config.php?ini=full.0.l" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always"><embed src="http://www.gabcast.com/mp3play/mp3player.swf?file='.$feed.'&config=http://www.gabcast.com/mp3play/config.php?ini=full.0.l" allowScriptAccess="always" wmode="transparent" width="300" height="300" name="mp3player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object><br><br><div>Feed URL: <a href="'.$feed.'" target=_blank>'.$feed.'</a></div>';
178  
179 }
180 ?>
Note: See TracBrowser for help on using the browser.