public function loadEditorAssets() { if (!$this->_editorAssetsLoaded) { $this->configuration->loadHelpers('SympalContentSlotEditor'); sfSympalToolkit::useJQuery(array('ui')); $response = sfContext::getInstance()->getResponse(); // Load jquery tools/plugins that the inline editor requires $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.cookie.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.elastic.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jquery.Jcrop.min.js')); // Load markitup markdown editor if (sfSympalConfig::get('enable_markdown_editor')) { $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/jquery.markitup.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/sets/markdown/set.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/skins/markitup/style.css')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/sets/markdown/style.css')); } // Load tinymce $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/tiny_mce/tiny_mce.js')); // Load the sympal editor js and css $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/editor.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/editor.css')); // Fancybox $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.css')); // Shortcuts $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $this->_editorAssetsLoaded = true; } }
public static function convertToHtml($markdown) { if ($markdown) { sfContext::getInstance()->getResponse()->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalRenderingPlugin/css/markdown.css')); return '<div class="sympal_markdown">' . self::enhanceHtml(Markdown($markdown), $markdown) . '</div>'; } }
public function executeIndex() { $response = $this->getResponse(); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/shortcuts.js')); if (sfSympalConfig::get('check_for_upgrades_on_dashboard', null, false)) { $this->upgrade = new sfSympalUpgradeFromWeb($this->getContext()->getConfiguration(), $this->getContext()->getEventDispatcher(), new sfFormatter()); $this->hasNewVersion = $this->upgrade->hasNewVersion(); } else { $this->hasNewVersion = false; } $this->dashboardRight = new sfSympalMenu('Sympal Dashboard Right'); $numUsers = Doctrine_Core::getTable('sfGuardUser')->count(); $this->dashboardRight->addChild(sprintf('<label>Users</label> %s', $numUsers), '@sympal_users'); $numSites = Doctrine_Core::getTable('sfSympalSite')->count(); $this->dashboardRight->addChild(sprintf('<label>Sites</label> %s', $numSites), '@sympal_sites'); $numContentTypes = Doctrine_Core::getTable('sfSympalContentType')->count(); $this->dashboardRight->addChild(sprintf('<label>Content Types</label> %s', $numContentTypes), '@sympal_content_types'); $contentTypes = Doctrine::getTable('sfSympalContentType')->getAllContentTypes(); foreach ($contentTypes as $contentType) { $numPublishedContent = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->where('c.date_published < NOW()')->andWhere('c.content_type_id = ?', $contentType->getId())->count(); $this->dashboardRight->addChild(sprintf('<label>Published %s Content</label> %s', $contentType->getLabel(), $numPublishedContent), '@sympal_content_list_type?type=' . $contentType->getId() . '&published=1'); $numUnPublishedContent = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->where('c.date_published >= NOW() OR c.date_published IS NULL')->andWhere('c.content_type_id = ?', $contentType->getId())->count(); $this->dashboardRight->addChild(sprintf('<label>Un-Published %s Content</label> %s', $contentType->getLabel(), $numUnPublishedContent), '@sympal_content_list_type?type=' . $contentType->getId() . '&published=0'); } sfApplicationConfiguration::getActive()->getEventDispatcher()->notify(new sfEvent($this->dashboardRight, 'sympal.load_dashboard_right')); }
public function loadAdminMenuAssets() { sfSympalToolkit::useJQuery(); $response = sfContext::getInstance()->getResponse(); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/css/menu.css')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/menu.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/shortcuts.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.css')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.js')); }
public function executeIndex() { $response = $this->getResponse(); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/shortcuts.js')); if (sfSympalConfig::get('check_for_upgrades_on_dashboard', null, false)) { $this->upgrade = new sfSympalUpgradeFromWeb($this->getContext()->getConfiguration(), $this->getContext()->getEventDispatcher(), new sfFormatter()); $this->hasNewVersion = $this->upgrade->hasNewVersion(); } else { $this->hasNewVersion = false; } }
/** * @param string $name The element name * @param string $value The value displayed in this widget * @param array $attributes An array of HTML attributes to be merged with the default HTML attributes * @param array $errors An array of errors for the field * * @return string An HTML tag string * * @see sfWidgetForm */ public function render($name, $value = null, $attributes = array(), $errors = array()) { $this->context = sfContext::getInstance(); $attributes = array_merge(array('type' => $this->getOption('type'), 'name' => $name, 'value' => $value), $attributes); $attributes = $this->fixFormId($attributes); $url = $this->context->getRouting()->generate('sympal_assets_select'); $tag = $this->renderTag('input', $attributes); $tag .= $this->includeView(); $tag .= $this->includeDelete(); // add if (!isset($attributes['load_javascript']) || $attributes['load_javascript'] !== false) { $tag .= $this->loadJavascript(array_merge($attributes, array('url' => $url))); } if (!isset($attributes['load_stylesheet']) || $attributes['load_stylesheet'] !== false) { $this->context->getResponse()->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalAssetsPlugin/css/form_widget.css')); } $tag = $this->wrapTag($tag); return $tag; }
public function loadEditorAssets() { if (!$this->_editorAssetsLoaded) { $this->configuration->loadHelpers('SympalContentSlotEditor'); sfSympalToolkit::useJQuery(array('ui')); $response = sfContext::getInstance()->getResponse(); // Load jquery tools/plugins that the inline editor requires $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.cookie.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.elastic.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jquery.Jcrop.min.js')); // Load in the metadata plugin $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jquery.metadata.js')); // Load tinymce $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/tiny_mce/tiny_mce.js')); // Load in the UI blocker $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jquery.blockUI.js')); // Load the sympal editor js and css $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/editor.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/editor.css')); // Load the js and css for the slot editing $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/slot.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/slotEditor.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/slots.css')); // Fancybox $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.css')); // Ajax form submission $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.form.js')); // Shortcuts $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); // Load the individual slot javsascripts // @todo The slot type javascript needs to be brought in dynamically $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/slots/markdown.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/slots/tinymce.js')); // Load the core javascript $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/chooser.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/core.js')); $this->_editorAssetsLoaded = true; } }
/** * Use the given javascript * * @param string $javascript * @param string $position * @return void */ public static function useJavascript($javascript, $position = 'last') { return sfContext::getInstance()->getResponse()->addJavascript(sfSympalConfig::getAssetPath($javascript), $position); }
/** * Listens to the theme.filter_asset_paths event and rewrites all of * the assets from themes before outputting them */ public function filterThemeAssetPaths(sfEvent $event, $assets) { foreach ($assets as $key => $asset) { $assets[$key]['file'] = sfSympalConfig::getAssetPath($asset['file']); } return $assets; }
/** * Helper method for using a Sympal stylesheet file * * @param string $path * @param string $position * @return void */ function sympal_use_stylesheet($path, $position = 'last') { return use_stylesheet(sfSympalConfig::getAssetPath($path), $position); }
/** * Called when the admin menu is loaded. * * Supplies all of the css and js needed for the admin menu */ protected function _loadAdminMenuAssets() { $response = sfContext::getInstance()->getResponse(); $response->addJavascript(sfSympalConfig::getAssetPath('jquery.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('jquery.fancybox.css')); $response->addJavascript(sfSympalConfig::getAssetPath('jquery.fancybox.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/css/floating_menu.css')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/floating_menu.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/shortcuts.js')); }
public function removeJavascripts() { foreach ($this->_configuration->getJavascripts() as $javascript) { $this->_response->removeJavascript(sfSympalConfig::getAssetPath($javascript)); } }
<script type="text/javascript" src="<?php echo javascript_path(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/links.js')); ?> "></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo stylesheet_path(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/links.css')); ?> " /> <div id="sympal_links_container"> <h1><?php echo __('Link Browser'); ?> </h1> <p> <?php echo __('Browse your content below and insert links into the currently focused editor by ' . 'just clicking the page you want to link to.'); ?> <?php echo __('You can control where the link is inserted by positioning the cursor in the editor.'); ?> </p> <div id="content_types"> <h2><?php echo __('Content Types'); ?> </h2> <ul> <?php