diff --git a/e107_admin/image.php b/e107_admin/image.php index 2e17e94a9..c91b8908b 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -53,6 +53,12 @@ class media_admin extends e_admin_dispatcher 'ui' => 'media_form_ui', 'uipath' => null ), + 'dialog' => array( + 'controller' => 'media_admin_ui', + 'path' => null, + 'ui' => 'media_form_ui', + 'uipath' => null + ), 'cat' => array( 'controller' => 'media_cat_ui', 'path' => null, @@ -197,7 +203,19 @@ class media_form_ui extends e_admin_form_ui asort($this->cats);*/ } - + function options() + { + //return print_a($_GET,true); + $tagid = $_GET['tagid']; + $path = $this->getController()->getListModel()->get('media_url'); + $preview = basename($path); + + + $text .= ""; + // $text .= "SELECT"; + // $text .= "\n\n"; + return $text; + } @@ -336,6 +354,27 @@ class media_admin_ui extends e_admin_ui { $this->updateSettings(); } + + if($this->getQuery('mode') == 'dialog') + { + $cat = $_GET['for']; + $this->listQry = "SELECT m.*,u.user_id,u.user_name FROM #core_media AS m LEFT JOIN #user AS u ON m.media_author = u.user_id WHERE media_category = '".$cat."' "; // without any Order or Limit. + + unset($this->fields['checkboxes']); + $this->fields['options']['type'] = 'method'; + $this->fields['media_userclass']['nolist'] = true; + $this->fields['media_dimentions']['nolist'] = true; + $this->fields['media_description']['nolist'] = true; + $this->fields['media_type']['nolist'] = true; + + foreach($this->fields as $k=>$v) + { + $this->fields[$k]['filter'] = false; + } + } + + + if($this->getQuery('iframe')) { @@ -397,15 +436,26 @@ class media_admin_ui extends e_admin_ui function dialogPage() // Popup dialogPage for Image Selection. { + $cat = $this->getQuery('for'); + $file = (substr($cat,-5) == "_file") ? TRUE : FALSE; + + if($file) + { + + echo $this->getUI()->getList(); + return; + } + + // $this->getModel()->setAction('create'); // $this->getUI()->getController()->getRequest()->setAction('create'); //$this->setAction('create');; if($_POST['etrigger_submit']) { - $data = $this->beforeCreate($_POST); - e107::getDb()->db_Insert('core_media',$data); // Replace with Generic (needs parm sent) + // $data = $this->beforeCreate($_POST); + // e107::getDb()->db_Insert('core_media',$data); // Replace with Generic (needs parm sent) } echo $this->imageSelectUpload(); } @@ -467,8 +517,8 @@ class media_admin_ui extends e_admin_ui $this->fields['media_url']['noedit'] = TRUE; $this->fields['media_userclass']['noedit'] = TRUE; - // $text .= $this->uploadPage(); // To test upload script with plupload - $text .= $this->CreatePage(); // comment me out to test plupload + $text .= $this->uploadPage(); // To test upload script with plupload + // $text .= $this->CreatePage(); // comment me out to test plupload $text .= " "; diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index bca842d6d..7ba0fb11d 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -1119,6 +1119,36 @@ function update_706_to_800($type='') $med->import('download_thumb',e_FILE.'downloadthumbs'); } + $dl_files = $fl->get_files(e_DOWNLOAD, "","standard",5); + $public_files = $fl->get_files(e_FILE.'public'); + + if((count($dl_files) || count($public_files)) && !$sql->db_Select_gen("SELECT * FROM `#core_media` WHERE `media_category` = 'download_file' ")) + { + if ($just_check) return update_needed('Import Download and Public Files into Media Manager'); + // check for file-types; + if (is_readable(e_ADMIN.'filetypes.php')) + { + $a_types = strtolower(trim(file_get_contents(e_ADMIN.'filetypes.php'))); + $srch = array("png","jpg","jpeg","gif"); + $a_types = str_replace($srch,"",$a_types); // filter-out images. + + } else + { + $a_types = 'zip, gz, pdf'; + } + + $a_types = explode(',', $a_types); + foreach ($a_types as $f_type) { + $allowed_types[] = trim(str_replace('.', '', $f_type)); + } + + $fmask = '[a-zA-z0-9_-]+\.('.implode('|',$allowed_types).')$'; + $med->import('download_file',e_DOWNLOAD, $fmask); + $med->import('_common_file',e_FILE.'public', $fmask); + } + + + $count = $sql->db_Select_gen("SELECT * FROM `#core_media_cat` WHERE media_cat_owner='_icon' "); diff --git a/e107_files/jslib/core/admin.jquery.js b/e107_files/jslib/core/admin.jquery.js index 0e0c4002a..194ff0749 100644 --- a/e107_files/jslib/core/admin.jquery.js +++ b/e107_files/jslib/core/admin.jquery.js @@ -61,7 +61,7 @@ $(document).ready(function() $("a.e-dialog").colorbox({ iframe:true, width:"60%", - height:"65%", + height:"70%", speed:100 }); @@ -352,7 +352,7 @@ $(document).ready(function() var opt = linkid.split('-'); if(area == 'remove') - { alert(area); + { // alert(area); var remove = linkid; areaList = ''; $('#check-' + opt[1]).show('fast'); diff --git a/e107_files/jslib/core/mediaManager.js b/e107_files/jslib/core/mediaManager.js index e6c339813..f065feb47 100644 --- a/e107_files/jslib/core/mediaManager.js +++ b/e107_files/jslib/core/mediaManager.js @@ -98,7 +98,7 @@ $(document).ready(function() $(".e-media-select").live("click", function(){ - // console.log(this); + console.log(this); @@ -111,7 +111,9 @@ $(document).ready(function() $(this).closest("img").addClass("active"); $('#' + target, window.top.document).attr('value',path); // set new value - $('#' + target + "_prev", window.top.document).attr('src',preview); // set new value + $('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value + $('div#' + target + "_prev", window.top.document).html(preview); // set new value + $('span#' + target + "_prev", window.top.document).html(preview); // set new value $('#src').attr('value',src); // working old $('#preview').attr('src',preview); // working old diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 138480ea5..66d9bc3e8 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -144,21 +144,31 @@ class e_form return $ret; } - // FIXME - Dialog JS no more working, investigate - public function mediaUrl($category = '', $label = '', $tagid='', $bbcode='') + /** + * Internal Function used by imagepicker and filepicker + */ + private function mediaUrl($category = '', $label = '', $tagid='', $extras='') { + $cat = ($category) ? '&for='.$category : ""; if(!$label) $label = ' Upload an image or file'; if($tagid) $cat .= '&tagid='.$tagid; + + parse_str($extras); + if($bbcode) $cat .= '&bbcode=1'; + + if(!$mode) $mode = 'main'; + if(!$action) $action = 'dialog'; + // $tabs // TODO - option to choose which tabs to display. //TODO Parse selection data back to parent form. - $url = e_ADMIN_ABS."image.php?mode=main&action=dialog".$cat; + $url = e_ADMIN_ABS."image.php?mode={$mode}&action={$action}".$cat; $url .= "&iframe=1"; - $ret = "".$label.""; + $ret = "".$label.""; // $footer = "