File modules/cms/ui/action/index/IndexManifestAction.class.php
Last commit: Fri Apr 15 14:51:22 2022 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization.
1 <?php 2 namespace cms\ui\action\index; 3 use cms\action\Method; 4 use cms\base\Configuration; 5 use cms\ui\action\IndexAction; 6 use cms\ui\themes\ThemeStyle; 7 use util\Session; 8 use cms\action\RequestParams; 9 use cms\auth\Auth; 10 use cms\auth\AuthRunner; 11 use cms\base\Configuration as C; 12 use cms\base\Startup; 13 use cms\model\BaseObject; 14 use cms\model\Project; 15 use cms\model\User; 16 use cms\model\Value; 17 use cms\ui\themes\Theme; 18 use Exception; 19 use language\Messages; 20 use util\Html; 21 use util\json\JSON; 22 use logger\Logger; 23 use util\Less; 24 use util\UIUtils; 25 use \util\exception\ObjectNotFoundException; 26 27 28 /** 29 * Creating the website manifest. 30 * 31 * See https://developer.mozilla.org/de/docs/Web/Manifest 32 */ 33 class IndexManifestAction extends IndexAction implements Method { 34 35 public function view() { 36 $user = $this->currentUser; 37 38 if ( $user ) 39 $this->lastModified( C::subset('config')->get('last_modification_time',time() ) ); 40 else 41 $this->lastModified( time() ); 42 43 $currentStyle = $this->getUserStyle( $user ); 44 45 $themeStyle = new ThemeStyle( Configuration::subset('style')->get($currentStyle,[]) ); // user style config 46 47 48 // Theme base color for smartphones colorizing their status bar. 49 $themeColor = UIUtils::getColorHexCode($themeStyle->getThemeColor()); 50 51 $appName = C::subset(['application'])->get('name',Startup::TITLE); 52 53 $value = array( 54 'name' => $appName, 55 'description' => $appName, 56 'short_name' => 'CMS', 57 'display' => 'standalone', 58 'orientation' => 'landscape', 59 'background_color' => $themeColor, 60 'theme_color' => $themeColor, 61 'start_url' => './', 62 ); 63 64 header("Content-Type: application/manifest+json"); 65 $this->setTemplateVar( 'manifest',JSON::encode($value) ); 66 } 67 68 69 public function post() { 70 } 71 }
Downloadmodules/cms/ui/action/index/IndexManifestAction.class.php
History Fri, 15 Apr 2022 14:51:22 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization. Fri, 26 Feb 2021 00:04:49 +0100 Jan Dankert New: Request may contain JSON,XML in POST data. This is good for API clients. Wed, 10 Feb 2021 22:04:26 +0100 Jan Dankert Provide the theme configuration through a class. Wed, 18 Nov 2020 20:23:57 +0100 Jan Dankert Cleaning up the UI actions. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.