$def with (m_vals) $var title: $_(u'SIP - Relay Board Settings') $var page: plugins <script> // Initialize behaviors jQuery(document).ready(function(){ jQuery("#cSubmit").click(function() { jQuery("#pluginForm").submit(); }); jQuery("button#cCancel").click(function(){ window.location="/"; }); jQuery("button#docButton").click(function(){ window.open("https://github.com/KanyonKris/relay_board/wiki", "_blank"); //Edit: replace "proto-docs.html" }) }); </script> <div id="plugin"> <div class="title">$_(u'Relay Board Settings') <button class="execute" id="docButton" type="button" >$_(u'Help')</button> </div> <p>$_(u'A plugin for using relay boards to control sprinkler valves.') </p> <br> <form id="pluginForm" action="/rbu" method="get"> <div class='option' title='Number of relays connected to the Raspberry Pi (relay boards are commonly 2, 4, 8)'><span class='label'>$_(u'Relay channels'):</span> <select name="relays"> <option value="1" ${" selected" if m_vals[u"relays"]==1 else ""}>1</option> <option value="2" ${" selected" if m_vals[u"relays"]==2 else ""}>2</option> <option value="3" ${" selected" if m_vals[u"relays"]==3 else ""}>3</option> <option value="4" ${" selected" if m_vals[u"relays"]==4 else ""}>4</option> <option value="5" ${" selected" if m_vals[u"relays"]==5 else ""}>5</option> <option value="6" ${" selected" if m_vals[u"relays"]==6 else ""}>6</option> <option value="7" ${" selected" if m_vals[u"relays"]==7 else ""}>7</option> <option value="8" ${" selected" if m_vals[u"relays"]==8 else ""}>8</option> <option value="9" ${" selected" if m_vals[u"relays"]==9 else ""}>9</option> <option value="10" ${" selected" if m_vals[u"relays"]==10 else ""}>10</option> <option value="11" ${" selected" if m_vals[u"relays"]==11 else ""}>11</option> <option value="12" ${" selected" if m_vals[u"relays"]==12 else ""}>12</option> </select> <span class='tooltip'>$_(u'Number of relays connected to the Raspberry Pi /(relay boards are commonly 2, 4, 8/)')</span> </div> <div class='option' title='Active low means the relay turns on when the input is low and turns off when the input is high. Active high does the opposite.'><span class='label'>$_(u'Active'):</span> <input type="radio" name="active" value="low" ${" checked" if m_vals[u"active"]==u"low" else u""}>$_('Low') <input type="radio" name="active" value="high" ${" checked" if m_vals[u"active"]==u"high" else u""}>$_('High') <span class='tooltip'>$_('Active low means the relay turns on when the input is low and turns off when the input is high. Active high does the opposite.')</span> </div> <br> <p><b>$_(u'IMPORTANT'):</b> $_(u'If') <b>$_(u'Active')</b> $_(u'is changed'), <b>$_(u'Relay channels')</b> $_(u'will be set to') <b>1</b> $_(u'to prevent all the relays being switched on, and possibly damaging the power supply.') $_(u'After verifying that the first relay is off, return to this page and set') <b>$_(u'Relay channels')</b> $_(u'to the correct number.') </p> </form> </div> <div class="controls"> <button id="cSubmit" class="submit"><b>$_(u'Submit')</b></button> <button id="cCancel" class="cancel danger">$_(u'Cancel')</button> </div>