[EXTENSION] PS Yii Extension Library -- v1.0.4 (jQuery Tools Support)

i tried : CPSMarkItUpWidget::create( array( 'id' => 'myTextArea' ) );

but even if i specify the 'id' in the options array thc ode that i see produced by the widget is always:

jQuery(document).ready(function() { $('#markItUp').markItUp(mySettings); 5});

Make sure you're using the latest version (1.0.4) for one.

Secondly, what's with the "5" at the end of the Javascript?

I think there is a bug in the selector choosing portion. I just cleaned it up a bit.

However, I've added a new parameter (with the v1.0.4) to the widget creation. This parameter is called 'target'. This should be used to set the CSS selector of the target. So try this:



CPSMarkItUpWidget( array( 'target' => '#myTextArea' ) );


See if that works any better. If myTextArea is a class, adjust the code accordingly (i.e. '.myTextArea').

Quote

Make sure you're using the latest version (1.0.4) for one.

Secondly, what's with the "5" at the end of the Javascript?

I think there is a bug in the selector choosing portion. I just cleaned it up a bit.

However, I've added a new parameter (with the v1.0.4) to the widget creation. This parameter is called 'target'. This should be used to set the CSS selector of the target. So try this:



CPSMarkItUpWidget( array( 'target' => '#myTextArea' ) );


See if that works any better. If myTextArea is a class, adjust the code accordingly (i.e. '.myTextArea').

ok with the "target" attribute it works perfectly. One last thing. I use also the datepicker widget and to localize it (italian language) i had to download the jquery ui file from the jquery ui website and copy and include the relative .js italian language translation file in my app and also add a custom javascript line to localize the datepicker. Maybe you could add also the localization files and option to localizate the datepicker widget

@skyblaze thanks for the input, glad it's working. I just added a 'regional' option to the jqUIWrapper object. If set (to your locale), it will generate the datepicker properly and include the necessary files.

It will be in the next release!

I downloaded your library v1.0.4.  I unzipped it into my ndragon\extensions directory so that now it looks like this.

…\htdocs\ndragon\protected\extensions\pogostick…

…\htdocs\ndragon\protected\extensions\tutorials…

I modified the postController.php



<?php





class PostController extends Controller





...





	public function actionExamples()


	{


		$this->render( 'application.extensions.pogostick.widgets.examples.jqui_examples' );


	}


}


Then I tried to load it up via:

http://localhost/ndragon/post/Examples

and I got this error message:






PHP Error


Description





include(CPSjqUIWrapper.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


Source File





D:xampphtdocsframeworkYiiBase.php(310)





00298:      * @param string class name


00299:      * @return boolean whether the class has been loaded successfully


00300:      */


00301:     public static function autoload($className)


00302:     {


00303:         // use include so that the error PHP file may appear


00304:         if(isset(self::$_coreClasses[$className]))


00305:             include(YII_PATH.self::$_coreClasses[$className]);


00306:         else if(isset(self::$_classes[$className]))


00307:             include(self::$_classes[$className]);


00308:         else


00309:         {


00310: include($className.'.php');


00311:             return class_exists($className,false) || interface_exists($className,false);


00312:         }


00313:         return true;


00314:     }


00315: 


00316:     /**


00317:      * Writes a trace message.


00318:      * This method will only log a message when the application is in debug mode.


00319:      * @param string message to be logged


00320:      * @param string category of the message


00321:      * @see log


00322:      */





Stack Trace





#0 D:xampphtdocsframeworkYiiBase.php(310): autoload()


#1 unknown(0): autoload()


#2 D:xampphtdocsndragonprotectedextensionspogostickwidgetsexamplesjqui_examples.php(18): spl_autoload_call()


#3 D:xampphtdocsframeworkwebCBaseController.php(119): require()


#4 D:xampphtdocsframeworkwebCBaseController.php(88): PostController->renderInternal()


#5 D:xampphtdocsframeworkwebCController.php(701): PostController->renderFile()


#6 D:xampphtdocsframeworkwebCController.php(640): PostController->renderPartial()


#7 D:xampphtdocsndragonprotectedcontrollersPostController.php(205): PostController->render()


#8 D:xampphtdocsframeworkwebactionsCInlineAction.php(32): PostController->actionExamples()


#9 D:xampphtdocsframeworkwebCController.php(300): CInlineAction->run()


#10 D:xampphtdocsframeworkwebfiltersCFilterChain.php(129): PostController->runAction()


#11 D:xampphtdocsframeworkwebfiltersCFilter.php(41): CFilterChain->run()


#12 D:xampphtdocsndragonprotectedcomponentsController.php(7): AccessControlFilter->filter()


#13 D:xampphtdocsframeworkwebfiltersCInlineFilter.php(59): PostController->filterAccessControl()


#14 D:xampphtdocsframeworkwebfiltersCFilterChain.php(126): CInlineFilter->filter()


#15 D:xampphtdocsframeworkwebCController.php(283): CFilterChain->run()


#16 D:xampphtdocsframeworkwebCController.php(257): PostController->runActionWithFilters()


#17 D:xampphtdocsframeworkwebCWebApplication.php(332): PostController->run()


#18 D:xampphtdocsframeworkwebCWebApplication.php(120): CWebApplication->runController()


#19 D:xampphtdocsframeworkbaseCApplication.php(133): CWebApplication->processRequest()


#20 D:xampphtdocsndragonindex.php(11): CWebApplication->run()








Can you tell me if I missed something?  I am an Yii-beginner…

Did you add the path alias in your main.php config? Check out the wiki page on installation @ the googlecode sire.

Sorry I see it.  I will give it a shot.  Thank you.

Thanks for the quick reply.  When  I look at the wiki, it showed this.  I don’t see any instructions on path alias setup requierd.



Installation   


One-sentence summary of this page.


Introduction





Add your content here.


Details





Add your content here. Format your content with:





    * Text in bold or italic


    * Headings, paragraphs, and lists


    * Automatic links to other wiki pages 


I added the alias and updated the import.  Same error.  I can see the file at

D:\xampp\htdocs\ndragon\protected\extensions\pogostick\widgets\jqui\CPSjqUIWrapper.php



<?php








Yii::setPathOfAlias( 'pogostick', 'D:xampphtdocsndragonprotectedextensionspogostick' );


// Yii::setPathOfAlias( 'pogostick', dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'extensions'.DIRECTORY_SEPARATOR.'pogostick' );





// This is the main Web application configuration. Any writable


// CWebApplication properties can be configured here.


return array(


	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',


	'name' => 'Yii Skeleton Application',


	'defaultController'=>'site',


	


	// autoloading model and component classes


	'import'=>array(


		'application.models.*',


		'application.components.*',


		'application.components.helpers.*',


		'application.components.behaviors.*',


		'application.components.widgets.*',


		'application.extensions.*',


		'pogostick.base.*',


		'pogostick.behaviors.*',


		'pogostick.components.*',


		'pogostick.events.*',


		'pogostick.helpers.*',


		'pogostick.widgets.*',


	),


...


In the PostController.php



...


	public function actionExamples()


	{


		$this->render( 'application.extensions.pogostick.widgets.examples.jqui_examples' );


		// $this->render( 'pogostick.widgets.examples.jqui_examples' );


	}


...


Ok, two things…

  1. Add a line to your imports:


'pogostick.widgets.jqui.*'


  1. Your class alias is wrong in your render statement. Should be:


public function actionExamples()


	{


		$this->render( 'pogostick.widgets.examples.jqui_examples' );


	}


If this does not work, it could be an issue internally within the library as I am not 100% sure I coded it properly for WAMP.

Give this a try and report back and I’ll check out the code for WAMP compatibility.  I only found one potential issue for WAMP, which I’ve corrected and will be in the next release. However the above should work.

One more thing I just thought of…

You may install the extension library OUTSIDE of your application directory so it can be used with multiple projects.

Hello!

Nice extension.

But i need help with jqGrid.

For now i try do tests it.

All other widgets work whout problem.

But jqGridWidget after generate code for HTML page and after page is redy didnot send request to the url.

On top of the view/test/show.php :




<?php 

    CPSjqGridWidget::create(array(

    	'target'=>'#list',	

    	'url'=> CHtml::normalizeUrl(array('Example','data'=>'test')),

    	'datatype'=>'xml',

        'mtype'=>'GET',

    	'colNames'=>array('Inv No','Date', 'Amount','Tax','Total','Notes'),

//        'colModel'=>array( 

//          array('name'=>'invid', 'index'=>'invid', 'width'=>55), 

//          array('name'=>'invdate', 'index'=>'invdate', 'width'=>90), 

//          array('name'=>'amount', 'index'=>'amount', 'width'=>80, 'align'=>'right'), 

//          array('name'=>'tax', 'index'=>'tax', 'width'=>80, 'align'=>'right'), 

//          array('name'=>'total', 'index'=>'total', 'width'=>80, 'align'=>'right'), 

//          array('name'=>'note', 'index'=>'note', 'width'=>150, 'sortable'=>'false'), 

//    	),

    

        'pager'=>'#pager',    

        'rowNum'=>10,

        'rowList'=>array(10,20,30),

        'sortname'=>'invid',

        'sortorder'=>'desc',

        'viewrecords'=>'true',

        'caption'=>'My first grid',

    	'theme' => 'cupertino',

    ));

?>



Also i catch a trouble with colModel option.

Error when not commented:




Description


Array to string conversion

Source File


C:\WAPP\apache2\htdocs\seoportal\protected\extensions\pogostick\behaviors\CPSComponentBehavior.php(449)


00437:             return $this->setOption( $sName, $oValue );

00438:             

00439:         return parent::__set( $sName, $oValue );

00440:     }

00441:     

00442:     /**

00443:     * Check to see if the value follows a callback function pattern

00444:     *     

00445:     * @param string $sValue

00446:     */

00447:     protected function isCBFunction( $sValue )

00448:     {

00449: return ( 0 == strncasecmp( $sValue, 'function(', 9 ) || 0 == strncasecmp( $sValue, 'jQuery(', 7 ) || 0 == strncasecmp( $sValue, '$(', 2 ) );

00450:     }

00451:     




seems like something in jqGrid. Make sure you aren’t including the jqgrid.js, the extension does it, secondly, I suggest starting with my example and adding your options in one at a time. I’m sure you’ll find the bug.

I think i found a problem source.

For my project now i use jqgrid from MetaYii insted PS.

And i catch same problem. Problem was found in the next part:

Widjet did not report about missing files, when langueage and sourcelang option is EN all work fine.

When all other widjet generate the html code for load js file from locale folder, and try create the file name from Yii::language parametr.

But not check exist file oк not.

I do not know why in this case not use the deafult locale file for EN ???

I don’t doubt it. The jqGrid code is BETA and is updated slowly.

hi sir,

I use CPSWysiwygWidget to convert the Message Body from Contact page.

When I go to ‘Home’ page, wait for a couple of minutes, then back to ‘Contact’ page, there are some seconds delay to display ‘Contact’ page…

The javascript files are loaded again…

How can I cache (permanently) the loaded jQuery library so that when I open ‘Contact’ page, it loads jQuery from cache instead?

here’s the code in contact.php (views/site)




<?php

	CPSWysiwygWidget::create( array( 'target' => '#mycontact' ) ); 

	$this->pageTitle=Yii::app()->name . ' - Contact Us'; 

?>


<?php echo CHtml::activeLabel($contact,'body'); ?>

<?php echo CHtml::activeTextArea($contact,'body',array('rows'=>6, 'cols'=>50, 'id'=>'mycontact')); ?>



Here the message from Firebug




4 requests 328 KB (117 KB from cache)



Thanks.

Sidney, the javascript files are published with the CAssetManager class in Yii. I’m not sure why they’d be reloading.

What is the URL of the reload?

Are you in DEBUG mode in Yii? That may affect it as well.

– J

Here’s URL of the JS


http://...../assets/d5dafa33/jqui/js/jquery-ui-1.7.1.min.js

and here’s my index.php


// remove the following line when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

After I set YII_DEBUG to false, I think it works… (waited for 10 minutes, then reload… nothing new was loaded).

Thanks!

Hello,

could anyone please explain me in examples, what exactly is needed to do in order to use jui datepicker with this extension?

at first, where do i need to install this extension sources?

I installed it in webroot/myproject/protected/extensions/

when i try to run examples as you explain here:

i get an error:


SiteController cannot find the requested view "pogostick.widgets.examples.jqui_examples".

i mean, do i need to set some configuration or something else in order to get it working?

any help appreciated

thanx a lot

Hi smeto,

did you add the extension path in the import parameter ? I think you should have someting like this in your main configuration file


    

 'import'=>array(

        'application.models.*',

        'application.components.*',

        'application.extensions.EXTENSION_FOLDER_NAME',        

    ),



(replace .EXTENSION_FOLDER_NAME by the actual name).

ciao

B)

thanx:)

Hello,

Sorry for my english.

I have a error using jqGrid and rendering a example too. I don’t know if both errors are related.

FIRST ERROR:

I have installed this extension (downloaded of the svn repository) using this config:

My main.php




Yii::setPathOfAlias( 'pogostick', dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.'\extensions\pogostick');


...


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

                'application.extensions.*',

                'pogostick.base.*',

                'pogostick.behaviors.*',

                'pogostick.components.*',

                'pogostick.events.*',

                'pogostick.helpers.*',

                'pogostick.widgets.*',

                'pogostick.widgets.jqui.*',

	),



And in my Controller:




    public function actionExamples()

    {

        $this->render( 'pogostick.widgets.examples.jqui_examples');

    }

    public function actionExamples2()

    {

        $this->render( 'pogostick.widgets.examples.jqTools_examples');

    }



The first example works fine.

The second example returns this error:

PHP Error

Description

Undefined variable: oOwner

Source File:

C:\Servers\htdocs\aurora_yii\protected\extensions\pogostick\widgets\CPSjqToolsWrapper.php(55)

SECOND ERROR:

I want to used a jqGrid widget. I haven’t found a example and sure that i have all bad.

My files:

In my View:




<?php

    CPSjqGridWidget::create(array(

        'target'=>'#list',

        //'url'=> CHtml::normalizeUrl(array('Example','data'=>'test')),

        'url'=>CController::createUrl('infoGeografica/cargarmunicipios2'),

        'datatype'=>'json',

        'mtype'=>'GET',

        'colNames'=>array('ID No','Nombre', 'Cod INE'),

        'colModel'=>array(

          array('name'=>'id', 'index'=>'id', 'width'=>55),

          array('name'=>'nombre', 'index'=>'nombre', 'width'=>90),

          array('name'=>'cod_ine', 'index'=>'cod_ine', 'width'=>80, 'align'=>'right'),

     ),


        'pager'=>'#pager',

        'rowNum'=>10,

        'rowList'=>array(10,20,30),

        'sortname'=>'id',

        'sortorder'=>'desc',

        'viewrecords'=>'true',

        'caption'=>'My first grid',

        'theme' => 'steel',

    ));

?>



And in my Controller:




    public function actionCargarmunicipios2()

    {


        $page = $_GET['page']; // get the requested page

        $limit = $_GET['rows']; // get how many rows we want to have into the grid

        $sidx = $_GET['sidx']; // get index row - i.e. user click to sort

        $sord = $_GET['sord']; // get the direction

        if(!$sidx) $sidx =1;


        //$responce->page = 1;

        //$responce->total = 1;

        //$responce->records = 6;


        $responce->rows[0]['id']=0;

        $responce->rows[0]['cell']=array(0,Prueba0,00001);

        $responce->rows[1]['id']=0;

        $responce->rows[1]['cell']=array(0,Prueba1,00002);

        $responce->rows[2]['id']=0;

        $responce->rows[2]['cell']=array(0,Prueba2,00003);

        $responce->rows[3]['id']=0;

        $responce->rows[3]['cell']=array(0,Prueba3,00004);

        $responce->rows[4]['id']=0;

        $responce->rows[4]['cell']=array(0,Prueba4,00005);

        $responce->rows[5]['id']=0;

        $responce->rows[5]['cell']=array(0,Prueba5,00006);

        

        echo json_encode($responce);


    }



Render the view the page return this error:

PHP Error

Description

Declaration of CPSjqGridWidget::create() should be compatible with that of CPSjqUIWrapper::create()

Source File:

C:\Servers\htdocs\aurora_yii\protected\extensions\pogostick\widgets\jqui\CPSjqGridWidget.php(24)

Can someone help me to learn to use this widget?

Thanks and regards.