Commits

Guido Draheim  committed 0fb23a5

fix newentry

  • Participants
  • Parent commits a1d8109

Comments (0)

Files changed (4)

File src/dvbcronrecording/channelsconf.py

             data = {}
             data['title'] = translate("Saved")
             data['messages'] = ['(%s)' % text, result]
+            data["adapter"] = req.args.get("adapter", None)
             data['adapterlist'] = self._adapter_list(req)
             data['text'] = self.loadtext(req)
             data['_'] = translate
             data = {}
             data['title'] = translate("Edit")
             data['messages'] = [ translate('use the traditional dvbscan/zap syntax') ]
+            data["adapter"] = req.args.get("adapter", None)
             data['adapterlist'] = self._adapter_list(req)
             data['text'] = self.loadtext(req)
             data['_'] = translate
             data = {}
             data['title'] = translate("Takeover")
             data['messages'] = [ "" ]
+            data["adapter"] = req.args.get("adapter", None)
             data['adapterlist'] = self._adapter_list(req)
             data["_pagenum"] = req.args.get("_pagenum", "0")
             data["_pagesize"] = req.args.get("_pagesize", "10")
         data['message'] = message
         data['title'] = translate('Channel List')
         data['polaritylist'] = polaritylist
+        data["adapter"] = req.args.get("adapter", None)
         data['adapterlist'] = self._adapter_list(req)
         data["channeltype"] = channeltype
         data["channeltypelist"] = channeltypelist
         _ = ['adapter', 'title','frequency','polarity','source','symbolrate','vpid', 'apid', 'tpid']
         translate = Translate(PACKAGE, req.locale)
         defs = {}
-        defs["adapter"] = "0"
+        defs["adapter"] = req.args.get("adapter", "0")
         defs["title"] = translate.get("-new-channel", "NEW CHANNEL")
         defs["frequency"] = translate.get("-new-frequency", "12000")
         defs["polarity"] = translate.get("-new-polarity", "H")
     """
     def _channelsconf_append(self, req):
         item = RecordingChannelsConf()
-        item.frequency = req.args("frequency")
-        item.polarity = req.args("polarity")
-        item.source = req.args("source")
-        item.symbolrate = req.args("symbolrate")
-        item.vpid = req.args("vpid")
-        item.apid = req.args("apid")
-        item.tpid = req.args("tpid")
+        item.adapter = req.args.get("adapter","0")
+        item.frequency = req.args.get("frequency")
+        item.polarity = req.args.get("polarity")
+        item.source = req.args.get("source")
+        item.symbolrate = req.args.get("symbolrate")
+        item.vpid = req.args.get("vpid")
+        item.apid = req.args.get("apid")
+        item.tpid = req.args.get("tpid")
         item.title = req.args.get("newtitle")
+        value = "%s:%s" % (item.adapter, item.title)
         session = db_cnx(self.env)
         session.add(item)
         session.flush() 
-        return "OK"
+        return "OK(%s)"+value
 
     """
       Updates an entry in the channels.conf list

File src/dvbcronrecording/htdocs/css/dvbcronrecording.css

 }
 .recordingpages .activate a { padding: 5px 1em; }
 .recordingpages .planning a { padding: 2px 2em; }
+
+.channelsconfpages { display: block; margin: 0.5em 2px; padding: 0.5em 0em; }
+.channelsconfpages li { display: inline; margin: 0 0; padding: 0 0; }
+.channelsconfpages a { color: black; font-weight: bold; text-decoration: none;
+        padding: 2px 1em;
+       border: 1px outset gray; background-color: #EEE;
+}

File src/dvbcronrecording/templates/channelsconf_list.html

   <xi:include href="channelsconf_nav.html" />
   <div class="actionlist">
                   &nbsp; &nbsp; &nbsp; &nbsp;
-          <form method="get" action="${href.recording('channelsconf/list')}" class="actionform">
+          <form method="post" action="${href.recording('channelsconf/list')}" class="actionform">
             <select name="adapter">
-                <option py:for="adapter in sorted(adapterlist)" 
-                        value="${adapter}">
-                        ${adapter}
+                <option py:for="adapter1 in sorted(adapterlist)" 
+                        selected="${adapter1 == adapter or None}" 
+                        value="${adapter1}"
+                        >${adapter1}
                 </option>
             </select>
             <input type="submit" value="${_('channel subselection')}" class="actionbutton"></input>
             <label for="channeltype">${_('channel type')}:
             </label><select name="channeltype">
-                <option py:for="name in channeltypelist" value="${name}" 
-                    selected="${name == channeltype or None}">${_(name)}</option>
+                <option py:for="name in channeltypelist" 
+                        value="${name}" 
+                        selected="${name == channeltype or None}"
+                        >${_(name)}</option>
             </select>
           </form>
           <br /> &nbsp; &nbsp; &nbsp; &nbsp;
-          <form method="get" action="${href.recording('channelsconf/edit')}" class="actionform">
+          <form method="post" action="${href.recording('channelsconf/edit')}" class="actionform">
             <select name="adapter">
-                <option py:for="adapter in sorted(adapterlist)" 
-                        value="${adapter}">
-                        ${adapter}
+                <option py:for="adapter1 in sorted(adapterlist)"
+                        selected="${adapter1 == adapter or None}" 
+                        value="${adapter1}">
+                        ${adapter1}
                 </option>
             </select>
             <input type="submit" value="${_('channels.conf editor')}" class="actionbutton"></input>
       <th>${_('action buttons')}</th>
       <th>-&nbsp;</th>
       </tr>
-      
+
+    <!-- ______________________ NEW _______________________ -->      
     <py:if test="perm.has_permission('DVBREC_CHANNELSCONF_EDIT')">
   <div py:for="item in new_datalist">
-    <form method="post" action="${href.channels('newentry')}">
+    <form method="post" action="${href.recording('channelsconf/newentry')}">
       <tr>
       <td class="id new">${_('NEW')}</td>
       <td class="adapter">
            <select name="adapter">
-                <option py:for="adapter in sorted(adapterlist)" 
-                        value="${adapter}">
-                        ${adapter}
+                <option py:for="adapter1 in sorted(adapterlist)" 
+                        selected="${adapter1 == adapter or None}" 
+                        value="${adapter1}">
+                        ${adapter1}
                 </option>
             </select>
        </td>      
        <td class="title">
-          <input type="text" name="title" value="${item.title}"></input>
+          <input type="text" name="newtitle" value="${item.title}"></input>
       </td>
       <td class="frequency"><input type="text" name="frequency" value="${item.frequency}"></input></td>
       <td class="polarity"><select name="polarity">
      </form>    
   </div>    
     </py:if>
+    <!-- ______________________ /NEW _______________________ -->      
 
   <div py:for="item in datalist">
   <form method="post" action="${href.channels('update')}">
     <tr class="status${item.status}">
       <td class="id">
         <py:if test="perm.has_permission('DVBREC_CHANNELSCONF_EDIT')">
-           <span  py:with="item_adapter = quote_plus(item.adapter); item_title = quote_plus(item.title)">
+           <span  py:with="item_adapter = quote_plus(item and item.adapter or '0'); item_title = quote_plus(item and item.title or '')">
               <a href="${href.recording('channelsconf/delete')}?adapter=${item_adapter}&amp;title=${item_title}">
                 <span class="delete">
                    &#x2716;
         </py:if>              
        </td>
       <td class="adapter"><select name="adapter">
-                <option py:for="adapter in sorted(adapterlist)" 
-                        value="${adapter}">
-                        ${adapter}
+                <option py:for="adapter1 in sorted(adapterlist)" 
+                        selected="${adapter1 == adapter or None}" 
+                        value="${adapter1}">
+                        ${adapter1}
         </option></select>
       </td>
       <td class="title">
       <td class="vpid"><input type="text" name="vpid" value="${item.vpid}"></input></td>
       <td class="apid"><input type="text" name="apid" value="${item.apid}"></input></td>
       <td class="tpid"><input type="text" name="tpid" value="${item.tpid}"></input></td>
-      <td class="action" py:with="item_adapter = quote_plus(item.adapter) ;  item_title = quote_plus(item.title)">
+      <td class="action" py:with="item_adapter = quote_plus(item and item.adapter or '0') ;  item_title = quote_plus(item and item.title or '')">
         <py:if test="perm.has_permission('DVBREC_CHANNELSCONF_EDIT')">
           <input type="submit" value="${_('update')}" class="actionbutton"></input>
         </py:if>
       </td><td>
         <py:if test="perm.has_permission('DVBREC_CHANNELS_EDIT')">
-          <span  class="deletebutton" py:with="item_adapter = quote_plus(item.adapter); item_title = quote_plus(item.title)">
+          <span  class="deletebutton" py:with="item_adapter = quote_plus(item and item.adapter or '0'); item_title = quote_plus(item and item.title or '')">
             <a href="${href.recording('channelsconf/takeover')}?adapter=${item_adapter}&amp;title=${item_title}">${_("takeover")}</a>
           </span>
         </py:if>

File src/dvbcronrecording/templates/channelsconf_nav.html

-  <div class="actionlist">
-          <form method="get" action="${href.recording('channelsconf/list/video')}" class="actionform">
-            <input type="submit" value="${_('video channels')}" class="actionbutton"></input>
-          </form>
-          <form method="get" action="${href.recording('channelsconf/list/radio')}" class="actionform">
-            <input type="submit" value="${_('radio channels')}" class="actionbutton"></input>
-          </form>
-          <form method="get" action="${href.recording('channelsconf/list')}" class="actionform">
-            <input type="submit" value="${_('channel.conf show')}" class="actionbutton"></input>
-          </form>
-          &nbsp;
-          <form method="get" action="${href.recording('channeltuning/list')}" class="actionform">
-            <input type="submit" value="${_('tuning list')}" class="actionbutton"></input>
-          </form>
-  </div>
+  <ul class="channelsconfpages">
+        <li><a href="${href.recording('channelsconf/list/video')}">${_('video channels')}</a></li>
+        <li><a href="${href.recording('channelsconf/list/radio')}">${_('radio channels')}</a></li>
+        <li><a href="${href.recording('channelsconf/list')}">${_('channel.conf show')}</a></li>
+        <li>&nbsp;<a href="${href.recording('channeltuning/list')}">${_('tuning list')}</a></li>
+  </ul>