diff --git a/app/Helpers/FileManager.php b/app/Helpers/FileManager.php
index 568411d9..01459d13 100644
--- a/app/Helpers/FileManager.php
+++ b/app/Helpers/FileManager.php
@@ -17,34 +17,42 @@ class FileManager
switch ($type) {
case 'image':
- // try to check if file have thumbnail
- if (file_exists(config('app.thumbnail_url') . '/' . $file->filename)) {
- $url = config('app.thumbnail_url') . '/' . $file->filename;
- } else {
- $url = config('app.upload_url') . '/' . $file->filename;
- }
+ $url = Template::thumbnail($file->filename);
return '';
break;
case 'text':
- return '';
+ return self::getIcon($file, 'fa-file-text-o');
break;
case 'application':
switch ($subtype) {
case 'pdf':
- return '';
+ return self::getIcon($file, 'fa-file-pdf-o');
break;
default:
- return '';
+ return self::getIcon($file, 'fa-newspaper-o');
break;
}
break;
default:
- return '';
+ return self::getIcon($file, 'fa-question');
break;
}
}
+ /**
+ * Shortcut for displaying icons
+ *
+ * @param $file
+ * @param $icon
+ *
+ * @return string
+ */
+ protected static function getIcon($file, $icon)
+ {
+ return '
' . e(str_limit($file->original_filename, 15)) . '
';
$string .= htmlspecialchars(file_get_contents($path));
$string .= '';
@@ -91,15 +98,8 @@ class FileManager
return $string;
break;
case 'application':
- switch ($subtype) {
- case 'pdf':
- return '';
- break;
- default:
- return '';
- break;
- }
- break;
+ return '';
+ break;
default:
return self::getPreview($file);
break;
@@ -119,19 +119,12 @@ class FileManager
switch ($type) {
case 'text':
-
- return [
- trans('admin/fileManager.encoding') => mb_detect_encoding(file_get_contents($path))
- ];
+ return [trans('admin/fileManager.encoding') => mb_detect_encoding(file_get_contents($path))];
break;
case 'image':
list ($width, $height) = getimagesize($path);
-
- return [
- trans('admin/fileManager.resolution') => $height . ' x ' . $width,
- ];
-
+ return [trans('admin/fileManager.resolution') => $height . ' x ' . $width,];
break;
}
diff --git a/app/Helpers/Template.php b/app/Helpers/Template.php
index fab3a803..07332d77 100644
--- a/app/Helpers/Template.php
+++ b/app/Helpers/Template.php
@@ -61,6 +61,18 @@ class Template
return config('app.upload_url') . '/' . $filename;
}
+ public static function thumbnail($filename)
+ {
+ // try to check if file have thumbnail
+ if (file_exists(config('app.thumbnail_path') . '/' . $filename)) {
+ $url = config('app.thumbnail_url') . '/' . $filename;
+ } else {
+ $url = self::upload($filename);
+ }
+
+ return $url;
+ }
+
/**
* Get path to given asset
*
diff --git a/app/Http/Controllers/Admin/Contents/EditContent.php b/app/Http/Controllers/Admin/Contents/EditContent.php
index fda4f63e..d1cf7a3e 100644
--- a/app/Http/Controllers/Admin/Contents/EditContent.php
+++ b/app/Http/Controllers/Admin/Contents/EditContent.php
@@ -147,7 +147,11 @@ class EditContent extends Controller
$request->url = Str::slug($request->url);
$request->parentPage = $request->parentPage ? $request->parentPage : null;
- $request->titlePhotoFilename = $file ? $file['filename'] : null;
+ if (!$file) {
+ $request->titlePhotoFilename = empty($request->existingTitlePhoto) ? null : $request->existingTitlePhoto;
+ } else {
+ $request->titlePhotoFilename = $file['filename'];
+ }
// array of fields in database and fields from request
$fields = [
diff --git a/app/Models/File.php b/app/Models/File.php
index 1c7c39a0..6c171459 100644
--- a/app/Models/File.php
+++ b/app/Models/File.php
@@ -4,9 +4,13 @@ namespace App\Models;
use App\Events\UploadFile;
use App\Http\Requests\Request;
+use Franzose\ClosureTable\Extensions\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
+use Illuminate\Support\Facades\File as FileFacade;
+use Intervention\Image\Constraint;
+use Intervention\Image\Facades\Image;
use Symfony\Component\HttpFoundation\File\File as SymphonyFile;
use Symfony\Component\HttpFoundation\File\UploadedFile;
@@ -63,6 +67,12 @@ class File extends Model
// save file into physical location (local FS)
$uploadedFile = $file->move($destination, $filename);
+ // is uploaded file an image?
+ if (Str::startsWith($uploadedFile->getMimeType(), 'image')) {
+ // yes, create thumbnail
+ $this->createThumbnail($uploadedFile);
+ }
+
// insert record into database
$id = $this->saveIntoDatabase($uploadedFile, $request, $file->getClientOriginalName());
@@ -118,4 +128,29 @@ class File extends Model
return $newFile->id;
}
+
+ /**
+ * Create thumbnail of given image
+ *
+ * @param SymphonyFile $file
+ */
+ private function createThumbnail(SymphonyFile $file)
+ {
+ // does thumbnail directory exist?
+ if (!is_dir(config('app.thumbnail_path'))) {
+ FileFacade::makeDirectory(config('app.thumbnail_path'));
+ }
+
+ // get image instance
+ $image = Image::make(config('app.upload_path') . DIRECTORY_SEPARATOR . $file->getFilename());
+
+ // resize image and keep aspect ration
+ $image->resize(env('THUMBNAIL_WIDTH', 300), null, function (Constraint $constraint) {
+ $constraint->aspectRatio();
+ $constraint->upsize();
+ });
+
+ // save thumbnail with lower quality
+ $image->save(config('app.thumbnail_path') . DIRECTORY_SEPARATOR . $file->getFilename(), 75);
+ }
}
\ No newline at end of file
diff --git a/app/Providers/GlobalViewDataProvider.php b/app/Providers/GlobalViewDataProvider.php
index f201c027..e0e31da2 100644
--- a/app/Providers/GlobalViewDataProvider.php
+++ b/app/Providers/GlobalViewDataProvider.php
@@ -65,7 +65,7 @@ class GlobalViewDataProvider extends ServiceProvider
return preg_replace($pattern, $code, $view);
});
- // shortcut for loading uploaded images
+ // shortcut for loading uploaded files
Blade::extend(function ($view) {
$pattern = $this->createPattern('upload');
$code = '';
@@ -73,6 +73,14 @@ class GlobalViewDataProvider extends ServiceProvider
return preg_replace($pattern, $code, $view);
});
+ // shortcut for loading thumbnails of uploaded images
+ Blade::extend(function ($view) {
+ $pattern = $this->createPattern('upload');
+ $code = '';
+
+ return preg_replace($pattern, $code, $view);
+ });
+
// shortcut for displaying Gravatar
Blade::extend(function ($view) {
$pattern = $this->createPattern('gravatar');
diff --git a/composer.json b/composer.json
index 2a77208a..c45e56d7 100644
--- a/composer.json
+++ b/composer.json
@@ -13,7 +13,8 @@
"pingpong/menus": "^2.2",
"watson/sitemap": "^2.0",
"mcamara/laravel-localization": "^1.1",
- "franzose/closure-table": "^4.1"
+ "franzose/closure-table": "^4.1",
+ "intervention/image": "^2.3"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
diff --git a/composer.lock b/composer.lock
index cc93517b..a245d21e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "34fec17afe62b99ed90d0f72d3536a7b",
- "content-hash": "58f7e332f9be3faf1f8d481191cf1bb1",
+ "hash": "066078c74cc6b8d99111c0e9b4b385d6",
+ "content-hash": "1574402e32047ac8589b6fc08d6d744c",
"packages": [
{
"name": "classpreloader/classpreloader",
@@ -704,6 +704,133 @@
],
"time": "2016-07-08 08:19:46"
},
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "64862e854f876bc5aee2996cab2f552db8586065"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/64862e854f876bc5aee2996cab2f552db8586065",
+ "reference": "64862e854f876bc5aee2996cab2f552db8586065",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0",
+ "psr/http-message": "~1.0"
+ },
+ "provide": {
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Psr7\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Tobias Schultze",
+ "homepage": "https://github.com/Tobion"
+ }
+ ],
+ "description": "PSR-7 message implementation that also provides common utility methods",
+ "keywords": [
+ "http",
+ "message",
+ "request",
+ "response",
+ "stream",
+ "uri",
+ "url"
+ ],
+ "time": "2016-08-03 09:33:34"
+ },
+ {
+ "name": "intervention/image",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Intervention/image.git",
+ "reference": "4064a980324f6c3bfa2bd981dfb247afa705ec3c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Intervention/image/zipball/4064a980324f6c3bfa2bd981dfb247afa705ec3c",
+ "reference": "4064a980324f6c3bfa2bd981dfb247afa705ec3c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-fileinfo": "*",
+ "guzzlehttp/psr7": "~1.1",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "~0.9.2",
+ "phpunit/phpunit": "3.*"
+ },
+ "suggest": {
+ "ext-gd": "to use GD library based image processing.",
+ "ext-imagick": "to use Imagick based image processing.",
+ "intervention/imagecache": "Caching extension for the Intervention Image library"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Intervention\\Image\\": "src/Intervention/Image"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Oliver Vogel",
+ "email": "oliver@olivervogel.net",
+ "homepage": "http://olivervogel.net/"
+ }
+ ],
+ "description": "Image handling and manipulation library with support for Laravel integration",
+ "homepage": "http://image.intervention.io/",
+ "keywords": [
+ "gd",
+ "image",
+ "imagick",
+ "laravel",
+ "thumbnail",
+ "watermark"
+ ],
+ "time": "2016-09-01 17:04:03"
+ },
{
"name": "jakub-onderka/php-console-color",
"version": "0.1",
@@ -1632,6 +1759,56 @@
"description": "Support Component of Pingpong Sky Package",
"time": "2016-01-07 08:23:04"
},
+ {
+ "name": "psr/http-message",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2016-08-06 14:39:51"
+ },
{
"name": "psr/log",
"version": "dev-master",
diff --git a/config/.gitignore b/config/.gitignore
index 2475f7d1..a6acbe5b 100644
--- a/config/.gitignore
+++ b/config/.gitignore
@@ -17,4 +17,5 @@
!services.php
!session.php
!sitemap.php
+!image.php
!view.php
diff --git a/config/app.php b/config/app.php
index 49291806..a451ec46 100644
--- a/config/app.php
+++ b/config/app.php
@@ -161,6 +161,7 @@ return [
App\Providers\SubmodulesManager::class,
Franzose\ClosureTable\ClosureTableServiceProvider::class,
\Watson\Sitemap\SitemapServiceProvider::class,
+ Intervention\Image\ImageServiceProvider::class,
/*
* Application Service Providers...
*/
diff --git a/config/image.php b/config/image.php
new file mode 100644
index 00000000..b106809e
--- /dev/null
+++ b/config/image.php
@@ -0,0 +1,20 @@
+ 'gd'
+
+);
diff --git a/database/migrations/2016_09_26_132627_RemoveOnUpdateCurrentTimestampFromContentsUpdatedAt.php b/database/migrations/2016_09_26_132627_RemoveOnUpdateCurrentTimestampFromContentsUpdatedAt.php
new file mode 100644
index 00000000..a8538c80
--- /dev/null
+++ b/database/migrations/2016_09_26_132627_RemoveOnUpdateCurrentTimestampFromContentsUpdatedAt.php
@@ -0,0 +1,29 @@
+ .card'
- });
- }
- }
-
- $.extend (loginValidationSettings, config.validations);
-
- $ ('#login-form').validate (loginValidationSettings);
-})
-//LoginForm validation
-$ (function () {
- if (!$ ('#reset-form').length) {
- return false;
- }
-
- var resetValidationSettings = {
- rules: {
- email1: {
- required: true,
- email: true
- }
- },
- messages: {
- email1: {
- required: "Please enter email address",
- email: "Please enter a valid email address"
- }
- },
- invalidHandler: function () {
- animate ({
- name: 'shake',
- selector: '.auth-container > .card'
- });
- }
- }
-
- $.extend (resetValidationSettings, config.validations);
-
- $ ('#reset-form').validate (resetValidationSettings);
-})
-//LoginForm validation
-$ (function () {
- if (!$ ('#signup-form').length) {
- return false;
- }
-
- var signupValidationSettings = {
- rules: {
- firstname: {
- required: true,
- },
- lastname: {
- required: true,
- },
- email: {
- required: true,
- email: true
- },
- password: {
- required: true,
- minlength: 8
- },
- retype_password: {
- required: true,
- minlength: 8,
- equalTo: "#password"
- },
- agree: {
- required: true,
- }
- },
- groups: {
- name: "firstname lastname",
- pass: "password retype_password",
- },
- errorPlacement: function (error, element) {
- if (
- element.attr ("name") == "firstname" ||
- element.attr ("name") == "lastname"
- ) {
- error.insertAfter ($ ("#lastname").closest ('.row'));
- element.parents ("div.form-group")
- .addClass ('has-error');
- }
- else if (
- element.attr ("name") == "password" ||
- element.attr ("name") == "retype_password"
- ) {
- error.insertAfter ($ ("#retype_password").closest ('.row'));
- element.parents ("div.form-group")
- .addClass ('has-error');
- }
- else if (element.attr ("name") == "agree") {
- error.insertAfter ("#agree-text");
- }
- else {
- error.insertAfter (element);
- }
- },
- messages: {
- firstname: "Please enter firstname and lastname",
- lastname: "Please enter firstname and lastname",
- email: {
- required: "Please enter email",
- email: "Please enter a valid email address"
- },
- password: {
- required: "Please enter password fields.",
- minlength: "Passwords should be at least 8 characters."
- },
- retype_password: {
- required: "Please enter password fields.",
- minlength: "Passwords should be at least 8 characters."
- },
- agree: "Please accept our policy"
- },
- invalidHandler: function () {
- animate ({
- name: 'shake',
- selector: '.auth-container > .card'
- });
- }
- }
-
- $.extend (signupValidationSettings, config.validations);
-
- $ ('#signup-form').validate (signupValidationSettings);
-});
-$ (function () {
-
- $ (".wyswyg").each (function () {
-
- var $toolbar = $ (this).find (".toolbar");
- var $editor = $ (this).find (".editor");
-
- var editor = new Quill ($editor.get (0), {
- theme: 'snow'
- });
-
- editor.addModule ('toolbar', {
- container: $toolbar.get (0) // Selector for toolbar container
- });
-
- });
-
});
+// //LoginForm validation
+// $ (function () {
+// if (!$ ('#login-form').length) {
+// return false;
+// }
+//
+// var loginValidationSettings = {
+// rules: {
+// username: {
+// required: true,
+// email: true
+// },
+// password: "required",
+// agree: "required"
+// },
+// messages: {
+// username: {
+// required: "Please enter username",
+// email: "Please enter a valid email address"
+// },
+// password: "Please enter password",
+// agree: "Please accept our policy"
+// },
+// invalidHandler: function () {
+// animate ({
+// name: 'shake',
+// selector: '.auth-container > .card'
+// });
+// }
+// };
+//
+// $.extend (loginValidationSettings, config.validations);
+//
+// $ ('#login-form').validate (loginValidationSettings);
+// })
+// //LoginForm validation
+// $ (function () {
+// if (!$ ('#reset-form').length) {
+// return false;
+// }
+//
+// var resetValidationSettings = {
+// rules: {
+// email1: {
+// required: true,
+// email: true
+// }
+// },
+// messages: {
+// email1: {
+// required: "Please enter email address",
+// email: "Please enter a valid email address"
+// }
+// },
+// invalidHandler: function () {
+// animate ({
+// name: 'shake',
+// selector: '.auth-container > .card'
+// });
+// }
+// }
+//
+// $.extend (resetValidationSettings, config.validations);
+//
+// $ ('#reset-form').validate (resetValidationSettings);
+// })
+// //LoginForm validation
+// $ (function () {
+// if (!$ ('#signup-form').length) {
+// return false;
+// }
+//
+// var signupValidationSettings = {
+// rules: {
+// firstname: {
+// required: true,
+// },
+// lastname: {
+// required: true,
+// },
+// email: {
+// required: true,
+// email: true
+// },
+// password: {
+// required: true,
+// minlength: 8
+// },
+// retype_password: {
+// required: true,
+// minlength: 8,
+// equalTo: "#password"
+// },
+// agree: {
+// required: true,
+// }
+// },
+// groups: {
+// name: "firstname lastname",
+// pass: "password retype_password",
+// },
+// errorPlacement: function (error, element) {
+// if (
+// element.attr ("name") == "firstname" ||
+// element.attr ("name") == "lastname"
+// ) {
+// error.insertAfter ($ ("#lastname").closest ('.row'));
+// element.parents ("div.form-group")
+// .addClass ('has-error');
+// }
+// else if (
+// element.attr ("name") == "password" ||
+// element.attr ("name") == "retype_password"
+// ) {
+// error.insertAfter ($ ("#retype_password").closest ('.row'));
+// element.parents ("div.form-group")
+// .addClass ('has-error');
+// }
+// else if (element.attr ("name") == "agree") {
+// error.insertAfter ("#agree-text");
+// }
+// else {
+// error.insertAfter (element);
+// }
+// },
+// messages: {
+// firstname: "Please enter firstname and lastname",
+// lastname: "Please enter firstname and lastname",
+// email: {
+// required: "Please enter email",
+// email: "Please enter a valid email address"
+// },
+// password: {
+// required: "Please enter password fields.",
+// minlength: "Passwords should be at least 8 characters."
+// },
+// retype_password: {
+// required: "Please enter password fields.",
+// minlength: "Passwords should be at least 8 characters."
+// },
+// agree: "Please accept our policy"
+// },
+// invalidHandler: function () {
+// animate ({
+// name: 'shake',
+// selector: '.auth-container > .card'
+// });
+// }
+// }
+//
+// $.extend (signupValidationSettings, config.validations);
+//
+// $ ('#signup-form').validate (signupValidationSettings);
+// });
+// $ (function () {
+//
+// $ (".wyswyg").each (function () {
+//
+// var $toolbar = $ (this).find (".toolbar");
+// var $editor = $ (this).find (".editor");
+//
+// var editor = new Quill ($editor.get (0), {
+// theme: 'snow'
+// });
+//
+// editor.addModule ('toolbar', {
+// container: $toolbar.get (0) // Selector for toolbar container
+// });
+//
+// });
+//
+// });
$ (function () {
$ ('#sidebar-menu, #customize-menu').metisMenu ({
@@ -665,398 +665,398 @@ $ (function () {
// });
//
// });
-$ (function () {
-
- if (!$ ('#morris-one-line-chart').length) {
- return false;
- }
-
- function drawMorrisCharts() {
-
- $ ('#morris-one-line-chart').empty ();
-
- Morris.Line ({
- element: 'morris-one-line-chart',
- data: [
- {year: '2008', value: 5},
- {year: '2009', value: 10},
- {year: '2010', value: 8},
- {year: '2011', value: 22},
- {year: '2012', value: 8},
- {year: '2014', value: 10},
- {year: '2015', value: 5}
- ],
- xkey: 'year',
- ykeys: ['value'],
- resize: true,
- lineWidth: 4,
- labels: ['Value'],
- lineColors: [config.chart.colorPrimary.toString ()],
- pointSize: 5,
- });
-
- $ ('#morris-area-chart').empty ();
-
- Morris.Area ({
- element: 'morris-area-chart',
- data: [{period: '2010 Q1', iphone: 2666, ipad: null, itouch: 2647},
- {period: '2010 Q2', iphone: 2778, ipad: 2294, itouch: 2441},
- {period: '2010 Q3', iphone: 4912, ipad: 1969, itouch: 2501},
- {period: '2010 Q4', iphone: 3767, ipad: 3597, itouch: 5689},
- {period: '2011 Q1', iphone: 6810, ipad: 1914, itouch: 2293},
- {period: '2011 Q2', iphone: 5670, ipad: 4293, itouch: 1881},
- {period: '2011 Q3', iphone: 4820, ipad: 3795, itouch: 1588},
- {period: '2011 Q4', iphone: 15073, ipad: 5967, itouch: 5175},
- {period: '2012 Q1', iphone: 10687, ipad: 4460, itouch: 2028},
- {period: '2012 Q2', iphone: 8432, ipad: 5713, itouch: 1791}],
- xkey: 'period',
- ykeys: ['iphone', 'ipad', 'itouch'],
- labels: ['iPhone', 'iPad', 'iPod Touch'],
- pointSize: 2,
- hideHover: 'auto',
- resize: true,
- lineColors: [
- tinycolor (config.chart.colorPrimary.toString ()).lighten (10).toString (),
- tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString (),
- config.chart.colorPrimary.toString ()
- ],
- lineWidth: 2,
- pointSize: 1,
- });
-
- $ ('#morris-donut-chart').empty ();
-
- Morris.Donut ({
- element: 'morris-donut-chart',
- data: [{label: "Download Sales", value: 12},
- {label: "In-Store Sales", value: 30},
- {label: "Mail-Order Sales", value: 20}],
- resize: true,
- colors: [
- tinycolor (config.chart.colorPrimary.toString ()).lighten (10).toString (),
- tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString (),
- config.chart.colorPrimary.toString ()
- ],
- });
-
- $ ('#morris-bar-chart').empty ();
-
- Morris.Bar ({
- element: 'morris-bar-chart',
- data: [{y: '2006', a: 60, b: 50},
- {y: '2007', a: 75, b: 65},
- {y: '2008', a: 50, b: 40},
- {y: '2009', a: 75, b: 65},
- {y: '2010', a: 50, b: 40},
- {y: '2011', a: 75, b: 65},
- {y: '2012', a: 100, b: 90}],
- xkey: 'y',
- ykeys: ['a', 'b'],
- labels: ['Series A', 'Series B'],
- hideHover: 'auto',
- resize: true,
- barColors: [
- config.chart.colorPrimary.toString (),
- tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString ()
- ],
- });
-
- $ ('#morris-line-chart').empty ();
-
- Morris.Line ({
- element: 'morris-line-chart',
- data: [{y: '2006', a: 100, b: 90},
- {y: '2007', a: 75, b: 65},
- {y: '2008', a: 50, b: 40},
- {y: '2009', a: 75, b: 65},
- {y: '2010', a: 50, b: 40},
- {y: '2011', a: 75, b: 65},
- {y: '2012', a: 100, b: 90}],
- xkey: 'y',
- ykeys: ['a', 'b'],
- labels: ['Series A', 'Series B'],
- hideHover: 'auto',
- resize: true,
- lineColors: [
- config.chart.colorPrimary.toString (),
- tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString ()
- ],
- });
- }
-
- drawMorrisCharts ();
-
- $ (document).on ("themechange", function () {
- drawMorrisCharts ();
- });
-});
-$ (function () {
-
- if (!$ ('#dashboard-visits-chart').length) {
- return false;
- }
-
- // drawing visits chart
- drawVisitsChart ();
-
- var el = null;
- var item = 'visits';
-
- $ ('a[data-toggle="tab"]').on ('shown.bs.tab', function (e) {
-
- el = e.target;
- item = $ (el).attr ('href').replace ('#', '');
- switchHistoryCharts (item);
-
- });
-
- $ (document).on ("themechange", function () {
- switchHistoryCharts (item);
- });
-
- function switchHistoryCharts(item) {
- var chartSelector = "#dashboard-" + item + "-chart";
-
- if ($ (chartSelector).has ('svg').length) {
- $ (chartSelector).empty ();
- }
-
- switch (item) {
- case 'visits':
- drawVisitsChart ();
- break;
- case 'downloads':
- drawDownloadsChart ();
- break;
- }
- }
-
- function drawVisitsChart() {
- var dataVisits = [
- {x: '2015-09-01', y: 70},
- {x: '2015-09-02', y: 75},
- {x: '2015-09-03', y: 50},
- {x: '2015-09-04', y: 75},
- {x: '2015-09-05', y: 50},
- {x: '2015-09-06', y: 75},
- {x: '2015-09-07', y: 86}
- ];
-
- Morris.Line ({
- element: 'dashboard-visits-chart',
- data: dataVisits,
- xkey: 'x',
- ykeys: ['y'],
- ymin: 'auto 40',
- labels: ['Visits'],
- xLabels: "day",
- hideHover: 'auto',
- yLabelFormat: function (y) {
- // Only integers
- if (y === parseInt (y, 10)) {
- return y;
- }
- else {
- return '';
- }
- },
- resize: true,
- lineColors: [
- config.chart.colorSecondary.toString (),
- ],
- pointFillColors: [
- config.chart.colorPrimary.toString (),
- ]
- });
- }
-
- function drawDownloadsChart() {
-
- var dataDownloads = [
- {
- year: '2006',
- downloads: 1300
- },
- {
- year: '2007',
- downloads: 1526
- },
- {
- year: '2008',
- downloads: 2000
- },
- {
- year: '2009',
- downloads: 1800
- },
- {
- year: '2010',
- downloads: 1650
- },
- {
- year: '2011',
- downloads: 620
- },
- {
- year: '2012',
- downloads: 1000
- },
- {
- year: '2013',
- downloads: 1896
- },
- {
- year: '2014',
- downloads: 850
- },
- {
- year: '2015',
- downloads: 1500
- }
- ];
-
- Morris.Bar ({
- element: 'dashboard-downloads-chart',
- data: dataDownloads,
- xkey: 'year',
- ykeys: ['downloads'],
- labels: ['Downloads'],
- hideHover: 'auto',
- resize: true,
- barColors: [
- config.chart.colorPrimary.toString (),
- tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString ()
- ],
- });
- }
-});
-
-$ (function () {
-
- function drawDashboardItemsListSparklines() {
- $ (".dashboard-page .items .sparkline").each (function () {
- var type = $ (this).data ('type');
-
- // There is predefined data
- if ($ (this).data ('data')) {
- var data = $ (this).data ('data').split (',').map (function (item) {
- if (item.indexOf (":") > 0) {
- return item.split (":");
- }
- else {
- return item;
- }
- });
- }
- // Generate random data
- else {
- var data = [];
- for (var i = 0; i < 17; i++) {
- data.push (Math.round (100 * Math.random ()));
- }
- }
-
- $ (this).sparkline (data, {
- barColor: config.chart.colorPrimary.toString (),
- height: $ (this).height (),
- type: type
- });
- });
- }
-
- drawDashboardItemsListSparklines ();
-
- $ (document).on ("themechange", function () {
- drawDashboardItemsListSparklines ();
- });
-});
-$ (function () {
-
- var $dashboardSalesBreakdownChart = $ ('#dashboard-sales-breakdown-chart');
-
- if (!$dashboardSalesBreakdownChart.length) {
- return false;
- }
-
- function drawSalesChart() {
-
- $dashboardSalesBreakdownChart.empty ();
-
- Morris.Donut ({
- element: 'dashboard-sales-breakdown-chart',
- data: [{label: "Download Sales", value: 12},
- {label: "In-Store Sales", value: 30},
- {label: "Mail-Order Sales", value: 20}],
- resize: true,
- colors: [
- tinycolor (config.chart.colorPrimary.toString ()).lighten (10).toString (),
- tinycolor (config.chart.colorPrimary.toString ()).darken (8).toString (),
- config.chart.colorPrimary.toString ()
- ],
- });
-
- var $sameheightContainer = $dashboardSalesBreakdownChart.closest (".sameheight-container");
-
- setSameHeights ($sameheightContainer);
- }
-
- drawSalesChart ();
-
- $ (document).on ("themechange", function () {
- drawSalesChart ();
- });
-
-})
-$ (function () {
-
- var $dashboardSalesMap = $ ('#dashboard-sales-map');
-
- if (!$dashboardSalesMap.length) {
- return false;
- }
-
- function drawSalesMap() {
-
- $dashboardSalesMap.empty ();
-
- var color = config.chart.colorPrimary.toHexString ();
- var darkColor = tinycolor (config.chart.colorPrimary.toString ()).darken (40).toHexString ();
- var selectedColor = tinycolor (config.chart.colorPrimary.toString ()).darken (10).toHexString ();
-
- var sales_data = {
- us: 2000,
- ru: 2000,
- gb: 10000,
- fr: 10000,
- de: 10000,
- cn: 10000,
- in: 10000,
- sa: 10000,
- ca: 10000,
- br: 5000,
- au: 5000
- };
-
- $dashboardSalesMap.vectorMap ({
- map: 'world_en',
- backgroundColor: 'transparent',
- color: '#E5E3E5',
- hoverOpacity: 0.7,
- selectedColor: selectedColor,
- enableZoom: true,
- showTooltip: true,
- values: sales_data,
- scaleColors: [color, darkColor],
- normalizeFunction: 'linear'
- });
- }
-
- drawSalesMap ();
-
- $ (document).on ("themechange", function () {
- drawSalesMap ();
- });
-});
+// $ (function () {
+//
+// if (!$ ('#morris-one-line-chart').length) {
+// return false;
+// }
+//
+// function drawMorrisCharts() {
+//
+// $ ('#morris-one-line-chart').empty ();
+//
+// Morris.Line ({
+// element: 'morris-one-line-chart',
+// data: [
+// {year: '2008', value: 5},
+// {year: '2009', value: 10},
+// {year: '2010', value: 8},
+// {year: '2011', value: 22},
+// {year: '2012', value: 8},
+// {year: '2014', value: 10},
+// {year: '2015', value: 5}
+// ],
+// xkey: 'year',
+// ykeys: ['value'],
+// resize: true,
+// lineWidth: 4,
+// labels: ['Value'],
+// lineColors: [config.chart.colorPrimary.toString ()],
+// pointSize: 5,
+// });
+//
+// $ ('#morris-area-chart').empty ();
+//
+// Morris.Area ({
+// element: 'morris-area-chart',
+// data: [{period: '2010 Q1', iphone: 2666, ipad: null, itouch: 2647},
+// {period: '2010 Q2', iphone: 2778, ipad: 2294, itouch: 2441},
+// {period: '2010 Q3', iphone: 4912, ipad: 1969, itouch: 2501},
+// {period: '2010 Q4', iphone: 3767, ipad: 3597, itouch: 5689},
+// {period: '2011 Q1', iphone: 6810, ipad: 1914, itouch: 2293},
+// {period: '2011 Q2', iphone: 5670, ipad: 4293, itouch: 1881},
+// {period: '2011 Q3', iphone: 4820, ipad: 3795, itouch: 1588},
+// {period: '2011 Q4', iphone: 15073, ipad: 5967, itouch: 5175},
+// {period: '2012 Q1', iphone: 10687, ipad: 4460, itouch: 2028},
+// {period: '2012 Q2', iphone: 8432, ipad: 5713, itouch: 1791}],
+// xkey: 'period',
+// ykeys: ['iphone', 'ipad', 'itouch'],
+// labels: ['iPhone', 'iPad', 'iPod Touch'],
+// pointSize: 2,
+// hideHover: 'auto',
+// resize: true,
+// lineColors: [
+// tinycolor (config.chart.colorPrimary.toString ()).lighten (10).toString (),
+// tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString (),
+// config.chart.colorPrimary.toString ()
+// ],
+// lineWidth: 2,
+// pointSize: 1,
+// });
+//
+// $ ('#morris-donut-chart').empty ();
+//
+// Morris.Donut ({
+// element: 'morris-donut-chart',
+// data: [{label: "Download Sales", value: 12},
+// {label: "In-Store Sales", value: 30},
+// {label: "Mail-Order Sales", value: 20}],
+// resize: true,
+// colors: [
+// tinycolor (config.chart.colorPrimary.toString ()).lighten (10).toString (),
+// tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString (),
+// config.chart.colorPrimary.toString ()
+// ],
+// });
+//
+// $ ('#morris-bar-chart').empty ();
+//
+// Morris.Bar ({
+// element: 'morris-bar-chart',
+// data: [{y: '2006', a: 60, b: 50},
+// {y: '2007', a: 75, b: 65},
+// {y: '2008', a: 50, b: 40},
+// {y: '2009', a: 75, b: 65},
+// {y: '2010', a: 50, b: 40},
+// {y: '2011', a: 75, b: 65},
+// {y: '2012', a: 100, b: 90}],
+// xkey: 'y',
+// ykeys: ['a', 'b'],
+// labels: ['Series A', 'Series B'],
+// hideHover: 'auto',
+// resize: true,
+// barColors: [
+// config.chart.colorPrimary.toString (),
+// tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString ()
+// ],
+// });
+//
+// $ ('#morris-line-chart').empty ();
+//
+// Morris.Line ({
+// element: 'morris-line-chart',
+// data: [{y: '2006', a: 100, b: 90},
+// {y: '2007', a: 75, b: 65},
+// {y: '2008', a: 50, b: 40},
+// {y: '2009', a: 75, b: 65},
+// {y: '2010', a: 50, b: 40},
+// {y: '2011', a: 75, b: 65},
+// {y: '2012', a: 100, b: 90}],
+// xkey: 'y',
+// ykeys: ['a', 'b'],
+// labels: ['Series A', 'Series B'],
+// hideHover: 'auto',
+// resize: true,
+// lineColors: [
+// config.chart.colorPrimary.toString (),
+// tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString ()
+// ],
+// });
+// }
+//
+// drawMorrisCharts ();
+//
+// $ (document).on ("themechange", function () {
+// drawMorrisCharts ();
+// });
+// });
+// $ (function () {
+//
+// if (!$ ('#dashboard-visits-chart').length) {
+// return false;
+// }
+//
+// // drawing visits chart
+// drawVisitsChart ();
+//
+// var el = null;
+// var item = 'visits';
+//
+// $ ('a[data-toggle="tab"]').on ('shown.bs.tab', function (e) {
+//
+// el = e.target;
+// item = $ (el).attr ('href').replace ('#', '');
+// switchHistoryCharts (item);
+//
+// });
+//
+// $ (document).on ("themechange", function () {
+// switchHistoryCharts (item);
+// });
+//
+// function switchHistoryCharts(item) {
+// var chartSelector = "#dashboard-" + item + "-chart";
+//
+// if ($ (chartSelector).has ('svg').length) {
+// $ (chartSelector).empty ();
+// }
+//
+// switch (item) {
+// case 'visits':
+// drawVisitsChart ();
+// break;
+// case 'downloads':
+// drawDownloadsChart ();
+// break;
+// }
+// }
+//
+// function drawVisitsChart() {
+// var dataVisits = [
+// {x: '2015-09-01', y: 70},
+// {x: '2015-09-02', y: 75},
+// {x: '2015-09-03', y: 50},
+// {x: '2015-09-04', y: 75},
+// {x: '2015-09-05', y: 50},
+// {x: '2015-09-06', y: 75},
+// {x: '2015-09-07', y: 86}
+// ];
+//
+// Morris.Line ({
+// element: 'dashboard-visits-chart',
+// data: dataVisits,
+// xkey: 'x',
+// ykeys: ['y'],
+// ymin: 'auto 40',
+// labels: ['Visits'],
+// xLabels: "day",
+// hideHover: 'auto',
+// yLabelFormat: function (y) {
+// // Only integers
+// if (y === parseInt (y, 10)) {
+// return y;
+// }
+// else {
+// return '';
+// }
+// },
+// resize: true,
+// lineColors: [
+// config.chart.colorSecondary.toString (),
+// ],
+// pointFillColors: [
+// config.chart.colorPrimary.toString (),
+// ]
+// });
+// }
+//
+// function drawDownloadsChart() {
+//
+// var dataDownloads = [
+// {
+// year: '2006',
+// downloads: 1300
+// },
+// {
+// year: '2007',
+// downloads: 1526
+// },
+// {
+// year: '2008',
+// downloads: 2000
+// },
+// {
+// year: '2009',
+// downloads: 1800
+// },
+// {
+// year: '2010',
+// downloads: 1650
+// },
+// {
+// year: '2011',
+// downloads: 620
+// },
+// {
+// year: '2012',
+// downloads: 1000
+// },
+// {
+// year: '2013',
+// downloads: 1896
+// },
+// {
+// year: '2014',
+// downloads: 850
+// },
+// {
+// year: '2015',
+// downloads: 1500
+// }
+// ];
+//
+// Morris.Bar ({
+// element: 'dashboard-downloads-chart',
+// data: dataDownloads,
+// xkey: 'year',
+// ykeys: ['downloads'],
+// labels: ['Downloads'],
+// hideHover: 'auto',
+// resize: true,
+// barColors: [
+// config.chart.colorPrimary.toString (),
+// tinycolor (config.chart.colorPrimary.toString ()).darken (10).toString ()
+// ],
+// });
+// }
+// });
+//
+// $ (function () {
+//
+// function drawDashboardItemsListSparklines() {
+// $ (".dashboard-page .items .sparkline").each (function () {
+// var type = $ (this).data ('type');
+//
+// // There is predefined data
+// if ($ (this).data ('data')) {
+// var data = $ (this).data ('data').split (',').map (function (item) {
+// if (item.indexOf (":") > 0) {
+// return item.split (":");
+// }
+// else {
+// return item;
+// }
+// });
+// }
+// // Generate random data
+// else {
+// var data = [];
+// for (var i = 0; i < 17; i++) {
+// data.push (Math.round (100 * Math.random ()));
+// }
+// }
+//
+// $ (this).sparkline (data, {
+// barColor: config.chart.colorPrimary.toString (),
+// height: $ (this).height (),
+// type: type
+// });
+// });
+// }
+//
+// drawDashboardItemsListSparklines ();
+//
+// $ (document).on ("themechange", function () {
+// drawDashboardItemsListSparklines ();
+// });
+// });
+// $ (function () {
+//
+// var $dashboardSalesBreakdownChart = $ ('#dashboard-sales-breakdown-chart');
+//
+// if (!$dashboardSalesBreakdownChart.length) {
+// return false;
+// }
+//
+// function drawSalesChart() {
+//
+// $dashboardSalesBreakdownChart.empty ();
+//
+// Morris.Donut ({
+// element: 'dashboard-sales-breakdown-chart',
+// data: [{label: "Download Sales", value: 12},
+// {label: "In-Store Sales", value: 30},
+// {label: "Mail-Order Sales", value: 20}],
+// resize: true,
+// colors: [
+// tinycolor (config.chart.colorPrimary.toString ()).lighten (10).toString (),
+// tinycolor (config.chart.colorPrimary.toString ()).darken (8).toString (),
+// config.chart.colorPrimary.toString ()
+// ],
+// });
+//
+// var $sameheightContainer = $dashboardSalesBreakdownChart.closest (".sameheight-container");
+//
+// setSameHeights ($sameheightContainer);
+// }
+//
+// drawSalesChart ();
+//
+// $ (document).on ("themechange", function () {
+// drawSalesChart ();
+// });
+//
+// })
+// $ (function () {
+//
+// var $dashboardSalesMap = $ ('#dashboard-sales-map');
+//
+// if (!$dashboardSalesMap.length) {
+// return false;
+// }
+//
+// function drawSalesMap() {
+//
+// $dashboardSalesMap.empty ();
+//
+// var color = config.chart.colorPrimary.toHexString ();
+// var darkColor = tinycolor (config.chart.colorPrimary.toString ()).darken (40).toHexString ();
+// var selectedColor = tinycolor (config.chart.colorPrimary.toString ()).darken (10).toHexString ();
+//
+// var sales_data = {
+// us: 2000,
+// ru: 2000,
+// gb: 10000,
+// fr: 10000,
+// de: 10000,
+// cn: 10000,
+// in: 10000,
+// sa: 10000,
+// ca: 10000,
+// br: 5000,
+// au: 5000
+// };
+//
+// $dashboardSalesMap.vectorMap ({
+// map: 'world_en',
+// backgroundColor: 'transparent',
+// color: '#E5E3E5',
+// hoverOpacity: 0.7,
+// selectedColor: selectedColor,
+// enableZoom: true,
+// showTooltip: true,
+// values: sales_data,
+// scaleColors: [color, darkColor],
+// normalizeFunction: 'linear'
+// });
+// }
+//
+// drawSalesMap ();
+//
+// $ (document).on ("themechange", function () {
+// drawSalesMap ();
+// });
+// });
$ (function () {
$ ('.actions-list > li').on ('click', '.check', function (e) {
@@ -1460,6 +1460,11 @@ $ (document).ready (function () {
$ ("#" + tabCard.prop ('id') + "-tab").addClass ('tab-with-error');
});
+
+ $('#removeTitlePhoto').click(function () {
+ $('#titlePhotoContainer').remove();
+ // $('existingTitlePhoto').val(null);
+ });
});
/***********************************************
diff --git a/resources/assets/admin/js/viewerJs/compatibility.js b/resources/assets/admin/js/viewerJs/compatibility.js
new file mode 100644
index 00000000..06f54bff
--- /dev/null
+++ b/resources/assets/admin/js/viewerJs/compatibility.js
@@ -0,0 +1,577 @@
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
+/* Copyright 2012 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* globals VBArray, PDFJS */
+
+'use strict';
+
+// Initializing PDFJS global object here, it case if we need to change/disable
+// some PDF.js features, e.g. range requests
+if (typeof PDFJS === 'undefined') {
+ (typeof window !== 'undefined' ? window : this).PDFJS = {};
+}
+
+// Checking if the typed arrays are supported
+// Support: iOS<6.0 (subarray), IE<10, Android<4.0
+(function checkTypedArrayCompatibility() {
+ if (typeof Uint8Array !== 'undefined') {
+ // Support: iOS<6.0
+ if (typeof Uint8Array.prototype.subarray === 'undefined') {
+ Uint8Array.prototype.subarray = function subarray(start, end) {
+ return new Uint8Array(this.slice(start, end));
+ };
+ Float32Array.prototype.subarray = function subarray(start, end) {
+ return new Float32Array(this.slice(start, end));
+ };
+ }
+
+ // Support: Android<4.1
+ if (typeof Float64Array === 'undefined') {
+ window.Float64Array = Float32Array;
+ }
+ return;
+ }
+
+ function subarray(start, end) {
+ return new TypedArray(this.slice(start, end));
+ }
+
+ function setArrayOffset(array, offset) {
+ if (arguments.length < 2) {
+ offset = 0;
+ }
+ for (var i = 0, n = array.length; i < n; ++i, ++offset) {
+ this[offset] = array[i] & 0xFF;
+ }
+ }
+
+ function TypedArray(arg1) {
+ var result, i, n;
+ if (typeof arg1 === 'number') {
+ result = [];
+ for (i = 0; i < arg1; ++i) {
+ result[i] = 0;
+ }
+ } else if ('slice' in arg1) {
+ result = arg1.slice(0);
+ } else {
+ result = [];
+ for (i = 0, n = arg1.length; i < n; ++i) {
+ result[i] = arg1[i];
+ }
+ }
+
+ result.subarray = subarray;
+ result.buffer = result;
+ result.byteLength = result.length;
+ result.set = setArrayOffset;
+
+ if (typeof arg1 === 'object' && arg1.buffer) {
+ result.buffer = arg1.buffer;
+ }
+ return result;
+ }
+
+ window.Uint8Array = TypedArray;
+ window.Int8Array = TypedArray;
+
+ // we don't need support for set, byteLength for 32-bit array
+ // so we can use the TypedArray as well
+ window.Uint32Array = TypedArray;
+ window.Int32Array = TypedArray;
+ window.Uint16Array = TypedArray;
+ window.Float32Array = TypedArray;
+ window.Float64Array = TypedArray;
+})();
+
+// URL = URL || webkitURL
+// Support: Safari<7, Android 4.2+
+(function normalizeURLObject() {
+ if (!window.URL) {
+ window.URL = window.webkitURL;
+ }
+})();
+
+// Object.defineProperty()?
+// Support: Android<4.0, Safari<5.1
+(function checkObjectDefinePropertyCompatibility() {
+ if (typeof Object.defineProperty !== 'undefined') {
+ var definePropertyPossible = true;
+ try {
+ // some browsers (e.g. safari) cannot use defineProperty() on DOM objects
+ // and thus the native version is not sufficient
+ Object.defineProperty(new Image(), 'id', { value: 'test' });
+ // ... another test for android gb browser for non-DOM objects
+ var Test = function Test() {};
+ Test.prototype = { get id() { } };
+ Object.defineProperty(new Test(), 'id',
+ { value: '', configurable: true, enumerable: true, writable: false });
+ } catch (e) {
+ definePropertyPossible = false;
+ }
+ if (definePropertyPossible) {
+ return;
+ }
+ }
+
+ Object.defineProperty = function objectDefineProperty(obj, name, def) {
+ delete obj[name];
+ if ('get' in def) {
+ obj.__defineGetter__(name, def['get']);
+ }
+ if ('set' in def) {
+ obj.__defineSetter__(name, def['set']);
+ }
+ if ('value' in def) {
+ obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
+ this.__defineGetter__(name, function objectDefinePropertyGetter() {
+ return value;
+ });
+ return value;
+ });
+ obj[name] = def.value;
+ }
+ };
+})();
+
+
+// No XMLHttpRequest#response?
+// Support: IE<11, Android <4.0
+(function checkXMLHttpRequestResponseCompatibility() {
+ var xhrPrototype = XMLHttpRequest.prototype;
+ var xhr = new XMLHttpRequest();
+ if (!('overrideMimeType' in xhr)) {
+ // IE10 might have response, but not overrideMimeType
+ // Support: IE10
+ Object.defineProperty(xhrPrototype, 'overrideMimeType', {
+ value: function xmlHttpRequestOverrideMimeType(mimeType) {}
+ });
+ }
+ if ('responseType' in xhr) {
+ return;
+ }
+
+ // The worker will be using XHR, so we can save time and disable worker.
+ PDFJS.disableWorker = true;
+
+ Object.defineProperty(xhrPrototype, 'responseType', {
+ get: function xmlHttpRequestGetResponseType() {
+ return this._responseType || 'text';
+ },
+ set: function xmlHttpRequestSetResponseType(value) {
+ if (value === 'text' || value === 'arraybuffer') {
+ this._responseType = value;
+ if (value === 'arraybuffer' &&
+ typeof this.overrideMimeType === 'function') {
+ this.overrideMimeType('text/plain; charset=x-user-defined');
+ }
+ }
+ }
+ });
+
+ // Support: IE9
+ if (typeof VBArray !== 'undefined') {
+ Object.defineProperty(xhrPrototype, 'response', {
+ get: function xmlHttpRequestResponseGet() {
+ if (this.responseType === 'arraybuffer') {
+ return new Uint8Array(new VBArray(this.responseBody).toArray());
+ } else {
+ return this.responseText;
+ }
+ }
+ });
+ return;
+ }
+
+ Object.defineProperty(xhrPrototype, 'response', {
+ get: function xmlHttpRequestResponseGet() {
+ if (this.responseType !== 'arraybuffer') {
+ return this.responseText;
+ }
+ var text = this.responseText;
+ var i, n = text.length;
+ var result = new Uint8Array(n);
+ for (i = 0; i < n; ++i) {
+ result[i] = text.charCodeAt(i) & 0xFF;
+ }
+ return result.buffer;
+ }
+ });
+})();
+
+// window.btoa (base64 encode function) ?
+// Support: IE<10
+(function checkWindowBtoaCompatibility() {
+ if ('btoa' in window) {
+ return;
+ }
+
+ var digits =
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+
+ window.btoa = function windowBtoa(chars) {
+ var buffer = '';
+ var i, n;
+ for (i = 0, n = chars.length; i < n; i += 3) {
+ var b1 = chars.charCodeAt(i) & 0xFF;
+ var b2 = chars.charCodeAt(i + 1) & 0xFF;
+ var b3 = chars.charCodeAt(i + 2) & 0xFF;
+ var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
+ var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
+ var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
+ buffer += (digits.charAt(d1) + digits.charAt(d2) +
+ digits.charAt(d3) + digits.charAt(d4));
+ }
+ return buffer;
+ };
+})();
+
+// window.atob (base64 encode function)?
+// Support: IE<10
+(function checkWindowAtobCompatibility() {
+ if ('atob' in window) {
+ return;
+ }
+
+ // https://github.com/davidchambers/Base64.js
+ var digits =
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+ window.atob = function (input) {
+ input = input.replace(/=+$/, '');
+ if (input.length % 4 === 1) {
+ throw new Error('bad atob input');
+ }
+ for (
+ // initialize result and counters
+ var bc = 0, bs, buffer, idx = 0, output = '';
+ // get next character
+ buffer = input.charAt(idx++);
+ // character found in table?
+ // initialize bit storage and add its ascii value
+ ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
+ // and if not first of each 4 characters,
+ // convert the first 8 bits to one ascii character
+ bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
+ ) {
+ // try to find character in table (0-63, not found => -1)
+ buffer = digits.indexOf(buffer);
+ }
+ return output;
+ };
+})();
+
+// Function.prototype.bind?
+// Support: Android<4.0, iOS<6.0
+(function checkFunctionPrototypeBindCompatibility() {
+ if (typeof Function.prototype.bind !== 'undefined') {
+ return;
+ }
+
+ Function.prototype.bind = function functionPrototypeBind(obj) {
+ var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
+ var bound = function functionPrototypeBindBound() {
+ var args = headArgs.concat(Array.prototype.slice.call(arguments));
+ return fn.apply(obj, args);
+ };
+ return bound;
+ };
+})();
+
+// HTMLElement dataset property
+// Support: IE<11, Safari<5.1, Android<4.0
+(function checkDatasetProperty() {
+ var div = document.createElement('div');
+ if ('dataset' in div) {
+ return; // dataset property exists
+ }
+
+ Object.defineProperty(HTMLElement.prototype, 'dataset', {
+ get: function() {
+ if (this._dataset) {
+ return this._dataset;
+ }
+
+ var dataset = {};
+ for (var j = 0, jj = this.attributes.length; j < jj; j++) {
+ var attribute = this.attributes[j];
+ if (attribute.name.substring(0, 5) !== 'data-') {
+ continue;
+ }
+ var key = attribute.name.substring(5).replace(/\-([a-z])/g,
+ function(all, ch) {
+ return ch.toUpperCase();
+ });
+ dataset[key] = attribute.value;
+ }
+
+ Object.defineProperty(this, '_dataset', {
+ value: dataset,
+ writable: false,
+ enumerable: false
+ });
+ return dataset;
+ },
+ enumerable: true
+ });
+})();
+
+// HTMLElement classList property
+// Support: IE<10, Android<4.0, iOS<5.0
+(function checkClassListProperty() {
+ var div = document.createElement('div');
+ if ('classList' in div) {
+ return; // classList property exists
+ }
+
+ function changeList(element, itemName, add, remove) {
+ var s = element.className || '';
+ var list = s.split(/\s+/g);
+ if (list[0] === '') {
+ list.shift();
+ }
+ var index = list.indexOf(itemName);
+ if (index < 0 && add) {
+ list.push(itemName);
+ }
+ if (index >= 0 && remove) {
+ list.splice(index, 1);
+ }
+ element.className = list.join(' ');
+ return (index >= 0);
+ }
+
+ var classListPrototype = {
+ add: function(name) {
+ changeList(this.element, name, true, false);
+ },
+ contains: function(name) {
+ return changeList(this.element, name, false, false);
+ },
+ remove: function(name) {
+ changeList(this.element, name, false, true);
+ },
+ toggle: function(name) {
+ changeList(this.element, name, true, true);
+ }
+ };
+
+ Object.defineProperty(HTMLElement.prototype, 'classList', {
+ get: function() {
+ if (this._classList) {
+ return this._classList;
+ }
+
+ var classList = Object.create(classListPrototype, {
+ element: {
+ value: this,
+ writable: false,
+ enumerable: true
+ }
+ });
+ Object.defineProperty(this, '_classList', {
+ value: classList,
+ writable: false,
+ enumerable: false
+ });
+ return classList;
+ },
+ enumerable: true
+ });
+})();
+
+// Check console compatibility
+// In older IE versions the console object is not available
+// unless console is open.
+// Support: IE<10
+(function checkConsoleCompatibility() {
+ if (!('console' in window)) {
+ window.console = {
+ log: function() {},
+ error: function() {},
+ warn: function() {}
+ };
+ } else if (!('bind' in console.log)) {
+ // native functions in IE9 might not have bind
+ console.log = (function(fn) {
+ return function(msg) { return fn(msg); };
+ })(console.log);
+ console.error = (function(fn) {
+ return function(msg) { return fn(msg); };
+ })(console.error);
+ console.warn = (function(fn) {
+ return function(msg) { return fn(msg); };
+ })(console.warn);
+ }
+})();
+
+// Check onclick compatibility in Opera
+// Support: Opera<15
+(function checkOnClickCompatibility() {
+ // workaround for reported Opera bug DSK-354448:
+ // onclick fires on disabled buttons with opaque content
+ function ignoreIfTargetDisabled(event) {
+ if (isDisabled(event.target)) {
+ event.stopPropagation();
+ }
+ }
+ function isDisabled(node) {
+ return node.disabled || (node.parentNode && isDisabled(node.parentNode));
+ }
+ if (navigator.userAgent.indexOf('Opera') !== -1) {
+ // use browser detection since we cannot feature-check this bug
+ document.addEventListener('click', ignoreIfTargetDisabled, true);
+ }
+})();
+
+// Checks if possible to use URL.createObjectURL()
+// Support: IE
+(function checkOnBlobSupport() {
+ // sometimes IE loosing the data created with createObjectURL(), see #3977
+ if (navigator.userAgent.indexOf('Trident') >= 0) {
+ PDFJS.disableCreateObjectURL = true;
+ }
+})();
+
+// Checks if navigator.language is supported
+(function checkNavigatorLanguage() {
+ if ('language' in navigator) {
+ return;
+ }
+ PDFJS.locale = navigator.userLanguage || 'en-US';
+})();
+
+(function checkRangeRequests() {
+ // Safari has issues with cached range requests see:
+ // https://github.com/mozilla/pdf.js/issues/3260
+ // Last tested with version 6.0.4.
+ // Support: Safari 6.0+
+ var isSafari = Object.prototype.toString.call(
+ window.HTMLElement).indexOf('Constructor') > 0;
+
+ // Older versions of Android (pre 3.0) has issues with range requests, see:
+ // https://github.com/mozilla/pdf.js/issues/3381.
+ // Make sure that we only match webkit-based Android browsers,
+ // since Firefox/Fennec works as expected.
+ // Support: Android<3.0
+ var regex = /Android\s[0-2][^\d]/;
+ var isOldAndroid = regex.test(navigator.userAgent);
+
+ // Range requests are broken in Chrome 39 and 40, https://crbug.com/442318
+ var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(navigator.userAgent);
+
+ if (isSafari || isOldAndroid || isChromeWithRangeBug) {
+ PDFJS.disableRange = true;
+ PDFJS.disableStream = true;
+ }
+})();
+
+// Check if the browser supports manipulation of the history.
+// Support: IE<10, Android<4.2
+(function checkHistoryManipulation() {
+ // Android 2.x has so buggy pushState support that it was removed in
+ // Android 3.0 and restored as late as in Android 4.2.
+ // Support: Android 2.x
+ if (!history.pushState || navigator.userAgent.indexOf('Android 2.') >= 0) {
+ PDFJS.disableHistory = true;
+ }
+})();
+
+// Support: IE<11, Chrome<21, Android<4.4, Safari<6
+(function checkSetPresenceInImageData() {
+ // IE < 11 will use window.CanvasPixelArray which lacks set function.
+ if (window.CanvasPixelArray) {
+ if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
+ window.CanvasPixelArray.prototype.set = function(arr) {
+ for (var i = 0, ii = this.length; i < ii; i++) {
+ this[i] = arr[i];
+ }
+ };
+ }
+ } else {
+ // Old Chrome and Android use an inaccessible CanvasPixelArray prototype.
+ // Because we cannot feature detect it, we rely on user agent parsing.
+ var polyfill = false, versionMatch;
+ if (navigator.userAgent.indexOf('Chrom') >= 0) {
+ versionMatch = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
+ // Chrome < 21 lacks the set function.
+ polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
+ } else if (navigator.userAgent.indexOf('Android') >= 0) {
+ // Android < 4.4 lacks the set function.
+ // Android >= 4.4 will contain Chrome in the user agent,
+ // thus pass the Chrome check above and not reach this block.
+ polyfill = /Android\s[0-4][^\d]/g.test(navigator.userAgent);
+ } else if (navigator.userAgent.indexOf('Safari') >= 0) {
+ versionMatch = navigator.userAgent.
+ match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
+ // Safari < 6 lacks the set function.
+ polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
+ }
+
+ if (polyfill) {
+ var contextPrototype = window.CanvasRenderingContext2D.prototype;
+ contextPrototype._createImageData = contextPrototype.createImageData;
+ contextPrototype.createImageData = function(w, h) {
+ var imageData = this._createImageData(w, h);
+ imageData.data.set = function(arr) {
+ for (var i = 0, ii = this.length; i < ii; i++) {
+ this[i] = arr[i];
+ }
+ };
+ return imageData;
+ };
+ }
+ }
+})();
+
+// Support: IE<10, Android<4.0, iOS
+(function checkRequestAnimationFrame() {
+ function fakeRequestAnimationFrame(callback) {
+ window.setTimeout(callback, 20);
+ }
+
+ var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
+ if (isIOS) {
+ // requestAnimationFrame on iOS is broken, replacing with fake one.
+ window.requestAnimationFrame = fakeRequestAnimationFrame;
+ return;
+ }
+ if ('requestAnimationFrame' in window) {
+ return;
+ }
+ window.requestAnimationFrame =
+ window.mozRequestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ fakeRequestAnimationFrame;
+})();
+
+(function checkCanvasSizeLimitation() {
+ var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
+ var isAndroid = /Android/g.test(navigator.userAgent);
+ if (isIOS || isAndroid) {
+ // 5MP
+ PDFJS.maxCanvasPixels = 5242880;
+ }
+})();
+
+// Disable fullscreen support for certain problematic configurations.
+// Support: IE11+ (when embedded).
+(function checkFullscreenSupport() {
+ var isEmbeddedIE = (navigator.userAgent.indexOf('Trident') >= 0 &&
+ window.parent !== window);
+ if (isEmbeddedIE) {
+ PDFJS.disableFullscreen = true;
+ }
+})();
diff --git a/resources/assets/admin/js/viewerJs/example.local.css b/resources/assets/admin/js/viewerJs/example.local.css
new file mode 100644
index 00000000..034347d4
--- /dev/null
+++ b/resources/assets/admin/js/viewerJs/example.local.css
@@ -0,0 +1,27 @@
+/* This is just a sample file with CSS rules. You should write your own @font-face declarations
+ * to add support for your desired fonts.
+ */
+
+@font-face {
+ font-family: 'Novecentowide Book';
+ src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot");
+ src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot?#iefix") format("embedded-opentype"),
+ url("/ViewerJS/fonts/Novecentowide-Bold-webfont.woff") format("woff"),
+ url("/fonts/Novecentowide-Bold-webfont.ttf") format("truetype"),
+ url("/fonts/Novecentowide-Bold-webfont.svg#NovecentowideBookBold") format("svg");
+ font-weight: normal;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'exotica';
+ src: url('/ViewerJS/fonts/Exotica-webfont.eot');
+ src: url('/ViewerJS/fonts/Exotica-webfont.eot?#iefix') format('embedded-opentype'),
+ url('/ViewerJS/fonts/Exotica-webfont.woff') format('woff'),
+ url('/ViewerJS/fonts/Exotica-webfont.ttf') format('truetype'),
+ url('/ViewerJS/fonts/Exotica-webfont.svg#exoticamedium') format('svg');
+ font-weight: normal;
+ font-style: normal;
+
+}
+
diff --git a/resources/assets/admin/js/viewerJs/images/kogmbh.png b/resources/assets/admin/js/viewerJs/images/kogmbh.png
new file mode 100644
index 00000000..00e8f4de
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/kogmbh.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/nlnet.png b/resources/assets/admin/js/viewerJs/images/nlnet.png
new file mode 100644
index 00000000..e75ab2e8
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/nlnet.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/texture.png b/resources/assets/admin/js/viewerJs/images/texture.png
new file mode 100644
index 00000000..df008649
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/texture.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-download.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-download.png
new file mode 100644
index 00000000..8676d8e2
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-download.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-fullscreen.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-fullscreen.png
new file mode 100644
index 00000000..fa730955
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-fullscreen.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-menuArrows.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-menuArrows.png
new file mode 100644
index 00000000..31b06b5a
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-menuArrows.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-pageDown.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-pageDown.png
new file mode 100644
index 00000000..762ac43e
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-pageDown.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-pageUp.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-pageUp.png
new file mode 100644
index 00000000..3155b8bd
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-pageUp.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-presentation.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-presentation.png
new file mode 100644
index 00000000..0f224232
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-presentation.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-zoomIn.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-zoomIn.png
new file mode 100644
index 00000000..670acd93
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-zoomIn.png differ
diff --git a/resources/assets/admin/js/viewerJs/images/toolbarButton-zoomOut.png b/resources/assets/admin/js/viewerJs/images/toolbarButton-zoomOut.png
new file mode 100644
index 00000000..810fbf98
Binary files /dev/null and b/resources/assets/admin/js/viewerJs/images/toolbarButton-zoomOut.png differ
diff --git a/resources/assets/admin/js/viewerJs/index.html b/resources/assets/admin/js/viewerJs/index.html
new file mode 100644
index 00000000..2eb1fd47
--- /dev/null
+++ b/resources/assets/admin/js/viewerJs/index.html
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
+