コード例 #1
0
ファイル: ewplupload.php プロジェクト: stan5621/eduwind
 /**
  * register the required scripts and style
  */
 function init()
 {
     $cloudStorageForm = new CloudStorageForm();
     $cloudStorageForm->getSetting();
     $storage = $cloudStorageForm->storage;
     if ($storage == 'cloud') {
         Yii::app()->getClientScript()->registerCoreScript('jquery')->registerScriptFile($this->getBaseUrl() . '/js/plupload/plupload.full.min.js')->registerScriptFile($this->getBaseUrl() . '/js/plupload/i18n/zh_CN.js')->registerScriptFile($this->getBaseUrl() . '/js/ui.js')->registerScriptFile($this->getBaseUrl() . '/js/ewcloud.js')->registerScriptFile($this->getBaseUrl() . '/js/cloudmain.js')->registerCssFile($this->getBaseUrl() . '/main.css');
     } else {
         Yii::app()->getClientScript()->registerCoreScript('jquery')->registerScriptFile($this->getBaseUrl() . '/js/plupload/plupload.full.min.js')->registerScriptFile($this->getBaseUrl() . '/js/plupload/i18n/zh_CN.js')->registerScriptFile($this->getBaseUrl() . '/js/ui.js')->registerScriptFile($this->getBaseUrl() . '/js/localmain.js')->registerCssFile($this->getBaseUrl() . '/main.css');
     }
     return parent::init();
 }
コード例 #2
0
ファイル: CloudService.php プロジェクト: stan5621/eduwind
 private function __construct()
 {
     $cloudStorageForm = new CloudStorageForm();
     $cloudStorageForm->getSetting();
     if (isset($cloudStorageForm->bucket) && $cloudStorageForm->bucket) {
         $this->_bucket = $cloudStorageForm->bucket;
     }
     if (isset($cloudStorageForm->accessKey) && $cloudStorageForm->accessKey) {
         $this->_accessKey = $cloudStorageForm->accessKey;
     }
     if (isset($cloudStorageForm->secretKey) && $cloudStorageForm->secretKey) {
         $this->_secretKey = $cloudStorageForm->secretKey;
     }
     if (isset($cloudStorageForm->cloudServer) && $cloudStorageForm->cloudServer) {
         $this->_cloudServer = $cloudStorageForm->cloudServer;
     }
     if (isset($cloudStorageForm->apiServer) && $cloudStorageForm->apiServer) {
         $this->_apiServer = $cloudStorageForm->apiServer;
     }
     if (isset($cloudStorageForm->uploadServer) && $cloudStorageForm->uploadServer) {
         $this->_uploadServer = $cloudStorageForm->uploadServer;
     }
 }
コード例 #3
0
<h3 class="dxd-fancybox-header">上传文件</h3>
<div class="dxd-fancybox-body">

<?php 
$cloudStorageForm = new CloudStorageForm();
$cloudStorageForm->getSetting();
$storage = $cloudStorageForm->storage;
?>

	<br />

	<div id="dxd-for-self"
		class="dxd-media-source <?php 
if ($model->mediaSource != "self") {
    echo 'dxd-hidden';
}
?>
">

		<?php 
if ($storage == 'cloud') {
    $cloudService = CloudService::getInstance("uploads/uploadFile/lesson/mediaId/" . DxdUtil::randCode(32));
    //	$cloudService = new CloudService();
    $this->widget('ext.uploadify.MUploadify', array('name' => 'file', 'buttonText' => '选择文件', 'auto' => true, 'uploader' => 'http://up.eduwind.com', 'formData' => array('token' => $cloudService->makeUploadToken(), 'key' => $cloudService->getKey()), 'onUploadSuccess' => "js:function(file, data, response) {\n\t\t\t   \t\t\t\t\tdataObj = JSON.parse(data);\n\t\t\t   \t\t\t\t\tif(data){\n\t\t\t  \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-success\\'>“' + file.name + '</span>”已经上传成功。');\n\t\t\t  \t\t\t\t\t\t\$.post('" . $this->createUrl('setMedia', array('lessonId' => $model->id)) . "',{name:file.name,mediaId:dataObj.id});\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t  \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-error\\'>“' + file.name + '</span>”上传失败。');\n    \t\t\t\t\t\t\t}\n\t\t\t\t\t}", 'onQueueComplete' => "js:function(queueData) {\n\t\t\t            \$('div#file').addClass('dxd-hidden');\n\t\t\t        }"));
    //    	$this->widget('ext.uploadify.MUploadify',CloudService::getInstance("uploads/uploadFile/lesson/mediaId/".DxdUtil::randCode(32))->getUploadifySetting());
    //    	CloudService::getInstance()->cloudService();
} else {
    $this->widget('ext.uploadify.MUploadify', array('name' => 'file', 'buttonText' => '选择文件', 'uploader' => $this->createUrl('upload', array('lessonId' => $model->id)), 'auto' => true, 'onUploadSuccess' => "js:function(file, data, response) {\n\t\t\t   \t\t\t\t\tif(data){\n\t\t\t  \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-success\\'>“' + file.name + '</span>”已经上传成功。');\n\t\t\t  \t\t\t\t\t}else{\n\t\t\t  \t\t\t\t\t\t\$('#uploaded-file-{$model->id}').html('<span style=\\'text-error\\'>“' + file.name + '</span>”上传失败。');\n    \t\t\t\t\t\t\t}\n\t\t\t\t\t        }", 'onQueueComplete' => "js:function(queueData) {\n\t\t\t            \$('div#file').addClass('dxd-hidden');\n\t\t\t        }"));
}
//	echo $form->hiddenField($model,'mediaId',array('id'=>'mediaId'));
?>