primo commit
This commit is contained in:
		| @ -0,0 +1 @@ | ||||
| <html><body bgcolor="#FFFFFF"></body></html> | ||||
| @ -0,0 +1,198 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| JToolBarHelper::title(JText::_('COM_TABULIZER_DATA_SOURCES')); | ||||
|  | ||||
| $return_url = $this->return_urls['archives']; | ||||
| $data_sources_return_url = '&data_sources_return_url='.urlencode($this->return_urls['data_sources']); | ||||
|  | ||||
| if (empty($this->data_sources)) { | ||||
| 	JToolBarHelper::back(JText::_('COM_TABULIZER_BACK_TO_ARCHIVES'), $return_url); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-edit')) JToolBarHelper::addNew('newDataSource', JText::_('COM_TABULIZER_NEW_DATA_SOURCE')); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-import')) JToolBarHelper::custom( 'importDataSource', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_IMPORT_DATASOURCE'), false, false ); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-import')) JToolBarHelper::custom( 'manageDataFiles', 'data_files', 'data_files', JText::_('COM_TABULIZER_MANAGE_DATA_FILES'), false, false ); | ||||
| 	JToolBarHelper::help( 'all_topics', true ); | ||||
| } else {	 | ||||
| 	JToolBarHelper::back(JText::_('COM_TABULIZER_BACK_TO_ARCHIVES'), $return_url); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-edit')) JToolBarHelper::addNew('newDataSource', JText::_('COM_TABULIZER_NEW_DATA_SOURCE')); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-import')) JToolBarHelper::custom( 'importDataSource', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_IMPORT_DATASOURCE'), false, false ); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-export'))  JToolBarHelper::custom( 'exportDataSource', 'export_archive', 'export_archive', JText::_('COM_TABULIZER_EXPORT_DATASOURCE'), true ); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-edit')) JToolBarHelper::custom('clearDataSourceCache', 'clear', 'clear_cache', JText::_('COM_TABULIZER_CLEAR_DATA_SOURCE_CACHE'), true); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-source-edit')) JToolBarHelper::deleteList(JText::_('COM_TABULIZER_DELETE_DATA_SOURCE_CONFIRM'), 'deleteDataSource', JText::_('COM_TABULIZER_DELETE_DATA_SOURCE')); | ||||
|     if (TabulizerPermissions::userIsAllowed('data-import')) JToolBarHelper::custom( 'manageDataFiles', 'data_files', 'data_files', JText::_('COM_TABULIZER_MANAGE_DATA_FILES'), false, false ); | ||||
| 	JToolBarHelper::help( 'all_topics', true ); | ||||
| } | ||||
|  | ||||
| if (empty($this->data_sources)) {	 | ||||
| 	$msg = sprintf(JText::_('COM_TABULIZER_NO_DATA_SOURCES_WERE_FOUND'), JText::_('COM_TABULIZER_NEW_DATA_SOURCE')); | ||||
| 	TabulizerUserMessage::printInfo($msg);	 | ||||
| ?> | ||||
| <form action="index.php" method="post" name="adminForm" id="adminForm"> | ||||
| <input type="hidden" name="option" value="<?php echo $option; ?>" /> | ||||
| <input type="hidden" name="task" value="viewDataSources" /> | ||||
| <input type="hidden" name="boxchecked" value="0"/> | ||||
| <?php echo JHTML::_( 'form.token' ); ?> | ||||
| </form> | ||||
| <?php		 | ||||
| } | ||||
| else { | ||||
| 	$rows = &$this->data_sources; | ||||
|     if (CLIENT_SIDE_PAGINATION) { | ||||
| ?> | ||||
|  | ||||
| <link rel="stylesheet" href="<?php echo TabulizerPath::getURLPath('jquery.dataTables.css','datatables_css');?>" type="text/css" /> | ||||
| <link rel="stylesheet" href="<?php echo TabulizerPath::getURLPath('smoothness.css','datatables_css');?>" type="text/css" /> | ||||
|  | ||||
| <script src="<?php echo TabulizerPath::getURLPath('jtquery.min.js','asset_js'); ?>" type="text/javascript"></script> | ||||
| <script src="<?php echo TabulizerPath::getURLPath('jtquery.dataTables.min.js','datatables_js'); ?>" type="text/javascript"></script> | ||||
|  | ||||
| <script type="text/javascript"> | ||||
|     window.addEvent('domready', function() { | ||||
|         $$('.hasTip').each(function(el) { | ||||
|             var title = el.get('title'); | ||||
|             if (title) { | ||||
|                 var parts = title.split('::', 2); | ||||
|                 el.store('tip:title', parts[0]); | ||||
|                 el.store('tip:text', parts[1]); | ||||
|             } | ||||
|         }); | ||||
|         var JTooltips = new Tips($$('.hasTip'), { maxTitleChars: 50, fixed: false}); | ||||
|     }); | ||||
|  | ||||
|     if (typeof(tabulizer_datatables) == "undefined") tabulizer_datatables = []; | ||||
|     jtQuery.noConflict(); | ||||
|     jtQuery(document).ready(function() { | ||||
|         var tabulizer_datatable_id = tabulizer_datatables.length; | ||||
|         tabulizer_datatables[tabulizer_datatable_id] = jtQuery("#tab_admin_list").dataTable({"bPaginate": true, | ||||
|             "bLengthChange": true, | ||||
|             "bFilter": true, | ||||
|             "bSort": true, | ||||
|             "bInfo": false, | ||||
|             "bAutoWidth": false, | ||||
|             "bJQueryUI": true, | ||||
|             "oLanguage": <?php echo LanguageLiterals::dataTableLabels(); ?>, | ||||
|             "aaSorting": [[ 1, "asc" ]], | ||||
|             "aoColumnDefs": [ { "bSortable" : false, "aTargets" : [0,4,5 ] } ], | ||||
|             "sPaginationType": "full_numbers", | ||||
|             "iDisplayLength": 20}); | ||||
|     } ); | ||||
|  | ||||
| </script> | ||||
|  | ||||
| <?php | ||||
|     } // client side pagination | ||||
| ?> | ||||
|  | ||||
| <form action="index.php" method="post" name="adminForm" id="adminForm"> | ||||
|     <table id="tab_admin_list" class="adminlist tabtable-tabulizer_backend_admin"> | ||||
|         <thead> | ||||
|         <tr class="tabrow tr_header1"> | ||||
|             <th class="tabcol" width="20"><input type="checkbox" name="toggle" value="" onclick="Joomla.checkAll(this)" /></th> | ||||
|             <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_TITLE');?></th> | ||||
|             <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_TAG');?></th> | ||||
|             <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_TYPE');?></th> | ||||
|             <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_PARAMS');?></th> | ||||
|             <th class="tabcol"><?php echo JText::_('COM_TABULIZER_ACTIONS');?></th> | ||||
|         </tr> | ||||
|         </thead> | ||||
|         <?php | ||||
|  | ||||
|         $separator_options = $options = TabulizerUtils::getSeparatorListLabels(); | ||||
|         $enclosure_options = array(ENCLOSURE_NONE=>JText::_('COM_TABULIZER_NO_ENCLOSURE'), | ||||
|             ENCLOSURE_DOUBLE_QUOTES=>JText::_('COM_TABULIZER_DOUBLE_QUOTES_ENCLOSURE'), | ||||
|             ENCLOSURE_SINGLE_QUOTES=>JText::_('COM_TABULIZER_SINGLE_QUOTES_ENCLOSURE')); | ||||
|         $boost_options = array(BOOST_NONE=>JText::_('COM_TABULIZER_BOOST_NONE'), | ||||
|             BOOST_NO_EXT=>JText::_('COM_TABULIZER_BOOST_NOEXT'), | ||||
|             BOOST_XLSX_PARSER=>JText::_('COM_TABULIZER_XLSX_PARSER')); | ||||
|         $cellcache_options = array(CELLCACHE_NONE=>JText::_('COM_TABULIZER_CELLCACHE_NONE'), | ||||
|             CELLCACHE_SQLITE3=>JText::_('COM_TABULIZER_CELLCACHE_SQLITE3')); | ||||
|  | ||||
|         jimport('joomla.filter.output'); | ||||
|         $k=0; | ||||
|         $i=0; | ||||
|         foreach ($rows as $archive_name => $row) { | ||||
|             $tag = $row->tag; | ||||
|             $title = htmlspecialchars($row->title,ENT_QUOTES,'UTF-8'); | ||||
|             $source_type = TabulizerDataSource::getSourceTypeLabel($row->source_type); | ||||
|             $source_params = array(); | ||||
|             if (TabulizerDataSource::decodeParams($row->source_type, $row->source_params, $source_params, $error_msg)) { | ||||
|                 $source_params_html = '<ul>'; | ||||
|                 foreach ($source_params as $key => $value) { | ||||
|                     if (empty($key) || empty($value)) continue; | ||||
|                     if ($key == 'meta') continue; | ||||
|                     if ($key == 'separator') if (isset($separator_options[$value])) $value = $separator_options[$value]; | ||||
|                     if ($key == 'enclosure') if (isset($enclosure_options[$value])) $value = $enclosure_options[$value]; | ||||
|                     if ($key == 'boost') if (isset($boost_options[$value])) $value = $boost_options[$value]; | ||||
|                     if ($key == 'cellcache') if (isset($cellcache_options[$value])) $value = $cellcache_options[$value]; | ||||
|                     $source_params_html .= '<li><strong>'.TabulizerDataSource::getSourceParamsLabel($key).'</strong>: '. $value. '</li>'; | ||||
|                 } | ||||
|                 $source_params_html .= '</ul>'; | ||||
|             } else { | ||||
|                 $source_params_html = TabulizerUserMessage::printError($error_msg, true); | ||||
|             } | ||||
|  | ||||
|             $return_url = $data_sources_return_url; | ||||
|  | ||||
|             $id = $row->id; | ||||
|             $k=1-$k; | ||||
|             $checked = JHTML::_('grid.id', $i, $id); | ||||
|             $preview_link = JFilterOutput::ampReplace ('index.php?option='.$option.'&task=previewDataSource&ds_id='.$id.'&cid[]='.$id.$return_url); | ||||
|             $edit_link = JFilterOutput::ampReplace ('index.php?option='.$option.'&task=editDataSource&ds_id='.$id.'&cid[]='.$id.$return_url); | ||||
|             $delete_link = JFilterOutput::ampReplace ('index.php?option='.$option.'&task=deleteDataSource&ds_id='.$id.'&cid[]='.$id.'&'. JSession::getFormToken() .'=1'.$return_url); | ||||
|             if (TabulizerPermissions::isAllowed('data-source-edit')) { | ||||
|                 $publishing_preferences_link = JFilterOutput::ampReplace ('index.php?option='.$option.'&task=editDataSourcePublishingPreferences&ds_id='.$id.$return_url); | ||||
|                 $action_links = '<a href="'.$preview_link.'">'.JText::_('COM_TABULIZER_PREVIEW').'</a> | <a href="'.$edit_link.'">'.JText::_('COM_TABULIZER_EDIT').'</a> | <a href="'.$delete_link.'" onclick="javascript:return confirm(\''.JText::_('COM_TABULIZER_DELETE_DATA_SOURCE_CONFIRM').'\')">'.JText::_('COM_TABULIZER_DELETE').'</a><br/><a href="'.$publishing_preferences_link.'">'.JText::_('COM_TABULIZER_PUBLISHING_PREFERENCES').'</a>'; | ||||
|             } else { | ||||
|                 $action_links = '<a href="'.$preview_link.'">'.JText::_('COM_TABULIZER_PREVIEW').'</a> | <a href="'.$edit_link.'">'.JText::_('COM_TABULIZER_EDIT').'</a> | <a href="'.$delete_link.'" onclick="javascript:return confirm(\''.JText::_('COM_TABULIZER_DELETE_DATA_SOURCE_CONFIRM').'\')">'.JText::_('COM_TABULIZER_DELETE').'</a>'; | ||||
|             } | ||||
|  | ||||
|             echo '<tr class="tabrow"><td class="tabcol tabcheck">'.$checked.'</td><td class="tabcol tabtitle">'.$title.'</td><td class="tabcol tabtag">'.$tag.'</td><td class="tabcol tabsource">'.$source_type.'</td><td class="tabcol tabparams">'.$source_params_html.'</td><td class="tabcol tabaction" nowrap>'.$action_links.'</td></tr>' ."\n"; | ||||
|             $i++; | ||||
|         } | ||||
|         ?> | ||||
|  | ||||
|         <?php | ||||
|         // add pagination, if needed | ||||
|         $pagination = $this->pagination; | ||||
|         if ($pagination) { | ||||
|             ?> | ||||
|             <tfoot> | ||||
|             <tr> | ||||
|                 <td colspan="7"><?php echo $pagination->getListFooter(); ?></td> | ||||
|             </tr> | ||||
|             </tfoot> | ||||
|         <?php | ||||
|         } | ||||
|         ?> | ||||
|  | ||||
|     </table> | ||||
|  | ||||
|     <input type="hidden" name="option" value="<?php echo $option; ?>" /> | ||||
|     <input type="hidden" name="task" value="viewDataSources" /> | ||||
|     <input type="hidden" name="boxchecked" value="0"/> | ||||
|     <?php echo JHTML::_( 'form.token' ); ?> | ||||
| </form> | ||||
|  | ||||
| <?php | ||||
|  | ||||
| } // if (empty($this->data_sources)) | ||||
|  | ||||
| ?> | ||||
|  | ||||
| @ -0,0 +1,153 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| JToolBarHelper::title(JText::_('COM_TABULIZER_DATA_FILES')); | ||||
|  | ||||
| $data_files_return_url = str_replace('&','&',JRoute::_('index.php?option=com_tabulizer&task=manageDataFiles')); | ||||
| $data_sources_return_url = str_replace('&','&',JRoute::_('index.php?option=com_tabulizer&task=viewDataSources')); | ||||
|  | ||||
| if (empty($this->data_files)) { | ||||
|     JToolBarHelper::back(JText::_('COM_TABULIZER_BACK_TO_DATA_SOURCES'), $data_sources_return_url); | ||||
|     JToolBarHelper::custom( 'importDataFile', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_IMPORT_DATAFILE'), false, false ); | ||||
|     JToolBarHelper::help( 'all_topics', true ); | ||||
| } else { | ||||
|     JToolBarHelper::back(JText::_('COM_TABULIZER_BACK_TO_DATA_SOURCES'), $data_sources_return_url); | ||||
|     JToolBarHelper::custom( 'importDataFile', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_IMPORT_DATAFILE'), false, false ); | ||||
|     JToolBarHelper::custom( 'downloadDataFile', 'export_archive', 'export_archive', JText::_('COM_TABULIZER_DOWNLOAD_DATAFILE'), true, true ); | ||||
|     JToolBarHelper::deleteList(JText::_('COM_TABULIZER_DELETE_DATA_FILE_CONFIRM'), 'deleteDataFile', JText::_('COM_TABULIZER_DELETE_DATA_FILE')); | ||||
|     JToolBarHelper::help( 'all_topics', true ); | ||||
| } | ||||
|  | ||||
| if (empty($this->data_files)) { | ||||
|     $msg = sprintf(JText::_('COM_TABULIZER_NO_DATA_FILES_WERE_FOUND'),JText::_('COM_TABULIZER_IMPORT_DATAFILE')); | ||||
|     TabulizerUserMessage::printInfo($msg); | ||||
|     ?> | ||||
|     <form action="index.php" method="post" name="adminForm" id="adminForm"> | ||||
|         <input type="hidden" name="option" value="<?php echo $option; ?>" /> | ||||
|         <input type="hidden" name="task" value="viewDataFiles" /> | ||||
|         <input type="hidden" name="boxchecked" value="0"/> | ||||
|         <?php echo JHTML::_( 'form.token' ); ?> | ||||
|     </form> | ||||
| <?php | ||||
| } | ||||
| else { | ||||
|     $rows = &$this->data_files; | ||||
|     if (CLIENT_SIDE_PAGINATION) { | ||||
|         ?> | ||||
|  | ||||
|         <link rel="stylesheet" href="<?php echo TabulizerPath::getURLPath('jquery.dataTables.css','datatables_css');?>" type="text/css" /> | ||||
|         <link rel="stylesheet" href="<?php echo TabulizerPath::getURLPath('smoothness.css','datatables_css');?>" type="text/css" /> | ||||
|  | ||||
|         <script src="<?php echo TabulizerPath::getURLPath('jtquery.min.js','asset_js'); ?>" type="text/javascript"></script> | ||||
|         <script src="<?php echo TabulizerPath::getURLPath('jtquery.dataTables.min.js','datatables_js'); ?>" type="text/javascript"></script> | ||||
|  | ||||
|         <script type="text/javascript"> | ||||
|             window.addEvent('domready', function() { | ||||
|                 $$('.hasTip').each(function(el) { | ||||
|                     var title = el.get('title'); | ||||
|                     if (title) { | ||||
|                         var parts = title.split('::', 2); | ||||
|                         el.store('tip:title', parts[0]); | ||||
|                         el.store('tip:text', parts[1]); | ||||
|                     } | ||||
|                 }); | ||||
|                 var JTooltips = new Tips($$('.hasTip'), { maxTitleChars: 50, fixed: false}); | ||||
|             }); | ||||
|  | ||||
|             if (typeof(tabulizer_datatables) == "undefined") tabulizer_datatables = []; | ||||
|             jtQuery.noConflict(); | ||||
|             jtQuery(document).ready(function() { | ||||
|                 var tabulizer_datatable_id = tabulizer_datatables.length; | ||||
|                 tabulizer_datatables[tabulizer_datatable_id] = jtQuery("#tab_admin_list").dataTable({"bPaginate": true, | ||||
|                     "bLengthChange": true, | ||||
|                     "bFilter": true, | ||||
|                     "bSort": true, | ||||
|                     "bInfo": false, | ||||
|                     "bAutoWidth": false, | ||||
|                     "bJQueryUI": true, | ||||
|                     "oLanguage": <?php echo LanguageLiterals::dataTableLabels(); ?>, | ||||
|                     "aaSorting": [[ 1, "asc" ]], | ||||
|                     "aoColumnDefs": [ { "bSortable" : false, "aTargets" : [0,4 ] } ], | ||||
|                     "sPaginationType": "full_numbers", | ||||
|                     "iDisplayLength": 20}); | ||||
|             } ); | ||||
|  | ||||
|         </script> | ||||
|  | ||||
|     <?php | ||||
|     } // client side pagination | ||||
|     ?> | ||||
|  | ||||
|     <form action="index.php" method="post" name="adminForm" id="adminForm"> | ||||
|         <table id="tab_admin_list" class="adminlist tabtable-tabulizer_backend_admin"> | ||||
|             <thead> | ||||
|             <tr class="tabrow tr_header1"> | ||||
|                 <th class="tabcol" width="20"><input type="checkbox" name="toggle" value="" onclick="Joomla.checkAll(this)" /></th> | ||||
|                 <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_FILE_NAME');?></th> | ||||
|                 <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_FILE_MODIFIED');?></th> | ||||
|                 <th class="tabcol"><?php echo JText::_('COM_TABULIZER_DATA_FILE_LINKED_DATA_SOURCES');?></th> | ||||
|                 <th class="tabcol"><?php echo JText::_('COM_TABULIZER_ACTIONS');?></th> | ||||
|             </tr> | ||||
|             </thead> | ||||
|             <?php | ||||
|             jimport('joomla.filter.output'); | ||||
|             $k=0; | ||||
|             $i=0; | ||||
|             foreach ($rows as $file_name => $row) { | ||||
|                 $return_url = $data_files_return_url; | ||||
|                 $id = urlencode($file_name); | ||||
|                 $k=1-$k; | ||||
|                 $checked = JHTML::_('grid.id', $i, $id); | ||||
|                 $download_link = JFilterOutput::ampReplace ('index.php?option='.$option.'&task=downloadDataFile&df_name='.$id.'&cid[]='.$id.'&'. JSession::getFormToken() .'=1'); | ||||
|                 $delete_link = JFilterOutput::ampReplace ('index.php?option='.$option.'&task=deleteDataFile&df_name='.$id.'&cid[]='.$id.'&'. JSession::getFormToken() .'=1'); | ||||
|                 $action_links = '<a href="'.$download_link.'">'.JText::_('COM_TABULIZER_DOWNLOAD').'</a> | <a href="'.$delete_link.'" onclick="javascript:return confirm(\''.JText::_('COM_TABULIZER_DELETE_DATA_FILE_CONFIRM').'\')">'.JText::_('COM_TABULIZER_DELETE').'</a>'; | ||||
|  | ||||
|                 echo '<tr class="tabrow"><td class="tabcol tabcheck">'.$checked.'</td><td class="tabcol tabname">'.$file_name.'</td><td class="tabcol tabmodified">'.$row['modified'].'</td><td class="tabcol tabsource">'.$row['linked_data_sources'].'</td><td class="tabcol tabaction" nowrap>'.$action_links.'</td></tr>' ."\n"; | ||||
|                 $i++; | ||||
|             } | ||||
|             ?> | ||||
|  | ||||
|             <?php | ||||
|             // add pagination, if needed | ||||
|             $pagination = $this->pagination; | ||||
|             if ($pagination) { | ||||
|                 ?> | ||||
|                 <tfoot> | ||||
|                 <tr> | ||||
|                     <td colspan="7"><?php echo $pagination->getListFooter(); ?></td> | ||||
|                 </tr> | ||||
|                 </tfoot> | ||||
|             <?php | ||||
|             } | ||||
|             ?> | ||||
|  | ||||
|         </table> | ||||
|  | ||||
|         <input type="hidden" name="option" value="<?php echo $option; ?>" /> | ||||
|         <input type="hidden" name="task" value="viewDataFiles" /> | ||||
|         <input type="hidden" name="boxchecked" value="0"/> | ||||
|         <?php echo JHTML::_( 'form.token' ); ?> | ||||
|     </form> | ||||
|  | ||||
| <?php | ||||
|  | ||||
| } // if (empty($this->data_files)) | ||||
|  | ||||
| ?> | ||||
| @ -0,0 +1,127 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| $return_url = str_replace('&','&',JRoute::_('index.php?option='.$option.'&task=manageDataFiles')); | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| $text = JText::_('COM_TABULIZER_UPLOAD' ); | ||||
| JToolBarHelper::title(   JText::_('COM_TABULIZER_DATA_FILES' ).': <small><small>[ ' . $text.' ]</small></small>','config' ); | ||||
| JToolBarHelper::custom('import', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_UPLOAD'), false, false ); | ||||
| JToolBarHelper::cancel( 'cancel', JText::_('COM_TABULIZER_CLOSE') ); | ||||
| JToolBarHelper::help( 'all_topics', true ); | ||||
|  | ||||
| $lists = array(); | ||||
| $lists['filename'] = '<input name="data_file" id="data_file" type="file" />'; | ||||
| $lists['overwrite'] = '<input type="checkbox" name="overwrite_file" id="overwrite_file" value="1" /> ' . JText::_('COM_TABULIZER_RULESET_ARCHIVE_OVERWRITE_VALUE'); | ||||
|  | ||||
| $allowed_extensions = ALLOWED_FILE_TYPES_FOR_DATA_IMPORTATION; | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <script language="javascript" type="text/javascript"> | ||||
|  | ||||
|     function isValidFilename(filename) { | ||||
|         regex = /[a-zA-Z0-9\._\-]{2,128}\.(<?php echo str_replace(',','|',$allowed_extensions)?>|zip)$/i; | ||||
|         value = filename; | ||||
|         if (!regex.test(value)) { | ||||
|             return false; | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     function validateAndSubmit() { | ||||
|         var form = document.adminForm; | ||||
|         var value, regex, valid = true, error_msg = ""; | ||||
|         if (form.data_file.value == "") { | ||||
|             error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_FILE_UPLOAD_ERROR_NO_FILE');?>"; | ||||
|             valid = false; | ||||
|         } else if (!isValidFilename(form.data_file.value)) { | ||||
|             error_msg = error_msg + "\n* <?php echo sprintf(JText::_('COM_TABULIZER_INVALID_DATA_FILENAME_IMPORT'),$allowed_extensions);?>"; | ||||
|             valid = false; | ||||
|         } | ||||
|  | ||||
|         if (valid) { | ||||
|             form.submit(); | ||||
|         } else { | ||||
|             error_msg = "<?php echo JText::_('COM_TABULIZER_JS_ERRORS_FOUND'); ?>" + error_msg; | ||||
|             alert(error_msg); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     <?php if(version_compare(JVERSION,'1.6.0','ge')) { ?> | ||||
|  | ||||
|     Joomla.submitbutton = function(pressbutton) { | ||||
|         if (pressbutton == 'import') { | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'cancel') { | ||||
|             window.location = "<?php echo $return_url;?>"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     <?php } else { ?> | ||||
|  | ||||
|     function submitbutton(pressbutton) { | ||||
|         if (pressbutton == 'import') { | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'cancel') { | ||||
|             window.location = "<?php echo $return_url;?>"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     <?php } ?> | ||||
|  | ||||
| </script> | ||||
|  | ||||
| <form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data"> | ||||
|     <div class="col edit_frm_div"> | ||||
|         <fieldset class="adminform"> | ||||
|             <legend><?php echo JText::_('COM_TABULIZER_DATA_FILE_IMPORT_DETAILS' ); ?></legend> | ||||
|             <table class="admintable"> | ||||
|                 <tr class="row1"> | ||||
|                     <td class="key"> | ||||
|                         <?php echo JText::_('COM_TABULIZER_DATA_FILENAME' ); ?>: | ||||
|                     </td> | ||||
|                     <td> | ||||
|                         <?php echo $lists['filename']; ?> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr class="row0"> | ||||
|                     <td class="key"> | ||||
|                         <?php echo JText::_('COM_TABULIZER_DATA_FILE_OVERWRITE_LABEL' ); ?>: | ||||
|                     </td> | ||||
|                     <td> | ||||
|                         <?php echo $lists['overwrite']; ?> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|             </table> | ||||
|         </fieldset> | ||||
|     </div> | ||||
|  | ||||
|     <div class="clr"></div> | ||||
|     <input type="hidden" name="option" value="com_tabulizer" /> | ||||
|     <input type="hidden" name="task" value="importDataFile" /> | ||||
|     <input type="hidden" name="import_file" value="1" /> | ||||
|     <?php echo JHTML::_( 'form.token' ); ?> | ||||
| </form> | ||||
|  | ||||
| <?php | ||||
| $data_file_path = TabulizerPath::getDirPath('data'); | ||||
| TabulizerUserMessage::printHelp(sprintf(JText::_('COM_TABULIZER_FORM_DATA_FILE_IMPORT_HELP'),$data_file_path)); | ||||
| ?> | ||||
| @ -0,0 +1,519 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| JHTML::_('behavior.modal'); // for article selection popup | ||||
|  | ||||
| $return_url = $this->return_urls['data_sources']; | ||||
| $archive_to_rulesets = $this->archive_to_rulesets; | ||||
|  | ||||
| $edit = $this->lists['edit']; | ||||
| $text = !$edit ? JText::_('COM_TABULIZER_NEW' ) : JText::_('COM_TABULIZER_EDIT' ); | ||||
| JToolBarHelper::title(   JText::_('COM_TABULIZER_DATA_SOURCE' ).': <small><small>[ ' . $text.' ]</small></small>','config' ); | ||||
| JToolBarHelper::save(); | ||||
| JToolBarHelper::custom( 'saveNew', 'save-new', 'save-new', JText::_('COM_TABULIZER_SAVE_AND_NEW'), false, false ); | ||||
| JToolBarHelper::custom( 'saveCopy', 'save-copy', 'save-copy', JText::_('COM_TABULIZER_SAVE_AS_COPY'), false, false ); | ||||
|  | ||||
| if (!$edit)  { | ||||
| 	JToolBarHelper::cancel(); | ||||
| } else { | ||||
| 	// for existing items the button is renamed `close` | ||||
| 	JToolBarHelper::cancel( 'cancel', JText::_('COM_TABULIZER_CLOSE') ); | ||||
| } | ||||
| JToolBarHelper::help( 'all_topics', true ); | ||||
|  | ||||
| TabulizerUtils::opentipInit(); | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <script language="javascript" type="text/javascript">		 | ||||
|  | ||||
| 	function validateAndSubmit() { | ||||
| 		var form = document.adminForm;	 | ||||
| 		var value, f_value, regex, valid = true, error_msg = ""; | ||||
| 								 | ||||
| 		regex = /^[a-zA-Z0-9\._\-]{2,128}\<?php echo XML_FILE_EXT;?>$/i; | ||||
| 		value = form.ds_ruleset_archive.value; | ||||
| 		if (!regex.test(value)) { | ||||
| 			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_ARCHIVE_FILENAME');?>"; | ||||
| 			valid = false;		 | ||||
| 		} | ||||
| 		 | ||||
| 		regex = /^[a-zA-Z0-9\._\-]{2,128}$/; | ||||
| 		value = form.ds_ruleset_name.value; | ||||
| 		if (!regex.test(value)) { | ||||
| 			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_RULESET_NAME');?>"; | ||||
| 			valid = false;		 | ||||
| 		} | ||||
| 		 | ||||
| 		regex = /^.{2,255}$/; | ||||
| 		value = form.ds_title.value; | ||||
| 		if (!regex.test(value)) { | ||||
| 			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_TITLE');?>"; | ||||
| 			valid = false;		 | ||||
| 		} | ||||
|  | ||||
|         var regex_user_param_text = /({user_param_\d_url:text})|({user_param_\d:text})/gmi; | ||||
|  | ||||
| 		var source_type = form.ds_source_type.value; | ||||
|  | ||||
| 		if ((source_type == 'csv')||(source_type == 'excel')||(source_type == 'html')||(source_type == 'rss')||(source_type == 'json')) { | ||||
| 			if (form.ds_filepath.value == '') { | ||||
| 				error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_FILEPATH_OR_URL');?>"; | ||||
| 				valid = false;		 | ||||
| 			} else if (regex_user_param_text.test(form.ds_filepath.value)) { | ||||
|                 error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_DATA_SOURCE_FILEPATH_USER_PARAM_TEXT_NOT_ALLOWED');?>"; | ||||
|                 valid = false; | ||||
|             } | ||||
| 		}				 | ||||
| 		 | ||||
| 		switch (source_type) { | ||||
| 			case 'csv': 				 | ||||
| 				break; | ||||
| 						 | ||||
| 			case 'excel': 				 | ||||
| 				if (form.ds_filepath.value != '') f_value = form.ds_filepath.value;				 | ||||
| 				else f_value = false;				 | ||||
| 				if (f_value) {					 | ||||
| 					f_value = f_value.replace(/\s/g, "");		 | ||||
| 					f_regex = new RegExp("^(.+)(xls|xlsx|ods)$","i"); | ||||
| 					if (!f_regex.test(f_value)) {  | ||||
| 						error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_SHEET_FILE');?>"; | ||||
| 						valid = false;						 | ||||
| 					} | ||||
|                     $allow_remote_files = true; | ||||
|                     if (!$allow_remote_files) { | ||||
|                         f_url_regex = new RegExp("^(http|https)://", "i"); | ||||
|                         if (f_url_regex.test(f_value)) { | ||||
|                             error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_SHEET_FILE_URL');?>"; | ||||
|                             valid = false; | ||||
|                         } | ||||
|                     } | ||||
| 				}			 | ||||
| 				if (form.ds_sheet_name.value == '') { | ||||
| 					error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_SHEET_NAME');?>"; | ||||
| 					valid = false; | ||||
| 				} | ||||
|                 if (form.ds_sheet_references.value != '') { | ||||
|                     // placeholder for future use | ||||
|                 } | ||||
| 				if (form.ds_sheet_selection.value == '') { | ||||
| 					error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_SHEET_SELECTION');?>"; | ||||
| 					valid = false; | ||||
| 				} else { | ||||
| 					f_value = form.ds_sheet_selection.value; | ||||
| 					f_value = f_value.replace(/\s/g, "");		 | ||||
| 					f_regex = new RegExp("^([a-zA-Z]{1,3})(\\d+):([a-zA-Z]{1,3})(\\d+)$",""); | ||||
| 					f_regex_b = new RegExp("^(\\d+)([a-zA-Z]{1,3}):(\\d+)([a-zA-Z]{1,3})$",""); | ||||
| 					if ((!f_regex.test(f_value))&&(!f_regex_b.test(f_value))&&(f_value.indexOf("{")==-1)) { | ||||
| 						error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_SHEET_SELECTION');?>"; | ||||
| 						valid = false;						 | ||||
| 					}					 | ||||
| 				}												 | ||||
| 				break;					 | ||||
| 						 | ||||
| 			case 'database':  | ||||
| 				if (form.ds_query.value == '') { | ||||
| 					error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_QUERY');?>"; | ||||
| 					valid = false; | ||||
| 				} else if (regex_user_param_text.test(form.ds_query.value)) { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_DATA_SOURCE_QUERY_USER_PARAM_TEXT_NOT_ALLOWED');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
| 				break; | ||||
|  | ||||
|             case 'external_database': | ||||
|                 if (form.ds_edb_driver.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_EDB_DRIVER');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 if (form.ds_edb_host.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_EDB_HOST');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 if (form.ds_edb_user.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_EDB_USER');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 if (form.ds_edb_password.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_EDB_PASSWORD');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 if (form.ds_edb_database.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_EDB_DATABASE');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 if (form.ds_query.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_QUERY');?>"; | ||||
|                     valid = false; | ||||
|                 } else if (regex_user_param_text.test(form.ds_query.value)) { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_DATA_SOURCE_QUERY_USER_PARAM_TEXT_NOT_ALLOWED');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 break; | ||||
| 						 | ||||
| 			case 'html': 				 | ||||
| 				if (!form.ds_table_order.value) { | ||||
| 					error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_TABLE_ORDER');?>"; | ||||
| 					valid = false; | ||||
| 				} | ||||
| 				if ((form.ds_table_attribute_name.value == '') && (form.table_attribute_value.value != '')) { | ||||
| 					error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_TABLE_ATTRIBUTE');?>"; | ||||
| 					valid = false;		 | ||||
| 				} | ||||
| 				break; | ||||
|  | ||||
|             case 'xml': | ||||
|                 if (!form.ds_td_map.value) { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_TD_MAP');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 break; | ||||
|  | ||||
|             case 'rss': | ||||
|                 if (form.ds_feed_type.selectedIndex < 0) { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_FEED_TYPE');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 break; | ||||
|  | ||||
|             case 'json': | ||||
|                 break; | ||||
| 						 | ||||
| 			case 'article':  | ||||
| 				if (form.ds_article_id.value == '') { | ||||
| 					error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_ARTICLE_ID');?>"; | ||||
| 					valid = false; | ||||
| 				}			 | ||||
| 				break; | ||||
|  | ||||
|             case 'merger': | ||||
|                 if (form.ds_merging_tree.value == '') { | ||||
|                     error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_MERGING_TREE');?>"; | ||||
|                     valid = false; | ||||
|                 } | ||||
|                 break; | ||||
|  | ||||
|             default: | ||||
| 				error_msg = "Unknown source type: " + source_type; | ||||
| 				valid = false; | ||||
| 				break;			 | ||||
| 		} | ||||
| 		 | ||||
| 		regex = /^\d+$/; | ||||
| 		value = form.ds_cache_time.value; | ||||
| 		if (!regex.test(value)) { | ||||
| 			if (form.ds_cache_type.value != <?php echo TABULIZER_DATA_SOURCE_CACHE_OFF;?>) { | ||||
| 				error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_CACHE_TIME');?>"; | ||||
| 				valid = false;		 | ||||
| 			}	 | ||||
| 		} | ||||
| 				 | ||||
| 		if (valid) { | ||||
| 			form.submit(); | ||||
| 		} else { | ||||
| 			error_msg = "<?php echo JText::_('COM_TABULIZER_JS_ERRORS_FOUND'); ?>" + error_msg; | ||||
| 			alert(error_msg); | ||||
| 		}	 | ||||
| 						 | ||||
| 	} | ||||
| 	 | ||||
| 	function updateSourceParams() { | ||||
| 		var form = document.adminForm; | ||||
| 		var show_keys, all_keys = new Array('ruleset_archive','ruleset_name','table_caption','table_summary','server_side','filepath','query','edb_driver','edb_host','edb_user','edb_password','edb_database','edb_prefix','article_id','merging_tree','sheet_name','sheet_references','sheet_selection','read_font','read_color','read_images','read_hyperlinks','boost','cellcache','remove_empty','separator','enclosure','consistency','strip_tags','table_order','table_attribute_name','table_attribute_value','td_map'); | ||||
| 		var source_type = form.ds_source_type.value;						 | ||||
| 		 | ||||
| 		switch (source_type) { | ||||
| 			case 'csv': show_keys = new Array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'filepath',												 | ||||
| 						'separator', | ||||
| 						'enclosure', | ||||
| 						'consistency'); | ||||
| 						break; | ||||
| 						 | ||||
| 			case 'excel': show_keys = new Array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'filepath',												 | ||||
| 						'sheet_name', | ||||
|                         'sheet_selection', | ||||
|                         'sheet_references', | ||||
| 						'read_font',	 | ||||
| 						'read_color',	 | ||||
| 						'read_images',	 | ||||
| 						'read_hyperlinks', | ||||
|                         'boost', | ||||
|                         'cellcache', | ||||
| 						'remove_empty'); | ||||
| 						break; | ||||
| 						 | ||||
| 			case 'database': show_keys = new Array('ruleset_archive', | ||||
| 						'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
| 						'query'); | ||||
| 						break; | ||||
|  | ||||
|             case 'external_database': show_keys = new Array('ruleset_archive', | ||||
|                         'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
|                         'edb_driver', | ||||
|                         'edb_host', | ||||
|                         'edb_user', | ||||
|                         'edb_password', | ||||
|                         'edb_database', | ||||
|                         'edb_prefix', | ||||
|                         'query'); | ||||
|                         break; | ||||
| 						 | ||||
| 			case 'html': show_keys = new Array('ruleset_archive', | ||||
| 						'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
| 						'filepath',												 | ||||
| 						'table_order', | ||||
| 						'table_attribute_name', | ||||
| 						'table_attribute_value'); | ||||
| 						break; | ||||
|  | ||||
|             case 'xml': show_keys = new Array('ruleset_archive', | ||||
|                         'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
|                         'filepath', | ||||
|                         'td_map'); | ||||
|                         break; | ||||
|  | ||||
|             case 'rss': show_keys = new Array('ruleset_archive', | ||||
|                         'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
|                         'filepath', | ||||
|                         'feed_type', | ||||
|                         'encoding'); | ||||
|                         break; | ||||
|  | ||||
|             case 'json': show_keys = new Array('ruleset_archive', | ||||
|                         'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
|                         'filepath', | ||||
|                         'encoding'); | ||||
|                         break; | ||||
| 						 | ||||
| 			case 'article':  show_keys = new Array('ruleset_archive', | ||||
| 						'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
| 						'article_id', | ||||
| 						'separator', | ||||
| 						'enclosure', | ||||
| 						'consistency', | ||||
| 						'strip_tags'); | ||||
| 						break; | ||||
|  | ||||
|             case 'merger':  show_keys = new Array('ruleset_archive', | ||||
|                         'ruleset_name' , | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side' , | ||||
|                         'merging_tree'); | ||||
|                         break; | ||||
|  | ||||
|             default: | ||||
| 						show_keys = new Array(); | ||||
| 						break;			 | ||||
| 		} | ||||
| 		 | ||||
| 		var i, el;		 | ||||
| 		for (i = 0; i < all_keys.length; i++) { | ||||
| 			el = document.getElementById('tr_'+all_keys[i]); | ||||
| 			el.className="hidden_tr"; | ||||
| 		}			 | ||||
| 		for (i = 0; i < show_keys.length; i++) { | ||||
| 			el = document.getElementById('tr_'+show_keys[i]); | ||||
| 			el.className=""; | ||||
| 		}	    | ||||
| 	} | ||||
| 		 | ||||
| 	function TabulizerUpdateRulesetArchive(ruleset_archive_selection) { | ||||
| 		var archive_to_rulesets = new Array(); | ||||
| <?php echo $archive_to_rulesets; ?> | ||||
| 		var archive_filename = ruleset_archive_selection.value; | ||||
| 		var ruleset_select = document.getElementById("ds_ruleset_name"); | ||||
| 		var rulesets, ruleset_count = 0; | ||||
| 				 | ||||
| 		if (archive_filename) { | ||||
| 			rulesets = archive_to_rulesets[archive_filename]; | ||||
| 			if (rulesets) { | ||||
| 				ruleset_count = 0; | ||||
| 				ruleset_select.options.length = 0; | ||||
| 				for(index in rulesets) { | ||||
| 					ruleset_select.options[ruleset_select.options.length] = new Option(rulesets[index], index); | ||||
| 					ruleset_count++; | ||||
| 				} | ||||
| 				if (ruleset_count == 0) {		 | ||||
| 					ruleset_select.options[ruleset_select.options.length] = new Option("<?php echo JText::_('COM_TABULIZER_NONE');?>", 0); | ||||
| 				}				 | ||||
| 			} | ||||
| 			if (typeof jtQuery != 'undefined') { | ||||
| 				jtQuery("#ds_ruleset_name").trigger("liszt:updated"); | ||||
| 			} | ||||
| 		}				 | ||||
| 				 | ||||
| 	}	 | ||||
| 	 | ||||
| 	function updateCacheType() {		 | ||||
| 		var cache_type = document.getElementById('ds_cache_type'); | ||||
| 		var cache_time = document.getElementById('ds_cache_time'); | ||||
| 		 | ||||
| 		if (cache_type.value != <?php echo TABULIZER_DATA_SOURCE_CACHE_OFF;?>) cache_time.disabled = false; else cache_time.disabled = true; | ||||
| 	} | ||||
|  | ||||
|     function TabulizerUpdateSheetReferences(ref_type) { | ||||
|         var custom_references = document.getElementById("ds_sheet_references_custom"); | ||||
|         if (ref_type.value == "none") { | ||||
|             document.getElementById("ds_sheet_references").value = ""; | ||||
|             custom_references.style.display="none"; | ||||
|         } else if (ref_type.value == "all") { | ||||
|             document.getElementById("ds_sheet_references").value = "all"; | ||||
|             custom_references.style.display="none"; | ||||
|         } else { | ||||
|             if (document.getElementById("ds_sheet_references").value == "all") { | ||||
|                 document.getElementById("ds_sheet_references").value = ""; | ||||
|             } | ||||
|             custom_references.style.display="block"; | ||||
|         } | ||||
|     } | ||||
| 	 | ||||
| 	function jSelectArticle(id, title, object) {     | ||||
| 		document.getElementById('ds_article_id').value = id; | ||||
| 		document.getElementById('sbox-window').close(); | ||||
| 	}									 | ||||
| 	 | ||||
| <?php if(version_compare(JVERSION,'1.6.0','ge')) { ?>		 | ||||
| 	 | ||||
| 	Joomla.submitbutton = function(pressbutton) {											 | ||||
| 		if (pressbutton == 'save') { | ||||
| 			validateAndSubmit(); | ||||
| 		} else if (pressbutton == 'saveNew') { | ||||
|             document.getElementById('addnew').value = '1'; | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'saveCopy') { | ||||
|             document.getElementById('addcopy').value = '1'; | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'cancel') { | ||||
| 			window.location = "<?php echo $return_url;?>";			 | ||||
| 		}		 | ||||
| 	} | ||||
| 	 | ||||
| <?php } else { ?> | ||||
| 	 | ||||
| 	function submitbutton(pressbutton) { | ||||
| 		if (pressbutton == 'save') { | ||||
| 			validateAndSubmit(); | ||||
| 		} else if (pressbutton == 'saveNew') { | ||||
|             document.getElementById('addnew').value = '1'; | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'saveCopy') { | ||||
|             document.getElementById('addcopy').value = '1'; | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'cancel') { | ||||
| 			window.location = "<?php echo $return_url;?>";			 | ||||
| 		}											 | ||||
| 	}	 | ||||
| 	 | ||||
| <?php } ?>		 | ||||
| 	 | ||||
| </script> | ||||
|  | ||||
|  | ||||
| <form action="index.php" method="post" name="adminForm" id="adminForm"> | ||||
| <div class="col edit_frm_div"> | ||||
| 	<fieldset class="adminform"> | ||||
| 		<legend><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_DETAILS' ); ?></legend> | ||||
|  | ||||
| 		<table class="admintable"> | ||||
| 		<tr class="row1"> | ||||
| 			<td  class="key"> | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_TAG' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $this->lists['tag']; ?> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr class="row0"> | ||||
| 			<td  class="key"> | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_TITLE' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $this->lists['title']; ?> | ||||
| 			</td> | ||||
| 		</tr>				 | ||||
| 		<tr class="row1"> | ||||
| 			<td  class="key">				 | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_TYPE' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $this->lists['source_type']; ?> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr class="row0"> | ||||
| 			<td  class="key"> | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_PARAMS' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $this->lists['source_params']; ?> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr class="row1"> | ||||
| 			<td  class="key"> | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_CACHE' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $this->lists['cache_params']; ?> | ||||
| 			</td> | ||||
| 		</tr>		 | ||||
| 	    </table> | ||||
| 	</fieldset> | ||||
| </div>      | ||||
|  | ||||
| <div class="clr"></div> | ||||
| 	<input type="hidden" name="option" value="com_tabulizer" />			 | ||||
| 	<input type="hidden" name="task" value="saveDataSource" /> | ||||
|     <input type="hidden" name="addnew" id="addnew" value="0" /> | ||||
|     <input type="hidden" name="addcopy" id="addcopy" value="0" /> | ||||
| 	<?php echo $this->lists['id']; ?> | ||||
| 	<?php echo JHTML::_( 'form.token' ); ?> | ||||
| </form> | ||||
|  | ||||
| @ -0,0 +1,126 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| $return_url = str_replace('&','&',JRoute::_('index.php?option='.$option.'&task=viewDataSources')); | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| $text = JText::_('COM_TABULIZER_IMPORT' ); | ||||
| JToolBarHelper::title(   JText::_('COM_TABULIZER_DATA_SOURCE' ).': <small><small>[ ' . $text.' ]</small></small>','config' ); | ||||
| JToolBarHelper::custom('import', 'import_archive', 'import_archive', JText::_('COM_TABULIZER_IMPORT'), false, false ); | ||||
| JToolBarHelper::cancel( 'cancel', JText::_('COM_TABULIZER_CLOSE') ); | ||||
| JToolBarHelper::help( 'all_topics', true ); | ||||
|  | ||||
| $lists = array();		 | ||||
| $lists['filename'] = '<input name="datasource_filename" id="datasource_filename" type="file" />'; | ||||
| $lists['overwrite'] = '<input type="checkbox" name="overwrite_file" id="overwrite_file" value="1" /> ' . JText::_('COM_TABULIZER_DATA_SOURCE_OVERWRITE_VALUE'); | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <script language="javascript" type="text/javascript">		 | ||||
| 	 | ||||
| 	function isValidFilename(filename) {				 | ||||
| 		regex = /[a-zA-Z0-9\._\-]{2,128}\.xml$/i; | ||||
| 		value = filename; | ||||
| 		if (!regex.test(value)) { | ||||
| 			return false; | ||||
| 		}		 | ||||
| 		return true; | ||||
| 	} | ||||
| 	 | ||||
| 	function validateAndSubmit() { | ||||
| 		var form = document.adminForm;	 | ||||
| 		var value, regex, valid = true, error_msg = ""; | ||||
| 		if (form.datasource_filename.value == "") { | ||||
| 			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_FILE_UPLOAD_ERROR_NO_FILE');?>"; | ||||
| 			valid = false;		 | ||||
| 		} else if (!isValidFilename(form.datasource_filename.value)) { | ||||
| 			error_msg = error_msg + "\n* <?php echo JText::_('COM_TABULIZER_INVALID_DATA_SOURCE_FILENAME_IMPORT');?>"; | ||||
| 			valid = false;		 | ||||
| 		}				 | ||||
| 				 | ||||
| 		if (valid) { | ||||
| 			form.submit(); | ||||
| 		} else { | ||||
| 			error_msg = "<?php echo JText::_('COM_TABULIZER_JS_ERRORS_FOUND'); ?>" + error_msg; | ||||
| 			alert(error_msg); | ||||
| 		}	 | ||||
| 						 | ||||
| 	} | ||||
|  | ||||
| <?php if(version_compare(JVERSION,'1.6.0','ge')) { ?>	 | ||||
|  | ||||
| 	Joomla.submitbutton = function(pressbutton) {											 | ||||
| 		if (pressbutton == 'import') { | ||||
| 			validateAndSubmit(); | ||||
| 		} else if (pressbutton == 'cancel') { | ||||
| 			window.location = "<?php echo $return_url;?>";			 | ||||
| 		}		 | ||||
| 	} | ||||
|  | ||||
| <?php } else { ?> | ||||
| 	 | ||||
| 	function submitbutton(pressbutton) {											 | ||||
| 		if (pressbutton == 'import') { | ||||
| 			validateAndSubmit(); | ||||
| 		} else if (pressbutton == 'cancel') { | ||||
| 			window.location = "<?php echo $return_url;?>";			 | ||||
| 		}		 | ||||
| 	}	 | ||||
| 	 | ||||
| <?php } ?>	 | ||||
| 	 | ||||
| </script> | ||||
|  | ||||
| <form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data"> | ||||
| <div class="col edit_frm_div"> | ||||
| 	<fieldset class="adminform"> | ||||
| 		<legend><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_IMPORT_DETAILS' ); ?></legend> | ||||
| 		<table class="admintable"> | ||||
| 		<tr class="row1"> | ||||
| 			<td class="key">				 | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_FILENAME_XML' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $lists['filename']; ?> | ||||
| 			</td>			 | ||||
| 		</tr> | ||||
| 		<tr class="row0"> | ||||
| 			<td class="key">												 | ||||
| 				<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_OVERWRITE_LABEL' ); ?>: | ||||
| 			</td> | ||||
| 			<td> | ||||
| 				<?php echo $lists['overwrite']; ?> | ||||
| 			</td>			 | ||||
| 		</tr>						 | ||||
| 	    </table> | ||||
| 	</fieldset> | ||||
| </div> | ||||
|  | ||||
| <div class="clr"></div> | ||||
| 	<input type="hidden" name="option" value="com_tabulizer" />		 | ||||
| 	<input type="hidden" name="task" value="importDataSource" /> | ||||
| 	<input type="hidden" name="import_file" value="1" /> | ||||
| 	<?php echo JHTML::_( 'form.token' ); ?> | ||||
| </form> | ||||
|  | ||||
| <?php | ||||
| TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_IMPORT_HELP')); | ||||
| echo "<br/>\n"; | ||||
| TabulizerUserMessage::printWarning(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_IMPORT_WARNING')); | ||||
| ?> | ||||
| @ -0,0 +1 @@ | ||||
| <html><body bgcolor="#FFFFFF"></body></html> | ||||
| @ -0,0 +1,40 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| $title = JText::_('COM_TABULIZER_DATA_SOURCE' ) . ' <em>'.$this->data_source->tag.'</em>'; | ||||
|  | ||||
| $return_url = $this->return_urls['data_sources']; | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| JToolBarHelper::title($title); | ||||
| JToolBarHelper::back(JText::_('COM_TABULIZER_BACK_TO_DATA_SOURCES'), $return_url); | ||||
| JToolBarHelper::help( 'all_topics', true ); | ||||
|  | ||||
| $table_html = TabulizerDataSource::getTableHTML($this->data_source->tag); | ||||
|  | ||||
| TabulizerPath::requireLib('tags_processor','common'); | ||||
| $processor = new TabulizerTagsProcessor(); | ||||
|  | ||||
| $processor->init('system'); | ||||
| $processor->processTags($table_html); | ||||
|  | ||||
| echo "<h3>{$title}</h3>\n<hr>\n"; | ||||
| echo $table_html; | ||||
|  | ||||
| ?> | ||||
| @ -0,0 +1,196 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		6.2.6 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.tabulizer.com | ||||
|  *  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| $jinput = JFactory::getApplication()->input; | ||||
| $option = $jinput->getCmd('option'); | ||||
|  | ||||
| $title = JText::_('COM_TABULIZER_DATA_SOURCE' ) . ' <em>'.$this->data_source->tag.'</em>'; | ||||
| $return_url = $this->return_urls['data_sources']; | ||||
|  | ||||
| JHTML::_('behavior.tooltip'); | ||||
| JToolBarHelper::title($title); | ||||
| JToolBarHelper::save(); | ||||
| JToolBarHelper::cancel( 'cancel', JText::_('COM_TABULIZER_CLOSE') ); | ||||
| JToolBarHelper::help( 'all_topics', true ); | ||||
|  | ||||
| $lists = $this->lists; | ||||
|  | ||||
| if (!empty($this->preferences)) { | ||||
|     $publishing_preferences = $this->preferences; | ||||
|     if ($publishing_preferences->status == PUBLISHING_PREFERENCES_STATUS_PUBLISHED) { | ||||
|         $base_url = JURI::root().'/index.php?option=com_tabulizer&task=outputDataSource&tmpl=component&output=raw'; | ||||
|         $base_url .= '&ds_tag='.$this->data_source->tag; | ||||
|         $base_url .= '&ds_mode='.$publishing_preferences->mode; | ||||
|         $urls = array(); | ||||
|         if (!empty($publishing_preferences->keyphrases)) { | ||||
|             $keyphrases = explode("\n",$publishing_preferences->keyphrases); | ||||
|             foreach ($keyphrases as $keyphrase) { | ||||
|                 $urls[] = $base_url . '&ds_keyphrase='.$keyphrase; | ||||
|             } | ||||
|         } else { | ||||
|             $urls[] = $base_url; | ||||
|         } | ||||
|         $published_urls = '<div style="font-weight: bold;">'.JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHED_URLS').'</div>'; | ||||
|         $published_urls .= '<ul>'; | ||||
|         foreach ($urls as $url) { | ||||
|             $published_urls .= '<li>'.$url.'</li>'; | ||||
|         } | ||||
|         $published_urls .= '</ul>'; | ||||
|     } | ||||
| } else { | ||||
|     $published_urls = ''; | ||||
| } | ||||
|  | ||||
| echo "<h3>{$title}</h3>\n<hr>\n"; | ||||
|  | ||||
| ?> | ||||
|  | ||||
| <script language="javascript" type="text/javascript"> | ||||
|  | ||||
|     function isValidFilename(filename) { | ||||
|         regex = /[a-zA-Z0-9\._\-]{2,128}\.xml$/i; | ||||
|         value = filename; | ||||
|         if (!regex.test(value)) { | ||||
|             return false; | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     function validateAndSubmit() { | ||||
|         var form = document.adminForm; | ||||
|         var value, regex, valid = true, error_msg = ""; | ||||
|  | ||||
|         if (valid) { | ||||
|             form.submit(); | ||||
|         } else { | ||||
|             error_msg = "<?php echo JText::_('COM_TABULIZER_JS_ERRORS_FOUND'); ?>" + error_msg; | ||||
|             alert(error_msg); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     function randomString(length, chars) { | ||||
|         var result = ''; | ||||
|         for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))]; | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     function addNewKeyphrase() { | ||||
|         var keyphrases = document.getElementById('ds_keyphrases'); | ||||
|         var new_keyphrase = randomString(32, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); | ||||
|         keyphrases.options[keyphrases.options.length] = new Option(new_keyphrase, new_keyphrase); | ||||
|     } | ||||
|  | ||||
|     function removeKeyphrase() { | ||||
|         var keyphrases = document.getElementById('ds_keyphrases'); | ||||
|         var keyphrase_id = keyphrases.selectedIndex; | ||||
|         if (keyphrase_id>=0) { | ||||
|             keyphrases.removeChild(keyphrases[keyphrase_id]); | ||||
|         } else { | ||||
|             alert("<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_NO_KEYPHRASE_SELECTED_DELETION_JS');?>"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     function removeAllKeyphrases() { | ||||
|         var keyphrases = document.getElementById('ds_keyphrases'); | ||||
|         var keyphrases_length = keyphrases.options.length; | ||||
|         if (keyphrases_length) { | ||||
|             for(var i=keyphrases_length-1;i>=0;i--) { | ||||
|                 keyphrases.remove(i); | ||||
|             } | ||||
|         } else { | ||||
|             alert("<?php echo JText::_('COM_TABULIZER_DATA_SOURCE_NO_KEYPHRASE_FOR_DELETION_JS');?>"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| <?php if(version_compare(JVERSION,'1.6.0','ge')) { ?> | ||||
|  | ||||
|     Joomla.submitbutton = function(pressbutton) { | ||||
|         if (pressbutton == 'save') { | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'cancel') { | ||||
|             window.location = "<?php echo $return_url;?>"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| <?php } else { ?> | ||||
|  | ||||
|     function submitbutton(pressbutton) { | ||||
|         if (pressbutton == 'import') { | ||||
|             validateAndSubmit(); | ||||
|         } else if (pressbutton == 'cancel') { | ||||
|             window.location = "<?php echo $return_url;?>"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| <?php } ?> | ||||
|  | ||||
| </script> | ||||
|  | ||||
| <form action="index.php" method="post" name="adminForm" id="adminForm"> | ||||
|     <div class="col edit_frm_div"> | ||||
|         <fieldset class="adminform"> | ||||
|             <legend><?php echo JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_PREFERENCES' ); ?></legend> | ||||
|             <table class="admintable"> | ||||
|                 <tr class="row1"> | ||||
|                     <td class="key"> | ||||
|                         <?php echo JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_PREFERENCE_STATUS' ); ?>: | ||||
|                     </td> | ||||
|                     <td> | ||||
|                         <?php echo $lists['status']; ?> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr class="row0"> | ||||
|                     <td class="key"> | ||||
|                         <?php echo JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_PREFERENCE_MODE' ); ?>: | ||||
|                     </td> | ||||
|                     <td> | ||||
|                         <?php echo $lists['mode']; ?> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr class="row1"> | ||||
|                     <td class="key"> | ||||
|                         <?php echo JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_PREFERENCE_KEYPHRASES' ); ?>: | ||||
|                     </td> | ||||
|                     <td> | ||||
|                         <?php echo $lists['keyphrases']; ?> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|             </table> | ||||
|         </fieldset> | ||||
|     </div> | ||||
|  | ||||
|     <div class="clr"></div> | ||||
|     <input type="hidden" name="option" value="com_tabulizer" /> | ||||
|     <input type="hidden" name="task" value="saveDataSourcePublishingPreferences" /> | ||||
|     <input type="hidden" name="ds_tag" value="<?php echo $this->data_source->tag;?>" /> | ||||
|     <?php echo JHTML::_( 'form.token' ); ?> | ||||
| </form> | ||||
|  | ||||
|  | ||||
| <?php | ||||
|  | ||||
| if (empty($published_urls)) { | ||||
|     TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_PUBLISHING_PREFERENCES_HELP')); | ||||
| } else { | ||||
|     echo $published_urls; | ||||
|     if ($publishing_preferences->mode == 'json') { | ||||
|         TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_PUBLISHING_PREFERENCES_JSON_URLS')); | ||||
|     } else { | ||||
|         TabulizerUserMessage::printHelp(JText::_('COM_TABULIZER_FORM_DATA_SOURCE_PUBLISHING_PREFERENCES_HTML_URLS')); | ||||
|     } | ||||
| } | ||||
|  | ||||
| ?> | ||||
| @ -0,0 +1,873 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @version		1.0.0 tabulizer $ | ||||
|  * @package		tabulizer | ||||
|  * @copyright	Copyright © 2011 - All rights reserved. | ||||
|  * @license		GNU/GPL | ||||
|  * @author		Dimitrios Mourloukos | ||||
|  * @author mail	info@alterora.gr | ||||
|  * @website		www.alterora.gr | ||||
|  * | ||||
|  * | ||||
|  * @MVC architecture generated by MVC generator tool at http://www.alphaplug.com | ||||
|  */ | ||||
|  | ||||
| // no direct access | ||||
| defined('_JEXEC') or die('Restricted access'); | ||||
|  | ||||
| jimport( 'joomla.application.component.view' ); | ||||
|  | ||||
| class tabulizerViewDatasources extends JViewLegacy | ||||
| { | ||||
| 	function __construct(){ | ||||
| 		// add tabulizer CSS to override form styling | ||||
| 		$doc=JFactory::getDocument(); | ||||
| 		$cssfile = TabulizerPath::getURLPath('tabulizer.css', 'admin_css');		 | ||||
| 		$doc->addStyleSheet($cssfile); | ||||
| 		 | ||||
| 		TabulizerPath::requireLib('data_source','common'); | ||||
| 		 | ||||
| 		parent::__construct();		 | ||||
| 	} | ||||
|  | ||||
| 	function display($tpl = null){ | ||||
|         $jinput = JFactory::getApplication()->input; | ||||
| 		$option = $jinput->getCmd('option'); | ||||
|         $return_urls = null; | ||||
| 		 | ||||
| 		$model = $this->getModel(); | ||||
| 		$data_sources = $model->getDataSources(); | ||||
|         $pagination = $model->getPagination(); | ||||
| 		$model->getReturnURLs($return_urls);				 | ||||
| 		 | ||||
| 		$this->assignRef('data_sources', $data_sources); | ||||
| 		$this->assignRef('return_urls', $return_urls); | ||||
| 	    $this->assignRef('pagination', $pagination); | ||||
| 				 | ||||
| 		parent::display($tpl); | ||||
| 	}					 | ||||
| 	 | ||||
| 	function displayPreview($tpl = null) { | ||||
|         $jinput = JFactory::getApplication()->input; | ||||
| 		$option = $jinput->getCmd('option'); | ||||
|         $return_urls = null; | ||||
| 		 | ||||
| 		TabulizerPath::requireLib('ruleset','admin'); | ||||
| 		 | ||||
| 		$model = $this->getModel(); | ||||
| 		$model->getReturnURLs($return_urls);	 | ||||
| 		$data_source = $model->getDataSource(); | ||||
| 		 | ||||
| 		TabulizerDataSource::decodeParams($data_source->source_type, $data_source->source_params, $source_params, $errors); | ||||
| 		 | ||||
| 		$ruleset = new Ruleset();		 | ||||
| 		$selected_ruleset = $ruleset->getRuleset($source_params['ruleset_name'], $source_params['ruleset_archive']); | ||||
| 		if (empty($selected_ruleset)) { | ||||
| 			$error_msg = sprintf(JText::_('COM_TABULIZER_DATA_SOURCE_ERROR_RULESET_NOT_FOUND'),$source_params['ruleset_archive'],$source_params['ruleset_name']); | ||||
| 			TabulizerUserMessage::printError($error_msg); | ||||
| 			return; | ||||
| 		} 				 | ||||
| 				 | ||||
| 		$this->assignRef('ruleset', $selected_ruleset); | ||||
| 		$this->assignRef('data_source', $data_source);		 | ||||
| 		$this->assignRef('return_urls', $return_urls);						 | ||||
| 		 | ||||
| 		parent::display($tpl);		 | ||||
| 	} | ||||
|  | ||||
| 	function displayNew($tpl = null) { | ||||
|         $jinput = JFactory::getApplication()->input; | ||||
| 		$option = $jinput->getCmd('option'); | ||||
|         $return_urls = null; | ||||
| 		 | ||||
| 		$model = $this->getModel(); | ||||
| 		$model->getReturnURLs($return_urls);	 | ||||
| 		 | ||||
| 		$default_source_type = 'csv'; | ||||
| 		$default_source_params = "strip_tags=1\nremove_empty=1"; | ||||
| 			 | ||||
| 		$lists = array();	 | ||||
| 												 | ||||
| 		$lists['edit'] = false; | ||||
|  | ||||
|         $lists['id'] = '<input type="hidden" name="ds_id" id="ds_id" value="">'; | ||||
| 		 | ||||
| 		$lists['title'] = TabulizerForm::getTextCtrl('ds_title', null, array('class'=>'ds_param_wide')); | ||||
| 		 | ||||
| 		$random_tag = TabulizerString::generateRandomString(24); | ||||
| 		$lists['tag'] = TabulizerForm::getTextCtrl("ds_tag",$random_tag, array('readonly'=>'readonly')) . ' <span class="tip">'.JText::_('COM_TABULIZER_DATA_SOURCE_TAG_TIP').'</span>'; | ||||
| 						 | ||||
| 		$options = TabulizerDataSource::getSourceTypeLabel(); | ||||
| 		$attributes = array('onchange'=>'updateSourceParams()'); | ||||
| 		$lists['source_type'] = TabulizerForm::getSelectCtrl('ds_source_type',$default_source_type,$options,$attributes);		 | ||||
| 		 | ||||
| 		$default_cache_type = TABULIZER_DATA_SOURCE_DEFAULT_CACHE_TYPE;  | ||||
| 		$options = array(TABULIZER_DATA_SOURCE_CACHE_OFF => JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_OFF'), TABULIZER_DATA_SOURCE_CACHE_ON => JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_ON')); | ||||
| 		$attributes = array('onchange'=>'updateCacheType()'); | ||||
| 		$cache_type = TabulizerForm::getSelectCtrl('ds_cache_type',$default_cache_type,$options,$attributes);		 | ||||
| 	 | ||||
| 		$default_cache_time = TABULIZER_DATA_SOURCE_DEFAULT_CACHE_TIME; // minutes	 | ||||
| 		$attributes = ($default_cache_type==TABULIZER_DATA_SOURCE_CACHE_OFF)?array('disabled'=>'disabled'):array(); | ||||
| 		$cache_time = TabulizerForm::getTextCtrl('ds_cache_time',$default_cache_time,$attributes). ' <span class="tip">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_TIME_TIP').'</span>';								 | ||||
| 		 | ||||
| 		$lists['cache_params'] = '<table><tr><td class="ds_param_label">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_TYPE').': </td><td>'.$cache_type.'</td></tr><tr><td class="ds_param_label">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_TIME').': </td><td>'.$cache_time.'</td></tr></table>'; | ||||
| 		 | ||||
| 		$source_params = array( | ||||
| 						'ruleset_archive' => null, | ||||
| 						'ruleset_name' => null, | ||||
|                         'table_caption' => null, | ||||
|                         'table_summary' => null, | ||||
|                         'server_side' => null, | ||||
| 						'filepath'=> null, | ||||
|                         'encoding'=> null, | ||||
|                         'feed_type'=> null, | ||||
| 						'article_id'=>null,	 | ||||
| 						'query'=> null, | ||||
|                         'edb_driver'=>'mysqli', | ||||
|                         'edb_host'=>'localhost', | ||||
|                         'edb_user'=>null, | ||||
|                         'edb_password'=>null, | ||||
|                         'edb_database'=>null, | ||||
|                         'edb_prefix'=>null, | ||||
| 						'sheet_name'=> null, | ||||
| 						'sheet_selection'=> null, | ||||
|                         'sheet_references'=>null, | ||||
| 						'read_font'=> null,	 | ||||
| 						'read_color'=> null,	 | ||||
| 						'read_images'=> null,	 | ||||
| 						'read_hyperlinks'=> null, | ||||
|                         'boost'=>null, | ||||
|                         'cellcache'=>null, | ||||
| 						'remove_empty'=> null,	 | ||||
| 						'separator'=> null, | ||||
| 						'enclosure'=> null, | ||||
| 						'consistency'=>null, | ||||
| 						'strip_tags'=>null, | ||||
| 						'table_order'=> null, | ||||
| 						'table_attribute_name'=> null, | ||||
| 						'table_attribute_value'=> null, | ||||
|                         'merging_tree'=> null, | ||||
|                         'td_map'=>null); | ||||
| 								 | ||||
| 		TabulizerDataSource::decodeParams($default_source_type, $default_source_params, $source_params, $errors);				 | ||||
| 		 | ||||
| 		TabulizerPath::requireLib('ruleset','admin');				 | ||||
| 		$rs = new Ruleset(); | ||||
| 		$ruleset_archive_options = array(0=>JText::_('COM_TABULIZER_NONE')); | ||||
| 		$ruleset_name_options = array(); | ||||
| 		$archive_to_rulesets = ''; | ||||
|  | ||||
| 		$ruleset_archives = $rs->loadRulesets(null, 0, 0, $total_count); | ||||
| 		if ($total_count) { | ||||
| 			$ruleset_archives = $rs->getRulesets(null, 0, 0, $total_count); | ||||
|             uasort($ruleset_archives, array($this,'sortArrayByTitle')); | ||||
| 			foreach ($ruleset_archives as $ruleset_archive) { | ||||
| 				$ruleset_archive_options[$ruleset_archive['filename']] = $ruleset_archive['title']; | ||||
| 				if (!empty($ruleset_archive['rulesets'])) { | ||||
|                     $rulesets = $ruleset_archive['rulesets']; | ||||
|                     uasort($rulesets, array($this,'sortArrayByTitle')); | ||||
| 					$archive_to_ruleset_entries = array(); | ||||
| 					foreach ($rulesets as $ruleset_name => $ruleset) { | ||||
| 						if ($source_params['ruleset_archive'] == $ruleset_archive['filename']) { | ||||
| 							$ruleset_name_options[$ruleset['name']] = $ruleset['title']; | ||||
| 						} | ||||
| 						$archive_to_ruleset_entries[] = '"'.$ruleset['name'].'": "'.htmlspecialchars($ruleset['title'],ENT_COMPAT,'UTF-8'). '"'; | ||||
| 					}					 | ||||
| 					if (!empty($archive_to_ruleset_entries)) $archive_to_rulesets .= '		archive_to_rulesets["'.$ruleset_archive['filename'].'"] = {'.implode(',',$archive_to_ruleset_entries).'};' . "\n"; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		if (empty($ruleset_name_options)) $ruleset_name_options = array(0=>JText::_('COM_TABULIZER_NONE'));						 | ||||
| 		$this->assignRef('archive_to_rulesets', $archive_to_rulesets);				 | ||||
| 		 | ||||
| 		$labels = TabulizerDataSource::getSourceParamsLabel(); | ||||
|         $tips = TabulizerDataSource::getSourceParamsTip(); | ||||
|  | ||||
| 		$source_params_html = '<table>';				 | ||||
| 		foreach ($source_params as $key => $value) {			 | ||||
| 			switch ($key) { | ||||
| 				case 'ruleset_archive': | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key, $source_params[$key], $ruleset_archive_options, array('onchange'=>'TabulizerUpdateRulesetArchive(this)', 'class'=>'ds_param_wide')); | ||||
| 					break; | ||||
| 				case 'ruleset_name': | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key, $source_params[$key], $ruleset_name_options, array('class'=>'ds_param_wide')); | ||||
| 					break; | ||||
|                 case 'table_caption': | ||||
|                     $attributes = array('maxlength'=>TABLE_CAPTION_MAX_LEN,'class'=>'ds_param_wide'); | ||||
|                     $html_value = TabulizerForm::getInputCtrl('ds_'.$key, $source_params[$key],$attributes); | ||||
|                     $tip = '<br style="clear: both"><div class="tipdiv">'.JText::_('COM_TABULIZER_DATA_SOURCE_PARAM_TABLE_CAPTION_TIP').'</div>'; | ||||
|                     $html_value .= $tip; | ||||
|                     break; | ||||
|                 case 'table_summary': | ||||
|                     $attributes = array('maxlength'=>TABLE_CAPTION_MAX_LEN, 'style'=>'width:98%; height: 80px;'); | ||||
|                     $html_value = TabulizerForm::getTextareaCtrl('ds_'.$key, $source_params[$key],$attributes); | ||||
|                     break; | ||||
|                 case 'server_side': | ||||
|                     $checked = empty($value)?false:true; | ||||
|                     $html_value = TabulizerForm::getCheckboxCtrl('ds_'.$key, '1', $checked, array()); | ||||
|                     break; | ||||
| 				case 'article_id': | ||||
| 					$html_value = $this->getArticleSelectionInput('ds_'.$key, $source_params[$key]); | ||||
| 					break; | ||||
|                 case 'filepath': | ||||
|                     $html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_extra_wide')); // '<input type="text" name="ds_'.$key.'" id="ds_'.$key.'" value="'.$value.'" class="ds_param_wide" />'; | ||||
|                     $site_path = TabulizerPath::getDirPath('site_root'); | ||||
|                     $data_path = TabulizerPath::getDirPath('data'); | ||||
|                     $data_manage = JRoute::_('index.php?option=com_tabulizer&task=manageDataFiles'); | ||||
|                     $tip = '<br style="clear: both"><div class="tipdiv">'.sprintf(JText::_('COM_TABULIZER_DATA_SOURCE_FILEPATH_TIP'),$site_path,$site_path,$site_path,$data_path,$data_manage).'</div>'; | ||||
|                     $html_value .= $tip; | ||||
|                     break; | ||||
|                 case 'encoding': | ||||
|                     $html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value); // '<input type="text" name="ds_'.$key.'" id="ds_'.$key.'" value="'.$value.'" class="ds_param_wide" />'; | ||||
|                     $tip = '<br style="clear: both"><div class="tipdiv">'.JText::_('COM_TABULIZER_DATA_SOURCE_ENCODING_TIP').'</div>'; | ||||
|                     $html_value .= $tip; | ||||
|                     break; | ||||
|                 case 'feed_type': | ||||
|                     $feed_types = array('rss2'=>'RSS 2.0','atom'=>'Atom'); | ||||
|                     $html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$value,$feed_types); | ||||
|                     break; | ||||
| 				case 'query': | ||||
|                     $html_value = TabulizerForm::getTextareaCtrl('ds_'.$key,$value,array('style'=>'width:98%; height:120px;')); // '<input type="text" name="ds_'.$key.'" id="ds_'.$key.'" value="'.$value.'" class="ds_param_wide" />'; | ||||
|                     break; | ||||
|                 case 'edb_driver': | ||||
|                     $html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')); | ||||
|                     $supported_drivers = array('mysql','mysqli'); | ||||
|                     if (class_exists('PDO')) { | ||||
|                         $drivers = PDO::getAvailableDrivers(); | ||||
|                         if (!empty($drivers)) { | ||||
|                             foreach ($drivers as $driver) { | ||||
|                                 $supported_drivers[] = $driver; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     $supported_drivers_str = implode(', ',$supported_drivers); | ||||
|                     $tip = sprintf(JText::_('COM_TABULIZER_DATA_SOURCE_EXTERNAL_DATABASE_SUPPORTED_DRIVERS'),$supported_drivers_str); | ||||
|                     $html_value .= '<br style="clear: both" /><div class="tipdiv">'.$tip.'</div>'; | ||||
|                     break; | ||||
|                 case 'edb_host': | ||||
|                 case 'edb_user': | ||||
|                 case 'edb_password': | ||||
|                 case 'edb_database': | ||||
|                 case 'edb_prefix': | ||||
|                     $html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')); | ||||
|                     break; | ||||
| 				case 'sheet_name': | ||||
| 				case 'sheet_selection':				 | ||||
| 				case 'table_attribute_value': | ||||
|                 case 'merging_tree': | ||||
| 					$html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')); // '<input type="text" name="ds_'.$key.'" id="ds_'.$key.'" value="'.$value.'" class="ds_param_wide" />'; | ||||
| 					break; | ||||
|                 case 'td_map': | ||||
|                     $html_value = TabulizerForm::getTextareaCtrl('ds_'.$key,$value,array('style'=>'width:98%; height:120px;')); | ||||
|                     break; | ||||
|                 case 'sheet_references': | ||||
|                     $sheet_references_custom_style ='none'; | ||||
|                     $attr_none = array('onclick'=>'TabulizerUpdateSheetReferences(this)', 'style'=>'float:none'); | ||||
|                     $attr_all = array('onclick'=>'TabulizerUpdateSheetReferences(this)', 'style'=>'float:none'); | ||||
|                     $attr_custom = array('onclick'=>'TabulizerUpdateSheetReferences(this)', 'style'=>'float:none'); | ||||
|                     if (empty($value)) { | ||||
|                         $attr_none['checked'] = 'checked'; | ||||
|                     } else if ($value == 'all') { | ||||
|                         $attr_all['checked'] = 'checked'; | ||||
|                     } else { | ||||
|                         $attr_custom['checked'] = 'checked'; | ||||
|                         $sheet_references_custom_style ='block'; | ||||
|                     } | ||||
|                     $html_value = TabulizerForm::getInputCtrl('ds_sheet_references_type', 'none', $attr_none, 'radio') . ' ' . JText::_('COM_TABULIZER_SHEET_REFERENCES_NONE') . '   ' . | ||||
|                         TabulizerForm::getInputCtrl('ds_sheet_references_type', 'all', $attr_all, 'radio') . ' ' . JText::_('COM_TABULIZER_SHEET_REFERENCES_ALL') . '   ' . | ||||
|                         TabulizerForm::getInputCtrl('ds_sheet_references_type', 'custom', $attr_custom, 'radio') . ' ' . JText::_('COM_TABULIZER_SHEET_REFERENCES_CUSTOM') . | ||||
|                         '<div id="ds_sheet_references_custom" style="display:'.$sheet_references_custom_style.'">' . | ||||
|                         TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')) . | ||||
|                         '</div>'; | ||||
|                     break; | ||||
| 				case 'table_attribute_name': | ||||
| 					$options = array(0=>JText::_('COM_TABULIZER_NONE'),'id'=>'id','name'=>'name','class'=>'class'); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);	 | ||||
| 					break;	 | ||||
| 				case 'table_order': | ||||
| 					$options = array(); | ||||
| 					for ($j=1;$j<=32;$j++) $options[$j] = $j; | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);				 | ||||
| 					break; | ||||
| 				case 'separator':					 | ||||
| 					$options = TabulizerUtils::getSeparatorListLabels(); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$value,$options);				 | ||||
| 					break; | ||||
| 				case 'enclosure': | ||||
| 					$options = array(ENCLOSURE_NONE=>JText::_('COM_TABULIZER_NO_ENCLOSURE'), | ||||
| 								     ENCLOSURE_DOUBLE_QUOTES=>JText::_('COM_TABULIZER_DOUBLE_QUOTES_ENCLOSURE'), | ||||
|    				 					ENCLOSURE_SINGLE_QUOTES=>JText::_('COM_TABULIZER_SINGLE_QUOTES_ENCLOSURE')); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options); | ||||
| 					break; | ||||
| 				case 'consistency': | ||||
| 					$options = array(1 => JText::_('COM_TABULIZER_COLUMN_CONSISTENCY_STRICT'), | ||||
| 					  				 0 => JText::_('COM_TABULIZER_COLUMN_CONSISTENCY_LOOSE')); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);  | ||||
| 					break; | ||||
|                 case 'boost': | ||||
|                     $options = array(BOOST_NONE => JText::_('COM_TABULIZER_BOOST_NONE'), | ||||
|                         BOOST_NO_EXT => JText::_('COM_TABULIZER_BOOST_NOEXT'), | ||||
|                         BOOST_XLSX_PARSER => JText::_('COM_TABULIZER_XLSX_PARSER') | ||||
|                     ); | ||||
|                     $html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options); | ||||
|                     break; | ||||
|                 case 'cellcache': | ||||
|                     $options = array(CELLCACHE_NONE => JText::_('COM_TABULIZER_CELLCACHE_NONE'), | ||||
|                         CELLCACHE_SQLITE3 => JText::_('COM_TABULIZER_CELLCACHE_SQLITE3') | ||||
|                     ); | ||||
|                     $html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options); | ||||
|                     break; | ||||
| 				case 'read_font': | ||||
| 				case 'read_color': | ||||
| 				case 'read_images': | ||||
| 				case 'read_hyperlinks': | ||||
| 				case 'remove_empty': | ||||
| 				case 'strip_tags': | ||||
| 					$value = empty($value)?false:true; | ||||
| 					$html_value = TabulizerForm::getCheckboxCtrl('ds_'.$key, 1, $value); | ||||
| 					break; | ||||
| 				default: | ||||
| 					$html_value = null;	 | ||||
| 			} | ||||
|  | ||||
|             if (isset($tips[$key])) $tip = TabulizerUtils::opentip($tips[$key], $labels[$key]); else $tip = ''; | ||||
| 			if (isset($html_value)) $source_params_html .= '<tr id="tr_'.$key.'" class="'.$this->getShowHideClass($default_source_type, $key).'"><td class="ds_param_label">'.$labels[$key].$tip.': </td><td>'.$html_value.'</td></tr>'; | ||||
| 		}				 | ||||
| 		$source_params_html .= '</table>';				 | ||||
| 								 | ||||
| 		$lists['source_params'] = $source_params_html;								 | ||||
| 								 | ||||
| 		$this->assignRef('lists', $lists);		 | ||||
| 		$this->assignRef('return_urls', $return_urls);						 | ||||
| 		 | ||||
| 		parent::display($tpl);	 | ||||
| 	} | ||||
|  | ||||
| 	function displayEdit($tpl = null){ | ||||
|         $jinput = JFactory::getApplication()->input; | ||||
|         $jinput = JFactory::getApplication()->input; | ||||
| 		$option = $jinput->getCmd('option'); | ||||
|         $return_urls = null; | ||||
| 		 | ||||
| 		$model = $this->getModel(); | ||||
| 		$model->getReturnURLs($return_urls);	 | ||||
| 		$data_source = $model->getDataSource(); | ||||
| 			 | ||||
| 		$lists = array();	 | ||||
| 												 | ||||
| 		$lists['edit'] = true; | ||||
| 		$lists['id'] = '<input type="hidden" name="ds_id" id="ds_id" value="'.$data_source->id.'">'; | ||||
| 		$lists['title'] = TabulizerForm::getTextCtrl('ds_title', $data_source->title, array('class'=>'ds_param_wide')); | ||||
| 		$lists['tag'] = TabulizerForm::getTextCtrl('ds_tag', $data_source->tag, array('readonly'=>'readonly')) . ' <span class="tip">'.JText::_('COM_TABULIZER_DATA_SOURCE_TAG_TIP').'</span>'; | ||||
| 				 | ||||
| 		$options = array(TABULIZER_DATA_SOURCE_CACHE_OFF => JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_OFF'), TABULIZER_DATA_SOURCE_CACHE_ON => JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_ON')); | ||||
| 		$attributes = array('onchange'=>'updateCacheType()'); | ||||
| 		$cache_type = TabulizerForm::getSelectCtrl('ds_cache_type',$data_source->cache_type,$options,$attributes);		 | ||||
| 		 | ||||
| 		if ($data_source->cache_type!=TABULIZER_DATA_SOURCE_CACHE_OFF) { | ||||
| 			$cache_clear_url = str_replace('&','&',JRoute::_('index.php?option=com_tabulizer&task=clearDataSourceCache&ds_id='.$data_source->id)); | ||||
| 			if (!empty($return_urls['data_sources'])) $cache_clear_url .= '&data_sources_return_url='.urlencode($return_urls['data_sources']); | ||||
| 			$cache_type .= ' <a href="'.$cache_clear_url.'">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_CLEAR').'</a>';  | ||||
| 		} | ||||
| 	 | ||||
| 		$attributes = ($data_source->cache_type==TABULIZER_DATA_SOURCE_CACHE_OFF)?array('disabled'=>'disabled'):array(); | ||||
| 		$cache_time = TabulizerForm::getTextCtrl('ds_cache_time',$data_source->cache_time,$attributes). ' <span class="tip">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_TIME_TIP').'</span>';						 | ||||
| 		 | ||||
| 		$lists['cache_params'] = '<table><tr><td class="ds_param_label">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_TYPE').': </td><td>'.$cache_type.'</td></tr><tr><td class="ds_param_label">'.JText::_('COM_TABULIZER_DATA_SOURCE_CACHE_TIME').': </td><td>'.$cache_time.'</td></tr></table>'; | ||||
| 		 | ||||
| 		$options = TabulizerDataSource::getSourceTypeLabel(); | ||||
| 		$attributes = array('onchange'=>'updateSourceParams()'); | ||||
| 		$lists['source_type'] = TabulizerForm::getSelectCtrl('ds_source_type',$data_source->source_type,$options,$attributes);		 | ||||
| 				 | ||||
| 		$source_params = array( | ||||
| 						'ruleset_archive' => null, | ||||
| 						'ruleset_name' => null, | ||||
|                         'table_caption'=>null, | ||||
|                         'table_summary'=>null, | ||||
|                         'server_side' => null, | ||||
| 						'filepath'=> null, | ||||
|                         'encoding'=> null, | ||||
|                         'feed_type'=>null, | ||||
| 						'article_id'=>null,	 | ||||
| 						'query'=> null, | ||||
|                         'edb_driver'=>null, | ||||
|                         'edb_host'=>null, | ||||
|                         'edb_user'=>null, | ||||
|                         'edb_password'=>null, | ||||
|                         'edb_database'=>null, | ||||
|                         'edb_prefix'=>null, | ||||
| 						'sheet_name'=> null, | ||||
|                         'sheet_references'=>null, | ||||
| 						'sheet_selection'=> null,					 | ||||
| 						'read_font'=> null,	 | ||||
| 						'read_color'=> null,	 | ||||
| 						'read_images'=> null,	 | ||||
| 						'read_hyperlinks'=> null, | ||||
|                         'boost'=> null, | ||||
|                         'cellcache'=> null, | ||||
| 						'remove_empty'=> null,	 | ||||
| 						'separator'=> null, | ||||
| 						'enclosure'=> null, | ||||
| 						'consistency'=>null, | ||||
| 						'strip_tags'=>null, | ||||
| 						'table_order'=> null, | ||||
| 						'table_attribute_name'=> null, | ||||
| 						'table_attribute_value'=> null, | ||||
|                         'merging_tree'=> null, | ||||
|                         'td_map'=>null); | ||||
| 		 | ||||
| 		TabulizerDataSource::decodeParams($data_source->source_type, $data_source->source_params, $source_params, $errors);				 | ||||
| 		 | ||||
| 		TabulizerPath::requireLib('ruleset','admin');				 | ||||
| 		$rs = new Ruleset(); | ||||
| 		$ruleset_archive_options = array(0=>JText::_('COM_TABULIZER_NONE')); | ||||
| 		$ruleset_name_options = array(); | ||||
| 		$archive_to_rulesets = ''; | ||||
|  | ||||
| 		$ruleset_archives = $rs->loadRulesets(null, 0, 0, $total_count); | ||||
| 		if ($total_count) { | ||||
|             $ruleset_archives = $rs->getRulesets(null, 0, 0, $total_count); | ||||
|             uasort($ruleset_archives, array($this,'sortArrayByTitle')); | ||||
| 			foreach ($ruleset_archives as $ruleset_archive) { | ||||
| 				$ruleset_archive_options[$ruleset_archive['filename']] = $ruleset_archive['title']; | ||||
| 				if (!empty($ruleset_archive['rulesets'])) { | ||||
|                     $rulesets = $ruleset_archive['rulesets']; | ||||
|                     uasort($rulesets, array($this,'sortArrayByTitle')); | ||||
| 					$archive_to_ruleset_entries = array(); | ||||
| 					foreach ($rulesets as $ruleset_name => $ruleset) { | ||||
| 						if ($source_params['ruleset_archive'] == $ruleset_archive['filename']) { | ||||
| 							$ruleset_name_options[$ruleset['name']] = $ruleset['title']; | ||||
| 						} | ||||
| 						$archive_to_ruleset_entries[] = '"'.$ruleset['name'].'": "'.htmlspecialchars($ruleset['title'],ENT_COMPAT,'UTF-8'). '"'; | ||||
| 					}					 | ||||
| 					if (!empty($archive_to_ruleset_entries)) $archive_to_rulesets .= '		archive_to_rulesets["'.$ruleset_archive['filename'].'"] = {'.implode(',',$archive_to_ruleset_entries).'};' . "\n"; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		if (empty($ruleset_name_options)) $ruleset_name_options = array(0=>JText::_('COM_TABULIZER_NONE'));						 | ||||
| 		$this->assignRef('archive_to_rulesets', $archive_to_rulesets);				 | ||||
| 		 | ||||
| 		$labels = TabulizerDataSource::getSourceParamsLabel(); | ||||
|         $tips = TabulizerDataSource::getSourceParamsTip(); | ||||
| 		$source_params_html = '<table>';				 | ||||
| 		foreach ($source_params as $key => $value) {			 | ||||
| 			switch ($key) { | ||||
| 				case 'ruleset_archive': | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key, $source_params[$key], $ruleset_archive_options, array('onchange'=>'TabulizerUpdateRulesetArchive(this)', 'class'=>'ds_param_wide')); | ||||
| 					break; | ||||
| 				case 'ruleset_name': | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key, $source_params[$key], $ruleset_name_options, array('class'=>'ds_param_wide')); | ||||
| 					break; | ||||
|                 case 'table_caption': | ||||
|                     $attributes = array('maxlength'=>TABLE_CAPTION_MAX_LEN,'class'=>'ds_param_wide'); | ||||
|                     $html_value = TabulizerForm::getInputCtrl('ds_'.$key, $source_params[$key],$attributes); | ||||
|                     break; | ||||
|                 case 'table_summary': | ||||
|                     $attributes = array('maxlength'=>TABLE_CAPTION_MAX_LEN, 'style'=>'width:98%;height:80px;'); | ||||
|                     $html_value = TabulizerForm::getTextareaCtrl('ds_'.$key, $source_params[$key],$attributes); | ||||
|                     break; | ||||
|                 case 'server_side': | ||||
|                     $checked = empty($value)?false:true; | ||||
|                     $html_value = TabulizerForm::getCheckboxCtrl('ds_'.$key, '1', $checked, array()); | ||||
|                     break; | ||||
| 				case 'article_id': | ||||
| 					$html_value = $this->getArticleSelectionInput('ds_'.$key, $source_params[$key]);									 | ||||
| 					break;			   | ||||
| 				case 'filepath': | ||||
|                 case 'encoding': | ||||
| 				case 'sheet_name': | ||||
| 				case 'sheet_selection':				 | ||||
| 				case 'table_attribute_value': | ||||
|                 case 'merging_tree': | ||||
| 					$html_value = TabulizerForm::getTextCtrl('ds_'.$key, $value, array('class'=>'ds_param_wide')); | ||||
| 					break; | ||||
|                 case 'td_map': | ||||
|                     $html_value = TabulizerForm::getTextareaCtrl('ds_'.$key, $value, array('style'=>'width:98%; height:120px;')); | ||||
|                     break; | ||||
|                 case 'feed_type': | ||||
|                     $feed_types = array('rss2'=>'RSS 2.0','atom'=>'Atom'); | ||||
|                     $html_value = TabulizerForm::getSelectCtrl('ds_'.$key, $value, $feed_types); | ||||
|                     break; | ||||
|                 case 'query': | ||||
|                     $html_value = TabulizerForm::getTextareaCtrl('ds_'.$key, $value, array('style'=>'width:98%; height:120px;')); | ||||
|                     break; | ||||
|                 case 'edb_driver': | ||||
|                     $html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')); | ||||
|                     $supported_drivers = array('mysql','mysqli'); | ||||
|                     if (class_exists('PDO')) { | ||||
|                         $drivers = PDO::getAvailableDrivers(); | ||||
|                         if (!empty($drivers)) { | ||||
|                             foreach ($drivers as $driver) { | ||||
|                                 $supported_drivers[] = $driver; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     $supported_drivers_str = implode(', ',$supported_drivers); | ||||
|                     $tip = sprintf(JText::_('COM_TABULIZER_DATA_SOURCE_EXTERNAL_DATABASE_SUPPORTED_DRIVERS'),$supported_drivers_str); | ||||
|                     $html_value .= '<br style="clear: both" /><div class="tipdiv">'.$tip.'</span>'; | ||||
|                     break; | ||||
|                 case 'edb_host': | ||||
|                 case 'edb_user': | ||||
|                 case 'edb_password': | ||||
|                 case 'edb_database': | ||||
|                 case 'edb_prefix': | ||||
|                     $html_value = TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')); | ||||
|                     break; | ||||
|                 case 'sheet_references': | ||||
|                     $sheet_references_custom_style ='none'; | ||||
|                     $attr_none = array('onclick'=>'TabulizerUpdateSheetReferences(this)', 'style'=>'float:none'); | ||||
|                     $attr_all = array('onclick'=>'TabulizerUpdateSheetReferences(this)', 'style'=>'float:none'); | ||||
|                     $attr_custom = array('onclick'=>'TabulizerUpdateSheetReferences(this)', 'style'=>'float:none'); | ||||
|                     if (empty($value)) { | ||||
|                         $attr_none['checked'] = 'checked'; | ||||
|                     } else if ($value == 'all') { | ||||
|                         $attr_all['checked'] = 'checked'; | ||||
|                     } else { | ||||
|                         $attr_custom['checked'] = 'checked'; | ||||
|                         $sheet_references_custom_style ='block'; | ||||
|                     } | ||||
|                     $html_value = TabulizerForm::getInputCtrl('ds_sheet_references_type', 'none', $attr_none, 'radio') . ' ' . JText::_('COM_TABULIZER_SHEET_REFERENCES_NONE') . '   ' . | ||||
|                         TabulizerForm::getInputCtrl('ds_sheet_references_type', 'all', $attr_all, 'radio') . ' ' . JText::_('COM_TABULIZER_SHEET_REFERENCES_ALL') . '   ' . | ||||
|                         TabulizerForm::getInputCtrl('ds_sheet_references_type', 'custom', $attr_custom, 'radio') . ' ' . JText::_('COM_TABULIZER_SHEET_REFERENCES_CUSTOM') . | ||||
|                         '<div id="ds_sheet_references_custom" style="display:'.$sheet_references_custom_style.'">' . | ||||
|                         TabulizerForm::getTextCtrl('ds_'.$key,$value,array('class'=>'ds_param_wide')) . | ||||
|                         '</div>'; | ||||
|                     break; | ||||
| 				case 'table_attribute_name': | ||||
| 					$options = array(0=>JText::_('COM_TABULIZER_NONE'),'id'=>'id','name'=>'name','class'=>'class'); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);	 | ||||
| 					break;	 | ||||
| 				case 'table_order': | ||||
| 					$options = array(); | ||||
| 					for ($j=1;$j<=32;$j++) $options[$j] = $j; | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);				 | ||||
| 					break; | ||||
| 				case 'separator':					 | ||||
| 					$options = TabulizerUtils::getSeparatorListLabels(); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);				 | ||||
| 					break; | ||||
| 				case 'enclosure': | ||||
| 					$options = array(ENCLOSURE_NONE=>JText::_('COM_TABULIZER_NO_ENCLOSURE'), | ||||
| 								     ENCLOSURE_DOUBLE_QUOTES=>JText::_('COM_TABULIZER_DOUBLE_QUOTES_ENCLOSURE'), | ||||
|    				 					ENCLOSURE_SINGLE_QUOTES=>JText::_('COM_TABULIZER_SINGLE_QUOTES_ENCLOSURE')); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options); | ||||
| 					break; | ||||
| 				case 'consistency': | ||||
| 					$options = array(1 => JText::_('COM_TABULIZER_COLUMN_CONSISTENCY_STRICT'), | ||||
| 					  				 0 => JText::_('COM_TABULIZER_COLUMN_CONSISTENCY_LOOSE')); | ||||
| 					$html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options);  | ||||
| 					break; | ||||
|                 case 'boost': | ||||
|                     $options = array(BOOST_NONE => JText::_('COM_TABULIZER_BOOST_NONE'), | ||||
|                         BOOST_NO_EXT => JText::_('COM_TABULIZER_BOOST_NOEXT'), | ||||
|                         BOOST_XLSX_PARSER => JText::_('COM_TABULIZER_XLSX_PARSER') | ||||
|                     ); | ||||
|                     $html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options); | ||||
|                     break; | ||||
|                 case 'cellcache': | ||||
|                     $options = array(CELLCACHE_NONE => JText::_('COM_TABULIZER_CELLCACHE_NONE'), | ||||
|                         CELLCACHE_SQLITE3 => JText::_('COM_TABULIZER_CELLCACHE_SQLITE3') | ||||
|                     ); | ||||
|                     $html_value = TabulizerForm::getSelectCtrl('ds_'.$key,$source_params[$key],$options); | ||||
|                     break; | ||||
| 				case 'read_font': | ||||
| 				case 'read_color': | ||||
| 				case 'read_images': | ||||
| 				case 'read_hyperlinks': | ||||
| 				case 'remove_empty': | ||||
| 				case 'strip_tags': | ||||
| 					$value = empty($value)?false:true; | ||||
| 					$html_value = TabulizerForm::getCheckboxCtrl('ds_'.$key, 1, $value); | ||||
| 					break;						 | ||||
| 				default: | ||||
| 					$html_value = null;	 | ||||
| 			} | ||||
|  | ||||
|             if (isset($tips[$key])) $tip = TabulizerUtils::opentip($tips[$key], $labels[$key]); else $tip = ''; | ||||
| 			if (isset($html_value)) $source_params_html .= '<tr id="tr_'.$key.'" class="'.$this->getShowHideClass($data_source->source_type, $key).'"><td class="ds_param_label">'.$labels[$key].$tip.': </td><td>'.$html_value.'</td></tr>'; | ||||
| 		}				 | ||||
| 		$source_params_html .= '</table>';				 | ||||
| 								 | ||||
| 		$lists['source_params'] = $source_params_html; | ||||
| 								 | ||||
| 		$this->assignRef('lists', $lists);		 | ||||
| 		$this->assignRef('return_urls', $return_urls);						 | ||||
| 		 | ||||
| 		parent::display($tpl);	 | ||||
| 	} | ||||
|  | ||||
|     function displayImport($tpl = null) { | ||||
|         $model = $this->getModel(); | ||||
|  | ||||
|         parent::display($tpl); | ||||
|     } | ||||
|  | ||||
|     function displayDataFiles($tpl = null){ | ||||
|         $jinput = JFactory::getApplication()->input; | ||||
|         $option = $jinput->getCmd('option'); | ||||
|         $return_urls = null; | ||||
|  | ||||
|         $model = $this->getModel(); | ||||
|         $data_files = $model->getDataFiles(); | ||||
|         $pagination = $model->getPagination(); | ||||
|         $model->getReturnURLs($return_urls); | ||||
|  | ||||
|         $this->assignRef('data_files', $data_files); | ||||
|         $this->assignRef('return_urls', $return_urls); | ||||
|         $this->assignRef('pagination', $pagination); | ||||
|  | ||||
|         parent::display($tpl); | ||||
|     } | ||||
|  | ||||
|     function displayDataFileImport($tpl = null) { | ||||
|         $model = $this->getModel(); | ||||
|  | ||||
|         parent::display($tpl); | ||||
|     } | ||||
|  | ||||
|     function editPublishingPreferences($tpl = null) { | ||||
|         $model = $this->getModel(); | ||||
|  | ||||
|         $data_source = $model->getDataSource(); | ||||
|         $preferences = $model->getPublishingPreferences(); | ||||
|         $return_urls = null; | ||||
|  | ||||
|         $model->getReturnURLs($return_urls); | ||||
|  | ||||
|         if (!empty($preferences)) { | ||||
|             $status = $preferences->status; | ||||
|             $mode = $preferences->mode; | ||||
|             $keyphrases = $preferences->keyphrases; | ||||
|         } else { | ||||
|             $status = 0; | ||||
|             $mode = 'json'; | ||||
|             $keyphrases = array(); | ||||
|         } | ||||
|  | ||||
|         $lists = array(); | ||||
|  | ||||
|         $options = array(PUBLISHING_PREFERENCES_STATUS_UNPUBLISHED=>JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_STATUS_UNPUBLISHED'), PUBLISHING_PREFERENCES_STATUS_PUBLISHED=>JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_STATUS_PUBLISHED')); | ||||
|         $lists['status'] = TabulizerForm::getSelectCtrl('ds_status',$status,$options); | ||||
|  | ||||
|         $options = array(PUBLISHING_PREFERENCES_MODE_JSON=>JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_MODE_JSON'), PUBLISHING_PREFERENCES_MODE_HTML=>JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_MODE_HTML')); | ||||
|         $lists['mode'] = TabulizerForm::getSelectCtrl('ds_mode',$mode,$options); | ||||
|  | ||||
|         $attributes = array('style'=>'height: 125px; width: 220px;'); | ||||
|         if (!empty($keyphrases)) { | ||||
|             $lists['keyphrases'] = TabulizerForm::getSelectCtrlMultiple('ds_keyphrases', array(), $keyphrases, $attributes); | ||||
|         } else { | ||||
|             $lists['keyphrases'] = '<select name="ds_keyphrases" id="ds_keyphrases" multiple style="'.$attributes['style'].'"></select>'; | ||||
|         } | ||||
|         $lists['keyphrases'] .= '<br style="clear: both;"/><a href="javascript:addNewKeyphrase();">'.JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_KEYPHRASE_ADD').'</a> | <a href="javascript:removeKeyphrase();">'.JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_KEYPHRASE_REMOVE').'</a> | <a href="javascript:removeAllKeyphrases();">'.JText::_('COM_TABULIZER_DATA_SOURCE_PUBLISHING_KEYPHRASE_REMOVE_ALL').'</a>'; | ||||
|  | ||||
|         $this->assignRef('return_urls', $return_urls); | ||||
|         $this->assignRef('data_source', $data_source); | ||||
|         $this->assignRef('preferences', $preferences); | ||||
|         $this->assignRef('lists', $lists); | ||||
|  | ||||
|         parent::display($tpl); | ||||
|     } | ||||
|  | ||||
|     function sortArrayByTitle($a, $b) { | ||||
|         return ($a['title'] > $b['title']); | ||||
|     } | ||||
| 	 | ||||
| 	function getShowHideClass($source_type, $param_key) { | ||||
| 		$class = 'hidden_tr'; | ||||
| 		switch ($source_type) { | ||||
| 			case 'csv': $show_keys = array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'filepath', | ||||
|                         'encoding', | ||||
| 						'separator', | ||||
| 						'enclosure', | ||||
| 						'consistency'); | ||||
| 						break; | ||||
| 						 | ||||
| 			case 'excel': $show_keys = array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'filepath',												 | ||||
| 						'sheet_name', | ||||
|                         'sheet_references', | ||||
| 						'sheet_selection',					 | ||||
| 						'read_font',	 | ||||
| 						'read_color',	 | ||||
| 						'read_images',	 | ||||
| 						'read_hyperlinks', | ||||
|                         'boost', | ||||
|                         'cellcache', | ||||
| 						'remove_empty'); | ||||
| 						break; | ||||
| 						 | ||||
| 			case 'database': $show_keys = array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'query'); | ||||
| 						break; | ||||
|  | ||||
|             case 'external_database': $show_keys = array('ruleset_archive', | ||||
|                         'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
|                         'query', | ||||
|                         'edb_driver', | ||||
|                         'edb_host', | ||||
|                         'edb_user', | ||||
|                         'edb_password', | ||||
|                         'edb_database', | ||||
|                         'edb_prefix'); | ||||
|                          break; | ||||
| 						 | ||||
| 			case 'html': $show_keys = array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'filepath', | ||||
|                         'encoding', | ||||
| 						'table_order', | ||||
| 						'table_attribute_name', | ||||
| 						'table_attribute_value'); | ||||
| 						break; | ||||
|  | ||||
|             case 'xml': $show_keys = array('ruleset_archive', | ||||
|                         'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
|                         'filepath', | ||||
|                         'encoding', | ||||
|                         'td_map'); | ||||
|                         break; | ||||
|  | ||||
|             case 'rss': $show_keys = array('ruleset_archive', | ||||
|                         'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
|                         'filepath', | ||||
|                         'encoding', | ||||
|                         'feed_type'); | ||||
|                         break; | ||||
|  | ||||
|             case 'json': $show_keys = array('ruleset_archive', | ||||
|                         'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
|                         'filepath', | ||||
|                         'encoding'); | ||||
|                         break; | ||||
| 						 | ||||
| 			case 'article': $show_keys = array('ruleset_archive', | ||||
| 						'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
| 						'article_id', | ||||
| 						'separator', | ||||
| 						'enclosure', | ||||
| 						'consistency', | ||||
| 						'strip_tags'); | ||||
| 						break; | ||||
|  | ||||
|             case 'merger': $show_keys = array('ruleset_archive', | ||||
|                         'ruleset_name', | ||||
|                         'table_caption', | ||||
|                         'table_summary', | ||||
|                         'server_side', | ||||
|                         'merging_tree'); | ||||
|                         break; | ||||
|  | ||||
|             default: | ||||
| 						$show_keys = array(); | ||||
| 						break;			 | ||||
| 		} | ||||
| 		 | ||||
| 		if (in_array($param_key, $show_keys)) $class = ''; | ||||
| 		 | ||||
| 		return $class;	 | ||||
| 	}	 | ||||
| 	 | ||||
| 	function getArticleSelectionInput($element_id, $element_value = 0) { | ||||
| 		if (defined('JOOMLA_1_MODE')) {			 | ||||
| 			$session_token = JSession::getFormToken(); | ||||
| 			$element_value = (empty($element_value))?'':intval($element_value); | ||||
| 			$html = TabulizerForm::getTextCtrl($element_id, $element_value) .  | ||||
| 						  ' <a rel="{handler: \'iframe\', size: {x: 650, y: 375}}" href="'.JRoute::_("index.php?option=com_content&task=element&tmpl=component&object=id'&{$session_token}=1").'" class="modal">'.JText::_('COM_TABULIZER_DATA_SOURCE_PARAM_ARTICLE_ID_VIEW_LIST').'</a>'; | ||||
| 								  								  			 | ||||
| 			return $html; | ||||
| 		}	 | ||||
| 	 | ||||
| 		// Load the modal behavior script. | ||||
| 		JHtml::_('behavior.modal', 'a.modal'); | ||||
| 		 | ||||
| 		// Build the script. | ||||
| 		$script = array(); | ||||
| 		$script[] = '   function jSelectArticle_'.$element_id.'(id, title, catid, object) {'; | ||||
| 		$script[] = '       document.id("'.$element_id.'").value = id;'; | ||||
| 		$script[] = '       document.id("'.$element_id.'_title").value = title;'; | ||||
| 		$script[] = '       SqueezeBox.close();'; | ||||
| 		$script[] = '   }'; | ||||
| 		 | ||||
| 		// Add the script to the document head. | ||||
| 		TabulizerJS::addScriptDeclaration(implode("\n", $script)); | ||||
| 		 | ||||
| 		// Setup variables for display. | ||||
| 		$html   = array(); | ||||
| 		$link   = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_'.$element_id; | ||||
| 		 | ||||
| 		if (!empty($element_value)) { | ||||
| 			$db = JFactory::getDBO();				 | ||||
| 			$db->setQuery( | ||||
| 				'SELECT title' . | ||||
| 				' FROM #__content' . | ||||
| 				' WHERE id = '.(int) $element_value | ||||
| 			); | ||||
| 			$title = $db->loadResult(); | ||||
| 			if ($error = $db->getErrorMsg()) { | ||||
|                 JFactory::getApplication()->enqueueMessage($error, 'error'); | ||||
|                 return ''; | ||||
| 			} | ||||
| 		} else { | ||||
| 			$element_value = ''; | ||||
| 			$title = ''; | ||||
| 		}				 | ||||
| 		 | ||||
| 		if (empty($title)) { | ||||
| 			$title = JText::_('COM_TABULIZER_NO_ARTICLE_IS_SELECTED'); | ||||
| 		} | ||||
| 		$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); | ||||
| 		 | ||||
| 		$session_token = JSession::getFormToken(); | ||||
| 		 | ||||
| 		// The current user display field. | ||||
| 		$html[] = '<span class="article_selection_title">'; | ||||
| 		$html[] = '<input type="text" id="'.$element_id.'_title" value="'.$title.'" disabled="disabled" /> '; | ||||
| 		$html[] = '<a class="modal" title="'.JText::_('COM_TABULIZER_CHANGE_ARTICLE').'"  href="'.$link.'&'.$session_token.'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('COM_TABULIZER_CHANGE_ARTICLE_BUTTON').'</a>'; | ||||
| 		$html[] = '</span>'; | ||||
| 			 | ||||
| 		// The active article id field. | ||||
| 		if (empty($element_value)) { | ||||
| 			$value = ''; | ||||
| 		} else { | ||||
| 			$value = (int)$element_value; | ||||
| 		}	 | ||||
| 		 | ||||
| 		$html[] = '<input type="hidden" id="'.$element_id.'" name="'.$element_id.'" value="'.$value.'" />'; | ||||
| 		 | ||||
| 		return implode("\n", $html); | ||||
| 				 | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user