/** * @NoAdminRequired * @NoCSRFRequired */ public function index() { if (defined('DEBUG') && DEBUG) { \OCP\Util::addScript('tasks', 'vendor/angularjs/angular'); \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route'); \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate'); \OCP\Util::addScript('tasks', 'vendor/momentjs/moment'); \OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0'); } else { \OCP\Util::addScript('tasks', 'vendor/angularjs/angular.min'); \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route.min'); \OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate.min'); \OCP\Util::addScript('tasks', 'vendor/momentjs/moment.min'); \OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0.min'); } \OCP\Util::addScript('tasks', 'public/app'); \OCP\Util::addScript('tasks', 'vendor/appframework/app'); \OCP\Util::addScript('tasks', 'vendor/timepicker/jquery.ui.timepicker'); \OCP\Util::addStyle('tasks', 'style'); \OCP\Util::addStyle('tasks', 'vendor/bootstrap/bootstrap'); $date = new \DateTimeZone(\OC_Calendar_App::getTimezone()); $day = new \DateTime('today', $date); $day = $day->format('d'); // TODO: Make a HTMLTemplateResponse class $response = new TemplateResponse('tasks', 'main'); $response->setParams(array('DOM' => $day)); return $response; }
/** * Load the frontend files needed */ public function loadFrontend() { \OCP\Util::addStyle('ocusagecharts', 'c3js/c3'); \OCP\Util::addScript('ocusagecharts', 'c3js/d3.min'); \OCP\Util::addScript('ocusagecharts', 'c3js/c3.min'); \OCP\Util::addScript('ocusagecharts', 'c3js/initGraphs'); }
/** * Load additional scripts when the files app is visible */ public static function onLoadFilesAppScripts() { Util::addScript('snannyowncloudapi', 'tabview'); Util::addScript('snannyowncloudapi', 'filesplugin'); Util::addScript('snannyowncloudapi', 'fileupload'); Util::addScript('snannyowncloudapi', 'templateutil'); Util::addStyle('snannyowncloudapi', 'style'); }
function vendor_script($app, $files) { if (is_array($files)) { foreach ($files as $file) { \OCP\Util::addScript('chat', '../vendor/' . $file); } } else { \OCP\Util::addScript('chat', '../vendor/' . $files); } }
public static function init() { //check if curl extension installed if (!in_array('curl', get_loaded_extensions())) { \OCP\Util::writeLog(self::APP_ID, 'This app needs cUrl PHP extension', \OCP\Util::DEBUG); return false; } \OC::$CLASSPATH['OCA\\User_persona\\Policy'] = self::APP_PATH . 'lib/policy.php'; \OCP\App::registerAdmin(self::APP_ID, 'settings'); if (!\OCP\User::isLoggedIn()) { \OC::$CLASSPATH['OCA\\User_persona\\Validator'] = self::APP_PATH . 'lib/validator.php'; \OC::$CLASSPATH['OC_USER_PERSONA'] = self::APP_PATH . 'user_persona.php'; \OC_User::useBackend('persona'); \OCP\Util::connectHook('OC_User', 'post_login', "OCA\\User_persona\\Validator", "postlogin_hook"); \OCP\Util::addScript(self::APP_ID, 'utils'); } }
/** * @NoAdminRequired * @NoCSRFRequired */ public function index() { $imppTypes = Properties::getTypesForProperty('IMPP'); $adrTypes = Properties::getTypesForProperty('ADR'); $phoneTypes = Properties::getTypesForProperty('TEL'); $emailTypes = Properties::getTypesForProperty('EMAIL'); $cloudTypes = Properties::getTypesForProperty('CLOUD'); $ims = Properties::getIMOptions(); $imProtocols = array(); foreach ($ims as $name => $values) { $imProtocols[$name] = $values['displayname']; } $maxUploadFilesize = $this->utilFactory->maxUploadFilesize('/'); \OCP\Util::addScript('placeholder', null); \OCP\Util::addScript('../vendor/blueimp-md5/js/md5', null); \OCP\Util::addScript('jquery.avatar', null); \OCP\Util::addScript('avatar', null); $response = new TemplateResponse($this->appName, 'contacts'); $response->setParams(['uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => $this->utilFactory->humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'cloudTypes' => $cloudTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $this->importManager]); return $response; }
/** * @NoAdminRequired * @NoCSRFRequired * * @throws \Exception If the URL is not valid. * @return TemplateResponse */ public function redirect() { $templateName = 'redirect'; $route = 'mail.page.index'; $mailURL = $this->urlGenerator->linkToRoute($route); $url = $this->request->getParam('src'); $authorizedRedirect = false; if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) { throw new \Exception('URL is not valid.', 1); } // If the request has a referrer from this domain redirect the user without interaction // this is there to prevent an open redirector. // Since we can't prevent the referrer from being added with a HTTP only header we rely on an // additional JS file here. if (parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) === Util::getServerHostName()) { Util::addScript('mail', 'autoredirect'); $authorizedRedirect = true; } $params = ['authorizedRedirect' => $authorizedRedirect, 'url' => $url, 'urlHost' => parse_url($url, PHP_URL_HOST), 'mailURL' => $mailURL]; return new TemplateResponse($this->appName, $templateName, $params, 'guest'); }
/** * @NoAdminRequired * @NoCSRFRequired */ public function index() { \OC::$server->getNavigationManager()->setActiveEntry($this->appName); $importManager = new ImportManager(); $imppTypes = Properties::getTypesForProperty('IMPP'); $adrTypes = Properties::getTypesForProperty('ADR'); $phoneTypes = Properties::getTypesForProperty('TEL'); $emailTypes = Properties::getTypesForProperty('EMAIL'); $ims = Properties::getIMOptions(); $imProtocols = array(); foreach ($ims as $name => $values) { $imProtocols[$name] = $values['displayname']; } $maxUploadFilesize = \OCP\Util::maxUploadFilesize('/'); \OCP\Util::addScript('', 'jquery.multiselect'); \OCP\Util::addScript('', 'tags'); \OCP\Util::addScript('placeholder'); \OCP\Util::addScript('3rdparty', 'md5/md5.min'); \OCP\Util::addScript('jquery.avatar'); \OCP\Util::addScript('avatar'); \OCP\Util::addScript('contacts', 'jquery.combobox'); \OCP\Util::addScript('contacts', 'modernizr.custom'); \OCP\Util::addScript('contacts', 'app'); \OCP\Util::addScript('contacts', 'addressbooks'); \OCP\Util::addScript('contacts', 'contacts'); \OCP\Util::addScript('contacts', 'storage'); \OCP\Util::addScript('contacts', 'groups'); \OCP\Util::addScript('contacts', 'jquery.ocaddnew'); \OCP\Util::addScript('contacts', 'otherbackendconfig'); \OCP\Util::addScript('files', 'jquery.fileupload'); \OCP\Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop'); \OCP\Util::addStyle('', 'jquery.multiselect'); \OCP\Util::addStyle('contacts', 'jquery.combobox'); \OCP\Util::addStyle('contacts', 'jquery.ocaddnew'); \OCP\Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop'); \OCP\Util::addStyle('contacts', 'contacts'); $response = new TemplateResponse($this->appName, 'contacts'); $response->setParams(array('uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $importManager)); return $response; }
/** * @param string $renderAs * @param string $appId application id */ public function __construct($renderAs, $appId = '') { // yes - should be injected .... $this->config = \OC::$server->getConfig(); // Decide which page we show if ($renderAs == 'user') { parent::__construct('core', 'layout.user'); if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { $this->assign('bodyid', 'body-settings'); } else { $this->assign('bodyid', 'body-user'); } // Code integrity notification $integrityChecker = \OC::$server->getIntegrityCodeChecker(); if (!$integrityChecker->hasPassedCheck()) { \OCP\Util::addScript('core', 'integritycheck-failed-notification'); } // Add navigation entry $this->assign('application', ''); $this->assign('appid', $appId); $navigation = \OC_App::getNavigation(); $this->assign('navigation', $navigation); $settingsNavigation = \OC_App::getSettingsNavigation(); $this->assign('settingsnavigation', $settingsNavigation); foreach ($navigation as $entry) { if ($entry['active']) { $this->assign('application', $entry['name']); break; } } foreach ($settingsNavigation as $entry) { if ($entry['active']) { $this->assign('application', $entry['name']); break; } } $userDisplayName = \OC_User::getDisplayName(); $appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0; if ($appsMgmtActive) { $l = \OC::$server->getL10N('lib'); $this->assign('application', $l->t('Apps')); } $this->assign('user_displayname', $userDisplayName); $this->assign('user_uid', \OC_User::getUser()); $this->assign('appsmanagement_active', $appsMgmtActive); $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true); if (\OC_User::getUser() === false) { $this->assign('userAvatarSet', false); } else { $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists()); } } else { if ($renderAs == 'error') { parent::__construct('core', 'layout.guest', '', false); $this->assign('bodyid', 'body-login'); } else { if ($renderAs == 'guest') { parent::__construct('core', 'layout.guest'); $this->assign('bodyid', 'body-login'); } else { parent::__construct('core', 'layout.base'); } } } // Send the language to our layouts $this->assign('language', \OC_L10N::findLanguage()); if (\OC::$server->getSystemConfig()->getValue('installed', false)) { if (empty(self::$versionHash)) { $v = \OC_App::getAppVersions(); $v['core'] = implode('.', \OCP\Util::getVersion()); self::$versionHash = md5(implode(',', $v)); } } else { self::$versionHash = md5('not installed'); } $useAssetPipeline = self::isAssetPipelineEnabled(); if ($useAssetPipeline) { $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash])); $this->generateAssets(); } else { // Add the js files $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts); $this->assign('jsfiles', array()); if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') { $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash])); } foreach ($jsFiles as $info) { $web = $info[1]; $file = $info[2]; $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash); } // Add the css files $cssFiles = self::findStylesheetFiles(\OC_Util::$styles); $this->assign('cssfiles', array()); foreach ($cssFiles as $info) { $web = $info[1]; $file = $info[2]; $this->append('cssfiles', $web . '/' . $file . '?v=' . self::$versionHash); } } }
<?php \OCP\Util::addScript('music', 'vendor/underscore/underscore-min'); \OCP\Util::addScript('music', 'vendor/angular/angular.min'); \OCP\Util::addScript('music', 'vendor/angular/angular-route.min'); \OCP\Util::addScript('music', 'vendor/soundmanager/soundmanager2'); \OCP\Util::addScript('music', 'vendor/restangular/restangular.min'); \OCP\Util::addScript('music', 'vendor/angular-gettext/angular-gettext.min'); \OCP\Util::addScript('music', 'public/app'); \OCP\Util::addStyle('music', 'style-playerbar'); \OCP\Util::addStyle('music', 'style-sidebar'); \OCP\Util::addStyle('music', 'style'); \OCP\Util::addStyle('music', 'mobile'); \OCP\Util::addStyle('music', 'tablet'); ?> <div id="app" ng-app="Music" ng-cloak ng-init="started = false; lang = '<?php p($_['lang']); ?> '"> <div ng-controller="MainController"> <!-- this will be used to display the flash element to give the user a chance to unblock flash --> <div id="sm2-container" ng-class="{started: started}"></div> <div id="playerbar" ng-controller="PlayerController" ng-class="{started: started}"> <div id="play-controls"> <img ng-click="prev()" class="control small svg" alt="{{'Previous' | translate }}" src="<?php p(OCP\image_path('music', 'play-previous.svg')); ?>
public static function initTemplateEngine($renderAs) { if (self::$initTemplateEngineFirstRun) { //apps that started before the template initialization can load their own scripts/styles //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true //meaning the last script/style in this list will be loaded first if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { OC_Util::addScript('backgroundjobs', null, true); } } OC_Util::addStyle("tooltip", null, true); OC_Util::addStyle('jquery-ui-fixes', null, true); OC_Util::addVendorStyle('jquery-ui/themes/base/jquery-ui', null, true); OC_Util::addStyle("multiselect", null, true); OC_Util::addStyle("fixes", null, true); OC_Util::addStyle("global", null, true); OC_Util::addStyle("apps", null, true); OC_Util::addStyle("fonts", null, true); OC_Util::addStyle("icons", null, true); OC_Util::addStyle("mobile", null, true); OC_Util::addStyle("header", null, true); OC_Util::addStyle("inputs", null, true); OC_Util::addStyle("styles", null, true); // avatars if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) { \OC_Util::addScript('avatar', null, true); \OC_Util::addScript('jquery.avatar', null, true); \OC_Util::addScript('placeholder', null, true); } OC_Util::addScript('oc-backbone', null, true); OC_Util::addVendorScript('core', 'backbone/backbone', true); OC_Util::addVendorScript('snapjs/dist/latest/snap', null, true); OC_Util::addScript('mimetypelist', null, true); OC_Util::addScript('mimetype', null, true); OC_Util::addScript("apps", null, true); OC_Util::addScript("oc-requesttoken", null, true); OC_Util::addScript('search', 'search', true); OC_Util::addScript("config", null, true); OC_Util::addScript("eventsource", null, true); OC_Util::addScript("octemplate", null, true); OC_Util::addTranslations("core", null, true); OC_Util::addScript("l10n", null, true); OC_Util::addScript("js", null, true); OC_Util::addScript("oc-dialogs", null, true); OC_Util::addScript("jquery.ocdialog", null, true); OC_Util::addStyle("jquery.ocdialog"); OC_Util::addScript("compatibility", null, true); OC_Util::addScript("placeholders", null, true); OC_Util::addScript('files/fileinfo'); OC_Util::addScript('files/client'); // Add the stuff we need always // following logic will import all vendor libraries that are // specified in core/js/core.json $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json'); if ($fileContent !== false) { $coreDependencies = json_decode($fileContent, true); foreach (array_reverse($coreDependencies['vendor']) as $vendorLibrary) { // remove trailing ".js" as addVendorScript will append it OC_Util::addVendorScript(substr($vendorLibrary, 0, strlen($vendorLibrary) - 3), null, true); } } else { throw new \Exception('Cannot read core/js/core.json'); } if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) { // shim for the davclient.js library \OCP\Util::addScript('files/iedavclient'); } self::$initTemplateEngineFirstRun = false; } }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', function () { \OCP\Util::addScript('oc-backbone-webdav'); \OCP\Util::addScript('comments', 'app'); \OCP\Util::addScript('comments', 'commentmodel'); \OCP\Util::addScript('comments', 'commentcollection'); \OCP\Util::addScript('comments', 'commentsummarymodel'); \OCP\Util::addScript('comments', 'commentstabview'); \OCP\Util::addScript('comments', 'filesplugin'); \OCP\Util::addStyle('comments', 'comments'); }); $activityManager = \OC::$server->getActivityManager(); $activityManager->registerExtension(function () { $application = new \OCP\AppFramework\App('comments'); /** @var \OCA\Comments\Activity\Extension $extension */ $extension = $application->getContainer()->query('OCA\\Comments\\Activity\\Extension'); return $extension; }); $managerListener = function (\OCP\Comments\CommentsEvent $event) use($activityManager) { $application = new \OCP\AppFramework\App('comments'); /** @var \OCA\Comments\Activity\Listener $listener */ $listener = $application->getContainer()->query('OCA\\Comments\\Activity\\Listener'); $listener->commentEvent($event); };
<?php /** * ownCloud - gsync plugin * * @author Victor Dubiniuk * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA_Gsync; App::initController(); \OCP\Util::addScript(App::APP_ID, 'settings'); $info = \OCP\App::getAppInfo(App::APP_ID); $tmpl = new \OCP\Template(App::APP_ID, 'settings'); $tmpl->assign(App::GOOGLE_CLIENT_ID, App::getClientId()); $tmpl->assign(App::GOOGLE_SECRET, App::getSecret()); $tmpl->assign(App::GOOGLE_REFRESH_TOKEN, App::getRefreshToken()); $tmpl->assign('gsync_redirect', App::getRedirectUri()); $tmpl->assign('app_version', @$info['version']); return $tmpl->fetchPage();
/** * Prints the upgrade page */ private static function printUpgradePage() { $systemConfig = \OC::$server->getSystemConfig(); $oldTheme = $systemConfig->getValue('theme'); $systemConfig->setValue('theme', ''); \OCP\Util::addScript('config'); // needed for web root \OCP\Util::addScript('update'); // check whether this is a core update or apps update $installedVersion = $systemConfig->getValue('version', '0.0.0'); $currentVersion = implode('.', OC_Util::getVersion()); $appManager = \OC::$server->getAppManager(); $tmpl = new OC_Template('', 'update.admin', 'guest'); $tmpl->assign('version', OC_Util::getVersionString()); // if not a core upgrade, then it's apps upgrade if (version_compare($currentVersion, $installedVersion, '=')) { $tmpl->assign('isAppsOnlyUpgrade', true); } else { $tmpl->assign('isAppsOnlyUpgrade', false); } // get third party apps $ocVersion = OC_Util::getVersion(); $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); $tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion)); $tmpl->assign('productName', 'ownCloud'); // for now $tmpl->assign('oldTheme', $oldTheme); $tmpl->printPage(); }
<?php /** * ownCloud - Updater plugin * * @author Victor Dubiniuk * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Updater; \OCP\User::checkAdminUser(); \OCP\Util::addScript(App::APP_ID, '3rdparty/angular'); \OCP\Util::addScript(App::APP_ID, 'app'); \OCP\Util::addScript(App::APP_ID, 'controllers'); \OCP\Util::addStyle(App::APP_ID, 'updater'); if (!@file_exists(App::getBackupBase())) { Helper::mkdir(App::getBackupBase()); } $data = App::getFeed(); $isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array(); $tmpl = new \OCP\Template(App::APP_ID, 'admin'); $lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat'); $tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck)); $tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false'); $tmpl->assign('channels', Channel::getChannels()); $tmpl->assign('currentChannel', Channel::getCurrentChannel()); $tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : ''); return $tmpl->fetchPage();
<?php // JS Scripts \OCP\Util::addScript('dashboard', 'script'); // CSS Styles \OCP\Util::addStyle('dashboard', 'widgets'); \OCP\Util::addStyle('dashboard', 'control'); /* $widgets = $_['enabledWidgets']; $widgetsJson = OC_JSON::encode($widgets); */ ?> <div id="app"> <div id="app-content"> <?php print_unescaped($this->inc('part.content')); ?> <?php print_unescaped($this->inc('part.control')); ?> </div> </div>
$tmpl->printPage(); exit; } if (isset($_GET['t'])) { $token = $_GET['t']; $tmpl = new \OCP\Template('documents', 'public', 'guest'); try { $file = File::getByShareToken($token); if ($file->isPasswordProtected() && !$file->checkPassword(@$_POST['password'])) { if (isset($_POST['password'])) { $tmpl->assign('wrongpw', true); } $tmpl->assign('hasPassword', true); } else { \OCP\Util::addStyle('documents', '3rdparty/webodf/dojo-app'); \OCP\Util::addScript('documents', 'documents'); if ($file->getFileId()) { $session = new Db\Session(); $session->loadBy('file_id', $file->getFileId()); if ($session->getEsId()) { $member = new Db\Member(); $members = $member->getCollectionBy('es_id', $session->getEsId()); } else { $members = 0; } $tmpl->assign('total', count($members) + 1); } else { $tmpl->assign('total', 1); } $tmpl->assign('document', $token); }
<?php /** * ownCloud - Documents App * * @author Victor Dubiniuk * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Documents; \OCP\Util::addScript('documents', 'personal'); $tmpl = new \OCP\Template('documents', 'personal'); $savePath = \OCP\Config::getUserValue(\OCP\User::getUser(), 'documents', 'save_path', '/'); $tmpl->assign('savePath', $savePath); return $tmpl->fetchPage();
<?php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('pdflintview'); \OCP\App::setActiveNavigationEntry( 'pdflintview' ); \OCP\Util::addScript('pdflintview', 'ajaxaggregator'); ?>
/** * @deprecated include javascript and css in template files * shorthand for addScript for files in the 3rdparty directory * @param string $name the name of the file without the suffix */ public function add3rdPartyScript($name) { \OCP\Util::addScript($this->appName . '/3rdparty', $name); }
$eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', function () { // FIXME: no public API for these ? \OC_Util::addVendorScript('select2/select2'); \OC_Util::addVendorStyle('select2/select2'); \OCP\Util::addScript('select2-toggleselect'); \OCP\Util::addScript('oc-backbone-webdav'); \OCP\Util::addScript('systemtags/systemtags'); \OCP\Util::addScript('systemtags/systemtagmodel'); \OCP\Util::addScript('systemtags/systemtagsmappingcollection'); \OCP\Util::addScript('systemtags/systemtagscollection'); \OCP\Util::addScript('systemtags/systemtagsinputfield'); \OCP\Util::addScript('systemtags', 'app'); \OCP\Util::addScript('systemtags', 'systemtagsfilelist'); \OCP\Util::addScript('systemtags', 'filesplugin'); \OCP\Util::addScript('systemtags', 'systemtagsinfoview'); \OCP\Util::addStyle('systemtags'); \OCP\Util::addStyle('systemtags', 'systemtagsfilelist'); }); $activityManager = \OC::$server->getActivityManager(); $activityManager->registerExtension(function () { $application = new \OCP\AppFramework\App('systemtags'); /** @var \OCA\SystemTags\Activity\Extension $extension */ $extension = $application->getContainer()->query('OCA\\SystemTags\\Activity\\Extension'); return $extension; }); $managerListener = function (ManagerEvent $event) use($activityManager) { $application = new \OCP\AppFramework\App('systemtags'); /** @var \OCA\SystemTags\Activity\Listener $listener */ $listener = $application->getContainer()->query('OCA\\SystemTags\\Activity\\Listener'); $listener->event($event);
<?php \OCP\Util::addScript('ownnote', 'admin'); $folder = $_['folder']; $disableAnnouncement = $_['disableAnnouncement']; $l = OCP\Util::getL10N('ownnote'); ?> <div class="section"> <h2>ownNote</h2> <label for="ownnote-type"><?php p($l->t("How would you like to store your notes?")); ?> </label><br> <select id="ownnote-type"> <option <?php if ($folder == "") { echo "selected"; } ?> value=""><?php p($l->t("Database only")); ?> </option> <option <?php if ($folder != "") { echo "selected"; } ?> value="folder"><?php p($l->t("Database and folder"));
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ namespace OCA\Documents; \OCP\User::checkLoggedIn(); \OCP\JSON::checkAppEnabled('documents'); \OCP\App::setActiveNavigationEntry('documents_index'); \OCP\Util::addStyle('documents', 'style'); \OCP\Util::addStyle('documents', '3rdparty/webodf/dojo-app'); \OCP\Util::addScript('documents', 'documents'); \OCP\Util::addScript('files', 'file-upload'); \OCP\Util::addScript('files', 'jquery.iframe-transport'); \OCP\Util::addScript('files', 'jquery.fileupload'); $tmpl = new \OCP\Template('documents', 'documents', 'user'); $previewsEnabled = \OC::$server->getConfig()->getSystemValue('enable_previews', true); $unstable = \OCP\Config::getAppValue('documents', 'unstable', 'false'); $maxUploadFilesize = \OCP\Util::maxUploadFilesize("/"); $savePath = \OCP\Config::getUserValue(\OCP\User::getUser(), 'documents', 'save_path', '/'); $tmpl->assign('enable_previews', $previewsEnabled); $tmpl->assign('useUnstable', $unstable); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize)); $tmpl->assign('savePath', $savePath); $tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes')); $tmpl->printPage();
<?php /** * ownCloud - singlesignon * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author dauba <*****@*****.**> * @copyright dauba 2015 */ namespace OCA\SingleSignOn\AppInfo; use OCP\AppFramework\App; $app = new App('singlesignon'); $application = new Application(); $container = $app->getContainer(); $container->registerService("L10N", function ($c) { return $c->getServerContainer()->getL10N("singlesignon"); }); $processor = new \OCA\SingleSignOn\SingleSignOnProcessor(); $processor->run(); \OCP\Util::addScript("singlesignon", "script");
/** * @param string $renderAs * @param string $appId application id */ public function __construct($renderAs, $appId = '') { // yes - should be injected .... $this->config = \OC::$server->getConfig(); // Decide which page we show if ($renderAs == 'user') { parent::__construct('core', 'layout.user'); if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { $this->assign('bodyid', 'body-settings'); } else { $this->assign('bodyid', 'body-user'); } // Update notification if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) { $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig()); $data = $updater->check(); if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) { $this->assign('updateAvailable', true); $this->assign('updateVersion', $data['versionstring']); $this->assign('updateLink', $data['web']); \OCP\Util::addScript('core', 'update-notification'); } else { $this->assign('updateAvailable', false); // No update available or not an admin user } } else { $this->assign('updateAvailable', false); // Update check is disabled } // Add navigation entry $this->assign('application', ''); $this->assign('appid', $appId); $navigation = OC_App::getNavigation(); $this->assign('navigation', $navigation); $settingsNavigation = OC_App::getSettingsNavigation(); $this->assign('settingsnavigation', $settingsNavigation); foreach ($navigation as $entry) { if ($entry['active']) { $this->assign('application', $entry['name']); break; } } foreach ($settingsNavigation as $entry) { if ($entry['active']) { $this->assign('application', $entry['name']); break; } } $userDisplayName = OC_User::getDisplayName(); $this->assign('user_displayname', $userDisplayName); $this->assign('user_uid', OC_User::getUser()); $this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0); $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true)); $this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser())); } else { if ($renderAs == 'error') { parent::__construct('core', 'layout.guest', '', false); $this->assign('bodyid', 'body-login'); } else { if ($renderAs == 'guest') { parent::__construct('core', 'layout.guest'); $this->assign('bodyid', 'body-login'); } else { parent::__construct('core', 'layout.base'); } } } // Send the language to our layouts $this->assign('language', OC_L10N::findLanguage()); if (empty(self::$versionHash)) { $v = OC_App::getAppVersions(); $v['core'] = implode('.', \OC_Util::getVersion()); self::$versionHash = md5(implode(',', $v)); } $useAssetPipeline = self::isAssetPipelineEnabled(); if ($useAssetPipeline) { $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash))); $this->generateAssets(); } else { // Add the js files $jsFiles = self::findJavascriptFiles(OC_Util::$scripts); $this->assign('jsfiles', array(), false); if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') { $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash))); } foreach ($jsFiles as $info) { $web = $info[1]; $file = $info[2]; $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash); } // Add the css files $cssFiles = self::findStylesheetFiles(OC_Util::$styles); $this->assign('cssfiles', array()); foreach ($cssFiles as $info) { $web = $info[1]; $file = $info[2]; $this->append('cssfiles', $web . '/' . $file . '?v=' . self::$versionHash); } } }
<?php /** * ownCloud - user_permission * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Dino Peng <*****@*****.**> * @copyright Dino Peng 2015 */ namespace OCA\User_Permission\AppInfo; $app = new Application(); $app->getContainer()->query('UserHooks')->register(); \OCP\Util::addScript('user_permission', 'permission'); \OCP\Util::addStyle('user_permission', "style");
\OCP\Util::connectHook('OCP\\Share', 'post_unshare', 'OCA\\Music\\Hooks\\Share', 'itemUnshared'); // TODO: disabled because it can delay the share a lot /* \OCP\Util::connectHook( 'OCP\Share', 'post_shared', 'OCA\Music\Hooks\Share', 'itemShared' ); */ /** * register search provider */ \OC_Search::registerProvider('OCA\\Music\\Utility\\Search'); /** * register settings */ \OCP\App::registerPersonal($c->query('AppName'), 'settings/user'); /** * load styles and scripts */ $appName = $c->query('AppName'); if (version_compare(implode('.', \OCP\Util::getVersion()), '7.8', '<=')) { // fileactions $c->query('API')->addScript('public/fileactions', $appName); // file player for public sharing page $c->query('API')->addScript('public/musicFilePlayer', $appName); } else { // fileactions \OCP\Util::addScript($appName, 'public/fileactions'); // file player for public sharing page \OCP\Util::addScript($appName, 'public/musicFilePlayer'); }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ if (\OC::$server->getConfig()->getSystemValue('updatechecker', true) === true) { $updater = new \OC\Updater\VersionCheck(\OC::$server->getHTTPClientService(), \OC::$server->getConfig()); $updateChecker = new \OCA\UpdateNotification\UpdateChecker($updater); $userObject = \OC::$server->getUserSession()->getUser(); if ($userObject !== null) { if (\OC::$server->getGroupManager()->isAdmin($userObject->getUID())) { if ($updateChecker->getUpdateState() !== []) { \OCP\Util::addScript('updatenotification', 'notification'); OC_Hook::connect('\\OCP\\Config', 'js', $updateChecker, 'getJavaScript'); } \OC_App::registerAdmin('updatenotification', 'admin'); } } $manager = \OC::$server->getNotificationManager(); $manager->registerNotifier(function () use($manager) { return new \OCA\UpdateNotification\Notification\Notifier($manager, \OC::$server->getL10NFactory()); }, function () { $l = \OC::$server->getL10N('updatenotification'); return ['id' => 'updatenotification', 'name' => $l->t('Update notifications')]; }); }
OCP\Util::addscript('files', 'file-upload'); OCP\Util::addscript('files', 'jquery.iframe-transport'); OCP\Util::addscript('files', 'jquery.fileupload'); OCP\Util::addscript('files', 'jquery-visibility'); OCP\Util::addscript('files', 'fileinfomodel'); OCP\Util::addscript('files', 'filesummary'); OCP\Util::addscript('files', 'breadcrumb'); OCP\Util::addscript('files', 'filelist'); OCP\Util::addscript('files', 'search'); \OCP\Util::addScript('files', 'favoritesfilelist'); \OCP\Util::addScript('files', 'tagsplugin'); \OCP\Util::addScript('files', 'favoritesplugin'); \OCP\Util::addScript('files', 'detailfileinfoview'); \OCP\Util::addScript('files', 'detailtabview'); \OCP\Util::addScript('files', 'mainfileinfodetailview'); \OCP\Util::addScript('files', 'detailsview'); \OCP\Util::addStyle('files', 'detailsView'); \OC_Util::addVendorScript('core', 'handlebars/handlebars'); OCP\App::setActiveNavigationEntry('files_index'); $l = \OC::$server->getL10N('files'); $isIE8 = false; preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches); if (count($matches) > 0 && $matches[1] <= 9) { $isIE8 = true; } // if IE8 and "?dir=path&view=someview" was specified, reformat the URL to use a hash like "#?dir=path&view=someview" if ($isIE8 && (isset($_GET['dir']) || isset($_GET['view']))) { $hash = '#?'; $dir = isset($_GET['dir']) ? $_GET['dir'] : '/'; $view = isset($_GET['view']) ? $_GET['view'] : 'files'; $hash = '#?dir=' . \OCP\Util::encodePath($dir);
/** * Load additional scripts when the files app is visible */ public static function onLoadFilesAppScripts() { Util::addStyle('activity', 'style'); Util::addScript('activity', 'activitymodel'); Util::addScript('activity', 'activitycollection'); Util::addScript('activity', 'activitytabview'); Util::addScript('activity', 'filesplugin'); }