You've already forked joomla_test
first commit
This commit is contained in:
59
modules/mod_roktabs/fields/break.php
Normal file
59
modules/mod_roktabs/fields/break.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: break.php 6824 2013-01-28 06:14:09Z btowles $
|
||||
* @author RocketTheme http://www.rockettheme.com
|
||||
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Form Field class for the Joomla Platform.
|
||||
* Supports a one line text field.
|
||||
*
|
||||
* @package Joomla.Platform
|
||||
* @subpackage Form
|
||||
* @link http://www.w3.org/TR/html-markup/input.text.html#input.text
|
||||
* @since 11.1
|
||||
*/
|
||||
class JFormFieldBreak extends JFormField
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Break';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getLabel()
|
||||
{
|
||||
$doc = JFactory::getDocument();
|
||||
$version = new JVersion();
|
||||
$doc->addStyleDeclaration(".rok-break {border-bottom:1px solid #eee;font-size:16px;color:#0088CC;margin-top:15px;padding:2px 0;width:100%}");
|
||||
|
||||
if (isset($this->element['label']) && !empty($this->element['label'])) {
|
||||
$label = JText::_((string)$this->element['label']);
|
||||
$css = (string)$this->element['class'];
|
||||
$version = new JVersion();
|
||||
if (version_compare($version->getShortVersion(), '3.0', '>=')) {
|
||||
return '<div class="rok-break ' . $css . '">' . $label . '</div>';
|
||||
} else {
|
||||
return '<label class="rok-break ' . $css . '">' . $label . '</label>';
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
96
modules/mod_roktabs/fields/contenttype.php
Normal file
96
modules/mod_roktabs/fields/contenttype.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: contenttype.php 6824 2013-01-28 06:14:09Z btowles $
|
||||
* @author RocketTheme http://www.rockettheme.com
|
||||
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
|
||||
*/
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
jimport('joomla.html.html');
|
||||
jimport('joomla.form.formfield');
|
||||
JHtml::_('behavior.framework', true);
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
class JFormFieldContentType extends JFormFieldList
|
||||
{
|
||||
protected $type = 'contenttype';
|
||||
|
||||
protected function getInput()
|
||||
{
|
||||
$doc = JFactory::getDocument();
|
||||
|
||||
// Initialize some field attributes.
|
||||
$attr = '';
|
||||
$attr .= $this->element['class'] ? ' class="' . (string)$this->element['class'] . '"' : '';
|
||||
// To avoid user's confusion, readonly="true" should imply disabled="true".
|
||||
if ((string)$this->element['readonly'] == 'true' || (string)$this->element['disabled'] == 'true') {
|
||||
$attr .= ' disabled="disabled"';
|
||||
}
|
||||
$attr .= $this->element['size'] ? ' size="' . (int)$this->element['size'] . '"' : '';
|
||||
$attr .= $this->element['multiple'] ? ' multiple="multiple"' : '';
|
||||
// Initialize JavaScript field attributes.
|
||||
$attr .= $this->element['onchange'] ? ' onchange="' . (string)$this->element['onchange'] . '"' : '';
|
||||
|
||||
$version = new JVersion();
|
||||
if (version_compare($version->getShortVersion(), '3.0', '<')) {
|
||||
if (K2_CHECK) {
|
||||
$js = "window.addEvent('domready', function() {
|
||||
$('" . $this->id . "').addEvent('change', function(){
|
||||
$$('.ifk2').getParent('li').setStyle('display','block');
|
||||
$$('." . $this->element['name'] . "').getParent('li').setStyle('display','none');
|
||||
$$('." . $this->value . "').getParent('li').setStyle('display','block');
|
||||
var sel = this.getSelected().get('value');
|
||||
$$('.source').getParent('li').setStyle('display','none');
|
||||
$$('.'+sel).getParent('li').setStyle('display','block');
|
||||
}).fireEvent('change');
|
||||
});";
|
||||
} else {
|
||||
$js = "window.addEvent('domready', function() {
|
||||
$('" . $this->id . "').set('value', 'joomla');
|
||||
$('" . $this->id . "').getParent('li').setStyle('display','none');
|
||||
$$('." . $this->element['name'] . "').getParent('li').setStyle('display','none');
|
||||
$$('.joomla').getParent('li').setStyle('display','block');
|
||||
});";
|
||||
}
|
||||
} else {
|
||||
if (K2_CHECK) {
|
||||
$js = "window.addEvent('domready', function() {
|
||||
var chzn = $('" . $this->id . "_chzn');
|
||||
if(chzn!=null){
|
||||
$('" . $this->id . "_chzn').addEvent('click', function(){
|
||||
$$('.ifk2').getParent('div.control-group').setStyle('display','block');
|
||||
$$('." . $this->value . "').getParent('div.control-group').setStyle('display','block');
|
||||
$$('." . $this->element['name'] . "').getParent('div.control-group').setStyle('display','none');
|
||||
var text = $('" . $this->id . "_chzn').getElement('span').get('text');
|
||||
var options = $('" . $this->id . "').getElements('option');
|
||||
options.each(function(option) {
|
||||
var optText = String(option.get('text'));
|
||||
var optValue = String(option.get('value'));
|
||||
if(text == optText){
|
||||
var sel = optValue;
|
||||
}
|
||||
$$('.'+sel).getParent('div.control-group').setStyle('display','block');
|
||||
});
|
||||
}).fireEvent('click');
|
||||
}
|
||||
});";
|
||||
} else {
|
||||
$js = "window.addEvent('domready', function() {
|
||||
$('" . $this->id . "').set('value', 'joomla');
|
||||
$('" . $this->id . "').getParent('div.control-group').setStyle('display','none');
|
||||
$$('." . $this->element['name'] . "').getParent('div.control-group').setStyle('display','none');
|
||||
$$('.joomla').getParent('div.control-group').setStyle('display','block');
|
||||
});";
|
||||
}
|
||||
}
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
|
||||
return JHtml::_('select.genericlist', (array)$this->getOptions(), $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
1
modules/mod_roktabs/fields/index.html
Normal file
1
modules/mod_roktabs/fields/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
86
modules/mod_roktabs/fields/k2categories.php
Normal file
86
modules/mod_roktabs/fields/k2categories.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2categories.php 6824 2013-01-28 06:14:09Z btowles $
|
||||
* @author RocketTheme http://www.rockettheme.com
|
||||
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
|
||||
*
|
||||
* "K2 Items" Module by JoomlaWorks for Joomla! 1.5.x - Version 2.0.0
|
||||
* Copyright (c) 2006 - 2009 JoomlaWorks Ltd. All rights reserved.
|
||||
* Released under the GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
* More info at http://www.joomlaworks.gr
|
||||
* Designed and developed by the JoomlaWorks team
|
||||
* *** Last update: June 20th, 2009 ***
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die ('Restricted access');
|
||||
jimport('joomla.html.html');
|
||||
jimport('joomla.form.formfield');
|
||||
JHtml::_('behavior.framework', true);
|
||||
/**
|
||||
* @package RocketTheme
|
||||
* @subpackage rokstories.fields
|
||||
*/
|
||||
class JFormFieldK2Categories extends JFormField
|
||||
{
|
||||
var $_name = 'k2categories';
|
||||
|
||||
public function getInput()
|
||||
{
|
||||
|
||||
// Initialize variables.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Initialize some field attributes.
|
||||
$attr = '';
|
||||
$attr .= $this->element['class'] ? ' class="' . (string)$this->element['class'] . '"' : '';
|
||||
// To avoid user's confusion, readonly="true" should imply disabled="true".
|
||||
if ((string)$this->element['readonly'] == 'true' || (string)$this->element['disabled'] == 'true') {
|
||||
$attr .= ' disabled="disabled"';
|
||||
}
|
||||
$attr .= $this->element['size'] ? ' size="' . (int)$this->element['size'] . '"' : '';
|
||||
$attr .= $this->element['multiple'] ? ' multiple="multiple"' : '';
|
||||
// Initialize JavaScript field attributes.
|
||||
$attr .= $this->element['onchange'] ? ' onchange="' . (string)$this->element['onchange'] . '"' : '';
|
||||
|
||||
$mitems = array();
|
||||
if ($this->available()) {
|
||||
|
||||
$query = 'SELECT m.* FROM #__k2_categories m WHERE published=1 AND trash = 0 ORDER BY parent, ordering';
|
||||
$db->setQuery($query);
|
||||
$mitems = $db->loadObjectList();
|
||||
$children = array();
|
||||
if ($mitems) {
|
||||
foreach ($mitems as $v) {
|
||||
$v->title = $v->name;
|
||||
$v->parent_id = $v->parent;
|
||||
$pt = $v->parent;
|
||||
$list = @$children[$pt] ? $children[$pt] : array();
|
||||
array_push($list, $v);
|
||||
$children[$pt] = $list;
|
||||
}
|
||||
}
|
||||
$list = JHtml::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
|
||||
$mitems = array();
|
||||
|
||||
foreach ($list as $item) {
|
||||
$item->treename = JString::str_ireplace(' ', '- ', $item->treename);
|
||||
$mitems[] = JHtml::_('select.option', $item->id, ' ' . $item->treename);
|
||||
}
|
||||
}
|
||||
return JHtml::_('select.genericlist', $mitems, $this->name, trim($attr), 'value', 'text', $this->value);
|
||||
}
|
||||
|
||||
function available()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = 'select count(*) from #__extensions where element = ' . $db->Quote('com_k2') . ' AND enabled=1';
|
||||
$db->setQuery($query);
|
||||
$count = (int)$db->loadResult();
|
||||
if ($count > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
36
modules/mod_roktabs/fields/k2check.php
Normal file
36
modules/mod_roktabs/fields/k2check.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2check.php 6824 2013-01-28 06:14:09Z btowles $
|
||||
* @author RocketTheme http://www.rockettheme.com
|
||||
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
|
||||
*/
|
||||
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die();
|
||||
jimport('joomla.html.html');
|
||||
jimport('joomla.form.formfield');
|
||||
JHtml::_('behavior.framework', true);
|
||||
/**
|
||||
* @package RocketTheme
|
||||
* @subpackage rokstories.elements
|
||||
*/
|
||||
class JFormFieldK2check extends JFormField
|
||||
{
|
||||
public function getInput()
|
||||
{
|
||||
if (defined('K2_CHECK')) return;
|
||||
$k2 = JPATH_SITE . "/components/com_k2/k2.php";
|
||||
|
||||
if (!file_exists($k2)) {
|
||||
define('K2_CHECK', 0);
|
||||
$warning_style = "style='background: #FFF3A3;border: 1px solid #E7BD72;color: #B79000;display: block;padding: 8px 10px;'";
|
||||
return "<span $warning_style><strong>K2 Component</strong> Not Found. In order to use the <strong>K2 Content</strong> type, you will need to <a href=\"http://k2.joomlaworks.gr\" target=\"_blank\">download and install it</a>.</span>";
|
||||
} else {
|
||||
define('K2_CHECK', 1);
|
||||
$success_style = "style='background: #d2edc9;border: 1px solid #90e772;color: #2b7312;display: block;padding: 8px 10px;'";
|
||||
return "<span $success_style><strong>K2 Component</strong> has been found and is available to use.</span>";
|
||||
}
|
||||
}
|
||||
}
|
132
modules/mod_roktabs/fields/roktabsicons.php
Normal file
132
modules/mod_roktabs/fields/roktabsicons.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: roktabsicons.php 6824 2013-01-28 06:14:09Z btowles $
|
||||
* @author RocketTheme http://www.rockettheme.com
|
||||
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
|
||||
*/
|
||||
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @package RocketTheme
|
||||
* @subpackage roktabs.elements
|
||||
*/
|
||||
class JFormFieldRoktabsicons extends JFormField
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'RokTabsIcons';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $_name = 'roktabsicons';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInput()
|
||||
{
|
||||
$document = JFactory::getDocument();
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
if (!defined('ROKTABS_ICONS')) {
|
||||
define('ROKTABS_ICONS', 1);
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
// Get the current default template
|
||||
$query = ' SELECT template ' . ' FROM #__template_styles ' . ' WHERE client_id = 0 ' . ' AND home = 1 ';
|
||||
$db->setQuery($query);
|
||||
$template = $db->loadResult();
|
||||
|
||||
$path = JURI::Root(true) . "/modules/mod_roktabs/";
|
||||
$document->addStyleSheet($path . 'admin/icons.css');
|
||||
$version = new JVersion();
|
||||
if (version_compare($version->getShortVersion(), '3.0', '<')) {
|
||||
$document->addScript($path . 'admin/icons_25.js');
|
||||
} else {
|
||||
$document->addScript($path . 'admin/icons.js');
|
||||
}
|
||||
$document->addScriptDeclaration("
|
||||
var SitePath = '" . JURI::Root(true) . "', TemplatePath = 'templates/" . $template . "', ModulePath = 'modules/mod_roktabs';
|
||||
window.addEvent('domready', function() {new RokTabsIcons();});
|
||||
");
|
||||
|
||||
}
|
||||
|
||||
$html = "";
|
||||
|
||||
$value = str_replace(" ", "", $this->value);
|
||||
$list = explode(",", $value);
|
||||
|
||||
$i = 0;
|
||||
foreach ($list as $img) {
|
||||
$i++;
|
||||
$html .= "<div class='icons'>";
|
||||
$html .= " <span class='tab_label'>Tab " . $i . ":</span> ";
|
||||
$html .= " <div class='preview_" . $this->id . $i . " icons_previews'></div>";
|
||||
$html .= " <select class='inputbox'>";
|
||||
$html .= $this->loadIcons($this->name, $img, $template);
|
||||
$html .= " </select>";
|
||||
$html .= " <div class='controls'>";
|
||||
$html .= " <span class='add' title='Add new tab icon'></span>";
|
||||
$html .= " <span class='remove' title='Remove current tab icon'></span>";
|
||||
$html .= " </div>";
|
||||
$html .= " <div style='clear: both;'></div>";
|
||||
$html .= "</div>";
|
||||
}
|
||||
|
||||
$html .= "<input id='" . $this->id . "' name='" . $this->name . "' type='hidden' value='" . $value . "' />";
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $template
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function loadIcons($name, $value, $template)
|
||||
{
|
||||
$path = JPATH_SITE . "/modules/mod_roktabs/images/";
|
||||
$urlPath = JURI::Root(true) . "/modules/mod_roktabs/images/";
|
||||
|
||||
if ($this->form->getValue('tabs_iconpath', 'params') != '') {
|
||||
$path = JPATH_SITE . '/' . $this->form->getValue('tabs_iconpath', 'params');
|
||||
$urlPath = JURI::Root(true) . "/" . $this->form->getValue('tabs_iconpath', 'params');
|
||||
}
|
||||
|
||||
$path = str_replace('__template__', 'templates' . '/' . $template, $path);
|
||||
$urlPath = str_replace('__template__', 'templates/' . $template, $urlPath);
|
||||
$path = str_replace('__module__', 'modules/mod_roktabs', $path);
|
||||
$urlPath = str_replace('__module__', 'modules/mod_roktabs', $urlPath);
|
||||
|
||||
$icons = array('__none__');
|
||||
$html = "";
|
||||
|
||||
if ($handle = @opendir($path)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
$ext = strtolower(substr($file, strrpos($file, '.') + 1));
|
||||
if ($ext == 'gif' || $ext == 'bmp' || $ext == 'jpg' || $ext == 'png') {
|
||||
array_push($icons, $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
foreach ($icons as $icon) {
|
||||
if ($icon == $value) $selected = "selected='selected'"; else $selected = "";
|
||||
$html .= "<option alt='" . $urlPath . $icon . "' $selected>" . $icon . "</option>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user