aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-15 20:59:52 -0800
committerfriendica <info@friendica.com>2013-12-15 20:59:52 -0800
commit5a3a72604bf0e1c7ec04fbdbdee7a08c2a340c5a (patch)
tree641255e82ace2196a957fd091c3303aeaa8117ec
parent61a7bfb9426c36b7cac0058f5fe5a0c5c6d4ae71 (diff)
downloadvolse-hubzilla-5a3a72604bf0e1c7ec04fbdbdee7a08c2a340c5a.tar.gz
volse-hubzilla-5a3a72604bf0e1c7ec04fbdbdee7a08c2a340c5a.tar.bz2
volse-hubzilla-5a3a72604bf0e1c7ec04fbdbdee7a08c2a340c5a.zip
some re-work of mod_sources
-rw-r--r--mod/sources.php21
-rw-r--r--view/js/mod_sources.js4
-rw-r--r--view/tpl/sources_edit.tpl2
-rw-r--r--view/tpl/sources_new.tpl2
4 files changed, 25 insertions, 4 deletions
diff --git a/mod/sources.php b/mod/sources.php
index 125184d47..87bab60df 100644
--- a/mod/sources.php
+++ b/mod/sources.php
@@ -9,11 +9,25 @@ function sources_post(&$a) {
$source = intval($_REQUEST['source']);
$xchan = $_REQUEST['xchan'];
+ $abook = intval($_REQUEST['abook']);
$words = $_REQUEST['words'];
$frequency = $_REQUEST['frequency'];
$channel = $a->get_channel();
+ if($abook) {
+ $r = q("select abook_xchan from abook where abook_id = %d and abook_channel = %d limit 1",
+ intval($abook),
+ intval(local_user())
+ );
+ if($r)
+ $xchan = $r[0]['abook_xchan'];
+ }
+
+ if(! $xchan) {
+ notice ( t('Failed to create source. No channel selected.') . EOL);
+ return;
+ }
if(! $source) {
$r = q("insert into source ( src_channel_id, src_channel_xchan, src_xchan, src_patt )
@@ -92,6 +106,12 @@ function sources_content(&$a) {
intval(argv(1)),
intval(local_user())
);
+ if($r) {
+ $x = q("select abook_id from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
+ dbesc($r[0]['src_xchan']),
+ intval(local_user())
+ );
+ }
if(! $r) {
notice( t('Source not found.') . EOL);
return '';
@@ -106,6 +126,7 @@ function sources_content(&$a) {
'$desc' => t('Import all or selected content from the following channel into this channel and 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'],
'$name' => array( 'name', t('Channel Name'), $r[0]['xchan_name'], ''),
'$submit' => t('Submit')
));
diff --git a/view/js/mod_sources.js b/view/js/mod_sources.js
index 2efc7ad5d..49880b38f 100644
--- a/view/js/mod_sources.js
+++ b/view/js/mod_sources.js
@@ -6,10 +6,10 @@ $(document).ready(function() {
width: 250,
id: 'id-name-ac',
onSelect: function(value,data) {
- $("#id_xchan").val(data);
+ $("#id_abook").val(data);
}
});
- a.setOptions({ autoSubmit: true, params: { type: 'a' }});
+ a.setOptions({ params: { type: 'a' }});
});
diff --git a/view/tpl/sources_edit.tpl b/view/tpl/sources_edit.tpl
index 6e9cee32b..34023e03f 100644
--- a/view/tpl/sources_edit.tpl
+++ b/view/tpl/sources_edit.tpl
@@ -4,7 +4,7 @@
<form action="sources" method="post">
<input type="hidden" name="source" value="{{$id}}" />
-<input type="hidden" id="id_xchan" name="xchan" value="{{$xchan}}" />
+<input type="hidden" id="id_abook" name="abook" value="{{$abook}}" />
{{include file="field_input.tpl" field=$name}}
{{include file="field_textarea.tpl" field=$words}}
diff --git a/view/tpl/sources_new.tpl b/view/tpl/sources_new.tpl
index 267245ae4..3c6a4be30 100644
--- a/view/tpl/sources_new.tpl
+++ b/view/tpl/sources_new.tpl
@@ -3,7 +3,7 @@
<div class="descriptive-text">{{$desc}}</div>
<form action="sources" method="post">
-<input type="hidden" id="id_xchan" name="xchan" value="{{$xchan}}" />
+<input type="hidden" id="id_abook" name="abook" value="{{$abook}}" />
{{include file="field_input.tpl" field=$name}}
{{include file="field_textarea.tpl" field=$words}}