public function getEdit($user) { \AssetManager::addStyle(\URL::asset('chosen_v1.3.0/chosen.css')); \AssetManager::addScript(\URL::asset('chosen_v1.3.0/chosen.jquery.js')); \AssetManager::addScript(\URL::asset('js/chosenpicker.js')); $title = 'Users'; $roles = $user->roles()->lists('id', 'name'); error_log('>>> Roles ' . json_encode($roles)); $html = view('admin.users.edit', compact('title', 'user', 'roles'))->render(); return Admin::view($html); }
public function getEdit($group) { \AssetManager::addStyle(\URL::asset('chosen_v1.3.0/chosen.css')); \AssetManager::addScript(\URL::asset('chosen_v1.3.0/chosen.jquery.js')); \AssetManager::addScript(\URL::asset('js/chosenpicker.js')); $title = 'Groups'; $users = $group->users()->get(); $gusers = $users->lists('name', 'id'); error_log(json_encode($gusers)); $html = view('admin.groups.edit', compact('title', 'group', 'gusers'))->render(); return Admin::view($html); }
public function updateCMSFields(Fieldset $fields) { $fields->removeFieldFromTab("Root.Files", "Files"); $fields->removeFieldFromTab("Root.Files", "deletemarked"); $fields->removeByName("Upload"); $fields->addFieldToTab("Root.Files", $a = new AssetManager($this->owner, "Files")); $a->setUploadFolder($this->owner->Filename); $a->setColumnWidths(array('Title' => 30, 'Filename' => 70)); $a->setSourceFilter("Classname != 'Folder' AND ParentID = " . $this->owner->ID); $a->setParentClass("Folder"); $a->setPermissions(self::$permissions); if ($this->owner->Title) { $a->setAddTitle(sprintf(_t('AssetManager.ADDFILESTO', 'files to "%s"'), $this->owner->Title)); } else { $a->setAddTitle(_t('AssetManager.FILES', 'files')); } return $fields; }
<?php $id = uniqid(); AssetManager::addScript('admin::js/lightbox-2.6.min.js'); AssetManager::addStyle('admin::css/lightbox.css'); ?> <div class="panel-group" id="accordion"> @foreach ($itemsField as $key => $item) <div class="panel panel-inverse"> <div class="panel-heading"> <div class="panel-heading-btn"> <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove" data-original-title="" title=""><i class="fa fa-times"></i></a> </div> <h3 class="panel-title"> <a class="accordion-toggle accordion-toggle-styled" data-toggle="collapse" data-parent="#accordion" href="#collapse_{{$key}}"> <i class="fa fa-plus-circle pull-right"></i> Item {{$key + 1}} </a> </h3> </div> <div id="collapse_{{$key}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading_{{$key}}"> <div class="panel-body"> <div class="form-group"> <label class="col-md-2 control-label">Photo</label> <div class="col-md-10"> <a href="/{{$photos[$key]->image}}" data-lightbox="{{$id}}"> <img class="thumbnail" src="/{{$photos[$key]->image}}" width="200px"> </a> </div> </div>
<!DOCTYPE HTML> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title><?php echo PROJECT_NAME . (isset($title) ? ' - ' . $title : ''); ?> </title> <?php echo AssetManager::display_stylesheets(); ?> <?php echo AssetManager::display_javascripts(); ?> </head> <body> <div id="container">
function javascripts() { AssetManager::javascripts(func_get_args()); }
/** * Enqueue admin scripts and styles. */ public function enqueueAdminScripts() { wp_enqueue_style('sb/admin_css', AssetManager::getUrl('styles/admin.min.css'), [], null); wp_enqueue_script('sb/main_js', AssetManager::getUrl('scripts/main.min.js'), ['jquery'], null); }
<?php /* * Describe you custom columns and form items here. * * There is some simple examples what you can use: * * Column::register('customColumn', '\Foo\Bar\MyCustomColumn'); * * FormItem::register('customElement', \Foo\Bar\MyCustomElement::class); * * FormItem::register('otherCustomElement', function (\Eloquent $model) * { * AssetManager::addStyle(URL::asset('css/style-to-include-on-page-with-this-element.css')); * AssetManager::addScript(URL::asset('js/script-to-include-on-page-with-this-element.js')); * if ($model->exists) * { * return 'My edit code.'; * } * return 'My custom element code'; * }); */ AssetManager::addScript(URL::asset('js/admin.js'));
<button type="submit" class="btn btn-success btn-block btn-lg">Sign me in</button> </div> @if (config('admin.registration.enabled', true)) <div class="m-t-20"> Not a member yet? Click <a href="/registration">here</a> to register. </div> @endif </form> </div> </div> <ul class="login-bg-list"> <li><a href="#" data-click="change-bg"><img src="{{Admin::instance()->router->routeToAsset('img/login-bg/bg-1.jpg')}}" alt="" /></a></li> <li><a href="#" data-click="change-bg"><img src="{{Admin::instance()->router->routeToAsset('img/login-bg/bg-2.jpg')}}" alt="" /></a></li> <li class="active"><a href="#" data-click="change-bg"><img src="{{Admin::instance()->router->routeToAsset('img/login-bg/bg-3.jpg')}}" alt="" /></a></li> <li><a href="#" data-click="change-bg"><img src="{{Admin::instance()->router->routeToAsset('img/login-bg/bg-4.jpg')}}" alt="" /></a></li> <li><a href="#" data-click="change-bg"><img src="{{Admin::instance()->router->routeToAsset('img/login-bg/bg-5.jpg')}}" alt="" /></a></li> <li><a href="#" data-click="change-bg"><img src="{{Admin::instance()->router->routeToAsset('img/login-bg/bg-6.jpg')}}" alt="" /></a></li> </ul> </div> <?php AssetManager::addScript('admin::js/login.js'); ?> <script> $(document).ready(function() { App.init(); LoginV2.init(); }); </script> @stop
<?php AssetManager::addScript('admin::js/bootstrap-datepicker.js'); AssetManager::addStyle('admin::css/datepicker.css'); ?> <div class="row"> <div class="col-lg-12"> <form action="{{$_SERVER['REQUEST_URI']}}" id="filterForm" method="GET"> <div class="filter-wrapper"> @foreach ($viewFilters as $filterIndex => $filter) {!! $filter->render($tableId, $filterIndex) !!} @endforeach <a href="#" id="reset-{{$tableId}}" class="reset">Reset form</a> </div> </form> </div> </div>
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/config.php'; // ==================== // = Admin Navigation = // ==================== $admin_links = array('Manage Users' => array('path' => 'users', 'auth' => 'admin'), 'Manage Auth Codes' => array('path' => 'auth_codes', 'auth' => 'su'), 'Manage Roles' => array('path' => 'roles', 'auth' => 'su'), 'Edit Blocks' => array('path' => 'cms', 'auth' => 'admin'), 'Manage Files' => array('path' => 'cms_files', 'auth' => 'su'), 'Manage Extenders' => array('path' => 'extenders', 'auth' => 'admin'), 'Manage Blocks' => array('path' => 'blocks', 'auth' => 'su'), 'Run Tests' => array('path' => 'tests', 'auth' => 'admin'), 'Clear Files' => array('path' => 'clear', 'auth' => 'admin')); // ================ // = Admin Config = // ================ $theme = true; // To disable theme, set to false AssetManager::stylesheets('admin');
define('DB_NAME', $_ENV['DB_NAME']); break; } if (@$db_load !== false) { include ROOT . '/inc/opendb.php'; } // =========== // = Helpers = // =========== /* AssetManager */ $javascripts = array('jquery-1.4.2.min', 'jquery-ui-1.8.4.min', 'defaults'); $stylesheets = array('master', 'form_builder'); AssetManager::javascripts($javascripts); AssetManager::stylesheets($stylesheets); // ==================== // = Autoload Classes = // ==================== function __autoload($className) { // Ignore NORM if ($className == 'NORM') { require_once ROOT . '/inc/classes/class.norm.php'; return; } $className[0] = strtolower($className[0]); $func = create_function('$c', 'return "_" . strtolower($c[1]);'); $class_name = preg_replace_callback('/([A-Z])/', $func, $className); $class_file = ROOT . '/inc/classes/class.' . $class_name . '.php'; if (file_exists($class_file)) {
<?php error_reporting(E_ALL); ini_set("display_errors", 1); include $_SERVER['DOCUMENT_ROOT'] . '/inc/classes/tests/class.test_form_builder.php'; $tester = new Test_FormBuilder(); if (isset($_GET['v'])) { $tester->initialize_tests($_GET['v']); } require $_SERVER['DOCUMENT_ROOT'] . '/inc/admin/config.php'; $session->auth_or_redirect('admin', '/', true); $admin_title = 'Run Tests'; $admin_subtitle = 'FormBuilder'; AssetManager::javascripts('tests/form_builder'); AssetManager::stylesheets('tests/form_builder'); include ROOT . '/inc/admin/header.php'; ?> <p><a href="/admin">Back to Admin Home</a></p> <p><a href="../">Back to Tests Home</a></p> <div> <h1>FormBuilder Test</h1> <p>Which version would you like to test?</p> <?php echo $tester->version_links(); ?> <?php if (isset($_GET['v'])) {
/** * Serve static files through php proxy. * * It performs the following actions: * - Checks the file is readable or returns "HTTP/1.0 404 Not Found" * - Returns "HTTP/1.1 304 Not Modified" after comparing the HTTP_IF_MODIFIED_SINCE * with the modification date of the static file * - Will try to compress the static file according to HTTP_ACCEPT_ENCODING. Compressed files are store in * the /tmp directory. If compressing extensions are not available, a manually gzip compressed file * can be provided in the /tmp directory. It has to bear the same name with an added .gz extension. * Using manually compressed static files requires you to manually update the compressed file when * the static file is updated. * - Overrides server cache control config to allow caching * - Sends Very Accept-Encoding to tell proxies to store different version of the static file according * to users encoding capacities. * * Warning: * Compressed filed are stored in the /tmp directory. * If this method is used with two files bearing the same name but located in different locations, * there is a risk of conflict. One file could be served with the content of the other. * A future upgrade of this method would be to recreate the directory structure of the static file * within a /tmp/compressed-static-files directory. * * @param string $file The location of the static file to serve * @param string $contentType The content type of the static file. * @param bool $expireFarFuture Day in the far future to set the Expires header to. * Should be set to false for files that should not be cached. * @param int|false $byteStart The starting byte in the file to serve. If false, the data from the beginning * of the file will be served. * @param int|false $byteEnd The ending byte in the file to serve. If false, the data from $byteStart to the * end of the file will be served. * @param string|false $filename By default the filename of $file is reused as Content-Disposition. If the * file should be sent as a different filename to the client you can specify * a custom filename here. */ public static function serverStaticFile($file, $contentType, $expireFarFutureDays = 100, $byteStart = false, $byteEnd = false, $filename = false) { // if the file cannot be found return HTTP status code '404' if (!file_exists($file)) { Common::sendResponseCode(404); return; } $modifiedSince = Http::getModifiedSinceHeader(); $fileModifiedTime = @filemtime($file); $lastModified = gmdate('D, d M Y H:i:s', $fileModifiedTime) . ' GMT'; // set some HTTP response headers self::overrideCacheControlHeaders('public'); Common::sendHeader('Vary: Accept-Encoding'); if (false === $filename) { $filename = basename($file); } Common::sendHeader('Content-Disposition: inline; filename=' . $filename); if ($expireFarFutureDays) { // Required by proxy caches potentially in between the browser and server to cache the request indeed Common::sendHeader(self::getExpiresHeaderForFutureDay($expireFarFutureDays)); } // Return 304 if the file has not modified since if ($modifiedSince === $lastModified) { Common::sendResponseCode(304); return; } // if we have to serve the file, serve it now, either in the clear or compressed if ($byteStart === false) { $byteStart = 0; } if ($byteEnd === false) { $byteEnd = filesize($file); } $compressed = false; $encoding = ''; $compressedFileLocation = AssetManager::getInstance()->getAssetDirectory() . '/' . basename($file); if (!($byteStart == 0 && $byteEnd == filesize($file))) { $compressedFileLocation .= ".{$byteStart}.{$byteEnd}"; } $phpOutputCompressionEnabled = self::isPhpOutputCompressed(); if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && !$phpOutputCompressionEnabled) { list($encoding, $extension) = self::getCompressionEncodingAcceptedByClient(); $filegz = $compressedFileLocation . $extension; if (self::canCompressInPhp()) { if (!empty($encoding)) { // compress the file if it doesn't exist or is newer than the existing cached file, and cache // the compressed result if (self::shouldCompressFile($file, $filegz)) { self::compressFile($file, $filegz, $encoding, $byteStart, $byteEnd); } $compressed = true; $file = $filegz; $byteStart = 0; $byteEnd = filesize($file); } } else { // if a compressed file exists, the file was manually compressed so we just serve that if ($extension == '.gz' && !self::shouldCompressFile($file, $filegz)) { $compressed = true; $file = $filegz; $byteStart = 0; $byteEnd = filesize($file); } } } Common::sendHeader('Last-Modified: ' . $lastModified); if (!$phpOutputCompressionEnabled) { Common::sendHeader('Content-Length: ' . ($byteEnd - $byteStart)); } if (!empty($contentType)) { Common::sendHeader('Content-Type: ' . $contentType); } if ($compressed) { Common::sendHeader('Content-Encoding: ' . $encoding); } if (!_readfile($file, $byteStart, $byteEnd)) { Common::sendResponseCode(500); } }
* return 'My custom element code'; * }); */ use SleepingOwl\Admin\Columns\Column\BaseColumn; class LinkColumn extends BaseColumn { public function render($instance, $totalCount) { $content = $instance->codigo; return '<td><a href="/orden?codigo=' . $content . '" target="_blank">Link</a></td>'; } } Column::register('Link', 'LinkColumn'); FormItem::register('archivosSelector', function (\Eloquent $model) { $archivos = Storage::directories('archivos-imprentas'); $archivos_seleccionados = explode(",", $model->archivos); $salida = '<div class="form-group"><label for="archivos_s">Archivos</label><div> <select class=" multiselect form-control" size="2" data-select-type="multiple" multiple="multiple" id="archivos_s[]" name="archivos_s"> '; foreach ($archivos as $archivo) { $archivo = str_replace('archivos-imprentas/', '', $archivo); $sel = in_array($archivo, $archivos_seleccionados) ? ' selected="selected" ' : ''; $salida .= '<option ' . $sel . '>' . $archivo . '</option>'; } $salida .= '</select></div></div>'; return $salida; }); FormItem::register('archivosHidden', function (\Eloquent $model) { AssetManager::addScript(URL::asset('js/archivos.js')); return '<input type="hidden" name="archivos" id="archivos" value="' . $model->archivos . '">'; });
@extends('admin::_layout.inner') @section('innerContent') <?php AssetManager::addStyle('admin::css/bootstrap-select.min.css'); AssetManager::addScript('admin::js/bootstrap-select.min.js'); AssetManager::addScript('admin::js/form-plugins.js'); ?> @if (!empty($form->getGroups())) {!! $form->render(true) !!} @else <div class="row"> <div class="col-lg-12"> <div class="panel panel-inverse"> <div class="panel-heading"> {{{ $title }}} </div> <div class="panel-body"> {!! $form->render() !!} </div> </div> </div> </div> @endif <script> var myFile = document.getElementById("teq"); if(myFile) { myFile.addEventListener('change', function() { var max_filesize = 5242880; if (this.files[0].size > max_filesize) {
/** * Serve static files through php proxy. * * It performs the following actions: * - Checks the file is readable or returns "HTTP/1.0 404 Not Found" * - Returns "HTTP/1.1 304 Not Modified" after comparing the HTTP_IF_MODIFIED_SINCE * with the modification date of the static file * - Will try to compress the static file according to HTTP_ACCEPT_ENCODING. Compressed files are store in * the /tmp directory. If compressing extensions are not available, a manually gzip compressed file * can be provided in the /tmp directory. It has to bear the same name with an added .gz extension. * Using manually compressed static files requires you to manually update the compressed file when * the static file is updated. * - Overrides server cache control config to allow caching * - Sends Very Accept-Encoding to tell proxies to store different version of the static file according * to users encoding capacities. * * Warning: * Compressed filed are stored in the /tmp directory. * If this method is used with two files bearing the same name but located in different locations, * there is a risk of conflict. One file could be served with the content of the other. * A future upgrade of this method would be to recreate the directory structure of the static file * within a /tmp/compressed-static-files directory. * * @param string $file The location of the static file to serve * @param string $contentType The content type of the static file. * @param bool $expireFarFuture Day in the far future to set the Expires header to. * Should be set to false for files that should not be cached. */ public static function serverStaticFile($file, $contentType, $expireFarFutureDays = 100) { if (file_exists($file)) { // conditional GET $modifiedSince = ''; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE']; // strip any trailing data appended to header if (false !== ($semicolon = strpos($modifiedSince, ';'))) { $modifiedSince = substr($modifiedSince, 0, $semicolon); } } $fileModifiedTime = @filemtime($file); $lastModified = gmdate('D, d M Y H:i:s', $fileModifiedTime) . ' GMT'; // set HTTP response headers self::overrideCacheControlHeaders('public'); @header('Vary: Accept-Encoding'); @header('Content-Disposition: inline; filename=' . basename($file)); if ($expireFarFutureDays) { // Required by proxy caches potentially in between the browser and server to cache the request indeed @header("Expires: " . gmdate('D, d M Y H:i:s', time() + 86400 * (int) $expireFarFutureDays) . ' GMT'); } // Returns 304 if not modified since if ($modifiedSince === $lastModified) { self::setHttpStatus('304 Not Modified'); } else { // optional compression $compressed = false; $encoding = ''; $compressedFileLocation = AssetManager::getInstance()->getAssetDirectory() . '/' . basename($file); $phpOutputCompressionEnabled = ProxyHttp::isPhpOutputCompressed(); if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && !$phpOutputCompressionEnabled) { $acceptEncoding = $_SERVER['HTTP_ACCEPT_ENCODING']; if (extension_loaded('zlib') && function_exists('file_get_contents') && function_exists('file_put_contents')) { if (preg_match('/(?:^|, ?)(deflate)(?:,|$)/', $acceptEncoding, $matches)) { $encoding = 'deflate'; $filegz = $compressedFileLocation . '.deflate'; } else { if (preg_match('/(?:^|, ?)((x-)?gzip)(?:,|$)/', $acceptEncoding, $matches)) { $encoding = $matches[1]; $filegz = $compressedFileLocation . '.gz'; } } if (!empty($encoding)) { // compress-on-demand and use cache if (!file_exists($filegz) || $fileModifiedTime > @filemtime($filegz)) { $data = file_get_contents($file); if ($encoding == 'deflate') { $data = gzdeflate($data, 9); } else { if ($encoding == 'gzip' || $encoding == 'x-gzip') { $data = gzencode($data, 9); } } file_put_contents($filegz, $data); } $compressed = true; $file = $filegz; } } else { // manually compressed $filegz = $compressedFileLocation . '.gz'; if (preg_match('/(?:^|, ?)((x-)?gzip)(?:,|$)/', $acceptEncoding, $matches) && file_exists($filegz) && $fileModifiedTime < @filemtime($filegz)) { $encoding = $matches[1]; $compressed = true; $file = $filegz; } } } @header('Last-Modified: ' . $lastModified); if (!$phpOutputCompressionEnabled) { @header('Content-Length: ' . filesize($file)); } if (!empty($contentType)) { @header('Content-Type: ' . $contentType); } if ($compressed) { @header('Content-Encoding: ' . $encoding); } if (!_readfile($file)) { self::setHttpStatus('505 Internal server error'); } } } else { self::setHttpStatus('404 Not Found'); } }
AssetManager::addScript('admin::js/jquery.dataTables.js'); AssetManager::addScript('admin::js/dataTables.colReorder.js'); AssetManager::addScript('admin::js/dataTables.keyTable.js'); AssetManager::addScript('admin::js/dataTables.fixedHeader.js'); AssetManager::addScript('admin::js/dataTables.colVis.js'); AssetManager::addScript('admin::js/table-manager.js'); ?> <script> <?php AssetManager::addScript('admin::js/bootstrap-datepicker.js'); AssetManager::addStyle('admin::css/datepicker.css'); AssetManager::addStyle('admin::css/model-filters.css'); AssetManager::addScript('admin::js/editable.js'); AssetManager::addScript('admin::js/parsley.min.js'); AssetManager::addStyle('admin::css/bootstrap-editable.css'); AssetManager::addStyle('admin::css/editable.css'); ?> var filters = {!! json_encode($jsFilters) !!}; $(document).ready(function() { var table = AdminTable.init('{{$tableId}}', { exclColumns: {{count($columns)-1}}, sortConfig: [{!! json_encode($unsortableColumns) !!}], filters: filters }); }); </script> @stop
private function renderAssets() { $oAssetManager = new AssetManager($this->sConfigFile); $oAssetManager->addAssets($this->aAssets); $this->aRenderedAssets = $oAssetManager->getAssetPaths(); }