aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/attach.php15
-rw-r--r--include/photos.php25
-rw-r--r--mod/photos.php11
-rw-r--r--view/css/mod_photos.css2
-rw-r--r--view/js/mod_photos.js19
-rwxr-xr-xview/tpl/photos_upload.tpl9
6 files changed, 55 insertions, 26 deletions
diff --git a/include/attach.php b/include/attach.php
index f95feed2d..f5d2c69b6 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -815,6 +815,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
if($arr['item'])
$args['item'] = $arr['item'];
+ if($arr['body'])
+ $args['body'] = $arr['body'];
+
+ if($arr['description'])
+ $args['description'] = $arr['description'];
+
$p = photo_upload($channel,$observer,$args);
if($p['success']) {
$ret['body'] = $p['body'];
@@ -1282,12 +1288,11 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
);
if($x) {
drop_item($x[0]['id'],false,(($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1),true);
-
- q("DELETE FROM photo WHERE uid = %d AND resource_id = '%s'",
- intval($channel_id),
- dbesc($resource)
- );
}
+ q("DELETE FROM photo WHERE uid = %d AND resource_id = '%s'",
+ intval($channel_id),
+ dbesc($resource)
+ );
}
// update the parent folder's lastmodified timestamp
diff --git a/include/photos.php b/include/photos.php
index a203b9b6a..d89c0fca1 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -7,6 +7,7 @@
require_once('include/permissions.php');
require_once('include/items.php');
require_once('include/photo/photo_driver.php');
+require_once('include/text.php');
/**
* @brief
@@ -18,6 +19,8 @@ require_once('include/photo/photo_driver.php');
*/
function photo_upload($channel, $observer, $args) {
+ $a = get_app();
+
$ret = array('success' => false);
$channel_id = $channel['channel_id'];
$account_id = $channel['channel_account_id'];
@@ -186,8 +189,8 @@ function photo_upload($channel, $observer, $args) {
$p['description'] = $args['description'];
$r0 = $ph->save($p);
- $r0width = $ph->getWidth();
- $r0height = $ph->getHeight();
+ $r0width = $ph->getWidth();
+ $r0height = $ph->getHeight();
if(! $r0)
$errors = true;
@@ -199,8 +202,8 @@ function photo_upload($channel, $observer, $args) {
$p['scale'] = 1;
$r1 = $ph->save($p);
- $r1width = $ph->getWidth();
- $r1height = $ph->getHeight();
+ $r1width = $ph->getWidth();
+ $r1height = $ph->getHeight();
if(! $r1)
$errors = true;
@@ -209,8 +212,8 @@ function photo_upload($channel, $observer, $args) {
$p['scale'] = 2;
$r2 = $ph->save($p);
- $r2width = $ph->getWidth();
- $r2height = $ph->getHeight();
+ $r2width = $ph->getWidth();
+ $r2height = $ph->getHeight();
if(! $r2)
$errors = true;
@@ -219,8 +222,8 @@ function photo_upload($channel, $observer, $args) {
$p['scale'] = 3;
$r3 = $ph->save($p);
- $r3width = $ph->getWidth();
- $r3height = $ph->getHeight();
+ $r3width = $ph->getWidth();
+ $r3height = $ph->getHeight();
if(! $r3)
$errors = true;
@@ -246,10 +249,12 @@ function photo_upload($channel, $observer, $args) {
}
}
- $title = (($args['filename']) ? $args['filename'] : '');
+ $title = (($args['description']) ? $args['description'] : $args['filename']);
$large_photos = feature_enabled($channel['channel_id'], 'large_photos');
+ linkify_tags($a, $args['body'], $channel_id);
+
if($large_photos) {
$scale = 1;
$width = $r1width;
@@ -360,7 +365,7 @@ function photo_upload($channel, $observer, $args) {
$arr['item_thread_top'] = 1;
$arr['item_private'] = intval($acl->is_private());
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
- $arr['body'] = (($object) ? '' : $body);
+ $arr['body'] = (($object) ? $args['body'] : $body . $args['body']);
$result = item_store($arr);
$item_id = $result['item_id'];
diff --git a/mod/photos.php b/mod/photos.php
index 7cd972d8d..33a895fdf 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -183,14 +183,14 @@ function photos_post(&$a) {
);
if($r) {
-
+/*
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'",
intval($page_owner_uid),
dbesc($r[0]['resource_id'])
);
-
+*/
attach_delete($page_owner_uid, $r[0]['resource_id'], 1 );
-
+/*
$i = q("SELECT * FROM `item` WHERE `resource_id` = '%s' AND resource_type = 'photo' and `uid` = %d LIMIT 1",
dbesc($r[0]['resource_id']),
intval($page_owner_uid)
@@ -199,6 +199,7 @@ function photos_post(&$a) {
drop_item($i[0]['id'],true,DROPITEM_PHASE1);
$url = $a->get_baseurl();
}
+*/
}
goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']);
@@ -622,7 +623,9 @@ function photos_content(&$a) {
'$nickname' => $a->data['channel']['channel_address'],
'$newalbum_label' => t('Enter an album name'),
'$newalbum_placeholder' => t('or select an existing album (doubleclick)'),
- '$visible' => array('visible', t('Create a status post for this upload'), 0, '', array(t('No'), t('Yes'))),
+ '$visible' => array('visible', t('Create a status post for this upload'), 0,'', array(t('No'), t('Yes')), 'onclick="showHideBodyTextarea();"'),
+ '$caption' => array('description', t('Caption (optional):')),
+ '$body' => array('body', t('Description (optional):'),'', 'Description will only appear in the status post'),
'$albums' => $albums['albums'],
'$selname' => $selname,
'$permissions' => t('Permissions'),
diff --git a/view/css/mod_photos.css b/view/css/mod_photos.css
index 7718289c3..ae250bc1c 100644
--- a/view/css/mod_photos.css
+++ b/view/css/mod_photos.css
@@ -33,4 +33,4 @@
position: absolute;
left: -9999px;
top: -9999px;
-} \ No newline at end of file
+}
diff --git a/view/js/mod_photos.js b/view/js/mod_photos.js
index b254370c1..d371c3f2f 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -6,10 +6,9 @@
var ispublic = aStr.everybody;
$(document).ready(function() {
- $(document).ready(function() {
- $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', false, function(data) {
- $("#photo-edit-newtag").val('@' + data.name);
- });
+
+ $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', false, function(data) {
+ $("#photo-edit-newtag").val('@' + data.name);
});
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
@@ -24,4 +23,14 @@ $(document).ready(function() {
$('#jot-public').show();
}
}).trigger('change');
-}); \ No newline at end of file
+
+ showHideBodyTextarea();
+
+});
+
+function showHideBodyTextarea() {
+ if( $('#id_visible').is(':checked'))
+ $('#body-textarea').slideDown();
+ else
+ $('#body-textarea').slideUp();
+}
diff --git a/view/tpl/photos_upload.tpl b/view/tpl/photos_upload.tpl
index bf02c614d..11a08204d 100755
--- a/view/tpl/photos_upload.tpl
+++ b/view/tpl/photos_upload.tpl
@@ -21,7 +21,11 @@
<div class="form-group">
<input id="photos-upload-choose" type="file" name="userfile" />
</div>
+ {{include file="field_input.tpl" field=$caption}}
{{include file="field_checkbox.tpl" field=$visible}}
+ <div id="body-textarea">
+ {{include file="field_textarea.tpl" field=$body}}
+ </div>
<div class="pull-right btn-group form-group">
<div class="btn-group">
{{if $lockstate}}
@@ -37,8 +41,11 @@
<div class="clear"></div>
{{if $uploader}}
-
+ {{include file="field_input.tpl" field=$caption}}
{{include file="field_checkbox.tpl" field=$visible}}
+ <div id="body-textarea">
+ {{include file="field_textarea.tpl" field=$body}}
+ </div>
<div id="photos-upload-perms" class="btn-group pull-right">
{{if $lockstate}}
<button class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" onclick="return false;">