Changeset 88bbc1410b52d4b669c54abc42f68c5677c3b951

Show
Ignore:
Timestamp:
03/15/08 00:46:38 (10 months ago)
Author:
KRKeegan <-NOSPAM-kevin@krkeegan.com>
git-committer:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1205559998 -0700
git-parent:

[4d2469c7e4af30574a75287c0c43f50b184c1d98]

git-author:
KRKeegan <-NOSPAM-kevin@krkeegan.com> 1205559998 -0700
Message:

Add form to change MAK and save path

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/admin/admin.py

    re5ddd2a r88bbc14  
    3030        config.reset() 
    3131        handler.server.reset() 
     32        if 'last_page' in query: 
     33            last_page = query['last_page'][0] 
     34        else: 
     35            last_page = 'Admin' 
    3236         
    3337        subcname = query['Container'][0] 
     
    3842        t.container = cname 
    3943        t.time = '3' 
    40         t.url = '/TiVoConnect?Command=Admin&Container=' + cname 
     44        t.url = '/TiVoConnect?Command='+ last_page +'&Container=' + cname 
    4145        t.text = '<h3>The pyTivo Server has been soft reset.</h3>  <br>pyTivo has reloaded the pyTivo.conf'+\ 
    4246                 'file and all changed should now be in effect. <br> The'+ \ 
    43                  '<a href="/TiVoConnect?Command=Admin&Container='+ cname +'"> Admin</a> page will reload in 3 seconds.' 
     47                 '<a href="/TiVoConnect?Command='+ last_page +'&Container='+ cname +'"> previous</a> page will reload in 3 seconds.' 
    4448        handler.wfile.write(t) 
    4549     
     
    147151                else: 
    148152                    tivo_mak = "" 
     153                if 'togo_path' in data: 
     154                    togo_path = data['togo_path'] 
     155                else: 
     156                    togo_path = "" 
    149157 
    150158        if 'TiVo' in query: 
     
    225233            tivoIP = '' 
    226234 
    227         print len(data) 
    228235        subcname = query['Container'][0] 
    229236        cname = subcname.split('/')[0] 
     
    233240        t.folder = folder 
    234241        t.status = status 
    235         print handler.tivos 
     242        t.tivo_mak = tivo_mak 
     243        t.togo_path = togo_path 
    236244        t.tivos = handler.tivos 
    237245        t.tivoIP = tivoIP 
     
    349357                 '<br> The <a href="/TiVoConnect?Command=NPL&Container='+ cname + '&TiVo=' + query['TiVo'][0] + '&Folder=' + query['Folder'][0] +'"> ToGo</a> page will reload in 3 seconds.' 
    350358        handler.wfile.write(t) 
     359 
     360 
     361    def SaveNPL(self, handler, query): 
     362        config = ConfigParser.ConfigParser() 
     363        config.read(config_file_path) 
     364        if 'tivo_mak' in query: 
     365            config.set(query['Container'][0], 'tivo_mak', query['tivo_mak'][0]) 
     366        if 'togo_path' in query: 
     367            config.set(query['Container'][0], 'togo_path', query['togo_path'][0])                  
     368        f = open(config_file_path, "w") 
     369        config.write(f) 
     370        f.close() 
     371 
     372        subcname = query['Container'][0] 
     373        cname = subcname.split('/')[0] 
     374        handler.send_response(200) 
     375        handler.end_headers() 
     376        t = Template(file=os.path.join(SCRIPTDIR,'templates', 'redirect.tmpl')) 
     377        t.container = cname 
     378        t.time = '2' 
     379        t.url = '/TiVoConnect?last_page=NPL&Command=Reset&Container=' + cname 
     380        t.text = '<h3>Your Settings have been saved.</h3>  <br>You settings have been saved to the pyTivo.conf file.'+\ 
     381                 'pyTivo will now do a <b>Soft Reset</b> to allow these changes to take effect.'+\ 
     382                 '<br> The <a href="/TiVoConnect?last_page=NPL&Command=Reset&Container='+ cname +'"> Reset</a> will occur in 2 seconds.' 
     383        handler.wfile.write(t) 
  • plugins/admin/templates/npl.tmpl

    r4d2469c r88bbc14  
    110110          #else 
    111111                  <!-- No TiVo IP Provided so display instructions --> 
     112                  <form method="get" action="/TiVoConnect"> 
     113                  <input type="hidden" name="Command" value="SaveNPL"> 
     114                  <input type="hidden" name="Container" value="$container"> 
     115                  <table align='right' style="border: 1px solid rgb(220, 220, 220);"> 
     116                  <tr><td colspan=2 align='center'><b>ToGo Settings</b></td></tr> 
     117                  <tr><td>MAK:</td><td><input type='text' name="tivo_mak" value="$tivo_mak"></td></tr> 
     118                  <tr><td>Save Path:</td><td><input type='text' name="togo_path" value="$togo_path"></td></tr> 
     119                  <tr><td colspan=2 align="center"><input type="submit" value="Save Settings"></td></tr> 
     120                  </table></form> 
     121                   
    112122                  <h2>Instructions</h2> 
    113123