1 <script
type=
"text/javascript">
2 function saveHotkey() {
5 if (!(
event.which === 115 && (navigator.platform.match(
"Mac") ?
event.metaKey :
event.ctrlKey)) && !(
event.which === 19))
return true;
6 event.preventDefault();
11 $(document).keydown(
function (
event) {
12 if (
event.which === 83 && (navigator.platform.match(
"Mac") ?
event.metaKey :
event.ctrlKey)) {
13 event.preventDefault();
14 $(
'#savebutton').click();
22 $(document).
ready(
function() {
24 const savebutton = (
'#savebutton');
25 const savebuttonIcon = (
'#savebuttonIcon');
28 $(savebutton).click(
function() {
29 $(savebutton).removeClass(
'btn btn-success').addClass(
'btn btn-warning');
30 $(savebuttonIcon).removeClass(
'fa fa-check').addClass(
'fa fa-spinner fa-spin fa-fw');
37 <script
type=
"text/javascript" src=
"../system/engines/jquery/jscolor/jscolor.js"></script>
38 <!-- Bootstrap toggle css -->
39 <link rel=
"stylesheet" href=
"../system/engines/bootstrap-toggle/css/bootstrap-toggle.css">
40 <!-- Bootstrap toggle js -->
41 <script
type=
"text/javascript" src=
"../system/engines/bootstrap-toggle/js/bootstrap-toggle.min.js"></script>
61 if (isset(
$_GET[
'widget']) && is_numeric(
$_GET[
'widget']))
63 $widget->loadProperties(
$db,
$_GET[
'widget']);
67 alert::draw(
"danger",
"$lang[ERROR]",
"$lang[VARS_MANIPULATED]",
"page=widgets",
"5000");
71 if(isset($_POST[
'save']))
73 $widget->published =
$db->quote($_POST[
'publish']);
74 $widget->pageID =
$db->quote($_POST[
'pageID']);
75 $widget->widgetType =
$db->quote($_POST[
'widgetType']);
76 $widget->sort =
$db->quote($_POST[
'sort']);
77 $widget->position =
$db->quote($_POST[
'positions']);
78 $widget->marginTop =
$db->quote($_POST[
'marginTop']);
79 $widget->marginBottom =
$db->quote($_POST[
'marginBottom']);
80 $widget->date_publish =
$db->quote($_POST[
'date_publish']);
81 $widget->date_unpublish =
$db->quote($_POST[
'date_unpublish']);
82 $widget->widgetTitle =
$db->quote($_POST[
'widgetTitle']);
83 $widget->blocked = isset($_POST[
'mystatus']);
86 if (empty($widget->date_publish)) { $widget->date_publish = sys::now(); }
89 if ($widget->save(
$db) ===
true)
91 alert::draw(
"success",
"$lang[SUCCESS]",
"$lang[WIDGET] $lang[SETTINGS] $lang[SAVED]",
"",
"1200");
95 alert::draw(
"danger",
"$lang[ERROR]",
"$lang[WIDGET] $lang[SETTINGS] $lang[NOT_SAVED]",
"",
"2400");
98 foreach($_POST as $property=>
$value)
100 if($property !=
"save")
102 if (isset(
$_GET[
'widget']) && is_numeric(
$_GET[
'widget']))
112 <!-- Content Wrapper. Contains page content -->
113 <div class=\"content-wrapper\" id=\"content-FX\">
114 <!-- Content Header (Page header) -->
115 <section class=\"content-header\">";
117 echo backend::getTitle($widget->name,
$lang[
'WIDGET']);
118 echo
"<ol class=\"breadcrumb\">
119 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
120 <li><a href=\"index.php?page=widgets\" title=\"$lang[WIDGETS]\"> $lang[WIDGETS]</a></li>
121 <li class=\"active\"><a href=\"index.php?page=widget-edit&widget=$widget->id\" title=\"$lang[WIDGET_EDIT_SUBTEXT]\"> $lang[EDIT]: <b>$widget->name $lang[WIDGET]</b></a></li>
124 <!-- Main content -->
125 <section class=\"content\">";
128 <!-- bootstrap
date-timepicker -->
129 <link
type=
"text/css" href=
"../system/engines/datetimepicker/css/datetimepicker.min.css" rel=
"stylesheet">
130 <script
type=
"text/javascript" src=
"../system/engines/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
132 <script
type=
"text/javascript" >
133 $(document).
ready(
function() {
135 $(
'#datetimepicker1').datetimepicker({
137 format:
'YYYY-MM-DD HH:mm:ss'
140 $(
'#datetimepicker2').datetimepicker({
141 format:
'YYYY-MM-DD HH:mm:ss'
148 <form
name=
"form" role=
"form" action=
"index.php?page=widget-edit&widget=<?php echo $widget->id; ?>" method=
"post">
151 <div
class=
"col-md-4">
152 <!-- BASIC WIDGET SETTINGS -->
153 <div
class=
"box box-default">
154 <div
class=
"box-header with-border">
155 <h3
class=
"box-title"><?php echo
"$lang[COMMON_WIDGET_SETTINGS]"; ?></h3>
157 <div
class=
"box-body">
159 <label
for=
"widgetType"><?php echo
$lang[
'WIDGET']; ?>
160 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_NAME']); ?>
162 <select
id=
"widgetType" name=
"widgetType" class=
"form-control" readonly>
163 <option value=
"<?php echo $widget->widgetType; ?>"><?php echo $widget->name; ?></option>
166 <label
for=
"pageID"><?php echo
$lang[
'ON_PAGE']; ?>
167 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_PAGE']); ?>
169 <select
id=
"pageID" name=
"pageID" class=
"form-control">
175 if ($widget->pageID ==
$page[
'id']){
176 $selectedHtml =
" selected";
178 else { $selectedHtml =
""; }
180 if ($widget->pageID == 0){
181 $allSelected =
" selected";
183 else { $allSelected =
""; }
186 if (isset(
$page[
'id']) && (isset(
$page[
'title']))) {
187 echo
"<option value=\"".$page[
'id'].
"\"$selectedHtml>".
$page[
'title'].
"</option>";
191 echo
"<option value=\"0\"$allSelected>$lang[ON_ALL_PAGES]</option>";
195 <label
for=
"positions"><?php echo
$lang[
'AT_POSITION']; ?>
196 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_POS']); ?>
198 <select
id=
"positions" name=
"positions" class=
"form-control">
199 <option value=
"<?php echo $widget->position; ?>"><?php echo $widget->position; ?></option>
200 <option value=
"">-----</option>
206 echo
"<option value=\"".$position[
$i].
"\">".
$position[
$i].
"</option>";
213 <!-- DATE_PUBLISH -->
214 <label
for =
"datetimepicker1"><?php echo
$lang[
'START_PUBLISH']; ?>
215 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_PUBLISH_DATE']); ?></label>
216 <input
id=
"datetimepicker1" name=
"date_publish" autocomplete=
"off" class=
"form-control" value=
"<?php echo $widget->date_publish; ?>">
218 <!-- DATE_UNPUBLISH -->
219 <label
for =
"datetimepicker2"><?php echo
$lang[
'END_PUBLISH']; ?>
220 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_UNPUBLISH_DATE']); ?></label>
221 <input
id=
"datetimepicker2" name=
"date_unpublish" autocomplete=
"off" class=
"form-control" value=
"<?php echo $widget->date_unpublish; ?>">
224 <label
for=
"marginTop"><?php echo
"$lang[MARGIN_TOP] <i><small>$lang[LEAVE_BLANK_FOR_NO_MARGIN]</small></i>"; ?>
225 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_MARGIN_TOP']); ?></label>
226 <input
type=
"text" id=
"marginTop" class=
"form-control" placeholder=
"" name=
"marginTop" maxlength=
"11" value=
"<?php echo $widget->marginTop; ?>">
227 <!-- MARGIN BOTTOM -->
228 <label
for=
"marginBottom"><?php echo
"$lang[MARGIN_BOTTOM] <i><small>$lang[LEAVE_BLANK_FOR_NO_MARGIN]</small></i>"; ?>
229 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_MARGIN_BOTTOM']); ?></label>
230 <input
type=
"text" id=
"marginBottom" class=
"form-control" name=
"marginBottom" placeholder=
"" maxlength=
"11" value=
"<?php echo $widget->marginBottom; ?>">
233 <label
for=
"sort"><?php echo
$lang[
'SORTATION_ORDER']; ?>
234 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_SORTATION_ORDER']); ?></label>
235 <input
id=
"sort" type=
"text" class=
"form-control" name=
"sort" maxlength=
"6" value=
"<?php echo $widget->sort; ?>">
238 <label
for =
"widgetTitle"><?php echo
$lang[
'NOTE']; ?>
239 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_NOTE']); ?></label>
240 <input
id=
"widgetTitle" name=
"widgetTitle" class=
"form-control" value=
"<?php echo $widget->widgetTitle; ?>">
243 <!-- PUBLISHED / UNPUBLISHED CHECKBOX -->
244 <?php
if ($widget->published ==
"1") { $checkedHtml=
" checked";
$value=1; }
else { $checkedHtml =
'';
$value =0; } ?>
245 <input
type=
"hidden" name=
"publish" value=
"0">
246 <input
type=
"checkbox" data-
on=
"<?php echo $lang['ON_'];?>" data-off=
"<?php echo $lang['OFF_'];?>" data-toggle=
"toggle" data-onstyle=
"success" data-offstyle=
"danger" id=
"publish" name=
"publish" value=
"1"<?php echo $checkedHtml;?>>
247 <label
for=
"publish">&
nbsp;<?php echo
"$lang[PUBLISHED]"; ?>
248 <?php echo backend::printTooltip(
$lang[
'TT_WIDGET_PUBLISH']); ?></label>
253 </div> <!-- end left col -->
256 <div
class=
"col-md-8">
257 <div
class=
"box box-default">
258 <div
class=
"box-header with-border">
259 <h3
class=
"box-title"><?php echo
"$widget->name $lang[WIDGET] $lang[SETTINGS]"; ?></h3>
261 <button
type=
"submit" id=
"savebutton" name=
"save" class=
"btn btn-success pull-right">
262 <
i id=
"savebuttonIcon" class=
"fa fa-check"></
i> &
nbsp;<?php echo
$lang[
'WIDGETS_SAVE_BTN']; ?>
265 <div
class=
"box-body">
266 <!-- MORE WIDGET SETTINGS -->
270 $widget->getWidgetFormElements(
$db,
$settings, $widget->id, $widget->folder,
$lang);
272 <br><input
type=
"hidden" name=
"widgetID" value=
"<?php echo $widget->id; ?>">
print $lang['FILEMAN_UPLOAD']
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Backend class serves a few useful functions for the admin backend.
Mysqli database class; returns db connection object.
The language class - support multilingual backend.
static setWidgetSetting($db, $property, $value, $widgetID)
Set widget setting value into widgets_settings.
The sys class - handles yawk's system core functions.
The template controller - get and set template settings.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L öschen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})