diff options
-rw-r--r-- | apps/calendar/ajax/createcalendar.php | 12 | ||||
-rw-r--r-- | apps/calendar/ajax/editeventform.php | 31 | ||||
-rw-r--r-- | apps/calendar/ajax/updatecalendar.php | 12 | ||||
-rw-r--r-- | apps/calendar/js/calendar.js | 18 | ||||
-rw-r--r-- | apps/files_texteditor/js/editor.js | 3 | ||||
-rw-r--r-- | apps/gallery/css/styles.css | 19 | ||||
-rw-r--r-- | apps/gallery/js/album_cover.js | 17 | ||||
-rw-r--r-- | apps/gallery/js/albums.js | 34 | ||||
-rw-r--r-- | apps/gallery/lib/album.php | 4 | ||||
-rw-r--r-- | apps/gallery/lib/hooks_handlers.php | 6 | ||||
-rw-r--r-- | apps/gallery/lib/scanner.php | 5 | ||||
-rw-r--r-- | apps/media/lib_scanner.php | 2 | ||||
-rw-r--r-- | lib/util.php | 4 | ||||
-rw-r--r-- | settings/js/users.js | 10 |
14 files changed, 117 insertions, 60 deletions
diff --git a/apps/calendar/ajax/createcalendar.php b/apps/calendar/ajax/createcalendar.php index f8b5974f54c..b719b207c74 100644 --- a/apps/calendar/ajax/createcalendar.php +++ b/apps/calendar/ajax/createcalendar.php @@ -12,6 +12,18 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); +if(trim($_POST['name']) == ''){ + OC_JSON::error(array('message'=>'empty')); + exit; +} +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +foreach($calendars as $cal){ + if($cal['displayname'] == $_POST['name']){ + OC_JSON::error(array('message'=>'namenotavailable')); + exit; + } +} + $userid = OC_User::getUser(); $calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']); OC_Calendar_Calendar::setCalendarActive($calendarid, 1); diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index 95cae39c1c2..9ae3ffa8d94 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -184,6 +184,8 @@ if($data['repeating'] == 1){ } $repeat['weekdays'] = $repeat_weekdays_; } +}else{ + $repeat['repeat'] = 'doesnotrepeat'; } $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); @@ -227,19 +229,20 @@ $tmpl->assign('endtime', $endtime); $tmpl->assign('description', $description); $tmpl->assign('repeat', $repeat['repeat']); -$tmpl->assign('repeat_month', $repeat['month']); -$tmpl->assign('repeat_weekdays', $repeat['weekdays']); -$tmpl->assign('repeat_interval', $repeat['interval']); -$tmpl->assign('repeat_end', $repeat['end']); -$tmpl->assign('repeat_count', $repeat['count']); -$tmpl->assign('repeat_weekofmonth', $repeat['weekofmonth']); -$tmpl->assign('repeat_date', $repeat['date']); -$tmpl->assign('repeat_year', $repeat['year']); -$tmpl->assign('repeat_byyearday', $repeat['byyearday']); -$tmpl->assign('repeat_bymonthday', $repeat['bymonthday']); -$tmpl->assign('repeat_bymonth', $repeat['bymonth']); -$tmpl->assign('repeat_byweekno', $repeat['byweekno']); +if($repeat['repeat'] != 'doesnotrepeat'){ + $tmpl->assign('repeat_month', $repeat['month']); + $tmpl->assign('repeat_weekdays', $repeat['weekdays']); + $tmpl->assign('repeat_interval', $repeat['interval']); + $tmpl->assign('repeat_end', $repeat['end']); + $tmpl->assign('repeat_count', $repeat['count']); + $tmpl->assign('repeat_weekofmonth', $repeat['weekofmonth']); + $tmpl->assign('repeat_date', $repeat['date']); + $tmpl->assign('repeat_year', $repeat['year']); + $tmpl->assign('repeat_byyearday', $repeat['byyearday']); + $tmpl->assign('repeat_bymonthday', $repeat['bymonthday']); + $tmpl->assign('repeat_bymonth', $repeat['bymonth']); + $tmpl->assign('repeat_byweekno', $repeat['byweekno']); +} $tmpl->printpage(); -?> - +?>
\ No newline at end of file diff --git a/apps/calendar/ajax/updatecalendar.php b/apps/calendar/ajax/updatecalendar.php index 14f560da5a3..269b7b7ca06 100644 --- a/apps/calendar/ajax/updatecalendar.php +++ b/apps/calendar/ajax/updatecalendar.php @@ -12,6 +12,18 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); +if(trim($_POST['name']) == ''){ + OC_JSON::error(array('message'=>'empty')); + exit; +} +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +foreach($calendars as $cal){ + if($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']){ + OC_JSON::error(array('message'=>'namenotavailable')); + exit; + } +} + $calendarid = $_POST['id']; $calendar = OC_Calendar_App::getCalendar($calendarid);//access check OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], null, null, null, $_POST['color']); diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 228ea97c2da..afd1b692dd4 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -429,11 +429,17 @@ Calendar={ } }, submit:function(button, calendarid){ - var displayname = $("#displayname_"+calendarid).val(); + var displayname = $.trim($("#displayname_"+calendarid).val()); var active = $("#edit_active_"+calendarid+":checked").length; var description = $("#description_"+calendarid).val(); var calendarcolor = $("#calendarcolor_"+calendarid).val(); - + if(displayname == ''){ + $("#displayname_"+calendarid).css('background-color', '#FF2626'); + $("#displayname_"+calendarid).focus(function(){ + $("#displayname_"+calendarid).css('background-color', '#F8F8F8'); + }); + } + var url; if (calendarid == 'new'){ url = OC.filePath('calendar', 'ajax', 'createcalendar.php'); @@ -449,6 +455,11 @@ Calendar={ if (calendarid == 'new'){ $('#choosecalendar_dialog > table').append('<tr><td colspan="6"><a href="#" onclick="Calendar.UI.Calendar.newCalendar(this);"><input type="button" value="' + newcalendar + '"></a></td></tr>'); } + }else{ + $("#displayname_"+calendarid).css('background-color', '#FF2626'); + $("#displayname_"+calendarid).focus(function(){ + $("#displayname_"+calendarid).css('background-color', '#F8F8F8'); + }); } }, 'json'); }, @@ -677,6 +688,9 @@ $(document).ready(function(){ $('#calendar_holder').fullCalendar('option', 'aspectRatio', 1.35); } }, + columnFormat: { + week: 'ddd d. MMM' + }, selectable: true, selectHelper: true, select: Calendar.UI.newEvent, diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js index cb1af3dd6db..6e154bedb9c 100644 --- a/apps/files_texteditor/js/editor.js +++ b/apps/files_texteditor/js/editor.js @@ -234,6 +234,7 @@ function hideFileEditor(){ // Keyboard Shortcuts var ctrlBtn = false; +// TODO fix detection of ctrl keyup // returns true if ctrl+s or cmd+s is being pressed function checkForSaveKeyPress(e){ if(e.which == 17 || e.which == 91) ctrlBtn=true; @@ -276,5 +277,5 @@ $(document).ready(function(){ bindControlEvents(); // Binds the save keyboard shortcut events - $(document).unbind('keydown').bind('keydown',checkForSaveKeyPress); + //$(document).unbind('keydown').bind('keydown',checkForSaveKeyPress); }); diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css index 4ada23b0b06..bb8d0607f8c 100644 --- a/apps/gallery/css/styles.css +++ b/apps/gallery/css/styles.css @@ -1,11 +1,12 @@ div#gallery_list { margin: 90pt 20pt; } -div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: scroll; } -div#gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; } -div#gallery_album_box:hover { color: black; } -.leftcontent div#gallery_album_box { margin: 5px; } -div#gallery_album_box h1 { font-size: 9pt; font-family: Verdana; } -div#gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; } -div#gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0.5; visibility:hidden; padding: 0 5pt; } -div#gallery_control_overlay a { color:white; } -#gallery_images.rightcontent { padding:10px 5px; position:absolute; bottom: 0px; overflow: scroll; } +div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: auto; } +div.gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; } +div.gallery_album_box:hover { color: black; } +.leftcontent div.gallery_album_box { margin: 5px; } +div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; } +div.gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; } +div.gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0; padding: 0 5pt; } +div.gallery_album_box:hover div.gallery_control_overlay { opacity:0.5 } +div.gallery_control_overlay a { color:white; } +#gallery_images.rightcontent { padding:10px 5px; bottom: 0px; overflow: auto; right:0px} diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index 38b5815775c..513dd47d351 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -44,7 +44,11 @@ function scanForAlbums() { if (r.status == 'success') { totalAlbums = r.paths.length; - $('#notification').text(t('gallery',"Creating thumbnails")+' ... ' + Math.floor((albumCounter/totalAlbums)*100) + "%"); + if (totalAlbums == 0) { + $('#notification').text(t('gallery', "No photos found")).fadeIn().slideDown().delay(3000).fadeOut().slideUp(); + return; + } + $('#notification').text(t('gallery',"Creating thumbnails")+' ... ' + Math.floor((albumCounter/totalAlbums)*100) + "%"); for(var a in r.paths) { $.getJSON('ajax/galleryOp.php?operation=partial_create&path='+r.paths[a], function(r) { @@ -77,8 +81,8 @@ function galleryRemove(albumName) { if (confirm(t('gallery',"Do you wan't to remove album")+' ' + albumName + "?")) { $.getJSON("ajax/galleryOp.php", {operation: "remove", name: albumName}, function(r) { if (r.status == "success") { - $("#gallery_album_box[title='"+albumName+"']").remove(); - Albums.remove(albumName); + $(".gallery_album_box").filterAttr('data-album',albumName).remove(); + Albums.remove(albumName); } else { alert("Error: " + r.cause); } @@ -88,6 +92,9 @@ function galleryRemove(albumName) { function galleryRename(name) { var result = window.prompt(t('gallery',"Input new gallery name"), name); + if(result=='' || result==name){ + return; + } if (result) { if (Albums.find(result)) { alert("Album named '" + result + "' already exists"); @@ -95,14 +102,12 @@ function galleryRename(name) { } $.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: result}, function(r) { if (r.status == "success") { - Albums.rename($("#gallery_album_box[title='"+name+"']"), result); + Albums.rename($(".gallery_album_box").filterAttr('data-album',name), result); } else { alert("Error: " + r.cause); } }); - } else { - alert(t('gallery',"Album name can't be empty")) } } diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js index 546aadba49f..6150b0daa1e 100644 --- a/apps/gallery/js/albums.js +++ b/apps/gallery/js/albums.js @@ -41,20 +41,26 @@ Albums={ // displays gallery in linear representation // on given element, and apply default styles for gallery display: function(element) { - var displayTemplate = '<div id="gallery_album_box" title="*NAME*"><div id="gallery_control_overlay"><a href="#" onclick="galleryRename(\'*NAME*\');return false;">rename</a> | <a href="#" onclick="galleryRemove(\'*NAME*\');">remove</a></div><a href="?view=*NAME*"><div id="gallery_album_cover" title="*NAME*"></div></a><h1>*NAME*</h1></div></div>'; + var displayTemplate = '<div class="gallery_album_box"><div class="gallery_control_overlay"><a href="#" class="rename">rename</a> | <a href="#" class="remove">remove</a></div><a class="view"><div class="gallery_album_cover"></div></a><h1></h1></div></div>'; for (var i in Albums.albums) { var a = Albums.albums[i]; - var local = $(displayTemplate.replace(/\*NAME\*/g, a.name)); - $("#gallery_album_cover", local).css('background-repeat', 'no-repeat'); - $("#gallery_album_cover", local).css('background-position', '0'); - $("#gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+a.name+'")'); - local.mouseover(function(e) { - $("#gallery_control_overlay", this).css('visibility','visible'); - }); - local.mouseout(function(e) { - $("#gallery_control_overlay", this).css('visibility','hidden'); - }); - $("#gallery_album_cover", local).mousemove(function(e) { + var local=$(displayTemplate); + local.attr('data-album',a.name); + $(".gallery_control_overlay a.rename", local).click(function(name,event){ + event.preventDefault(); + galleryRename(name); + }.bind(null,a.name)); + $(".gallery_control_overlay a.remove", local).click(function(name,event){ + event.preventDefault(); + galleryRemove(name); + }.bind(null,a.name)); + $("a.view", local).attr('href','?view='+a.name); + $('h1',local).text(a.name); + $(".gallery_album_cover", local).attr('title',a.name); + $(".gallery_album_cover", local).css('background-repeat', 'no-repeat'); + $(".gallery_album_cover", local).css('background-position', '0'); + $(".gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+a.name+'")'); + $(".gallery_album_cover", local).mousemove(function(e) { var albumMetadata = Albums.find(this.title); if (albumMetadata == undefined) { @@ -69,8 +75,8 @@ Albums={ }, rename: function(element, new_name) { if (new_name) { - $(element).attr("title", new_name); - $("a", element).attr("href", "?view="+new_name); + $(element).attr("data-album", new_name); + $("a.view", element).attr("href", "?view="+new_name); $("h1", element).text(new_name); } } diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php index d2c420eb9ef..4eb12cc0b81 100644 --- a/apps/gallery/lib/album.php +++ b/apps/gallery/lib/album.php @@ -28,7 +28,7 @@ class OC_Gallery_Album { } public static function rename($oldname, $newname, $owner) { - $stmt = OC_DB::prepare('UPDATE OR IGNORE *PREFIX*gallery_albums SET album_name=? WHERE uid_owner=? AND album_name=?'); + $stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_albums SET album_name=? WHERE uid_owner=? AND album_name=?'); $stmt->execute(array($newname, $owner, $oldname)); } @@ -76,7 +76,7 @@ class OC_Gallery_Album { } public static function changePath($oldname, $newname, $owner) { - $stmt = OC_DB::prepare('UPDATE OR IGNORE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?'); + $stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?'); $stmt->execute(array($newname, $owner, $oldname)); } diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 7248e67f0a2..53a924ff40a 100644 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -32,10 +32,8 @@ class OC_Gallery_Hooks_Handlers { private static $APP_TAG = "Gallery"; private static function isPhoto($filename) { - OC_Log::write(self::$APP_TAG, "Checking file ".$filename." with mimetype ".OC_Filesystem::getMimeType($filename), OC_Log::DEBUG); - if (substr(OC_Filesystem::getMimeType($filename), 0, 6) == "image/") - return true; - return false; + $ext = strtolower(substr($filename, strrpos($filename, '.')+1)); + return $ext=='png' || $ext=='jpeg' || $ext=='jpg' || $ext=='gif'; } private static function directoryContainsPhotos($dirpath) { diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index df33369b93b..447174e84c0 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -88,9 +88,8 @@ class OC_Gallery_Scanner { } public static function isPhoto($filename) { - if (substr(OC_Filesystem::getMimeType($filename), 0, 6) == "image/") - return 1; - return 0; + $ext = strtolower(substr($filename, strrpos($filename, '.')+1)); + return $ext=='png' || $ext=='jpeg' || $ext=='jpg' || $ext=='gif'; } public static function find_paths($path) { diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php index 4039cce09ee..8b659c73b6e 100644 --- a/apps/media/lib_scanner.php +++ b/apps/media/lib_scanner.php @@ -140,7 +140,7 @@ class OC_MEDIA_SCANNER{ * @return bool */ public static function isMusic($filename){ - $ext=substr($filename,strrpos($filename,'.')+1); + $ext=strtolower(substr($filename,strrpos($filename,'.')+1)); return $ext=='mp3' || $ext=='flac' || $ext=='m4a' || $ext=='ogg' || $ext=='oga'; } } diff --git a/lib/util.php b/lib/util.php index 09513d32328..ac969f9aba9 100644 --- a/lib/util.php +++ b/lib/util.php @@ -62,7 +62,7 @@ class OC_Util { * @return array */ public static function getVersion(){ - return array(2,90,0); + return array(2,91,0); } /** @@ -70,7 +70,7 @@ class OC_Util { * @return string */ public static function getVersionString(){ - return '3 alpha 1'; + return '3 RC 1'; } /** diff --git a/settings/js/users.js b/settings/js/users.js index b45038e5b04..c9b1d855db0 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -127,12 +127,16 @@ $(document).ready(function(){ $('#newuser').submit(function(event){ event.preventDefault(); var username=$('#newusername').val(); + if($('#content table tbody tr').filterAttr('data-uid',username).length>0){ + return; + } if($.trim(username) == '') { alert('Please provide a username!'); return false; } var password=$('#newuserpassword').val(); var groups=$('#newusergroups').prev().children('div').data('settings').checked; + var tr $.post( OC.filePath('settings','ajax','createuser.php'), { @@ -141,10 +145,12 @@ $(document).ready(function(){ groups:groups, }, function(result){ - + if(result.status!='success'){ + tr.remove(); + } } ); - var tr=$('#content table tbody tr').first().clone(); + tr=$('#content table tbody tr').first().clone(); tr.attr('data-uid',username); tr.find('td.name').text(username); var select=$('<select multiple="multiple" data-placehoder="Groups" title="Groups">'); |