com.baidu.ueditor.define.ActionMap Java Examples

The following examples show how to use com.baidu.ueditor.define.ActionMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigManager.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public Map<String, Object> getConfig ( int type ) {
	
	Map<String, Object> conf = new HashMap<String, Object>();
	String savePath = null;
	
	switch ( type ) {
	
		case ActionMap.UPLOAD_FILE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "fileMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "fileAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "fileFieldName" ) );
			savePath = this.jsonConfig.getString( "filePathFormat" );
			break;
			
		case ActionMap.UPLOAD_IMAGE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "imageMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "imageAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "imageFieldName" ) );
			savePath = this.jsonConfig.getString( "imagePathFormat" );
			break;
			
		case ActionMap.UPLOAD_VIDEO:
			conf.put( "maxSize", this.jsonConfig.getLong( "videoMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "videoAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "videoFieldName" ) );
			savePath = this.jsonConfig.getString( "videoPathFormat" );
			break;
			
		case ActionMap.UPLOAD_SCRAWL:
			conf.put( "filename", ConfigManager.SCRAWL_FILE_NAME );
			conf.put( "maxSize", this.jsonConfig.getLong( "scrawlMaxSize" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "scrawlFieldName" ) );
			conf.put( "isBase64", "true" );
			savePath = this.jsonConfig.getString( "scrawlPathFormat" );
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf.put( "filename", ConfigManager.REMOTE_FILE_NAME );
			conf.put( "filter", this.getArray( "catcherLocalDomain" ) );
			conf.put( "maxSize", this.jsonConfig.getLong( "catcherMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "catcherAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "catcherFieldName" ) + "[]" );
			savePath = this.jsonConfig.getString( "catcherPathFormat" );
			break;
			
		case ActionMap.LIST_IMAGE:
			conf.put( "allowFiles", this.getArray( "imageManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "imageManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "imageManagerListSize" ) );
			break;
			
		case ActionMap.LIST_FILE:
			conf.put( "allowFiles", this.getArray( "fileManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "fileManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "fileManagerListSize" ) );
			break;
			
	}
	
	conf.put( "savePath", savePath );
	conf.put( "rootPath", this.rootPath );
	
	return conf;
	
}
 
Example #2
Source File: ActionEnter.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public String invoke() {
	
	if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
		return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
	}
	
	if ( this.configManager == null || !this.configManager.valid() ) {
		return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
	}
	
	State state = null;
	
	int actionCode = ActionMap.getType( this.actionType );
	
	Map<String, Object> conf = null;
	
	switch ( actionCode ) {
	
		case ActionMap.CONFIG:
			return this.configManager.getAllConfig().toString();
			
		case ActionMap.UPLOAD_IMAGE:
		case ActionMap.UPLOAD_SCRAWL:
		case ActionMap.UPLOAD_VIDEO:
		case ActionMap.UPLOAD_FILE:
			conf = this.configManager.getConfig( actionCode );
			state = new Uploader( request, conf ).doExec();
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf = configManager.getConfig( actionCode );
			String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
			state = new ImageHunter( conf ).capture( list );
			break;
			
		case ActionMap.LIST_IMAGE:
		case ActionMap.LIST_FILE:
			conf = configManager.getConfig( actionCode );
			int start = this.getStartIndex();
			state = new FileManager( conf ).listFile( start );
			break;
			
	}
	
	return state.toJSONString();
	
}
 
Example #3
Source File: ConfigManager.java    From wangmarket with Apache License 2.0 4 votes vote down vote up
public Map<String, Object> getConfig ( int type ) {
	
	Map<String, Object> conf = new HashMap<String, Object>();
	String savePath = null;
	
	switch ( type ) {
	
		case ActionMap.UPLOAD_FILE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "fileMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "fileAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "fileFieldName" ) );
			savePath = this.jsonConfig.getString( "filePathFormat" );
			break;
			
		case ActionMap.UPLOAD_IMAGE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "imageMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "imageAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "imageFieldName" ) );
			savePath = this.jsonConfig.getString( "imagePathFormat" );
			break;
			
		case ActionMap.UPLOAD_VIDEO:
			conf.put( "maxSize", this.jsonConfig.getLong( "videoMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "videoAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "videoFieldName" ) );
			savePath = this.jsonConfig.getString( "videoPathFormat" );
			break;
			
		case ActionMap.UPLOAD_SCRAWL:
			conf.put( "filename", ConfigManager.SCRAWL_FILE_NAME );
			conf.put( "maxSize", this.jsonConfig.getLong( "scrawlMaxSize" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "scrawlFieldName" ) );
			conf.put( "isBase64", "true" );
			savePath = this.jsonConfig.getString( "scrawlPathFormat" );
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf.put( "filename", ConfigManager.REMOTE_FILE_NAME );
			conf.put( "filter", this.getArray( "catcherLocalDomain" ) );
			conf.put( "maxSize", this.jsonConfig.getLong( "catcherMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "catcherAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "catcherFieldName" ) + "[]" );
			savePath = this.jsonConfig.getString( "catcherPathFormat" );
			break;
			
		case ActionMap.LIST_IMAGE:
			conf.put( "allowFiles", this.getArray( "imageManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "imageManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "imageManagerListSize" ) );
			break;
			
		case ActionMap.LIST_FILE:
			conf.put( "allowFiles", this.getArray( "fileManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "fileManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "fileManagerListSize" ) );
			break;
			
	}
	conf.put( "savePath", savePath );
	conf.put( "rootPath", this.rootPath );
	
	return conf;
	
}
 
Example #4
Source File: ActionEnter.java    From wangmarket with Apache License 2.0 4 votes vote down vote up
public String invoke() {
//		Log.debug("invoke--into");
//		Log.debug("actionType -- "+actionType);
//		Log.debug("configManager -- "+this.configManager);
		if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
			return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
		}
		
		if ( this.configManager == null || !this.configManager.valid() ) {
			return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
		}
		
		State state = null;
		
		int actionCode = ActionMap.getType( this.actionType );
		
		Map<String, Object> conf = null;
		
//		Log.debug("invoke--switch before actionCode: "+actionCode);
		switch ( actionCode ) {
		
			case ActionMap.CONFIG:
				return this.configManager.getAllConfig().toString();
				
			case ActionMap.UPLOAD_IMAGE:
			case ActionMap.UPLOAD_SCRAWL:
			case ActionMap.UPLOAD_VIDEO:
			case ActionMap.UPLOAD_FILE:
//				Log.debug("invoke--UPLOAD_IMAGE--actionCode: "+actionCode);
				conf = this.configManager.getConfig( actionCode );
				state = new Uploader( request, conf ).doExec();
				break;
				
			case ActionMap.CATCH_IMAGE:
				conf = configManager.getConfig( actionCode );
				String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
				state = new ImageHunter( conf ).capture( list );
				break;
				
			case ActionMap.LIST_IMAGE:
			case ActionMap.LIST_FILE:
				conf = configManager.getConfig( actionCode );
				int start = this.getStartIndex();
				state = new FileManager( conf ).listFile( start );
				break;
				
		}
		
		return state.toJSONString();
		
	}
 
Example #5
Source File: ConfigManager.java    From hsweb-framework with Apache License 2.0 4 votes vote down vote up
public Map<String, Object> getConfig(int type) {

        Map<String, Object> conf = new HashMap<String, Object>();
        String savePath = null;

        switch (type) {

            case ActionMap.UPLOAD_FILE:
                conf.put("isBase64", "false");
                conf.put("maxSize", this.jsonConfig.getLong("fileMaxSize"));
                conf.put("allowFiles", this.getArray("fileAllowFiles"));
                conf.put("fieldName", this.jsonConfig.getString("fileFieldName"));
                savePath = this.jsonConfig.getString("filePathFormat");
                break;

            case ActionMap.UPLOAD_IMAGE:
                conf.put("isBase64", "false");
                conf.put("maxSize", this.jsonConfig.getLong("imageMaxSize"));
                conf.put("allowFiles", this.getArray("imageAllowFiles"));
                conf.put("fieldName", this.jsonConfig.getString("imageFieldName"));
                savePath = this.jsonConfig.getString("imagePathFormat");
                break;

            case ActionMap.UPLOAD_VIDEO:
                conf.put("maxSize", this.jsonConfig.getLong("videoMaxSize"));
                conf.put("allowFiles", this.getArray("videoAllowFiles"));
                conf.put("fieldName", this.jsonConfig.getString("videoFieldName"));
                savePath = this.jsonConfig.getString("videoPathFormat");
                break;

            case ActionMap.UPLOAD_SCRAWL:
                conf.put("filename", ConfigManager.SCRAWL_FILE_NAME);
                conf.put("maxSize", this.jsonConfig.getLong("scrawlMaxSize"));
                conf.put("fieldName", this.jsonConfig.getString("scrawlFieldName"));
                conf.put("isBase64", "true");
                savePath = this.jsonConfig.getString("scrawlPathFormat");
                break;

            case ActionMap.CATCH_IMAGE:
                conf.put("filename", ConfigManager.REMOTE_FILE_NAME);
                conf.put("filter", this.getArray("catcherLocalDomain"));
                conf.put("maxSize", this.jsonConfig.getLong("catcherMaxSize"));
                conf.put("allowFiles", this.getArray("catcherAllowFiles"));
                conf.put("fieldName", this.jsonConfig.getString("catcherFieldName") + "[]");
                savePath = this.jsonConfig.getString("catcherPathFormat");
                break;

            case ActionMap.LIST_IMAGE:
                conf.put("allowFiles", this.getArray("imageManagerAllowFiles"));
                conf.put("dir", this.jsonConfig.getString("imageManagerListPath"));
                conf.put("count", this.jsonConfig.getIntValue("imageManagerListSize"));
                break;

            case ActionMap.LIST_FILE:
                conf.put("allowFiles", this.getArray("fileManagerAllowFiles"));
                conf.put("dir", this.jsonConfig.getString("fileManagerListPath"));
                conf.put("count", this.jsonConfig.getIntValue("fileManagerListSize"));
                break;

        }

        conf.put("savePath", savePath);
        conf.put("rootPath", this.rootPath);

        return conf;

    }
 
Example #6
Source File: ActionEnter.java    From hsweb-framework with Apache License 2.0 4 votes vote down vote up
public String invoke() {

        if (actionType == null || !ActionMap.mapping.containsKey(actionType)) {
            return new BaseState(false, AppInfo.INVALID_ACTION).toJSONString();
        }

        if (this.configManager == null || !this.configManager.valid()) {
            return new BaseState(false, AppInfo.CONFIG_ERROR).toJSONString();
        }

        State state = null;

        int actionCode = ActionMap.getType(this.actionType);

        Map<String, Object> conf ;

        switch (actionCode) {

            case ActionMap.CONFIG:
                return this.configManager.getAllConfig().toString();

            case ActionMap.UPLOAD_IMAGE:
            case ActionMap.UPLOAD_SCRAWL:
            case ActionMap.UPLOAD_VIDEO:
            case ActionMap.UPLOAD_FILE:
                conf = this.configManager.getConfig(actionCode);
                state = new Uploader(request, conf).doExec();
                break;

            case ActionMap.CATCH_IMAGE:
                conf = configManager.getConfig(actionCode);
                String[] list = this.request.getParameterValues((String) conf.get("fieldName"));
                state = new ImageHunter(conf).capture(list);
                break;

            case ActionMap.LIST_IMAGE:
            case ActionMap.LIST_FILE:
                conf = configManager.getConfig(actionCode);
                int start = this.getStartIndex();
                state = new FileManager(conf).listFile(start);
                break;

        }

        return state == null ? "{}" : state.toJSONString();

    }
 
Example #7
Source File: ConfigManager.java    From cms with Apache License 2.0 4 votes vote down vote up
public Map<String, Object> getConfig ( int type ) {
	
	Map<String, Object> conf = new HashMap<String, Object>();
	String savePath = null;
	
	switch ( type ) {
	
		case ActionMap.UPLOAD_FILE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "fileMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "fileAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "fileFieldName" ) );
			savePath = this.jsonConfig.getString( "filePathFormat" );
			break;
			
		case ActionMap.UPLOAD_IMAGE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "imageMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "imageAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "imageFieldName" ) );
			savePath = this.jsonConfig.getString( "imagePathFormat" );
			break;
			
		case ActionMap.UPLOAD_VIDEO:
			conf.put( "maxSize", this.jsonConfig.getLong( "videoMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "videoAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "videoFieldName" ) );
			savePath = this.jsonConfig.getString( "videoPathFormat" );
			break;
			
		case ActionMap.UPLOAD_SCRAWL:
			conf.put( "filename", ConfigManager.SCRAWL_FILE_NAME );
			conf.put( "maxSize", this.jsonConfig.getLong( "scrawlMaxSize" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "scrawlFieldName" ) );
			conf.put( "isBase64", "true" );
			savePath = this.jsonConfig.getString( "scrawlPathFormat" );
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf.put( "filename", ConfigManager.REMOTE_FILE_NAME );
			conf.put( "filter", this.getArray( "catcherLocalDomain" ) );
			conf.put( "maxSize", this.jsonConfig.getLong( "catcherMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "catcherAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "catcherFieldName" ) + "[]" );
			savePath = this.jsonConfig.getString( "catcherPathFormat" );
			break;
			
		case ActionMap.LIST_IMAGE:
			conf.put( "allowFiles", this.getArray( "imageManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "imageManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "imageManagerListSize" ) );
			break;
			
		case ActionMap.LIST_FILE:
			conf.put( "allowFiles", this.getArray( "fileManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "fileManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "fileManagerListSize" ) );
			break;
			
	}
	
	conf.put( "savePath", savePath );
	conf.put( "rootPath", this.rootPath );
	
	return conf;
	
}
 
Example #8
Source File: ActionEnter.java    From cms with Apache License 2.0 4 votes vote down vote up
public String invoke() {
	
	if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
		return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
	}
	
	if ( this.configManager == null || !this.configManager.valid() ) {
		return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
	}
	
	State state = null;
	
	int actionCode = ActionMap.getType( this.actionType );
	
	Map<String, Object> conf = null;
	
	switch ( actionCode ) {
	
		case ActionMap.CONFIG:
			return this.configManager.getAllConfig().toString();
			
		case ActionMap.UPLOAD_IMAGE:
		case ActionMap.UPLOAD_SCRAWL:
		case ActionMap.UPLOAD_VIDEO:
		case ActionMap.UPLOAD_FILE:
			conf = this.configManager.getConfig( actionCode );
			state = new Uploader( request, conf ).doExec();
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf = configManager.getConfig( actionCode );
			String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );

			if(Configuration.useStatus()) {//使用阿里云oss 存储
				state = new OSSImageHunter(conf).capture(list);
			}else {
				//state = new ImageHunter(conf).capture(list);
				state = new LocalImageHunter(conf).capture(list);
			}
			break;
			
		case ActionMap.LIST_IMAGE:
		case ActionMap.LIST_FILE:
			conf = configManager.getConfig( actionCode );
			int start = this.getStartIndex();

			if(Configuration.useStatus()){//使用阿里云oss 存储
				state = new OSSFileManager( conf ).listFile( start );
			}else {
				state = new FileManager(conf).listFile(start);
			}
			break;
			
	}
	
	return state.toJSONString();
	
}
 
Example #9
Source File: ConfigManager.java    From ueditor with Apache License 2.0 4 votes vote down vote up
public Map<String, Object> getConfig ( int type ) {
	
	Map<String, Object> conf = new HashMap<String, Object>();
	String savePath = null;
	
	switch ( type ) {
	
		case ActionMap.UPLOAD_FILE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "fileMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "fileAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "fileFieldName" ) );
			savePath = this.jsonConfig.getString( "filePathFormat" );
			break;
			
		case ActionMap.UPLOAD_IMAGE:
			conf.put( "isBase64", "false" );
			conf.put( "maxSize", this.jsonConfig.getLong( "imageMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "imageAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "imageFieldName" ) );
			savePath = this.jsonConfig.getString( "imagePathFormat" );
			break;
			
		case ActionMap.UPLOAD_VIDEO:
			conf.put( "maxSize", this.jsonConfig.getLong( "videoMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "videoAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "videoFieldName" ) );
			savePath = this.jsonConfig.getString( "videoPathFormat" );
			break;
			
		case ActionMap.UPLOAD_SCRAWL:
			conf.put( "filename", ConfigManager.SCRAWL_FILE_NAME );
			conf.put( "maxSize", this.jsonConfig.getLong( "scrawlMaxSize" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "scrawlFieldName" ) );
			conf.put( "isBase64", "true" );
			savePath = this.jsonConfig.getString( "scrawlPathFormat" );
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf.put( "filename", ConfigManager.REMOTE_FILE_NAME );
			conf.put( "filter", this.getArray( "catcherLocalDomain" ) );
			conf.put( "maxSize", this.jsonConfig.getLong( "catcherMaxSize" ) );
			conf.put( "allowFiles", this.getArray( "catcherAllowFiles" ) );
			conf.put( "fieldName", this.jsonConfig.getString( "catcherFieldName" ) + "[]" );
			savePath = this.jsonConfig.getString( "catcherPathFormat" );
			break;
			
		case ActionMap.LIST_IMAGE:
			conf.put( "allowFiles", this.getArray( "imageManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "imageManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "imageManagerListSize" ) );
			break;
			
		case ActionMap.LIST_FILE:
			conf.put( "allowFiles", this.getArray( "fileManagerAllowFiles" ) );
			conf.put( "dir", this.jsonConfig.getString( "fileManagerListPath" ) );
			conf.put( "count", this.jsonConfig.getInt( "fileManagerListSize" ) );
			break;
			
	}
	
	conf.put( "savePath", savePath );
	conf.put( "rootPath", this.rootPath );
	
	return conf;
	
}
 
Example #10
Source File: ActionEnter.java    From ueditor with Apache License 2.0 4 votes vote down vote up
public String invoke() {
	
	if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
		return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
	}
	
	if ( this.configManager == null || !this.configManager.valid() ) {
		return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
	}
	
	State state = null;
	
	int actionCode = ActionMap.getType( this.actionType );
	
	Map<String, Object> conf = null;
	
	switch ( actionCode ) {
	
		case ActionMap.CONFIG:
			return this.configManager.getAllConfig().toString();
			
		case ActionMap.UPLOAD_IMAGE:
		case ActionMap.UPLOAD_SCRAWL:
		case ActionMap.UPLOAD_VIDEO:
		case ActionMap.UPLOAD_FILE:
			conf = this.configManager.getConfig( actionCode );
			state = new Uploader( request, conf ).doExec();
			break;
			
		case ActionMap.CATCH_IMAGE:
			conf = configManager.getConfig( actionCode );
			String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
			state = new ImageHunter( conf ).capture( list );
			break;
			
		case ActionMap.LIST_IMAGE:
		case ActionMap.LIST_FILE:
			conf = configManager.getConfig( actionCode );
			int start = this.getStartIndex();
			state = new FileManager( conf ).listFile( start );
			break;
			
	}
	
	return state.toJSONString();
	
}
 
Example #11
Source File: MyConfigManager.java    From ueditor with Apache License 2.0 4 votes vote down vote up
public Map<String, Object> getConfig(int type) {

        Map<String, Object> conf = new HashMap<String, Object>();
        String savePath = null;

        switch (type) {

        case ActionMap.UPLOAD_FILE:
            conf.put("isBase64", "false");
            conf.put("maxSize", this.jsonConfig.getLong("fileMaxSize"));
            conf.put("allowFiles", this.getArray("fileAllowFiles"));
            conf.put("fieldName", this.jsonConfig.getString("fileFieldName"));
            savePath = this.jsonConfig.getString("filePathFormat");
            break;

        case ActionMap.UPLOAD_IMAGE:
            conf.put("isBase64", "false");
            conf.put("maxSize", this.jsonConfig.getLong("imageMaxSize"));
            conf.put("allowFiles", this.getArray("imageAllowFiles"));
            conf.put("fieldName", this.jsonConfig.getString("imageFieldName"));
            savePath = this.jsonConfig.getString("imagePathFormat");
            break;

        case ActionMap.UPLOAD_VIDEO:
            conf.put("maxSize", this.jsonConfig.getLong("videoMaxSize"));
            conf.put("allowFiles", this.getArray("videoAllowFiles"));
            conf.put("fieldName", this.jsonConfig.getString("videoFieldName"));
            savePath = this.jsonConfig.getString("videoPathFormat");
            break;

        case ActionMap.UPLOAD_SCRAWL:
            conf.put("filename", MyConfigManager.SCRAWL_FILE_NAME);
            conf.put("maxSize", this.jsonConfig.getLong("scrawlMaxSize"));
            conf.put("fieldName", this.jsonConfig.getString("scrawlFieldName"));
            conf.put("isBase64", "true");
            savePath = this.jsonConfig.getString("scrawlPathFormat");
            break;

        case ActionMap.CATCH_IMAGE:
            conf.put("filename", MyConfigManager.REMOTE_FILE_NAME);
            conf.put("filter", this.getArray("catcherLocalDomain"));
            conf.put("maxSize", this.jsonConfig.getLong("catcherMaxSize"));
            conf.put("allowFiles", this.getArray("catcherAllowFiles"));
            conf.put("fieldName", this.jsonConfig.getString("catcherFieldName") + "[]");
            savePath = this.jsonConfig.getString("catcherPathFormat");
            break;

        case ActionMap.LIST_IMAGE:
            conf.put("allowFiles", this.getArray("imageManagerAllowFiles"));
            conf.put("dir", this.jsonConfig.getString("imageManagerListPath"));
            conf.put("count", this.jsonConfig.getInt("imageManagerListSize"));
            break;

        case ActionMap.LIST_FILE:
            conf.put("allowFiles", this.getArray("fileManagerAllowFiles"));
            conf.put("dir", this.jsonConfig.getString("fileManagerListPath"));
            conf.put("count", this.jsonConfig.getInt("fileManagerListSize"));
            break;

        }

        conf.put("savePath", savePath);
//        conf.put("rootPath", this.rootPath);

        return conf;

    }
 
Example #12
Source File: MyActionEnter.java    From ueditor with Apache License 2.0 4 votes vote down vote up
public String invoke() {

        if (actionType == null || !ActionMap.mapping.containsKey(actionType)) {
            return new BaseState(false, AppInfo.INVALID_ACTION).toJSONString();
        }

        if (this.configManager == null || !this.configManager.valid()) {
            return new BaseState(false, AppInfo.CONFIG_ERROR).toJSONString();
        }

        State state = null;

        int actionCode = ActionMap.getType(this.actionType);

        Map<String, Object> conf = null;

        switch (actionCode) {

        case ActionMap.CONFIG:
            return this.configManager.getAllConfig().toString();

        case ActionMap.UPLOAD_IMAGE:
        case ActionMap.UPLOAD_SCRAWL:
        case ActionMap.UPLOAD_VIDEO:
        case ActionMap.UPLOAD_FILE:
            conf = this.configManager.getConfig(actionCode);
            state = new Uploader(request, conf).doExec();
            break;

        case ActionMap.CATCH_IMAGE:
            conf = configManager.getConfig(actionCode);
            String[] list = this.request.getParameterValues((String) conf.get("fieldName"));
            state = new ImageHunter(conf).capture(list);
            break;

        case ActionMap.LIST_IMAGE:
        case ActionMap.LIST_FILE:
            conf = configManager.getConfig(actionCode);
            int start = this.getStartIndex();
            state = new FileManager(conf).listFile(start);
            break;

        }

        return state.toJSONString();

    }