forked from ldleman/hackpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch.php
More file actions
150 lines (127 loc) · 5.17 KB
/
Copy pathsketch.php
File metadata and controls
150 lines (127 loc) · 5.17 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
<?php require_once __DIR__.DIRECTORY_SEPARATOR.'header.php';
try {
if (!isset($_['id']) || !is_numeric($_['id'])) {
throw new Exception("Sketch non spécifié");
}
$sketch = Sketch::getById($_['id']);
if (!$sketch || $sketch->id == 0) {
throw new Exception("Sketch inexistant");
}
if (!$sketch->public && $myUser->id != $sketch->owner) {
throw new Exception("Sketch privé, demandez à son propriétaire de le rendre publique");
}
?>
<div class="row" id="sketch" data-id="<?php echo $sketch->id;
?>">
<div class="col-md-4">
<h5 id="sketchTitle"><input onblur="save_sketch_title(this);" type="text" value="<?php echo htmlspecialchars(html_entity_decode($sketch->label));
?>"/></h5>
</div>
<div class="col-md-8">
<ul class="sketchOptions">
<li onclick="window.location='action.php?action=export_sketch&id=<?php echo $sketch->id;
?>';" title="Exporter"><i class="fa fa-share-square-o"></i></li>
<li id="importResource" title="Envoyer des fichiers"><i class="fa fa-files-o"></i></li>
<li onclick="toggle_embed_sketch();" title="Partager"><i class="fa fa-code"></i></li>
<li onclick="toggle_share_sketch(this);" title="Rendre <?php echo $sketch->public==0?'Public':'Privé';
?>"><i class="fa <?php echo $sketch->public==0?'fa-eye-slash':'fa-eye';
?>"></i></li>
<li id="download" onclick="window.location='action.php?action=download_sketch&id=<?php echo $sketch->id;
?>'" title="Télécharger"><i class="fa fa-arrow-circle-o-down"></i></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-3" id="resourceMenu">
<?php if ($myUser->id == $sketch->owner) : ?>
<div class="btn-group" style="margin:10px auto;">
<button onclick="add_resource();" type="button" class="btn btn-primary"><i class="fa fa-plus"></i> Ajouter une ressource</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<?php foreach (Type::all() as $uid=>$type): ?>
<li><a onclick="add_resource('<?php echo $uid;
?>');"><?php echo $type['label'];
?></a></li>
<?php endforeach;
?>
</ul>
</div>
<?php endif;
?>
<div class="list-group resources" id="resources">
<a class="list-group-item" style="display:none;" data-id="{{id}}" onclick="select_resource($(this).attr('data-id'));">
<h4 class="list-group-item-heading">{{label}}</h4>
<p class="list-group-item-text">Type : <code>{{type}}</code></p>
<div class="resources-options"><i class="fa fa-pencil" onclick="edit_resource(this,event);"></i> <i onclick="delete_resource(this,event);" class="fa fa-times"></i></div>
</a>
</div>
</div>
<div class="col-md-9" id="resourceContent">
<div class="jumbotron">
<div class="jumbotron-contents" id="resource">
<h2 style="margin:0 0 5px 0;">Aucune ressource sélectionnée</h2>
<div class="preloader"></div>
<p>Ce tableau est tristement vide... :(</p>
</div>
</div>
</div>
</div>
<!-- Resource edition -->
<div id="editResourceMeta" class="modal fade" role="dialog" data-action="save_resource" data-id="">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Edition ressource</h4>
</div>
<div class="modal-body">
<label for="type">Type</label>
<select class="form-control" id="type">
<?php foreach (Type::all() as $uid=>$type): ?>
<option value="<?php echo $uid;
?>"><?php echo $type['label'];
?></option>
<?php endforeach;
?>
</select>
<label for="label">Libellé</label>
<input class="form-control" type="text" id="label"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="save_resource();" data-dismiss="modal">Enregistrer</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Resource edition -->
<div id="embedModal" class="modal fade" role="dialog" data-action="save_resource" data-id="">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Copier coller le code suivant</h4>
</div>
<div class="modal-body">
<label><input id="enableSideBar" checked="checked" onchange="get_embeded_code();" type="checkbox"> Afficher la barre de menu</label>
<br/>
<label for="code">Code</label>
<textarea class="form-control"></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php
} catch (Exception $e) {
$_SESSION['error'] = $e->getMessage();
header('location: index.php');
}
require_once __ROOT__.'footer.php' ?>