diff --git a/e107_admin/image.php b/e107_admin/image.php index 05731c534..437e156ad 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -46,12 +46,6 @@ if(isset($_POST['submit_cancel_show'])) include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); -if(vartrue($_GET['action']) == 'youtube' && e_AJAX_REQUEST) //XXX Doesn't work correctly inside the class for some reason -{ - //echo "it works"; - //exit; - -} if(vartrue($_GET['action']) == 'nav' && e_AJAX_REQUEST) //XXX Doesn't work correctly inside the class for some reason { @@ -196,7 +190,7 @@ class media_cat_ui extends e_admin_ui "download" => "download" ); - // FIXME lan + // FIXME LAN $this->fields['media_cat_type']['writeParms'] = array('image' => 'Image', 'file' => 'File', 'video' => 'Video'); if($this->getAction() == 'list') @@ -253,7 +247,7 @@ class media_cat_ui extends e_admin_ui // XXX temporary disable when there is no owners, discuss if(!$new_data['media_cat_owner']) { - e107::getMessage()->addError('No media owner found.'); // FIXME lan + e107::getMessage()->addError('No media owner found.'); // FIXME LAN return false; } //$replace = array("_"," ","'",'"',"."); //FIXME Improve @@ -837,21 +831,26 @@ class media_admin_ui extends e_admin_ui $this->prefs['watermark_pos']['writeParms'] = $wm_pos; $this->prefs['watermark_pos']['readParms'] = $wm_pos; - - //FIXME TODO - clear thumbnail cache when prefs are saved/updated. - // e107::getCache()->clearAll('image'); + + e107::getCache()->clearAll('image'); // print_a($_GET); if($this->getAction() == 'youtube') { $parm = array('search'=>$_GET['search']); - echo $this->videotab($parm); + echo $this->videoTab($parm); exit; } + if($this->getAction() == 'glyph') + { + $parm = array('search'=>$_GET['search']); + echo $this->glyphTab($parm); + exit; + } - if($_GET['action'] == 'nav' ) + if($this->getAction() == 'nav' ) { //echo $this->navPage();\ // $this->getResponse()->setIframeMod(); // disable header/footer menus etc. @@ -908,17 +907,7 @@ class media_admin_ui extends e_admin_ui } -// - // if($this->getQuery('for') && $this->getMediaCategory($this->getQuery('for'))) - // { -// - // $this->setPosted('media_category', $this->getQuery('for')); - // if(!$this->getId()) - // { - // $this->getModel()->set('media_category', $this->getQuery('for')); - // } - // } -// + } @@ -953,7 +942,8 @@ class media_admin_ui extends e_admin_ui $mes->addDebug("For:".$cat); $mes->addDebug("Bbcode: ".$this->getQuery('bbcode')); - + + $this->processUploadUrl(true, $cat); if($file) @@ -991,13 +981,11 @@ class media_admin_ui extends e_admin_ui - function uploadPage() + function uploadTab() { if(!ADMIN){ exit; } //TODO check for upload-access in perms. - - // if 'for' has no value, files are placed in /temp and not added to the db. $text = '

No HTML5 support.

@@ -1011,8 +999,9 @@ class media_admin_ui extends e_admin_ui $text .= ""; $text .= $frm->admin_button('upload_remote_url',1,'create','Start Upload'); $text .= "
"; + $text .= "\n\n"; - $text .= ""; + $text .= $frm->close(); return $text; } @@ -1067,7 +1056,7 @@ class media_admin_ui extends e_admin_ui
- Library +
"; @@ -1095,13 +1084,13 @@ class media_admin_ui extends e_admin_ui
- Upload"; + "; $this->fields['media_category']['readonly'] = TRUE; $this->fields['media_url']['noedit'] = TRUE; $this->fields['media_userclass']['noedit'] = TRUE; - $text .= $this->uploadPage(); // To test upload script with plupload + $text .= $this->uploadTab(); // To test upload script with plupload // $text .= $this->CreatePage(); // comment me out to test plupload $text .= " @@ -1116,7 +1105,7 @@ class media_admin_ui extends e_admin_ui if($options['bbcode']) { $text .= "
- Appearance +
@@ -1175,15 +1164,8 @@ class media_admin_ui extends e_admin_ui { //TODO $text .= "
"; - $glyphs = e107::getMedia()->getGlyphs(); - - foreach($glyphs as $val) - { - $text .= ""; - $text .= ""; - $text .= "\n\n"; - } - + + $text .= $this->glyphTab(); $text .= "
"; @@ -1194,10 +1176,10 @@ class media_admin_ui extends e_admin_ui if($this->getQuery('video')) { $text .= "
"; - $text .= "
"; + // $text .= "
"; $text .= $this->videoTab(); $text .= "
"; - $text .= "
"; + // $text .= "
"; } @@ -1222,29 +1204,104 @@ class media_admin_ui extends e_admin_ui Cancel"; - - // TODO to eventually be hidden. - + $type = (E107_DEBUG_LEVEL > 0) ? "text" : "hidden"; $br = (E107_DEBUG_LEVEL > 0) ? "
" : ""; $text .= " ".$br." ".$br." - ".$br." - ".$br." + ".$br." + ".$br." "; } return $text; } + + + function glyphTab($parm='') + { + + $parms = array( + 'width' => 32, + 'height' => 32, + 'type' =>'glyph', + 'tagid' => $this->getQuery('tagid'), + 'action' =>'glyph', // Used by AJAX to identify correct function. + 'perPage' => 90, + 'gridClass' => 'media-carousel-item-glyph pull-left', + + + ); + + //TODO FIXME Upgrade to bs3 when Bootstrap3 Admin is ready. + $bs2 = e107::getMedia()->getGlyphs('bs2','icon-'); + + foreach($bs2 as $val) + { + $items[] = array( + 'previewUrl' => $val, + 'saveValue' => $val.'.glyph', + 'thumbUrl' => $val, + 'title' => $val, + 'slideCaption' => 'Bootstrap', + 'slideCategory' => 'bootstrap' + ); + + + + $text .= ""; + $text .= ""; + $text .= "\n\n"; + } + + $fa4 = e107::getMedia()->getGlyphs('fa4'); + e107::css('url', "//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"); + + foreach($fa4 as $val) + { + $items[] = array( + 'previewUrl' => $val, + 'saveValue' => $val.'.glyph', + 'thumbUrl' => $val, + 'title' => $val, + 'slideCaption' => 'Font-Awesome 4', + 'slideCategory' => 'font-awesome' + ); + + } + + if(vartrue($parm['search'])) + { + $filtered = array(); + foreach($items as $v) + { + if(strpos($v['title'], $parm['search'])!==false) + { + $v['slideCaption'] = ''; + $filtered[] = $v; + + } + } + + $items = $filtered; + } + + return e107::getMedia()->browserCarousel($items, $parms); + } + + + function videoTab($parm='') { // $feed = "https://gdata.youtube.com/feeds/base/users/e107inc/uploads"; - + + // @see https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters + if($search = vartrue($this->getQuery('search'))) { $feed = "http://gdata.youtube.com/feeds/api/videos?orderby=relevance&vq=".urlencode($search)."&max-results=50"; // maximum is 50. @@ -1742,7 +1799,7 @@ class media_admin_ui extends e_admin_ui $mes->add("No media Found! Please upload some files.", E_MESSAGE_INFO); } - $text = $this->uploadPage(); + $text = $this->uploadTab(); echo $mes->render().$text; return; } diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 9718e178a..6d13217de 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -1936,7 +1936,7 @@ class e_parse extends e_parser $baseurl = ($full ? SITEURL : e_HTTP).'thumb.php?'; - $thurl = 'src='.$url.'&'; + $thurl = 'src='.urlencode($url).'&'; if(vartrue($options['aw']) || vartrue($options['ah']) || $this->thumbCrop == 1) { @@ -2671,25 +2671,14 @@ class e_parser } // Bootstrap 3 Glyph names. - $bs3 = array( - 'adjust','align-center','align-justify','align-left','align-right','arrow-down','arrow-left','arrow-right','arrow-up','asterisk','backward','ban-circle','barcode','bell','bold','book - ','bookmark','briefcase','bullhorn','calendar','camera','certificate','check','chevron-down','chevron-left','chevron-right','chevron-up','circle-arrow-down','circle-arrow-left','circle-arrow-right - ','circle-arrow-up','cloud','cloud-download','cloud-upload','cog','collapse-down','collapse-up','comment','compressed','copyright-mark','credit-card','cutlery','dashboard','download','download-alt - ','earphone','edit','eject','envelope','euro','exclamation-sign','expand','export','eye-close','eye-open','facetime-video','fast-backward','fast-forward','file','film','filter','fire','flag - ','flash','floppy-disk','floppy-open','floppy-remove','floppy-save','floppy-saved','folder-close','folder-open','font','forward','fullscreen','gbp','gift - ','glass','globe','hand-down','hand-left','hand-right','hand-up','hd-video','hdd','header','headphones','heart','heart-empty','home','import','inbox','indent-left','indent-right','info-sign','italic','leaf','link','list - ','list-alt','lock','log-in','log-out','magnet','map-marker','minus','minus-sign','move','music','new-window','off','ok','ok-circle','ok-sign','open','paperclip','pause','pencil','phone','phone-alt','picture - ','plane','play','play-circle','plus','plus-sign','print','pushpin','qrcode','question-sign','random','record','refresh','registration-mark','remove','remove-circle','remove-sign','repeat','resize-full','resize-horizontal - ','resize-small','resize-vertical','retweet','road','save','saved','screenshot','sd-video','search','send','share','share-alt','shopping-cart','signal','sort','sort-by-alphabet','sort-by-alphabet-alt - ','sort-by-attributes','sort-by-attributes-alt','sort-by-order','sort-by-order-alt','sound-5-1','sound-6-1','sound-7-1','sound-dolby','sound-stereo','star','stats','step-backward','step-forward','stop - ','subtitles','tag','tags','tasks','text-height','text-width','th','th-large','th-list','thumbs-down','thumbs-up','time','tint','tower','transfer','trash','tree-conifer','tree-deciduous','unchecked','upload - ','usd','user','volume-down','volume-off','volume-up','warning-sign','wrench','zoom-in','zoom-out' - ); + $bs3 = e107::getMedia()->getGlyphs('bs3',''); if(substr($text,-6) == '.glyph' || strpos($text,".")==false) // Bootstrap or Font-Awesome. { list($cls,$tmp) = explode('.glyph',$text); + list($type, $tmp2) = explode("-",$text,2); + $id = str_replace("icon-","",$cls); if(deftrue('FONTAWESOME') == 4 && !in_array($id ,$bs3)) // Convert FontAwesome 3 to 4. @@ -2701,6 +2690,12 @@ class e_parser $cls = str_replace('icon-', 'glyphicon glyphicon-', $cls); } + if($type == 'fa') + { + $cls = str_replace('fa-', 'fa fa-', $cls); + } + + $text = (deftrue('BOOTSTRAP') === 3) ? "" : ""; // retain space. $text .= ($space !== false) ? $space : ""; @@ -2768,7 +2763,7 @@ class e_parser if($type == 'youtube') { - $video = ''; + $video = ''; $thumbSrc = "https://i1.ytimg.com/vi/".$id."/0.jpg"; if($thumb == 'tag') diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 8eeddf2ec..b5b10dbfb 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -596,16 +596,17 @@ class e_media $data_src = $this->mediaSelectNav($category,$tagid, $option); // ."&from=0"; // Inline style to override jquery-ui stuff. - $text .= "
- - "; + $text .= "
+
+ + "; // $text .= " "; // Manual filter, if onkeyup ajax fails for some reason. - $text .= ""; // Manual filter, if onkeyup ajax fails for some reason. + $text .= ""; // Manual filter, if onkeyup ajax fails for some reason. - $text .= " "; // see next page of images. + $text .= ""; // see next page of images. $text .= ""; // see next page of images. - $text .= "
"; + $text .= "
"; $text .= "
"; @@ -768,21 +769,94 @@ class e_media * Get all Glyphs * @todo Cache */ - function getGlyphs() + function getGlyphs($type='fa4',$prefix = '') { + $icons = array(); - $pattern = '/\.(icon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; - $subject = file_get_contents(e_WEB_JS.'font-awesome/css/font-awesome.css'); + if($type == 'bs2') + { + $matches = array( + 'glass','music','search','envelope','heart','star','star-empty','user','film','th-large','th','th-list','ok', + 'remove','zoom-in','zoom-out','off','signal','cog','trash','home','file','time','road','download-alt','download', + 'upload','inbox','play-circle','repeat','refresh','list-alt','lock','flag','headphones','volume-off','volume-down', + 'volume-up','qrcode','barcode','tag','tags','book','bookmark','print','camera','font','bold','italic','text-height', + 'text-width','align-left','align-center','align-right','align-justify','list','indent-left','indent-right', + 'facetime-video','picture','pencil','map-marker','adjust','tint','edit','share','check','move','step-backward', + 'fast-backward','backward','play','pause','stop','forward','fast-forward','step-forward','eject','chevron-left', + 'chevron-right','plus-sign','minus-sign','remove-sign','ok-sign','question-sign','info-sign','screenshot', + 'remove-circle','ok-circle','ban-circle','arrow-left','arrow-right','arrow-up','arrow-down','share-alt', + 'resize-full','resize-small','plus','minus','asterisk','exclamation-sign','gift','leaf','fire','eye-open', + 'eye-close','warning-sign','plane','calendar','random','comment','magnet','chevron-up','chevron-down', + 'retweet','shopping-cart','folder-close','folder-open','resize-vertical','resize-horizontal','hdd', + 'bullhorn','bell','certificate','thumbs-up','thumbs-down','hand-right','hand-left','hand-up','hand-down', + 'circle-arrow-right','circle-arrow-left','circle-arrow-up','circle-arrow-down','globe','wrench','tasks', + 'filter','briefcase','fullscreen' + ); + + foreach($matches as $match) + { + $icons[] = $prefix.$match; + } + + return $icons; + } + + if($type == 'bs3') + { + $matches = array( + 'adjust','align-center','align-justify','align-left','align-right','arrow-down','arrow-left','arrow-right','arrow-up','asterisk','backward','ban-circle','barcode','bell','bold','book + ','bookmark','briefcase','bullhorn','calendar','camera','certificate','check','chevron-down','chevron-left','chevron-right','chevron-up','circle-arrow-down','circle-arrow-left','circle-arrow-right + ','circle-arrow-up','cloud','cloud-download','cloud-upload','cog','collapse-down','collapse-up','comment','compressed','copyright-mark','credit-card','cutlery','dashboard','download','download-alt + ','earphone','edit','eject','envelope','euro','exclamation-sign','expand','export','eye-close','eye-open','facetime-video','fast-backward','fast-forward','file','film','filter','fire','flag + ','flash','floppy-disk','floppy-open','floppy-remove','floppy-save','floppy-saved','folder-close','folder-open','font','forward','fullscreen','gbp','gift + ','glass','globe','hand-down','hand-left','hand-right','hand-up','hd-video','hdd','header','headphones','heart','heart-empty','home','import','inbox','indent-left','indent-right','info-sign','italic','leaf','link','list + ','list-alt','lock','log-in','log-out','magnet','map-marker','minus','minus-sign','move','music','new-window','off','ok','ok-circle','ok-sign','open','paperclip','pause','pencil','phone','phone-alt','picture + ','plane','play','play-circle','plus','plus-sign','print','pushpin','qrcode','question-sign','random','record','refresh','registration-mark','remove','remove-circle','remove-sign','repeat','resize-full','resize-horizontal + ','resize-small','resize-vertical','retweet','road','save','saved','screenshot','sd-video','search','send','share','share-alt','shopping-cart','signal','sort','sort-by-alphabet','sort-by-alphabet-alt + ','sort-by-attributes','sort-by-attributes-alt','sort-by-order','sort-by-order-alt','sound-5-1','sound-6-1','sound-7-1','sound-dolby','sound-stereo','star','stats','step-backward','step-forward','stop + ','subtitles','tag','tags','tasks','text-height','text-width','th','th-large','th-list','thumbs-down','thumbs-up','time','tint','tower','transfer','trash','tree-conifer','tree-deciduous','unchecked','upload + ','usd','user','volume-down','volume-off','volume-up','warning-sign','wrench','zoom-in','zoom-out' + ); + + foreach($matches as $match) + { + $icons[] = $prefix.$match; + } + + return $icons; + } + $cache = e107::getCache(); + $cache->setMD5('_'); + + if($data = $cache->retrieve($type,360,true)) + { + return e107::unserialize($data); + } + + + if($type == 'fa4') + { + $pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; + $subject = e107::getFile()->getRemoteContent('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'); + } + elseif($type == 'fa3') + { + $pattern = '/\.(icon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; + $subject = file_get_contents(e_WEB_JS.'font-awesome/css/font-awesome.css'); + } + preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER); - $icons = array(); + foreach($matches as $match) { $icons[] = $match[1]; } - + + $data = e107::serialize($icons); + $cache->set($type,$data,true); return $icons; } @@ -936,47 +1010,63 @@ class e_media { $tp = e107::getParser(); - $defaultThumb = $tp->thumbUrl('','w=400&h=240'); + $defaultThumb = $tp->thumbUrl('','w=400&h=240'); - $default = array( - 'width' => 200, - 'height' => 113, - 'id' => '', - 'type' => 'image', - 'tagid' => '', - 'saveValue' => '', - 'previewUrl' => $defaultThumb , - 'thumbUrl' => $defaultThumb, - 'title' => '' - - ); + $default = array( + 'width' => 200, + 'height' => 113, + 'id' => '', + 'type' => 'image', + 'tagid' => '', + 'saveValue' => '', + 'previewUrl' => $defaultThumb , + 'thumbUrl' => $defaultThumb, + 'title' => '', + 'gridClass' => 'span2' - $data = array(); - - foreach($default as $k=>$v) - { - $data[$k] = isset($row[$k]) ? $row[$k] : $default[$k]; - } + ); + + $data = array(); + + foreach($default as $k=>$v) + { + $data[$k] = isset($row[$k]) ? $row[$k] : $default[$k]; + } - $close = (E107_DEBUG_LEVEL > 0) ? "" : "e-dialog-close"; + $close = (E107_DEBUG_LEVEL > 0) ? "" : "e-dialog-close"; - $text .= "
"; - $text .= '
'; - $text .= ""; - // $text .= ""; - $text .= ''; - $text .= "\n\n"; - $text .= "
".$data['title']."
"; - $text .= "
"; - $text .= "
"; + $text .= "\n\n\n\n\n\n"; return $text; } - function browserIndicators($slides=array()) + function browserIndicators($slides=array(),$uniqueID) { if(count($slides)<1) @@ -985,12 +1075,12 @@ class e_media } $indicators = ''; @@ -1005,48 +1095,50 @@ class e_media /* Fix for Bootstrap2 margin-left issue when wrapping */ e107::css('inline',' - .browserItem { margin-bottom:15px } + .media-carousel { margin-bottom:15px } - .row-fluid .browserItem.span6:nth-child(2n + 3) { margin-left : 0px; } - .row-fluid .browserItem.span4:nth-child(3n + 4) { margin-left : 0px; } - .row-fluid .browserItem.span3:nth-child(4n + 5) { margin-left : 0px; } - .row-fluid .browserItem.span2:nth-child(6n + 7) { margin-left : 0px; } + .row-fluid .media-carousel.span6:nth-child(2n + 3) { margin-left : 0px; } + .row-fluid .media-carousel.span4:nth-child(3n + 4) { margin-left : 0px; } + .row-fluid .media-carousel.span3:nth-child(4n + 5) { margin-left : 0px; } + .row-fluid .media-carousel.span2:nth-child(6n + 7) { margin-left : 0px; } '); - - $frm = varset($option['from']) ? $option['from'] : 0; - $limit = varset($option['limit']) ? $option['limit'] : 20; - $bbcode = varset($option['bbcode']) ? $option['bbcode'] : null; - $navMode = varset($option['nav']) ? TRUE : FALSE; - $search = varset($option['search']) ? $option['search'] : null; - + $frm = e107::getForm(); // $text .= print_a($_GET,true); $data_src = $this->mediaSelectNav($category,$parm['tagid'], $parm); + $carouselID = 'myCarousel-'.$parm['action']; //$text = ""; if(!e_AJAX_REQUEST) { $text = '
'; - $text .= ""; + $text .= ""; // $text .= ''; - $text .= ''; + $text .= ''; $text .= ""; $text .= "
"; - $text .= "
"; + $text .= "
"; } + if(count($data) < 1) + { + return "
No Results Found.
"; + } + + + // $text .= $this->search('srch', $srch, 'go', $filterName, $filterArray, $filterVal).$frm->hidden('mode','online'); - $text .= '"; } - $ret = str_replace('{INDICATORS}', $this->browserIndicators($slides), $text); + $ret = str_replace('{INDICATORS}', $this->browserIndicators($slides,$carouselID), $text); return $ret; diff --git a/e107_themes/bootstrap/admin_style.css b/e107_themes/bootstrap/admin_style.css index b90b6a789..a2674c2c5 100644 --- a/e107_themes/bootstrap/admin_style.css +++ b/e107_themes/bootstrap/admin_style.css @@ -928,6 +928,13 @@ li.rssRow > div { width:142px; } + +.media-carousel-item-caption { + padding-top:8px; white-space:nowrap; display:inline-block; width:100%; overflow:hidden; +} + +.media-carousel-item-glyph { width: 64px; height:64px; overflow:hidden; margin-right:5px; margin-bottom:0px } + /* body { background-color: rgb(68, 68, 68); } diff --git a/e107_web/js/core/mediaManager.js b/e107_web/js/core/mediaManager.js index 274914574..f7ac4c69a 100644 --- a/e107_web/js/core/mediaManager.js +++ b/e107_web/js/core/mediaManager.js @@ -317,13 +317,13 @@ $(document).ready(function() delay(function(){ - if((search.length) >= 3) { + // if((search.length) >= 3) { $('#'+id).load(src,function() { // alert(src); $('#'+id).fadeIn('fast'); // .slideLeft(); }); - } + // } }, 300 ); @@ -370,12 +370,12 @@ $(document).ready(function() src = src + '&search='+search; } - + $(id).fadeOut('fast'); //TODO Animate. $(id).load(src,function() { // alert(src); - // $(this).hide(); + $(id).fadeIn('fast'); // $(this).show('slow'); // .slideLeft(); });