예제 #1
0
            if ($show[$j] == $i)
               echo "<option value=$i selected>".$desc[$i][0]."</option>\n";
            else
               echo "<option value=$i>".$desc[$i][0]."</option>\n";
         }
      echo "</select>\n"; 
      echo "<select name=\"gtype[]\">";
      for ($i=0; $i < 40; $i++)
         if (isset($gtypes[$i])) {
            if ($gtype[$j] == $i)
               echo "<option value=$i selected>".$gtypes[$i][0]."</option>\n";
            else
               echo "<option value=$i>".$gtypes[$i][0]."</option>\n";
         }
      echo "</select>\n"; 
      color_picker("",3+$j); 
      echo "<br>\n"; 
   }

   echo "Debug: &nbsp;";
   //if ($debug) echo "<input type=checkbox name=debug checked> &nbsp;"; else
   echo "<input type=checkbox name=debug> &nbsp;";
   //if ($debug_src) echo "<input type=checkbox name=debug_src checked> &nbsp;"; else
   echo "<input type=checkbox name=debug_src> &nbsp;";
   echo "<input type=submit name=button onClick=\"this.form.target='_blank';this.form.filedesc.value='';var d=new Date(); document.myform.action='$SYSappname.php?'+d.getTime();\" value=\"Generate Graph\">\n";
   echo "<input type=submit name=download onClick=\"this.form.target='_blank';this.form.filedesc.value='';var d=new Date(); document.myform.action='$SYSappname.php?'+d.getTime();\" value=\"Download\">\n";
   echo "<input type=submit name=addline onClick=\"this.form.target='_self';this.form.filedesc.value='';\" value=\"Add Line\">\n";
   echo "<input type=submit name=removeline onClick=\"this.form.target='_self';this.form.filedesc.value='';\" value=\"Remove Line\">\n";
   echo "<input type=submit name=method onClick=\"this.form.target='_self';this.form.method='get';this.form.filedesc.value='';\" value=\"Get Full URL(to save)\">\n";
   //echo "</FORM><HR><FORM METHOD=GET ACTION=$SYSappname.php TARGET=_blank>";
   //echo "<input type=submit name=filedesc value=\"Get File Description\">\n";
예제 #2
0
    $partial_query = $control[1];
    result(array('title' => 'Turn off', 'icon' => 'icons/switch.png', 'autocomplete' => "{$id}:off", 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"on": false}'))));
    result(array('title' => 'Turn on', 'icon' => 'icons/switch.png', 'autocomplete' => "{$id}:on", 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"on": true}'))));
    result(array('title' => 'Set color...', 'icon' => 'icons/colors.png', 'valid' => 'no', 'autocomplete' => "{$id}:color:"));
    result(array('title' => 'Set effect...', 'icon' => 'icons/effect.png', 'valid' => 'no', 'autocomplete' => "{$id}:effect:"));
    result(array('title' => 'Set brightness...', 'icon' => 'icons/sun.png', 'valid' => 'no', 'autocomplete' => "{$id}:bri:"));
    result(array('title' => 'Set alert...', 'icon' => 'icons/siren.png', 'valid' => 'no', 'autocomplete' => "{$id}:alert:"));
    result(array('title' => 'Rename...', 'icon' => 'icons/cog.png', 'valid' => 'no', 'autocomplete' => "{$id}:rename:"));
} elseif (count($control) == 3) {
    $id = $control[0];
    $value = $control[2];
    if ($control[1] == 'bri') {
        result(array('title' => "Set brightness to {$value}", 'subtitle' => 'Set on a scale from 0 to 255, where 0 is off.', 'icon' => 'icons/sun.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => sprintf('{"bri": %d}', $value)))));
    } elseif ($control[1] == 'color') {
        if ($value == 'colorpicker') {
            color_picker($id);
        }
        result(array('title' => "Set color to {$value}", 'subtitle' => 'Accepts 6-digit hex colors or CSS literal color names (e.g. "blue")', 'icon' => 'icons/colors.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '', '_color' => $value))));
        result(array('title' => "Use color picker...", 'valid' => 'no', 'icon' => 'icons/eyedropper.png', 'autocomplete' => "{$id}:color:colorpicker"));
    } elseif ($control[1] == 'effect') {
        result(array('title' => 'None', 'icon' => 'icons/effect.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"effect": "none"}'))));
        result(array('title' => 'Color loop', 'icon' => 'icons/effect.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"effect": "colorloop"}'))));
    } elseif ($control[1] == 'alert') {
        result(array('title' => 'None', 'subtitle' => 'Turn off any ongoing alerts', 'icon' => 'icons/siren.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"alert": "none"}'))));
        result(array('title' => 'Blink once', 'icon' => 'icons/siren.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"alert": "select"}'))));
        result(array('title' => 'Blink for 30 seconds', 'icon' => 'icons/siren.png', 'arg' => api_arg(array('url' => "/lights/{$id}/state", 'data' => '{"alert": "lselect"}'))));
    } elseif ($control[1] == 'rename') {
        result(array('title' => "Set light name to {$value}", 'arg' => api_arg(array('url' => "/lights/{$id}", 'data' => sprintf('{"name": "%s"}', $value)))));
    }
} else {
    $partial_query = $query;