Commit 0fb240c1 authored by speedprogs_de's avatar speedprogs_de

fixed jqvascript include file paths, chart testing

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@51738 735d13b6-9817-0410-8766-e36946ffe9aa
parent 0689934f
......@@ -25,7 +25,7 @@
/**
* Chart view helper
*
*
* For documentation and examples visit http://www.jqplot.com
*/
class Tx_TerFe2_ViewHelpers_ChartViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
......@@ -40,37 +40,66 @@
*/
protected $chart = '
<div id="%1$s" style="height:%2$s;width:%3$s;"></div>
<script type="text/javascript">$.jqplot("%1$s", %4$s, {%5$s});</script>
<script type="text/javascript">
$(document).ready(function(){
$.jqplot(\'%1$s\', [[%4$s]], {%5$s});
});
</script>
';
/**
* Renders a jqPlot chart
*
* @param array $points Array of points on chart
* @param object $object The object to get chart from
* @param string $type The type of information to render
* @param integer $height Height of the chart
* @param integer $width Width of the chart
* @param string $color Color of the line
* @return string Chart
*/
public function render($points = NULL, $height = 300, $width = 400, $color = '#FFA500') {
if ($points === NULL) {
$points = $this->renderChildren();
public function render($object = NULL, $type = 'downloads', $height = 300, $width = 400, $color = '#FFA500') {
if ($object === NULL) {
$object = $this->renderChildren();
}
if (!is_array($points)) {
throw new Exception('Chart points have no valid format');
$points = array();
$type = trim(strtolower($type));
if ($object instanceof Tx_TerFe2_Domain_Model_Extension) {
$points = $this->getExtensionPoints($object, $type);
}
$id = uniqid('chart_');
$height = (int) $height . 'px';
$width = (int) $width . 'px';
$points = json_encode(array(array($points)));
$options = 'series:[{color:"' . $color . '"}]';
$points = implode(',', $points);
$options = '
series:[{color:\'' . $color . '\'}]
';
return sprintf($this->chart, $id, $height, $width, $points, $options);
}
/**
* Returns the points by type for an extension model
*
* @param Tx_TerFe2_Domain_Model_Extension Extension object
* @param string $type Type of the information to get
* @return array Points to render in chart
*/
protected function getExtensionPoints(Tx_TerFe2_Domain_Model_Extension $extension, $type) {
$result = array();
if ($type === 'downloads') {
$versions = $extension->getVersions();
foreach ($versions as $version) {
$result[] = "['" . $version->getVersionNumber() . "'," . (int) $version->getDownloadCounter() . "]";
}
}
return $result;
}
}
?>
\ No newline at end of file
......@@ -40,11 +40,11 @@ page.includeCSS.tx_terfe2 = EXT:ter_fe2/Resources/Public/Stylesheet/Default.css
## jQuery
[globalVar = LIT:1 = {$plugin.tx_terfe2.libraries.jquery.load}]
page.includeJSlibs.jquery = EXT:torr_configuration/Resources/Public/Javascript/jquery.min.js
page.includeJSlibs.jquery = EXT:ter_fe2/Resources/Public/Javascript/jquery-1.6.2.min.js
[global]
## jqPlot
[globalVar = LIT:1 = {$plugin.tx_terfe2.libraries.jqplot.load}]
page.includeCSS.jqplot = EXT:torr_configuration/Resources/Public/Javascript/jqPlot/jquery.jqplot.min.css
page.includeJSlibs.jqplot = EXT:torr_configuration/Resources/Public/Javascript/jqPlot/jquery.jqplot.min.js
page.includeCSS.jqplot = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/jquery.jqplot.min.css
page.includeJSlibs.jqplot = EXT:ter_fe2/Resources/Public/Javascript/jqPlot/jquery.jqplot.min.js
[global]
\ No newline at end of file
......@@ -17,7 +17,7 @@
<label index="versions.description">All versions</label>
<label index="last_version.description">Last version</label>
<label index="frontend_user.description">Frontend user</label>
<label index="insecure.description">Last version is insecure, requires update</label>
<label index="insecure.description">Last version is insecure, require update</label>
</languageKey>
</data>
</T3locallang>
\ No newline at end of file
......@@ -18,7 +18,7 @@
<label index="tx_terfe2_domain_model_extension.last_version">Last Version</label>
<label index="tx_terfe2_domain_model_extension.frontend_user">Frontend User</label>
<label index="tx_terfe2_domain_model_extension.insecure">Mark as insecure</label>
<label index="tx_terfe2_domain_model_extension.insecure.check">Last version was insecure, requires update</label>
<label index="tx_terfe2_domain_model_extension.insecure.check">Last version was insecure, require update</label>
<label index="tx_terfe2_domain_model_category">Category</label>
<label index="tx_terfe2_domain_model_category.title">Title</label>
......
......@@ -12,12 +12,19 @@
</h3>
<p class="description">{extension.lastVersion.description}</p>
<p class="categories"><f:for each="{extension.categories}" as="{category}">{category.title}</f:for></p>
<p class="tags"><f:for each="{extension.tags}" as="tag" iteration="tagIterator">{tag.title}{f:if(condition:tagIterator.isLast,then:'',else:', ')}</f:for><br /><f:link.action action="new" controller="Tag" arguments="{extension : extension}"><f:translate key="create_tag" /></f:link.action> </p>
<p class="download"><f:link.action action="download" arguments="{extension : extension, version : extension.lastVersion}"><f:translate key="download"/></f:link.action></p>
<p class="tags">
<f:for each="{extension.tags}" as="tag" iteration="tagIterator">{tag.title}{f:if(condition:tagIterator.isLast,then:'',else:', ')}</f:for><br />
<f:link.action action="new" controller="Tag" arguments="{extension : extension}"><f:translate key="create_tag" /></f:link.action>
</p>
<p class="download"><f:link.action controller="Extension" action="download" arguments="{extension : extension, version : extension.lastVersion}"><f:translate key="download"/></f:link.action></p>
<f:if condition="{extension.forgeLink}"><p class="forgeLink"><f:link.action absolute="{extension.forgeLink}"><f:translate key="tx_terfe2_domain_model_extension.forge_link" /></f:link.action></p></f:if>
<f:if condition="{extension.hudsonLink}"><p class="hudsonLink"><f:link.action absolute="{extension.hudsonLink}"><f:translate key="tx_terfe2_domain_model_extension.hudson_link" /></f:link.action></p></f:if>
</div>
<div class="chart">
<terfe2:chart object="{extension}" type="downloads" />
</div>
<ul>
<li><f:link.action controller="Extension" action="download" arguments="{version : extension.lastVersion}"><f:translate key="download_t3x"/></f:link.action></li>
<f:if condition="{extension.lastVersion.zipFile}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment