*** *** *** You should have received a copy of the GNU General Public License *** *** along with this program; if not, write to the Free Software *** *** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *** *** *** *** See COPYRIGHT.php for more information. *** *** See LICENSE.php for more information. *** *** *** *** www.joomlaxtc.com *** *** *** ************************************************************************************ ***********************************************************************************/ // This program Builds CSS style cascade define('_XTCFRAMEWORK', 1); require 'XTC.php'; $templateParameters = xtcLoadParams(); // Get params for this template $group = cleanGet('group'); $file = basename(cleanGet('file')); if ($group && isset($templateParameters->group->{$group})) { $params = $templateParameters->group->{$group}; $file .= '.css'; } else { $params = $templateParameters; } $imgpath = $xtc->templateUrl . 'images'; header('Content-type: text/css'); if ($xtc->CSScompression) { ob_start(); ob_implicit_flush(0); }
protected function getInput() { if (!function_exists('xtcsortfn')) { function xtcsortfn($a, $b) { return strnatcmp($a[0], $b[0]); } } jimport('joomla.filesystem.folder'); JHTML::_('behavior.modal', 'a.modal'); $live_site = JURI::root(); $template = basename(dirname(dirname(dirname(__FILE__)))); $document = JFactory::getDocument(); $id = JRequest::getInt('id'); $document->addStyleSheet($live_site . "templates/{$template}/XTC/XTC.css", 'text/css'); $path = JPATH_ROOT . '/templates/' . $template; $files = JFolder::files($path . '/parameters', 'xml'); $onopen = "var iSize;\n var iFrame = this.asset;\n iFrame.addEvent('load', function(){\n var iBody = (iFrame.contentDocument) ? iFrame.contentDocument.getElementsByTagName('body')[0] : iFrame.contentWindow.document.getElementsByTagName('body')[0];\n\n\t iSize = {x:this.size.x, y:iBody.offsetHeight};\n var per = (window.innerHeight * 0.9).toInt();\n iSize.y = (iSize.y > per) ? per : iSize.y ;\n iFrame.setStyles({'height':'100%'});\n\n this.resize(iSize, false);\n }.bind(this));"; $parmsfound = false; $prefix = trim($this->element['group']); $label = trim($this->element['label']); $parameters = array(); foreach ($files as $file) { @(list($filename, $extension) = explode('.', $file, 2)); if ($extension != 'xml') { continue; } // Not an XML if (strpos($filename, $prefix) !== 0) { continue; } // Not the right prefix $xmlFile = $path . '/parameters/' . $file; if (is_readable($xmlFile)) { $xml = simplexml_load_file($xmlFile); $name = isset($xml->name) ? $xml->name : $filename; $description = isset($xml->description) ? trim($xml->description) : ''; } else { $name = $filename; $description = ''; } $thumbnail = ''; if (file_exists($path . '/parameters/' . $filename . '.gif')) { $thumbnail = $filename . '.gif'; } elseif (file_exists($path . '/parameters/' . $filename . '.jpg')) { $thumbnail = $filename . '.jpg'; } elseif (file_exists($path . '/parameters/' . $filename . '.png')) { $thumbnail = $filename . '.png'; } $fullimage = ''; if (file_exists($path . '/parameters/' . $filename . '_full.gif')) { $fullimage = $filename . '_full.gif'; } elseif (file_exists($path . '/parameters/' . $filename . '_full.jpg')) { $fullimage = $filename . '_full.jpg'; } elseif (file_exists($path . '/parameters/' . $filename . '_full.png')) { $fullimage = $filename . '_full.png'; } $parameters[] = array($name, $filename, $description, $thumbnail, $fullimage); } usort($parameters, "xtcsortfn"); $stringFilter = JFilterInput::getInstance(); require_once $path . '/XTC/XTC_library.php'; $templateParameters = xtcLoadParams($id); $html = ''; $navHtml = ''; $tabHtml = ''; $count = count($parameters); $openClass = $count == 1 ? ' open' : ''; foreach ($parameters as $i => $parameter) { // Draw parameters list($name, $filename, $description, $thumbnail, $fullimage) = $parameter; $params = isset($templateParameters->group->{$filename}) ? $templateParameters->group->{$filename} : new stdClass(); $tabid = $filename . $i; // Parameter Tab $active = $i == 0 ? ' class="active"' : ''; $navHtml .= '<li' . $active . '>'; $navHtml .= '<a href="#' . $tabid . '" data-toggle="tab">'; if ($thumbnail) { $thumbnailURL = $live_site . 'templates/' . $template . '/parameters/' . $thumbnail; $navHtml .= '<img class="img-rounded" src="' . $thumbnailURL . '" alt="" /><br/>'; } $navHtml .= '<center>' . $name . '</center>'; $navHtml .= '</a>'; $navHtml .= '</li>'; // Parameter Tab contents $form = new JForm('jxtc'); $form->addFieldPath(JPATH_ROOT . '/templates/' . $template . '/XTC/elements'); $xmlFile = $path . '/parameters/' . $filename . '.xml'; $form->loadFile($xmlFile); $getFieldsets = $form->getFieldsets(); $active = $i == 0 ? ' active' : ''; $tabHtml .= '<div class="tab-pane' . $active . '" id="' . $tabid . '">'; $tabHtml .= '<div class="xtc row-fluid">'; $tabHtml .= '<div class="span5">'; foreach ($getFieldsets as $fieldsets => $fieldset) { $label = trim($fieldset->label); if (empty($label)) { $label = trim($fieldset->name); } $fieldsetDescription = isset($fieldset->description) ? trim($fieldset->description) : ''; if (count($getFieldsets) > 1) { $tabHtml .= '<fieldset>'; if ($label) { $tabHtml .= '<legend>' . $label . '</legend>'; } if ($fieldsetDescription) { $tabHtml .= '<div class="well">' . $fieldsetDescription . '</div>'; } } foreach ($form->getFieldset($fieldset->name) as $field) { $xtcName = substr($field->name, 7, -1); if (isset($params->{$xtcName})) { $field->value = $params->{$xtcName}; } $field->name = str_replace('params[', 'xtcparam[' . $prefix . '][' . $filename . '][', $field->name); $field->id = $stringFilter->clean($field->name, 'cmd'); $tabHtml .= '<div class="control-group">'; $tabHtml .= '<div class="control-label">' . $field->getLabel() . '</div>'; $tabHtml .= '<div class="controls">' . $field->getInput() . '</div>'; $tabHtml .= '</div>'; } if (count($getFieldsets) > 1) { $tabHtml .= '</fieldset>'; } } $tabHtml .= '</div>'; // span5 if ($description || $fullimage) { $tabHtml .= '<div class="span1"></div>'; $tabHtml .= '<div class="span4"><div class="well">'; $tabHtml .= '<h3>' . $name . '</h3>'; if ($description) { $tabHtml .= $description . '<br/><br/>'; } if ($fullimage) { $fullimageURL = $live_site . 'templates/' . $template . '/parameters/' . $fullimage; $headerimg_size = getimagesize($path . '/layouts/' . $folder . '/' . $fullimage); $width = $headerimg_size[0]; $height = $headerimg_size[1]; $onclick = "onclick=\"MyWindow=window.open('{$fullimageURL}','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width={$width},height={$height}'); return false;\""; $tabHtml .= '<a class="btn btn-primary" href="#" ' . $onclick . '>' . JText::_('TPL_JXTC_VIEWLAYOUT') . '</a>'; } $tabHtml .= '</div></div>'; } $tabHtml .= '</div>'; // row-fluid $tabHtml .= '</div>'; // tab-pane } $html .= '<div class="tabbable">'; $html .= '<ul class="nav nav-tabs">' . $navHtml . '</ul>'; $html .= '<div class="tab-content">' . $tabHtml . '</div>'; $html .= '</div>'; return $html; }
protected function getInput() { if (!function_exists('xtcsortfn')) { function xtcsortfn($a, $b) { return strnatcmp($a[0], $b[0]); } } jimport('joomla.filesystem.folder'); JHTML::_('behavior.modal', 'a.modal'); $template = basename(dirname(dirname(dirname(__FILE__)))); $live_site = JURI::root(); $document = JFactory::getDocument(); $id = JRequest::getInt('id'); $document->addStyleSheet($live_site . "templates/{$template}/XTC/XTC.css", 'text/css'); $path = JPATH_ROOT . '/templates/' . $template; $folders = JFolder::folders($path . '/layouts'); $layouts = array(); foreach ($folders as $folder) { // Parse parameter files $xmlFile = $path . '/layouts/' . $folder . '/config.xml'; if (is_readable($xmlFile)) { $xml = simplexml_load_file($xmlFile); $name = isset($xml->name) ? $xml->name : $folder; $description = isset($xml->description) ? trim($xml->description) : ''; } else { $name = $folder; $description = ''; } $thumbnail = ''; if (file_exists($path . '/layouts/' . $folder . '/thumbnail.gif')) { $thumbnail = 'thumbnail.gif'; } elseif (file_exists($path . '/layouts/' . $folder . '/thumbnail.jpg')) { $thumbnail = 'thumbnail.jpg'; } elseif (file_exists($path . '/layouts/' . $folder . '/thumbnail.png')) { $thumbnail = 'thumbnail.png'; } $fullimage = ''; if (file_exists($path . '/layouts/' . $folder . '/layout.gif')) { $fullimage = 'layout.gif'; } elseif (file_exists($path . '/layouts/' . $folder . '/layout.jpg')) { $fullimage = 'layout.jpg'; } elseif (file_exists($path . '/layouts/' . $folder . '/layout.png')) { $fullimage = 'layout.png'; } $layouts[] = array($name, $folder, $description, $thumbnail, $fullimage); } usort($layouts, "xtcsortfn"); $stringFilter = JFilterInput::getInstance(); require_once $path . '/XTC/XTC_library.php'; $templateParameters = xtcLoadParams($id); $html = ''; $navHtml = ''; $tabHtml = ''; $count = count($layouts); $openClass = $count == 1 ? ' open' : ''; foreach ($layouts as $i => $layout) { // Draw layouts list($name, $folder, $description, $thumbnail, $fullimage) = $layout; $params = isset($templateParameters->group->{$folder}) ? $templateParameters->group->{$folder} : new stdClass(); $tabid = $folder . $i; // Parameter Tab $active = $i == 0 ? ' class="active"' : ''; $navHtml .= '<li' . $active . '>'; $navHtml .= '<a href="#' . $tabid . '" data-toggle="tab">'; if ($thumbnail) { $thumbnailURL = $live_site . 'templates/' . $template . '/layouts/' . $folder . '/' . $thumbnail; $navHtml .= '<img class="img-rounded" src="' . $thumbnailURL . '" alt="" /><br/>'; } $navHtml .= '<center>' . $name . '</center>'; $navHtml .= '</a>'; $navHtml .= '</li>'; // Parameter Tab contents $form = new JForm('jxtc'); $form->addFieldPath(JPATH_ROOT . '/templates/' . $template . '/XTC/elements'); $xmlFile = $path . '/layouts/' . $folder . '/config.xml'; $form->loadFile($xmlFile); $getFieldsets = $form->getFieldsets(); $active = $i == 0 ? ' active' : ''; $tabHtml .= '<div class="tab-pane' . $active . '" id="' . $tabid . '">'; $tabHtml .= '<div class="xtc row-fluid">'; $tabHtml .= '<div class="span5">'; foreach ($getFieldsets as $fieldsets => $fieldset) { $label = trim($fieldset->label); if (empty($label)) { $label = trim($fieldset->name); } $fieldsetDescription = isset($fieldset->description) ? trim($fieldset->description) : ''; if (count($getFieldsets) > 1) { $tabHtml .= '<fieldset>'; if ($label) { $tabHtml .= '<legend>' . $label . '</legend>'; } if ($fieldsetDescription) { $tabHtml .= '<div class="well">' . $fieldsetDescription . '</div>'; } } foreach ($form->getFieldset($fieldset->name) as $field) { $xtcName = substr($field->name, 7, -1); if (isset($params->{$xtcName})) { $field->value = $params->{$xtcName}; } $field->name = str_replace('params[', 'xtcparam[layout][' . $folder . '][', $field->name); $field->id = $stringFilter->clean($field->name, 'cmd'); $tabHtml .= '<div class="control-group">'; $tabHtml .= '<div class="control-label">' . $field->getLabel() . '</div>'; $tabHtml .= '<div class="controls">' . $field->getInput() . '</div>'; $tabHtml .= '</div>'; } if (count($getFieldsets) > 1) { $tabHtml .= '</fieldset>'; } } $tabHtml .= '</div>'; // span5 if ($description || $fullimage) { $tabHtml .= '<div class="span1"></div>'; $tabHtml .= '<div class="span4"><div class="well">'; $tabHtml .= '<h3>' . $name . '</h3>'; if ($description) { $tabHtml .= $description . '<br/><br/>'; } if ($fullimage) { $fullimageURL = $live_site . 'templates/' . $template . '/layouts/' . $folder . '/' . $fullimage; $headerimg_size = getimagesize($path . '/layouts/' . $folder . '/' . $fullimage); $width = $headerimg_size[0]; $height = $headerimg_size[1]; $onclick = "onclick=\"MyWindow=window.open('{$fullimageURL}','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width={$width},height={$height}'); return false;\""; $tabHtml .= '<a class="btn btn-primary" href="#" ' . $onclick . '>' . JText::_('TPL_JXTC_VIEWLAYOUT') . '</a>'; } $tabHtml .= '</div></div>'; } $tabHtml .= '</div>'; // row-fluid $tabHtml .= '</div>'; // tab-pane } $html .= '<div class="tabbable">'; $html .= '<ul class="nav nav-tabs">' . $navHtml . '</ul>'; $html .= '<div class="tab-content">' . $tabHtml . '</div>'; $html .= '</div>'; return $html; }
protected function getInput() { jimport('joomla.html.parameter'); jimport('joomla.html.pane'); $id = JRequest::getInt('id'); $live_site = JURI::root(); $template = basename(dirname(dirname(dirname(__FILE__)))); $path = JPATH_ROOT . '/templates/' . $template; $document = JFactory::getDocument(); $document->addStyleSheet($live_site . "templates/{$template}/XTC/XTC.css", 'text/css'); $xmlFile = JPATH_ROOT . '/templates/' . $template . '/XTC/XTC_config.xml'; if (!is_readable($xmlFile)) { return "No parameters found."; } else { if (is_readable($xmlFile)) { $xml = simplexml_load_file($xmlFile); $name = isset($xml->name) ? $xml->name : ''; $description = isset($xml->description) ? trim($xml->description) : ''; } else { $name = ''; $description = ''; } } $form = new JForm('jxtc'); $form->addFieldPath(JPATH_ROOT . '/templates/' . $template . '/XTC/elements'); $form->loadFile($xmlFile); $getFieldsets = $form->getFieldsets(); require_once $path . '/XTC/XTC_library.php'; $templateParameters = xtcLoadParams($id); $html = ''; $html .= '<div class="xtc row-fluid">'; $html .= '<div class="span5">'; foreach ($getFieldsets as $fieldsets => $fieldset) { $label = trim($fieldset->label); if (empty($label)) { $label = trim($fieldset->name); } $fieldsetDescription = isset($fieldset->description) ? trim($fieldset->description) : ''; if (count($getFieldsets) > 1) { // Split in xtc fieldsets $html .= '<fieldset>'; if ($label) { $html .= '<legend>' . $label . '</legend>'; } if ($fieldsetDescription) { $html .= '<div>' . $fieldsetDescription . '</div>'; } } foreach ($form->getFieldset($fieldset->name) as $field) { $xtcName = substr($field->name, 7, -1); if (isset($templateParameters->{$xtcName})) { $field->value = $templateParameters->{$xtcName}; } $field->name = str_replace('params[', 'jform[params][', $field->name); $html .= '<div class="control-group">'; $html .= '<div class="control-label">' . $field->getLabel() . '</div>'; $html .= '<div class="controls">' . $field->getInput() . '</div>'; $html .= '</div>'; } if (count($getFieldsets) > 1) { $html .= '</fieldset>'; } } $html .= '</div>'; //span if ($description) { $html .= '<div class="span1"></div>'; $html .= '<div class="span4">'; $html .= '<h3>' . $name . '</h3>'; $html .= '<div class="well">' . $description . '</div></div>'; } $html .= '</div>'; // row-fluid $html .= '<script type="text/javascript"> original = Joomla.submitbutton; Joomla.submitbutton = function(task) { if (task == "style.apply" || task == "style.save" || task == "style.save2copy") { form = document.getElementById("style-form"); form.action="index.php?option=com_jxtc&id=' . JRequest::getInt('id') . '" form.task.value = task.substr(6); form.submit(); } else { original(task); } } function switchpane(name) { pane = document.getElementById(name); if (pane.className == "xtcPane") { pane.setAttribute("class", "xtcPane open"); } else { pane.setAttribute("class", "xtcPane"); } } </script>'; return $html; }