Ckeditor with Ajaxplorer

Posted: April 24, 2012 in PHP

– To disable login: ajaxplorer/core/classes/class.AuthService.php => function ‘usersEnabled’ add first line return false;

– To change file’s root path: ajaxplorer/conf/bootstrap_context.php

// define("AJXP_DATA_PATH", AJXP_INSTALL_PATH."/data"); == justnew ==
$temp = explode('\\',AJXP_INSTALL_PATH);
unset($temp[count($temp)-1]);
$sitePath = implode('\\',$temp);
define("AJXP_DATA_PATH", $sitePath."/upload");

– To integrate with ckeditor
Let we have placed ckeditor and ajaxplorer both at root of project.
ckeditor/config.js =>

CKEDITOR.editorConfig = function( config )
{
	config.filebrowserBrowseUrl = '../ajaxplorer/?external_selector_type=ckeditor&relative_path=upload/files';
	config.filebrowserImageBrowseUrl = '../ajaxplorer/?external_selector_type=ckeditor&relative_path=upload/files';     
	config.filebrowserUploadUrl = '../ajaxplorer/?external_selector_type=ckeditor&relative_path=upload/files';  
}

Above we need to give complete relative path from domian name but i have added below code so that we can only pass relative path from current project.
ajaxplorer/plugins/gui.ajax/ajxpclient_actions.xml
=> In change below code

//=== justnew combining relative path start =====
var hackStr = window.location.pathname; // /projects/demoproject/ajaxplorer/
hackStr = hackStr.substr(0,hackStr.indexOf("ajaxplorer")); // /projects/demoproject/
//=== justnew combining relative path end =====
								
if(ckData['relative_path']){
	imagePath = hackStr + ckData['relative_path'] + fileName;
}

– To select file and return it’s value in textbox
Below function will be called onclick of any button i.e. ‘Browse File’

function openKCFinder(id) {	
	window.AJAXPLO = {
        ajaxplorerPopupCallback: function(url) {
			window.AJAXPLO = null;
            $('#'+id).val(url);
        }
    };    
	window.open('../ajaxplorer/?external_selector_type=popup&relative_path=upload/files', 'ajaxplorer_textbox',
        'status=0, toolbar=0, location=0, menubar=0, directories=0, ' +
        'resizable=1, scrollbars=0, width=800, height=600'
    );
}

And add below code in ajaxplorer/plugins/gui.ajax/ajxpclient_actions.xml

if(selectorData.get('type') == "ckeditor"){ ... }
else if(selectorData.get('type') == "popup"){
    var ckData = selectorData.get('data');	
    var imagePath = fileName;								
    //=== justnew combining relative path start ===== added by Vibha Jadwani
    var hackStr = window.location.pathname; // /projects/demoproject/ajaxplorer/
    hackStr = hackStr.substr(0,hackStr.indexOf("ajaxplorer")); // /projects/demoproject/
    //=== justnew combining relative path end =====								
    if(ckData['relative_path']){
        imagePath = hackStr + ckData['relative_path'] + fileName;
    }
    window.opener.AJAXPLO.ajaxplorerPopupCallback(imagePath);
    window.close();
}
Advertisements
Comments
  1. mike says:

    easier to point the soft link rather than chaning the php code for the paths . . .

  2. ViVe®s says:

    Warning: fopen(C:\Web Workspace\project/upload/cache/plugins_requires.ser): failed to open stream: No such file or directory in C:\Web Workspace\project\ajaxplorer\core\classes\class.AJXP_Utils.php on line 1032

    Any solution ? i am using localhost

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s