provide expire feature on post and comments as well as private messages. This requires a feature setting and is currently unmaskable - if the author says it's gone, there's not a lot you can do to stop it or try and save it. It's gone.

This commit is contained in:
friendica 2013-11-07 00:47:50 -08:00
parent df4c917120
commit 7381326b7a
14 changed files with 58 additions and 14 deletions

View File

@ -1064,7 +1064,8 @@ function status_editor($a,$x,$popup=false) {
'$audurl' => t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'),
'$fileas' => t('Save to Folder:'),
'$whereareu' => t('Where are you right now?')
'$whereareu' => t('Where are you right now?'),
'$expireswhen' => t('Expires YYYY-MM-DD HH:MM')
));
@ -1130,6 +1131,9 @@ function status_editor($a,$x,$popup=false) {
'$preview' => $preview,
'$sourceapp' => t($a->sourcename),
'$jotplugins' => $jotplugins,
'$defexpire' => '',
'$feature_expire' => ((feature_enabled($x['profile_uid'],'content_expire') && (! $webpage)) ? 'block' : 'none'),
'$expires' => t('Set expiration date'),
));

View File

@ -19,8 +19,8 @@ function get_features() {
// General
'general' => array(
t('General Features'),
// uncomment when expire is fixed
// array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
// This is per post, and different from fixed expiration 'expire' which isn't working yet
array('content_expire', t('Content Expiration'), t('Remove posts/comments and/or private messages at a future time')),
array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')),
array('webpages', t('Web Pages'), t('Provide managed web pages on your channel')),
array('prettyphoto', t('Enhanced Photo Albums'), t('Enable photo album with enhanced features')),

View File

@ -46,7 +46,13 @@ function poller_run($argv, $argc){
// expire any expired mail
q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
$r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
if($r) {
require_once('include/items.php');
foreach($r as $rr)
drop_item($rr['id'],false);
}
// Ensure that every channel pings a directory server once a month. This way we can discover
// channels and sites that quietly vanished and prevent the directory from accumulating stale

View File

@ -144,6 +144,9 @@ function editblock_content(&$a) {
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$defexpire' => '',
'$feature_expire' => 'none',
'$expires' => t('Set expiration date'),
));

View File

@ -129,6 +129,9 @@ function editlayout_content(&$a) {
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$defexpire' => '',
'$feature_expire' => 'none',
'$expires' => t('Set expiration date'),
));
$ob = get_observer_hash();

View File

@ -48,7 +48,8 @@ function editpost_content(&$a) {
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $channel['channel_address']
'$nickname' => $channel['channel_address'],
'$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
));
@ -126,6 +127,9 @@ function editpost_content(&$a) {
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$catsenabled' => $catsenabled,
'$defexpire' => $itm[0]['expires'],
'$feature_expire' => 'none',
'$expires' => t('Set expiration date'),
));
return $o;

View File

@ -150,6 +150,10 @@ function editwebpage_content(&$a) {
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$defexpire' => '',
'$feature_expire' => 'none',
'$expires' => t('Set expiration date'),
));
$ob = get_observer_hash();

View File

@ -327,11 +327,9 @@ function item_post(&$a) {
$expires = '0000-00-00 00:00:00';
if(feature_enabled($profile_uid,'expire')) {
// expire_quantity, e.g. '3'
// expire_units, e.g. days, weeks, months
if(x($_REQUEST,'expire_quantity') && (x($_REQUEST,'expire_units'))) {
$expire = datetime_convert('UTC','UTC', 'now + ' . $_REQUEST['expire_quantity'] . ' ' . $_REQUEST['expire_units']);
if(feature_enabled($profile_uid,'content_expire')) {
if(x($_REQUEST,'expire')) {
$expires = datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expire']);
if($expires <= datetime_convert())
$expires = '0000-00-00 00:00:00';
}

View File

@ -324,7 +324,8 @@ function message_content(&$a) {
'$insert' => t('Insert web link'),
'$wait' => t('Please wait'),
'$submit' => t('Submit'),
'$expires' => t('Expires: (leave blank for never)')
'$expires' => t('Expires: (leave blank for never)'),
'$feature_expire' => ((feature_enabled(local_user(),'content_expire')) ? '1' : ''),
));
return $o;
@ -499,7 +500,8 @@ function message_content(&$a) {
'$insert' => t('Insert web link'),
'$submit' => t('Submit'),
'$wait' => t('Please wait'),
'$expires' => t('Expires: (leave blank for never)')
'$expires' => t('Expires: (leave blank for never)'),
'$feature_expire' => ((feature_enabled(local_user(),'content_expire')) ? '1' : ''),
));
return $o;

View File

@ -1 +1 @@
2013-11-06.489
2013-11-07.490

View File

@ -319,7 +319,8 @@ footer {
#profile-video,
#profile-audio,
#profile-link,
#profile-title,
#profile-title,
#profile-expires,
#wall-image-upload,
#wall-file-upload,
#profile-upload-wrapper,
@ -1137,6 +1138,10 @@ footer {
float: left;
margin-left: 15px;
}
#profile-expire-wrapper {
float: left;
margin-left: 15px;
}
#jot-preview-link {
float: left;
margin-left: 45px;

View File

@ -191,6 +191,13 @@ function enableOnUser(){
}
}
function jotGetExpiry() {
reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
if(reply && reply.length) {
$('#jot-expire').val(reply);
}
}
function jotShare(id) {
if ($('#jot-popup').length != 0) $('#jot-popup').show();

View File

@ -5,6 +5,7 @@
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
<input type="hidden" name="return" value="{{$return_path}}" />
<input type="hidden" name="location" id="jot-location" value="{{$defloc}}" />
<input type="hidden" name="expire" id="jot-expire" value="{{$defexpire}}" />
<input type="hidden" name="coord" id="jot-coord" value="" />
<input type="hidden" name="post_id" value="{{$post_id}}" />
<input type="hidden" name="webpage" value="{{$webpage}}" />
@ -50,6 +51,11 @@
<div id="profile-nolocation-wrapper" style="display: none;" >
<i id="profile-nolocation" class="icon-circle-blank jot-icons" title="{{$noloc}}" onclick="jotClearLocation();return false;"></i>
</div>
<div id="profile-expire-wrapper" style="display: {{$feature_expire}};" >
<i id="profile-expires" class="icon-eraser jot-icons" title="{{$expires}}" onclick="jotGetExpiry();return false;"></i>
</div>
<div id="profile-rotator-wrapper" style="display: {{$visitor}};" >
<div id="profile-rotator"></div>
</div>

View File

@ -17,8 +17,10 @@
<div id="prvmail-subject-label">{{$subject}}</div>
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="{{$subjtxt}}" {{$readonly}} tabindex="11" />
{{if $feature_expire}}
<div id="prvmail-expires-label">{{$expires}}</div>
<input type="text" size="64" maxlength="255" id="prvmail-expires" name="expires" value="" tabindex="12" />
{{/if}}
<div id="prvmail-message-label">{{$yourmessage}}</div>
<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="13">{{$text}}</textarea>