Yii Framework Forum: [EXTENSION] EUpdateDialog - Yii Framework Forum

Jump to content

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] EUpdateDialog Rate Topic: ***** 1 Votes

#21 User is offline   DG Esteban A. Pérez 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 16-September 10
  • Location:Bs. As., Argentina

Posted 07 September 2011 - 03:46 PM

Hi!,

I'm using your extension... Nice work... but... Why the "title" poperty is not working?.. I see in the js you hard coded the title of the dialog :unsure:

How can I fix it? (I don't know about jQuery :( )

BTW, If you answer that, I'll can "customize" the "delte message"and other strings to internationalize it :)

Thanks in advance...

E.

I fixed it commenting the line 86 in EUpdateDialog.js
  // Open the dialog
85:  $( '#update-dialog' )
86:    //.dialog( { title: dialogTitle } )
87:    .dialog( 'open' );

This post has been edited by DG Esteban A. Pérez: 07 September 2011 - 04:08 PM

0

#22 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 08 September 2011 - 02:44 AM

View PostDG Esteban A. Pérez, on 07 September 2011 - 03:46 PM, said:

Hi!,

I'm using your extension... Nice work... but... Why the "title" poperty is not working?.. I see in the js you hard coded the title of the dialog :unsure:

How can I fix it? (I don't know about jQuery :( )

BTW, If you answer that, I'll can "customize" the "delte message"and other strings to internationalize it :)

Thanks in advance...

E.

I fixed it commenting the line 86 in EUpdateDialog.js
  // Open the dialog
85:  $( '#update-dialog' )
86:    //.dialog( { title: dialogTitle } )
87:    .dialog( 'open' );



Hi,

It's hardcoded because I don't want to use any inline JavaScript (something I'm trying out in my project), and different actions different dialog title. Thanks for pointing this out, maybe I will try to use title from a link for dialog title or something like that, I will have to think about it then I will be updating the extension.
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#23 User is offline   pituspace 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 10-August 11

Posted 13 September 2011 - 04:04 AM

Hi,

Is there any way to fetch instance in actionAdd controller like:

$upload1 = CUploadedFile::getInstancesByName('upload1');


I don't know how fetch it from json "success" response.

Regards
0

#24 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 14 October 2011 - 12:32 AM

Hi, I've seen that you published a new version, I just tried it but found the same issue with the date picker (now working) un the popup. Do you had the chance of working out this issue or it's not done yet? Just to confirm =)

View Postandrew2mar, on 03 September 2011 - 09:51 AM, said:

I think the problem is with jQuery UI. It's not the first problem I had with jQuery UI and also other this library widgets aren't initializing either.
Thanks, it's great you like it :)
Yes, I noticed that it's missing a 'loading' message|icon, so it's already on my to-do list. I was thinking about updating it little by little, but decided to finish my first Yii app, and then I'll start polishing my app I will also make a big update to this extension. So it should be coming in a week or two, as there are still some work to be done, also if making a design won't make me too depressed like it happened the last time :D

0

#25 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 14 October 2011 - 01:38 AM

View Postjpablo, on 14 October 2011 - 12:32 AM, said:

Hi, I've seen that you published a new version, I just tried it but found the same issue with the date picker (now working) un the popup. Do you had the chance of working out this issue or it's not done yet? Just to confirm =)


Hi, no I haven't published a new version, just letting everyone know that it's almost done. It should be published by the end of the month (I will sacrifice a few hours of my personal time in worst case scenario).
Then working on the new version, I jest JUI widgets and was very happy that they worked, hovewer a bit later it stopped working, after some testing I found that it was because one of widgets was trowing a JavaScript error (which wasn't shown in firebug console), so I just started removing other widgets to pinpoint which one was at fault, and then I found it just went to fixing that widget. You might try this method out too, maybe it will help.
Regards
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#26 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 15 October 2011 - 09:25 PM

Thank you, I'll wait for the new version, I've seen the last update set on oct 6 in the extension page and guessed that you posted a new version. I will still trying to figure out how to make it work, but I will also check the new version of eupdatedialog when it's ready.


View Postandrew2mar, on 14 October 2011 - 01:38 AM, said:

Hi, no I haven't published a new version, just letting everyone know that it's almost done. It should be published by the end of the month (I will sacrifice a few hours of my personal time in worst case scenario).
Then working on the new version, I jest JUI widgets and was very happy that they worked, hovewer a bit later it stopped working, after some testing I found that it was because one of widgets was trowing a JavaScript error (which wasn't shown in firebug console), so I just started removing other widgets to pinpoint which one was at fault, and then I found it just went to fixing that widget. You might try this method out too, maybe it will help.
Regards

0

#27 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 16 October 2011 - 01:41 AM

View Postjpablo, on 15 October 2011 - 09:25 PM, said:

Thank you, I'll wait for the new version, I've seen the last update set on oct 6 in the extension page and guessed that you posted a new version. I will still trying to figure out how to make it work, but I will also check the new version of eupdatedialog when it's ready.


The update was because I added a little note to the extension letting everyone know that this extension is not dead I'm almost done with it. The biggest thing I'm running from is writing the documentation for it, as I'm the one who wrote this extension and even I'm not sure how it works :D But I will try to glue all the pieces together and finally publish it so I could start thinking about the next update (I'm still not happy about it, and think it can be better), so just wait a little bit longer :)
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#28 User is offline   IRCSASW 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 01-September 11
  • Location:Cancún, México.

Posted 09 November 2011 - 06:52 PM

Hello, I'm new in Yii, I followed the instructions for using the extension and I could not run, nor the basic usage.

Copy the files in place
Assuming a model 'Customer'

1. I see my model in 'protected/controllers/CustomerController.php' the method LoadModule(), Ok
	public function loadModel()
	{
		if($this->_model===null)
		{
			if(isset($_GET['id']))
				$this->_model=Customer::model()->findbyPk($_GET['id']);
			if($this->_model===null)
				throw new CHttpException(404,'The requested page does not exist.');
		}
		return $this->_model;
	}


2. At the end of my controller 'protected/controllers/CustomerController.php' put the method setFlash()
	public function setFlash( $key, $value, $defaultValue = null )
	{
	  Yii::app()->user->setFlash( $key, $value, $defaultValue );
	}


3. Change actions(), also in 'protected/controllers/CustomerController.php'? put at the end? or in 'protected/components/controller.php'?, or in 'protected/controllers/SiteController.php' if it is here, what do I do with the code that is already here?

4. I make changes in my view and add a update-dialog-open-link class to all the links or
<?php
echo CHtml::link( 'Create', array( 'create' ),
  array(
    'class' => 'update-dialog-open-link',
    'data-update-dialog-title' => Yii::t( 'app', 'Create a new mix' ),
));
?>


5. I add the widget in my view, is in 'protected/views/Customer/create.php'? or directly on the form 'protected/views/Customer/_form.php'?
<div class="form">

<?php 
$this->widget( 'ext.EUpdateDialog.EUpdateDialog' );

$form=$this->beginWidget('CActiveForm', array(
	'id'=>'project-form',
	'enableAjaxValidation'=>false,
)); ?>
...


Either way is not working.

Will you show me step by step detail how to run this extension?

Sorry for my google-English.

Regards.
Arturo Ramos
www.ircsasoftware.com.mx
Cancún, México
0

#29 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 10 November 2011 - 12:31 PM

With a quick look as far I can tell:

1) Correct
2) Correct
3) Add it to your customercontroller.php (you are just adding external actions to your controller)
4) just add the class to the links you want to work with eupdatedialog (example: you want edit link to work through eupdatedialog so you add your class, but you want your delete link to work through normal redirects so you won't add the class to this link)
5) add it to the view from which you want to access actions using eupdatedialog (example: you want to create/edit/etc from admin view then add the widget to admin view; if you have a select in your form and you want to add additional options to that select using a link, then add it in your _form or create view)
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

#30 User is offline   IRCSASW 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 01-September 11
  • Location:Cancún, México.

Posted 10 November 2011 - 01:19 PM

Thank you very much for responding.

1) Function loadModule() in protected/controllers/ProjectController.php
	public function loadModel()
	{
		if($this->_model===null)
		{
			if(isset($_GET['id']))
				$this->_model=Project::model()->findbyPk($_GET['id']);
			if($this->_model===null)
				throw new CHttpException(404,'The requested page does not exist.');
		}
		return $this->_model;
	}


2) Function setFlash() at the end of protected/controllers/ProjectController.php
	public function setFlash( $key, $value, $defaultValue = null )
	{
	  Yii::app()->user->setFlash( $key, $value, $defaultValue );
	}


3) Function actions() at the end of protected/controllers/ProjectController.php
	public function actions()
	{
	  return array(
	    'view' => 'application.actions.CreateAction',
	  );
	}


4) and 5) With this code in protected/views/project/index.php:
<?php
$this->breadcrumbs=array(
	'Projects',
);

$this->menu=array(
	array('label'=>'Create Project', 'url'=>array('create')),
	array('label'=>'Manage Project', 'url'=>array('admin')),
);

$this->widget( 'ext.EUpdateDialog.EUpdateDialog' );

?>

<h1><?php echo Yii::t('app', 'Projects'); ?></h1>

<?php
echo CHtml::link( 'Create', array( 'create' ),
  array(
    'class' => 'update-dialog-open-link',
    'data-update-dialog-title' => Yii::t( 'app', 'Create a new mix' ),
));
?>

<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
)); ?>


Just get this dialog (image attached):

What is missing me?

Regards.

Attached File(s)


Arturo Ramos
www.ircsasoftware.com.mx
Cancún, México
0

#31 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 12 November 2011 - 10:43 PM

Similar issue here. The first time I click the CREATE MIX link I get this error:

b is null
inside jquery.cookie.js (line 10)
jQuery.cookie=function(b,j,m){if(typeo...tring(b.length+1));break}}}return d}};

then I click the link again and the dialog opens, the "loading.." text dissapears, but the dialog stays empty.
Any clue?
0

#32 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 14 November 2011 - 11:06 PM

I found the solution for both issues. The dialog was empty because in my case I was using the old JSON attribute (div, instead of content, which is the name in the new version).

The jqueryCookie seems to be a bug... check the line 153 of EUpdateDialog.js, looks like:
if( ( jQuery.cookie ) && ( typeof this.csrfTokenName != null ) )
and should be:
if( ( typeof this.csrfTokenName != null ) && ( this.csrfTokenName != null ) && ( jQuery.cookie ) )

because if the token name is empty the IF condition evaluates to TRUE. I dont understand why it check for the TYPEOF instead of the property itself... there is a reason or it's just a typo/bug?
0

#33 User is offline   IRCSASW 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 01-September 11
  • Location:Cancún, México.

Posted 15 November 2011 - 10:51 PM

This does not solve my problem, I still see only the window of dialogue with the text 'Loading ..'.

What am I missing?
Arturo Ramos
www.ircsasoftware.com.mx
Cancún, México
0

#34 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 16 November 2011 - 06:45 PM

Remember to adjust the actionCreate() in your controller to return the create form through AJAX, something like this:
(Mi model is called 'Provincia', use the correct name for your model)
if(isset($_POST['Provincia']))
{
$model->attributes=$_POST['Provincia'];
if ($model->save())
{
if (Yii::app()->request->isAjaxRequest)
{
echo CJSON::encode(array(
'status'=>'success',
'div'=>"<div id='saveconfirm'>Los datos han sido almacenados.</div>",
'option'=>CHtml::tag('option',array (
'value'=>$model->id,
'selected'=>true
),CHtml::encode($model->cod_prov),true)

));
exit;
}
else
$this->redirect(array('view','id'=>$model->id));
}
}


View PostIRCSASW, on 15 November 2011 - 10:51 PM, said:

This does not solve my problem, I still see only the window of dialogue with the text 'Loading ..'.

What am I missing?

0

#35 User is offline   IRCSASW 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 01-September 11
  • Location:Cancún, México.

Posted 16 November 2011 - 09:24 PM

Thank you very much for your time and patience.

This is the code:
public function actionCreate()
{
	$model=new Project;

	if(isset($_POST['Project']))
	{
		$model->attributes=$_POST['Project'];
		if($model->save())
		{
			if (Yii::app()->request->isAjaxRequest)
			{
				echo CJSON::encode(array(
					'status'=>'success',
					'div'=>"<div id='saveconfirm'>Los datos han sido almacenados.</div>",
					'option'=>CHtml::tag('option',array (
							'value'=>$model->id,
							'selected'=>true), CHtml::encode($model->id),true)
					));
				exit;
			}
			else 
				$this->redirect(array('view','id'=>$model->id));
		}				
	}
	if (Yii::app()->request->isAjaxRequest)
        {
            echo CJSON::encode(array(
                'status'=>'failure', 
                'div'=>$this->renderPartial('_form', array('model'=>$model), true)
            ));
            exit;               
        }
        else
	    $this->render('create',array(
		'model'=>$model,
	    ));
}


Still do not see anything in the window, the text 'Loading ...' no longer seen.
Arturo Ramos
www.ircsasoftware.com.mx
Cancún, México
0

#36 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 16 November 2011 - 10:41 PM

Replace 'div' with 'content'
version 2 of EUpdateDialog uses 'content' as the JSON identifier.

View PostIRCSASW, on 16 November 2011 - 09:24 PM, said:

Thank you very much for your time and patience.

This is the code:
public function actionCreate()
{
	$model=new Project;

	if(isset($_POST['Project']))
	{
		$model->attributes=$_POST['Project'];
		if($model->save())
		{
			if (Yii::app()->request->isAjaxRequest)
			{
				echo CJSON::encode(array(
					'status'=>'success',
					'div'=>"<div id='saveconfirm'>Los datos han sido almacenados.</div>",
					'option'=>CHtml::tag('option',array (
							'value'=>$model->id,
							'selected'=>true), CHtml::encode($model->id),true)
					));
				exit;
			}
			else 
				$this->redirect(array('view','id'=>$model->id));
		}				
	}
	if (Yii::app()->request->isAjaxRequest)
        {
            echo CJSON::encode(array(
                'status'=>'failure', 
                'div'=>$this->renderPartial('_form', array('model'=>$model), true)
            ));
            exit;               
        }
        else
	    $this->render('create',array(
		'model'=>$model,
	    ));
}


Still do not see anything in the window, the text 'Loading ...' no longer seen.

1

#37 User is offline   IRCSASW 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 01-September 11
  • Location:Cancún, México.

Posted 16 November 2011 - 11:48 PM

It works perfect, thank you very much, excellent work.

Another question, I have a datepicker in _form.php no longer see.

Is there a way to make it look in the dialogs?
<div class="row">
	<?php echo $form->labelEx($model,'create_time'); ?>
	<?php 
		// echo $form->textField($model,'create_time'); 
		$this->widget('zii.widgets.jui.CJuiDatePicker',
			 array(
				 'model'=>'$model',
				 'name'=>'Project[create_time]',
				 'value'=>$model->create_time,
				 'htmlOptions'=>array('size'=>10, 'style'=>'width:120px !important'),
					 'options'=>array(
		 				 'dateFormat'=>Yii::t('app', 'm/d/y'),
						 'showButtonPanel'=>true,
						 'changeMonth'=>true,                                      
						 'changeYear'=>true,
		 				 'closeText'=>'Done',
		 				 'currentText'=>'Today',
						 ),
					 )
				 );
	?>
	<?php echo $form->error($model,'create_time'); ?>
</div>


Find a solution? or still waiting. =(
Arturo Ramos
www.ircsasoftware.com.mx
Cancún, México
0

#38 User is offline   jpablo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 18-August 11
  • Location:Rosario, Argentina

Posted 17 November 2011 - 08:17 AM

Great to hear that it worked for you! =) I had the same issue with the datepicker and EUpdateDialog, I think that it can be solved using Version 2 of EUpdateDialog and playing with the JS initialization options, but didn't tried it yet, maybe andrew2mar can tell us how to manage it.


View PostIRCSASW, on 16 November 2011 - 11:48 PM, said:

It works perfect, thank you very much, excellent work.

Another question, I have a datepicker in _form.php no longer see.


0

#39 User is offline   IRCSASW 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 01-September 11
  • Location:Cancún, México.

Posted 17 November 2011 - 10:12 AM

Thanks, then wait.

Quote

Hablas Español?, Gracias, entonces esperamos.


We read. :rolleyes:
Arturo Ramos
www.ircsasoftware.com.mx
Cancún, México
0

#40 User is offline   ifdattic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 71
  • Joined: 08-March 11

Posted 19 December 2011 - 08:13 AM

View Postjpablo, on 14 November 2011 - 11:06 PM, said:

The jqueryCookie seems to be a bug... check the line 153 of EUpdateDialog.js, looks like:
if( ( jQuery.cookie ) && ( typeof this.csrfTokenName != null ) )
and should be:
if( ( typeof this.csrfTokenName != null ) && ( this.csrfTokenName != null ) && ( jQuery.cookie ) )

because if the token name is empty the IF condition evaluates to TRUE. I dont understand why it check for the TYPEOF instead of the property itself... there is a reason or it's just a typo/bug?


I'm not sure my self why I was checking for typeof, probably had a very big idea in my head for something :D
Made some changes to the check, but for some reason to me it was working either way :D
Andrius Marcinkevičius
(In English: Andrew M.)
Web Developer
http://ifdattic.com

Posted Image
0

Share this topic:


  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users