primo commit
This commit is contained in:
@ -0,0 +1,225 @@
|
||||
<?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');
|
||||
|
||||
jimport( 'joomla.application.component.view' );
|
||||
|
||||
class tabulizerViewRulesetarchive extends JViewLegacy
|
||||
{
|
||||
function __construct(){
|
||||
// add tabulizer CSS to override form styling
|
||||
$doc=JFactory::getDocument();
|
||||
$cssfile = TabulizerPath::getURLPath('tabulizer.css', 'admin_css');
|
||||
$doc->addStyleSheet($cssfile);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function display($tpl = null){
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$option = $jinput->getCmd('option');
|
||||
$return_urls = null;
|
||||
|
||||
$model = $this->getModel();
|
||||
$ruleset_archive = $model->getRulesetArchive();
|
||||
$pagination = $model->getPagination();
|
||||
$model->getReturnURLs($return_urls);
|
||||
|
||||
if (!empty($ruleset_archive)) {
|
||||
$this->assignRef('archive_name', $ruleset_archive['name']);
|
||||
$this->assignRef('archive_title', $ruleset_archive['title']);
|
||||
$this->assignRef('archive_description', $ruleset_archive['archive_description']);
|
||||
$this->assignRef('archive_filename', $ruleset_archive['filename']);
|
||||
$this->assignRef('rulesets', $ruleset_archive['rulesets']);
|
||||
$this->assignRef('pagination', $pagination);
|
||||
$this->assignRef('return_urls', $return_urls);
|
||||
|
||||
// is there any help doc present
|
||||
$archive_help_contents = '';
|
||||
if (ARCHIVE_HELP_DISPLAY != 'none') {
|
||||
if (preg_match('/([a-z0-9\.\-\_]+)\.xml/',$ruleset_archive['filename'],$matches)) {
|
||||
$archive_help_html = 'help-'. $matches[1] . '.html';
|
||||
$archive_help_path = TabulizerPath::getFilePath($archive_help_html, 'docs');
|
||||
switch (ARCHIVE_HELP_DISPLAY) {
|
||||
case 'text':
|
||||
if (file_exists($archive_help_path)) {
|
||||
$archive_help_contents = file_get_contents($archive_help_path);
|
||||
}
|
||||
break;
|
||||
case 'html':
|
||||
if (file_exists($archive_help_path)) {
|
||||
$archive_help_contents = file_get_contents($archive_help_path);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assignRef('archive_help_contents', $archive_help_contents);
|
||||
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
function displayPreview($tpl = null){
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$option = $jinput->getCmd('option');
|
||||
$return_urls = null;
|
||||
|
||||
$model = $this->getModel();
|
||||
$ruleset_archive = $model->getRulesetArchive();
|
||||
$model->getReturnURLs($return_urls);
|
||||
|
||||
if (!empty($ruleset_archive)) {
|
||||
$this->assignRef('archive_name', $ruleset_archive['name']);
|
||||
$this->assignRef('archive_title', $ruleset_archive['title']);
|
||||
$this->assignRef('archive_description', $ruleset_archive['archive_description']);
|
||||
$this->assignRef('archive_style', $ruleset_archive['style']);
|
||||
$this->assignRef('archive_filename', $ruleset_archive['filename']);
|
||||
$this->assignRef('rulesets', $ruleset_archive['rulesets']);
|
||||
$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);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$author_name = $user->name;
|
||||
$author_email = $user->email;
|
||||
$author_url = '';
|
||||
|
||||
$lists = array();
|
||||
|
||||
$lists['edit'] = false;
|
||||
|
||||
$default_name = 'rs_'. strtolower(TabulizerString::generateRandomString(8)); // '*'.XML_FILE_EXT;
|
||||
$default_filename = $default_name.'.xml';
|
||||
$default_style = $default_name.'.css';
|
||||
$name_attr = array('onchange'=>'updateArchiveFields(\''.$default_filename.'\')');
|
||||
|
||||
$lists['filename'] = TabulizerForm::getTextCtrl('archive_filename',$default_filename);
|
||||
$lists['name'] = TabulizerForm::getTextCtrl('archive_name',$default_name,$name_attr);
|
||||
$lists['title'] = TabulizerForm::getTextCtrl('archive_title',"");
|
||||
$lists['description'] = TabulizerForm::getTextCtrl('archive_description', "");
|
||||
$lists['style'] = TabulizerForm::getTextCtrl('archive_style',$default_style);
|
||||
$lists['meta'] = array();
|
||||
$lists['meta']['version'] = TabulizerForm::getTextCtrl('meta_version',"1");
|
||||
$lists['meta']['author_name'] = TabulizerForm::getTextCtrl('meta_author_name',$author_name);
|
||||
$lists['meta']['author_email'] = TabulizerForm::getTextCtrl('meta_author_email',$author_email);
|
||||
$lists['meta']['author_url'] = TabulizerForm::getTextCtrl('meta_author_url',$author_url);
|
||||
$lists['meta']['compatibility'] = '4'; // meaning it's compatible with Tabulizer v4
|
||||
$lists['meta']['generator'] = 'Tabulizer v.'.TABULIZER_APP_VERSION;
|
||||
$lists['meta']['last_modified'] = date('Y-m-d H:i:s');
|
||||
|
||||
$lists['used_archive_names'] = '';
|
||||
$archive_names = $model->getAllRulesetArchiveNames();
|
||||
if (!empty($archive_names)) {
|
||||
$lists['used_archive_names'] = '"'.implode('","', $archive_names).'"';
|
||||
}
|
||||
|
||||
$lists['used_archive_filenames'] = '';
|
||||
$archive_filenames = $model->getAllRulesetArchiveFilenames();
|
||||
if (!empty($archive_filenames)) {
|
||||
$lists['used_archive_filenames'] = '"'.implode('","', $archive_filenames).'"';
|
||||
}
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('return_urls', $return_urls);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
function displayEdit($tpl = null){
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$option = $jinput->getCmd('option');
|
||||
$return_urls = null;
|
||||
|
||||
$model = $this->getModel();
|
||||
$archive = $model->getRulesetArchive();
|
||||
$model->getReturnURLs($return_urls);
|
||||
|
||||
$lists = array();
|
||||
|
||||
$lists['edit'] = true;
|
||||
|
||||
$name = $archive['name'];
|
||||
$description = isset($archive['description'])?$archive['description']:'';
|
||||
$title = isset($archive['title'])?$archive['title']:'';
|
||||
$style = isset($archive['style'])?$archive['style']:'';
|
||||
|
||||
$author_name = isset($archive['meta']['author_name'])?trim($archive['meta']['author_name']):'';
|
||||
$author_email = isset($archive['meta']['author_email'])?trim($archive['meta']['author_email']):'';
|
||||
$author_url = isset($archive['meta']['author_url'])?trim($archive['meta']['author_url']):'';
|
||||
$version = isset($archive['meta']['version'])?trim($archive['meta']['version']):'';
|
||||
|
||||
$lists['filename'] = '<input type="text" name="archive_filename" id="archive_filename" value="'.$archive['filename'].'" readonly class="fieldvalue_readonly">';
|
||||
$lists['name'] = TabulizerForm::getTextCtrl('archive_name', $name, array('readonly'=>'readonly', 'class'=>'fieldvalue_readonly'));
|
||||
$lists['title'] = TabulizerForm::getTextCtrl('archive_title', $title);
|
||||
$lists['description'] = TabulizerForm::getTextCtrl('archive_description', $description);
|
||||
$lists['style'] = TabulizerForm::getTextCtrl('archive_style', $style);
|
||||
$lists['meta'] = array();
|
||||
$lists['meta']['version'] = TabulizerForm::getTextCtrl('meta_version',$version);
|
||||
$lists['meta']['author_name'] = TabulizerForm::getTextCtrl('meta_author_name',$author_name);
|
||||
$lists['meta']['author_email'] = TabulizerForm::getTextCtrl('meta_author_email',$author_email);
|
||||
$lists['meta']['author_url'] = TabulizerForm::getTextCtrl('meta_author_url',$author_url);
|
||||
$lists['meta']['compatibility'] = RANGE_COMPATIBILITY_5;
|
||||
$lists['meta']['generator'] = 'Tabulizer v.'.TABULIZER_APP_VERSION;
|
||||
$lists['meta']['last_modified'] = date('Y-m-d H:i:s');
|
||||
|
||||
$lists['used_archive_names'] = '';
|
||||
$archive_names = $model->getAllRulesetArchiveNames(array($archive['name']));
|
||||
if (!empty($archive_names)) {
|
||||
$lists['used_archive_names'] = '"'.implode('","', $archive_names).'"';
|
||||
}
|
||||
|
||||
$lists['used_archive_filenames'] = '';
|
||||
$archive_filenames = $model->getAllRulesetArchiveFilenames(array($archive['filename']));
|
||||
if (!empty($archive_filenames)) {
|
||||
$lists['used_archive_filenames'] = '"'.implode('","', $archive_filenames).'"';
|
||||
}
|
||||
|
||||
$this->assignRef('lists', $lists);
|
||||
$this->assignRef('return_urls', $return_urls);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
function displayCSSEdit($tpl = null){
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$option = $jinput->getCmd('option');
|
||||
$return_urls = null;
|
||||
|
||||
$model = $this->getModel();
|
||||
$css = $model->getCSSFile();
|
||||
$model->getReturnURLs($return_urls);
|
||||
|
||||
$this->assignRef('css', $css);
|
||||
$this->assignRef('return_urls', $return_urls);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user