Skip to content

Commit 4b0ee6f

Browse files
authored
Merge pull request #68 from r4fx/master
BE module visual tweaking
2 parents 15f2b7f + 59ce922 commit 4b0ee6f

File tree

2 files changed

+146
-97
lines changed

2 files changed

+146
-97
lines changed

Classes/Manager/Main.php

Lines changed: 134 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function main() {
4141

4242
if (!$this->enable) return $this->noCache();
4343

44-
$content = '<div class="container-fluid">';
44+
$content = '<div class="container-fluid-off">';
4545

4646
// if (empty($_GET['mod'])) {
4747
// $content .= $this->welcome();
@@ -78,23 +78,36 @@ public function all() {
7878
$this->db->query('DELETE FROM '.$this->table.'oldlinks WHERE sticky != 1');
7979
}
8080
}
81-
$c .= '<div class="succes"><p>Done.</p></div>';
81+
$c .= '<div class="text-center"><p class="text-success bg-success" style="padding: 10px;">Done.</p></div>';
8282
}
8383
$c .= '
84-
<h2>Force all links to update upon next hit</h2>
85-
<p>Upon next page hit, all links will be regenerated and if changed, any old link will be moved to "oldlinks".</p>
86-
<form method="post" action="'.$this->file.'mod=all">
87-
<input type="submit" name="refresh" value="FORCE UPDATE OF ALL LINKS" class="btn btn-warning">
88-
</form>
89-
90-
<h2>Start again</h2>
91-
<p>Delete everything - cache and oldlinks.</p>
92-
<form method="post" action="'.$this->file.'mod=all" class="form-inline">
93-
<input type="submit" name="delete" value="DELETE EVERYTHING AND START AGAIN" class="btn btn-danger">
94-
<label class="checkbox">
95-
<input type="checkbox" name="sticky" value="1"> Delete sticky too
96-
</label>
97-
</form>
84+
<div class="row">
85+
<div class="col-md-6">
86+
<div class="panel panel-default">
87+
<div class="panel-heading">Force all links to update upon next hit</div>
88+
<div class="panel-body">
89+
<p>Upon next page hit, all links will be regenerated and if changed, any old link will be moved to "oldlinks".</p>
90+
<form method="post" action="'.$this->file.'mod=all">
91+
<input type="submit" name="refresh" value="FORCE UPDATE OF ALL LINKS" class="btn btn-warning">
92+
</form>
93+
</div>
94+
</div>
95+
96+
<div class="panel panel-default">
97+
<div class="panel-heading">Start again</div>
98+
<div class="panel-body">
99+
<p>Delete everything - cache and oldlinks.</p>
100+
<form method="post" action="'.$this->file.'mod=all">
101+
<div class="form-group">
102+
<label>
103+
<input type="checkbox" name="sticky" value="1"> Delete sticky too
104+
</label>
105+
</div>
106+
<input type="submit" name="delete" value="DELETE EVERYTHING AND START AGAIN" class="btn btn-danger">
107+
</form>
108+
</div>
109+
</div>
110+
</div></div>
98111
';
99112
return $c;
100113
}
@@ -151,7 +164,7 @@ public function sticky() {
151164
if (!$q || $this->db->affected_rows()==0) {
152165
$c = '<div class="error"><p>The sticky value hasn\'t been changed because the link doesn\'t exist (or maybe a DB error).</p></div>';
153166
} else {
154-
$c = '<div class="succes"><p>The sticky value has been changed.</p></div>';
167+
$c = '<div class="bg-success text-center"><p class="text-success" style="padding:15px;">The sticky value has been changed.</p></div>';
155168
}
156169
}
157170
$c .= $this->getBackLink();
@@ -200,7 +213,7 @@ public function update() {
200213

201214
private function getBackLink() {
202215
if (!empty($_GET['from'])) $from = explode(':',$_GET['from']);
203-
return '<p class="center"><a href="'.$this->file.(empty($from[0])?'':'mod='.$from[0].(empty($from[1])?'':'&amp;l='.$from[1])).'">&lt;&lt; Back</a></p>';
216+
return '<p><a class="btn btn-primary" href="'.$this->file.(empty($from[0])?'':'mod='.$from[0].(empty($from[1])?'':'&amp;l='.$from[1])).'">&lt;&lt; Back</a></p>';
204217
}
205218

206219
public function cache() {
@@ -213,20 +226,31 @@ public function cache() {
213226

214227
$c = '<h1>Cached links</h1>';
215228

216-
$c .= '<p class="center">';
217-
$c .= '<b><a href="'.$this->file.'mod=cache&amp;l='.urlencode('%').'">all</a></b>
229+
$c .= '<p>';
230+
$c .= '<a class="badge badge-bprimary" href="'.$this->file.'mod=cache&amp;l='.urlencode('%').'">All</a>
218231
';
219232
for ($i=ord('A');$i<=ord('Z');$i++) {
220-
$c .= '<b><a href="'.$this->file.'mod=cache&amp;l='.strtoupper(chr($i)).'">'.strtoupper(chr($i)).'</a></b>
233+
$c .= '<a class="badge" href="'.$this->file.'mod=cache&amp;l='.strtoupper(chr($i)).'">'.strtoupper(chr($i)).'</a>
221234
';
222235
}
223-
$c .= '</p>';
224-
$c .= '<form method="post" action="'.$this->file.'" class="form-inline">
225-
<label>Link starts with: <input type="text" name="l" class="a form-control" value="'.htmlspecialchars($let).'"></label>
226-
<input type="hidden" name="mod" value="cache">
227-
<input type="submit" value="Search" class="submit btn btn-primary">
228-
<label><input type="checkbox" name="domain" value="1" '.(!empty($_REQUEST['domain'])?' checked="checked"':'').'> Ignore domain</label>
229-
</form>';
236+
$c .= '</p> <hr>';
237+
$c .= '<div class="row">
238+
<div class="col-md-6">
239+
<form method="post" action="'.$this->file.'">
240+
<label>Link starts with:</label>
241+
<div class="form-group">
242+
<div class="input-group">
243+
<input type="text" name="l" class="a form-control" value="'.htmlspecialchars($let).'">
244+
<input type="hidden" name="mod" value="cache">
245+
<span class="input-group-btn">
246+
<input type="submit" value="Search" class="submit btn btn-primary">
247+
</span>
248+
</div>
249+
</div>
250+
<div class="form-group">
251+
<label><input type="checkbox" name="domain" value="1" '.(!empty($_REQUEST['domain'])?' checked="checked"':'').'> Ignore domain</label>
252+
</div>
253+
</form></div></div>';
230254

231255
if (!empty($let)) {
232256

@@ -238,13 +262,13 @@ public function cache() {
238262
}
239263
$num = $this->db->num_rows($q);
240264
if ($num>0) {
241-
$c .= '<p class="center">Records found: '.$num.'</p>';
265+
$c .= '<p class="center text-info">Records found: '.$num.'</p>';
242266
$c .= '<form method="post" action="'.$this->file.'mod=cache">';
243-
$c .= '<table id="list" class="table table-striped"><thead><tr><th class="left">Cached URI</th><th>Parameters</th><th>Cached</th><th>Last check</th><th>Sticky</th><th>Action</th></tr></thead>';
267+
$c .= '<table id="list" class="table table-striped" style="table-layout: fixed;"><thead><tr><th class="left" style="width: 30%;">Cached URI</th><th style="width: 30%;">Parameters</th><th style="width: 10%;">Cached</th><th style="width: 10%;">Last check</th><th style="width: 5%;">Sticky</th><th style="width: 20%;">Action</th></tr></thead>';
244268
while ($row = $this->db->fetch($q)) {
245269
$c .= '<tr>
246-
<td class="left">'.htmlspecialchars($row['url']).'</td>
247-
<td>'.htmlspecialchars($this->serializedArrayToQueryString($row['params'])).'</td>
270+
<td class="left" style="word-wrap: break-word;">'.htmlspecialchars($row['url']).'</td>
271+
<td style="word-wrap: break-word;">'.htmlspecialchars($this->serializedArrayToQueryString($row['params'])).'</td>
248272
<td>'.$row['crdatetime'].'</td>
249273
<td>'.$row['tstamp'].'</td>
250274
<td>'.($row['sticky']?'YES':'NO').'</td>
@@ -260,11 +284,11 @@ public function cache() {
260284
}
261285
$c .= '</table></form>';
262286
} else {
263-
$c .= '<p>No cached links found.</p>';
287+
$c .= '<p class="text-info">No cached links found.</p>';
264288
}
265289

266290
} else {
267-
$c .= '<p>Input any filter. Use "%" to get all links.';
291+
$c .= '<p class="text-muted">Input any filter. Use "%" to get all links.</p>';
268292
}
269293
return $c;
270294
}
@@ -274,18 +298,25 @@ public function old() {
274298

275299
$c = '<h1>Old links</h1>';
276300

277-
$c .= '<p class="center">';
278-
$c .= '<b><a href="'.$this->file.'mod=old&amp;l=%">all</a></b>
301+
$c .= '<p>';
302+
$c .= '<a class="badge badge-bprimary" href="'.$this->file.'mod=old&amp;l=%">all</a>
279303
';
280304
for ($i=ord('A');$i<=ord('Z');$i++) {
281-
$c .= '<b><a href="'.$this->file.'mod=old&amp;l='.strtoupper(chr($i)).'">'.strtoupper(chr($i)).'</a></b>
305+
$c .= '<a class="badge" href="'.$this->file.'mod=old&amp;l='.strtoupper(chr($i)).'">'.strtoupper(chr($i)).'</a>
282306
';
283307
}
284-
$c .= '</p>';
285-
$c .= '<form method="post" action="'.$this->file.'mod=old" class="form-inline">
286-
<label>Link starts with: <input type="text" name="l" class="a form-control" value="'.htmlspecialchars($let).'"></label>
287-
<input type="hidden" name="mod" value="cache">
288-
<input type="submit" value="Search" class="submit btn btn-primary">
308+
$c .= '</p> <hr>';
309+
$c .= '<div class="row">
310+
<div class="col-md-6">
311+
<form method="post" action="'.$this->file.'mod=old">
312+
<label>Link starts with:</label>
313+
<div class="input-group">
314+
<input type="text" name="l" class="a form-control" value="'.htmlspecialchars($let).'">
315+
<input type="hidden" name="mod" value="cache">
316+
<span class="input-group-btn">
317+
<input type="submit" value="Search" class="submit btn btn-primary">
318+
</span>
319+
</div></div></div>
289320
</form>';
290321

291322
if (!empty($let)) {
@@ -294,7 +325,7 @@ public function old() {
294325

295326
$num = $this->db->num_rows($q);
296327
if ($num>0) {
297-
$c .= '<p class="center">Records found: '.$num.'</p>';
328+
$c .= '<p class="center text-info">Records found: '.$num.'</p>';
298329
$c .= '<form method="post" action="'.$this->file.'mod=cache">';
299330
$c .= '<table id="list" class="table table-striped"><tr><th class="left">Old URI</th><th class="left">Cached URI</th><th>Moved to olds</th><th>Sticky</th><th>Action</th>';
300331
while ($row = $this->db->fetch($q)) {
@@ -313,10 +344,10 @@ public function old() {
313344
}
314345
$c .= '</table></form>';
315346
} else {
316-
$c .= '<p>No old links found.</p>';
347+
$c .= '<p class="text-info">No old links found.</p>';
317348
}
318349
} else {
319-
$c .= '<p>Input any filter. Use "%" to get all links.</p>';
350+
$c .= '<p class="text-muted">Input any filter. Use "%" to get all links.</p>';
320351
}
321352
return $c;
322353
}
@@ -364,7 +395,7 @@ public function link() {
364395
$data = $_POST;
365396
$data = array_map('trim',$data);
366397
if (empty($data['url']) || empty($data['params'])) {
367-
$c .= '<div class="error"><p>You must fill all inputs.</p></div>';
398+
$c .= '<div class="error"><p class="text-danger">You must fill all inputs.</p></div>';
368399
} else {
369400
$params = \Bednarik\Cooluri\Core\Functions::convertQuerystringToArray($data['params']);
370401
$cp = \Bednarik\Cooluri\Core\Functions::prepareParamsForCache($params);
@@ -422,26 +453,31 @@ public function link() {
422453
}
423454
}
424455

425-
$c .= '<form method="post" action="'.$this->file.'mod=link'.($new?'':'&amp;lid='.$id).'">
426-
<fieldset>
427-
<legend>URI details</legend>
428-
<div class="form-group">
429-
<label for="url">URI:</label>
430-
<input type="text" name="url" id="url" class="form-control" value="'.(empty($data['url'])?'':htmlspecialchars($data['url'])).'">
431-
</div>
432-
<div class="form-group">
433-
<label for="params">Parameters (query string: id=1&amp;type=2):</label>
434-
<input type="text" name="params" id="params" class="form-control" value="'.(empty($data['params'])?'':htmlspecialchars($data['params'])).'">
435-
</div>
436-
<div class="form-group">
437-
<label for="sticky">
438-
<input type="checkbox" class="check" name="sticky" id="sticky" value="1" '.(empty($data['sticky'])?'':' checked="checked"').'>
439-
Sticky (won\'t be updated)
440-
</label>
456+
$c .= '
457+
<div class="row">
458+
<div class="col-md-6">
459+
<form method="post" action="'.$this->file.'mod=link'.($new?'':'&amp;lid='.$id).'">
460+
<fieldset>
461+
<legend>URI details</legend>
462+
<div class="form-group">
463+
<label for="url">URI:</label>
464+
<input type="text" name="url" id="url" class="form-control" value="'.(empty($data['url'])?'':htmlspecialchars($data['url'])).'">
465+
</div>
466+
<div class="form-group">
467+
<label for="params">Parameters (query string: id=1&amp;type=2):</label>
468+
<input type="text" name="params" id="params" class="form-control" value="'.(empty($data['params'])?'':htmlspecialchars($data['params'])).'">
469+
</div>
470+
<div class="form-group">
471+
<label for="sticky">
472+
<input type="checkbox" class="check" name="sticky" id="sticky" value="1" '.(empty($data['sticky'])?'':' checked="checked"').'>
473+
Sticky (won\'t be updated)
474+
</label>
475+
</div>
476+
</fieldset>
477+
<input type="submit" value=" '.($new?'Save new URI':'Update this URI').' " class="submit btn btn-primary">
478+
</form>
479+
</div>
441480
</div>
442-
</fieldset>
443-
<input type="submit" value=" '.($new?'Save new URI':'Update this URI').' " class="submit btn btn-primary">
444-
</form>
445481
';
446482
return $c;
447483
}
@@ -454,7 +490,7 @@ public function redirect() {
454490
if (!empty($_POST)) {
455491
$id = (int)$_POST['to'];
456492
if (empty($id) || empty($_POST['url'])) {
457-
$c .= '<div class="error"><p>All fields are required.</p></div>';
493+
$c .= '<div class="error"><p class="text-danger">All fields are required.</p></div>';
458494
} else {
459495
$this->db->query('INSERT INTO '.$this->table.'oldlinks(link_id,url,sticky)
460496
VALUES('.$id.',
@@ -466,32 +502,37 @@ public function redirect() {
466502

467503
$allq = $this->db->query('SELECT * FROM '.$this->table.'cache ORDER BY url');
468504

469-
$c .= '<form method="post" action="'.$this->file.'mod=redirect">
470-
<fieldset>
471-
<legend>Redirect details</legend>
472-
<div class="form-group">
473-
<label for="url">From:</label>
474-
<input type="text" name="url" id="url" class="form-control">
475-
</div>
476-
<div class="form-group">
477-
<label for="to">To:</label>
478-
<select name="to" id="to" class="form-control">
479-
';
480-
while ($row = $this->db->fetch($allq)) {
481-
$c .= '<option value="'.$row['id'].'">'.$row['url'].'</option>
482-
';
483-
}
484-
$c .= '</select>
485-
</div>
486-
<div class="checkbox">
487-
<label for="sticky">
488-
<input type="checkbox" class="check" name="sticky" id="sticky" value="1" '.(empty($data['sticky'])?'':' checked="checked"').'>
489-
Sticky (won\'t be deleted upon Delete all action)
490-
</label>
505+
$c .= '
506+
<div class="row">
507+
<div class="col-md-6">
508+
<form method="post" action="'.$this->file.'mod=redirect">
509+
<fieldset>
510+
<legend>Redirect details</legend>
511+
<div class="form-group">
512+
<label for="url">From:</label>
513+
<input type="text" name="url" id="url" class="form-control">
514+
</div>
515+
<div class="form-group">
516+
<label for="to">To:</label>
517+
<select name="to" id="to" class="form-control">
518+
';
519+
while ($row = $this->db->fetch($allq)) {
520+
$c .= '<option value="'.$row['id'].'">'.$row['url'].'</option>
521+
';
522+
}
523+
$c .= '</select>
524+
</div>
525+
<div class="form-group">
526+
<label for="sticky">
527+
<input type="checkbox" class="check" name="sticky" id="sticky" value="1" '.(empty($data['sticky'])?'':' checked="checked"').'>
528+
Sticky (won\'t be deleted upon Delete all action)
529+
</label>
530+
</div>
531+
</fieldset>
532+
<input type="submit" value="Submit this redirect" class="submit btn btn-primary">
533+
</form>
534+
</div>
491535
</div>
492-
</fieldset>
493-
<input type="submit" value="Submit this redirect" class="submit btn btn-primary">
494-
</form>
495536
';
496537
return $c;
497538
}
@@ -506,11 +547,11 @@ public function menu() {
506547
if (empty($cm)) {
507548
$cm = 'cache';
508549
}
509-
$c = '<nav class="navbar navbar-default" style="margin-bottom: 20px"><div class="container-fluid"><ul class="nav nav-tabs">';
550+
$c = '<ul class="nav nav-tabs" style="margin-bottom: 20px">';
510551
foreach ($mods as $k=>$v) {
511552
$c .= '<li'.($cm==$k?' class="active"':'').'><a href="'.$this->file.($k?'mod='.$k:'').'">'.$v.'</a></li>';
512553
}
513-
$c .= '</ul></div></nav>';
554+
$c .= '</ul>';
514555
return $c;
515556
}
516557

Resources/Private/Templates/LinkFix/List.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ <h2><f:translate key="LLL:EXT:cooluri/Resources/Private/Language/locallang_fix1.
99

1010
<p><f:translate key="LLL:EXT:cooluri/Resources/Private/Language/locallang_fix1.xlf:mlang_labels_form_description" /></p>
1111

12-
<f:form action="list" class="form-inline">
13-
<f:form.textfield name="url" size="100" value="{url}" class="form-control"/>
14-
<f:form.submit value="{f:translate(key:'LLL:EXT:cooluri/Resources/Private/Language/locallang_fix1.xlf:mlang_labels_form_button_find' )}" class="btn btn-primary"/>
15-
</f:form>
12+
<div class="row">
13+
<div class="col-md-6">
14+
<f:form action="list">
15+
<div class="input-group">
16+
<f:form.textfield name="url" size="100" value="{url}" class="form-control"/>
17+
<span class="input-group-btn">
18+
<f:form.submit value="{f:translate(key:'LLL:EXT:cooluri/Resources/Private/Language/locallang_fix1.xlf:mlang_labels_form_button_find' )}" class="btn btn-primary"/>
19+
</span>
20+
</div>
21+
</f:form>
22+
</div>
23+
</div>
1624

1725

1826
<f:for each="{urls}" as="u">

0 commit comments

Comments
 (0)