Skip to content

Commit 5177b65

Browse files
committed
New OpenEnergyMonitor Documentation Concept
0 parents  commit 5177b65

File tree

196 files changed

+11756
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+11756
-0
lines changed

.htaccess

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Apache/PHP/Emoncms settings:
3+
#
4+
5+
# Don't show directory listings for URLs which map to a directory.
6+
Options -Indexes
7+
8+
# Make Drupal handle any 404 errors.
9+
ErrorDocument 404 /index.php
10+
11+
# Set the default handler.
12+
DirectoryIndex index.php
13+
14+
# Various rewrite rules.
15+
<IfModule mod_rewrite.c>
16+
RewriteEngine on
17+
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
18+
19+
RewriteCond %{REQUEST_FILENAME} !-f
20+
RewriteCond %{REQUEST_FILENAME} !-d
21+
RewriteCond %{REQUEST_URI} !=/favicon.ico
22+
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
23+
</IfModule>
24+
25+
<Files 403.shtml>
26+
order allow,deny
27+
allow from all
28+
</Files>
29+

License

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
All documentation on OpenEnergyMonitor is subject to GNU Free Documentation License

changelinks.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
die;
4+
5+
$result = scandir("view");
6+
for ($i=2; $i<count($result); $i++) {
7+
$dir = $result[$i];
8+
$nicename = str_replace("-"," ",$dir);
9+
if (is_dir("view/$dir")) {
10+
11+
$l2 = scandir("view/$dir");
12+
for ($i2=2; $i2<count($l2); $i2++) {
13+
$dir2 = $l2[$i2];
14+
$nicename = str_replace("-"," ",$dir2);
15+
16+
if (is_dir("view/$dir/$dir2")) {
17+
18+
$l3 = scandir("view/$dir/$dir2");
19+
for ($i3=2; $i3<count($l3); $i3++) {
20+
$dir3 = $l3[$i3];
21+
$nicename = str_replace("-"," ",$dir3);
22+
$nicename = str_replace(".html","",$nicename);
23+
$nicename = str_replace(".php","",$nicename);
24+
if (is_file("view/$dir/$dir2/$dir3")) {
25+
$body = file_get_contents("view/$dir/$dir2/$dir3");
26+
$body = str_replace("https://openenergymonitor.org/emon/sites/default/","http://localhost/docs/",$body);
27+
echo "view/$dir/$dir2/$dir3\n";
28+
$fh = fopen("view/$dir/$dir2/$dir3","w");
29+
fwrite($fh,$body);
30+
fclose($fh);
31+
}
32+
}
33+
echo "</ul></div>";
34+
}
35+
}
36+
echo "</div>";
37+
}
38+
}

core.php

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
3+
/*
4+
5+
All Emoncms code is released under the GNU Affero General Public License.
6+
See COPYRIGHT.txt and LICENSE.txt.
7+
8+
---------------------------------------------------------------------
9+
Emoncms - open source energy visualisation
10+
Part of the OpenEnergyMonitor project:
11+
http://openenergymonitor.org
12+
13+
*/
14+
15+
// no direct access
16+
17+
function get_application_path()
18+
{
19+
// Default to http protocol
20+
$proto = "http";
21+
22+
// Detect if we are running HTTPS or proxied HTTPS
23+
if (server('HTTPS') == 'on') {
24+
// Web server is running native HTTPS
25+
$proto = "https";
26+
} elseif (server('HTTP_X_FORWARDED_PROTO') == "https") {
27+
// Web server is running behind a proxy which is running HTTPS
28+
$proto = "https";
29+
}
30+
31+
if( isset( $_SERVER['HTTP_X_FORWARDED_SERVER'] ))
32+
$path = dirname("$proto://" . server('HTTP_X_FORWARDED_SERVER') . server('SCRIPT_NAME')) . "/";
33+
else
34+
$path = dirname("$proto://" . server('HTTP_HOST') . server('SCRIPT_NAME')) . "/";
35+
36+
return $path;
37+
}
38+
39+
function controller($controller_name)
40+
{
41+
$output = array('content'=>"#UNDEFINED#");
42+
43+
if ($controller_name)
44+
{
45+
$controller = $controller_name."_controller";
46+
$controllerScript = "Modules/".$controller_name."/".$controller.".php";
47+
if (is_file($controllerScript))
48+
{
49+
// Load language files for module
50+
$domain = "messages";
51+
bindtextdomain($domain, "Modules/".$controller_name."/locale");
52+
bind_textdomain_codeset($domain, 'UTF-8');
53+
textdomain($domain);
54+
55+
require_once $controllerScript;
56+
$output = $controller();
57+
}
58+
}
59+
return $output;
60+
}
61+
62+
function view($filepath, array $args)
63+
{
64+
extract($args);
65+
ob_start();
66+
include "$filepath";
67+
$content = ob_get_clean();
68+
return $content;
69+
}
70+
71+
function get($index)
72+
{
73+
$val = null;
74+
if (isset($_GET[$index])) $val = $_GET[$index];
75+
76+
if (get_magic_quotes_gpc()) $val = stripslashes($val);
77+
return $val;
78+
}
79+
80+
function post($index)
81+
{
82+
$val = null;
83+
if (isset($_POST[$index])) $val = $_POST[$index];
84+
85+
if (get_magic_quotes_gpc()) $val = stripslashes($val);
86+
return $val;
87+
}
88+
89+
function prop($index)
90+
{
91+
$val = null;
92+
if (isset($_GET[$index])) $val = $_GET[$index];
93+
if (isset($_POST[$index])) $val = $_POST[$index];
94+
95+
if (get_magic_quotes_gpc()) $val = stripslashes($val);
96+
return $val;
97+
}
98+
99+
function server($index)
100+
{
101+
$val = null;
102+
if (isset($_SERVER[$index])) $val = $_SERVER[$index];
103+
return $val;
104+
}

files/3-phase-power.png

25.3 KB

files/FP1.jpg

49.2 KB

files/GitDownload.png

62.9 KB

files/IDE1.6.7_structure.png

11.1 KB

files/IdealPower_Phase.2.png

3.9 KB

files/IdealPower_Phase_scope.2.png

88.8 KB

files/Irms.png

4.58 KB

files/KST02_0.png

62.8 KB

files/Libraries2_Win10.png

20.8 KB

files/MW1.jpg

49.7 KB

files/N_America_Sentran_dims.png

24.6 KB

files/RFM%20Radios.png

124 KB

files/SCT-1250_CT.jpg

4.6 KB

files/Stontronics1.jpg

28.9 KB

files/Trolley.png

2.47 KB

files/apparentpower.png

5.03 KB

files/appliancelist2.png

104 KB

files/calc_cop_vs_measured.png

224 KB

files/comparison.jpg

122 KB

files/current.png

4.04 KB

files/current100a.jpg

50.8 KB

files/current_stack.png

5.04 KB

files/currentvoltage_bb.jpg

33.4 KB

files/diffequation.png

4.22 KB

files/difference.png

3.87 KB

files/dynamicheatingmodel.png

101 KB

files/emontx_to_pi_serial.JPG

196 KB

files/energycontext.png

803 KB

files/equation1.png

7 KB

files/equation2.png

5.44 KB

files/equation3.png

6.67 KB

files/espr.png

28.5 KB

files/firmware01.jpg

44.1 KB

files/firmware02.jpg

28.6 KB

files/firmware03.jpg

36.6 KB

files/firmware04.jpg

43.7 KB

files/future_scenario.png

115 KB

files/future_stack.png

3.76 KB

files/futurelist.png

97.1 KB

files/gettingstarted_Arduino_03.png

106 KB

files/group_current.png

112 KB

files/groupview.png

87 KB

files/install_arduino_lib_4.png

141 KB

files/instvi.png

81.7 KB

files/kstpulse.png

87.2 KB

files/libraries_p2.png

130 KB

files/libraries_p3.png

134 KB

files/mascot1.jpg

49.6 KB

files/meters-incomers.png

369 KB

files/myhomeenergyplanner.png

445 KB

files/openbemsim.png

407 KB

files/optical_pulse.JPG

45.1 KB

files/past_stack.png

4.77 KB

files/pastlist.png

88.8 KB

files/pf01.png

4.07 KB

files/pf_0.png

6.9 KB

files/piplusemontx.JPG

168 KB

files/psLapLamp_0.png

28.2 KB

files/pulsetest.JPG

76.1 KB

files/rcsimdiagram_0.png

2.86 KB

files/reactive.jpg

101 KB

files/resistive2.jpg

81.1 KB

files/revpower.png

59.6 KB

files/rtdsensor.jpg

33.9 KB

files/sampler.png

12.2 KB

files/stack_zcb.png

29.2 KB

files/stacks2012_01.png

42.8 KB

files/stacks2012_02.png

42.2 KB

files/tesla.jpg

16.9 KB

files/threshold.png

18.9 KB

files/topa.png

57.3 KB

files/ukgrid.png

246 KB

files/unbalanced-load.png

29.8 KB

files/view02.png

35.4 KB

files/voltageDivider.jpg

9.12 KB

files/zcbmodel.png

345 KB

files/zerocarbonenergymodeling.png

416 KB

imglist.php

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
die;
3+
4+
$result = scandir("view");
5+
for ($i=2; $i<count($result); $i++) {
6+
$dir = $result[$i];
7+
$nicename = str_replace("-"," ",$dir);
8+
if (is_dir("view/$dir")) {
9+
10+
$l2 = scandir("view/$dir");
11+
for ($i2=2; $i2<count($l2); $i2++) {
12+
$dir2 = $l2[$i2];
13+
$nicename = str_replace("-"," ",$dir2);
14+
15+
if (is_dir("view/$dir/$dir2")) {
16+
17+
$l3 = scandir("view/$dir/$dir2");
18+
for ($i3=2; $i3<count($l3); $i3++) {
19+
$dir3 = $l3[$i3];
20+
$nicename = str_replace("-"," ",$dir3);
21+
$nicename = str_replace(".html","",$nicename);
22+
$nicename = str_replace(".php","",$nicename);
23+
if (is_file("view/$dir/$dir2/$dir3")) {
24+
$body = file_get_contents("view/$dir/$dir2/$dir3");
25+
26+
$results = array();
27+
strpos_recursive($body,".gif",0,$results);
28+
foreach ($results as $line) {
29+
print $line." ";
30+
31+
if (file_exists("files/$line")) {
32+
print "ok";
33+
exec("cp files/$line f2/$line");
34+
}
35+
36+
print "\n";
37+
}
38+
}
39+
}
40+
echo "</ul></div>";
41+
}
42+
}
43+
echo "</div>";
44+
}
45+
}
46+
47+
function strpos_recursive($haystack, $needle, $offset = 0, &$results = array()) {
48+
$offset = strpos($haystack, $needle, $offset);
49+
if($offset === false) {
50+
return $results;
51+
} else {
52+
$maxlen = 200;
53+
$str = substr($haystack,$offset-$maxlen,$maxlen+4);
54+
$parts = explode("/",$str);
55+
$results[] = $parts[count($parts)-1];
56+
return strpos_recursive($haystack, $needle, ($offset + 1), $results);
57+
}
58+
}

index.php

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/*
3+
4+
All Emoncms code is released under the GNU Affero General Public License.
5+
See COPYRIGHT.txt and LICENSE.txt.
6+
7+
---------------------------------------------------------------------
8+
Emoncms - open source energy visualisation
9+
Part of the OpenEnergyMonitor project:
10+
http://openenergymonitor.org
11+
12+
*/
13+
14+
error_reporting(E_ALL);
15+
ini_set('display_errors', 'on');
16+
17+
require("core.php");
18+
$path = get_application_path();
19+
20+
$q = "";
21+
if (isset($_GET['q'])) $q = $_GET['q'];
22+
//$q = rtrim($q,"/");
23+
24+
$format = "html";
25+
$content = "Sorry page not found";
26+
27+
$format = "html";
28+
if (file_exists("view/".$q)) {
29+
$content = view("view/".$q,array());
30+
}
31+
32+
if ($content=="Sorry page not found" && !$session) {
33+
$format = "html";
34+
$content = view("view/login.php",array());
35+
}
36+
37+
switch ($format)
38+
{
39+
case "html":
40+
header('Content-Type: text/html');
41+
print view("theme/theme.php", array("content"=>$content));
42+
break;
43+
case "text":
44+
header('Content-Type: text/plain');
45+
print $content;
46+
break;
47+
case "json":
48+
header('Content-Type: application/json');
49+
print json_encode($content);
50+
break;
51+
}

lib/jquery-1.11.3.min.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

theme/alert-icon.png

624 Bytes

theme/book.png

15.2 KB

theme/buttons.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.btn {
2+
text-align:center;
3+
height: 38px;
4+
padding:6px 10px;
5+
color:#fff;
6+
background: none;
7+
border-radius: 8px;
8+
border: 1px solid #fff;
9+
}
10+
11+
.btn:hover {
12+
background: rgba(255,255,255,0.2);
13+
cursor:pointer;
14+
}

theme/electricity-icon.png

5.68 KB

theme/expand.jpg

5.14 KB

theme/expand.png

22.6 KB

theme/forms.css

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* Forms
2+
–––––––––––––––––––––––––––––––––––––––––––––––––– */
3+
input[type="email"],
4+
input[type="number"],
5+
input[type="search"],
6+
input[type="text"],
7+
input[type="tel"],
8+
input[type="url"],
9+
input[type="password"],
10+
textarea,
11+
select {
12+
height: 38px;
13+
padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
14+
background-color: rgba(255,255,255,0.5);
15+
color:#fff;
16+
border: 1px solid #fff;
17+
border-radius: 6px;
18+
box-shadow: none;
19+
box-sizing: border-box; }
20+
/* Removes awkward default styles on some inputs for iOS */
21+
input[type="email"],
22+
input[type="number"],
23+
input[type="search"],
24+
input[type="text"],
25+
input[type="tel"],
26+
input[type="url"],
27+
input[type="password"],
28+
textarea {
29+
-webkit-appearance: none;
30+
-moz-appearance: none;
31+
appearance: none; }
32+
textarea {
33+
min-height: 65px;
34+
padding-top: 6px;
35+
padding-bottom: 6px; }
36+
input[type="email"]:focus,
37+
input[type="number"]:focus,
38+
input[type="search"]:focus,
39+
input[type="text"]:focus,
40+
input[type="tel"]:focus,
41+
input[type="url"]:focus,
42+
input[type="password"]:focus,
43+
textarea:focus,
44+
select:focus {
45+
border: 1px solid #33C3F0;
46+
outline: 0; }
47+
label,
48+
legend {
49+
display: block;
50+
margin-bottom: .5rem;
51+
font-weight: 600; }
52+
fieldset {
53+
padding: 0;
54+
border-width: 0; }
55+
input[type="checkbox"],
56+
input[type="radio"] {
57+
display: inline; }
58+
label > .label-body {
59+
display: inline-block;
60+
margin-left: .5rem;
61+
font-weight: normal; }

theme/grid.css

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.column,
2+
.columns {
3+
width: 100%;
4+
float: left;
5+
box-sizing: border-box; }
6+
7+
/* For devices larger than 550px */
8+
@media (min-width: 550px) {
9+
.column,
10+
.columns {
11+
margin-left: 0%; }
12+
.column:first-child,
13+
.columns:first-child {
14+
margin-left: 0; }
15+
16+
.one.column,
17+
.one.columns { width: 4.66666666667%; }
18+
.two.columns { width: 13.3333333333%; }
19+
.three.columns { width: 22%; }
20+
.four.columns { width: 30.6666666667%; }
21+
.five.columns { width: 39.3333333333%; }
22+
.six.columns { width: 48%; }
23+
.seven.columns { width: 56.6666666667%; }
24+
.eight.columns { width: 65.3333333333%; }
25+
.nine.columns { width: 74.0%; }
26+
.ten.columns { width: 82.6666666667%; }
27+
.eleven.columns { width: 91.3333333333%; }
28+
.twelve.columns { width: 100%; margin-left: 0; }
29+
30+
.one-third.column { width: 30.6666666667%; }
31+
.two-thirds.column { width: 65.3333333333%; }
32+
33+
.one-half.column { width: 50%; }
34+
}

0 commit comments

Comments
 (0)