forked from jeedom/plugin-script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.php
More file actions
189 lines (183 loc) · 8.9 KB
/
script.php
File metadata and controls
189 lines (183 loc) · 8.9 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('script');
$eqLogics = eqLogic::byType($plugin->getId());
$rootPath = getRootPath();
sendVarToJS(['eqType' => $plugin->getId(), 'userScriptDir' => $rootPath . '/' . config::byKey('userScriptDir', 'script'), 'rootPath' => $rootPath]);
?>
<style>
.CodeMirror-scroll {
height: 100%;
overflow-y: auto;
overflow-x: auto;
}
</style>
<div class="row row-overflow">
<div class="col-xs-12 eqLogicThumbnailDisplay">
<legend><i class="fas fa-cog"></i> {{Gestion}}</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction logoPrimary" data-action="add">
<i class="fas fa-plus-circle"></i>
<br />
<span>{{Ajouter}}</span>
</div>
<div class="cursor eqLogicAction logoSecondary" data-action="gotoPluginConf">
<i class="fas fa-wrench"></i>
<br />
<span>{{Configuration}}</span>
</div>
</div>
<legend><i class="fas fa-file"></i> {{Mes Scripts}}</legend>
<?php
if (count($eqLogics) == 0) {
echo '<br><div class="text-center" style="font-size:1.2em;font-weight:bold;">{{Aucun équipement trouvé, cliquer sur "Ajouter" pour commencer}}</div>';
} else {
// Champ de recherche
echo '<div class="input-group" style="margin:5px;">';
echo '<input class="form-control roundedLeft" placeholder="{{Rechercher}}" id="in_searchEqlogic">';
echo '<div class="input-group-btn">';
echo '<a id="bt_resetSearch" class="btn" style="width:30px"><i class="fas fa-times"></i></a>';
echo '<a class="btn roundedRight hidden" id="bt_pluginDisplayAsTable" data-coreSupport="1" data-state="0"><i class="fas fa-grip-lines"></i></a>';
echo '</div>';
echo '</div>';
// Liste des équipements du plugin
echo '<div class="eqLogicThumbnailContainer">';
foreach ($eqLogics as $eqLogic) {
$opacity = ($eqLogic->getIsEnable()) ? '' : 'disableCard';
echo '<div class="eqLogicDisplayCard cursor ' . $opacity . '" data-eqLogic_id="' . $eqLogic->getId() . '">';
echo '<img src="' . $eqLogic->getImage() . '"/>';
echo '<br>';
echo '<span class="name">' . $eqLogic->getHumanName(true, true) . '</span>';
echo '<span class="hiddenAsCard displayTableRight hidden">';
if ($eqLogic->getConfiguration('autorefresh', '') != '') {
echo '<span class="label label-info">' . $eqLogic->getConfiguration('autorefresh') . '</span>';
}
echo ($eqLogic->getIsVisible() == 1) ? '<i class="fas fa-eye" title="{{Equipement visible}}"></i>' : '<i class="fas fa-eye-slash" title="{{Equipement non visible}}"></i>';
echo '</span>';
echo '</div>';
}
echo '</div>';
}
?>
</div>
<div class="col-xs-12 eqLogic" style="display: none;">
<div class="input-group pull-right" style="display:inline-flex">
<span class="input-group-btn">
<a class="btn btn-default btn-sm eqLogicAction" data-action="configure"><i class="fas fa-cogs"></i> {{Configuration avancée}}</a><a class="btn btn-default btn-sm eqLogicAction" data-action="copy"><i class="fas fa-copy"></i> {{Dupliquer}}</a><a class="btn btn-sm btn-success eqLogicAction" data-action="save"><i class="fas fa-check-circle"></i> {{Sauvegarder}}</a><a class="btn btn-danger btn-sm eqLogicAction roundedRight" data-action="remove"><i class="fas fa-minus-circle"></i> {{Supprimer}}</a>
</span>
</div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation"><a href="#" class="eqLogicAction" aria-controls="home" role="tab" data-toggle="tab" data-action="returnToThumbnailDisplay"><i class="fas fa-arrow-circle-left"></i></a></li>
<li role="presentation" class="active"><a href="#eqlogictab" aria-controls="home" role="tab" data-toggle="tab"><i class="fas fa-tachometer-alt"></i> {{Equipement}}</a></li>
<li role="presentation"><a href="#commandtab" aria-controls="profile" role="tab" data-toggle="tab"><i class="fas fa-list"></i> {{Commandes}}</a></li>
</ul>
<div class="tab-content" style="height:calc(100% - 50px);overflow:auto;overflow-x: hidden;">
<div role="tabpanel" class="tab-pane active" id="eqlogictab">
<form class="form-horizontal">
<fieldset>
<div class="col-lg-7">
<legend><i class="fas fa-wrench"></i> {{Paramètres généraux}}</legend>
<div class="form-group">
<label class="col-sm-4 control-label">{{Nom de l'équipement}}</label>
<div class="col-sm-6">
<input type="text" class="eqLogicAttr form-control" data-l1key="id" style="display:none;">
<input type="text" class="eqLogicAttr form-control" data-l1key="name" placeholder="{{Nom de l'équipement}}">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{{Objet parent}}</label>
<div class="col-sm-6">
<select id="sel_object" class="eqLogicAttr form-control" data-l1key="object_id">
<option value="">{{Aucun}}</option>
<?php
$options = '';
foreach ((jeeObject::buildTree(null, false)) as $object) {
$options .= '<option value="' . $object->getId() . '">' . str_repeat(' ', $object->getConfiguration('parentNumber')) . $object->getName() . '</option>';
}
echo $options;
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{{Catégorie}}</label>
<div class="col-sm-6">
<?php
foreach (jeedom::getConfiguration('eqLogic:category') as $key => $value) {
echo '<label class="checkbox-inline">';
echo '<input type="checkbox" class="eqLogicAttr" data-l1key="category" data-l2key="' . $key . '" >' . $value['name'];
echo '</label>';
}
?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{{Options}}</label>
<div class="col-sm-6">
<label class="checkbox-inline"><input type="checkbox" class="eqLogicAttr" data-l1key="isEnable" checked>{{Activer}}</label>
<label class="checkbox-inline"><input type="checkbox" class="eqLogicAttr" data-l1key="isVisible" checked>{{Visible}}</label>
</div>
</div>
<legend><i class="fas fa-cogs"></i> {{Paramètres spécifiques}}</legend>
<div class="form-group">
<label class="col-sm-4 control-label">{{Auto-actualisation}}
<sup><i class="fas fa-question-circle tooltips" title="{{Fréquence de rafraîchissement des commandes infos de l'équipement}}"></i></sup>
</label>
<div class="col-sm-6">
<div class="input-group">
<input type="text" class="eqLogicAttr form-control roundedLeft" data-l1key="configuration" data-l2key="autorefresh" placeholder="{{Cliquer sur ? pour afficher l'assistant cron}}">
<span class="input-group-btn">
<a class="btn btn-default cursor jeeHelper roundedRight" data-helper="cron" title="Assistant cron">
<i class="fas fa-question-circle"></i>
</a>
</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">{{Délai avant d'actualiser les infos suite à une action (en secondes)}}</label>
<div class="col-sm-6">
<input type="text" class="eqLogicAttr form-control" data-l1key="configuration" data-l2key="delayBeforeRefrehInfo" />
</div>
</div>
</div>
</fieldset>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="commandtab">
<a class="btn btn-default btn-sm cmdAction pull-right" style="margin-top:5px;" data-action="add"><i class="fas fa-plus-circle"></i> {{Ajouter une commande script}}</a>
<br />
<br />
<table id="table_cmd" class="table table-bordered table-condensed">
<thead>
<tr>
<th style="min-width:150px;width:200px;">{{Nom}}</th>
<th style="width: 100px;">{{Type script}}</th>
<th style="width: 70px;">{{Type}}</th>
<th style="width: 300px;">{{Requête}}</th>
<th style="width: 360px;">{{Paramètres}}</th>
<th style="min-width:120px;width:260px">{{Options}}</th>
<th style="width: 100px;">{{Etat}}</th>
<th style="min-width:80px;width:100px;">{{Actions}}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="md_browseScriptFile" class="hidden" title="Parcourir...">
<div style="display: none;" id="div_browseScriptFileAlert"></div>
<div id="div_browseScriptFileTree"></div>
</div>
<?php
include_file('3rdparty', 'jquery.fileTree/jqueryFileTree', 'css', 'script');
include_file('3rdparty', 'jquery.fileTree/jquery.easing.1.3', 'js', 'script');
include_file('3rdparty', 'jquery.fileTree/jqueryFileTree', 'js', 'script');
include_file('desktop', 'script', 'js', 'script');
include_file('core', 'plugin.template', 'js');
?>