-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
140 lines (128 loc) · 6.52 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
//Just used to avoid server ip configuration ^^
$jsonServerIpAndPort = $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT'];;
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="client/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="client/css/ui-lightness/jquery-ui-1.10.2.custom.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="client/css/styles.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script type='text/javascript'>
document.jsonServerIpAndPort = "<?php echo $jsonServerIpAndPort; ?>";
</script>
<script type="text/javascript" data-main="client/js/init.js" src="client/js/tools/require.js"></script>
<!-- Top NavBar -->
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">PurpleApi Sample</a>
<ul class="nav" data-bind="foreach: spaObj.Pages">
<li data-bind="css: { active: $data == $root.spaObj.CurrentPageKey()} /*Set class='active' if bool ok */ "><a href="#" data-bind='text: $data, click: $root.spaObj.changePage'></a></li>
</ul>
</div>
</div>
<script type="text/html" id="alertTemplate">
<div class='alert'>
<button type="button" class="close" data-bind="click:$root.submitRemoveNotification">×</button>
<span data-bind="text:note"></span>
</div>
</script>
<div data-bind="template:{ name:'alertTemplate', foreach:notificationObj.NotificationList, as:'note' }"></div>
<!-- Home page -->
<div class='container' data-bind="visible:spaObj.CurrentPageKey() == 'Home'">
<input class="span2" placeholder="username" data-bind="value:securityObj.User.username" type="text"><br />
<input class="span2" placeholder="password" data-bind="value:securityObj.User.password" type="password"><br />
<button type="submit" class="btn" data-bind="click:securityObj.UserLogin">Sign in</button>
</div>
<!-- Fruits page -->
<div class='container' data-bind="visible:spaObj.CurrentPageKey() == 'Fruits'">
<button id='refreshFruitTable' class='btn' data-bind='click:fruitEntityObj.fetchFruitsTable'><i class="icon-refresh"></i></button>
<!--<div>Generation timestamp : <apan id='FruitEntityListGenerationTimelbl' data-bind='text:FruitEntityListGenerationTime'></span></div>-->
<table class='table table-striped table-bordered' id='fruitTable' data-bind="with:fruitEntityObj.FruitEntityList">
<thead>
<tr>
<th>Fruit</th>
<th>Quantity</th>
</tr>
</thead>
<tbody data-bind="foreach:$data">
<tr>
<td><a href="#" data-bind="text:Name"></a></td>
<td><a href="#" data-bind="text:Quantity"></a></td>
<td><button class='btn removeLineBtn' data-bind="click:$root.fruitEntityObj.submitRemoveLive, visible:$root.securityObj.IsLogged()"><i class='icon-remove'></i></button></td>
</tr>
</tbody>
</table>
<div class='row-fluid' data-bind="visible:securityObj.IsLogged()">
<div class='span6'>
<div class='form-horizontal'>
<fieldset>
<legend>Create a Fruit</legend>
<div class='control-group'>
<label class='control-label'>Fruit</label>
<div class='controls'>
<input type='text' data-bind='value:fruitEntityObj.FruitEntity.Name' />
</div>
</div>
<div class='control-group'>
<label class='control-label'>Quantity</label>
<div class='controls'>
<input type='text' data-bind='value:fruitEntityObj.FruitEntity.Quantity' />
</div>
</div>
<div class='control-group'>
<label class='control-label'>Type</label>
<div class='controls'>
<input type="text" data-bind="value:fruitEntityObj.FruitEntity.TypeId, autoComplete:{url:'server/jsonapi.php?action=FRUITTYPELIST', backFunction:$root.FruitTypeAutocompleteSelect}">
</div>
</div>
<div class='control-group'>
<div class='controls'>
<button class='btn btn-primary' data-bind="click:fruitEntityObj.submitAddLine">Add</button>
</div>
</div>
</fieldset>
</div>
</div>
<div class='span6'>
<div class='form-horizontal'>
<!-- #Fruits page name needed to redirect to the proper page -->
<form action='#Fruits' data-bind="submit: submitUpload" enctype="multipart/form-data">
<fieldset>
<legend>Upload</legend>
<div class="control-group">
<label class="control-label" for="description">File</label>
<div class="controls">
<input name='foo' type="file" id="file" >
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class='btn btn-primary'>Upload</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
<!-- Users page -->
<div class='container' data-bind="visible:spaObj.CurrentPageKey() == 'Users'">
<table class='table table-striped table-bordered'>
<thead>
<tr class="tableRow" data-bind="createTheadRow: userEntityObj.UserList()[0]"></tr>
</thead>
<tbody data-bind="foreach:userEntityObj.UserList">
<tr class="tableRow" data-bind="createTbodyRow: $data">
<td>fOObAr</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>