From c9c7a27dcf02fd8bcfb685821e2c2958da7bc449 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 1 May 2016 18:31:51 +0200 Subject: [PATCH] Fixes to handle the newer framework and jquery assets double check the web/assets folder is writable by your web server... so, jquery-ui bundled in this framework is now the v1.10.4 and jquery at the v1.11.1 --- .gitignore | 3 +++ web/assets/.yii | 0 web/framework-1.1.17/web/js/packages.php | 1 + web/yaamp/commands/CheckupCommand.php | 2 +- web/yaamp/components/CUFHtml.php | 2 +- web/yaamp/components/UniForm.php | 12 +++++++-- web/yaamp/modules/explorer/block.php | 2 +- web/yaamp/modules/site/coin.php | 2 ++ web/yaamp/modules/site/coin_form.php | 1 - web/yaamp/modules/site/coin_market_graph.php | 10 ++++---- .../modules/site/results/found_results.php | 6 ++--- web/yaamp/ui/app.php | 3 ++- web/yaamp/ui/js/jquery.yii.js | 25 ++++++++++++------- web/yaamp/ui/lib/pageheader.php | 7 ++++-- web/yaamp/ui/main.php | 9 +++++-- web/yaamp/yiic.php | 3 ++- 16 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 web/assets/.yii diff --git a/.gitignore b/.gitignore index 4b073db..29a8aeb 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ web/yaamp/runtime/* cookies/ bin/blocknotif web/serverconfig.php +web/assets/ +*.rej +*.orig diff --git a/web/assets/.yii b/web/assets/.yii new file mode 100644 index 0000000..e69de29 diff --git a/web/framework-1.1.17/web/js/packages.php b/web/framework-1.1.17/web/js/packages.php index 114051f..fd77dc6 100644 --- a/web/framework-1.1.17/web/js/packages.php +++ b/web/framework-1.1.17/web/js/packages.php @@ -29,6 +29,7 @@ return array( ), 'jquery.ui'=>array( 'js'=>array('jui/js/jquery-ui.min.js'), + // 'js'=>array('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js'), 'depends'=>array('jquery'), ), 'bgiframe'=>array( diff --git a/web/yaamp/commands/CheckupCommand.php b/web/yaamp/commands/CheckupCommand.php index 83ee544..4daa5a2 100644 --- a/web/yaamp/commands/CheckupCommand.php +++ b/web/yaamp/commands/CheckupCommand.php @@ -75,7 +75,7 @@ class CheckupCommand extends CConsoleCommand { $root = $this->basePath; - //self::isDirWritable("$root/protected/data/."); + self::isDirWritable("$root/assets/."); self::isDirWritable("$root/yaamp/runtime/."); self::isDirWritable(YAAMP_LOGS."/."); diff --git a/web/yaamp/components/CUFHtml.php b/web/yaamp/components/CUFHtml.php index 5c5f5d1..c990e5a 100644 --- a/web/yaamp/components/CUFHtml.php +++ b/web/yaamp/components/CUFHtml.php @@ -60,7 +60,7 @@ class CUFHtml extends CHtml { $realAttribute=$attribute; self::resolveName($model,$attribute); // strip off square brackets if any - $htmlOptions['required']=$model->isAttributeRequired($attribute,self::$scenario); + $htmlOptions['required']=$model->isAttributeRequired($attribute); return self::activeLabel($model,$realAttribute,$htmlOptions); } diff --git a/web/yaamp/components/UniForm.php b/web/yaamp/components/UniForm.php index baa1e42..44cd1c7 100644 --- a/web/yaamp/components/UniForm.php +++ b/web/yaamp/components/UniForm.php @@ -6,16 +6,24 @@ * @link http://www.hramov.info * @version 0.1 */ -class UniForm extends CWidget +//Yii::import('zii.widgets.jui.CJuiWidget'); + +class UniForm extends CWidget /* or CJuiWidget */ { public function init() { + parent::init(); + echo CHtml::cssFile('/yaamp/ui/css/uni-form.css'); - // echo CHtml::scriptFile('sansspace/ui/js/uni-form.jquery.js'); } public function run() { + $cs = Yii::app()->getClientScript(); + $cs->registerCoreScript("jquery"); + $cs->registerCoreScript("jquery.ui"); + $cs->registerScriptFile('/yaamp/ui/js/uni-form.jquery.js', CClientScript::POS_END); + CHtml::$requiredCss = ''; CHtml::$afterRequiredLabel=''; CHtml::$beforeRequiredLabel='* '; diff --git a/web/yaamp/modules/explorer/block.php b/web/yaamp/modules/explorer/block.php index 9948b94..46016d5 100644 --- a/web/yaamp/modules/explorer/block.php +++ b/web/yaamp/modules/explorer/block.php @@ -4,7 +4,7 @@ if (!$coin) return; $this->pageTitle = $coin->name." block explorer"; -$txid = getparam('txid'); +$txid = getparam('txid', 'tssssssss'); echo << diff --git a/web/yaamp/modules/site/coin.php b/web/yaamp/modules/site/coin.php index 746f39f..a4d157f 100644 --- a/web/yaamp/modules/site/coin.php +++ b/web/yaamp/modules/site/coin.php @@ -25,6 +25,8 @@ $since = arraySafeVal($_REQUEST,'since', time() - (7*24*3600)); // one week echo '
'; +app()->clientScript->registerCoreScript('jquery.ui'); // dialog + /* echo "
MAKE CONFIG & START"; diff --git a/web/yaamp/modules/site/coin_form.php b/web/yaamp/modules/site/coin_form.php index d2a9914..6597a97 100644 --- a/web/yaamp/modules/site/coin_form.php +++ b/web/yaamp/modules/site/coin_form.php @@ -4,7 +4,6 @@ echo getAdminSideBarLinks(); echo " - {$coin->name}
"; -//include "current.php"; $this->widget('UniForm'); echo CUFHtml::beginForm(); diff --git a/web/yaamp/modules/site/coin_market_graph.php b/web/yaamp/modules/site/coin_market_graph.php index 6b9902e..1446c98 100644 --- a/web/yaamp/modules/site/coin_market_graph.php +++ b/web/yaamp/modules/site/coin_market_graph.php @@ -131,7 +131,7 @@ function graph_price_data(data) tooltipContentEditor: function(str, seriesIndex, pointIndex, jqPlot) { var pt = jqPlot.series[seriesIndex].data[pointIndex]; var dt = new Date(0+pt[0]); - var date = $.datepicker.formatDate('dd M yy', dt); + var date = $.jsDate.strftime(dt, '%d %b'); var time = $.jsDate.strftime(dt, '%H:%M'); return date+' '+time+' '+ t.labels[seriesIndex] + '
' + pt[1]+' {$refSymbol}'; }, @@ -146,7 +146,7 @@ function graph_price_data(data) for (var i=0; i < x2ticks.length; i++) { if (i % tickInterval == 0) { var dt = new Date(0+x2ticks[i].value); - day = ''+$.datepicker.formatDate('dd M', dt)+''; + day = ''+$.jsDate.strftime(dt, '%#d %b')+''; if (x2ticks.length > 500 && day == lastDay) label = ''; else label = (day == lastDay) ? $.jsDate.strftime(dt, '%H:%M') : day; lastDay = day; @@ -211,7 +211,7 @@ function graph_balance_data(data) tooltipContentEditor: function(str, seriesIndex, pointIndex, jqPlot) { var pt = jqPlot.series[seriesIndex].data[pointIndex]; var dt = new Date(0+pt[0]); - var date = $.datepicker.formatDate('dd M yy', dt); + var date = $.jsDate.strftime(dt, '%d %b'); var time = $.jsDate.strftime(dt, '%H:%M'); return date+' '+time+' '+ t.labels[seriesIndex] + '
' + pt[1]+' {$coin->symbol}'; }, @@ -226,7 +226,7 @@ function graph_balance_data(data) for (var i=0; i < x2ticks.length; i++) { if (i % tickInterval == 0) { var dt = new Date(0+x2ticks[i].value); - day = ''+$.datepicker.formatDate('dd M', dt)+''; + day = ''+$.jsDate.strftime(dt, '%#d %b')+''; if (x2ticks.length > 500 && day == lastDay) label = ''; else label = (day == lastDay) ? $.jsDate.strftime(dt, '%H:%M') : day; lastDay = day; @@ -239,4 +239,4 @@ function graph_balance_data(data) end; -// JavascriptReady("$(window).resize(graph_resized);"); \ No newline at end of file +// JavascriptReady("$(window).resize(graph_resized);"); diff --git a/web/yaamp/modules/site/results/found_results.php b/web/yaamp/modules/site/results/found_results.php index b7fd2b3..192ef3e 100644 --- a/web/yaamp/modules/site/results/found_results.php +++ b/web/yaamp/modules/site/results/found_results.php @@ -17,14 +17,14 @@ $count = $count? $count: 50; WriteBoxHeader("Last $count Blocks ($algo)"); $criteria = new CDbCriteria(); -$criteria->condition = "blocks.category NOT IN ('stake','generated')"; +$criteria->condition = "t.category NOT IN ('stake','generated')"; $criteria->condition .= " AND IFNULL(coin.visible,1)=1"; // ifnull for rental if($algo != 'all') { - $criteria->condition .= " AND blocks.algo=:algo"; + $criteria->condition .= " AND t.algo=:algo"; $criteria->params = array(':algo'=>$algo); } $criteria->limit = $count; -$criteria->order = 'blocks.time DESC'; +$criteria->order = 't.time DESC'; $db_blocks = getdbolistWith('db_blocks', 'coin', $criteria); echo ""; diff --git a/web/yaamp/ui/app.php b/web/yaamp/ui/app.php index a7b872d..cff8d61 100644 --- a/web/yaamp/ui/app.php +++ b/web/yaamp/ui/app.php @@ -1,6 +1,7 @@ * @link http://www.yiiframework.com/ - * @copyright Copyright © 2008 Yii Software LLC + * @copyright 2008-2010 Yii Software LLC * @license http://www.yiiframework.com/license/ - * @version $Id: jquery.yii.js 1289 2009-08-06 15:33:57Z qiang.xue $ */ ;(function($) { @@ -20,12 +19,16 @@ $.yii = { f.style.display = 'none'; element.parentNode.appendChild(f); f.method = 'POST'; - }; + } if (typeof url == 'string' && url != '') { f.action = url; - }; + } + if (element.target != null) { + f.target = element.target; + } + var inputs = []; - jQuery.each(params, function(name, value) { + $.each(params, function(name, value) { var input = document.createElement("input"); input.setAttribute("type", "hidden"); input.setAttribute("name", name); @@ -34,11 +37,15 @@ $.yii = { inputs.push(input); }); - jQuery(f).trigger('submit'); + // remember who triggers the form submission + // this is used by jquery.yiiactiveform.js + $(f).data('submitObject', $(element)); - for (input in inputs) { - f.removeChild(inputs[input]); - } + $(f).trigger('submit'); + + $.each(inputs, function() { + f.removeChild(this); + }); } }; diff --git a/web/yaamp/ui/lib/pageheader.php b/web/yaamp/ui/lib/pageheader.php index 715e6cb..908f46d 100644 --- a/web/yaamp/ui/lib/pageheader.php +++ b/web/yaamp/ui/lib/pageheader.php @@ -20,7 +20,10 @@ echo CHtml::cssFile('/yaamp/ui/css/main.css'); echo CHtml::cssFile('/yaamp/ui/css/table.css'); //echo CHtml::scriptFile('/yaamp/ui/js/jquery.tablesorter.js'); -echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js'); -echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js'); +//echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js'); +//echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js'); + +$cs = app()->getClientScript(); +$cs->registerCoreScript('jquery.ui'); echo ""; diff --git a/web/yaamp/ui/main.php b/web/yaamp/ui/main.php index 125cac9..0443504 100644 --- a/web/yaamp/ui/main.php +++ b/web/yaamp/ui/main.php @@ -28,8 +28,13 @@ echo CHtml::cssFile("/extensions/jquery/themes/ui-lightness/jquery-ui.css"); echo CHtml::cssFile('/yaamp/ui/css/main.css'); echo CHtml::cssFile('/yaamp/ui/css/table.css'); -echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js'); -echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js'); +//echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js'); +//echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js'); + +$cs = app()->getClientScript(); +$cs->registerCoreScript('jquery.ui'); +//$cs->registerScriptFile('/yaamp/ui/js/jquery.tablesorter.js', CClientScript::POS_END); + echo CHtml::scriptFile('/yaamp/ui/js/jquery.tablesorter.js'); // if(!controller()->admin) diff --git a/web/yaamp/yiic.php b/web/yaamp/yiic.php index edab2a6..791ef26 100644 --- a/web/yaamp/yiic.php +++ b/web/yaamp/yiic.php @@ -14,7 +14,8 @@ defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); defined('YII_DEBUG') or define('YII_DEBUG',true); -require_once('framework-1.0.8'.'/yii.php'); +//require_once('framework-1.0.8'.'/yii.php'); +require_once('framework-1.1.17'.'/yii.php'); if(isset($config)) {