You've already forked joomla_test
first commit
This commit is contained in:
1
plugins/josetta_ext/k2item/fields/index.html
Normal file
1
plugins/josetta_ext/k2item/fields/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
80
plugins/josetta_ext/k2item/fields/k2extrafields.js
Normal file
80
plugins/josetta_ext/k2item/fields/k2extrafields.js
Normal file
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @version $Id: k2extrafields.js 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
$K2(document).ready(function() {
|
||||
extraFields();
|
||||
setTimeout(function() {
|
||||
initExtraFieldsEditor();
|
||||
}, 1000);
|
||||
|
||||
$K2('[id$=josetta_form_catid]').change(function() {
|
||||
if ($K2(this).find('option:selected').attr('disabled')) {
|
||||
alert(K2Language[4]);
|
||||
$K2(this).val('0');
|
||||
return;
|
||||
}
|
||||
extraFields();
|
||||
});
|
||||
});
|
||||
|
||||
function extraFields() {
|
||||
var selectedValue = $K2('[id$=josetta_form_catid]').val();
|
||||
var url = K2BasePath + '/index.php?option=com_k2&view=item&task=extraFields&cid=' + selectedValue + '&id=' + Josetta.josettaItemid;
|
||||
$K2('#extraFieldsContainer').fadeOut('slow', function() {
|
||||
$K2.ajax({
|
||||
url : url,
|
||||
type : 'get',
|
||||
success : function(response) {
|
||||
$K2('#extraFieldsContainer').html(response);
|
||||
initExtraFieldsEditor();
|
||||
$K2('img.calendar').each(function() {
|
||||
inputFieldID = $K2(this).prev().attr('id');
|
||||
imgFieldID = $K2(this).attr('id');
|
||||
Calendar.setup({
|
||||
inputField : inputFieldID,
|
||||
ifFormat : "%Y-%m-%d",
|
||||
button : imgFieldID,
|
||||
align : "Tl",
|
||||
singleClick : true
|
||||
});
|
||||
});
|
||||
$K2('#extraFieldsContainer').fadeIn('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initExtraFieldsEditor() {
|
||||
$K2('.k2ExtraFieldEditor').each(function() {
|
||||
var id = $K2(this).attr('id');
|
||||
if ( typeof tinymce != 'undefined') {
|
||||
if (tinyMCE.get(id)) {
|
||||
tinymce.EditorManager.remove(tinyMCE.get(id));
|
||||
}
|
||||
tinyMCE.execCommand('mceAddControl', false, id);
|
||||
} else {
|
||||
new nicEditor({
|
||||
fullPanel : true,
|
||||
maxHeight : 180,
|
||||
iconsPath : K2BasePath + '/media/k2/assets/images/system/nicEditorIcons.gif'
|
||||
}).panelInstance($K2(this).attr('id'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function syncExtraFieldsEditor() {
|
||||
$K2('.k2ExtraFieldEditor').each(function() {
|
||||
editor = nicEditors.findEditor($K2(this).attr('id'));
|
||||
if ( typeof editor != 'undefined') {
|
||||
if (editor.content == '<br>' || editor.content == '<br />') {
|
||||
editor.setContent('');
|
||||
}
|
||||
editor.saveContent();
|
||||
}
|
||||
});
|
||||
}
|
49
plugins/josetta_ext/k2item/fields/k2extrafields.php
Normal file
49
plugins/josetta_ext/k2item/fields/k2extrafields.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2extrafields.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die ;
|
||||
|
||||
class JFormFieldK2ExtraFields extends JFormField
|
||||
{
|
||||
|
||||
protected $type = 'K2ExtraFields';
|
||||
|
||||
protected function getInput()
|
||||
{
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration('var K2BasePath = "'.JURI::root(true).'";');
|
||||
$document->addScript(JURI::root(true).'/plugins/josetta_ext/k2item/fields/k2extrafields.js');
|
||||
|
||||
K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models');
|
||||
JLoader::register('K2HelperUtilities', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
|
||||
$model = K2Model::getInstance('Item', 'K2Model');
|
||||
$extraFields = $model->getItemExtraFields($this->value);
|
||||
$html = '<div id="extraFieldsContainer">';
|
||||
if (count($extraFields))
|
||||
{
|
||||
$html .= '<table class="admintable" id="extraFields">';
|
||||
foreach ($extraFields as $extraField)
|
||||
{
|
||||
$html .= '<tr>
|
||||
<td align="right" class="key">'.$extraField->name.'</td>
|
||||
<td>'.$extraField->element.'</td>
|
||||
</tr>';
|
||||
}
|
||||
$html .= '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= '<span class="k2Note"> '.JText::_('K2_PLEASE_SELECT_A_CATEGORY_FIRST_TO_RETRIEVE_ITS_RELATED_EXTRA_FIELDS').' </span>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
75
plugins/josetta_ext/k2item/fields/k2languagecategory.php
Normal file
75
plugins/josetta_ext/k2item/fields/k2languagecategory.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2languagecategory.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die ;
|
||||
|
||||
JFormHelper::loadFieldClass('list');
|
||||
JFormHelper::loadFieldClass('category');
|
||||
|
||||
class JFormFieldK2LanguageCategory extends JFormFieldCategory
|
||||
{
|
||||
|
||||
public $type = 'K2LanguageCategory';
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
|
||||
switch ($name)
|
||||
{
|
||||
case 'element' :
|
||||
return $this->$name;
|
||||
break;
|
||||
}
|
||||
|
||||
$value = parent::__get($name);
|
||||
return $value;
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
|
||||
// Initialise variables.
|
||||
$options = array();
|
||||
$published = (string)$this->element['published'];
|
||||
$languages = (string)$this->element['languages'];
|
||||
$name = (string)$this->element['name'];
|
||||
|
||||
// insert custom options passed in xml file
|
||||
$options = array();
|
||||
if (!is_null($this->element->option))
|
||||
{
|
||||
foreach ($this->element->option as $option)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $option->getAttribute('value'), JText::_($option->data()));
|
||||
}
|
||||
}
|
||||
|
||||
// Filter over published state or not depending upon if it is present.
|
||||
// include k2item helper, which has the method we want
|
||||
require_once JPATH_PLUGINS.'/josetta_ext/k2item/helpers/helper.php';
|
||||
if ($published)
|
||||
{
|
||||
$categoriesoptions = JosettaK2ItemHelper::getCategoryOptionsPerLanguage(array('filter.published' => explode(',', $published), 'filter.languages' => explode(',', $languages)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$categoriesoptions = JosettaK2ItemHelper::getCategoryOptionsPerLanguage(array('filter.languages' => explode(',', $languages)));
|
||||
}
|
||||
|
||||
$options = array_merge($options, $categoriesoptions);
|
||||
|
||||
if (!empty($this->element['show_root']) && strtolower($this->element['show_root']) == 'yes')
|
||||
{
|
||||
array_unshift($options, JHtml::_('select.option', '0', JText::_('JGLOBAL_ROOT')));
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
}
|
124
plugins/josetta_ext/k2item/fields/k2tags.css
Normal file
124
plugins/josetta_ext/k2item/fields/k2tags.css
Normal file
@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @version $Id: k2tags.css 1812 2013-01-14 18:45:06Z lefteris.kavadas $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
.ui-autocomplete {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
border: 1px solid #eee;
|
||||
background-color: white;
|
||||
border-right-color: #ddd;
|
||||
border-bottom-color: #ddd;
|
||||
text-align: left;sans-serif;
|
||||
z-index: 50;
|
||||
}
|
||||
* html .ui-autocomplete {
|
||||
width: 1px;
|
||||
}/* without this, the menu expands to 100% in IE6 */
|
||||
.ui-menu {
|
||||
list-style: none;
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
margin-top: -3px;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
.ui-menu .ui-menu-item {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
zoom: 0;
|
||||
float: left;
|
||||
clear: left;
|
||||
width: 99%;
|
||||
}
|
||||
.ui-menu .ui-menu-item a {
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
padding: .2em .4em;
|
||||
line-height: 1.5;
|
||||
zoom: 1;
|
||||
font-weight: bold;
|
||||
}
|
||||
.ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-active {
|
||||
margin: -1px;
|
||||
background-color: #444;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
ul.tags {
|
||||
background: #fff;
|
||||
border: 1px solid #c0c0c0;
|
||||
padding: 0;
|
||||
cursor: default;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 99%;
|
||||
}
|
||||
ul.tags li {
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
background: #cfe4fa;
|
||||
color: #222;
|
||||
border: 1px solid #b0d2f9;
|
||||
padding: 2px 4px 4px;
|
||||
list-style: none;
|
||||
float: left;
|
||||
clear: none;
|
||||
height: 18px;
|
||||
margin: 2px 1px 1px;
|
||||
}
|
||||
ul.tags li span.tagRemove {
|
||||
color: #5279a1;
|
||||
padding-left: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
ul.tags li span.tagRemove:hover {
|
||||
color: #505050;
|
||||
cursor: pointer;
|
||||
}
|
||||
ul.tags li input {
|
||||
border: none;
|
||||
padding-top: 2px;
|
||||
background: none;
|
||||
float: left;
|
||||
clear: none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
height:18px;
|
||||
}
|
||||
ul.tags li input:focus {
|
||||
background: none;
|
||||
}
|
||||
ul.tags li input.tagsLoading {
|
||||
background: url(../../../../media/k2/assets/images/system/loader.gif) no-repeat 50% 50%;
|
||||
}
|
||||
ul.tags li.clr {
|
||||
clear: both;
|
||||
height: 0;
|
||||
line-height: 0;
|
||||
border: none;
|
||||
float: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
ul.tags li.tagAdd {
|
||||
border-color: #fff;
|
||||
background: none;
|
||||
}
|
||||
ul.tags li.tagAdd input {
|
||||
border: none;
|
||||
}
|
||||
span.k2Note {
|
||||
display: block;
|
||||
padding: 4px 0 0 0;
|
||||
font-style: italic;
|
||||
color: #777;
|
||||
}
|
80
plugins/josetta_ext/k2item/fields/k2tags.js
Normal file
80
plugins/josetta_ext/k2item/fields/k2tags.js
Normal file
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @version $Id: k2tags.js 1919 2013-02-11 19:02:02Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
$K2(document).ready(function() {
|
||||
|
||||
// Generic function to get URL params passed in .js script include
|
||||
function getUrlParams(targetScript, varName) {
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
var scriptCount = scripts.length;
|
||||
for (var a = 0; a < scriptCount; a++) {
|
||||
var scriptSrc = scripts[a].src;
|
||||
if (scriptSrc.indexOf(targetScript) >= 0) {
|
||||
varName = varName.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||
var re = new RegExp("[\\?&]" + varName + "=([^&#]*)");
|
||||
var parsedVariables = re.exec(scriptSrc);
|
||||
if (parsedVariables !== null) {
|
||||
return parsedVariables[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the site root path
|
||||
var K2SitePath = getUrlParams('k2.js', 'sitepath');
|
||||
|
||||
$K2('.tagRemove').click(function(event) {
|
||||
event.preventDefault();
|
||||
$K2(this).parent().remove();
|
||||
});
|
||||
|
||||
/*
|
||||
$K2('ul.tags').click(function() {
|
||||
//$K2('#search-field').focus();
|
||||
});
|
||||
*/
|
||||
|
||||
$K2('.k2-search-field').keypress(function(event) {
|
||||
if (event.which == '13') {
|
||||
if ($K2(this).val() != '') {
|
||||
$K2('<li id="' + this.attributes['rel'].value + '_tagAdd" class="addedTag">' + $K2(this).val() + '<span class="tagRemove" onclick="Josetta.itemChanged('+this.id+');$K2(this).parent().remove();">x</span><input type="hidden" value="' + $K2(this).val() + '" name="'+this.attributes['rel'].value + '[tags][]"></li>').insertBefore('.tags #' + this.attributes['rel'].value + '_tagAdd.tagAdd');
|
||||
Josetta.itemChanged(this);
|
||||
$K2(this).val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$K2('.k2-search-field').autocomplete({
|
||||
source : function(request, response) {
|
||||
var target = this.element[0];
|
||||
$K2.ajax({
|
||||
type : 'post',
|
||||
url : K2SitePath + 'index.php?option=com_k2&view=item&task=tags',
|
||||
data : 'q=' + request.term,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
target.removeClass('tagsLoading');
|
||||
response($K2.map(data, function(item) {
|
||||
return item;
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength : 3,
|
||||
select : function(event, ui) {
|
||||
$K2('<li id="' + this.attributes['rel'].value + '_tagAdd" class="addedTag">' + ui.item.label + '<span class="tagRemove" onclick="Josetta.itemChanged('+this.id+');$K2(this).parent().remove();">x</span><input type="hidden" value="' + ui.item.value + '" name="'+this.attributes['rel'].value + '[tags][]"></li>').insertBefore('.tags #' + this.attributes['rel'].value + '_tagAdd.tagAdd');
|
||||
Josetta.itemChanged(this);
|
||||
this.value = '';
|
||||
return false;
|
||||
},
|
||||
search : function(event, ui) {
|
||||
event.target.addClass('tagsLoading');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
42
plugins/josetta_ext/k2item/fields/k2tags.php
Normal file
42
plugins/josetta_ext/k2item/fields/k2tags.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: k2tags.php 1978 2013-05-15 19:34:16Z joomlaworks $
|
||||
* @package K2
|
||||
* @author JoomlaWorks http://www.joomlaworks.net
|
||||
* @copyright Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
|
||||
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die ;
|
||||
|
||||
class JFormFieldK2Tags extends JFormField
|
||||
{
|
||||
|
||||
protected $type = 'K2Tags';
|
||||
|
||||
protected function getInput()
|
||||
{
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet(JURI::root(true).'/plugins/josetta_ext/k2item/fields/k2tags.css?v=2.6.7');
|
||||
$document->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js');
|
||||
$document->addScript(JURI::root(true).'/plugins/josetta_ext/k2item/fields/k2tags.js?v=2.6.7&sitepath='.JURI::root(true).'/');
|
||||
|
||||
$html = '<ul class="tags">';
|
||||
$tags = explode(',', $this->value);
|
||||
if (count($tags))
|
||||
{
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$tag = JString::trim($tag);
|
||||
$html .= '<li id="'.$this->formControl.'_tagAdd" class="tagAdded">'.$tag.'<span title="'.JText::_('K2_CLICK_TO_REMOVE_TAG').'" onclick="Josetta.itemChanged(\'' . $this->id . '\');" class="tagRemove">x</span><input type="hidden" name="'.$this->name.'[]" value="'.$tag.'" /></li>';
|
||||
}
|
||||
|
||||
}
|
||||
$html .= '<li id="'.$this->formControl.'_tagAdd" class="tagAdd"><input type="text" id="' . $this->id . '" rel="' . $this->formControl . '" class="k2-search-field" /></li>
|
||||
<li class="clr"></li>
|
||||
</ul>
|
||||
<span class="k2Note"> '.JText::_('K2_WRITE_A_TAG_AND_PRESS_RETURN_OR_COMMA_TO_ADD_IT').' </span>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user