/** * Display method * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { // Get config parameters $config = JSNConfigHelper::get(); $this->_document = JFactory::getDocument(); JHtmlBehavior::framework(); // Set the toolbar JToolBarHelper::title(JText::_('JSN_IMAGESHOW') . ': ' . JText::_('MAINTENANCE_CONFIGURATION_AND_MAINTENANCE'), 'maintenance'); // Get messages $msgs = ''; if (!$config->get('disable_all_messages')) { $msgs = JSNUtilsMessage::getList('CONFIGURATION_AND_MAINTENANCE'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; } // Assign variables for rendering $this->assignRef('msgs', $msgs); $this->_addAssets(); $this->addToolbar(); // Type of screen $type = JRequest::getWord('type', 'backup'); $themeName = JRequest::getWord('theme_name'); $sourceType = JRequest::getString('source_type'); switch ($type) { case 'themeparameters': $this->addTemplatePath(JPATH_PLUGINS . DS . 'jsnimageshow' . DS . $themeName . DS . 'views' . DS . 'maintenance' . DS . 'tmpl'); echo $this->loadTemplate('theme_config'); break; case 'profileparameters': $this->addTemplatePath(JPATH_PLUGINS . DS . 'jsnimageshow' . DS . $sourceType . DS . 'views' . DS . 'maintenance' . DS . 'tmpl'); echo $this->loadTemplate('source_config'); break; case 'editprofile': $sourceID = JRequest::getInt('external_source_id'); $countShowlist = JRequest::getInt('count_showlist'); $imageSource = JSNISFactory::getSource($sourceType, 'external'); $imageSource->_source['sourceTable']->load($sourceID); $this->assignRef('sourceInfo', $imageSource->_source['sourceTable']); $this->assignRef('countShowlist', $countShowlist); $this->addTemplatePath(JPATH_PLUGINS . DS . 'jsnimageshow' . DS . 'source' . $sourceType . DS . 'views' . DS . 'maintenance' . DS . 'tmpl'); echo $this->loadTemplate('edit_source_profile'); break; default: // Display the template parent::display($tpl); break; } }
/** * Delete a specifed profile * * @param int $sourceID The ID of source * @param string $sourceName The name of source * * @return void */ public function deleteProfile($sourceID, $sourceName) { $query = 'SELECT sl.showlist_id FROM #__imageshow_source_profile p INNER JOIN #__imageshow_showlist sl ON sl.image_source_profile_id = p.external_source_profile_id WHERE p.external_source_id = ' . (int) $sourceID . ' AND sl.image_source_name = ' . $this->_db->quote($sourceName); $this->_db->setQuery($query); $result = $this->_db->loadObjectList(); if (count($result)) { $showlistTable = JTable::getInstance('showlist', 'Table'); foreach ($result as $showlist) { if ($showlistTable->load($showlist->showlist_id)) { $imageSource = JSNISFactory::getSource($showlistTable->image_source_name, $showlistTable->image_source_type, $showlistTable->showlist_id); $imageSource->removeAllImages(array('showlist_id' => $showlistTable->showlist_id)); $imageSource->_source['profileTable']->delete(); $showlistTable->image_source_name = ''; $showlistTable->image_source_type = ''; $showlistTable->image_source_profile_id = 0; $showlistTable->store(); } } } //remove source $query = 'DELETE FROM #__imageshow_external_source_' . $sourceName . ' WHERE external_source_id = ' . (int) $sourceID; $this->_db->setQuery($query); $this->_db->query(); }
* Websites: http://www.joomlashine.com * Technical Support: Feedback - http://www.joomlashine.com/contact-us/get-support.html */ defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); $showlistID = JRequest::getInt('showlist_id', 0); $sourceIdentify = JRequest::getVar('source_identify', ''); $sourceType = JRequest::getVar('image_source_type', ''); $return = JRequest::getVar('return', '', 'get'); if (base64_decode($return) != @$_SERVER['HTTP_REFERER']) { $app->redirect(base64_decode($return)); return; } $availableProfile = array(); if ($sourceIdentify != '') { $imageSource = JSNISFactory::getSource($sourceIdentify, $sourceType, $showlistID); $availableProfile = $imageSource->getAvaiableProfiles(); } $availableProfile = array_reverse($availableProfile); $exsitedAvailableProfile = count($availableProfile); $availableProfile[] = array('value' => 0, 'text' => ' - ' . JText::_('SHOWLIST_PROFILE_SELECT_PROFILE') . ' - '); $availableProfile = array_reverse($availableProfile); $params = JSNUtilsLanguage::getTranslated(array('JSN_IMAGESHOW_SAVE', 'JSN_IMAGESHOW_CLOSE', 'JSN_IMAGESHOW_CONFIRM')); ?> <script type="text/javascript"> var objISShowlist = null; require(['imageshow/joomlashine/showlist'], function (JSNISShowlist) { objISShowlist = new JSNISShowlist({ language: <?php echo json_encode($params); ?>
/** * Display method * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { $images = array(); $catid = 0; $tmpjs = ''; $albumID = ''; $lists = array(); $countImage = 0; $canAutoDownload = true; $this->_document = JFactory::getDocument(); $objJSNUtils = JSNISFactory::getObj('classes.jsn_is_utils'); $objJSNImages = JSNISFactory::getObj('classes.jsn_is_images'); $objJSNJSLanguages = JSNISFactory::getObj('classes.jsn_is_jslanguages'); $objImages = JSNISFactory::getObj('classes.jsn_is_images'); $objJSNMsg = JSNISFactory::getObj('classes.jsn_is_message'); $model = $this->getModel(); $items = $this->get('data'); // Get messages $msgs = ''; $msgs = $objJSNMsg->getList('SHOWLISTS'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; if (isset($items->image_source_name) && $items->image_source_name != '') { $imageSource = JSNISFactory::getSource($items->image_source_name, $items->image_source_type, $items->showlist_id); $cat = $objImages->getAllCatShowlist($items->showlist_id); if (!empty($cat)) { $catid = $cat[0]; $config = array('album' => $catid); $sync = $imageSource->getShowlistMode(); if ($sync == 'sync') { $images = $imageSource->loadImages($config); } else { $images = $imageSource->loadImages($config); } } if ($imageSource->getShowlistMode() == 'sync') { $rmcat = 'JSNISImageGrid.removecatSelected();'; } else { $rmcat = ''; } $totalimage = count($images); if ($totalimage) { $imageInfo = (array) @$images->images[0]; $albumID = @$imageInfo['album_extid']; } $jscode = "\n\t\t\t\tvar JSNISImageGrid;\n\t\t\t\tvar initImageGrid = false;\n\t\t\t\tvar baseUrl = '" . JURI::root() . "';\n\t\t\t\tvar VERSION_EDITION_NOTICE = \"" . JText::_('VERSION_EDITION_NOTICE') . "\";\n\t\t\t(function(\$){\n\t\t\t\tfunction jsnisOpenTree(child)\n\t\t\t\t{\n\t\t\t\t\tvar parent = child.parent().parent();\n\n\t\t\t\t\tif (parent.attr('id') == 'jsn-jtree-categories' || parent.attr('id') == undefined) return;\n\n\t\t\t\t\tif (parent.hasClass('secondchild'))\n\t\t\t\t\t{\n\t\t\t\t\t\tparent.parent().parent().removeClass('jsn-jtree-close').addClass('jsn-jtree-open');\n\t\t\t\t\t\tparent.removeClass('jsn-jtree-close').addClass('jsn-jtree-open');\n\t\t\t\t\t\tparent.find('>ul').css('display','block');\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tparent.removeClass('jsn-jtree-close').addClass('jsn-jtree-open');\n\t\t\t\t\t\tparent.find('>ul').css('display','block');\n\t\t\t\t\t\tjsnisOpenTree(parent);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction jsnisReshowTree(tree)\n\t\t\t\t{\n\t\t\t\t\ttree.children('li').each(function(){\n\n\t\t\t\t\t\tif (\$(this).children('ul').length)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (\$(this).hasClass('catselected'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjsnisOpenTree(\$(this));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar treeChild = \$(this).children('ul');\n\t\t\t\t\t\t\tjsnisReshowTree(treeChild);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (\$(this).hasClass('catselected'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjsnisOpenTree(\$(this));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t}\n\t\t\t\t\$('#dialogbox:ui-dialog').dialog('destroy');\n\t\t\t\t\$('#dialogbox2:ui-dialog').dialog('destroy');\n\t\t\t\t\$(document).ready(function ()\n\t\t\t\t{\n\t\t\t\t\t\$('#jsn_is_showlist_tabs').tabs({\n\t\t\t\t\t\tactivate: function(event, ui)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(ui.newPanel.attr('id') == 'tab-showlist-images' && !initImageGrid)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tJSNISImageGrid = \$.JSNISImageGridGetInstaces({\n\t\t\t\t\t\t\t\t\tshowListID : '" . $items->showlist_id . "',\n\t\t\t\t\t\t\t\t\tsourceName : '" . $items->image_source_name . "',\n\t\t\t\t\t\t\t\t\tsourceType : '" . $items->image_source_type . "',\n\t\t\t\t\t\t\t\t\tselectMode : '" . $imageSource->getShowlistMode() . "',\n\t\t\t\t\t\t\t\t\tpagination\t : '" . $imageSource->_source['sourceDefine']->pagination . "',\n\t\t\t\t\t\t\t\t\tlayoutHeight : 500,\n\t\t\t\t\t\t\t\t\tlayoutWidth : '100%'\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t" . $rmcat . "\n\t\t\t\t\t\t\t\t" . $tmpjs . "\n\t\t\t\t\t\t\t\tJSNISImageGrid.initialize();\n\t\t\t\t\t\t\t\tif(!\$('.media-item').length && !\$('.jtree-selected', \$('#images')).length)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tJSNISImageGrid.cookie.set('rate_of_west', 58);\n\t\t\t\t\t\t\t\t\tJSNISImageGrid.UILayout.sizePane('west', '58%');\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\$('#jsn-jtree-categories').children('ul').each(function(){\n\t\t\t\t\t\t\t\t\t\$(this).children('li').each(function(){\n\t\t\t\t\t\t\t\t\t\t\$(this).children('ul').each(function(){\n\t\t\t\t\t\t\t\t\t\t\t\$(this).children('li').each(function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\$(this).find('ul').css('display','none');\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\$('#jsn-jtree-categories').children('ul').each(function(){\n\t\t\t\t\t\t\t\t\tjsnisReshowTree(\$(this));\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tinitImageGrid = true;\n\t\t\t\t\t\t\t\tJSNISImageGrid.overrideSaveEvent();\n\t\t\t\t\t\t\t\tJSNISImageShow.getScriptCheckThumb(" . $items->showlist_id . ");\n\t\t\t\t\t\t\t\t\$(window).trigger('resize');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t})((typeof JoomlaShine != 'undefined' && typeof JoomlaShine.jQuery != 'undefined') ? JoomlaShine.jQuery : jQuery);"; $this->_document->addScriptDeclaration($objJSNJSLanguages->loadLang()); $this->_document->addScriptDeclaration($jscode); $showlistMode = $imageSource->getShowlistMode(); $this->assignRef('selectMode', $showlistMode); } else { $jscode = "var baseUrl = '" . JURI::root() . "'"; $this->_document->addScriptDeclaration($jscode); } if ($items->showlist_id && $items->showlist_id != '') { if ($objJSNImages->checkImageLimition($items->showlist_id)) { $msg = JText::_('SHOWLIST_YOU_HAVE_REACHED_THE_LIMITATION_OF_10_IMAGES_IN_FREE_EDITION'); JError::raiseNotice(100, $msg); } $countImage = $objJSNImages->countImagesShowList($items->showlist_id); $countImage = $countImage[0]; } $authorizationCombo = array('0' => array('value' => '0', 'text' => JText::_('SHOWLIST_NO_MESSAGE')), '1' => array('value' => '1', 'text' => JText::_('SHOWLIST_JOOMLA_ARTICLE'))); $imagesLoadingOrder = array('0' => array('value' => 'forward', 'text' => JText::_('SHOWLIST_GENERAL_FORWARD')), '1' => array('value' => 'backward', 'text' => JText::_('SHOWLIST_GENERAL_BACKWARD')), '2' => array('value' => 'random', 'text' => JText::_('SHOWLIST_GENERAL_RANDOM'))); $showExifData = array('0' => array('value' => 'no', 'text' => JText::_('SHOWLIST_SHOW_EXIF_DATA_NO')), '1' => array('value' => 'title', 'text' => JText::_('SHOWLIST_SHOW_EXIF_DATA_TITLE')), '2' => array('value' => 'description', 'text' => JText::_('SHOWLIST_SHOW_EXIF_DATA_DESCRIPTION'))); $lists['imagesLoadingOrder'] = JHTML::_('select.genericList', $imagesLoadingOrder, 'image_loading_order', 'class="inputbox" ' . '', 'value', 'text', $items->image_loading_order); $lists['showExifData'] = JHTML::_('select.genericList', $showExifData, 'show_exif_data', 'class="inputbox" ' . '', 'value', 'text', $items->show_exif_data); $lists['authorizationCombo'] = JHTML::_('select.genericList', $authorizationCombo, 'authorization_status', 'class="inputbox" onchange="JSNISImageShow.ShowListCheckAuthorizationContent();"' . '', 'value', 'text', $items->authorization_status); $lists['published'] = JHTML::_('jsnselect.booleanlist', 'published', '', $items->published != '' ? $items->published : 1); $lists['overrideTitle'] = JHTML::_('jsnselect.booleanlist', 'override_title', '', $items->override_title); $lists['overrideDesc'] = JHTML::_('jsnselect.booleanlist', 'override_description', '', $items->override_description); $lists['overrideLink'] = JHTML::_('jsnselect.booleanlist', 'override_link', '', $items->override_link); $query = 'SELECT ordering AS value, showlist_title AS text' . ' FROM #__imageshow_showlist' . ' ORDER BY ordering'; $lists['ordering'] = JHtmlList::ordering('ordering', $query, '', $items->showlist_id); if (!$objJSNUtils->checkEnvironmentDownload()) { $canAutoDownload = false; } $image_model = $this->getModel(); $categories = $model->getTreeMenu(); $articlesCatgories = $model->getTreeArticle(); $this->assign('categories', $categories); $this->assign('articles_catgories', $articlesCatgories); $this->assignRef('canAutoDownload', $canAutoDownload); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('imageSource', $imageSource); $this->assignRef('countImage', $countImage); $this->assignRef('images', $images); $this->assignRef('catSelected', $catid); $this->assignRef('albumID', $albumID); $this->assignRef('totalImage', $totalimage); $this->assignRef('msgs', $msgs); $this->_addAssets(); $this->addToolbar(); if (!$this->_checkAction()) { JFactory::getApplication()->redirect('index.php?option=com_imageshow&controller=showlist', JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error'); return false; } parent::display($tpl); }
function uninstallImageSource($sourceInfo) { if (!isset($sourceInfo->pluginInfo)) { return false; } $pluginTable = JTable::getInstance('extension', 'JTable'); if ($pluginTable->load((int) $sourceInfo->pluginInfo->extension_id)) { $tableName = str_replace('source', '', $pluginTable->element); $query = 'SELECT * FROM #__imageshow_showlist WHERE image_source_name = ' . $this->_db->quote($sourceInfo->identified_name) . ' AND image_source_type = ' . $this->_db->quote($sourceInfo->type); $this->_db->setQuery($query); $showlists = $this->_db->loadObjectList(); foreach ($showlists as $showlist) { $imageSource = JSNISFactory::getSource($showlist->image_source_name, $showlist->image_source_type, $showlist->showlist_id); // remove all images $imageSource->removeAllImages(array('showlist_id' => $showlist->showlist_id)); // remove profile if have profile if (isset($imageSource->_source['profileTable'])) { $imageSource->_source['profileTable']->delete(); } // update showlist $imageSource->_showlistTable->image_source_type = ''; $imageSource->_showlistTable->image_source_name = ''; $imageSource->_showlistTable->image_source_profile_id = 0; $imageSource->_showlistTable->store(); } } return true; }
public function getShowlist2JSON($URL, $showlistID) { $objJSNShowlist = JSNISFactory::getObj('classes.jsn_is_showlist'); $objUtils = JSNISFactory::getObj('classes.jsn_is_utils'); $showlistTable = JTable::getInstance('showlist', 'Table'); $images = array(); if ($showlistTable->load($showlistID) && $showlistTable->image_source_name) { $imageSource = JSNISFactory::getSource($showlistTable->image_source_name, $showlistTable->image_source_type, $showlistID); $images = $imageSource->getImages2JSON(array('URL' => $URL, 'showlist_id' => $showlistID, 'limitEdition' => true)); } $showlistInfo = $objJSNShowlist->getShowListByID($showlistID); $dataObj = new stdClass(); //showlist $showlistObj = new stdClass(); $showlistObj->{'title'} = $showlistInfo['showlist_title']; $showlistObj->{'description'} = $showlistInfo['description']; $showlistObj->{'link'} = $showlistInfo['showlist_link']; $overrideTitle = $showlistInfo['override_title']; $overrideDesc = $showlistInfo['override_description']; $overrideLink = $showlistInfo['override_link']; $showExifData = $showlistInfo['show_exif_data']; //images object $imagesObj = new stdClass(); $arrayImage = array(); foreach ($images as $image) { if ($overrideTitle == 1) { $image->title = $showlistInfo['showlist_title']; } if ($overrideDesc == 1) { $image->description = $showlistInfo['description']; } if ($overrideLink == 1) { $image->link = $showlistInfo['showlist_link']; } if (!$objUtils->isDomain($image->link)) { $image->link = $URL . $image->link; } $tmpExifData = ''; if (@$image->exif_data != '') { $tmpExifData = '(' . @$image->exif_data . ')'; } if ($showExifData == 'title') { $image->title = $image->title . ' ' . $tmpExifData; } elseif ($showExifData == 'description') { if ($image->description != '') { $image->description = $image->description . "\n" . $tmpExifData; } else { $image->description = $image->description . $tmpExifData; } } else { } $arrayImage[] = $image; } $imagesObj->{'image'} = $arrayImage; // end images object $showlistObj->{'images'} = $imagesObj; $dataObj->{'showlist'} = $showlistObj; // end show list return $dataObj; }
/** * Validate profile * * @return void */ public function validateProfile() { $get = JRequest::get('get'); $data['success'] = true; $imageSource = JSNISFactory::getSource($get['source'], 'external'); $data['success'] = $imageSource->getValidation($get); $data['msg'] = $data['success'] == false ? $imageSource->getErrorMsg() : ''; echo json_encode($data); exit; }
/** * Function init show all images selected of the first album is selected */ function init() { // load all album is selected with current showlist -> and then get the firt album to get all images of that album. $showListID = JRequest::getVar('showListID', ''); $sourceType = JRequest::getVar('sourceType', ''); $sourceName = JRequest::getVar('sourceName', ''); $selectMode = JRequest::getVar('selectMode', ''); $imageSource = JSNISFactory::getSource($sourceName, $sourceType, $showListID); $model = $this->getModel('images'); $cat = $model->getAllCatShowlist($showListID); if (!empty($cat)) { $catid = $cat[0]; $config = array('album' => $catid); $images = $imageSource->loadImages($config); } else { $images->images = array(); } include JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_imageshow' . DS . 'views' . DS . 'showlist' . DS . 'tmpl' . DS . 'init.php'; jexit(); }
public function delete($cid = array()) { $result = false; if (count($cid)) { JArrayHelper::toInteger($cid); $showlistTable = JTable::getInstance('showlist', 'Table'); foreach ($cid as $showlistID) { $showlistTable->load($showlistID); $imageSource = JSNISFactory::getSource($showlistTable->image_source_name, $showlistTable->image_source_type, $showlistID); $imageSource->removeShowlist(); } } return true; }
function getScriptCheckThumb() { $showlistID = JRequest::getInt('showlist_id'); $script = ''; $showlistTable = JTable::getInstance('showlist', 'Table'); $showlistTable->load($showlistID); if ($showlistTable->image_source_name != '') { $imageSource = JSNISFactory::getSource($showlistTable->image_source_name, $showlistTable->image_source_type, $showlistID); $script .= $imageSource->renderScriptcheckThumb(); } else { $script .= ' JSNISImageShow.checkThumbCallBack(); '; } return $script; }
/** * * Check sync */ public function checksyncalbum() { $syncCate = JRequest::getVar('syncCate', ''); //$syncCate = str_replace("cat_","",$syncCate); $showListID = JRequest::getVar('showListID', ''); $sourceType = JRequest::getVar('sourceType', ''); $sourceName = JRequest::getVar('sourceName', ''); $imageSource = JSNISFactory::getSource($sourceName, $sourceType, $showListID); if ($imageSource->getShowlistMode() == 'sync' && $imageSource->checkSync($syncCate)) { $status = 'is_selected'; } else { $status = 'none'; } jexit($status); }