Ticket #1146: mythweb_remote.3.diff

File mythweb_remote.3.diff, 22.3 KB (added by hads, 13 years ago)

Updated patch against 13117

  • mythweb/includes/mythfrontend.php

     
    4040    var $fp;
    4141
    4242/** @var string     Hostname to connect to. */
    43     var $host;
     43    public $host;
    4444/** @var string     Hostname to connect to. */
    45     var $port;
     45    public $port;
    4646
    4747/** @var array      List of jump points available on this host. */
    4848    var $jump_points = array();
  • mythweb/skins/default/frontends.css

     
     1
     2
     3.success {
     4    color: #3AF030;
     5    background-color: #033600;
     6    border-color: #3AF030;
     7    border: thin groove #3AF030;
     8  }
     9
     10
     11.frontends {
     12    float: left;
     13    left: 2%;
     14    width: 20%;
     15    position: relative;
     16  }
     17
     18
     19.frontends select {
     20    width: 100%;
     21  }
     22
     23
     24.frontends option[disabled] {
     25    color: #68686F;
     26  }
     27
     28.jumps {
     29
     30        float: left;
     31        width: 50%;
     32        left: 25%;
     33        position: absolute;
     34}
     35
     36.keys {
     37    float: right;
     38    width: 20%;
     39    right: 2%;
     40    position: relative;
     41  }
     42
     43
     44.keypad td {
     45    text-align : center;
     46    width : 33%;
     47  }
     48
     49
     50.keypad td:hover {
     51    cursor : pointer;
     52    border : 1px solid yellow;
     53  }
     54
  • mythweb/modules/frontends/jump.php

     
     1<?php
     2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
     3
     4        if( $_POST['frontends'] && $_POST['jump'] )
     5                foreach( $_POST['frontends'] as $frontend )
     6                        $Frontends[$frontend]->send_jump( $_POST['jump'] );
     7
     8        if( $_GET['frontends'] && $_GET['jump'] )
     9                foreach( $_GET['frontends'] as $frontend )
     10                        $Frontends[$frontend]->send_jump( $_GET['jump'] );
     11
     12        sleep(1);  //give the frontend time to do it's thing
  • mythweb/modules/frontends/keys.php

     
     1<?php
     2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
     3
     4        if( $_POST['frontends'] && $_POST['key'] )
     5                foreach( $_POST['frontends'] as $frontend )
     6                        $Frontends[$frontend]->send_keypress( $_POST['key'] );
     7
     8        if( $_GET['frontends'] && $_GET['key'] )
     9                foreach( $_GET['frontends'] as $frontend )
     10                        $Frontends[$frontend]->send_keypress( $_GET['key'] );
     11
     12        sleep(1);  //give the frontend time to do it's thing
  • mythweb/modules/frontends/handler.php

     
     1<?php
     2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
     3
     4        require_once( "includes/mythfrontend.php" );
     5
     6        if( array_key_exists( "key", $_GET ) || array_key_exists( "key", $_POST ) )
     7                require_once( "modules/frontends/keys.php" );
     8
     9        if( array_key_exists( "jump", $_GET ) || array_key_exists( "jump", $_POST ) )
     10                require_once( "modules/frontends/jump.php" );
     11
     12        if( $Path[1] == "scripts.php" )
     13                require_once( "modules/frontends/scripts.php" );
     14        else
     15                require_once( "modules/frontends/main.php" );
     16
  • mythweb/modules/frontends/init.php

     
     1<?php
     2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
     3/**
     4 * Initialization routines for the MythWeb TV module.
     5 *
     6 * @url         $URL: http://svn.mythtv.org/svn/branches/release-0-19-fixes/mythplugins/mythweb/modules/tv/init.php $
     7 * @date        $Date: 2006-01-01 11:00:31 +1100 (Sun, 01 Jan 2006) $
     8 * @version     $Revision: 8460 $
     9 * @author      $Author: Philip Nelson <phatfil@optusnet.com.au> $
     10 * @license     GPL
     11 *
     12 * @package     MythWeb
     13 * @subpackage  TV
     14 *
     15/**/
     16
     17// The TV module is always enabled.
     18    $Modules['frontends'] = array('path'        => 'frontends',
     19                                  'name'        => t('Frontends'),
     20                                  'links'       => array('status' => t('Frontend Status'),
     21                                 ),
     22                          );
     23
  • mythweb/modules/frontends/main.php

     
     1<?php
     2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
     3
     4    // Set the desired page title
     5    $page_title = 'MythTV Frontend Status';
     6
     7    // Custom headers
     8    $headers[] = '<link rel="stylesheet" type="text/css" href="'.skin_url.'/frontends.css" />';
     9
     10    // Print the page header
     11    require 'modules/_shared/tmpl/'.tmpl.'/header.php';
     12?>
     13
     14
     15    <script id="scripts" language="javascript" type="text/javascript"></script>
     16
     17    <script language="javascript" type="text/javascript">
     18        document.onload = get_element( "scripts" ).src = "frontends/scripts.php";
     19    </script>
     20
     21
     22    <h1>Frontends (TESTING)</h1>
     23
     24    <form id="main" method="post" action="frontends">
     25
     26
     27    <!-- Frontends -->
     28    <div class="frontends">
     29
     30    <fieldset>
     31    <legend>Frontends</legend>
     32
     33    <div id="no_frontends_reachable" class="hidden">No frontends reachable</div>
     34    <div id="no_frontends_selected" class="hidden">No frontends selected</div>
     35
     36    <select id="frontends_select" multiple name="frontends[]">
     37
     38        <option id="loading_option">LOADING...</option>
     39
     40    </select>
     41
     42    </fieldset>
     43
     44    <p>You must select at least one frontend to communicate with. You can select as many as you want by holding CTRL while selecting multiple options. All discovered frontends are listed, any that are unreachable will appear as disabled select options.</p>
     45
     46    </div>
     47
     48
     49    <!-- Jump points -->
     50    <div id="jumps" class="jumps"></div>
     51
     52
     53    <!-- Keys -->
     54    <div class='keys'>
     55
     56        <table width='100%' border=1 class="keypad">
     57        <tr><td class='menu' colspan=3><font color=white face='Courier New'><b>MythTV - Remote</b></font></td></tr>
     58        <tr><td colspan=3></td></tr>
     59        <tr><td onclick="sendKey(1)">1</td><td onclick="sendKey(2)">2</td><td onclick="sendKey(1)">3</td></tr>
     60        <tr><td onclick="sendKey(4)">4</td><td onclick="sendKey(5)">5</td><td onclick="sendKey(6)">6</td></tr>
     61        <tr><td onclick="sendKey(7)">7</td><td onclick="sendKey(8)">8</td><td onclick="sendKey(9)">9</td></tr>
     62        <tr><td border="0"></td><td onclick="sendKey(0)">0</td><td border="0"></td></tr>
     63        <tr><td colspan=3></td></tr>
     64        <tr><td></td><td onclick="sendKey('up')">Up</td><td></td></tr>
     65        <tr><td onclick="sendKey('left')">Left</td><td onclick="sendKey('enter')">Enter</td><td onclick="sendKey('right')">Right</td></tr>
     66        <tr><td></td><td onclick="sendKey('down')">Down</td><td></td></tr>
     67        <tr><td colspan=3></td></tr>
     68        <tr><td onclick="sendKey('delete')">Delete</a></td><td></td><td onclick="sendKey('end')">End</td></tr>
     69        <tr><td onclick="sendKey('pageup')">Page Up</a></td><td onclick="sendKey('escape')">Escape</td><td onclick="sendKey('pagedown')">Page Down</td></tr>
     70        </table>
     71
     72        Select other possible
     73        <select>
     74
     75        <option>keys</option>
     76        <option onclick="sendKey('space')">space</option>
     77        <option onclick="sendKey('backspace')">backspace</option>
     78        <option onclick="sendKey('slash')">/</option>
     79        <option onclick="sendKey('backslash')">\</option>
     80        <option onclick="sendKey('bracketleft')">[</option>
     81        <option onclick="sendKey('bracketright')">]</option>
     82        <option onclick="sendKey('colon')">:</option>
     83        <option onclick="sendKey('semicolon')">;</option>
     84        <option onclick="sendKey('equal')">=</option>
     85        <option onclick="sendKey('greater')">greater</option>
     86        <option onclick="sendKey('less')">less</option>
     87        <option onclick="sendKey('f1')">F1</option>
     88        <option onclick="sendKey('f2')">F2</option>
     89        <option onclick="sendKey('f3')">F3</option>
     90        <option onclick="sendKey('f4')">F4</option>
     91        <option onclick="sendKey('f5')">F5</option>
     92        <option onclick="sendKey('f6')">F6</option>
     93        <option onclick="sendKey('f7')">F7</option>
     94        <option onclick="sendKey('f8')">F8</option>
     95        <option onclick="sendKey('f9')">F9</option>
     96        <option onclick="sendKey('f10')">F10</option>
     97        <option onclick="sendKey('f11')">F11</option>
     98        <option onclick="sendKey('f12')">F12</option>
     99
     100        </select>
     101        to send
     102
     103        <br>
     104        Keypress to send: <input id="key" type="text" name="key" size="11" />
     105        <input type="button" value="Send" onclick="sendPOST()">
     106        <br><br>
     107        <div align="center"><input id="detect_key_presses_button" type="button" onclick="toggleKeyDetect(); this.value == 'Detect Key Presses (OFF)' ? this.value='Detect Key Presses (ON)' : this.value='Detect Key Presses (OFF)'" value="Detect Key Presses (OFF)" /></div>
     108
     109        <p>Keypress can be a letter, number or one of the following: backslash, backspace, bracketleft, bracketright, colon, down, enter, equal, escape, f1, f10, f11, f12, f2, f3, f4, f5, f6, f7, f8, f9, greater, left, less, pagedown, pageup, right, semicolon, slash, space, up</p>
     110        <p>"Detect Key Presses" will send every key that is pressed in the browser window to the selected frontends</p>
     111
     112    </div>
     113
     114
     115    </form>
     116
     117
     118<?php
     119    // Print the page footer
     120    require 'modules/_shared/tmpl/'.tmpl.'/footer.php';
     121?>
  • mythweb/modules/frontends/tmpl/default/welcome.php

     
     1<?php
     2/**
     3 * Welcome page description of the frontends module.
     4 *
     5/**/
     6
     7// Open with a div and an image
     8    echo '<div id="info_frontends" class="hidden">',
     9         '<!--<img src="', skin_url, '/img/remote.png" class="module_icon" />-->',
     10
     11// Print a basic overview of what this module does
     12         t('welcome: frontends'),
     13
     14// Next, print a list of possible subsectons
     15    ####
     16
     17// Close the div
     18         "</div>\n";
  • mythweb/modules/frontends/scripts.php

     
     1<?php
     2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
     3
     4Header("content-type: application/x-javascript");
     5?>
     6
     7
     8function set()
     9{
     10    main_form = document.forms[0];
     11    frontends_select = get_element("frontends_select");
     12    jumps_div = get_element("jumps");
     13
     14    <?php
     15
     16    foreach ($Frontends as $frontend)
     17    {
     18
     19        $hostName   = $frontend->host;
     20        $location   = $frontend->query_location();
     21        $jumppoints = $frontend->get_jump_points();
     22
     23        if ( !empty( $hostName ) )
     24        {  ?>
     25
     26            // FRONTENDS
     27            var frontends_select_option = document.createElement("option");
     28            frontends_select_option.disabled = <?php echo $location == "Unreachable" ? "true" : "false" ?>;
     29            frontends_select_option.text = "<?php echo $hostName ?>";
     30            frontends_select.add(frontends_select_option, null);
     31
     32            // JUMPS
     33
     34            new_element = document.createElement("div");
     35
     36            new_element.innerHTML = "<h3><?php echo $hostName; ?></h3>Current location:<?php echo $location; ?><br><br>Jump to ";
     37
     38            jumps_select = document.createElement("select");
     39            jumps_select.onchange = "document.forms['main'].submit()";
     40            jumps_select.onchange = sendJump;
     41
     42            jumps_option_default = document.createElement("option");
     43            jumps_option_default.selected = true;
     44            jumps_option_default.value = "DEFAULT";
     45            jumps_option_default.text = "";
     46
     47            jumps_select.appendChild(jumps_option_default);
     48            jumps_select.selectedIndex = jumps_option_default.index;
     49
     50            <?php foreach ( array_keys($jumppoints) as $jumppoint_key ) { ?>
     51                    jumps_option = document.createElement("option");
     52                    jumps_option.value = "<?php echo $jumppoint_key ?>";
     53                    jumps_option.text = "<?php echo trim( $jumppoints[$jumppoint_key] ) ?>";
     54                    jumps_select.appendChild(jumps_option);
     55            <?php } ?>
     56
     57            new_element.appendChild(jumps_select);
     58            jumps_div.appendChild(new_element);
     59
     60        <?
     61        }
     62    }
     63    ?>
     64}
     65set();
     66
     67loading = get_element("loading_option");
     68loading.parentNode.removeChild(loading);
     69
     70
     71function clear()
     72{
     73    for (frontends_option in get_element("frontends_select").options)
     74            frontends_select.remove(frontends_option);
     75
     76    get_element("jumps").innerHTML = "";
     77    get_element("key").value = "";
     78}
     79
     80function update()
     81{
     82    clear();
     83    set();
     84}
     85
     86function setKey(value)
     87{
     88        key = get_element("key");
     89        key.value = value;
     90}
     91
     92function sendKey(value)
     93{
     94        setKey(value);
     95        sendPOST(getSelectedFrontends() + "key=" + value);
     96}
     97
     98function keypress(event)
     99{
     100    switch(event.keyCode)
     101    {
     102        case 8: key  = "backspace";     break;
     103        case 13: key = "enter";         break;
     104        case 27: key = "escape";        break;
     105        case 33: key = "pageup";        break;
     106        case 34: key = "pagedown";      break;
     107        case 37: key = "left";          break;
     108        case 38: key = "up";            break;
     109        case 39: key = "right";         break;
     110        case 40: key = "down";          break;
     111        case 46: key = "delete";        break;
     112
     113        case 112: key = "f1";           break;
     114        case 113: key = "f2";           break;
     115        case 114: key = "f3";           break;
     116        case 115: key = "f4";           break;
     117        case 116: key = "f5";           break;
     118        case 117: key = "f6";           break;
     119        case 118: key = "f7";           break;
     120        case 119: key = "f8";           break;
     121        case 120: key = "f9";           break;
     122        case 121: key = "f10";          break;
     123        case 122: key = "f11";          break;
     124        case 123: key = "f12";          break;
     125
     126        default: key = String.fromCharCode(event.charCode);  break;
     127    }
     128
     129    sendKey(key);
     130}
     131
     132function toggleKeyDetect()
     133{
     134    window.onkeypress == null ? window.onkeypress = keypress : window.onkeypress = null;
     135}
     136
     137
     138function sendJump( value )
     139{
     140    sendPOST(getSelectedFrontends() + "jump=" + this.value);
     141}
     142
     143
     144function getSelectedFrontends()
     145{
     146
     147    frontends_string = "";
     148    frontends = document.forms['main'].elements['frontends[]'];
     149
     150    for (index = 0; index < frontends.length; index++)
     151    {
     152        if( frontends.options[index].selected )
     153                frontends_string += "frontends[" + index + "]=" + frontends.options[index].value + "&";
     154    }
     155
     156    return frontends_string;
     157}
     158
     159
     160function sendPOST(send_string)
     161{
     162    var req = get_connection_object();
     163    req.open("POST", "frontends", false);
     164    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     165    req.send(send_string);
     166}
  • mythweb/modules/_shared/lang/English_GB.lang

     
    217217"Found %s results for '%s'"
    218218"freqid"
    219219"Friday"
     220"Frontend Status"
     221"Frontends"
    220222"generic_date"
    221223    %a %b %e, %Y
    222224"generic_time"
     
    710712"Wednesday"
    711713"welcome: backend_log"
    712714    Show the server logs.
     715"welcome: frontends"
    713716"welcome: music"
    714717    Browse your music collection.
    715718"welcome: settings"
  • mythweb/modules/_shared/lang/Catalan.lang

     
    325325    id freqÌÚncia
    326326"Friday"
    327327    Divendres
     328"Frontend Status"
     329"Frontends"
    328330"generic_date"
    329331    %b %e, %Y
    330332"generic_time"
     
    991993    Dimecres
    992994"welcome: backend_log"
    993995    benvingut: log backend
     996"welcome: frontends"
    994997"welcome: music"
    995998    benvingut: música
    996999"welcome: settings"
  • mythweb/modules/_shared/lang/Spanish.lang

     
    325325    id frecuencia
    326326"Friday"
    327327    Viernes
     328"Frontend Status"
     329"Frontends"
    328330"generic_date"
    329331    %b %e, %Y
    330332"generic_time"
     
    988990    Miércoles
    989991"welcome: backend_log"
    990992    bienvenido: log backend
     993"welcome: frontends"
    991994"welcome: music"
    992995    bienvenido: música
    993996"welcome: settings"
  • mythweb/modules/_shared/lang/French.lang

     
    279279"freqid"
    280280"Friday"
    281281    Vendredi
     282"Frontend Status"
     283"Frontends"
    282284"generic_date"
    283285    %e %b, %Y
    284286"generic_time"
     
    846848"Wednesday"
    847849    Mercredi
    848850"welcome: backend_log"
     851"welcome: frontends"
    849852"welcome: music"
    850853"welcome: settings"
    851854"welcome: stats"
  • mythweb/modules/_shared/lang/Swedish.lang

     
    406406    frekvens-id
    407407"Friday"
    408408    Fredag
     409"Frontend Status"
     410"Frontends"
    409411"generic_date"
    410412    %Y-%m-%d
    411413"generic_time"
     
    11891191    Onsdag
    11901192"welcome: backend_log"
    11911193    Visa serverloggarna.
     1194"welcome: frontends"
    11921195"welcome: music"
    11931196    BlÀddra i din musiksamling.
    11941197"welcome: settings"
  • mythweb/modules/_shared/lang/Danish.lang

     
    320320    Frekvens ID
    321321"Friday"
    322322    Fredag
     323"Frontend Status"
     324"Frontends"
    323325"generic_date"
    324326    %a %e %b %Y
    325327"generic_time"
     
    956958    Onsdag
    957959"welcome: backend_log"
    958960    Velkommen: Backend_log
     961"welcome: frontends"
    959962"welcome: music"
    960963    Velkommen: Musik
    961964"welcome: settings"
  • mythweb/modules/_shared/lang/Dutch.lang

     
    313313    frequentie
    314314"Friday"
    315315    Vrijdag
     316"Frontend Status"
     317"Frontends"
    316318"generic_date"
    317319    %a %e %b, %Y
    318320"generic_time"
     
    943945    Woensdag
    944946"welcome: backend_log"
    945947    Logboek laten zien
     948"welcome: frontends"
    946949"welcome: music"
    947950    Doorheen uw muziekcollectie bladeren
    948951"welcome: settings"
  • mythweb/modules/_shared/lang/German.lang

     
    313313    Kanal
    314314"Friday"
    315315    Freitag
     316"Frontend Status"
     317"Frontends"
    316318"generic_date"
    317319    %e.%m.%Y
    318320"generic_time"
     
    943945    Mittwoch
    944946"welcome: backend_log"
    945947    Backend Log
     948"welcome: frontends"
    946949"welcome: music"
    947950    Musik
    948951"welcome: settings"
  • mythweb/modules/_shared/lang/Japanese.lang

     
    314314    呚波数ID
    315315"Friday"
    316316    金曜日
     317"Frontend Status"
     318"Frontends"
    317319"generic_date"
    318320    %Y %b %e
    319321"generic_time"
     
    957959    氎曜日
    958960"welcome: backend_log"
    959961    バック゚ンドログようこそ
     962"welcome: frontends"
    960963"welcome: music"
    961964    ミュヌゞックようこそ
    962965"welcome: settings"
  • mythweb/modules/_shared/lang/English.lang

     
    212212"Found %s results for '%s'"
    213213"freqid"
    214214"Friday"
     215"Frontend Status"
     216"Frontends"
    215217"generic_date"
    216218    %a %b %e, %Y
    217219"generic_time"
     
    703705"Wednesday"
    704706"welcome: backend_log"
    705707    Show the server logs.
     708"welcome: frontends"
     709    See frontend status and remote control
    706710"welcome: music"
    707711    Browse your music collection.
    708712"welcome: settings"
  • mythweb/modules/_shared/lang/Czech.lang

     
    248248"freqid"
    249249"Friday"
    250250    Pátek
     251"Frontend Status"
     252"Frontends"
    251253"generic_date"
    252254    %a %b %e, %Y
    253255"generic_time"
     
    763765    Středa
    764766"welcome: backend_log"
    765767    Show the server logs.
     768"welcome: frontends"
    766769"welcome: music"
    767770    Browse your music collection.
    768771"welcome: settings"
  • mythweb/modules/_shared/lang/Finnish.lang

     
    305305"freqid"
    306306"Friday"
    307307    Perjantai
     308"Frontend Status"
     309"Frontends"
    308310"generic_date"
    309311    %a %b %e, %Y
    310312"generic_time"
     
    922924    Keskiviikko
    923925"welcome: backend_log"
    924926    tervetuloa: lokit
     927"welcome: frontends"
    925928"welcome: music"
    926929    tervetuloa: musiikki
    927930"welcome: settings"
  • mythweb/modules/_shared/lang/Slovenian.lang

     
    273273"freqid"
    274274"Friday"
    275275    Petek
     276"Frontend Status"
     277"Frontends"
    276278"generic_date"
    277279    %e.%m.%Y
    278280"generic_time"
     
    836838"Wednesday"
    837839    Sreda
    838840"welcome: backend_log"
     841"welcome: frontends"
    839842"welcome: music"
    840843"welcome: settings"
    841844"welcome: stats"