Improved the get snippets area to load one library at a time. started on the adaptation of the compiler that is needed for the new libraries

This commit is contained in:
2017-12-03 20:09:04 +02:00
parent 82df61aa4a
commit 19d4d77305
45 changed files with 1841 additions and 712 deletions

View File

@ -137,48 +137,33 @@ $componentParams = JComponentHelper::getParams('com_componentbuilder');
<script type="text/javascript">
// #jform_datalenght listeners for datalenght_vvvvwaa function
// #jform_datalenght listeners for datalenght_vvvvwab function
jQuery('#jform_datalenght').on('keyup',function()
{
var datalenght_vvvvwaa = jQuery("#jform_datalenght").val();
vvvvwaa(datalenght_vvvvwaa);
var datalenght_vvvvwab = jQuery("#jform_datalenght").val();
vvvvwab(datalenght_vvvvwab);
});
jQuery('#adminForm').on('change', '#jform_datalenght',function (e)
{
e.preventDefault();
var datalenght_vvvvwaa = jQuery("#jform_datalenght").val();
vvvvwaa(datalenght_vvvvwaa);
var datalenght_vvvvwab = jQuery("#jform_datalenght").val();
vvvvwab(datalenght_vvvvwab);
});
// #jform_datadefault listeners for datadefault_vvvvwab function
// #jform_datadefault listeners for datadefault_vvvvwac function
jQuery('#jform_datadefault').on('keyup',function()
{
var datadefault_vvvvwab = jQuery("#jform_datadefault").val();
vvvvwab(datadefault_vvvvwab);
var datadefault_vvvvwac = jQuery("#jform_datadefault").val();
vvvvwac(datadefault_vvvvwac);
});
jQuery('#adminForm').on('change', '#jform_datadefault',function (e)
{
e.preventDefault();
var datadefault_vvvvwab = jQuery("#jform_datadefault").val();
vvvvwab(datadefault_vvvvwab);
});
// #jform_datatype listeners for datatype_vvvvwac function
jQuery('#jform_datatype').on('keyup',function()
{
var datatype_vvvvwac = jQuery("#jform_datatype").val();
vvvvwac(datatype_vvvvwac);
});
jQuery('#adminForm').on('change', '#jform_datatype',function (e)
{
e.preventDefault();
var datatype_vvvvwac = jQuery("#jform_datatype").val();
vvvvwac(datatype_vvvvwac);
var datadefault_vvvvwac = jQuery("#jform_datadefault").val();
vvvvwac(datadefault_vvvvwac);
});
@ -197,97 +182,112 @@ jQuery('#adminForm').on('change', '#jform_datatype',function (e)
});
// #jform_store listeners for store_vvvvwae function
jQuery('#jform_store').on('keyup',function()
{
var store_vvvvwae = jQuery("#jform_store").val();
var datatype_vvvvwae = jQuery("#jform_datatype").val();
vvvvwae(store_vvvvwae,datatype_vvvvwae);
});
jQuery('#adminForm').on('change', '#jform_store',function (e)
{
e.preventDefault();
var store_vvvvwae = jQuery("#jform_store").val();
var datatype_vvvvwae = jQuery("#jform_datatype").val();
vvvvwae(store_vvvvwae,datatype_vvvvwae);
});
// #jform_datatype listeners for datatype_vvvvwae function
jQuery('#jform_datatype').on('keyup',function()
{
var store_vvvvwae = jQuery("#jform_store").val();
var datatype_vvvvwae = jQuery("#jform_datatype").val();
vvvvwae(store_vvvvwae,datatype_vvvvwae);
vvvvwae(datatype_vvvvwae);
});
jQuery('#adminForm').on('change', '#jform_datatype',function (e)
{
e.preventDefault();
var store_vvvvwae = jQuery("#jform_store").val();
var datatype_vvvvwae = jQuery("#jform_datatype").val();
vvvvwae(store_vvvvwae,datatype_vvvvwae);
vvvvwae(datatype_vvvvwae);
});
// #jform_add_css_view listeners for add_css_view_vvvvwag function
// #jform_store listeners for store_vvvvwaf function
jQuery('#jform_store').on('keyup',function()
{
var store_vvvvwaf = jQuery("#jform_store").val();
var datatype_vvvvwaf = jQuery("#jform_datatype").val();
vvvvwaf(store_vvvvwaf,datatype_vvvvwaf);
});
jQuery('#adminForm').on('change', '#jform_store',function (e)
{
e.preventDefault();
var store_vvvvwaf = jQuery("#jform_store").val();
var datatype_vvvvwaf = jQuery("#jform_datatype").val();
vvvvwaf(store_vvvvwaf,datatype_vvvvwaf);
});
// #jform_datatype listeners for datatype_vvvvwaf function
jQuery('#jform_datatype').on('keyup',function()
{
var store_vvvvwaf = jQuery("#jform_store").val();
var datatype_vvvvwaf = jQuery("#jform_datatype").val();
vvvvwaf(store_vvvvwaf,datatype_vvvvwaf);
});
jQuery('#adminForm').on('change', '#jform_datatype',function (e)
{
e.preventDefault();
var store_vvvvwaf = jQuery("#jform_store").val();
var datatype_vvvvwaf = jQuery("#jform_datatype").val();
vvvvwaf(store_vvvvwaf,datatype_vvvvwaf);
});
// #jform_add_css_view listeners for add_css_view_vvvvwah function
jQuery('#jform_add_css_view').on('keyup',function()
{
var add_css_view_vvvvwag = jQuery("#jform_add_css_view input[type='radio']:checked").val();
vvvvwag(add_css_view_vvvvwag);
var add_css_view_vvvvwah = jQuery("#jform_add_css_view input[type='radio']:checked").val();
vvvvwah(add_css_view_vvvvwah);
});
jQuery('#adminForm').on('change', '#jform_add_css_view',function (e)
{
e.preventDefault();
var add_css_view_vvvvwag = jQuery("#jform_add_css_view input[type='radio']:checked").val();
vvvvwag(add_css_view_vvvvwag);
var add_css_view_vvvvwah = jQuery("#jform_add_css_view input[type='radio']:checked").val();
vvvvwah(add_css_view_vvvvwah);
});
// #jform_add_css_views listeners for add_css_views_vvvvwah function
// #jform_add_css_views listeners for add_css_views_vvvvwai function
jQuery('#jform_add_css_views').on('keyup',function()
{
var add_css_views_vvvvwah = jQuery("#jform_add_css_views input[type='radio']:checked").val();
vvvvwah(add_css_views_vvvvwah);
var add_css_views_vvvvwai = jQuery("#jform_add_css_views input[type='radio']:checked").val();
vvvvwai(add_css_views_vvvvwai);
});
jQuery('#adminForm').on('change', '#jform_add_css_views',function (e)
{
e.preventDefault();
var add_css_views_vvvvwah = jQuery("#jform_add_css_views input[type='radio']:checked").val();
vvvvwah(add_css_views_vvvvwah);
var add_css_views_vvvvwai = jQuery("#jform_add_css_views input[type='radio']:checked").val();
vvvvwai(add_css_views_vvvvwai);
});
// #jform_add_javascript_view_footer listeners for add_javascript_view_footer_vvvvwai function
// #jform_add_javascript_view_footer listeners for add_javascript_view_footer_vvvvwaj function
jQuery('#jform_add_javascript_view_footer').on('keyup',function()
{
var add_javascript_view_footer_vvvvwai = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
vvvvwai(add_javascript_view_footer_vvvvwai);
var add_javascript_view_footer_vvvvwaj = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
vvvvwaj(add_javascript_view_footer_vvvvwaj);
});
jQuery('#adminForm').on('change', '#jform_add_javascript_view_footer',function (e)
{
e.preventDefault();
var add_javascript_view_footer_vvvvwai = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
vvvvwai(add_javascript_view_footer_vvvvwai);
var add_javascript_view_footer_vvvvwaj = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
vvvvwaj(add_javascript_view_footer_vvvvwaj);
});
// #jform_add_javascript_views_footer listeners for add_javascript_views_footer_vvvvwaj function
// #jform_add_javascript_views_footer listeners for add_javascript_views_footer_vvvvwak function
jQuery('#jform_add_javascript_views_footer').on('keyup',function()
{
var add_javascript_views_footer_vvvvwaj = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
vvvvwaj(add_javascript_views_footer_vvvvwaj);
var add_javascript_views_footer_vvvvwak = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
vvvvwak(add_javascript_views_footer_vvvvwak);
});
jQuery('#adminForm').on('change', '#jform_add_javascript_views_footer',function (e)
{
e.preventDefault();
var add_javascript_views_footer_vvvvwaj = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
vvvvwaj(add_javascript_views_footer_vvvvwaj);
var add_javascript_views_footer_vvvvwak = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
vvvvwak(add_javascript_views_footer_vvvvwak);
});

View File

@ -64,7 +64,7 @@ class ComponentbuilderViewFieldtype extends JViewLegacy
}
// Get Linked view data
$this->vzwfields = $this->get('Vzwfields');
$this->vzxfields = $this->get('Vzxfields');
// Set the toolbar
$this->addToolBar();

View File

@ -64,7 +64,7 @@ class ComponentbuilderViewFtp extends JViewLegacy
}
// Get Linked view data
$this->vzxlinked_components = $this->get('Vzxlinked_components');
$this->vzylinked_components = $this->get('Vzylinked_components');
// Set the toolbar
$this->addToolBar();

View File

@ -51,10 +51,14 @@ JHtml::_('behavior.keepalive');
</form>
<div id="snippets-github" class="bulk-updater-toggler">
<br /><br /><br />
<center><h1> <?php echo JText::_('COM_COMPONENTBUILDER_THE_SNIPPETS_ARE'); ?> <br /><?php echo JText::_('COM_COMPONENTBUILDER_LOADING'); ?>.<span class="loading-dots">.</span></h1></center>
<center><h1> <?php echo JText::_('COM_COMPONENTBUILDER_GETTING_AVAILABLE_LIBRARIES'); ?> <br /><?php echo JText::_('COM_COMPONENTBUILDER_LOADING'); ?>.<span class="loading-dots">.</span></h1></center>
</div>
<div id="libraries-display" style="display: none;">
<div id="libraries-grid" class="uk-grid uk-grid-preserve uk-grid-width-small-1-1 uk-grid-width-medium-1-3 uk-grid-width-large-1-4" data-uk-grid="{gutter:10}" data-uk-check-display>
</div>
</div>
<div class="bulk-updater-toggler uk-hidden">
<h1><?php echo JText::_('COM_COMPONENTBUILDER_BULK_TOOLS'); ?></h1>
<h1><?php echo JText::_('COM_COMPONENTBUILDER_BULK_TOOLS'); ?></h1>
</div>
<div id="snippets-display" style="display: none;">
<div class="uk-hidden-small">
@ -81,20 +85,6 @@ JHtml::_('behavior.keepalive');
<span class="uk-visible-medium"> <?php echo JText::_('COM_COMPONENTBUILDER_NAME'); ?></span>
</a>
</li>
<li data-uk-sort="snippet-libraries">
<a href="">
<i class="uk-icon-sort-amount-asc"></i>
<span class="uk-hidden-medium"> <?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY_ASC'); ?></span>
<span class="uk-visible-medium"> <?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY'); ?></span>
</a>
</li>
<li data-uk-sort="snippet-libraries:desc">
<a href="">
<i class="uk-icon-sort-amount-desc"></i>
<span class="uk-hidden-medium"> <?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY_DESC'); ?></span>
<span class="uk-visible-medium"> <?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY'); ?></span>
</a>
</li>
<li data-uk-sort="snippet-types">
<a href="">
<i class="uk-icon-sort-amount-asc"></i>
@ -112,6 +102,12 @@ JHtml::_('behavior.keepalive');
</ul>
<div class="uk-navbar-flip">
<ul class="uk-navbar-nav">
<li class="bulk-updater-toggler">
<a class="getreaction" data-type="getLibraries" title="<?php echo JText::_('COM_COMPONENTBUILDER_BACK_TO_LIBRARIES'); ?>">
<i class="uk-icon-puzzle-piece"></i>
<span class="uk-hidden-medium"><?php echo JText::_('COM_COMPONENTBUILDER_LIBRARIES'); ?></span>
</a>
</li>
<li>
<a class="getreaction" data-uk-toggle="{target:'.bulk-updater-toggler', animation:'uk-animation-slide-bottom, uk-animation-slide-bottom'}" data-type="bulk" title="<?php echo JText::_('COM_COMPONENTBUILDER_ACCESS_BULK_TOOLS'); ?>">
<i class="uk-icon-cog"></i>
@ -131,6 +127,7 @@ JHtml::_('behavior.keepalive');
<li data-uk-filter="new"><a href=""><i class="uk-icon-coffee"></i></a></li>
<li data-uk-filter="diverged"><a href=""><i class="uk-icon-code-fork"></i></a></li>
<li data-uk-filter="ahead"><a href=""><i class="uk-icon-joomla"></i></a></li>
<li class="bulk-updater-toggler"><a class="getreaction" data-type="getLibraries" title="<?php echo JText::_('COM_COMPONENTBUILDER_BACK_TO_LIBRARIES'); ?>"><i class="uk-icon-puzzle-piece"></i></a></li>
<li><a class="getreaction" data-uk-toggle="{target:'.bulk-updater-toggler', animation:'uk-animation-slide-bottom, uk-animation-slide-bottom'}" data-type="bulk" title="<?php echo JText::_('COM_COMPONENTBUILDER_ACCESS_BULK_TOOLS'); ?>"><i class="uk-icon-cog"></i></a></li>
</ul>
</nav>
@ -229,6 +226,7 @@ JHtml::_('behavior.keepalive');
<p><?php echo JText::_('COM_COMPONENTBUILDER_WE_DID_NOT_CHECK_THE_SNIPPET_IT_SELF_TO_SEE_IF_IT_CHANGED_WE_ONLY_WORK_ON_DATES'); ?></p>
</div></div>
</div>
<div id="loading" style="display: none;"><br /><h3><?php echo JText::_('COM_COMPONENTBUILDER_PLEASE_WAIT_LOADING'); ?>.<span class="loading-dots">.</span></h3></div>
<script type="text/javascript">
// nice little dot trick :)

View File

@ -173,7 +173,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
else
{
// set to use no storage
$expire = 30000;
$expire = 30000; // only 30 seconds
}
// set snippet path
$this->document->addScriptDeclaration("var snippetPath = '". ComponentbuilderHelper::$snippetPath ."';");
@ -219,6 +219,8 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
$this->document->addScriptDeclaration("var lang_Get_Snippets_Ahead_Tooltip = '".JText::_('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME')."';");
$this->document->addScriptDeclaration("var lang_Get_Snippets_Behind_Tooltip = '".JText::_('COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME')."';");
$this->document->addScriptDeclaration("var lang_Get_Snippets_All_Tooltip = '".JText::_('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME')."';");
$this->document->addScriptDeclaration("var lang_Available_Libraries = '".JText::_('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES')."';");
$this->document->addScriptDeclaration("var lang_Open_Lib_Snippets = '".JText::_('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS')."';");
// add some lang verfy messages
$this->document->addScriptDeclaration("
// set the snippet from gitHub
@ -256,8 +258,14 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
$this->document->addScriptDeclaration("
// start the moment the document is ready
jQuery(document).ready(function () {
getSnippets(snippetsPath);
// just get the available libraries
getLibraries(snippetsPath);
});
// add an ajax call tracker
var ajaxcall = null;
var fromLocal = false;
jQuery(document).ready(function(){
jQuery('body').on('click','.getreaction',function(){
// Ajax request
@ -267,10 +275,15 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
btn.prop('disabled', false);
}, 3000);
var type = btn.data('type');
if ('all' === type) {
if ('getLibraries' === type) {
getLibraries(snippetsPath);
} else if ('getSnippets' === type) {
var name = btn.data('name');
getSnippets(snippetsPath, name);
} else if ('all' === type) {
var status = btn.data('status');
bulkSnippetGithub(status);
} else if ('bulk' === type) {
} else if ('bulk' === type) {
checkBulkSnippetGithub();
} else if ('get' === type) {
var path = btn.data('path');
@ -286,52 +299,35 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// load every thing once ready
jQuery(document).ajaxStop(function () {
if (0 === jQuery.active) {
setTimeout( function() {
//do something special
jQuery('#snippets-github').html('<h1>'+lang_Community_Snippets+'</h1>');
jQuery('#snippets-display').show();
jQuery('#snippets-grid').trigger('display.uk.check');
}, 1000);
//do something special
if ('snippets' === ajaxcall) {
setTimeout( function() {
jQuery('#snippets-github').html('<h1>'+lang_Community_Snippets+'</h1>');
jQuery('#snippets-display').show();
jQuery('#snippets-grid').trigger('display.uk.check');
jQuery('#loading').hide();
}, 1000);
}
}
});
// set the snippet status
function getSnippetStatus(snippet, key) {
// check if JCB already has this snippet
if(local_snippets.hasOwnProperty(key)){
// first get local time stamp
var local_created = strtotime(local_snippets[key].created);
var local_modified = strtotime(local_snippets[key].modified);
// now get github time stamps
var created = strtotime(snippet.created);
var modified = strtotime(snippet.modified);
// work out the status
if (local_created == created) {
if (local_modified == modified) {
return 'equal';
} else if (local_modified > modified) {
return 'ahead';
} else if (local_modified < modified) {
return 'behind';
}
}
return 'diverged';
}
return 'new';
}
// get the snippets
function getSnippets(path) {
// get the libraries
function getLibraries(path) {
var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null);
// always hide the snippets display
jQuery('#snippets-display').hide();
// always reset the grid
jQuery('#libraries-grid').html('');
// set the ajax scope
ajaxcall = 'libraries';
if (_paths) {
setSnippets(_paths);
jQuery('#snippets-github').html('<h1>'+lang_Community_Snippets+'</h1>');
jQuery('#snippets-display').show();
buildLibraries(_paths);
} else {
jQuery.get(path)
.success(function(paths) {
// load only this library paths
jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire});
setSnippets(paths);
buildLibraries(paths);
})
.error(function(jqXHR, textStatus, errorThrown) {
jQuery('#snippets-github').html(returnError);
@ -339,14 +335,105 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
}
}
// build the ibraries object
function buildLibraries(paths) {
var _temp = jQuery.jStorage.get('JCB-Libraries', null);
if (_temp) {
setLibraries(_temp);
} else {
var temp = {};
jQuery.each(paths.tree, function(key,value) {
if (value.path.match(\".json$\")) {
var libName = value.path.split(/ -(.+)/)[0];
libName = libName.trim()
temp[libName] = libName;
}
});
// load only this library paths
jQuery.jStorage.set('JCB-Libraries', temp, {TTL: expire});
setLibraries(temp);
}
}
// set the libraries
function setLibraries(names) {
// now load the lib buttons
jQuery.each(names, function(value) {
setLibrary(value);
});
setTimeout( function() {
jQuery('#snippets-github').html('<h1>'+lang_Available_Libraries+'</h1>');
jQuery('#libraries-display').show();
jQuery('#libraries-grid').trigger('display.uk.check');
}, 1000);
}
// set the snippets
function setSnippets(paths) {
jQuery.each(paths.tree, function(key,value){
if (value.path.indexOf('.json') >= 0) {
function setLibrary(name) {
// get useful ID
var keyID = getKeyID(name);
// build the library display
var html = '<div id=\"'+keyID+'-panel\" class=\"uk-panel\">';
html += '<div class=\"uk-panel uk-panel-box uk-width-1-1\">';
html += '<h3 class=\"uk-panel-title\">' + name + '</h3>';
html += '<hr />';
// set the data buttons
html += setLibButtons(name);
// close the box panel
html += '</div>';
html += '</div>';
// now we have the library
jQuery('#libraries-grid').append(html);
}
function setLibButtons(name) {
return '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-1 getreaction\" data-name=\"'+name+'\" data-type=\"getSnippets\" title=\"'+lang_Description_Tooltip+'\"><i class=\"uk-icon-thumb-tack\"></i><span class=\"uk-hidden-small\"> '+lang_Open_Lib_Snippets+'</span></button>';
}
// get the snippets
function getSnippets(path, libraryName) {
jQuery('#loading').show();
// get local values if set
var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null);
// always reset the grid
jQuery('#snippets-grid').html('');
// always hide libraries
jQuery('#libraries-display').hide();
// set the ajax scope
ajaxcall = 'snippets';
fromLocal = false;
if (_paths) {
setSnippets(_paths, libraryName);
jQuery('#snippets-github').html('<h1>'+lang_Community_Snippets+'</h1>');
} else {
jQuery.get(path)
.success(function(paths) {
// load only this library paths
jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire});
setSnippets(paths, libraryName);
})
.error(function(jqXHR, textStatus, errorThrown) {
jQuery('#snippets-github').html(returnError);
});
}
// only use if loading localy
if (fromLocal) {
jQuery('#snippets-display').show();
jQuery('#snippets-grid').trigger('display.uk.check');
jQuery('#loading').hide();
}
}
// set the snippets
function setSnippets(paths, libraryName) {
// set the ajax scope
ajaxcall = 'snippets';
jQuery.each(paths.tree, function(key,value) {
if (value.path.match(\".json$\") && value.path.match(\"^\"+libraryName)) {
var _snippet = jQuery.jStorage.get(value.path, null);
if (_snippet) {
setSnippet(_snippet, value.path);
jQuery('#snippets-grid').trigger('display.uk.check');
fromLocal = true;
} else {
jQuery.get(snippetPath+value.path)
.success(function(snippet) {
@ -380,9 +467,9 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
html += '<h3 class=\"uk-panel-title\">' + snippet.library+ ' - (' + snippet.type + ') ' + snippet.name + '</h3>';
html += snippet.heading + '<hr />';
// set the data buttons
html += setDataButtons(snippet, key, status)
html += setDataButtons(snippet, key, status);
// set the snippet ref button
html += setRefButtons(snippet, key, status, keyID)
html += setRefButtons(snippet, key, status, keyID);
// set the contributor buttons
html += setContributorButtons(snippet, key);
// close the box panel
@ -392,6 +479,31 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
jQuery('#snippets-grid').append(html);
}
// set the snippet status
function getSnippetStatus(snippet, key) {
// check if JCB already has this snippet
if(local_snippets.hasOwnProperty(key)){
// first get local time stamp
var local_created = strtotime(local_snippets[key].created);
var local_modified = strtotime(local_snippets[key].modified);
// now get github time stamps
var created = strtotime(snippet.created);
var modified = strtotime(snippet.modified);
// work out the status
if (local_created == created) {
if (local_modified == modified) {
return 'equal';
} else if (local_modified > modified) {
return 'ahead';
} else if (local_modified < modified) {
return 'behind';
}
}
return 'diverged';
}
return 'new';
}
function setDataButtons(snippet, key, status) {
var html = '<div class=\"uk-button-group uk-width-1-1 uk-margin-small-bottom\">';
html += '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-3 getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"usage\" title=\"'+lang_Usage_Tooltip+'\"><i class=\"uk-icon-info\"></i><span class=\"uk-hidden-small\"> '+lang_Usage+'</span></button>';
@ -519,6 +631,8 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
}
function doBulkUpdate_server(path, status) {
// set the ajax scope
ajaxcall = null;
var getUrl = \"index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json\";
if (token.length > 0 && path.length > 0 && status.length > 0) {
var request = 'token='+token+'&path='+path+'&status='+status;
@ -554,6 +668,8 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
}
function setSnippetGithub_server(path, status) {
// set the ajax scope
ajaxcall = null;
var getUrl = \"index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json\";
if (token.length > 0 && path.length > 0 && status.length > 0) {
var request = 'token='+token+'&path='+path+'&status='+status;
@ -591,6 +707,8 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// set the modal
function getSnippetModal(key, type) {
// set the ajax scope
ajaxcall = 'snippets';
var _snippet = jQuery.jStorage.get(key, null);
if (_snippet) {
// show modal
@ -647,7 +765,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// get key ID
function getKeyID(key) {
// get useful ID
keyID = key.replace('-', '');
var keyID = key.replace('-', '');
keyID = keyID.replace('.json', '');
keyID = keyID.replace(/\s+/ig, '-');
keyID = keyID.replace(/\(/g, '');
@ -695,6 +813,11 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
{
// add Snippets button.
JToolBarHelper::custom('get_snippets.openSnippets', 'pin', '', 'COM_COMPONENTBUILDER_SNIPPETS', false);
}
if ($this->canDo->get('get_snippets.libraries'))
{
// add Libraries button.
JToolBarHelper::custom('get_snippets.openLibraries', 'puzzle', '', 'COM_COMPONENTBUILDER_LIBRARIES', false);
}
// set help url for this view if found

View File

@ -127,21 +127,6 @@ $componentParams = JComponentHelper::getParams('com_componentbuilder');
<script type="text/javascript">
// #jform_location listeners for location_vvvvwak function
jQuery('#jform_location').on('keyup',function()
{
var location_vvvvwak = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwak(location_vvvvwak);
});
jQuery('#adminForm').on('change', '#jform_location',function (e)
{
e.preventDefault();
var location_vvvvwak = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwak(location_vvvvwak);
});
// #jform_location listeners for location_vvvvwal function
jQuery('#jform_location').on('keyup',function()
{
@ -157,18 +142,18 @@ jQuery('#adminForm').on('change', '#jform_location',function (e)
});
// #jform_type listeners for type_vvvvwam function
jQuery('#jform_type').on('keyup',function()
// #jform_location listeners for location_vvvvwam function
jQuery('#jform_location').on('keyup',function()
{
var type_vvvvwam = jQuery("#jform_type").val();
vvvvwam(type_vvvvwam);
var location_vvvvwam = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwam(location_vvvvwam);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
jQuery('#adminForm').on('change', '#jform_location',function (e)
{
e.preventDefault();
var type_vvvvwam = jQuery("#jform_type").val();
vvvvwam(type_vvvvwam);
var location_vvvvwam = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwam(location_vvvvwam);
});
@ -202,18 +187,33 @@ jQuery('#adminForm').on('change', '#jform_type',function (e)
});
// #jform_target listeners for target_vvvvwap function
// #jform_type listeners for type_vvvvwap function
jQuery('#jform_type').on('keyup',function()
{
var type_vvvvwap = jQuery("#jform_type").val();
vvvvwap(type_vvvvwap);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_vvvvwap = jQuery("#jform_type").val();
vvvvwap(type_vvvvwap);
});
// #jform_target listeners for target_vvvvwaq function
jQuery('#jform_target').on('keyup',function()
{
var target_vvvvwap = jQuery("#jform_target input[type='radio']:checked").val();
vvvvwap(target_vvvvwap);
var target_vvvvwaq = jQuery("#jform_target input[type='radio']:checked").val();
vvvvwaq(target_vvvvwaq);
});
jQuery('#adminForm').on('change', '#jform_target',function (e)
{
e.preventDefault();
var target_vvvvwap = jQuery("#jform_target input[type='radio']:checked").val();
vvvvwap(target_vvvvwap);
var target_vvvvwaq = jQuery("#jform_target input[type='radio']:checked").val();
vvvvwaq(target_vvvvwaq);
});

View File

@ -92,6 +92,9 @@ $edit = "index.php?option=com_componentbuilder&view=libraries&task=library.edit"
<td class="hidden-phone">
<?php echo JText::_($item->how); ?>
</td>
<td class="hidden-phone">
<?php echo JText::_($item->type); ?>
</td>
<td class="center">
<?php if ($canDo->get('library.edit.state')) : ?>
<?php if ($item->checked_out) : ?>

View File

@ -28,5 +28,5 @@ defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
<td colspan="8"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>

View File

@ -52,6 +52,9 @@ defined('_JEXEC') or die('Restricted access');
<th class="nowrap hidden-phone" >
<?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL'); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL', 'type', $this->listDirn, $this->listOrder); ?>
</th>
<?php if ($this->canState): ?>
<th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LIBRARY_STATUS', 'published', $this->listDirn, $this->listOrder); ?>

View File

@ -143,7 +143,12 @@ class ComponentbuilderViewLibraries extends JViewLegacy
{
JToolbarHelper::trash('libraries.trash');
}
}
}
if ($this->user->authorise('library.get_snippets', 'com_componentbuilder'))
{
// add Get Snippets button.
JToolBarHelper::custom('libraries.getSnippets', 'search', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
}
// set help url for this view if found
$help_url = ComponentbuilderHelper::getHelpUrl('libraries');
@ -189,7 +194,51 @@ class ComponentbuilderViewLibraries extends JViewLegacy
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
}
// Set How Selection
$this->howOptions = $this->getTheHowSelections();
if ($this->howOptions)
{
// How Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL').' -',
'filter_how',
JHtml::_('select.options', $this->howOptions, 'value', 'text', $this->state->get('filter.how'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// How Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL').' -',
'batch[how]',
JHtml::_('select.options', $this->howOptions, 'value', 'text')
);
}
}
// Set Type Selection
$this->typeOptions = $this->getTheTypeSelections();
if ($this->typeOptions)
{
// Type Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL').' -',
'filter_type',
JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Type Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL').' -',
'batch[type]',
JHtml::_('select.options', $this->typeOptions, 'value', 'text')
);
}
}
}
/**
@ -234,7 +283,80 @@ class ComponentbuilderViewLibraries extends JViewLegacy
'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_COMPONENTBUILDER_LIBRARY_NAME_LABEL'),
'a.description' => JText::_('COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_LABEL'),
'a.type' => JText::_('COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}
protected function getTheHowSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('how'));
$query->from($db->quoteName('#__componentbuilder_library'));
$query->order($db->quoteName('how') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $how)
{
// Translate the how selection
$text = $model->selectionTranslation($how,'how');
// Now add the how and its text to the options array
$_filter[] = JHtml::_('select.option', $how, JText::_($text));
}
return $_filter;
}
return false;
}
protected function getTheTypeSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('type'));
$query->from($db->quoteName('#__componentbuilder_library'));
$query->order($db->quoteName('type') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -65,7 +65,10 @@ $componentParams = JComponentHelper::getParams('com_componentbuilder');
<?php echo JHtml::_('bootstrap.addTab', 'libraryTab', 'behaviour', JText::_('COM_COMPONENTBUILDER_LIBRARY_BEHAVIOUR', true)); ?>
<div class="row-fluid form-horizontal-desktop">
<div class="span12">
<div class="span6">
<?php echo JLayoutHelper::render('library.behaviour_left', $this); ?>
</div>
<div class="span6">
<?php echo JLayoutHelper::render('library.behaviour_right', $this); ?>
</div>
</div>
@ -147,14 +150,14 @@ $componentParams = JComponentHelper::getParams('com_componentbuilder');
// #jform_how listeners for how_vvvvvzu function
jQuery('#jform_how').on('keyup',function()
{
var how_vvvvvzu = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzu = jQuery("#jform_how").val();
vvvvvzu(how_vvvvvzu);
});
jQuery('#adminForm').on('change', '#jform_how',function (e)
{
e.preventDefault();
var how_vvvvvzu = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzu = jQuery("#jform_how").val();
vvvvvzu(how_vvvvvzu);
});
@ -162,14 +165,14 @@ jQuery('#adminForm').on('change', '#jform_how',function (e)
// #jform_how listeners for how_vvvvvzv function
jQuery('#jform_how').on('keyup',function()
{
var how_vvvvvzv = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzv = jQuery("#jform_how").val();
vvvvvzv(how_vvvvvzv);
});
jQuery('#adminForm').on('change', '#jform_how',function (e)
{
e.preventDefault();
var how_vvvvvzv = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzv = jQuery("#jform_how").val();
vvvvvzv(how_vvvvvzv);
});
@ -177,14 +180,14 @@ jQuery('#adminForm').on('change', '#jform_how',function (e)
// #jform_how listeners for how_vvvvvzw function
jQuery('#jform_how').on('keyup',function()
{
var how_vvvvvzw = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzw = jQuery("#jform_how").val();
vvvvvzw(how_vvvvvzw);
});
jQuery('#adminForm').on('change', '#jform_how',function (e)
{
e.preventDefault();
var how_vvvvvzw = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzw = jQuery("#jform_how").val();
vvvvvzw(how_vvvvvzw);
});
@ -192,14 +195,14 @@ jQuery('#adminForm').on('change', '#jform_how',function (e)
// #jform_how listeners for how_vvvvvzx function
jQuery('#jform_how').on('keyup',function()
{
var how_vvvvvzx = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzx = jQuery("#jform_how").val();
vvvvvzx(how_vvvvvzx);
});
jQuery('#adminForm').on('change', '#jform_how',function (e)
{
e.preventDefault();
var how_vvvvvzx = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzx = jQuery("#jform_how").val();
vvvvvzx(how_vvvvvzx);
});
@ -207,14 +210,14 @@ jQuery('#adminForm').on('change', '#jform_how',function (e)
// #jform_how listeners for how_vvvvvzy function
jQuery('#jform_how').on('keyup',function()
{
var how_vvvvvzy = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzy = jQuery("#jform_how").val();
vvvvvzy(how_vvvvvzy);
});
jQuery('#adminForm').on('change', '#jform_how',function (e)
{
e.preventDefault();
var how_vvvvvzy = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzy = jQuery("#jform_how").val();
vvvvvzy(how_vvvvvzy);
});
@ -222,18 +225,33 @@ jQuery('#adminForm').on('change', '#jform_how',function (e)
// #jform_how listeners for how_vvvvvzz function
jQuery('#jform_how').on('keyup',function()
{
var how_vvvvvzz = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzz = jQuery("#jform_how").val();
vvvvvzz(how_vvvvvzz);
});
jQuery('#adminForm').on('change', '#jform_how',function (e)
{
e.preventDefault();
var how_vvvvvzz = jQuery("#jform_how input[type='radio']:checked").val();
var how_vvvvvzz = jQuery("#jform_how").val();
vvvvvzz(how_vvvvvzz);
});
// #jform_type listeners for type_vvvvwaa function
jQuery('#jform_type').on('keyup',function()
{
var type_vvvvwaa = jQuery("#jform_type input[type='radio']:checked").val();
vvvvwaa(type_vvvvwaa);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_vvvvwaa = jQuery("#jform_type input[type='radio']:checked").val();
vvvvwaa(type_vvvvwaa);
});
<?php $numberAddconditions = range(0, count($this->item->addconditions) + 3, 1);?>