Updated the compiler to also target JText::script() & Joomla.JText._() in language constant replacement. Added field counter. Resolved gh-198

This commit is contained in:
Llewellyn van der Merwe 2017-12-14 15:30:21 +02:00
parent 20f5a083f0
commit 95716e22cf
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
11 changed files with 250 additions and 103 deletions

View File

@ -111,11 +111,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](http://vdm.bz/component-builder) + *Name*: [Component Builder](http://vdm.bz/component-builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 12th December, 2017 + *Last Build*: 14th December, 2017
+ *Version*: 2.6.6 + *Version*: 2.6.6
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **177938** + *Line count*: **177939**
+ *File count*: **1142** + *File count*: **1142**
+ *Folder count*: **184** + *Folder count*: **184**

View File

@ -111,11 +111,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](http://vdm.bz/component-builder) + *Name*: [Component Builder](http://vdm.bz/component-builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 12th December, 2017 + *Last Build*: 14th December, 2017
+ *Version*: 2.6.6 + *Version*: 2.6.6
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **177938** + *Line count*: **177939**
+ *File count*: **1142** + *File count*: **1142**
+ *Folder count*: **184** + *Folder count*: **184**

View File

@ -105,6 +105,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$message .= '<ul>'; $message .= '<ul>';
$message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>'; $message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>';
$message .= '<li>Total files created: <b>'.$model->compiler->fileCount.'</b></li>'; $message .= '<li>Total files created: <b>'.$model->compiler->fileCount.'</b></li>';
$message .= '<li>Total fields created: <b>'.$model->compiler->fieldCount.'</b></li>';
$message .= '<li>Total lines written: <b>'.$model->compiler->lineCount.'</b></li>'; $message .= '<li>Total lines written: <b>'.$model->compiler->lineCount.'</b></li>';
$message .= '<li>A4 Book of: <b>'.$model->compiler->pageCount.' pages</b></li>'; $message .= '<li>A4 Book of: <b>'.$model->compiler->pageCount.' pages</b></li>';
$message .= '</ul>'; $message .= '</ul>';

View File

@ -150,12 +150,12 @@ class ComponentbuilderControllerSnippets extends JControllerAdmin
if (count($pks) > 1) if (count($pks) > 1)
{ {
$message = '<h1>' . JText::_('COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED') . '</h1>'; $message = '<h1>' . JText::_('COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED') . '</h1>';
$message .= '<p>' . JText::sprintf('To share these snippets with the rest of the JCB community,'); $message .= '<p>' . JText::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY');
} }
else else
{ {
$message = '<h1>' . JText::_('COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED') . '</h1>'; $message = '<h1>' . JText::_('COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED') . '</h1>';
$message .= '<p>' . JText::sprintf('To share this snippet with the rest of the JCB community,'); $message .= '<p>' . JText::sprintf('COM_COMPONENTBUILDER_TO_SHARE_THIS_SNIPPET_WITH_THE_REST_OF_THE_JCB_COMMUNITY');
} }
$message .= JText::sprintf('COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_A_S_ACCOUNT_AND_KNOW_HOW_TO_MAKE_A_PULL_REQUEST_ON_GITHUB', $message .= JText::sprintf('COM_COMPONENTBUILDER_YOU_WILL_NEED_TO_KNOW_HOW_S_WORKS_BASIC_YOU_WILL_ALSO_NEED_A_S_ACCOUNT_AND_KNOW_HOW_TO_MAKE_A_PULL_REQUEST_ON_GITHUB',
'<a href="https://try.github.io" target="_blank">git</a>', '<a href="https://try.github.io" target="_blank">git</a>',

View File

@ -146,6 +146,38 @@ class Compiler extends Infusion
// done with error // done with error
return false; return false;
} }
// do lang mismatch check
if (ComponentbuilderHelper::checkArray($this->langMismatch))
{
if (ComponentbuilderHelper::checkArray($this->langMatch))
{
$mismatch = array_diff(array_unique($this->langMismatch), array_unique($this->langMatch));
}
else
{
$mismatch = array_unique($this->langMismatch);
}
// set a notice if we have a mismatch
if (ComponentbuilderHelper::checkArray($mismatch))
{
if (count($mismatch) > 1)
{
$this->app->enqueueMessage(JText::_('<h3>Please check the following mismatching Joomla.JText language constants.</h3>'), 'Warning');
}
else
{
$this->app->enqueueMessage(JText::_('<h3>Please check the following mismatch Joomla.JText language constant.</h3>'), 'Warning');
}
// add the mismatching issues
foreach ($mismatch as $string)
{
$constant = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($string,'U');
$this->app->enqueueMessage(JText::sprintf('The <b>Joomla.JText._(\'%s\')</b> language constant for (%s) does not have a corresponding JText::Script() decalaration.',
$constant, $string), 'Warning');
}
$this->app->enqueueMessage('<hr />', 'Warning');
}
}
// end the timer here // end the timer here
$this->time_end = microtime(true); $this->time_end = microtime(true);
$this->secondsCompiled = $this->time_end - $this->time_start; $this->secondsCompiled = $this->time_end - $this->time_start;
@ -396,6 +428,7 @@ class Compiler extends Infusion
{ {
// set some defaults // set some defaults
$this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount; $this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount;
$this->fileContentStatic['###FIELD_COUNT###'] = $this->fieldCount;
$this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount; $this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount;
$this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount; $this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount;
$this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount; $this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount;

View File

@ -218,6 +218,32 @@ class Get
*/ */
protected $existingLangStrings = array(); protected $existingLangStrings = array();
/**
* The Language JS matching check
*
* @var array
*/
public $langMismatch = array();
/**
* The Language SC matching check
*
* @var array
*/
public $langMatch = array();
/**
* The Language string targets
*
* @var array
*/
public $langStringTargets = array(
'Joomla.JText._(',
'JText::script(',
'JText::_(',
'JText::sprintf('
);
/** /**
* The Component Code Name * The Component Code Name
* *
@ -1773,18 +1799,6 @@ class Get
$this->getModule[$this->target][$view->code] = true; $this->getModule[$this->target][$view->code] = true;
} }
} }
// (TODO) we may want to automate this .... lets see if someone asks
// if (strpos($view->$scripter,"token") !== false || strpos($view->$scripter,"task=ajax") !== false)
// {
// if(!isset($this->customScriptBuilder['token']))
// {
// $this->customScriptBuilder['token'] = array();
// }
// if (!isset($this->customScriptBuilder['token'][$this->target.$view->code]) || !$this->customScriptBuilder['token'][$this->target.$view->code])
// {
// $this->customScriptBuilder['token'][$this->target.$view->code] = true;
// }
// }
} }
} }
// add_Ajax for this view // add_Ajax for this view
@ -3109,18 +3123,64 @@ class Get
*/ */
public function setLangStrings($content) public function setLangStrings($content)
{ {
// first check if we should continue // get targets to search for
if (strpos($content, 'JText::_(') !== false || strpos($content, 'JText::sprintf(') !== false) $langStringTargets = array_filter(
$this->langStringTargets,
function($get) use($content){
if (strpos($content, $get) !== false)
{
return true;
}
return false;
});
// check if we should continue
if (ComponentbuilderHelper::checkArray($langStringTargets))
{ {
// insure string is not broken // insure string is not broken
$content = str_replace('COM_###COMPONENT###',$this->langPrefix,$content); $content = str_replace('COM_###COMPONENT###',$this->langPrefix,$content);
// first get the Joomla.JText._()
if (in_array('Joomla.JText._(',$langStringTargets))
{
$jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, "Joomla.JText._('","'");
$jsTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'Joomla.JText._("','"');
// combine into one array
$jsTEXT = ComponentbuilderHelper::mergeArrays($jsTEXT);
// we need to add a check to insure these JavaScript lang matchup
if (ComponentbuilderHelper::checkArray($jsTEXT)) //<-- not really needed hmmm
{
// load the JS text to mismatch array
$langCheck[] = $jsTEXT;
$this->langMismatch = ComponentbuilderHelper::mergeArrays(array($jsTEXT, $this->langMismatch));
}
}
// now get the JText::script()
if (in_array('JText::script(',$langStringTargets))
{
$scTEXT[] = ComponentbuilderHelper::getAllBetween($content, "JText::script('","'");
$scTEXT[] = ComponentbuilderHelper::getAllBetween($content, 'JText::script("','"');
// combine into one array
$scTEXT = ComponentbuilderHelper::mergeArrays($scTEXT);
// we need to add a check to insure these JavaScript lang matchup
if (ComponentbuilderHelper::checkArray($scTEXT)) //<-- not really needed hmmm
{
// load the Script text to match array
$langCheck[] = $scTEXT;
$this->langMatch = ComponentbuilderHelper::mergeArrays(array($scTEXT, $this->langMatch));
}
}
// set language data // set language data
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, "JText::_('","'"); foreach($langStringTargets as $langStringTarget)
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, 'JText::_("','"'); {
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, "JText::sprintf('","'"); // need some special treatment here
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, 'JText::sprintf("','"'); if ($langStringTarget === 'Joomla.JText._(' || $langStringTarget === 'JText::script(')
{
continue;
}
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget."'","'");
$langCheck[] = ComponentbuilderHelper::getAllBetween($content, $langStringTarget.'"','"');
}
$langArray = ComponentbuilderHelper::mergeArrays($langCheck); $langArray = ComponentbuilderHelper::mergeArrays($langCheck);
if (ComponentbuilderHelper::checkArray($langArray)) if (ComponentbuilderHelper::checkArray($langArray)) //<-- not really needed hmmm
{ {
foreach ($langArray as $string) foreach ($langArray as $string)
{ {
@ -3135,10 +3195,12 @@ class Get
{ {
$this->langContent[$this->lang][$keyLang] = trim($string); $this->langContent[$this->lang][$keyLang] = trim($string);
} }
$langHolders["JText::_('".$string."')"] = "JText::_('".$keyLang."')"; // load the language targets
$langHolders['JText::_("'.$string.'")'] = 'JText::_("'.$keyLang.'")'; foreach($langStringTargets as $langStringTarget)
$langHolders["JText::sprintf('".$string."',"] = "JText::sprintf('".$keyLang."',"; {
$langHolders['JText::sprintf("'.$string.'",'] = 'JText::sprintf("'.$keyLang.'",'; $langHolders[$langStringTarget."'".$string."'"] = $langStringTarget."'".$keyLang."'";
$langHolders[$langStringTarget.'"'.$string.'"'] = $langStringTarget.'"'.$keyLang.'"';
}
} }
// only continue if we have value to replace // only continue if we have value to replace
if (isset($langHolders) && ComponentbuilderHelper::checkArray($langHolders)) if (isset($langHolders) && ComponentbuilderHelper::checkArray($langHolders))
@ -4772,21 +4834,33 @@ class Get
*/ */
protected function setReverseLangPlaceholders($updateString, $string) protected function setReverseLangPlaceholders($updateString, $string)
{ {
if (strpos($string, 'JText::_(') !== false || strpos($string, 'JText::sprintf(') !== false) // get targets to search for
$langStringTargets = array_filter(
$this->langStringTargets,
function($get) use($string){
if (strpos($string, $get) !== false)
{
return true;
}
return false;
});
// check if we should continue
if (ComponentbuilderHelper::checkArray($langStringTargets))
{ {
$langHolders = array(); $langHolders = array();
// set the lang for both since we don't know what area is being targeted // set the lang for both since we don't know what area is being targeted
$_tmp = $this->lang; $_tmp = $this->lang;
$this->lang = 'both'; $this->lang = 'both';
// set language data // set language data
$langCheck[] = ComponentbuilderHelper::getAllBetween($string, "JText::_('","'"); foreach($langStringTargets as $langStringTarget)
$langCheck[] = ComponentbuilderHelper::getAllBetween($string, 'JText::_("','"'); {
$langCheck[] = ComponentbuilderHelper::getAllBetween($string, "JText::sprintf('","'"); $langCheck[] = ComponentbuilderHelper::getAllBetween($string, $langStringTarget."'","'");
$langCheck[] = ComponentbuilderHelper::getAllBetween($string, 'JText::sprintf("','"'); $langCheck[] = ComponentbuilderHelper::getAllBetween($string, $langStringTarget."'","'");
}
// merge arrays // merge arrays
$langArray = ComponentbuilderHelper::mergeArrays($langCheck); $langArray = ComponentbuilderHelper::mergeArrays($langCheck);
// continue only if strings were found // continue only if strings were found
if (ComponentbuilderHelper::checkArray($langArray)) if (ComponentbuilderHelper::checkArray($langArray)) //<-- not really needed hmmm
{ {
foreach ($langArray as $lang) foreach ($langArray as $lang)
{ {
@ -4803,10 +4877,11 @@ class Get
$this->langContent[$this->lang][$keyLang] = trim($lang); $this->langContent[$this->lang][$keyLang] = trim($lang);
} }
// reverse the placeholders // reverse the placeholders
$langHolders["JText::_('".$keyLang."')"] = "JText::_('".$lang."')"; foreach($langStringTargets as $langStringTarget)
$langHolders['JText::_("'.$keyLang.'")'] = 'JText::_("'.$lang.'")'; {
$langHolders["JText::sprintf('".$keyLang."',"] = "JText::sprintf('".$lang."',"; $langHolders[$langStringTarget."'".$keyLang."'"] = $langStringTarget."'".$lang."'";
$langHolders['JText::sprintf("'.$keyLang.'",'] = 'JText::sprintf("'.$lang.'",'; $langHolders[$langStringTarget.'"'.$keyLang.'"'] = $langStringTarget.'"'.$lang.'"';
}
} }
// return the found placeholders // return the found placeholders
$updateString = $this->setPlaceholders($updateString, $langHolders); $updateString = $this->setPlaceholders($updateString, $langHolders);

View File

@ -59,6 +59,13 @@ class Structure extends Get
*/ */
public $lineCount = 0; public $lineCount = 0;
/**
* The field counter
*
* @var int
*/
public $fieldCount = 0;
/** /**
* The seconds counter * The seconds counter
* *

View File

@ -497,6 +497,8 @@ class Fields extends Structure
); );
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// if created is not set // if created is not set
if (!isset($this->fieldsNames[$viewName]['created'])) if (!isset($this->fieldsNames[$viewName]['created']))
@ -514,6 +516,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// if created_by is not set // if created_by is not set
if (!isset($this->fieldsNames[$viewName]['created_by'])) if (!isset($this->fieldsNames[$viewName]['created_by']))
@ -528,6 +532,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// if published is not set // if published is not set
if (!isset($this->fieldsNames[$viewName]['published'])) if (!isset($this->fieldsNames[$viewName]['published']))
@ -541,6 +547,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value) foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value)
{ {
$optionXML = $fieldXML->addChild('option'); $optionXML = $fieldXML->addChild('option');
@ -565,6 +573,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// if modified_by is not set // if modified_by is not set
if (!isset($this->fieldsNames[$viewName]['modified_by'])) if (!isset($this->fieldsNames[$viewName]['modified_by']))
@ -581,6 +591,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// check if view has access // check if view has access
if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access'])) if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access']))
@ -597,6 +609,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// if ordering is not set // if ordering is not set
if (!isset($this->fieldsNames[$viewName]['ordering'])) if (!isset($this->fieldsNames[$viewName]['ordering']))
@ -615,6 +629,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// if version is not set // if version is not set
if (!isset($this->fieldsNames[$viewName]['version'])) if (!isset($this->fieldsNames[$viewName]['version']))
@ -632,6 +648,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// check if metadata is added to this view // check if metadata is added to this view
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName])) if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
@ -648,6 +666,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
// metadesc // metadesc
$attributes['name'] = 'metadesc'; $attributes['name'] = 'metadesc';
$attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL'; $attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
@ -655,6 +675,8 @@ class Fields extends Structure
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)"); $this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)");
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
$this->xmlAddAttributes($fieldXML, $attributes); $this->xmlAddAttributes($fieldXML, $attributes);
// count the static field created
$this->fieldCount++;
} }
// load the dynamic fields now // load the dynamic fields now
if (count($dynamicFieldsXML)) if (count($dynamicFieldsXML))
@ -685,6 +707,8 @@ class Fields extends Structure
'description' => 'JFIELD_METADATA_ROBOTS_DESC' 'description' => 'JFIELD_METADATA_ROBOTS_DESC'
); );
$this->xmlAddAttributes($robots, $attributes); $this->xmlAddAttributes($robots, $attributes);
// count the static field created
$this->fieldCount++;
$options = array( $options = array(
'JGLOBAL_USE_GLOBAL' => '', 'JGLOBAL_USE_GLOBAL' => '',
'JGLOBAL_INDEX_FOLLOW' => 'index, follow', 'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
@ -709,6 +733,8 @@ class Fields extends Structure
'size' => 20 'size' => 20
); );
$this->xmlAddAttributes($author, $attributes); $this->xmlAddAttributes($author, $attributes);
// count the static field created
$this->fieldCount++;
// rights // rights
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)"); $this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
$rights = $fieldsFieldSetXML->addChild('field'); $rights = $fieldsFieldSetXML->addChild('field');
@ -723,6 +749,8 @@ class Fields extends Structure
'rows' => 2 'rows' => 2
); );
$this->xmlAddAttributes($rights, $attributes); $this->xmlAddAttributes($rights, $attributes);
// count the static field created
$this->fieldCount++;
} }
// just to be safe, lets clear the view placeholders // just to be safe, lets clear the view placeholders
$this->clearFromPlaceHolders('view'); $this->clearFromPlaceHolders('view');
@ -2342,7 +2370,8 @@ class Fields extends Structure
public function xmlAppend(&$xml, $node) public function xmlAppend(&$xml, $node)
{ {
if (!$node) if (!$node)
{ // element was not returned {
// element was not returned
return; return;
} }
switch (get_class($node)) switch (get_class($node))
@ -2364,6 +2393,8 @@ class Fields extends Structure
$xml = simplexml_import_dom($domXML); $xml = simplexml_import_dom($domXML);
break; break;
} }
// count the dynamic fields created
$this->fieldCount++;
} }
/** /**

View File

@ -189,38 +189,38 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// set an error message if needed // set an error message if needed
$this->document->addScriptDeclaration("var returnError = '<div class=\"uk-alert uk-alert-warning\"><h1>".JText::_('COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED')."!</h1><p>".JText::_('COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER').".</p></div>';"); $this->document->addScriptDeclaration("var returnError = '<div class=\"uk-alert uk-alert-warning\"><h1>".JText::_('COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED')."!</h1><p>".JText::_('COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER').".</p></div>';");
// need to add some language strings // need to add some language strings
$this->document->addScriptDeclaration("var lang_Community_Snippets = '".JText::_('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')."';"); JText::script('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS');
$this->document->addScriptDeclaration("var lang_Snippets = '".JText::_('COM_COMPONENTBUILDER_SNIPPETS')."';"); JText::script('COM_COMPONENTBUILDER_SNIPPETS');
$this->document->addScriptDeclaration("var lang_Snippet = '".JText::_('COM_COMPONENTBUILDER_SNIPPET')."';"); JText::script('COM_COMPONENTBUILDER_SNIPPET');
$this->document->addScriptDeclaration("var lang_Snippet_Tooltip = '".JText::_('COM_COMPONENTBUILDER_VIEW_SNIPPET_OF_COMMUNITY_VERSION')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_SNIPPET_OF_COMMUNITY_VERSION');
$this->document->addScriptDeclaration("var lang_Get_Snippet = '".JText::_('COM_COMPONENTBUILDER_GET_SNIPPET')."';"); JText::script('COM_COMPONENTBUILDER_GET_SNIPPET');
$this->document->addScriptDeclaration("var lang_Dont_Get_Snippet = '".JText::_('COM_COMPONENTBUILDER_LOCAL_SNIPPET')."';"); JText::script('COM_COMPONENTBUILDER_LOCAL_SNIPPET');
$this->document->addScriptDeclaration("var lang_Get_Snippet_Tooltip = '".JText::_('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION')."';"); JText::script('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION');
$this->document->addScriptDeclaration("var lang_Get_Snippet_New_Tooltip = '".JText::_('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY')."';"); JText::script('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY');
$this->document->addScriptDeclaration("var lang_Get_Snippet_Dont_Tooltip = '".JText::_('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION')."';"); JText::script('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION');
$this->document->addScriptDeclaration("var lang_Usage = '".JText::_('COM_COMPONENTBUILDER_USAGE')."';"); JText::script('COM_COMPONENTBUILDER_USAGE');
$this->document->addScriptDeclaration("var lang_Usage_Tooltip = '".JText::_('COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION');
$this->document->addScriptDeclaration("var lang_Description = '".JText::_('COM_COMPONENTBUILDER_DESCRIPTION')."';"); JText::script('COM_COMPONENTBUILDER_DESCRIPTION');
$this->document->addScriptDeclaration("var lang_Description_Tooltip = '".JText::_('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION');
$this->document->addScriptDeclaration("var lang_View_Blame = '".JText::_('COM_COMPONENTBUILDER_VIEW_BLAME')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_BLAME');
$this->document->addScriptDeclaration("var lang_View_Blame_Tooltip = '".JText::_('COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET');
$this->document->addScriptDeclaration("var lang_URL_Tooltip = '".JText::_('COM_COMPONENTBUILDER_VIEW_SNIPPET_REFERENCE_URL')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_SNIPPET_REFERENCE_URL');
$this->document->addScriptDeclaration("var lang_Update_Error_Tooltip = '".JText::_('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED')."';"); JText::script('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED');
$this->document->addScriptDeclaration("var lang_Updates_Error_Tooltip = '".JText::_('COM_COMPONENTBUILDER_SNIPPETS_COULD_NOT_BE_UPDATEDSAVED')."';"); JText::script('COM_COMPONENTBUILDER_SNIPPETS_COULD_NOT_BE_UPDATEDSAVED');
$this->document->addScriptDeclaration("var lang_Contributor_URL_Tooltip = '".JText::_('COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR')."';"); JText::script('COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR');
$this->document->addScriptDeclaration("var lang_Contributor_Modal_Tooltip = '".JText::_('COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS')."';"); JText::script('COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS');
$this->document->addScriptDeclaration("var lang_JCB_Community = '".JText::_('COM_COMPONENTBUILDER_JCB_COMMUNITY')."';"); JText::script('COM_COMPONENTBUILDER_JCB_COMMUNITY');
$this->document->addScriptDeclaration("var lang_Company_Name = '".JText::_('COM_COMPONENTBUILDER_COMPANY_NAME')."';"); JText::script('COM_COMPONENTBUILDER_COMPANY_NAME');
$this->document->addScriptDeclaration("var lang_Author_Name = '".JText::_('COM_COMPONENTBUILDER_AUTHOR_NAME')."';"); JText::script('COM_COMPONENTBUILDER_AUTHOR_NAME');
$this->document->addScriptDeclaration("var lang_Author_Email = '".JText::_('COM_COMPONENTBUILDER_AUTHOR_EMAIL')."';"); JText::script('COM_COMPONENTBUILDER_AUTHOR_EMAIL');
$this->document->addScriptDeclaration("var lang_Author_Website = '".JText::_('COM_COMPONENTBUILDER_AUTHOR_WEBSITE')."';"); JText::script('COM_COMPONENTBUILDER_AUTHOR_WEBSITE');
$this->document->addScriptDeclaration("var lang_Get_Snippets_New_Tooltip = '".JText::_('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME')."';"); JText::script('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME');
$this->document->addScriptDeclaration("var lang_Get_Snippets_Diverged_Tooltip = '".JText::_('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME')."';"); JText::script('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME');
$this->document->addScriptDeclaration("var lang_Get_Snippets_Ahead_Tooltip = '".JText::_('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME')."';"); JText::script('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')."';"); JText::script('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')."';"); JText::script('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME');
$this->document->addScriptDeclaration("var lang_Available_Libraries = '".JText::_('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES')."';"); JText::script('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES');
$this->document->addScriptDeclaration("var lang_Open_Lib_Snippets = '".JText::_('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS')."';"); JText::script('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS');
// add some lang verfy messages // add some lang verfy messages
$this->document->addScriptDeclaration(" $this->document->addScriptDeclaration("
// set the snippet from gitHub // set the snippet from gitHub
@ -302,7 +302,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
//do something special //do something special
if ('snippets' === ajaxcall) { if ('snippets' === ajaxcall) {
setTimeout( function() { setTimeout( function() {
jQuery('#snippets-github').html('<h1>'+lang_Community_Snippets+'</h1>'); jQuery('#snippets-github').html('<h1>'+Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')+'</h1>');
jQuery('#snippets-display').show(); jQuery('#snippets-display').show();
jQuery('#snippets-grid').trigger('display.uk.check'); jQuery('#snippets-grid').trigger('display.uk.check');
jQuery('#loading').hide(); jQuery('#loading').hide();
@ -362,7 +362,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
setLibrary(value); setLibrary(value);
}); });
setTimeout( function() { setTimeout( function() {
jQuery('#snippets-github').html('<h1>'+lang_Available_Libraries+'</h1>'); jQuery('#snippets-github').html('<h1>'+Joomla.JText._('COM_COMPONENTBUILDER_AVAILABLE_LIBRARIES')+'</h1>');
jQuery('#libraries-display').show(); jQuery('#libraries-display').show();
jQuery('#libraries-grid').trigger('display.uk.check'); jQuery('#libraries-grid').trigger('display.uk.check');
}, 1000); }, 1000);
@ -387,7 +387,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
} }
function setLibButtons(name) { 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>'; return '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-1 getreaction\" data-name=\"'+name+'\" data-type=\"getSnippets\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION')+'\"><i class=\"uk-icon-thumb-tack\"></i><span class=\"uk-hidden-small\"> '+Joomla.JText._('COM_COMPONENTBUILDER_OPEN_LIBRARY_SNIPPETS')+'</span></button>';
} }
// get the snippets // get the snippets
@ -404,7 +404,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
fromLocal = false; fromLocal = false;
if (_paths) { if (_paths) {
setSnippets(_paths, libraryName); setSnippets(_paths, libraryName);
jQuery('#snippets-github').html('<h1>'+lang_Community_Snippets+'</h1>'); jQuery('#snippets-github').html('<h1>'+Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS')+'</h1>');
} else { } else {
jQuery.get(path) jQuery.get(path)
.success(function(paths) { .success(function(paths) {
@ -506,27 +506,27 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
function setDataButtons(snippet, key, status) { function setDataButtons(snippet, key, status) {
var html = '<div class=\"uk-button-group uk-width-1-1 uk-margin-small-bottom\">'; 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>'; 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=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_USAGE_OF_COMMUNITY_VERSION')+'\"><i class=\"uk-icon-info\"></i><span class=\"uk-hidden-small\"> '+Joomla.JText._('COM_COMPONENTBUILDER_USAGE')+'</span></button>';
html += '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-3 getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"description\" title=\"'+lang_Description_Tooltip+'\"><i class=\"uk-icon-sticky-note-o\"></i><span class=\"uk-hidden-small\"> '+lang_Description+'</span></button>'; html += '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-3 getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"description\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_DESCRIPTION_OF_COMMUNITY_VERSION')+'\"><i class=\"uk-icon-sticky-note-o\"></i><span class=\"uk-hidden-small\"> '+Joomla.JText._('COM_COMPONENTBUILDER_DESCRIPTION')+'</span></button>';
html += '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-3 getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"snippet\" title=\"'+lang_Snippet_Tooltip+'\"><i class=\"uk-icon-code\"></i><span class=\"uk-hidden-small\"> '+lang_Snippet+'</span></button>'; html += '<button class=\"uk-button uk-button-small uk-button-success uk-width-1-3 getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"snippet\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_SNIPPET_OF_COMMUNITY_VERSION')+'\"><i class=\"uk-icon-code\"></i><span class=\"uk-hidden-small\"> '+Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET')+'</span></button>';
html += '</div>'; html += '</div>';
// return data buttons // return data buttons
return html; return html;
} }
function setRefButtons(snippet, key, status, keyID) { function setRefButtons(snippet, key, status, keyID) {
var html = '<div><a class=\"uk-button uk-button-mini uk-button-success uk-margin-small-bottom uk-width-1-1\" href=\"'+snippet.url+'\" target=\"_blank\" title=\"'+lang_URL_Tooltip+'\"><i class=\"uk-icon-external-link\"></i> ' + snippet.name + '</a></div>'; var html = '<div><a class=\"uk-button uk-button-mini uk-button-success uk-margin-small-bottom uk-width-1-1\" href=\"'+snippet.url+'\" target=\"_blank\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_SNIPPET_REFERENCE_URL')+'\"><i class=\"uk-icon-external-link\"></i> ' + snippet.name + '</a></div>';
// set the update button // set the update button
html += '<div>'; html += '<div>';
if ('equal' !== status) { if ('equal' !== status) {
if ('new' === status) { if ('new' === status) {
var tooltip = lang_Get_Snippet_New_Tooltip; var tooltip = Joomla.JText._('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_INSTALL_IT_LOCALLY');
} else { } else {
var tooltip = lang_Get_Snippet_Tooltip; var tooltip = Joomla.JText._('COM_COMPONENTBUILDER_GET_THE_SNIPPET_FROM_GITHUB_AND_UPDATE_THE_LOCAL_VERSION');
} }
html += '<button id=\"'+keyID+'-getbutton\" class=\"uk-button uk-button-small uk-button-primary uk-width-1-1 uk-margin-small-bottom getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"get\" title=\"'+tooltip+'\"><i class=\"uk-icon-cloud-download\"></i> '+lang_Get_Snippet+'</button>'; html += '<button id=\"'+keyID+'-getbutton\" class=\"uk-button uk-button-small uk-button-primary uk-width-1-1 uk-margin-small-bottom getreaction\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"get\" title=\"'+tooltip+'\"><i class=\"uk-icon-cloud-download\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_GET_SNIPPET')+'</button>';
} else { } else {
html += '<button class=\"uk-button uk-button-small uk-width-1-1 uk-margin-small-bottom\" type=\"button\" disabled title=\"'+lang_Get_Snippet_Dont_Tooltip+'\"><i class=\"uk-icon-check-square-o\"></i> '+lang_Dont_Get_Snippet+'</button>'; html += '<button class=\"uk-button uk-button-small uk-width-1-1 uk-margin-small-bottom\" type=\"button\" disabled title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION')+'\"><i class=\"uk-icon-check-square-o\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_LOCAL_SNIPPET')+'</button>';
} }
html += '</div>'; html += '</div>';
// return data buttons // return data buttons
@ -540,7 +540,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
} else if (snippet.contributor_name) { } else if (snippet.contributor_name) {
var contributor_name = snippet.contributor_name; var contributor_name = snippet.contributor_name;
} else { } else {
var contributor_name = lang_JCB_Community; var contributor_name = Joomla.JText._('COM_COMPONENTBUILDER_JCB_COMMUNITY');
} }
// set the contributor url // set the contributor url
if (snippet.contributor_website) { if (snippet.contributor_website) {
@ -551,9 +551,9 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
var contributor_url = 'https://github.com/vdm-io/Joomla-Component-Builder-Snippets'; var contributor_url = 'https://github.com/vdm-io/Joomla-Component-Builder-Snippets';
} }
var html = '<div class=\"uk-button-group uk-width-1-1\">'; var html = '<div class=\"uk-button-group uk-width-1-1\">';
html += '<button class=\"uk-button uk-button-primary uk-width-1-10 uk-button-mini getreaction\" data-type=\"contributor\" data-path=\"'+key+'\" title=\"'+lang_Contributor_Modal_Tooltip+'\"><i class=\"uk-icon-user\"></i></button>'; html += '<button class=\"uk-button uk-button-primary uk-width-1-10 uk-button-mini getreaction\" data-type=\"contributor\" data-path=\"'+key+'\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_THE_CONTRIBUTOR_DETAILS')+'\"><i class=\"uk-icon-user\"></i></button>';
html += '<a class=\"uk-button uk-button-primary uk-width-5-10 uk-button-mini\" href=\"'+contributor_url+'\" target=\"_blank\" title=\"'+lang_Contributor_URL_Tooltip+'\"><i class=\"uk-icon-external-link\"></i> ' + contributor_name + '</a>'; html += '<a class=\"uk-button uk-button-primary uk-width-5-10 uk-button-mini\" href=\"'+contributor_url+'\" target=\"_blank\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR')+'\"><i class=\"uk-icon-external-link\"></i> ' + contributor_name + '</a>';
html += '<a class=\"uk-button uk-button-primary uk-width-4-10 uk-button-mini\" href=\"https://github.com/vdm-io/Joomla-Component-Builder-Snippets/blame/master/'+key+'\" target=\"_blank\" title=\"'+lang_View_Blame_Tooltip+'\"><i class=\"uk-icon-external-link\"></i> '+lang_View_Blame+'</a>'; html += '<a class=\"uk-button uk-button-primary uk-width-4-10 uk-button-mini\" href=\"https://github.com/vdm-io/Joomla-Component-Builder-Snippets/blame/master/'+key+'\" target=\"_blank\" title=\"'+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_WHO_CONTRIBUTED_TO_THIS_SNIPPET')+'\"><i class=\"uk-icon-external-link\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_VIEW_BLAME')+'</a>';
html += '</div>'; html += '</div>';
// return contributor buttons // return contributor buttons
return html; return html;
@ -564,31 +564,31 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// check if there is new items // check if there is new items
if (bulkItems.new.length === 0) { if (bulkItems.new.length === 0) {
jQuery('#bulk-button-new').prop('disabled', true); jQuery('#bulk-button-new').prop('disabled', true);
jQuery('#bulk-button-new').attr('title', lang_Get_Snippets_New_Tooltip); jQuery('#bulk-button-new').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME'));
jQuery('#bulk-notice-new').show(); jQuery('#bulk-notice-new').show();
} }
// check if there is diverged items // check if there is diverged items
if (bulkItems.diverged.length === 0) { if (bulkItems.diverged.length === 0) {
jQuery('#bulk-button-diverged').prop('disabled', true); jQuery('#bulk-button-diverged').prop('disabled', true);
jQuery('#bulk-button-diverged').attr('title', lang_Get_Snippets_Diverged_Tooltip); jQuery('#bulk-button-diverged').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_DIVERGED_SNIPPETS_AT_THIS_TIME'));
jQuery('#bulk-notice-diverged').show(); jQuery('#bulk-notice-diverged').show();
} }
// check if there is ahead items // check if there is ahead items
if (bulkItems.ahead.length === 0) { if (bulkItems.ahead.length === 0) {
jQuery('#bulk-button-ahead').prop('disabled', true); jQuery('#bulk-button-ahead').prop('disabled', true);
jQuery('#bulk-button-ahead').attr('title', lang_Get_Snippets_Ahead_Tooltip); jQuery('#bulk-button-ahead').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_AHEAD_SNIPPETS_AT_THIS_TIME'));
jQuery('#bulk-notice-ahead').show(); jQuery('#bulk-notice-ahead').show();
} }
// check if there is behind items // check if there is behind items
if (bulkItems.behind.length === 0) { if (bulkItems.behind.length === 0) {
jQuery('#bulk-button-behind').prop('disabled', true); jQuery('#bulk-button-behind').prop('disabled', true);
jQuery('#bulk-button-behind').attr('title', lang_Get_Snippets_Behind_Tooltip); jQuery('#bulk-button-behind').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME'));
jQuery('#bulk-notice-behind').show(); jQuery('#bulk-notice-behind').show();
} }
// check if all we should close the all button // check if all we should close the all button
if (bulkItems.behind.length === 0 && bulkItems.new.length === 0 && bulkItems.ahead.length === 0 && bulkItems.diverged.length === 0) { if (bulkItems.behind.length === 0 && bulkItems.new.length === 0 && bulkItems.ahead.length === 0 && bulkItems.diverged.length === 0) {
jQuery('#bulk-button-all').prop('disabled', true); jQuery('#bulk-button-all').prop('disabled', true);
jQuery('#bulk-button-all').attr('title', lang_Get_Snippets_All_Tooltip); jQuery('#bulk-button-all').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME'));
jQuery('#bulk-notice-all').show(); jQuery('#bulk-notice-all').show();
} }
} }
@ -618,7 +618,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
updateSnippetDisplay(keyID, 'equal'); updateSnippetDisplay(keyID, 'equal');
} }
} else { } else {
UIkit.notify(lang_Update_Error_Tooltip, {status:'danger'}); UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED'), {status:'danger'});
} }
}); });
}, 200); }, 200);
@ -661,7 +661,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
updateSnippetDisplay(keyID, 'equal'); updateSnippetDisplay(keyID, 'equal');
} }
} else { } else {
UIkit.notify(lang_Update_Error_Tooltip, {status:'danger'}); UIkit.notify(Joomla.JText._('COM_COMPONENTBUILDER_SNIPPET_COULD_NOT_BE_UPDATEDSAVED'), {status:'danger'});
} }
}); });
}); });
@ -691,9 +691,9 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// update button // update button
if ('equal' === status) { if ('equal' === status) {
// update notice // update notice
jQuery('#'+keyID+'-getbutton').attr('title', lang_Get_Snippet_Dont_Tooltip); jQuery('#'+keyID+'-getbutton').attr('title', Joomla.JText._('COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION'));
jQuery('#'+keyID+'-getbutton').prop('disabled', true); jQuery('#'+keyID+'-getbutton').prop('disabled', true);
jQuery('#'+keyID+'-getbutton').html('<i class=\"uk-icon-check-square-o\"></i> ' + lang_Dont_Get_Snippet); jQuery('#'+keyID+'-getbutton').html('<i class=\"uk-icon-check-square-o\"></i> ' + Joomla.JText._('COM_COMPONENTBUILDER_LOCAL_SNIPPET'));
// counter delay just incase // counter delay just incase
setTimeout(function(){ setTimeout(function(){
jQuery('#'+keyID+'-getbutton').prop('disabled', true); jQuery('#'+keyID+'-getbutton').prop('disabled', true);
@ -735,13 +735,13 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
html += '<h3>' + snippet.library + ' - (' + snippet.type + ') ' + snippet.name + '</h3>'; html += '<h3>' + snippet.library + ' - (' + snippet.type + ') ' + snippet.name + '</h3>';
if ('contributor' === type) { if ('contributor' === type) {
html += '<dl class=\"uk-description-list-line\">'; html += '<dl class=\"uk-description-list-line\">';
html += '<dt><i class=\"uk-icon-institution\"></i> '+lang_Company_Name+'</dt>'; html += '<dt><i class=\"uk-icon-institution\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_COMPANY_NAME')+'</dt>';
html += '<dd>'+snippet.contributor_company+'</dd>'; html += '<dd>'+snippet.contributor_company+'</dd>';
html += '<dt><i class=\"uk-icon-user\"></i> '+lang_Author_Name+'</dt>'; html += '<dt><i class=\"uk-icon-user\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_NAME')+'</dt>';
html += '<dd>'+snippet.contributor_name+'</dd>'; html += '<dd>'+snippet.contributor_name+'</dd>';
html += '<dt><i class=\"uk-icon-envelope-o\"></i> '+lang_Author_Email+'</dt>'; html += '<dt><i class=\"uk-icon-envelope-o\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_EMAIL')+'</dt>';
html += '<dd>'+snippet.contributor_email+'</dd>'; html += '<dd>'+snippet.contributor_email+'</dd>';
html += '<dt><i class=\"uk-icon-laptop\"></i> '+lang_Author_Website+'</dt>'; html += '<dt><i class=\"uk-icon-laptop\"></i> '+Joomla.JText._('COM_COMPONENTBUILDER_AUTHOR_WEBSITE')+'</dt>';
html += '<dd>'+snippet.contributor_website+'</dd>'; html += '<dd>'+snippet.contributor_website+'</dd>';
html += '</dl>'; html += '</dl>';
} else { } else {

View File

@ -159,7 +159,7 @@ jQuery(document).ready(function($) {
<?php if ($this->hasPackage && ComponentbuilderHelper::checkArray($this->headerList) && ComponentbuilderHelper::checkArray($this->headers)) : ?> <?php if ($this->hasPackage && ComponentbuilderHelper::checkArray($this->headerList) && ComponentbuilderHelper::checkArray($this->headers)) : ?>
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => $this->activeTab)); ?> <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => $this->activeTab)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'basic', JText::_('Basic Method', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'basic', JText::_('COM_COMPONENTBUILDER_BASIC_METHOD', true)); ?>
<fieldset class="uploadform"> <fieldset class="uploadform">
<legend><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend> <legend><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?></legend>
<div class="control-group"> <div class="control-group">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>12th December, 2017</creationDate> <creationDate>14th December, 2017</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>http://vdm.bz/component-builder</authorUrl> <authorUrl>http://vdm.bz/component-builder</authorUrl>