Yii Framework Forum: tinymce + elfinder - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

tinymce + elfinder Rate Topic: -----

#1 User is offline   r0n9.GOL 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 21-August 09

Posted 05 September 2010 - 05:07 AM

I take tinymce Yii ext update it add spell checker (ru, en) and add elfinder

Extension

Posted Image



Made in two versions
1. elfinder as a module
Pluses:
* May prescribe rules
* Normally generated url
Minus:
* What to be separate from ext
2. And simply put in assets
Minuses:
* Can not prescribe rules
* Not normally generated url
Plus: * Be in a folder with Ext

It would be good if someone suggested how to make a folder c Ext and remove all the minuses ?
0

#2 User is offline   smoothcoder 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 29
  • Joined: 03-December 09
  • Location:Thailand

Posted 06 September 2010 - 02:24 PM

Hi ,
I'm using with module and customized ETinyMCE.
(ubuntu/lighttpd)
I can see the dialog and inside "file and directories" but :

b.fm.params is undefined
0

#3 User is offline   smoothcoder 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 29
  • Joined: 03-December 09
  • Location:Thailand

Posted 06 September 2010 - 02:57 PM

I got an information from "http://elrte.org/redmine/boards/2/topics/717" telling about "Destroyed global GET array". That reminded me that I was using Yii with urlmanager and rules in lighttpd server.

So I temporarily disconnected these.
Then rewrote the URL accordingly.
url : "http://deva.testbmfbm.net/index.php?r=elfinder/Default",

instead of
url : "http://deva.testbmfbm.net/elfinder/Default/connector",


When I call again, the dialog displays the file trees etc.
no more b.fm.params is undefined :) .

So later I will put back my urlrules and try to write better rules if this is the reason why the GET arrays are lost.
0

#4 User is offline   tc74 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 26-June 10

Posted 22 November 2010 - 03:37 PM

There is an issue to upload with you turn on Csrf.

Although, I try to solve that by adding jquery.cookie.js plugin and edited form submission to include the YII_CSRF_TOKEN but it does not seem to work.

elfinder.min.js...
<form method="post" enctype="multipart/form-data" action="'+self.fm.options.url+'" target="'+id+'"><input type="hidden" name="YII_CSRF_TOKEN" value="'+$.cookie('YII_CSRF_TOKEN')+'">

Can anyone help? Thanks in advance.

By the way, turning off Csrf works, but that defeat the purpose of trying to make the site as secure as possible.
0

#5 User is offline   tc74 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 26-June 10

Posted 25 November 2010 - 03:20 PM

I solved it with

adding csrf cookie into javascript generate form in \extensions\tinymce_elfinder\tinymce\assets\elfinder\js\elfinder.full.js (also you need to change elfinder.min.js) and have the assets re-published

<input type="hidden" name="YII_CSRF_TOKEN" value=\''+($.cookie.get('YII_CSRF_TOKEN')).substring(($.cookie.get('YII_CSRF_TOKEN')).indexOf('"')+1,($.cookie.get('YII_CSRF_TOKEN')).lastIndexOf('"'))+'\'><input type="hidden" name="cmd" value="upload" />

and save the two js in the zip file to \extensions\tinymce_elfinder\tinymce\assets\elfinder\js

and edit \extensions\tinymce_elfinder\tinymce\ETinyMce.php
Ln896
$cs->registerScriptFile($assets.'/elfinder/js/jquery.json.js'); //add this
$cs->registerScriptFile($assets.'/elfinder/js/jquery.cookie.js'); //add this
$cs->registerScriptFile($assets.'/elfinder/js/elfinder.min.js');
if(Yii::app()->language != 'en') $cs->registerScriptFile($assets.'/elfinder/js/i18n/elfinder.'.Yii::app()->language.'.js'); // tweak, so that no uncessary is add, this is to check if required to add language

Attached File(s)


0

#6 User is offline   tc74 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 26-June 10

Posted 07 December 2010 - 04:25 PM

More problem with Csrf. Flfinder when editing the file in text, cannot complete action as it fails with csrf. Do anyone know where and how to insert the YII_CSRF_TOKEN??

Please help. Thanks.
0

#7 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 12 December 2010 - 01:15 PM

I was using this great extension, but suddenly it decided to stop working.
Elfinder, that is.
Probably due to my url rules.

Did anyone solve this issue?

I spent two days on this ()#¤&#/(%&¤ issue, so any clues would be appreciated.
I've just turned it off for now...>:(
"Less noise - more signal"
0

#8 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 12 December 2010 - 03:39 PM

View Postjacmoe, on 12 December 2010 - 01:15 PM, said:

I was using this great extension, but suddenly it decided to stop working.
Elfinder, that is.
Probably due to my url rules.

Did anyone solve this issue?

I spent two days on this ()#¤&#/(%&¤ issue, so any clues would be appreciated.
I've just turned it off for now...>:(


Is this extension jac? http://www.yiiframew...xtension/elrtef
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#9 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 12 December 2010 - 07:11 PM

View PostAntonio Ramirez, on 12 December 2010 - 03:39 PM, said:



Nope. It's this one.
I am not going to touch elrt (or whatever it's called) with a ten foot long barge pole...

I know that I can get tinyMCE to work for me, using the prefixelement plugin: that leaves <pre> code blocks alone.
All other editors are messing with it.
So if it's going to be without a file browser, so be it. ;)
After all: it's going to be used on a programmers blog.
I'll just put a upload form below the text area, and problem solved.

Besides: all four rlte extensions are broken.
I know that the el guys are working on a better elFinder, and until it's released: no touch.
I spent two days on that crap.:lol:
Doesn't make it better that I've turned on cookie and csrf.
But what broke it was my url rules.
I see that four days ago they talked about a new version without post or get options, so I'm looking forward to that.
But it looks like it's going to take a while.
"Less noise - more signal"
0

#10 User is offline   www.ilyaplot.ru 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 27-December 10

Posted 27 December 2010 - 03:41 PM

I have worked, but corrected as follows:

file: ETinyMce.php
line: 806
replacement:
connector.php?url='.Yii::app()->baseUrl.'/uploads'.'",

replaceable:
connector.php?url='.Yii::app()->baseUrl.'/uploads/'.'",


It would be nice at least to correct such deficiencies.
The main problem now - it does not work function of load. Window opens, but does not respond to a click on INPUT
I apologize for my English, I'm Russian
Happy New Year and Merry Christmas!
0

#11 User is offline   twisted1919 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 640
  • Joined: 23-October 10
  • Location:Romania

Posted 15 January 2011 - 05:22 AM

For those that have problems with using this extension and validate the csrf token i modified the elfinder.full.js file so that the script can accept custom POST params when doing the upload.
Like uploadify does, this change allows you to use the scriptData option to pass your custom params:
<script type="text/javascript" charset="utf-8">
		$().ready(function() {
			
			var funcNum = window.location.search.replace(/^.*CKEditorFuncNum=(\d+).*$/, "$1");
            var langCode = window.location.search.replace(/^.*langCode=([a-z]{2}).*$/, "$1");
             
             $('#finder').elfinder({
                url : '<?php echo Yii::app()->createUrl('elfinder/default/connector')?>',
                lang : langCode,
                editorCallback : function(url) {
                  window.opener.CKEDITOR.tools.callFunction(funcNum, url);
                  window.close();
               },
               scriptData:{<?php echo Yii::app()->request->csrfTokenName;?>:'<?php echo Yii::app()->request->getCsrfToken();?>'}
            });
         
         });
	</script>

As you see, in scriptData i am passing the token so that it will be appended to the upload form and Yii can check it successfully.

The changes i did:
//In the default options area, line 704
        [...]
	autoReload : 0,
        /**
        * Option added by Twisted1919
        * The scriptData will accept an object (key:value pairs)
        * It is used to pass post data to the upload method so that for example you can check
        * a CSRF Token.
        * Also, see line 1964
        **/
        scriptData : null

//In the upload method, line 1964
[...]
/**
* Change made by Twisted1919
* Because most of the time we need to send extra data with the uploaded file
* like a csrf token, i needed a way to do this, so that the scriptData option was born.
**/
if(typeof(self.fm.options.scriptData)==='object'){
   for(key in self.fm.options.scriptData){
	f+='<input type="hidden" name="'+key+'" id="'+key+'" value="'+self.fm.options.scriptData[key]+'" />';
   }
}
// end change by Twisted1919
[...]


Attached is the archive containing just the elfinder.full.js file (you can compress it if you like).
Just overwrite the old one, and load it .

Attached File(s)


0

#12 User is offline   Pascool 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 15-December 09
  • Location:France

Posted 04 March 2011 - 04:53 PM

View Postwww.ilyaplot.ru, on 27 December 2010 - 03:41 PM, said:

The main problem now - it does not work function of load. Window opens, but does not respond to a click on INPUT

I have the same problem than you ilyaplot, it appears it's almost all the time, the file inputs can't be clicked. Happens on FireFox, but not on Google Chrome...
0

#13 User is offline   bleu 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 23-July 11

  Posted 07 November 2011 - 10:49 AM

I cannot save data entered in tinymce
<?php echo Yii::app()->baseUrl; $this->widget('application.extensions.tinymce_elfinder.tinymce.ETinyMce', array('name'=>'html', 'model' => $model,
        'attribute' => 'describe',)); ?>

0

#14 User is offline   damnated 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 01-February 12

Posted 09 February 2012 - 04:50 AM

Hi, I don't actually understand the install instructions, is there someone who could explain it more thoroughly please?
I put the whole elfinder folder under
/protected/extensions
, should I move the
/protected/extensions/elfinder/modules
folder to
/proteced/modules
?
0

#15 User is offline   rmarcou 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-March 12

Posted 09 August 2012 - 03:44 AM

I have the problem i don't actually understand the install instructions, is there someone who could explain it more thoroughly please?
0

#16 User is offline   Bogdan Savluk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 20-April 10
  • Location:Kiev

Posted 10 August 2012 - 03:23 AM

View Postrmarcou, on 09 August 2012 - 03:44 AM, said:

I have the problem i don't actually understand the install instructions, is there someone who could explain it more thoroughly please?


Long time ago I have used this extension, but recently I have completely replaced it but my own extensions.

Reasons to do so was:
1. I think tinyMce and elFinder should be in separate extensions.
2. I did not like how compressor and spellchecker was made in tinyMce - i think they must be in separate actions and should be configurable.
3. I did not like this extension because elfinder backend is not configurable(except editing files inside extension), because there is no posibility to easily add few elfider backends, and also there is serious security issues - just see what is published to assets(there is connector.php without any access control).
4. Also I want to use latest tinyMce

In case of using my extensions, you will get: latest tinymce version, more configurable integration with elFinder, separate actions for tinyMce compressor and spellchecker.

my extensions is here:
http://www.yiiframew...ion/newtinymce/
http://www.yiiframew...nsion/elfinder/

In other words, I want say - do not waste your time for this extension, there is much better replacement for it.
0

#17 User is offline   rmarcou 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-March 12

Posted 16 August 2012 - 04:44 AM

Thank you, it's work with your extension.
0

#18 User is offline   adober 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 14-February 12
  • Location:Odessa

Posted 11 October 2012 - 04:24 PM

Bogdan Savluk, thanks! Your extension working perfectly!
0

#19 User is offline   minh0409 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 03-September 13

Posted 24 November 2013 - 02:15 AM

I have different folders in elFinder: hr, accountant, admin, employee. I have Yii roles ( hr, accountant, admin, employee). Is there a way that specific Yii roles access to only that folder. Lets say a Yii roles accountant can only have access (read and upload , delete files ) to accountant folder but not other folders like hr, admin , employee. Thank you for your help.
0

#20 User is offline   hshfcb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 12-August 13

Posted 12 March 2014 - 06:08 AM

i wnant attach this extention to a $form->textField because i want add a file example thumbnail to my post but i cant please help me :(((
0

Share this topic:


Page 1 of 1
  • 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