How to specify image folder path for each user when use TinyMce ImageManager with Symfony
2012-02-22 00:42
696 查看
First, in sfWidgetFormTextareaTinyMce class we set:
Second, i set a 'imagemanager_rootpath' value in action, to throw the value to form:
Last, in the TextForm class, we configure the path:
more detail: http://www.tinymce.com/wiki.php/MCImageManager:rootpath
protected function configure($options = array(), $attributes = array()) { ...... $this->addOption('imagemanager_rootpath', 'mydir'); ...... } public function render($name, $value = null, $attributes = array(), $errors = array()) { $textarea = sfWidgetFormTextarea::render($name, $value, $attributes, $errors); $js = sprintf(<<<EOF <script type="text/javascript"> tinyMCE.init({ mode: "exact", elements : '%1\$s', imagemanager_rootpath: '{0}/%2\$s', ..... }
Second, i set a 'imagemanager_rootpath' value in action, to throw the value to form:
public function executeCreate(sfWebRequest $request) { ... $this->form = new TextForm(null, array('imagemanager_rootpath' => $user_id)); ... }
Last, in the TextForm class, we configure the path:
public function configure() { .... $path = $this->options['imagemanager_rootpath']; $user_dir = $_SERVER['DOCUMENT_ROOT'].'/uploads/submission/text/'.$path; if (!is_dir($user_dir)) mkdir($user_dir, 0777); $this->widgetSchema['content'] = new sfWidgetFormTextareaTinyMCE(array('width' => 480, 'height' => 250, 'imagemanager_rootpath' => $path)); .... }
more detail: http://www.tinymce.com/wiki.php/MCImageManager:rootpath
相关文章推荐
- How to create fully custom Role, User, Event, Resource classes for use with the Security and Scheduler modules
- How to create aligned partitions in Linux for use with NetApp LUNs, VMDKs, VHDs and other virtual di
- How to set timeout for user when login using zend_auth?
- how to fix "Cannot find a valid baseurl for repo: poptop-stable/7" in centos 7 *64 when use "yum -y
- use noscript html tag when user disable the javascript in browser, guide user how to enable the js in different browser and retu
- How to Use Xmonad, a Tiling Window Manager for Linux
- IntegrationWithDjango - modwsgi - How to use Django with mod_wsgi. - Python WSGI adapter module for Apache. - Google Project Hosting
- 如何使用th:each属性迭代模板-原标题:How To Use th:each For Iteration In Thymeleaf Template?
- How to create and use SDCard image for Android emulator
- When to use dequeueReusableCellWithIdentifier vs dequeueReusableCellWithIdentifier: forIndexPath
- How To Use Box2D For Just Collision Detection with Cocos2D iPhone
- How to aviod new line when use RadAjaxManager
- How to use iPhone with File I/O Functions: A Tutorial for Software Developers
- How to use transparent PNG icons with Delphi ImageList
- use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command
- How to Set Relative Path for Jasper Reports Image
- How to configure OpenFiler v2.3 iSCSI Storage for use with VMware ESX.
- 原文标题:How to use transparent PNG icons with Delphi ImageList
- DELPHI - How to use opendialog1 for choosing a folder? TOpenDialog, TFileOpenDialog
- How to Enabling and Diabling VxDMP devices for use with Oracle ASM