-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0c115a0
Showing
17 changed files
with
554 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
return []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
if (!defined('MAINTENANCE_MODE_MODULE_SCREEN_NAME')) { | ||
define('MAINTENANCE_MODE_MODULE_SCREEN_NAME', 'maintenance_mode'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "MaintenanceMode", | ||
"namespace": "Botble\\MaintenanceMode\\", | ||
"provider": "Botble\\MaintenanceMode\\Providers\\MaintenanceModeServiceProvider", | ||
"author": "Sang Nguyen", | ||
"url": "https://sangnguyen.info", | ||
"version": "5.3", | ||
"description": "The description for plugin maintenance_mode" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = function(exports) { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ | ||
/******/ // create a fake namespace object | ||
/******/ // mode & 1: value is a module id, require it | ||
/******/ // mode & 2: merge all properties of value into the ns | ||
/******/ // mode & 4: return value when already ns object | ||
/******/ // mode & 8|1: behave like require | ||
/******/ __webpack_require__.t = function(value, mode) { | ||
/******/ if(mode & 1) value = __webpack_require__(value); | ||
/******/ if(mode & 8) return value; | ||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; | ||
/******/ var ns = Object.create(null); | ||
/******/ __webpack_require__.r(ns); | ||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); | ||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); | ||
/******/ return ns; | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = "/"; | ||
/******/ | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 63); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ({ | ||
|
||
/***/ "./platform/plugins/maintenance-mode/resources/assets/js/maintenance.js": | ||
/*!******************************************************************************!*\ | ||
!*** ./platform/plugins/maintenance-mode/resources/assets/js/maintenance.js ***! | ||
\******************************************************************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports) { | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
|
||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
|
||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
|
||
var MaintenanceMode = /*#__PURE__*/function () { | ||
function MaintenanceMode() { | ||
_classCallCheck(this, MaintenanceMode); | ||
} | ||
|
||
_createClass(MaintenanceMode, [{ | ||
key: "init", | ||
value: function init() { | ||
$(document).on('click', '#btn-maintenance', function (event) { | ||
event.preventDefault(); | ||
|
||
var _self = $(event.currentTarget); | ||
|
||
_self.addClass('button-loading'); | ||
|
||
$.ajax({ | ||
type: 'POST', | ||
url: route('system.maintenance.run'), | ||
cache: false, | ||
data: _self.closest('form').serialize(), | ||
success: function success(res) { | ||
if (!res.error) { | ||
Botble.showSuccess(res.message); | ||
|
||
_self.text(res.data.message); | ||
|
||
if (!res.data.is_down) { | ||
_self.removeClass('btn-warning').addClass('btn-info'); | ||
} else { | ||
_self.addClass('btn-warning').removeClass('btn-info'); | ||
} | ||
|
||
if (res.data.is_down) { | ||
_self.closest('form').find('.maintenance-mode-notice div span').addClass('text-danger').removeClass('text-success').text(res.data.notice); | ||
} else { | ||
_self.closest('form').find('.maintenance-mode-notice div span').removeClass('text-danger').addClass('text-success').text(res.data.notice); | ||
} | ||
} else { | ||
Botble.showError(res.message); | ||
} | ||
|
||
_self.removeClass('button-loading'); | ||
}, | ||
error: function error(res) { | ||
Botble.handleError(res); | ||
|
||
_self.removeClass('button-loading'); | ||
} | ||
}); | ||
}); | ||
} | ||
}]); | ||
|
||
return MaintenanceMode; | ||
}(); | ||
|
||
$(document).ready(function () { | ||
new MaintenanceMode().init(); | ||
}); | ||
|
||
/***/ }), | ||
|
||
/***/ 63: | ||
/*!************************************************************************************!*\ | ||
!*** multi ./platform/plugins/maintenance-mode/resources/assets/js/maintenance.js ***! | ||
\************************************************************************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
|
||
module.exports = __webpack_require__(/*! /Users/mac/workspace/cms/platform/plugins/maintenance-mode/resources/assets/js/maintenance.js */"./platform/plugins/maintenance-mode/resources/assets/js/maintenance.js"); | ||
|
||
|
||
/***/ }) | ||
|
||
/******/ }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Overview | ||
This is a plugin for Botble CMS so you have to purchase Botble CMS first to use this plugin. | ||
Purchase it here: [https://codecanyon.net/item/botble-cms-php-platform-based-on-laravel-framework/16928182](https://1.envato.market/LWRBY) | ||
|
||
# Installation | ||
- Download and copy source code into `/platform/plugins/maintenance-mode`. | ||
- Run command `php artisan cms:plugin:activate maintenance-mode` to activate this plugin. | ||
- Go to Admin -> Platform Administration -> Maintenance mode. | ||
|
||
# Screenshots | ||
|
||
![Screenshot](https://raw.githubusercontent.com/botble/maintenance-mode/master/public/images/screenshot.png) | ||
|
||
# Contact us | ||
- Website: [https://botble.com](https://botble.com) | ||
- Email: [contact@botble.com](mailto:contact@botble.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class MaintenanceMode { | ||
init() { | ||
$(document).on('click', '#btn-maintenance', (event) => { | ||
event.preventDefault(); | ||
let _self = $(event.currentTarget); | ||
_self.addClass('button-loading'); | ||
|
||
$.ajax({ | ||
type: 'POST', | ||
url: route('system.maintenance.run'), | ||
cache: false, | ||
data: _self.closest('form').serialize(), | ||
success: (res) => { | ||
if (!res.error) { | ||
Botble.showSuccess(res.message); | ||
_self.text(res.data.message); | ||
if (!res.data.is_down) { | ||
_self.removeClass('btn-warning').addClass('btn-info'); | ||
} else { | ||
_self.addClass('btn-warning').removeClass('btn-info'); | ||
} | ||
|
||
if (res.data.is_down) { | ||
_self.closest('form').find('.maintenance-mode-notice div span').addClass('text-danger').removeClass('text-success').text(res.data.notice); | ||
} else { | ||
_self.closest('form').find('.maintenance-mode-notice div span').removeClass('text-danger').addClass('text-success').text(res.data.notice); | ||
} | ||
} else { | ||
Botble.showError(res.message); | ||
} | ||
_self.removeClass('button-loading'); | ||
}, | ||
error: (res) => { | ||
Botble.handleError(res); | ||
_self.removeClass('button-loading'); | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
$(document).ready(() => { | ||
new MaintenanceMode().init(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
return [ | ||
'maintenance_mode' => 'Maintenance mode', | ||
'message' => 'Message', | ||
'message_placeholder' => 'A message for your users', | ||
'retry_time' => 'Retry Time', | ||
'retry_time_placeholder' => 'Set the Retry-After header', | ||
'secs' => 'secs', | ||
'allowed_ip_address' => 'Allowed IP Addresses', | ||
'allowed_your_current_ip' => 'Allow your current IP', | ||
'allowed_your_current_ip_helper' => 'If you uncheck this and do not add your IP address above you will lose access to this site as well', | ||
'enable_maintenance_mode' => 'Enable maintenance mode', | ||
'disable_maintenance_mode' => 'Disable maintenance mode', | ||
'application_live' => 'Application is now live', | ||
'application_down' => 'Application is now in maintenance mode', | ||
'notice_enable' => 'Your website is currently in Maintenance Mode', | ||
'notice_disable' => 'Your website is live now', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
return [ | ||
'maintenance_mode' => 'Chế độ bảo trì', | ||
'message' => 'Tin nhắn', | ||
'message_placeholder' => 'Tin nhắn hiển thị cho khách ghé thăm', | ||
'retry_time' => 'Thời gian thử lại', | ||
'retry_time_placeholder' => 'Thiết lập Retry-After header', | ||
'secs' => 'giây', | ||
'allowed_ip_address' => 'Cho phép các địa chỉ IP có thể truy cập', | ||
'allowed_your_current_ip' => 'Cho phép địa chỉ IP hiện tại của bạn', | ||
'allowed_your_current_ip_helper' => 'Nếu bạn không lựa chọn tuỳ chọn này và không thêm IP của bạn vào mục cho phép phía trên, bạn cũng không thể truy cập được trang này', | ||
'enable_maintenance_mode' => 'Bật chế độ bảo trì', | ||
'disable_maintenance_mode' => 'Tắt chế độ bảo trì', | ||
'application_live' => 'Ứng dụng đang hoạt động', | ||
'application_down' => 'Ứng dụng hiện đang ở chế độ bảo trì', | ||
'notice_enable' => 'Website của bạn đang ở chế độ bảo trì', | ||
'notice_disable' => 'Website của bạn đang hoạt động bình thường', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@extends('core/base::layouts.master') | ||
@section('content') | ||
{!! Form::open() !!} | ||
<div class="maintenance-mode-notice"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M320 32C196.3 32 96 132.3 96 256c0 123.76 100.3 224 224 224s224-100.24 224-224c0-123.7-100.3-224-224-224zm0 400c-97.05 0-176-78.95-176-176S222.95 80 320 80s176 78.95 176 176-78.95 176-176 176zm0-112c-17.67 0-32 14.33-32 32s14.33 32 32 32 32-14.33 32-32-14.33-32-32-32zm22.32-192h-44.64c-9.47 0-16.86 8.17-15.92 17.59l12.8 128c.82 8.18 7.7 14.41 15.92 14.41h19.04c8.22 0 15.1-6.23 15.92-14.41l12.8-128c.94-9.42-6.45-17.59-15.92-17.59zM48 256c0-59.53 19.55-117.38 55.36-164.51 5.18-6.81 4.48-16.31-2.03-21.86l-12.2-10.41c-6.91-5.9-17.62-5.06-23.15 2.15C23.32 117.02 0 185.5 0 256c0 70.47 23.32 138.96 65.96 194.62 5.53 7.21 16.23 8.05 23.15 2.16l12.19-10.4c6.51-5.55 7.21-15.04 2.04-21.86C67.55 373.37 48 315.53 48 256zM572.73 59.71c-5.58-7.18-16.29-7.95-23.17-2l-12.15 10.51c-6.47 5.6-7.1 15.09-1.88 21.87C572.04 137.47 592 195.81 592 256c0 60.23-19.96 118.57-56.46 165.95-5.22 6.78-4.59 16.27 1.88 21.87l12.15 10.5c6.87 5.95 17.59 5.18 23.17-2C616.21 396.38 640 327.31 640 256c0-71.27-23.79-140.34-67.27-196.29z"/></svg> | ||
</div> | ||
<div> | ||
<span class="@if ($isDownForMaintenance) text-danger @else text-success @endif">@if ($isDownForMaintenance) {{ trans('plugins/maintenance-mode::maintenance-mode.notice_enable') }} @else {{ trans('plugins/maintenance-mode::maintenance-mode.notice_disable') }} @endif</span> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message" class="control-label">{{ trans('plugins/maintenance-mode::maintenance-mode.message') }}</label> | ||
<input type="text" name="message" class="form-control" value="{{ old('message') }}" placeholder="{{ trans('plugins/maintenance-mode::maintenance-mode.message_placeholder') }}"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="retry" class="control-label">{{ trans('plugins/maintenance-mode::maintenance-mode.retry_time') }} <span class="text-sm">({{ trans('plugins/maintenance-mode::maintenance-mode.secs') }})</span></label> | ||
<input type="number" name="retry" class="form-control" value="{{ old('retry') }}" placeholder="{{ trans('plugins/maintenance-mode::maintenance-mode.retry_time_placeholder') }}" min="0" max="9999"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="allow" class="control-label">{{ trans('plugins/maintenance-mode::maintenance-mode.allowed_ip_address') }}</label> | ||
<textarea name="allow" id="allow" class="form-control" rows="4" placeholder="127.0.0.1, 192.168.0.1">{{ old('allow') }}</textarea> | ||
</div> | ||
<div class="form-group"> | ||
<input type="hidden" value="0" name="include_current_ip"> | ||
<label><input type="checkbox" value="1" name="include_current_ip" checked>{{ trans('plugins/maintenance-mode::maintenance-mode.allowed_your_current_ip') }}</label> | ||
{!! Form::helper(trans('plugins/maintenance-mode::maintenance-mode.allowed_your_current_ip_helper')) !!} | ||
</div> | ||
<div class="form-group"> | ||
<button class="btn btn-sm @if ($isDownForMaintenance) btn-info @else btn-warning @endif" id="btn-maintenance">{{ $isDownForMaintenance ? trans('plugins/maintenance-mode::maintenance-mode.disable_maintenance_mode') : trans('plugins/maintenance-mode::maintenance-mode.enable_maintenance_mode') }}</button> | ||
</div> | ||
{!! Form::close() !!} | ||
|
||
<style> | ||
.maintenance-mode-notice { | ||
text-align : center; | ||
background: #fff; | ||
padding: 10px; | ||
font-size: 16px; | ||
margin-bottom: 20px; | ||
border-radius: 3px; | ||
color: #28a745; | ||
} | ||
.maintenance-mode-notice svg { | ||
width : 40px; | ||
} | ||
</style> | ||
@stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
Route::group(['namespace' => 'Botble\MaintenanceMode\Http\Controllers', 'middleware' => 'web'], function () { | ||
|
||
Route::group(['prefix' => config('core.base.general.admin_dir'), 'middleware' => 'auth'], function () { | ||
Route::group(['prefix' => 'system/maintenance'], function () { | ||
Route::get('', [ | ||
'as' => 'system.maintenance.index', | ||
'uses' => 'MaintenanceModeController@getIndex', | ||
'permission' => ACL_ROLE_SUPER_USER, | ||
]); | ||
|
||
Route::post('run', [ | ||
'as' => 'system.maintenance.run', | ||
'uses' => 'MaintenanceModeController@postRun', | ||
'middleware' => 'preventDemo', | ||
'permission' => ACL_ROLE_SUPER_USER, | ||
]); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.