function RunModule() { echo '<h1>' . $this->GetTitle() . '</h1>'; echo '{list.' . get_class($this) . '}'; list($path, $pathUpload) = uUploads::Init(); $relRoot = PATH_REL_ROOT; echo '<div class="module-content">You are here: Uploads <span id="mediaPath"></span><div id="fileMan"></div></div>'; $pluploadOpts = ''; if (class_exists('uPlupload')) { $jsOptionVar = 'filemanagerOptions'; uPlupload::Init($jsOptionVar, $pathUpload); $pluploadOpts = ',' . $jsOptionVar; } uJavascript::AddText(<<<FIN \t\$(function(){ \t\t\$('#fileMan') \t\t\t.fileManager({ajaxPath:'{$path}',virtualRoot:'{$relRoot}uploads',upload:true}{$pluploadOpts}) \t\t\t.on('changed',function(event, data){ \$('#mediaPath').text(data.path.replace(/\\//g,' > ')); }) \t\t\t.on('dblclick','.fmFile',function() { \t\t\t\tvar item = \$(this).data('item'); \t\t\t\tif (item.type != 0) return; \t\t\t\twindow.open(item.fullPath); \t\t\t}); \t}); FIN ); }
static function Init($jsVarName, $uploadPath) { $pathCore = PATH_REL_CORE; uJavascript::AddText(<<<FIN var {$jsVarName} = { runtimes : 'html5,flash,browserplus,html4', chunk_size : '1mb', url : '{$uploadPath}', flash_swf_url : '{$pathCore}modules/plupload/lib/plupload.flash.swf' }; FIN ); }
public static function MediaScript() { if (!isset($_REQUEST['__ajax']) || $_REQUEST['__ajax'] !== 'media') { return; } uJavascript::AddText(<<<FIN \t\$(function(){ \t\t\$('#fileMan').off('dblclick','.fmFile').on('dblclick','.fmFile',function(event){ \t\t\tvar item = \$(this).data('item'); \t\t\tif (item.type != 0) return; \t\t\twindow.opener.CKEDITOR.tools.callFunction({$_GET['CKEditorFuncNum']}, item.fullPath); \t\t\twindow.close(); \t\t}); \t}); FIN ); echo '<style>.ui-widget{font-size:0.8em}body{font-family:Arial}</style>'; }
public static function ShowNotices() { // is redirect issued? If so, don't draw now. foreach (headers_list() as $h) { if (preg_match('/^location:/i', $h)) { return; } } if (!utopia::UsingTemplate() && !AjaxEcho()) { return; } if (!isset($_SESSION['notices'])) { return; } $scripts = implode(PHP_EOL, $_SESSION['notices']); $_SESSION['notices'] = array(); if (!AjaxEcho($scripts)) { uJavascript::AddText('$(function(){' . $scripts . '});'); } }
static function show_fileman($fieldName, $inputType, $defaultValue = '', $possibleValues = NULL, $attributes = NULL, $noSubmit = FALSE) { list($path) = self::Init(); //if (!is_array($attributes)) $attributes = array(); //$attributes['onclick'] = 'alert("moo");return false;'; uJavascript::AddText(<<<FIN \tfunction filesel(id,item) { \t\tif (item.type != 0) return; \t\t\$('#fileMan').dialog('close'); \t\tuf(id,item.fullPath,'{$fieldName}'); \t} //\t\$(document).ready(function() { //\t\t\$('#fileMan').dialog({autoOpen: false}); //\t} FIN ); return '<div id="fileMan"></div>' . utopia::DrawInput($fieldName, itTEXT, $defaultValue, $possibleValues, $attributes, $noSubmit) . '<input id="' . $fieldName . '" type="button" onclick="$(\'#fileMan\').fileManager({ajaxPath:\'' . $path . '\'}).on(\'dblclick\',\'.fmFile\',function(event) {filesel(\'' . $fieldName . '\',$(this).data(\'item\'))}).dialog();" value="Choose File">'; //return $out.$defaultValue.utopia::DrawInput($fieldName,itBUTTON,'Choose File',$possibleValues,$attributes,$noSubmit); }