<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.linuxmce.org/index.php?action=history&amp;feed=atom&amp;title=WebServiceSource</id>
	<title>WebServiceSource - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.linuxmce.org/index.php?action=history&amp;feed=atom&amp;title=WebServiceSource"/>
	<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=WebServiceSource&amp;action=history"/>
	<updated>2026-07-22T02:58:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=WebServiceSource&amp;diff=22536&amp;oldid=prev</id>
		<title>Caiman at 21:06, 28 February 2010</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=WebServiceSource&amp;diff=22536&amp;oldid=prev"/>
		<updated>2010-02-28T21:06:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:06, 28 February 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This script needs to be placed in /var/www/lmce-ws/index.rb&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This script needs to be placed in /var/www/lmce-ws/index.rb&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/ruby&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/ruby&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l78&quot;&gt;Line 78:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 78:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Caiman</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=WebServiceSource&amp;diff=22535&amp;oldid=prev</id>
		<title>Caiman: New page: This script needs to be placed in /var/www/lmce-ws/index.rb  &lt;nowiki&gt;  #!/usr/bin/ruby  require &#039;rubygems&#039; require &#039;json&#039; require &#039;cgi&#039; require &#039;mysql&#039;  def hashresult(query) # Execute SQL...</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=WebServiceSource&amp;diff=22535&amp;oldid=prev"/>
		<updated>2010-02-28T21:04:59Z</updated>

		<summary type="html">&lt;p&gt;New page: This script needs to be placed in /var/www/lmce-ws/index.rb  &amp;lt;nowiki&amp;gt;  #!/usr/bin/ruby  require &amp;#039;rubygems&amp;#039; require &amp;#039;json&amp;#039; require &amp;#039;cgi&amp;#039; require &amp;#039;mysql&amp;#039;  def hashresult(query) # Execute SQL...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This script needs to be placed in /var/www/lmce-ws/index.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/ruby&lt;br /&gt;
&lt;br /&gt;
require &amp;#039;rubygems&amp;#039;&lt;br /&gt;
require &amp;#039;json&amp;#039;&lt;br /&gt;
require &amp;#039;cgi&amp;#039;&lt;br /&gt;
require &amp;#039;mysql&amp;#039;&lt;br /&gt;
&lt;br /&gt;
def hashresult(query)&lt;br /&gt;
# Execute SQL query and return result as an array, one entry per row&lt;br /&gt;
  # setup sql database&lt;br /&gt;
  db = Mysql.new(&amp;quot;localhost&amp;quot;, &amp;quot;root&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
  db.select_db(&amp;quot;pluto_main&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  result = db.query(query)&lt;br /&gt;
  arr = Array.new&lt;br /&gt;
  #result.each_hash(with_table=true) do |row|&lt;br /&gt;
  result.each do |row| &lt;br /&gt;
    arr &amp;lt;&amp;lt; row&lt;br /&gt;
  end&lt;br /&gt;
  return arr&lt;br /&gt;
end  &lt;br /&gt;
&lt;br /&gt;
def getlights()&lt;br /&gt;
# return list of lights (devices with (DeviceTemplate.FK_DeviceCategory = 73)&lt;br /&gt;
  query = &amp;quot;SELECT Device.PK_Device, Device.Description, Device.State, Device.FK_Room FROM Device,DeviceTemplate WHERE (Device.FK_DeviceTemplate = DeviceTemplate.PK_DeviceTemplate) AND (DeviceTemplate.FK_DeviceCategory = 73) ORDER BY PK_Device ASC&amp;quot;&lt;br /&gt;
  return hashresult(query)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def getrooms()&lt;br /&gt;
  # return list of all rooms&lt;br /&gt;
  query = &amp;quot;SELECT Room.PK_Room, Room.Description FROM Room ORDER BY Room.Description ASC&amp;quot;&lt;br /&gt;
  return hashresult(query)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def getscenarios()&lt;br /&gt;
  query = &amp;quot;SELECT CommandGroup.PK_CommandGroup, CommandGroup.Description, CommandGroup.Hint, CommandGroup.FK_Template, CommandGroup_Room.FK_Room&lt;br /&gt;
             FROM CommandGroup, CommandGroup_Room&lt;br /&gt;
             WHERE (CommandGroup_Room.FK_CommandGroup = CommandGroup.PK_CommandGroup)&lt;br /&gt;
             ORDER BY Sort ASC;&amp;quot;&lt;br /&gt;
  return hashresult(query)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def gettemplates()&lt;br /&gt;
  query = &amp;quot;&lt;br /&gt;
	SELECT PK_Template, Description&lt;br /&gt;
	FROM Template&lt;br /&gt;
	;&amp;quot;&lt;br /&gt;
  return hashresult(query)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def sendcommand(id,command)&lt;br /&gt;
 return `/usr/pluto/bin/MessageSend localhost 0 #{id} 1 #{command}`&lt;br /&gt;
end&lt;br /&gt;
	&lt;br /&gt;
# Send header to http client&lt;br /&gt;
puts &amp;quot;Content-type: text/html\r\n\r\n&amp;quot;&lt;br /&gt;
#puts &amp;quot;Content-type: application/json\r\n\r\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Process CGI arguments&lt;br /&gt;
c=CGI.new &lt;br /&gt;
cmd=c[&amp;#039;cmd&amp;#039;]&lt;br /&gt;
&lt;br /&gt;
return_obj = case cmd&lt;br /&gt;
  when &amp;#039;getLights&amp;#039; then getlights()&lt;br /&gt;
  when &amp;#039;getRooms&amp;#039; then getrooms()&lt;br /&gt;
  when &amp;#039;getScenarios&amp;#039; then getscenarios()&lt;br /&gt;
  when &amp;#039;getTemplates&amp;#039; then gettemplates()&lt;br /&gt;
  when &amp;#039;sendCommand&amp;#039; then sendcommand(c[&amp;#039;id&amp;#039;], c[&amp;#039;command&amp;#039;])&lt;br /&gt;
  else &amp;quot;use cmd=xxx where xxx is getLights, getRooms, getScenarios, getTemplates&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Send the return object as JSON&lt;br /&gt;
puts return_obj.to_json&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Caiman</name></author>
	</entry>
</feed>