/adei/ui

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/ui

« back to all changes in this revision

Viewing changes to services/update.php

  • Committer: Suren A. Chilingaryan
  • Date: 2008-04-02 10:23:22 UTC
  • Revision ID: csa@dside.dyndns.org-20080402102322-okib92sicg2dx3o3
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
require("../adei.php");
 
3
 
 
4
header("Content-type: application/json");
 
5
header("Cache-Control: no-cache, must-revalidate");
 
6
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 
7
 
 
8
 
 
9
/*
 
10
$props = new 
 
11
 
 
12
if (isset($_POST['props']))
 
13
    $props = json_decode(stripslashes($_POST['props']), true);
 
14
else
 
15
//    $error = _("Configuration is missing");
 
16
*/
 
17
 
 
18
/*
 
19
$f = fopen("/tmp/xxx", "w");
 
20
fprintf($f, time() . "\n");
 
21
fprintf($f, print_r($_POST['props'], true) . ".\n");
 
22
fprintf($f, print_r($props, true) . ".\n");
 
23
fprintf($f, addslashes(json_encode(array(
 
24
        "error" => 0,
 
25
        "draw" => 1,
 
26
        "image" => 0
 
27
    ))));
 
28
fclose($f);
 
29
$_POST['props'] = "{\"db_server\": \"hs\", \"db_name\": \"experiment1\", \"db_group\": \"0\", \"db_mask\": \"4\", \"experiment\": \"0-0\", \"window\": \"0\", \"frame_width\": 864, \"frame_height\": 616}";
 
30
*/
 
31
 
 
32
try {
 
33
    $req = new REQUEST();
 
34
    if ($req->CheckData()) {
 
35
 
 
36
        $req = $req->CreateDataRequest();
 
37
 
 
38
        $draw = new DRAW($req);
 
39
        $draw->Create();
 
40
        $file = $draw->Save();
 
41
        $scale = $draw->GetScaleInfo();
 
42
    }
 
43
} catch(ADEIException $e) {
 
44
    $error = $e->getMessage();
 
45
}
 
46
 
 
47
if ($error) {
 
48
    echo json_encode(array("error" => $error));
 
49
} else {
 
50
    if ($draw) {
 
51
        echo json_encode(array_merge(array(
 
52
            "error" => 0,
 
53
            "module" => "graph",
 
54
            "draw" => 1,
 
55
            "image" => $file
 
56
        ), $scale));
 
57
    } else {
 
58
        echo json_encode(array("error" => 0));
 
59
    }
 
60
}
 
61
 
 
62
 
 
63
?>
 
 
b'\\ No newline at end of file'