finish cleanup of sources

This commit is contained in:
Mike Macgirvin 2023-05-06 15:55:09 +10:00
parent 36150e5a9d
commit 849c96461e
6 changed files with 78 additions and 49 deletions

View file

@ -3774,9 +3774,8 @@ class Activity
$commentApproval?->Reject();
return;
}
} else {
}
else {
// By default, if we allow you to send_stream and comments and this is a comment, it is allowed.
// A side effect of this action is that if you take away send_stream permission, comments to those
// posts you previously allowed will still be accepted. It is possible but might be difficult to fix this.

View file

@ -119,6 +119,7 @@ class Sources extends Controller
]);
return $o;
}
$required = t('This name currently must autocomplete to one of your connections');
if (argc() == 2 && argv(1) === 'new') {
// TODO add the words 'or RSS feed' and corresponding code to manage feeds and frequency
@ -127,7 +128,7 @@ class Sources extends Controller
'$title' => t('New Source'),
'$desc' => t('Import all or selected content from the following channel into this channel and re-distribute it according to your channel settings.'),
'$words' => ['words', t('Only import content with these words (one per line)'), '', t('Leave blank to import all public content')],
'$name' => ['name', t('Channel Name'), '', '', '', 'autocomplete="off"'],
'$name' => ['name', t('Channel Name'), '', $required, '', 'autocomplete="off"'],
'$tags' => ['tags', t('Add the following categories to posts imported from this source (comma separated)'), '', t('Optional')],
'$submit' => t('Submit')
]);
@ -155,16 +156,19 @@ class Sources extends Controller
$r[0]['src_patt'] = htmlspecialchars($r[0]['src_patt'], ENT_QUOTES, 'UTF-8');
$required = t('This name currently must autocomplete to one of your connections');
$o = replace_macros(Theme::get_template('sources_edit.tpl'), array(
'$title' => t('Edit Source'),
'$drop' => t('Delete Source'),
'$id' => $r[0]['src_id'],
'$desc' => t('Import all or selected content from the following channel into this channel and re-distribute it according to your channel settings.'),
'$words' => array('words', t('Only import content with these words (one per line)'), $r[0]['src_patt'], t('Leave blank to import all public content')),
'$xchan' => $r[0]['src_xchan'],
'$abook' => $x[0]['abook_id'],
'$tags' => array('tags', t('Add the following categories to posts imported from this source (comma separated)'), $r[0]['src_tag'], t('Optional')),
'$name' => array('name', t('Channel Name'), $r[0]['xchan_name'], ''),
'$name' => array('name', t('Channel Name'), $r[0]['xchan_name'], $required),
'$submit' => t('Submit')
));
return $o;

View file

@ -103,6 +103,23 @@ class Settings_menu implements WidgetInterface
'selected' => ((argv(1) === 'identities') ? 'active' : '')
];
$links = q("select * from linkid where sigtype = %d and ident = '%s'",
intval(IDLINK_RELME),
dbesc($channel['channel_hash'])
);
$sources = q("select * from sources where src_channel_id = %d",
intval($channel['channel_id'])
);
if ($links || $sources) {
$tabs[] = [
'label' => t('Channel Sources'),
'url' => z_root() . '/sources',
'selected' => ((argv(1) === 'sources') ? 'active' : ''),
];
}
return replace_macros(Theme::get_template('generic_links_widget.tpl'), [
'$title' => t('Settings'),
'$class' => 'settings-widget',

View file

@ -1,22 +1,25 @@
<div class="generic-content-wrapper-styled">
<h1>{{$title}}</h1>
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<h2>{{$title}}</h2>
</div>
<div class="section-content-tools-wrapper">
<div class="descriptive-text">{{$desc}}</div>
<div class="descriptive-text">{{$desc}}</div>
<form action="sources" method="post">
<input type="hidden" name="source" value="{{$id}}" />
<input type="hidden" id="id_abook" name="abook" value="{{$abook}}" />
{{include file="field_input.tpl" field=$name}}
{{include file="field_input.tpl" field=$tags}}
{{include file="field_textarea.tpl" field=$words}}
<form action="sources" method="post">
<input type="hidden" name="source" value="{{$id}}" />
<input type="hidden" id="id_abook" name="abook" value="{{$abook}}" />
{{include file="field_input.tpl" field=$name}}
{{include file="field_input.tpl" field=$tags}}
{{include file="field_textarea.tpl" field=$words}}
<div class="sources-submit-wrapper" >
<input type="submit" name="submit" class="sources-submit" value="{{$submit}}" />
</div>
</form>
<br>
<br>
<a href="sources/{{$id}}/drop">{{$drop}}</a>
<div class="sources-submit-wrapper" >
<input type="submit" name="submit" class="sources-submit" value="{{$submit}}" />
</div>
</form>
<br>
<br>
<a href="sources/{{$id}}/drop">{{$drop}}</a>
</div>
</div>

View file

@ -1,17 +1,20 @@
<div class="generic-content-wrapper-styled">
<h1>{{$title}}</h1>
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<h2>{{$title}}</h2>
</div>
<div class="section-content-tools-wrapper">
<div class="descriptive-text">{{$desc}}</div>
<div class="descriptive-text">{{$desc}}</div>
<div class="sources-links">
<a href="sources/new">{{$new}}</a>
</div>
<div class="sources-links">
<a href="sources/new">{{$new}}</a>
</div>
{{if $sources}}
<ul class="sources-list">
{{foreach $sources as $source}}
<li><a href="sources/{{$source.src_id}}">{{$source.xchan_name}}</a></li>
{{/foreach}}
</ul>
{{/if}}
{{if $sources}}
<ul class="sources-list">
{{foreach $sources as $source}}
<li><a href="sources/{{$source.src_id}}">{{$source.xchan_name}}</a></li>
{{/foreach}}
</ul>
{{/if}}
</div>
</div>

View file

@ -1,17 +1,20 @@
<div class="generic-content-wrapper-styled">
<h1>{{$title}}</h1>
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<h2>{{$title}}</h2>
</div>
<div class="section-content-tools-wrapper">
<div class="descriptive-text">{{$desc}}</div>
<div class="descriptive-text">{{$desc}}</div>
<form action="sources" method="post" autocomplete="off" >
<input type="hidden" id="id_abook" name="abook" value="{{$abook}}" />
{{include file="field_input.tpl" field=$name}}
{{include file="field_input.tpl" field=$tags}}
{{include file="field_textarea.tpl" field=$words}}
<form action="sources" method="post" autocomplete="off" >
<input type="hidden" id="id_abook" name="abook" value="{{$abook}}" />
{{include file="field_input.tpl" field=$name}}
{{include file="field_input.tpl" field=$tags}}
{{include file="field_textarea.tpl" field=$words}}
<div class="sources-submit-wrapper" >
<input type="submit" name="submit" class="sources-submit" value="{{$submit}}" />
</div>
</form>
<div class="sources-submit-wrapper" >
<input type="submit" name="submit" class="sources-submit" value="{{$submit}}" />
</div>
</form>
</div>
</div>