public function addScript($fileName) { $url = "/contents/apps/{$this->id}/src/JS/{$fileName}"; \Lobby::addScript("{$this->id}-{$fileName}", $url); }
<?php if (!\Lobby::status("lobby.serve")) { /** * For enabling access by \Lobby\Panel */ require __DIR__ . "/class.panel.php"; /** * Panel UI */ if (!\Lobby::status("lobby.install")) { \Lobby::addScript("superfish", "/includes/lib/modules/panel/lib/superfish.js"); \Lobby::addStyle("panel", "/includes/lib/modules/panel/lib/panel.css"); \Lobby::addScript("panel", "/includes/lib/modules/panel/lib/panel.js"); } if (\Lobby::$config['server_check'] === true) { /** * Default Items provided by the module */ \Lobby\Panel::addTopItem("netStatus", array("html" => "<span id='net' title='Online'></span>", "position" => "right")); \Lobby::addScript("panel-item-connection", "/includes/lib/modules/panel/connection/connection.js"); } \Lobby::hook("body.begin", function () { include __DIR__ . "/panel.ui.php"; }); \Lobby::hook("admin.body.begin", function () { include __DIR__ . "/panel.ui.php"; }); }
<?php if (!\Lobby::status("lobby.admin")) { \Lobby::addScript("keyring_module", L_URL . "/contents/apps/keyring/module/js/keyring.js"); }
/** * Return the app class object */ public function run() { if ($this->app) { require_once L_DIR . "/includes/src/App.php"; require_once $this->appDir . "/App.php"; \Lobby::addScript("app", "/includes/lib/core/JS/app.js"); $appInfo = $this->info; $className = str_replace("-", "_", $this->app); /* Create the \Lobby\App Object */ $class = new $className(); /* Send app details to the \Lobby\App */ $class->setTheVars($appInfo); /** * Define the App Constants */ define("APP_DIR", $this->appDir); define("APP_SRC", $this->info['srcURL']); if (!defined("APP_URL")) { /** * We specifically check if APP_URL is defined, * because it may be already defined by `singleapp` module. */ define("APP_URL", $this->info['URL']); } /* Return the App Object */ return $class; } }
<?php \Lobby::addScript("dynscroll", "/includes/lib/scrollbar/scrollbar.js"); \Lobby::addStyle("dynscroll", "/includes/lib/scrollbar/scrollbar.css"); $this->addScript("/jquery.scrollTo.js"); $this->addStyle("/game.css"); $this->addScript("/game.js"); ?> <div class="contents"> <div class="loading"> <img src="<?php echo APP_SRC; ?> /src/Image/loading.gif" /> </div> <div class="controls"> <a id="newGame">New</a> <a id="solveGame">Solve</a> </div> <div class="letters"></div> <div class="input"></div> <div class="submit"> <a class='button'>Submit</a> <div class='status'></div> </div> <div class="boxes"> <div class="boxes-inner"> <div class='section' id='sec1'></div> </div> </div> <audio src='<?php
/** * Tell Lobby to load a script */ public function addScript($file_location) { $url = "/contents/themes/" . THEME_ID . $file_location; \Lobby::addScript("theme." . THEME_ID . "-{$file_location}", $url); }
/** * Add the <head> files if it's not the install page */ if (\Lobby::curPage() != "/admin/install.php") { /** * Styles */ \Lobby::addStyle("jqueryui", "/includes/lib/jquery/jquery-ui.css"); // jQuery UI /** * Scripts */ \Lobby::addScript("jquery", "/includes/lib/jquery/jquery.js"); \Lobby::addScript("jqueryui", "/includes/lib/jquery/jquery-ui.js"); // jQuery UI \Lobby::addScript("main", "/includes/lib/core/JS/main.js"); /** * Left Menu */ \Lobby\UI\Panel::addTopItem("lobbyHome", array("text" => "Home", "href" => L_URL, "position" => "left")); $adminArray = array("text" => "Admin", "href" => "/admin", "position" => "left"); $adminArray["subItems"] = array("AppManager" => array("text" => "Apps", "href" => "/admin/apps.php"), "LobbyStore" => array("text" => "Lobby Store", "href" => "/admin/lobby-store.php"), "About" => array("text" => "About", "href" => "/admin/about.php")); \Lobby\UI\Panel::addTopItem("lobbyAdmin", $adminArray); /** * If there is a update available either app or core, add an * "Update Available" icon on the right side of panel */ $AppUpdates = json_decode(getOption("app_updates"), true); $lobby_version = getOption("lobby_version"); $latestVersion = getOption("lobby_latest_version"); if (\Lobby\FS::exists("/upgrade.lobby")) {
/** * Define some pages by default */ public static function defaults() { /** * Route App Pages (/app/{appname}/{page}) to according apps */ self::route("/app/[:appID]?/[**:page]?", function ($request) { $AppID = $request->appID; $GLOBALS['AppID'] = $AppID; $page = $request->page != "" ? "/{$request->page}" : "/"; /** * Check if App exists */ $App = new \Lobby\Apps($AppID); if ($App->exists && $App->isEnabled() && substr($page, 0, 7) != "/Admin/") { $class = $App->run(); $AppInfo = $App->info; /** * Set the title */ \Lobby::setTitle($AppInfo['name']); /** * Add the App item to the navbar */ \Lobby\Panel::addTopItem("lobbyApp{$AppID}", array("text" => $AppInfo['name'], "href" => APP_URL, "position" => "left")); $page_response = $class->page($page); if ($page_response == "auto") { if ($page == "/") { $page = "/index"; } $GLOBALS['workspaceHTML'] = $class->inc("/src/Page{$page}.php"); } else { $GLOBALS['workspaceHTML'] = $page_response; } if ($GLOBALS['workspaceHTML'] == null) { ser(); } } else { ser(); } }); /** * Dashboard Page * The main Page. Add CSS & JS accordingly */ self::route("/", function () { \Lobby::addScript("metrojs", "/includes/lib/metrojs/metrojs.js"); \Lobby::addStyle("metrojs", "/includes/lib/metrojs/metrojs.css"); \Lobby::addScript("dynscroll", "/includes/lib/scrollbar/scrollbar.js"); \Lobby::addStyle("dynscroll", "/includes/lib/scrollbar/scrollbar.css"); \Lobby::addScript("jquery.contextmenu", "/includes/lib/jquery/jquery.contextmenu.js"); \Lobby::addStyle("jquery.contextmenu", "/includes/lib/jquery/jquery.contextmenu.css"); \Lobby::addScript("dashboard", "/includes/lib/core/JS/dashboard.js"); \Lobby::addStyle("dashboard", "/includes/lib/core/CSS/dashboard.css"); \Lobby::setTitle("Dashboard"); $GLOBALS['workspaceHTML'] = array("/includes/lib/core/Inc/main.php"); }); /** * Administration */ self::route("/admin/app/[:appID]?/[**:page]?", function ($request) { $AppID = $request->appID; $GLOBALS['AppID'] = $AppID; $page = $request->page != "" ? "/Admin/{$request->page}" : "/Admin/index"; /** * Check if App exists */ $App = new \Lobby\Apps($AppID); if ($App->exists && $App->isEnabled()) { /** * Redirect /src/ files to App's Source in /contents folder */ $class = $App->run(); $AppInfo = $App->info; /** * Set the title */ \Lobby::setTitle($AppInfo['name']); /** * Add the App item to the navbar */ \Lobby\Panel::addTopItem("lobbyApp{$AppID}", array("text" => "Admin > " . $AppInfo['name'], "href" => "/admin/app/{$AppID}", "position" => "left")); $page_response = $class->page($page); if ($page_response == "auto") { if ($page == "/") { $page = "/index"; } $GLOBALS['workspaceHTML'] = $class->inc("/src/Page{$page}.php"); } else { $GLOBALS['workspaceHTML'] = $page_response; } if ($GLOBALS['workspaceHTML'] === false || $GLOBALS['workspaceHTML'] == null) { ob_start(); ser("Error", "The app '<strong>{$AppID}</strong>' does not have an Admin Page"); $error = ob_get_contents(); ob_end_clean(); $GLOBALS['workspaceHTML'] = "<div class='contents'>" . $error . "</div>"; } } }); }