示例#1
0
 /**
  * Create JS JLayout data
  *
  * @return void
  */
 private function jLayouts()
 {
     FabrikHelperHTML::jLayoutJs('fabrik-visualization-fullcalendar-viewbuttons', 'fabrik-visualization-fullcalendar-viewbuttons', (object) array(), array(JPATH_PLUGINS . '/fabrik_visualization/fullcalendar/layouts/'));
     FabrikHelperHTML::jLayoutJs('fabrik-visualization-fullcalendar-event-popup', 'fabrik-visualization-fullcalendar-event-popup', (object) array(), array(JPATH_PLUGINS . '/fabrik_visualization/fullcalendar/layouts/'));
     FabrikHelperHTML::jLayoutJs('fabrik-visualization-fullcalendar-viewevent', 'fabrik-visualization-fullcalendar-viewevent', (object) array(), array(JPATH_PLUGINS . '/fabrik_visualization/fullcalendar/layouts/'));
     $modalOpts = array('content' => '', 'id' => 'fullcalendar_addeventwin', 'title' => FText::_('PLG_VISUALIZATION_FULLCALENDAR_ADD_EVENT'), 'modal' => false, 'expandable' => true);
     FabrikHelperHTML::jLayoutJs('fullcalendar_addeventwin', 'fabrik-modal', (object) $modalOpts);
     $modalOpts = array('content' => '', 'id' => 'fullcalendar_chooseeventwin', 'title' => FText::_('PLG_VISUALIZATION_FULLCALENDAR_PLEASE_SELECT'), 'modal' => false, 'expandable' => true);
     FabrikHelperHTML::jLayoutJs('fullcalendar_chooseeventwin', 'fabrik-modal', (object) $modalOpts);
 }
示例#2
0
 /**
  * Add the js jLayout objects for rendering the modal
  *
  * @return void
  */
 public static function modalJLayouts()
 {
     FabrikHelperHTML::jLayoutJs('modal-close', 'modal.fabrik-close');
     FabrikHelperHTML::jLayoutJs('icon-expand', 'fabrik-icon', (object) array('icon' => 'icon-expand'));
     FabrikHelperHTML::jLayoutJs('icon-full-screen', 'fabrik-icon', (object) array('icon' => 'icon-out-2 icon-fullscreen'));
 }
示例#3
0
 /**
  * Get JS objects
  *
  * @param   array $data list data
  *
  * @return  void
  */
 protected function getManagementJS($data = array())
 {
     $input = $this->app->input;
     $itemId = FabrikWorker::itemId();
     /** @var FabrikFEModelList $model */
     $model = $this->getModel();
     $params = $model->getParams();
     $item = $model->getTable();
     $listRef = $model->getRenderContext();
     $listId = $model->getId();
     $formModel = $model->getFormModel();
     $elementsNotInTable = $formModel->getElementsNotInTable();
     $toggleCols = (bool) $params->get('toggle_cols', false);
     $ajax = (int) $model->isAjax();
     $ajaxLinks = (bool) $params->get('list_ajax_links', $ajax);
     $opts = new stdClass();
     $pluginManager = FabrikWorker::getPluginManager();
     if ($ajaxLinks) {
         $modalTitle = 'test';
         $modalOpts = array('content' => '', 'id' => 'ajax_links', 'title' => JText::_($modalTitle), 'modal' => false, 'expandable' => true);
         FabrikHelperHTML::jLayoutJs('ajax_links', 'fabrik-modal', (object) $modalOpts);
     }
     // Advanced search
     if ($params->get('advanced-filter')) {
         $modalOpts = array('content' => '', 'id' => 'advanced-filter', 'title' => JText::_('COM_FABRIK_FIELD_ADVANCED_SEARCH_LABEL'), 'modal' => false, 'expandable' => true);
         FabrikHelperHTML::jLayoutJs('advanced-filter', 'fabrik-modal', (object) $modalOpts);
     }
     FabrikHelperHTML::jLayoutJs('modal-state-label', 'list.fabrik-filters-modal-state-label', $layoutData = (object) array('label' => '', 'displayValue' => '', 'key' => ''));
     $this->csvJS($opts, $model);
     if ($model->requiresSlimbox()) {
         FabrikHelperHTML::slimbox();
     }
     if ($model->requiresSlideshow()) {
         FabrikHelperHTML::slideshow();
     }
     $src = FabrikHelperHTML::framework();
     $shim = array();
     $dep = new stdClass();
     $dep->deps = array();
     $shim['fab/list'] = $dep;
     $src['FbList'] = FabrikHelperHTML::mediaFile('list.js');
     $src['FbListFilter'] = FabrikHelperHTML::mediaFile('listfilter.js');
     $src['ListPlugin'] = FabrikHelperHTML::mediaFile('list-plugin.js');
     $src = $model->getPluginJsClasses($src, $shim);
     $pluginManager->runPlugins('loadJavascriptClassName', $model, 'list');
     $pluginManager->data = array_filter($pluginManager->data, function ($v) {
         return $v !== '';
     });
     $model->getCustomJsAction($src);
     $tmpl = $model->getTmpl();
     $this->tmpl = $tmpl;
     $model->getListCss();
     // Check for a custom js file and include it if it exists
     $aJsPath = JPATH_SITE . '/components/com_fabrik/views/list/tmpl/' . $tmpl . '/javascript.js';
     if (JFile::exists($aJsPath)) {
         $src['CustomJs'] = 'components/com_fabrik/views/list/tmpl/' . $tmpl . '/javascript.js';
     }
     $origRows = $this->rows;
     $this->rows = array(array());
     $tmpItemid = !isset($itemId) ? 0 : $itemId;
     $this->_row = new stdClass();
     $script = array();
     $params = $model->getParams();
     $opts->admin = $this->app->isAdmin();
     $opts->ajax = $ajax;
     $opts->ajax_links = $ajaxLinks;
     $opts->links = array('detail' => $params->get('detailurl', ''), 'edit' => $params->get('editurl', ''), 'add' => $params->get('addurl', ''));
     $opts->filterMethod = $this->filter_action;
     $opts->advancedFilters = $model->getAdvancedFilterValues();
     $opts->resetFilters = (bool) FabrikWorker::getMenuOrRequestVar('resetfilters', 0, false, 'request');
     $opts->form = 'listform_' . $listRef;
     $this->listref = $listRef;
     $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->listRef = $listRef;
     $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->toggleCols = $toggleCols;
     $opts->j3 = FabrikWorker::j3();
     $opts->singleOrdering = (bool) $model->singleOrdering();
     // Reset data back to original settings
     $this->rows = $origRows;
     $formEls = array();
     foreach ($elementsNotInTable as $tmpElement) {
         $oo = new stdClass();
         $oo->name = $tmpElement->name;
         $oo->label = $tmpElement->label;
         $formEls[] = $oo;
     }
     $opts->formels = $formEls;
     $opts->fabrik_show_in_list = $input->get('fabrik_show_in_list', array(), 'array');
     $opts->popup_width = $params->get('popup_width', '');
     $opts->popup_height = $params->get('popup_height', '');
     $xOffset = $params->get('popup_offset_x', '');
     $yOffset = $params->get('popup_offset_y', '');
     if ($xOffset !== '') {
         $opts->popup_offset_x = (int) $xOffset;
     }
     if ($yOffset !== '') {
         $opts->popup_offset_y = (int) $yOffset;
     }
     /**
      * Added the $nodata object as we now weed something to pass in just to keep editLabel
      * and viewLabel happy, after adding placeholder replacement to the labels for a Pro user,
      * because the tooltips said we did that, which we never actually did.
      *
      * http://fabrikar.com/forums/index.php?threads/placeholders-in-list-links-and-labels.37726/#post-191081
      *
      * However, this means that using placeholders will yield funky labels for the popups, as
      * this isn't per row.  So we may need to not use editLabel / viewLabel here any more,
      * and just use the default COM_FABRIK_VIEW/EDIT.  Or add YAFO's, ::sigh::.
      *
      * But for now, it's too corner case to worry about!
      */
     $nodata = new stdClass();
     $opts->popup_edit_label = $model->editLabel($nodata);
     $opts->popup_view_label = $model->viewLabel($nodata);
     $opts->popup_add_label = $model->addLabel();
     $opts->limitLength = $model->limitLength;
     $opts->limitStart = $model->limitStart;
     $opts->tmpl = $tmpl;
     $opts->data = $data;
     $opts->groupByOpts = new stdClass();
     $opts->groupByOpts->isGrouped = (bool) $this->isGrouped;
     $opts->groupByOpts->collapseOthers = (bool) $params->get('group_by_collapse_others', false);
     $opts->groupByOpts->startCollapsed = (bool) $params->get('group_by_start_collapsed', false);
     $opts->groupByOpts->bootstrap = FabrikWorker::j3();
     // 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
     ob_start();
     $this->_row = new stdClass();
     $this->_row->id = '';
     $this->_row->class = 'fabrik_row';
     echo $this->loadTemplate('row');
     $opts->itemTemplate = 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 = $input->get('winid', '');
     $this->jsText();
     $script[] = "window.addEvent('domready', function () {";
     $script[] = "\tvar list = new FbList('{$listId}',";
     $script[] = "\t" . json_encode($opts);
     $script[] = "\t);";
     $script[] = "\tFabrik.addBlock('list_{$listRef}', list);";
     // Add in plugin objects
     $pluginManager->runPlugins('onLoadJavascriptInstance', $model, 'list');
     $aObjs = $pluginManager->data;
     if (!empty($aObjs)) {
         $script[] = "list.addPlugins([\n";
         $script[] = "\t" . implode(",\n  ", $aObjs);
         $script[] = "]);";
     }
     // @since 3.0 inserts content before the start of the list render (currently on f3 tmpl only)
     $pluginManager->runPlugins('onGetContentBeforeList', $model, 'list');
     $this->pluginBeforeList = $pluginManager->data;
     $script[] = $model->filterJs;
     $script[] = $this->getModel()->getElementJs($src);
     // End domready wrapper
     $script[] = '})';
     $script = implode("\n", $script);
     FabrikHelperHTML::iniRequireJS($shim);
     FabrikHelperHTML::script($src, $script);
 }
示例#4
0
 /**
  * Create the html for Ajax upload widget
  *
  * @param   array  $str            Current html output
  * @param   int    $repeatCounter  Repeat group counter
  * @param   array  $values         Existing files
  *
  * @return	array	Modified file-upload html
  */
 protected function plupload($str, $repeatCounter, $values)
 {
     FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'media/com_fabrik/css/slider.css');
     $params = $this->getParams();
     $w = (int) $params->get('ajax_dropbox_width', 0);
     $h = (int) $params->get('ajax_dropbox_height', 200);
     $dropBoxStyle = 'height:' . $h . 'px;';
     if ($w !== 0) {
         $dropBoxStyle .= 'width:' . $w . 'px;';
     }
     $layout = $this->getLayout('widget');
     $displayData = new stdClass();
     $displayData->id = $this->getHTMLId($repeatCounter);
     $displayData->winWidth = $params->get('win_width', 400);
     $displayData->winHeight = $params->get('win_height', 400);
     $displayData->canCrop = $this->canCrop();
     $displayData->canvasSupport = FabrikHelperHTML::canvasSupport();
     $displayData->dropBoxStyle = $dropBoxStyle;
     $displayData->field = implode("\n", $str);
     $displayData->j3 = FabrikWorker::j3();
     $str = (array) $layout->render($displayData);
     FabrikHelperHTML::jLayoutJs('fabrik-progress-bar', 'fabrik-progress-bar', (object) array('context' => '', 'animated' => true));
     FabrikHelperHTML::jLayoutJs('fabrik-progress-bar-success', 'fabrik-progress-bar', (object) array('context' => 'success', 'value' => 100));
     FabrikHelperHTML::jLayoutJs('fabrik-icon-delete', 'fabrik-icon', (object) array('icon' => 'delete'), array('debug' => true));
     return $str;
 }
示例#5
0
 /**
  * Create the upload modal and its content
  * Needs to be a unique $modalId to ensure that multiple modals can be created
  * each with unique content
  *
  * @param   int $repeatCounter
  */
 protected function pluploadModal($repeatCounter)
 {
     $params = $this->getParams();
     $modalContentLayout = $this->getLayout('modal-content');
     $modalData = (object) array('id' => $this->getHTMLId($repeatCounter), 'canCrop' => $this->canCrop(), 'canvasSupport' => FabrikHelperHTML::canvasSupport(), 'width' => $params->get('win_width', 400), 'height' => $params->get('win_height', 400));
     $modalContent = $modalContentLayout->render($modalData);
     $modalTitle = $this->canCrop() ? 'PLG_ELEMENT_FILEUPLOAD_CROP_AND_SCALE' : 'PLG_ELEMENT_FILEUPLOAD_PREVIEW';
     $modalId = $this->modalId($repeatCounter);
     $modalOpts = array('content' => $modalContent, 'id' => $modalId, 'title' => JText::_($modalTitle), 'modal' => true);
     FabrikHelperHTML::jLayoutJs($modalId, 'fabrik-modal', (object) $modalOpts);
 }
示例#6
0
 /**
  * Render checkbox list in form
  *
  * @param   array  $data           Form data
  * @param   int    $repeatCounter  Repeat group counter
  * @param   array  &$html          HTML to assign output to
  * @param   array  $tmp            List of value/label objects
  * @param   array  $default        Default values - the lookup table's primary key values
  *
  * @since   3.0.7
  *
  * @return  void
  */
 protected function renderCheckBoxList($data, $repeatCounter, &$html, $tmp, $default)
 {
     $id = $this->getHTMLId($repeatCounter);
     $name = $this->getHTMLName($repeatCounter);
     $params = $this->getParams();
     $html[] = '<div class="fabrikSubElementContainer" id="' . $id . '">';
     $attributes = 'class="fabrikinput inputbox" id="' . $id . '"';
     $name = FabrikString::rtrimword($name, '[]');
     if (!$this->getFormModel()->isNewRecord()) {
         // If its a new record we don't want to look up defaults in the look up table as they will not exist
         $targetIds = $this->multiOptionTargetIds($data, $repeatCounter);
         if ($targetIds !== false) {
             $default = $targetIds;
         }
     }
     $this->renderReadOnlyTrimOptions($tmp, $default);
     $layout = $this->getLayout('form-checkboxlist');
     $displayData = new stdClass();
     $displayData->options = $tmp;
     $displayData->default = (array) $default;
     $displayData->optsPerRow = (int) $params->get('dbjoin_options_per_row', 1);
     $displayData->name = $name;
     $displayData->editable = $this->isEditable();
     $displayData->optionLayout = $this->getLayout('form-checkbox');
     $html[] = '<div class="fabrikSubElementContainer" id="' . $id . '">';
     $singleLayout = 'fabrik-element-' . $this->getPluginName() . '-form-checkbox';
     FabrikHelperHTML::jLayoutJs($singleLayout, $singleLayout, $displayData, array($this->layoutBasePath()));
     if (FabrikWorker::j3()) {
         $html[] = $layout->render($displayData);
     } else {
         $html[] = FabrikHelperHTML::aList('checkbox', $tmp, $name, $attributes, $default, 'value', 'text', $displayData->optsPerRow, $displayData->editable);
     }
     if (empty($tmp) && !FabrikWorker::j3()) {
         $tmpIds = array();
         $o = new stdClass();
         $o->text = 'dummy';
         $o->value = 'dummy';
         $tmpIds[] = $o;
         $tmp = $tmpIds;
         $dummy = FabrikHelperHTML::aList('checkbox', $tmp, $name, $attributes, $default, 'value', 'text', 1, true);
         $html[] = '<div class="chxTmplNode">' . $dummy . '</div>';
     }
     $html[] = '</div>';
 }
示例#7
0
 /**
  * Add any jsJLayout templates to Fabrik.jLayouts js object.
  *
  * @return void
  */
 public function jsJLayouts()
 {
     $opts = $this->elementJavascriptOpts();
     $params = $this->getParams();
     if ($opts->allowadd) {
         $modalOpts = array('content' => '', 'id' => $opts->modalId, 'title' => '', 'modal' => false, 'expandable' => true);
         FabrikHelperHTML::jLayoutJs($opts->modalId, 'fabrik-modal', (object) $modalOpts);
     }
     if ($params->get('fabrikdatabasejoin_frontend_select')) {
         $modalOpts = array('content' => '', 'id' => 'db_join_select', 'title' => '', 'modal' => false, 'expandable' => true);
         FabrikHelperHTML::jLayoutJs('db_join_select', 'fabrik-modal', (object) $modalOpts);
     }
 }