Allow an album and photo title length of 50 chars #332

This commit is contained in:
Tobias Reich 2015-05-10 23:01:07 +02:00
parent 8e06bc7e5c
commit 7e885425dc
14 changed files with 49 additions and 32 deletions

BIN
dist/main.css vendored

Binary file not shown.

BIN
dist/main.js vendored

Binary file not shown.

BIN
dist/view.js vendored

Binary file not shown.

View File

@ -0,0 +1,29 @@
<?php
###
# @name Update to version 3.0.1
# @copyright 2015 by Tobias Reich
###
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
# Change length of photo title
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_PHOTOS));
$result = $database->query($query);
if (!$result) {
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Change length of album title
$query = Database::prepare($database, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_ALBUMS));
$result = $database->query($query);
if (!$result) {
Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
return false;
}
# Set version
if (Database::setVersion($database, '030001')===false) return false;
?>

View File

@ -484,7 +484,7 @@ class Album extends Module {
$this->plugins(__METHOD__, 0, func_get_args()); $this->plugins(__METHOD__, 0, func_get_args());
# Parse # Parse
if (strlen($title)>50) $title = substr($title, 0, 50); if (strlen($title)>100) $title = substr($title, 0, 100);
# Execute query # Execute query
$query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $title, $this->albumIDs)); $query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $title, $this->albumIDs));

View File

@ -55,7 +55,8 @@ class Database extends Module {
'020601', #2.6.1 '020601', #2.6.1
'020602', #2.6.2 '020602', #2.6.2
'020700', #2.7.0 '020700', #2.7.0
'030000' #3.0.0 '030000', #3.0.0
'030001' #3.0.1
); );
# For each update # For each update

View File

@ -842,7 +842,7 @@ class Photo extends Module {
$this->plugins(__METHOD__, 0, func_get_args()); $this->plugins(__METHOD__, 0, func_get_args());
# Parse # Parse
if (strlen($title)>50) $title = substr($title, 0, 50); if (strlen($title)>100) $title = substr($title, 0, 100);
# Set title # Set title
$query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $title, $this->photoIDs)); $query = Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $title, $this->photoIDs));

View File

@ -1,6 +1,6 @@
{ {
"name": "Lychee", "name": "Lychee",
"version": "3.0.0", "version": "3.0.1",
"description": "Self-hosted photo-management done right.", "description": "Self-hosted photo-management done right.",
"authors": "Tobias Reich <tobias@electerious.com>", "authors": "Tobias Reich <tobias@electerious.com>",
"license": "MIT", "license": "MIT",

View File

@ -138,7 +138,7 @@ album.add = function() {
} }
basicModal.show({ basicModal.show({
body: "<p>Enter a title for the new album: <input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='Untitled'></p>", body: "<p>Enter a title for the new album: <input class='text' data-name='title' type='text' maxlength='50' placeholder='Title' value='Untitled'></p>",
buttons: { buttons: {
action: { action: {
title: 'Create Album', title: 'Create Album',
@ -306,7 +306,7 @@ album.setTitle = function(albumIDs) {
} }
input = "<input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>"; input = "<input class='text' data-name='title' type='text' maxlength='50' placeholder='Title' value='" + oldTitle + "'>";
if (albumIDs.length===1) msg = "<p>Enter a new title for this album: " + input + "</p>"; if (albumIDs.length===1) msg = "<p>Enter a new title for this album: " + input + "</p>";
else msg = "<p>Enter a title for all " + albumIDs.length + " selected albums: " + input +"</p>"; else msg = "<p>Enter a title for all " + albumIDs.length + " selected albums: " + input +"</p>";

View File

@ -59,16 +59,7 @@ build.album = function(data) {
if (data===null||data===undefined) return ''; if (data===null||data===undefined) return '';
var html = '', var html = '';
title = data.title,
longTitle = '';
if (title!==null&&title.length>18) {
title = data.title.substr(0, 18) + '...';
longTitle = data.title;
}
var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbs[0]); var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbs[0]);
@ -78,7 +69,7 @@ build.album = function(data) {
<img src='${ data.thumbs[1] }' width='200' height='200' alt='thumb' data-retina='false'> <img src='${ data.thumbs[1] }' width='200' height='200' alt='thumb' data-retina='false'>
<img src='${ thumbPath }' width='200' height='200' alt='thumb' data-retina='${ thumbRetina }'> <img src='${ thumbPath }' width='200' height='200' alt='thumb' data-retina='${ thumbRetina }'>
<div class='overlay'> <div class='overlay'>
<h1 title='${ longTitle }'>${ title }</h1> <h1 title='${ data.title }'>${ data.title }</h1>
<a>${ data.sysdate }</a> <a>${ data.sysdate }</a>
</div> </div>
` `
@ -103,16 +94,7 @@ build.photo = function(data) {
if (data===null||data===undefined) return ''; if (data===null||data===undefined) return '';
var html = '', var html = '';
title = data.title,
longTitle = '';
if (title!==null&&title.length>18) {
title = data.title.substr(0, 18) + '...';
longTitle = data.title;
}
var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbUrl); var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbUrl);
@ -120,7 +102,7 @@ build.photo = function(data) {
<div class='photo' data-album-id='${ data.album }' data-id='${ data.id }'> <div class='photo' data-album-id='${ data.album }' data-id='${ data.id }'>
<img src='${ thumbPath }' width='200' height='200' alt='thumb'> <img src='${ thumbPath }' width='200' height='200' alt='thumb'>
<div class='overlay'> <div class='overlay'>
<h1 title='${ longTitle }'>${ title }</h1> <h1 title='${ data.title }'>${ data.title }</h1>
` `
if (data.cameraDate==='1') html += `<a><span title='Camera Date'>${ build.iconic('camera-slr') }</span>${ data.sysdate }</a>`; if (data.cameraDate==='1') html += `<a><span title='Camera Date'>${ build.iconic('camera-slr') }</span>${ data.sysdate }</a>`;

View File

@ -6,8 +6,8 @@
lychee = { lychee = {
title: document.title, title: document.title,
version: '3.0.0', version: '3.0.1',
version_code: '030000', version_code: '030001',
update_path: 'http://lychee.electerious.com/version/index.php', update_path: 'http://lychee.electerious.com/version/index.php',
updateURL: 'https://github.com/electerious/Lychee', updateURL: 'https://github.com/electerious/Lychee',

View File

@ -330,7 +330,7 @@ photo.setTitle = function(photoIDs) {
} }
input = "<input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>"; input = "<input class='text' data-name='title' type='text' maxlength='50' placeholder='Title' value='" + oldTitle + "'>";
if (photoIDs.length===1) msg = "<p>Enter a new title for this photo: " + input + "</p>"; if (photoIDs.length===1) msg = "<p>Enter a new title for this photo: " + input + "</p>";
else msg = "<p>Enter a title for all " + photoIDs.length + " selected photos: " + input + "</p>"; else msg = "<p>Enter a title for all " + photoIDs.length + " selected photos: " + input + "</p>";

View File

@ -125,13 +125,15 @@
.album .overlay h1, .album .overlay h1,
.photo .overlay h1 { .photo .overlay h1 {
min-height: 19px; min-height: 19px;
width: 185px; width: 180px;
margin: 12px 0 5px 15px; margin: 12px 0 5px 15px;
color: #fff; color: #fff;
text-shadow: 0 1px 3px black(.4); text-shadow: 0 1px 3px black(.4);
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
overflow: hidden; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.album .overlay a, .album .overlay a,

View File

@ -38,6 +38,9 @@ header {
text-align: center; text-align: center;
z-index: 1; z-index: 1;
cursor: default; cursor: default;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.iconic { .iconic {
display: none; display: none;