/** * set up the html to be injected into the bottom of the form * * @param object $params (no repeat counter stuff needed here as the plugin manager * which calls this function has already done the work for you */ function getBottomContent(&$params, &$formModel) { $user =& JFactory::getUser(); if ($user->get('id') == 0) { $this->html = JText::_('PLG_CRON_NOTIFICATION_SIGN_IN_TO_RECEIVE_NOTIFICATIONS'); return; } $opts = new stdClass(); $opts->tableid = $formModel->getTableModel()->_id; $opts->fabrik = $formModel->_id; $opts->rowid = $formModel->_rowId; $opts->senderBlock = JRequest::getCmd('view') == 'form' ? 'form_' : 'details_'; $opts->senderBlock .= $formModel->_id; $opts = json_encode($opts); $id = uniqid('fabrik_notification'); if ($params->get('notification_ajax', 0) == 1) { FabrikHelperHTML::script('javascript.js', 'components/com_fabrik/plugins/form/fabriknotification/', true); $script = "window.addEvent('domready', function() {\n\t\t\t\tvar notify = new Notify('{$id}', {$opts});\n \t\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); } //see if the checkbox should be checked $db =& JFactory::getDBO(); $ref = $this->getRef($formModel->getTableModel()->_id); $db->setQuery("SELECT COUNT(id) FROM #__fabrik_notification WHERE user_id = " . (int) $user->get('id') . " AND reference = {$ref}"); $found = $db->loadResult(); $checked = $found ? "checked=\"checked\"" : ""; $this->html = "\n\t\t<label><input id=\"{$id}\" {$checked} type=\"checkbox\" name=\"fabrik_notification\" class=\"input\" value=\"1\" />\n\t\t " . JText::_('NOTIFY_ME') . "</label>"; }
/** * set up the html to be injected into the bottom of the form * * @param object $params (no repeat counter stuff needed here as the plugin manager * which calls this function has already done the work for you */ function getBottomContent(&$params, &$formModel) { $user = JFactory::getUser(); if ($user->get('id') == 0) { $this->html = JText::_('PLG_CRON_NOTIFICATION_SIGN_IN_TO_RECEIVE_NOTIFICATIONS'); return; } $opts = new stdClass(); $opts->listid = $formModel->getListModel()->_id; $opts->fabrik = $formModel->_id; $opts->rowid = $formModel->_rowId; $opts->senderBlock = JRequest::getCmd('view') == 'form' ? 'form_' : 'details_'; $opts->senderBlock .= $formModel->_id; $opts = json_encode($opts); $id = uniqid('fabrik_notification'); if ($params->get('notification_ajax', 0) == 1) { FabrikHelperHTML::script('components/com_fabrik/plugins/form/fabriknotification/javascript.js', true); $script = "head.ready(function() { var notify = new Notify('$id', $opts); });"; FabrikHelperHTML::addScriptDeclaration($script); } //see if the checkbox should be checked $db = FabrikWorker::getDbo(); $ref =$this->getRef($formModel->getListModel()->_id); $db->setQuery("SELECT COUNT(id) FROM #__{package}_notification WHERE user_id = ".(int)$user->get('id') . " AND reference = $ref"); $found = $db->loadResult(); $checked = $found ? "checked=\"checked\"" : ""; $this->html = " <label><input id=\"$id\" $checked type=\"checkbox\" name=\"fabrik_notification\" class=\"input\" value=\"1\" /> ".JText::_('PLG_CRON_NOTIFICATION_NOTIFY_ME') . "</label>"; }
function display($tmpl = 'default') { FabrikHelperHTML::packageJS(); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row =& $model->getVisualization(); $model->setTableIds(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); $tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'visualization' . DS . 'coverflow' . DS . 'views' . DS . 'coverflow' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); //ensure we don't have an incorrect version of mootools loaded JHTML::stylesheet('table.css', 'media/com_fabrik/css/'); FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true); //check and add a general fabrik custom css file overrides template css and generic table css FabrikHelperHTML::stylesheetFromPath("media" . DS . "com_fabrik" . DS . "css" . DS . "custom.css"); //check and add a specific biz template css file overrides template css generic table css and generic custom css FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "plugins" . DS . "visualization" . DS . "coverflow" . DS . "views" . DS . "coverflow" . DS . "tmpl" . DS . $tmpl . DS . "custom.css"); FabrikHelperHTML::cleanMootools(); //assign something to oPackage to ensure we can clear filters $str = "window.addEvent('domready', function(){\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "oPackage.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Display * * @param string $tpl Template * * @return void */ public function display($tpl = null) { FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $input = $app->input; $state = $this->get('State'); $item = $this->get('Item'); $document = JFactory::getDocument(); $srcs = array('media/com_fabrik/js/icons.js', 'media/com_fabrik/js/icongen.js', 'media/com_fabrik/js/canvas.js', 'media/com_fabrik/js/history.js', 'media/com_fabrik/js/keynav.js', 'media/com_fabrik/js/tabs.js', 'media/com_fabrik/js/pages.js', 'media/com_fabrik/js/frontpackage.js'); FabrikHelperHTML::script($srcs); FabrikHelperHTML::stylesheet('media/com_fabrik/css/package.css'); $canvas = $item->params->get('canvas'); // $$$ rob 08/11/2011 test if component name set but still rendering // in option=com_fabrik then we should use fabrik as the package if ($input->get('option') === 'com_fabrik') { $item->component_name = 'fabrik'; } $opts = JArrayHelper::getvalue($canvas, 'options', array()); $tabs = JArrayHelper::getValue($canvas, 'tabs', array('Page 1')); $tabs = json_encode($tabs); $d = new stdClass(); $layout = JArrayHelper::getValue($canvas, 'layout', $d); $layout = json_encode(JArrayHelper::getValue($canvas, 'layout', $d)); $id = $this->get('State')->get('package.id'); $script = "window.addEvent('fabrik.loaded', function() {\n\t\t\tnew FrontPackage({\n\t\ttabs : {$tabs},\n\t\ttabelement : 'packagemenu',\n\t\tpagecontainer : 'packagepages',\n\t\tlayout: {$layout},\n\t\t'packageId': {$id},\n\t\t'package':'{$item->component_name}'\n\t});\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); // Force front end templates $this->_basePath = COM_FABRIK_FRONTEND . '/views'; $tmpl = !isset($item->template) ? 'default' : $item->template; $this->addTemplatePath($this->_basePath . '/' . $this->_name . '/tmpl/' . $tmpl); $text = $this->loadTemplate(); FabrikHelperHTML::runConentPlugins($text); echo $text; }
/** * list of items * * @return null */ public function dolist() { $app = JFactory::getApplication(); $input = $app->input; $db = FabrikWorker::getDbo(true); $query = $db->getQuery(true); $list = $input->get('list', 'form'); $selected = $input->get('selected'); $query->select('id, label')->from('#__fabrik_' . $list . 's'); if ($selected != '') { // $query->where('id NOT IN ('.$selected.')'); } $db->setQuery($query); $rows = $db->loadObjectList(); echo "<ul id=\"{$list}-additems\">"; if (empty($rows)) { echo "<li>" . JText::sprintf('COM_FABRIK_NO_FREE_ITEMS_FOUND') . "</li>"; } else { foreach ($rows as $row) { echo "<li><a href=\"#\" id=\"{$row->id}\">{$row->label}</a>"; } } echo "</ul>"; $script = "\$('{$list}-additems').getElements('a').addEvent('click', function(e){\n\t\t\tFabrik.fireEvent('fabrik.package.item.selected', [e]);\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. */ function display($tpl = 'default') { $srcs = FabrikHelperHTML::framework(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row = $model->getVisualization(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $params = $model->getParams(); $this->assign('params', $params); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/coverflow/views/coverflow/tmpl/' . $tpl; $this->_setPath('template', $tmplpath); $srcs[] = 'media/com_fabrik/js/listfilter.js'; // Assign something to Fabrik.blocks to ensure we can clear filters $ref = $model->getJSRenderContext(); $js = "{$ref} = {};"; $js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});"; $js .= $model->getFilterJs(); FabrikHelperHTML::addScriptDeclaration($srcs, $js); echo parent::display(); }
/** * Sets up HTML to be injected into the form's bottom * * @param object $params params * @param object $formModel form model * * @return void */ public function getBottomContent($params, $formModel) { $user = JFactory::getUser(); if ($user->get('id') == 0) { $this->html = JText::_('PLG_CRON_NOTIFICATION_SIGN_IN_TO_RECEIVE_NOTIFICATIONS'); return; } if ($params->get('send_mode') == '1') { return; } $opts = new stdClass(); $opts->listid = $formModel->getListModel()->getId(); $opts->formid = $formModel->getId(); $opts->rowid = $formModel->_rowId; $opts->senderBlock = JRequest::getCmd('view') == 'form' ? 'form_' : 'details_'; $opts->senderBlock .= $formModel->getId(); $opts = json_encode($opts); $id = uniqid('fabrik_notification'); if ($params->get('notification_ajax', 0) == 1) { FabrikHelperHTML::script('components/com_fabrik/plugins/form/notification/notify.js'); $script = "head.ready(function() {\n\t\t\t\tvar notify = new Notify('{$id}', {$opts});\n \t\t\t});"; FabrikHelperHTML::addScriptDeclaration($script); } // See if the checkbox should be checked $db = FabrikWorker::getDbo(); $ref = $this->getRef($formModel->getListModel()->getId()); $query = $db->getQuery(true); $query->select('COUNT(id)')->from('#__{package}_notification')->where('user_id = ' . (int) $user->get('id') . ' AND reference = ' . $ref); $db->setQuery($query); $found = $db->loadResult(); $checked = $found ? 'checked="checked"' : ''; $this->html = ' <label><input id="' . $id . '" ' . $checked . ' type="checkbox" name="fabrik_notification" class="input" value="1" /> ' . JText::_('PLG_CRON_NOTIFICATION_NOTIFY_ME') . '</label>'; }
/** * return the javascript to create an instance of the class defined in formJavascriptClass * @param object parameters * @param object table model * @param array [0] => string table's form id to contain plugin * @return bool */ function loadJavascriptInstance($params, $model, $args) { $form_id = $args[0]; $js = trim($params->get('table_js_code')); if ($js !== '') { FabrikHelperHTML::addScriptDeclaration($js); } $this->jsInstance = ''; //script $script = $params->get('table_js_file'); if ($script == '-1') { return; } $className = substr($script, 0, strlen($script) - 3); $document =& JFactory::getDocument(); $id =& $model->getTable()->id; $container = 'oTable'; if (JRequest::getVar('tmpl') != 'component') { FabrikHelperHTML::script($script, 'components/com_fabrik/plugins/table/tablejs/scripts/'); } else { // included scripts in the head don't work in mocha window // read in the class and insert it into the body as an inline script $class = JFile::read(JPATH_BASE . "/components/com_fabrik/plugins/table/tablejs/scripts/{$script}"); // $$$ rob dont want/need to delay the loading of the class //FabrikHelperHTML::addScriptDeclaration($class); $document =& JFactory::getDocument(); $document->addScriptDeclaration($class); } $this->jsInstance = "new {$className}({$container}{$id})"; return true; }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. */ function display($tpl = 'default') { FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $params = $app->getParams('com_fabrik'); $document = JFactory::getDocument(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); $params = $model->getParams(); $this->assign('params', $params); $pluginParams = $model->getPluginParams(); $tpl = $pluginParams->get('fb_gm_layout', $tpl); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/kaltura/views/kaltura/tmpl/' . $tpl; $js = <<<EOT \t\t<script type="text/javascript" > function entryClicked ( entry_id ) { \twindow.location = "./player.php?entry_id=" + entry_id; } </script> EOT; $this->assignRef('data', $this->get('Data')); FabrikHelperHTML::addScriptDeclaration($js); FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/kaltura/views/kaltura/tmpl/' . $tpl . '/template.css'); $template = null; $this->assign('containerId', $this->get('ContainerId')); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->_setPath('template', $tmplpath); echo parent::display($template); }
function display($tmpl = 'default') { $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row =& $model->getVisualization(); $model->setListIds(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); $tmplpath = JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'coverflow' . DS . 'views' . DS . 'coverflow' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/', true); //ensure we don't have an incorrect version of mootools loaded JHTML::stylesheet('media/com_fabrik/css/table.css'); FabrikHelperHTML::script('media/com_fabrik/js/list.js', true); //assign something to Fabrik.blocks to ensure we can clear filters $str = "head.ready(function() {\r\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "Fabrik.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\r\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Choose which list to add an event to * * @return void */ public function chooseAddEvent() { $app = JFactory::getApplication(); $input = $app->input; $this->setLayout('chooseAddEvent'); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)))); $rows = $model->getEventLists(); $model->getVisualization(); $options = array(); $options[] = JHTML::_('select.option', '', FText::_('PLG_VISUALIZATION_FULLCALENDAR_PLEASE_SELECT')); $model->getEvents(); $attribs = 'class="inputbox" size="1" '; $options = array_merge($options, $rows); $this->_eventTypeDd = JHTML::_('select.genericlist', $options, 'event_type', $attribs, 'value', 'text', '', 'fabrik_event_type'); /* * Tried loading in iframe and as an ajax request directly - however * in the end decided to set a call back to the main calendar object (via the package manager) * to load up the new add event form */ $ref = $model->getJSRenderContext(); $script = array(); $script[] = "document.id('fabrik_event_type').addEvent('change', function(e) {"; $script[] = "var fid = e.target.get('value');"; $script[] = "var o = ({'id':'','listid':fid,'rowid':0});"; $script[] = "o.title = Joomla.JText._('PLG_VISUALIZATION_FULLCALENDAR_ADD_EVENT');"; $script[] = "Fabrik.blocks['" . $ref . "'].addEvForm(o);"; $script[] = "Fabrik.Windows.chooseeventwin.close();"; $script[] = "});"; echo '<h2>' . FText::_('PLG_VISUALIZATION_FULLCALENDAR_PLEASE_CHOOSE_AN_EVENT_TYPE') . ':</h2>'; echo $this->_eventTypeDd; FabrikHelperHTML::addScriptDeclaration(implode("\n", $script)); }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model = $this->getModel(); $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))); $model->setId($id); $row = $model->getVisualization(); $model->setListIds(); if ($this->get('RequiredFiltersFound')) { $model->render(); } $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('row', $row); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $this->assignRef('params', $model->getParams()); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/coverflow/views/coverflow/tmpl/' . $tmpl; $this->_setPath('template', $tmplpath); FabrikHelperHTML::script('media/com_fabrik/js/list.js'); //assign something to Fabrik.blocks to ensure we can clear filters $str = "head.ready(function() {\r\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "Fabrik.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\r\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. */ public function display($tpl = 'default') { $document = JFactory::getDocument(); $app = JFactory::getApplication(); $input = $app->input; $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)))); if (!$model->canView()) { echo FText::_('JERROR_ALERTNOAUTHOR'); return false; } $srcs = FabrikHelperHTML::framework(); FabrikHelperHTML::styleSheet('plugins/fabrik_visualization/nvd3_chart/lib/novus-nvd3/src/nv.d3.css'); $srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js'; $srcs['AdvancedSearch'] = 'media/com_fabrik/js/advanced-search.js'; $lib = COM_FABRIK_LIVESITE . 'plugins/fabrik_visualization/nvd3_chart/lib/novus-nvd3/'; $document->addScript($lib . 'lib/d3.v2.js'); $document->addScript($lib . 'nv.d3.js'); $document->addScript($lib . 'src/tooltip.js'); $document->addScript($lib . 'lib/fisheye.js'); $document->addScript($lib . 'src/utils.js'); $document->addScript($lib . 'src/models/legend.js'); $document->addScript($lib . 'src/models/axis.js'); $document->addScript($lib . 'src/models/scatter.js'); $document->addScript($lib . 'src/models/line.js'); $document->addScript($lib . 'src/models/lineChart.js'); $document->addScript($lib . 'src/models/multiBar.js'); $document->addScript($lib . 'src/models/multiBarChart.js'); $this->row = $model->getVisualization(); $this->requiredFiltersFound = $model->getRequiredFiltersFound(); $params = $model->getParams(); $js = $model->js(); FabrikHelperHTML::addScriptDeclaration($js); $this->params = $params; $viewName = $this->getName(); $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikFEModel'); $plugin = $pluginManager->getPlugIn('calendar', 'visualization'); $this->params = $params; $this->postText = $model->postText; $this->assign('containerId', $this->get('ContainerId')); $this->assign('filters', $this->get('Filters')); $this->showFilters = $model->showFilters(); $this->assign('filterFormURL', $this->get('FilterFormURL')); $tpl = $params->get('nvd3_chart_layout', $tpl); $this->_setPath('template', JPATH_ROOT . '/plugins/fabrik_visualization/nvd3_chart/views/nvd3_chart/tmpl/' . $tpl); FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/nvd3_chart/views/nvd3_chart/tmpl/' . $tpl . '/template.css'); // Assign something to Fabrik.blocks to ensure we can clear filters $ref = $model->getJSRenderContext(); $js = "{$ref} = {};"; $js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});"; $js .= $model->getFilterJs(); FabrikHelperHTML::iniRequireJs($model->getShim()); FabrikHelperHTML::script($srcs, $js); $text = $this->loadTemplate(); FabrikHelperHTML::runContentPlugins($text); echo $text; }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); $model->setListIds(); if ($this->row->published == 0) { JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR')); return ''; } $this->assign('js', $this->get('JS')); $viewName = $this->getName(); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel'); $plugin = $pluginManager->getPlugIn('slideshow', 'visualization'); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $this->assignRef('params', $model->getParams()); $tmpl = $pluginParams->get('slideshow_viz_layout', $tmpl); $tmplpath = $model->pathBase . 'slideshow' . DS . 'views' . DS . 'slideshow' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); FabrikHelperHTML::script('media/com_fabrik/js/list.js'); if ($this->get('RequiredFiltersFound')) { FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.js'); $slideshow_viz_type = $pluginParams->get('slideshow_viz_type', 1); switch ($slideshow_viz_type) { case 1: break; case 2: FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.kenburns.js'); break; case 3: FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.push.js'); break; case 4: FabrikHelperHTML::script('components/com_fabrik/libs/slideshow2/js/slideshow.fold.js'); break; default: break; } JHTML::stylesheet('components/com_fabrik/libs/slideshow2/css/slideshow.css'); FabrikHelperHTML::script('plugins/fabrik_visualization/slideshow/slideshow.js'); } FabrikHelperHTML::addScriptDeclaration($this->js); $ab_css_file = $tmplpath . DS . "template.css"; $tmplpath = JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'slideshow' . DS . 'views' . DS . 'slideshow' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); if (JFile::exists($ab_css_file)) { JHTML::stylesheet($this->srcBase . 'slideshow/views/slideshow/tmpl/' . $tmpl . '/template.css'); } echo parent::display(); }
function display($tmpl = 'default') { JHTML::_('behavior.calendar'); FabrikHelperHTML::script('media/com_fabrik/js/list.js'); FabrikHelperHTML::script('media/com_fabrik/js/advanced-search.js'); require_once(COM_FABRIK_FRONTEND.DS.'helpers'.DS.'html.php'); FabrikHelperHTML::mocha(); FabrikHelperHTML::loadCalendar(); $model = &$this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); $model->setListIds(); if ($this->row->published == 0) { JError::raiseWarning(500, JText::_('ALERTNOTAUTH')); return ''; } $calendar = $model->_row; $this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound')); if ($this->requiredFiltersFound) { $this->assign('chart', $this->get('Chart')); } else { $this->assign('chart', ''); } $viewName = $this->getName(); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel'); $plugin = $pluginManager->getPlugIn('calendar', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('filters', $this->get('Filters')); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $this->assignRef('params', $pluginParams); $tmpl = $pluginParams->get('chart_layout', $tmpl); $tmplpath = JPATH_ROOT.DS.'plugins'.DS.'fabrik_visualization'.DS.'chart'.DS.'views'.DS.'chart'.DS.'tmpl'.DS.$tmpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath.DS."template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('plugins/fabrik_visualization/chart/views/chart/tmpl/'.$tmpl.'/template.css', true); } //assign something to Fabrik.blocks to ensure we can clear filters $str = "head.ready(function() { fabrikChart{$this->row->id} = {};"; $str .= "\n" . "Fabrik.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id}); });"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
function display($tmpl = 'default') { JHTML::_('behavior.calendar'); FabrikHelperHTML::packageJS(); FabrikHelperHTML::script('table.js', 'media/com_fabrik/js/'); FabrikHelperHTML::script('advanced-search.js', 'media/com_fabrik/js/'); require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'html.php'; FabrikHelperHTML::mocha(); FabrikHelperHTML::loadCalendar(); $model =& $this->getModel(); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row =& $model->getVisualization(); $model->setTableIds(); if ($this->row->state == 0) { JError::raiseWarning(500, JText::_('ALERTNOTAUTH')); return ''; } $calendar =& $model->_row; $this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound')); if ($this->requiredFiltersFound) { $this->assign('chart', $this->get('Chart')); } else { $this->assign('chart', ''); } $viewName = $this->getName(); $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin =& $pluginManager->getPlugIn('calendar', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('filters', $this->get('Filters')); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); JHTML::stylesheet('table.css', 'media/com_fabrik/css/'); $tmpl = $pluginParams->get('chart_layout', $tmpl); $tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'visualization' . DS . 'chart' . DS . 'views' . DS . 'chart' . DS . 'tmpl' . DS . $tmpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath . DS . "template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/visualization/chart/views/chart/tmpl/' . $tmpl . '/', true); } //check and add a general fabrik custom css file overrides template css and generic table css FabrikHelperHTML::stylesheetFromPath("media" . DS . "com_fabrik" . DS . "css" . DS . "custom.css"); //check and add a specific biz template css file overrides template css generic table css and generic custom css FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "plugins" . DS . "visualization" . DS . "chart" . DS . "views" . DS . "chart" . DS . "tmpl" . DS . $tmpl . DS . "custom.css"); //assign something to oPackage to ensure we can clear filters $str = "window.addEvent('domready', function(){\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "oPackage.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); //ensure we don't have an incorrect version of mootools loaded FabrikHelperHTML::cleanMootools(); echo parent::display(); }
function display($tmpl = 'default') { $app =& JFactory::getApplication(); FabrikHelperHTML::packageJS(); $params =& $app->getParams('com_fabrik'); $document =& JFactory::getDocument(); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $model =& $this->getModel(); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row =& $model->getVisualization(); $this->params =& $model->getParams(); $pluginParams =& $model->getPluginParams(); $this->assignRef('params', $pluginParams); $tmpl = $pluginParams->get('fb_gm_layout', $tmpl); $tmplpath = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'visualization' . DS . 'kaltura' . DS . 'views' . DS . 'kaltura' . DS . 'tmpl' . DS . $tmpl; $js = <<<EOT \t\t<script type="text/javascript" > function entryClicked ( entry_id ) { \twindow.location = "./player.php?entry_id=" + entry_id; } </script> EOT; JHTML::stylesheet('table.css', 'media/com_fabrik/css/'); $this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound')); if ($this->requiredFiltersFound) { $this->assignRef('data', $this->get('Data')); } else { $this->assignRef('data', ''); } FabrikHelperHTML::addScriptDeclaration($js); $ab_css_file = $tmplpath . DS . "template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/visualization/googlemap/views/googlemap/tmpl/' . $tmpl . '/', true); } //check and add a general fabrik custom css file overrides template css and generic table css FabrikHelperHTML::stylesheetFromPath("media" . DS . "com_fabrik" . DS . "css" . DS . "custom.css"); //check and add a specific biz template css file overrides template css generic table css and generic custom css FabrikHelperHTML::stylesheetFromPath("components" . DS . "com_fabrik" . DS . "plugins" . DS . "visualization" . DS . "kaltura" . DS . "views" . DS . "kaltura" . DS . "tmpl" . DS . $tmpl . DS . "custom.css"); $template = null; $this->assign('containerId', $this->get('ContainerId')); $this->assign('showFilters', JRequest::getInt('showfilters', 1) === 1 ? 1 : 0); $this->assignRef('filters', $this->get('Filters')); $this->assign('filterFormURL', $this->get('FilterFormURL')); $this->_setPath('template', $tmplpath); //ensure we don't have an incorrect version of mootools loaded FabrikHelperHTML::cleanMootools(); echo parent::display($template); }
/** * Method to get the field input markup. * * Options: * - target: the group id to toggler * - Show: the radio list's value to show target * - Hide: the radio list's value to hide the target * - alt: another group id, which is shown when target is hidden and hidden when target shown. * * @return string The field input markup. */ protected function getInput() { $alt = $this->element['alt']; $script = array(); $script[] = "window.addEvent('domready', function() {\n\t\tvar s = document.id('" . $this->id . "').getElements('input').filter(function (e) {\n\t\treturn (e.checked);\n\t\t});\n\t\tif (s[0].get('value') == '" . $this->element['hide'] . "') {\n\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t}"; if ($alt) { $script[] = "if (s[0].get('value') == '" . $this->element['show'] . "') {\n\t\t\tdocument.id('" . $alt . "').hide();\n\t\t}"; } $script[] = "document.id('" . $this->id . "').getElements('input').addEvent('change', function (e) {\n\t\t\t\tif (e.target.checked == true) {\n\t\t\t\t\tvar v = e.target.get('value');\n\t\t\t\t\tif (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; if ($alt) { $script[] = "if (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $alt . "').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $alt . "').show();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; } $script[] = "\n\t\t\t\t}\n\t\t\t});\n\t\t})"; FabrikHelperHTML::addScriptDeclaration(implode("\n", $script)); return parent::getInput(); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. */ function display($tpl = 'default') { $srcs = FabrikHelperHTML::framework(); $srcs[] = 'media/com_fabrik/js/listfilter.js'; $srcs[] = 'media/com_fabrik/js/advanced-search.js'; require_once COM_FABRIK_FRONTEND . '/helpers/html.php'; $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); if ($this->row->published == 0) { JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR')); return ''; } $calendar = $model->_row; $this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound')); if ($this->requiredFiltersFound) { $this->assign('chart', $this->get('Chart')); } else { $this->assign('chart', ''); } $params = $model->getParams(); $this->assign('params', $params); $viewName = $this->getName(); $pluginManager = FabrikWorker::getPluginManager(); $plugin = $pluginManager->getPlugIn('chart', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('filters', $this->get('Filters')); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assign('filterFormURL', $this->get('FilterFormURL')); $pluginParams = $model->getPluginParams(); $tpl = $pluginParams->get('chart_layout', $tpl); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/chart/views/chart/tmpl/' . $tpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath . '/template.css'; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('plugins/fabrik_visualization/chart/views/chart/tmpl/' . $tpl . '/template.css', true); } // Assign something to Fabrik.blocks to ensure we can clear filters $ref = $model->getJSRenderContext(); $js = "{$ref} = {};"; $js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});"; $js .= $model->getFilterJs(); FabrikHelperHTML::addScriptDeclaration($srcs, $js); echo parent::display(); }
function onLoad(&$params, &$formModel) { FabrikHelperHTML::script('plugins/fabrik_form/autofill/autofill.js'); $opts = new stdClass(); $opts->observe = str_replace('.', '___', $params->get('autofill_field_name')); $opts->trigger = str_replace('.', '___', $params->get('autofill_trigger')); $opts->formid = $formModel->getId(); $opts->map = $params->get('autofill_map'); $opts->cnn = $params->get('autofill_cnn'); $opts->table = $params->get('autofill_table'); $opts->editOrig = $params->get('autofill_edit_orig', 0) == 0 ? false : true; $opts = json_encode($opts); JText::script('PLG_FORM_AUTOFILL_DO_UPDATE'); JText::script('PLG_FORM_AUTOFILL_SEARCHING'); JText::script('PLG_FORM_AUTOFILL_NORECORDS_FOUND'); FabrikHelperHTML::addScriptDeclaration("head.ready(function(){var autofill = new Autofill({$opts});});"); }
/** * process the plugin, called when form is submitted * * @param object $params * @param object form */ function onAfterJSLoad(&$params, &$formModel) { $script = $params->get('jsfile'); if ($script == '-1') { return; } $className = substr($script, 0, strlen($script) - 3); $document =& JFactory::getDocument(); $form =& $formModel->getForm(); $container = $formModel->_editable ? 'form' : 'details'; if (JRequest::getVar('tmpl') != 'component') { FabrikHelperHTML::script($script, 'components/com_fabrik/plugins/form/fabrikjs/scripts/'); FabrikHelperHTML::addScriptDeclaration("\n\t\t\twindow.addEvent('load', function() {\n\t\t\t{$container}_{$form->id}.addPlugin(new {$className}({$container}_{$form->id}));\n\t\t\t{$container}_{$form->id}.runPlugins('onFormLoad', null);\n\t \t\t});"); } else { // included scripts in the head don't work in mocha window // read in the class and insert it into the body as an inline script $class = JFile::read(JPATH_BASE . "/components/com_fabrik/plugins/form/fabrikjs/scripts/{$script}"); FabrikHelperHTML::addScriptDeclaration($class); //there is no load event in a mocha window - use domready instead FabrikHelperHTML::addScriptDeclaration("\n\t\t\twindow.addEvent('domready', function() {\n\t\t\t{$container}_{$form->id}.addPlugin(new {$className}({$container}_{$form->id}));\n\t\t\t{$container}_{$form->id}.runPlugins('onFormLoad', null);\n\t \t\t});"); } }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); FabrikHelperHTML::script('media/com_fabrik/js/list.js'); FabrikHelperHTML::script('media/com_fabrik/js/advanced-search.js'); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $this->row = $model->getVisualization(); $model->setListIds(); if ($this->row->published == 0) { JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR')); return ''; } $this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound')); if ($this->requiredFiltersFound) { $this->assign('chart', $this->get('Chart')); } $viewName = $this->getName(); $pluginManager = FabrikWorker::getPluginManager(); $plugin = $pluginManager->getPlugIn('fusion_gantt_chart', 'visualization'); $this->assign('containerId', $this->get('ContainerId')); $this->assignRef('filters', $this->get('Filters')); $this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0); $this->assign('params', $model->getParams()); $pluginParams = $model->getPluginParams(); $tmpl = $pluginParams->get('fusion_gantt_chart_layout', $tmpl); $tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/fusion_gantt_chart/views/fusion_gantt_chart/tmpl/' . $tmpl; $this->_setPath('template', $tmplpath); $ab_css_file = $tmplpath . '/template.css'; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('plugins/fabrik_visualization/fusion_gantt_chart/views/fusion_gantt_chart/tmpl/' . $tmpl . '/template.css'); } //assign something to Fabrik.blocks to ensure we can clear filters $str = "head.ready(function() {\r\n\t\t\tfabrikChart{$this->row->id} = {};"; $str .= "\n" . "Fabrik.addBlock('vizualization_{$this->row->id}', fabrikChart{$this->row->id});\r\n\t\t});"; FabrikHelperHTML::addScriptDeclaration($str); echo parent::display(); }
/** * Method to get the field input markup. * * Options: * - target: the group id to toggler * - Show: the radio list's value to show target * - Hide: the radio list's value to hide the target * - alt: another group id, which is shown when target is hidden and hidden when target shown. * * @return string The field input markup. */ protected function getInput() { $fs = str_replace("'", '"', $this->element['fieldsets']); $script = array(); if ($fs !== '') { /** * New way: * * <field name="slack_attachment" type="toggleoptionsradio" class="btn-group" default="0" description="PLG_FORM_SLACK_ATTACHMENTS_DESC" label="PLG_FORM_SLACK_ATTACHMENTS_LABEL" fieldsets="{'0':'plg-form-slack-simple','1':'plg-form-slack-attachments'}"> <option value="0">JNO</option> <option value="1">JYES</option> </field> * */ $script[] = "jQuery('document').ready(function(\$) {\n\t\t\t\tvar fs = {$fs};\n\t\t\t\tvar v = \$('#" . $this->id . "').find('input:checked').val();\n\t\t\t\t\$.each(fs, function (value, fieldset) {\n\t\t\t\t\tv !== value ? \$('#' + fieldset).hide() : \$('#' + fieldset).show();\n\t\t\t\t\tv !== value ? \$('a[href*=' + fieldset + ']').hide() : \$('a[href*=' + fieldset + ']').show();\n\t\t\t\t});\n\n\t\t\t\t \$('#" . $this->id . "').find('input').on('click', function () {\n\t\t\t\t var v = \$(this).val();\n\t\t\t\t \$.each(fs, function (value, fieldset) {\n\t\t\t\t\t\tv !== value ? \$('#' + fieldset).hide() : \$('#' + fieldset).show();\n\t\t\t\t\t\tv !== value ? \$('a[href*=' + fieldset + ']').hide() : \$('a[href*=' + fieldset + ']').show();\n\t\t\t\t\t});\n\t\t\t\t });\n\t\t\t});"; } else { $alt = $this->element['alt']; $script[] = "window.addEvent('domready', function() {\n\t\tvar s = document.id('" . $this->id . "').getElements('input').filter(function (e) {\n\t\treturn (e.checked);\n\t\t});\n\t\tif (s[0].get('value') == '" . $this->element['hide'] . "') {\n\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t}"; if ($alt) { $script[] = "if (s[0].get('value') == '" . $this->element['show'] . "') {\n\t\t\tdocument.id('" . $alt . "').hide();\n\t\t}"; } $script[] = "document.id('" . $this->id . "').getElements('input').addEvent('change', function (e) {\n\t\t\t\tif (e.target.checked == true) {\n\t\t\t\t\tvar v = e.target.get('value');\n\t\t\t\t\tif (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $this->element['toggle'] . "').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; if ($alt) { $script[] = "if (v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\tdocument.id('" . $alt . "').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\tdocument.id('" . $alt . "').show();\n\t\t\t\t\t\t}\n\t\t\t\t\t}"; } $script[] = "\n\t\t\t\t}\n\t\t\t});\n\t\t})"; } FabrikHelperHTML::addScriptDeclaration(implode("\n", $script)); return parent::getInput(); }
function onLoad(&$params, &$formModel) { FabrikHelperHTML::script('javascript.js', 'components/com_fabrik/plugins/form/fabrikautofill/'); $opts = new stdClass(); $opts->observe = str_replace('.', '___', $params->get('autofill_field_name')); $opts->trigger = str_replace('.', '___', $params->get('autofill_trigger')); $opts->formid = $formModel->_id; $opts->liveSite = COM_FABRIK_LIVESITE; $opts->map = $params->get('autofill_map'); $opts->cnn = $params->get('autofill_cnn'); $opts->table = $params->get('autofill_table'); $opts->editOrig = $params->get('autofill_edit_orig', 0) == 0 ? false : true; $opts->confirm = $params->get('autofill_confirm', 1) == 0 ? false : true; $opts = json_encode($opts); $lang = new stdClass(); $lang->doupdate = JText::_('AUTOFILL_DO_UPDATE'); $lang->searching = JText::_('AUTOFILL_SEARCHING'); $lang->norecordsfound = JText::_('AUTOFILL_NORECORDS_FOUND'); $lang = json_encode($lang); $script = "window.addEvent('domready', function() {\n\t\tvar autofill = new Autofill({$opts}, {$lang});"; $script .= "\n});"; FabrikHelperHTML::addScriptDeclaration($script); //FabrikHelperHTML::addScriptDeclaration("var autofill = new Autofill($opts, $lang);"); }
function chooseaddevent() { $view->_layout = 'chooseaddevent'; $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel'); $plugin = $pluginManager->getPlugIn('calendar', 'visualization'); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $rows = $model->getEventLists(); $o = $model->getAddStandardEventFormInfo(); $options = array(); $options[] = JHTML::_('select.option', '', JText::_('PLG_VISUALIZATION_CALENDAR_PLEASE_SELECT')); if ($o != null) { $listid = $o->id; $options[] = JHTML::_('select.option', $listid, JText::_('PLG_VISUALIZATION_CALENDAR_STANDARD_EVENT')); } $model->getEvents(); $config = JFactory::getConfig(); $prefix = $config->getValue('config.dbprefix'); $this->_eventTypeDd = JHTML::_('select.genericlist', array_merge($options, $rows), 'event_type', 'class="inputbox" size="1" ', 'value', 'text', '', 'fabrik_event_type'); //tried loading in iframe and as an ajax request directly - however //in the end decided to set a call back to the main calendar object (via the package manager) //to load up the new add event form $script = "head.ready(function() {\r\n\t\t\t//oCalendar" . $model->getId() . ".addListenTo('chooseeventwin');\r\n\t\t\$('fabrik_event_type').addEvent('change', function(e) {\r\n\t\tvar fid = \$(e.target).get('value');\r\n\t\tvar o = ({'d':'','listid':fid,'rowid':0});\r\n\t\to.datefield = '{$prefix}fabrik_calendar_events___start_date';\r\n\t\to.datefield2 = '{$prefix}fabrik_calendar_events___end_date';\r\n\t\to.labelfield = '{$prefix}fabrik_calendar_events___label';\r\n\t\t"; foreach ($model->_events as $tid => $arr) { foreach ($arr as $ar) { $script .= "if(" . $ar['formid'] . " == fid)\t{\n"; $script .= "o.datefield = '" . $ar['startdate'] . "'\n"; $script .= "o.datefield2 = '" . $ar['enddate'] . "'\n"; $script .= "o.labelfield = '" . $ar['label'] . "'\n"; $script .= "}\n"; } } $script .= "var o = JSON.encode(o);\r\n\t\t// @TODO deal with this via window.fireEvent()\r\n\t\t\t//oPackage.sendMessage('chooseeventwin', 'addEvForm' , true, o);\r\n\r\n\t});\r\n\t});\r\n\t"; FabrikHelperHTML::addScriptDeclaration($script); echo '<h2>' . JText::_('PLG_VISUALIZATION_CALENDAR_PLEASE_CHOOSE_AN_EVENT_TYPE') . ':</h2>'; echo $this->_eventTypeDd; }
/** * Choose which list to add an event to * * @return void */ public function chooseaddevent() { $app = JFactory::getApplication(); $input = $app->input; $this->setLayout('chooseaddevent'); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)))); $rows = $model->getEventLists(); $o = $model->getAddStandardEventFormInfo(); $calendar = $model->getVisualization(); $options = array(); $options[] = JHTML::_('select.option', '', JText::_('PLG_VISUALIZATION_CALENDAR_PLEASE_SELECT')); if ($o != null) { $listid = $o->id; $options[] = JHTML::_('select.option', $listid, JText::_('PLG_VISUALIZATION_CALENDAR_STANDARD_EVENT')); } $model->getEvents(); $config = JFactory::getConfig(); $prefix = $config->get('dbprefix'); $attribs = 'class="inputbox" size="1" '; $options = array_merge($options, $rows); $this->_eventTypeDd = JHTML::_('select.genericlist', $options, 'event_type', $attribs, 'value', 'text', '', 'fabrik_event_type'); /* * Tried loading in iframe and as an ajax request directly - however * in the end decided to set a call back to the main calendar object (via the package manager) * to load up the new add event form */ $ref = $model->getJSRenderContext(); $script = array(); $script[] = "window.addEvent('fabrik.loaded', function() {"; $script[] = "document.id('fabrik_event_type').addEvent('change', function(e) {"; $script[] = "var fid = e.target.get('value');"; $script[] = "var o = ({'d':'','listid':fid,'rowid':0});"; $script[] = "o.datefield = '{$prefix}fabrik_calendar_events___start_date';"; $script[] = "o.datefield2 = '{$prefix}fabrik_calendar_events___end_date';"; $script[] = "o.labelfield = '{$prefix}fabrik_calendar_events___label';"; foreach ($model->_events as $tid => $arr) { foreach ($arr as $ar) { $script[] = "if(" . $ar['formid'] . " == fid)\t{"; $script[] = "o.datefield = '" . $ar['startdate'] . "'"; $script[] = "o.datefield2 = '" . $ar['enddate'] . "'"; $script[] = "o.labelfield = '" . $ar['label'] . "'"; $script[] = "}\n"; } } $script[] = "Fabrik.blocks['" . $ref . "'].addEvForm(o);"; $script[] = "Fabrik.Windows.chooseeventwin.close();"; $script[] = "});"; $script[] = "});"; echo '<h2>' . JText::_('PLG_VISUALIZATION_CALENDAR_PLEASE_CHOOSE_AN_EVENT_TYPE') . ':</h2>'; echo $this->_eventTypeDd; FabrikHelperHTML::addScriptDeclaration(implode("\n", $script)); }
protected function getManagementJS($data = array()) { $app = JFactory::getApplication(); $menuItem = $app->getMenu('site')->getActive(); $Itemid = is_object($menuItem) ? $menuItem->id : 0; $model = $this->getModel(); $item = $model->getTable(); $listid = $model->getId(); $formModel = $model->getFormModel(); $elementsNotInTable = $formModel->getElementsNotInTable(); if ($model->requiresSlimbox()) { FabrikHelperHTML::slimbox(); } if ($model->requiresMocha()) { FabrikHelperHTML::mocha(); } FabrikHelperHTML::script('media/com_fabrik/js/list.js', true); $tmpl = $this->get('tmpl'); $this->assign('tmpl', $tmpl); $this->get('ListCss'); // check for a custom js file and include it if it exists $aJsPath = JPATH_SITE.DS."components".DS."com_fabrik".DS."views".DS."list".DS."tmpl".DS.$tmpl.DS."javascript.js"; if (JFile::exists($aJsPath)) { FabrikHelperHTML::script('components/com_fabrik/views/list/tmpl/'.$tmpl.'/javascript.js', true); } $origRows = $this->rows; $this->rows = array(array()); $tmpItemid = !isset($Itemid) ? 0 : $Itemid; $this->_c = 0; $this->_row = new stdClass(); $script = ''; $opts = new stdClass(); $opts->admin = $app->isAdmin(); $opts->ajax = (int)$model->isAjax(); $opts->filterMethod = $this->filter_action; $opts->form = 'listform_' . $listid; $opts->headings = $model->_jsonHeadings(); $labels = $this->headings; foreach ($labels as &$l) { $l = strip_tags($l); } $opts->labels = $labels; $opts->primaryKey = $item->db_primary_key; $opts->Itemid = $tmpItemid; $opts->formid = $model->getFormModel()->getId(); $opts->canEdit = $model->canEdit() ? "1" : "0"; $opts->canView = $model->canView() ? "1" : "0"; $opts->page = JRoute::_('index.php'); $opts->isGrouped = $this->isGrouped; $opts->formels = $elementsNotInTable; $opts->actionMethod = $model->getParams()->get('actionMethod'); $opts->data = $data; //if table data starts as empty then we need the html from the row // template otherwise we can't add a row to the table if ($model->isAjax()) { ob_start(); $this->_row = new stdClass(); $this->_row->id = ''; $this->_row->class = 'fabrik_row'; require(COM_FABRIK_FRONTEND.DS.'views'.DS.'list'.DS.'tmpl'.DS.$tmpl.DS.'default_row.php'); $opts->rowtemplate = ob_get_contents(); ob_end_clean(); } //$$$rob if you are loading a table in a window from a form db join select record option // then we want to know the id of the window so we can set its showSpinner() method $opts->winid = JRequest::getVar('winid', ''); $opts = json_encode($opts); JText::script('COM_FABRIK_PREV'); JText::script('COM_FABRIK_SELECT_ROWS_FOR_DELETION'); JText::script('JYES'); JText::script('JNO'); JText::script('COM_FABRIK_SELECT_COLUMNS_TO_EXPORT'); JText::script('COM_FABRIK_INCLUDE_FILTERS'); JText::script('COM_FABRIK_INCLUDE_DATA'); JText::script('COM_FABRIK_INCLUDE_RAW_DATA'); JText::script('COM_FABRIK_INLCUDE_CALCULATIONS'); JText::script('COM_FABRIK_EXPORT'); JText::script('COM_FABRIK_START'); JText::script('COM_FABRIK_NEXT'); JText::script('COM_FABRIK_END'); JText::script('COM_FABRIK_PAGE'); JText::script('COM_FABRIK_OF'); JText::script('COM_FABRIK_LOADING'); JText::script('COM_FABRIK_RECORDS'); JText::script('COM_FABRIK_SAVING_TO'); JText::script('COM_FABRIK_CONFIRM_DROP'); JText::script('COM_FABRIK_CONFIRM_DELETE'); JText::script('COM_FABRIK_NO_RECORDS'); JText::script('COM_FABRIK_CSV_COMPLETE'); JText::script('COM_FABRIK_CSV_DOWNLOAD_HERE'); JText::script('COM_FABRIK_CONFIRM_DELETE'); JText::script('COM_FABRIK_CSV_DOWNLOADING'); JText::script('COM_FABRIK_FILE_TYPE'); //keyboard short cuts JText::script('COM_FABRIK_LIST_SHORTCUTS_ADD'); JText::script('COM_FABRIK_LIST_SHORTCUTS_EDIT'); JText::script('COM_FABRIK_LIST_SHORTCUTS_DELETE'); JText::script('COM_FABRIK_LIST_SHORTCUTS_FILTER'); $script .= "\n" . "var list = new FbList($listid,"; $script .= $opts; $script .= "\n" . ");"; $script .= "\n" . "Fabrik.addBlock('list_{$listid}', list);"; //add in plugin objects $params = $model->getParams(); //$activePlugins = $params->get('plugins'); $pluginManager = $model->getPluginManager(); $c = 0; $pluginManager->runPlugins('onLoadJavascriptInstance', $model, 'list'); $aObjs = $pluginManager->_data; $script .= "\nlist.addPlugins([\n"; $script .= " " . implode(",\n ", $aObjs); $script .= "\n]);\n"; //@since 3.0 inserts content before the start of the list render (currently on f3 tmpl only) $pluginManager->runPlugins('onGetContentBeforeList', $model, 'list'); $this->assign('pluginBeforeList', $pluginManager->_data); $script = " head.ready(function() { ".$model->filterJs." $script })"; FabrikHelperHTML::addScriptDeclaration($script); $this->getElementJs(); //reset data back to original settings $this->rows = $origRows; }
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php */ // no direct access defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . DS . 'helpers' . DS . 'html'); JHTML::stylesheet('administrator/components/com_fabrik/views/fabrikadmin.css'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::script('media/com_fabrik/js/mootools-ext.js'); $fbConfig =& JComponentHelper::getParams('com_fabrik'); $document = JFactory::getDocument(); FabrikHelperHTML::script('administrator/components/com_fabrik/views/namespace.js', true); FabrikHelperHTML::script('administrator/components/com_fabrik/views/pluginmanager.js', true); FabrikHelperHTML::script('administrator/components/com_fabrik/views/list/tmpl/adminlist.js', true); FabrikHelperHTML::addScriptDeclaration($this->js); ?> <form action="<?php JRoute::_('index.php?option=com_fabrik'); ?> " method="post" name="adminForm" id="adminForm" class="form-validate"> <div class="width-40 fltlft"> <?php $panels = array(array('heading' => JText::_('COM_FABRIK_DETAILS'), 'fieldset' => array('main', 'details2')), array('heading' => JText::_('COM_FABRIK_FILTERS'), 'fieldset' => array('main_filter', 'filters')), array('heading' => JText::_('COM_FABRIK_NAVIGATION'), 'fieldset' => array('main_nav', 'navigation')), array('heading' => JText::_('COM_FABRIK_LAYOUT'), 'fieldset' => array('main_template', 'layout')), array('heading' => JText::_('COM_FABRIK_MOBILE_LAYOUT'), 'fieldset' => array('mobile-layout')), array('heading' => JText::_('COM_FABRIK_LINKS'), 'fieldset' => array('links')), array('heading' => JText::_('COM_FABRIK_NOTES'), 'fieldset' => array('notes')), array('heading' => JText::_('COM_FABRIK_ADVANCED'), 'fieldset' => array('advanced'))); echo JHtml::_('sliders.start', 'list-sliders-' . $this->item->id, array('useCookie' => 1)); foreach ($panels as $panel) { echo JHtml::_('sliders.panel', $panel['heading'], $panel['fieldset'][0] . -'details'); ?>
/** * Display the form to add or edit a cronjob * @param object cronjob * @param object parameters from attributes * @param array lists * @param object pluginmanager */ function edit($row, $params, $lists, &$pluginManager) { JRequest::setVar('hidemainmenu', 1); FabrikHelperHTML::script('namespace.js', 'administrator/components/com_fabrik/views/', true); FabrikHelperHTML::script('admincron.js', 'administrator/components/com_fabrik/views/', true); FabrikHelperHTML::tips(); $document =& JFactory::getDocument(); FabrikHelperHTML::addScriptDeclaration("\n\t\t\twindow.addEvent('domready', function(e) {\n\t\t\t\tnew adminCron({'sel':'" . $row->plugin . "'});\n\t\t\t});\n\n\t\t\tfunction submitbutton(pressbutton) {\n\t\t\t\tvar form = document.adminForm;\n\t\t\t\tif (pressbutton == 'cancel') {\n\t\t\t\t\tsubmitform( pressbutton);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t/* do field validation */\n\t\t\t\tif (form.label.value == '') {\n\t\t\t\t\talert( '" . JText::_('PLEASE ENTER A LABEL', true) . "');\n\t\t\t\t} else {\n\t\t\t\t\tsubmitform( pressbutton);\n\t\t\t\t}\n\t\t\t}\n\t\t\t"); FabrikViewCron::setCronToolbar(); FabrikHelperHTML::loadCalendar(); FabrikHelperHTML::cleanMootools(); ?> <form action="index.php" method="post" name="adminForm"> <div class="col100"> <fieldset class="adminform"> <legend><?php echo JText::_('DETAILS'); ?> </legend> <table class="admintable"> <tr> <td class="key"><label for="label"><?php echo JText::_('LABEL'); ?> </label></td> <td><input class="inputbox" type="text" id="label" name="label" size="75" value="<?php echo $row->label; ?> " /></td> </tr> <tr> <td class="key"><label for="frequency"><?php echo JText::_('EVERY'); ?> </label></td> <td><input class="inputbox" type="text" id="frequency" name="frequency" size="4" value="<?php echo $row->frequency; ?> " /></td> </tr> <tr> <td class="key"><label for="unit"><?php echo JText::_('UNIT'); ?> </label></td> <td><?php echo $lists['unit']; ?> </td> </tr> <tr> <td class="key"><label for="lastrun"><?php echo JText::_('STARTING FROM'); ?> </label></td> <td><?php echo JHTML::calendar($row->lastrun, 'lastrun', 'lastrun', '%Y-%m-%d %H:%M:%S', array('size' => 23)); ?> </td> </tr> <tr> <td class="key"><label for="state"><?php echo JText::_('PUBLISHED'); ?> </label></td> <td> <input type="checkbox" id="state" name="state" value="1" <?php echo $row->state ? 'checked="checked"' : ''; ?> /> </td> </tr> <tr> <td colspan="2"> <?php echo stripslashes($params->render()); ?> </td> </tr> <tr> <td class="key"> <label for=""><?php echo JText::_('PLUGIN'); ?> </label> </td> <td> <?php echo $lists['plugins']; ?> </td> </tr> <?php foreach ($pluginManager->_plugIns['cron'] as $oPlugin) { $oPlugin->setId($row->id); ?> <tr> <td colspan="2"> <?php $oPlugin->renderAdminSettings(); ?> </td> </tr> <?php } ?> </table> </fieldset> <input type="hidden" name="option" value="com_fabrik" /> <input type="hidden" name="c" value="cron" /> <input type="hidden" name="task" /> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> </div> <?php echo JHTML::_('form.token'); echo JHTML::_('behavior.keepalive'); ?> </form> <?php }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $script = "head.ready(function() {\n\t\tvar s = \$('" . $this->id . "').getElements('input').filter(function(e){\n\t\treturn (e.checked);\n\t\t});\n\t\tif(s[0].get('value') == '" . $this->element['hide'] . "'){\n\t\t\t\$('" . $this->element['toggle'] . "').hide();\n\t\t}\n\t\t\t\$('" . $this->id . "').getElements('input').addEvent('change', function(e){\n\t\t\t\tif(e.target.checked == true){\n\t\t\t\t\tvar v = e.target.get('value');\n\t\t\t\t\tif(v == '" . $this->element['show'] . "') {\n\t\t\t\t\t\t\$('" . $this->element['toggle'] . "').show();\n\t\t\t\t\t} else{\n\t\t\t\t\t\tif(v == '" . $this->element['hide'] . "') {\n\t\t\t\t\t\t\t\$('" . $this->element['toggle'] . "').hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t})"; FabrikHelperHTML::addScriptDeclaration($script); return parent::getInput(); }