/** * onAdd. * * @param string $tpl Param * * @return void */ public function onAdd($tpl = null) { $result = parent::onAdd($tpl); Extly::loadAwesome(); $file = EHtml::getRelativeFile('js', 'com_autotweet/channel.min.js'); if ($file) { $dependencies = array(); $dependencies['channel'] = array('extlycore'); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies); } $postsModel = F0FModel::getTmpInstance('Posts', 'AutoTweetModel'); $postsModel->set('pubstate', array(AutotweetPostHelper::POST_SUCCESS, AutotweetPostHelper::POST_ERROR)); $postsModel->set('channel', $this->item->id); $postsModel->set('filter_order', 'id'); $postsModel->set('filter_order_Dir', 'DESC'); $postsModel->set('limit', 1); $posts = $postsModel->getItemList(); $alert_message = ''; $alert_style = 'alert-info'; if (count($posts) > 0) { $lastpost = $posts[0]; if ($lastpost->pubstate == AutotweetPostHelper::POST_ERROR) { $alert_style = 'alert-error'; } $alert_message = $lastpost->postdate . ' - ' . JText::_($lastpost->resultmsg); } $this->assign('alert_message', $alert_message); $this->assign('alert_style', $alert_style); return $result; }
/** * initApp. * * @param string $version Param * @param string $extensionmainjs Param * @param array &$dependencies {key2 => {key1, keyi}} * @param array &$paths {key1 => pathjs1, key2 => pathjs2} * * @return void */ protected function _initApp($version = null, $extensionmainjs = null, &$dependencies = array(), &$paths = array()) { $this->appAvailable = true; $this->version = $version; $appName = 'extlycore'; // Module dependencies must be added if ($extensionmainjs) { $host = Extly::getHost(); $appName = $this->getAppName($extensionmainjs); // App conditional to all dependencies if (!array_key_exists($appName, $dependencies) && !empty($paths)) { $dependencies[$appName] = array_keys($paths); } // $extensionmainjs = str_replace('.js', '', $extensionmainjs); $extensionmainjs = preg_replace('/\\.js$/', '', $extensionmainjs); $paths[$appName] = $this->addAppPath($extensionmainjs); } static $initialized = false; if (!$initialized) { $initialized = true; if ($this->framework == self::JS_ANGULAR) { $this->initPlatformNg($dependencies, $paths); } else { $this->initPlatform($dependencies, $paths); } } }
/** * onEdit. * * @param string $tpl Param * * @return void */ public function onAdd($tpl = null) { Extly::loadAwesome(); $file = EHtml::getRelativeFile('js', 'com_autotweet/rule.min.js'); if ($file) { Extly::initApp(CAUTOTWEETNG_VERSION, $file); } return parent::onAdd($tpl); }
/** * onBrowse. * * @param string $tpl Param * * @return void */ protected function onBrowse($tpl = null) { Extly::initApp(CAUTOTWEETNG_VERSION); Extly::loadAwesome(); if (!$this->isModule) { // When in interactive browsing mode, save the state to the session $this->getModel()->savestate(1); } return $this->onDisplay($tpl); }
/** * onAdd. * * @param string $tpl Param * * @return void */ public function onAdd($tpl = null) { Extly::loadAwesome(); $file = EHtml::getRelativeFile('js', 'com_autotweet/post.min.js'); if ($file) { $dependencies = array(); $dependencies['post'] = array('extlycore'); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies); } return parent::onAdd($tpl); }
/** * onBeforeDispatch. * * @return void */ public function onBeforeDispatch() { $result = parent::onBeforeDispatch(); if ($result && !F0FPlatform::getInstance()->isCli()) { $view = $this->input->getCmd('view'); Extly::loadStyle(false, $view != 'composer'); $document = JFactory::getDocument(); $document->addStyleSheet(JUri::root() . 'media/com_autotweet/css/style.css?version=' . CAUTOTWEETNG_VERSION); } return $result; }
/** * onBrowse * * @param string $tpl Param * * @return bool */ protected function onBrowse($tpl = null) { Extly::loadAwesome(); // Load the model $info = F0FModel::getTmpInstance('Update', 'AutoTweetModel'); $this->assign('comp', $info->getComponentInfo()); $this->assign('plugins', $info->getPluginInfo()); $this->assign('thirdparty', $info->getThirdpartyInfo()); $this->assign('sysinfo', $info->getSystemInfo()); Extly::initApp(CAUTOTWEETNG_VERSION); return; }
/** * onAdd. * * @param string $tpl Param * * @return void */ public function onAdd($tpl = null) { $result = parent::onAdd($tpl); Extly::loadAwesome(); $file = EHtml::getRelativeFile('js', 'com_autotweet/post.min.js'); if ($file) { $dependencies = array(); $dependencies['post'] = array('extlycore'); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies); } if ($this->item->id == 0 && isset($this->item->pubstate)) { if (!$this->perms->editstate) { $this->item->pubstate = 'approve'; } } return $result; }
/** * onAdd. * * @param string $tpl Param * * @return void */ public function onAdd($tpl = null) { $jlang = JFactory::getLanguage(); $jlang->load('com_content'); Extly::loadAwesome(); $file = EHtml::getRelativeFile('js', 'com_autotweet/feed.min.js'); if ($file) { $dependencies = array(); $paths = array(); $ajax_import = EParameter::getComponentParam(CAUTOTWEETNG, 'ajax_import', true); $this->assignRef('ajax_import', $ajax_import); if ($ajax_import) { $paths['import'] = 'media/com_autotweet/js/import.min'; } Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies, $paths); } return parent::onAdd($tpl); }
/** * onAdd. * * @param string $tpl Param * * @return void */ public function onAdd($tpl = null) { $result = parent::onAdd($tpl); Extly::loadAwesome(); JHtml::stylesheet('lib_extly/ng-table.min.css', false, true); $file = EHtml::getRelativeFile('js', 'com_autotweet/composer/app.min.js'); if ($file) { $this->assign('extensionmainjs', $file); $dependencies = array(); $paths = array(); // Libraries $paths['angular'] = 'media/lib_extly/js/angular/angular.min'; $paths['angular-resource'] = 'media/lib_extly/js/angular/angular-resource.min'; $dependencies['angular-resource'] = array('angular'); $paths['ng-table'] = 'media/lib_extly/js/angular/ng-table-noamd.min'; $dependencies['ng-table'] = array('angular'); // App $paths['requests-service'] = 'media/com_autotweet/js/composer/requests-service.min'; $dependencies['requests-service'] = array('angular-resource', 'extlycore'); $paths['agendas-service'] = 'media/com_autotweet/js/composer/agendas-service.min'; $dependencies['agendas-service'] = array('angular'); $paths['directives'] = 'media/com_autotweet/js/composer/directives.min'; $dependencies['directives'] = array('angular'); $paths['editor-controller'] = 'media/com_autotweet/js/composer/editor-controller.min'; $dependencies['editor-controller'] = array('angular'); $paths['requests-controller'] = 'media/com_autotweet/js/composer/requests-controller.min'; $dependencies['requests-controller'] = array('ng-table', 'requests-service'); $paths['agendas-controller'] = 'media/com_autotweet/js/composer/agendas-controller.min'; $dependencies['agendas-controller'] = array('agendas-service'); $scriptManager = Extly::getScriptManager(); $scriptManager->setFramework(DependencyManager::JS_ANGULAR); $scriptManager->initApp(CAUTOTWEETNG_VERSION, $file, $dependencies, $paths); $list_limit = JFactory::getConfig()->get('list_limit'); $scriptManager->addPostRequireScript("angular.bootstrap(document, ['composerApp']);\n\t\t\t\t\twindow.xtListLimit = {$list_limit};\n\t\t\t\t\tjQuery('.post-attrs-group a').click(function(e) {\n\t\t\t\t\t\tvar btn = jQuery(e.target), v;\n\n\t\t\t\t\t\tif (btn.hasClass('xticon')) {\n\t\t\t\t\t\t \tbtn = btn.parent('a');\n\t\t\t\t\t\t }\n\n\t\t\t\t\t\t v = btn.attr('data-value');\n\n\t\t\t\t\t\tjQuery('.xt-subform').hide();\n\t\t\t\t\t\tjQuery('.xt-subform-' + v).show();\n\t\t\t\t\t});"); } $document = JFactory::getDocument(); $document->addScript('//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js'); $platform = F0FPlatform::getInstance(); $this->assign('editown', $platform->authorise('core.edit.own', $this->input->getCmd('option', 'com_foobar'))); $this->assign('editstate', $platform->authorise('core.edit.state', $this->input->getCmd('option', 'com_foobar'))); return $result; }
/** * onBrowse * * @param string $tpl Param * * @return bool */ protected function onBrowse($tpl = null) { Extly::loadAwesome(); GridHelper::loadComponentInfo($this); GridHelper::loadStats($this); GridHelper::loadStatsTimeline($this); $document = JFactory::getDocument(); $document->addScript('//cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js'); $document->addScript('//cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.js'); $document->addStyleSheet('//cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.css'); // Get component parameter - Offline mode $version_check = EParameter::getComponentParam(CAUTOTWEETNG, 'version_check', 1); $this->assign('version_check', $version_check); $platform = F0FPlatform::getInstance(); if ($version_check && $platform->isBackend()) { $file = EHtml::getRelativeFile('js', 'com_autotweet/liveupdate.min.js'); if ($file) { $dependencies = array(); $dependencies['liveupdate'] = array('extlycore'); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies); } } parent::onBrowse($tpl); }
/** * onBrowse. * * @param string $tpl Param * * @return void */ protected function onBrowse($tpl = null) { Extly::initApp(CAUTOTWEETNG_VERSION); Extly::loadAwesome(); return parent::onBrowse($tpl); }
/** * addItemeditorHelperApp * * @return string */ public static function addItemeditorHelperApp() { static $link = false; if ($link) { return $link; } $doc = JFactory::getDocument(); $app = JFactory::getApplication(); list($isAdmin, $option, $controller, $task, $view, $layout, $id) = AutotweetBaseHelper::getControllerParams(); $js = "var autotweetUrlRoot = '" . JUri::root() . "';\n"; $js .= "var autotweetUrlBase = '" . JUri::base() . "';\n"; $mediaPath = 'media/com_autotweet/js/itemeditor/templates/'; $ext = '.txt'; $joomlaPart = '.j' . (EXTLY_J3 ? '3' : '25'); $sitePart = $isAdmin ? '.admin' : '.site'; $tpl0 = $mediaPath . $option . $ext; $tpl1 = $mediaPath . $option . $joomlaPart . $ext; $tpl2 = $mediaPath . $option . $sitePart . $joomlaPart . $ext; $tpl3 = $mediaPath . $option . $sitePart . $ext; if (file_exists(JPATH_ROOT . '/' . $tpl2)) { $tpl = $tpl2; } elseif (file_exists(JPATH_ROOT . '/' . $tpl1)) { $tpl = $tpl1; } elseif (file_exists(JPATH_ROOT . '/' . $tpl3)) { $tpl = $tpl3; } elseif (file_exists(JPATH_ROOT . '/' . $tpl0)) { $tpl = $tpl0; } else { $tpl = $mediaPath . 'com_joocial-default' . $joomlaPart . $ext; } $tpl = JUri::root() . $tpl . '?version=' . CAUTOTWEETNG_VERSION; $js .= "var autotweetPanelTemplate = 'text!" . $tpl . "';\n"; $doc->addScriptDeclaration($js); $link = 'index.php?option=com_autotweet&view=itemeditor&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1'; // Add Advanced Attributes $params = null; // Case Request edit page if ($option == CAUTOTWEETNG && $view == 'request' && $task == 'edit') { $params = AdvancedattrsHelper::getAdvancedAttrByReq($id); } elseif ($id > 0) { $params = AdvancedattrsHelper::getAdvancedAttrs($option, $id); } if (!$params) { $params = new StdClass(); $params->description = ''; $params->hashtags = ''; $params->fulltext = ''; $params->postthis = EParameter::getComponentParam(CAUTOTWEETNG, 'joocial_postthis', PlgAutotweetBase::POSTTHIS_DEFAULT); $params->evergreen = PlgAutotweetBase::POSTTHIS_NO; $params->agenda = array(); $params->unix_mhdmd = ''; $params->repeat_until = ''; $params->image = ''; $params->image_url = ''; $params->channels = ''; $params->channels_text = ''; } // Migrating old objects if (!isset($params->description)) { $params->description = ''; } // Migrating old objects if (!isset($params->hashtags)) { $params->hashtags = ''; } // Migrating old objects if (!isset($params->fulltext)) { $params->fulltext = ''; } // Migrating old objects if (!isset($params->image_url)) { $params->image_url = ''; } $params->editorTitle = VersionHelper::getFlavourName() . ' ' . JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_TITLE'); $params->postthisLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_POSTTHIS'); $params->evergreenLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_EVERGREEN'); $params->agendaLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_SCHEDULER'); $params->unix_mhdmdLabel = JText::_('COM_XTCRONJOB_TASKS_FIELD_UNIX_MHDMD'); $params->repeat_untilLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_REPEAT_UNTIL'); $params->imageLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_IMAGES'); $params->channelLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_CHANNELS'); $params->postthisDefaultLabel = '<i class="xticon xticon-circle-o"></i> ' . JText::_('COM_AUTOTWEET_DEFAULT_LABEL'); $params->postthisYesLabel = '<i class="xticon xticon-check"></i> ' . JText::_('JYES'); $params->postthisNoLabel = '<i class="xticon xticon-times"></i> ' . JText::_('JNO'); $params->descriptionLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_MSG'); $params->hashtagsLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_HASHTAGS'); $params->fulltextLabel = JText::_('COM_AUTOTWEET_VIEW_ITEMEDITOR_FULLTEXT_DESC'); if (!isset($params->channels_text)) { $params->channels_text = ''; } AutotweetBaseHelper::convertUTCLocalAgenda($params->agenda); $js = 'var autotweetAdvancedAttrs = ' . json_encode($params) . ";\n"; $doc->addScriptDeclaration($js); $file = EHtml::getRelativeFile('js', 'com_autotweet/itemeditor.helper.min.js'); if ($file) { $paths = array(); $paths = array('text' => Extly::JS_LIB . 'require/text.min'); $deps = array('itemeditor.helper' => array('text', 'underscore')); Extly::getScriptManager(false); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $deps, $paths); } return $link; }
/** * cronjobExpressionControl * * @param string $selected Value * @param string $name The name for the field * @param string $label Label * @param string $desc Description * @param array $idTag Additional HTML attributes for the <select> tag * @param string $class Class * @param string $extensionmainjs Module name * * @return string HTML */ public static function cronjobExpressionControl($selected, $name, $label, $desc, $idTag = null, $class = null, $extensionmainjs = null) { static $initialized = false; if (!$initialized) { $initialized = true; if ($extensionmainjs) { $dependencies = array(); // $dependencies['xtcronjob-expression-field'] = array('backbone'); $file = 'media/lib_extly/js/utils/xtcronjob-expression-field.min'; $paths = array('xtcronjob-expression-field' => $file); Extly::addAppDependency($extensionmainjs, $dependencies, $paths); } else { JHtml::script('lib_extly/utils/xtcronjob-expression-field.js', false, true); } } $blankText = false; if (empty($selected)) { $blankText = true; $selected = '* * * * *'; } JLoader::import('extly.scheduler.scheduler'); $cronExpression = Scheduler::getParser($selected); $minute = $cronExpression->getExpression(0); $hour = $cronExpression->getExpression(1); $day = $cronExpression->getExpression(2); $month = $cronExpression->getExpression(3); $weekday = $cronExpression->getExpression(4); $controlI = EHtmlSelect::minuteList($minute, $idTag . '_minute', array('class' => 'minute-part')); $controlH = EHtmlSelect::hourList($hour, $idTag . '_hour', array('class' => 'hour-part')); $controlD = EHtmlSelect::dayList($day, $idTag . '_day', array('class' => 'day-part')); $controlM = EHtmlSelect::monthList($month, $idTag . '_month', array('class' => 'month-part')); $controlW = EHtmlSelect::weekdayList($weekday, $idTag . '_weekday', array('class' => 'weekday-part')); $controlT = self::textControl($blankText ? '' : $selected, $name, $label, $desc, $idTag, 256, 'unix_mhdmd-part'); $controls = array(); $controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_MINUTE', 'COM_XTCRONJOB_TASKS_FIELD_MINUTE_DESC', $idTag . '_minute', $controlI); $controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_HOUR', 'COM_XTCRONJOB_TASKS_FIELD_HOUR_DESC', $idTag . '_hour', $controlH); $controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_DAY', 'COM_XTCRONJOB_TASKS_FIELD_DAY_DESC', $idTag . '_day', $controlD); $controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_MONTH', 'COM_XTCRONJOB_TASKS_FIELD_MONTH_DESC', $idTag . '_month', $controlM); $controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_WEEKDAY', 'COM_XTCRONJOB_TASKS_FIELD_WEEKDAY_DESC', $idTag . '_weekday', $controlW); $controls[] = $controlT; return implode("\n", $controls); }
/** * onBrowse. * * @param string $tpl Param * * @return void */ protected function onBrowse($tpl = null) { FeedImporterHelper::loadAjaxImporter($this); Extly::loadAwesome(); return parent::onBrowse($tpl); }
/** * loadAjaxImporter * * @param object $view Param * * @return void */ public static function loadAjaxImporter($view) { $ajax_import = EParameter::getComponentParam(CAUTOTWEETNG, 'ajax_import', true); $view->assignRef('ajax_import', $ajax_import); if ($ajax_import) { $file = EHtml::getRelativeFile('js', 'com_autotweet/import.min.js'); if ($file) { $dependencies = array(); $dependencies['import'] = array('extlycore'); Extly::initApp(CAUTOTWEETNG_VERSION, $file, $dependencies); } } else { Extly::initApp(CAUTOTWEETNG_VERSION); } }
/** * imagePickerControl * * @param string $label Param * @param string $desc Param * @param array $options The key that is selected * @param string $name The name for the field * @param array $attribs Additional HTML attributes for the <select> tag* * @param string $selected The key that is selected * @param string $idTag The name for the field * @param string $extensionmainjs Param * * @return string HTML for the select list. */ public static function imagePickerListControl($label, $desc, $options, $name, $attribs, $selected, $idTag, $extensionmainjs = null) { static $initialized = false; if (!$initialized) { $initialized = true; JHtml::stylesheet('lib_extly/image-picker.css', false, true); if ($extensionmainjs) { $dependencies = array(); if (EXTLY_J25) { $dependencies['image-picker'] = array(DependencyManager::EXTLY_J25_JQUERY); } $file = 'media/lib_extly/js/utils/image-picker.min'; $paths = array('image-picker' => $file); Extly::addAppDependency($extensionmainjs, $dependencies, $paths); } else { JHtml::script('lib_extly/utils/image-picker.min.js', false, true); } } if (!$idTag) { $idTag = self::generateIdTag(); } Extly::addPostRequireScript("jQuery('#{$idTag}').imagepicker({\nshow_label: true,\nselected: function() {\n\tthis.trigger('liszt:updated');\n}\n});"); $base_attrs = array(); $base_attrs['id'] = $idTag; $base_attrs['option.attr'] = 'data-img-src'; $base_attrs['list.translate'] = false; $base_attrs['option.key'] = 'value'; $base_attrs['option.text'] = 'text'; $base_attrs['list.select'] = $selected; $attribs = array_merge($base_attrs, $attribs); $control = self::genericlist($options, $name, $attribs); return EHtml::genericControl($label, $desc, $name, $control); }
/** * addAppPath * * @param string $appPath Param * * @return string */ protected function addAppPath($appPath) { $host = Extly::getHost(); $appPath = $host . $appPath; $site = JUri::root(); return str_replace($site, '', $appPath); }
* @copyright Copyright (C) 2007 - 2015 Prieco, S.A. All rights reserved. * @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL * @link http://www.extly.com http://support.extly.com */ // No direct access defined('_JEXEC') or die('Restricted access'); $this->loadHelper('select'); JHtml::_('behavior.formvalidation'); $isFrontendEnabled = F0FModel::getTmpInstance('Channeltypes', 'AutoTweetModel')->isFrontendEnabled($this->item->channeltype_id); ?> <div class="extly"> <div class="extly-body"> <?php echo Extly::showInvalidFormAlert(); ?> <form name="adminForm" id="adminForm" action="index.php" method="post" class="form form-horizontal form-validate"> <input type="hidden" name="option" value="com_autotweet" /> <input type="hidden" name="view" value="channels" /> <input type="hidden" name="task" value="" /> <?php echo EHtml::renderRoutingTags(); ?> <div class="row-fluid"> <div class="span6"> <fieldset class="basic">
/** * onAfterRender * * @return void */ public function onAfterRender() { $app = JFactory::getApplication(); // Get the response body .... an additional check for J! 3.0.0 if (EXTLY_J3 && method_exists($app, 'getBody')) { $body = $app->getBody(); } else { $body = JResponse::getBody(); } if (class_exists('Extly')) { Extly::insertDependencyManager($body); } if (EXTLY_J3 && method_exists($app, 'setBody')) { $app->setBody($body); } else { JResponse::setBody($body); } $this->onContentPolling(); }