aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-09-24 11:46:18 +0200
committerMario Vavti <mario@mariovavti.com>2018-09-24 11:46:18 +0200
commitc3aa15cc165730b6e67de580065ace255454dfb5 (patch)
tree7a3ed6285851c0fbe4556bc141af890f56d675b8 /Zotlabs
parentb45bd901e05db6cb797f83cb9c0276911b965286 (diff)
downloadvolse-hubzilla-c3aa15cc165730b6e67de580065ace255454dfb5.tar.gz
volse-hubzilla-c3aa15cc165730b6e67de580065ace255454dfb5.tar.bz2
volse-hubzilla-c3aa15cc165730b6e67de580065ace255454dfb5.zip
appification of notes
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Notes.php41
-rw-r--r--Zotlabs/Widget/Notes.php14
2 files changed, 44 insertions, 11 deletions
diff --git a/Zotlabs/Module/Notes.php b/Zotlabs/Module/Notes.php
index e530e6ff4..cd383a6c2 100644
--- a/Zotlabs/Module/Notes.php
+++ b/Zotlabs/Module/Notes.php
@@ -1,13 +1,19 @@
<?php
namespace Zotlabs\Module; /** @file */
+use App;
+use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Apps;
-class Notes extends \Zotlabs\Web\Controller {
+class Notes extends Controller {
- function init() {
+ function post() {
if(! local_channel())
- return;
+ return EMPTY_STR;
+
+ if(! Apps::system_app_installed(local_channel(), 'Notes'))
+ return EMPTY_STR;
$ret = array('success' => true);
if(array_key_exists('note_text',$_REQUEST)) {
@@ -24,17 +30,38 @@ class Notes extends \Zotlabs\Web\Controller {
}
set_pconfig(local_channel(),'notes','text',$body);
}
-
+
// push updates to channel clones
-
+
if((argc() > 1) && (argv(1) === 'sync')) {
require_once('include/zot.php');
build_sync_packet();
}
-
+
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
-
+
+ }
+
+ function get() {
+
+ if(! local_channel())
+ return EMPTY_STR;
+
+ if(! Apps::system_app_installed(local_channel(), 'Notes')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = EMPTY_STR;
+
+ $o = '<b>Notes App (Not Installed):</b><br>';
+ $o .= t('A simple notes app with a widget (note: notes are not encrypted)');
+ return $o;
+ }
+
+ $w = new \Zotlabs\Widget\Notes;
+ $arr = ['app' => true];
+
+ return $w->widget($arr);
+
}
}
diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php
index 5c83a550f..238008d81 100644
--- a/Zotlabs/Widget/Notes.php
+++ b/Zotlabs/Widget/Notes.php
@@ -2,20 +2,26 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Apps;
+
class Notes {
function widget($arr) {
if(! local_channel())
- return '';
- if(! feature_enabled(local_channel(),'private_notes'))
- return '';
+ return EMPTY_STR;
+
+ if(! Apps::system_app_installed(local_channel(), 'Notes'))
+ return EMPTY_STR;
$text = get_pconfig(local_channel(),'notes','text');
- $o = replace_macros(get_markup_template('notes.tpl'), array(
+ $tpl = get_markup_template('notes.tpl');
+
+ $o = replace_macros($tpl, array(
'$banner' => t('Notes'),
'$text' => $text,
'$save' => t('Save'),
+ '$app' => ((isset($arr['app'])) ? true : false)
));
return $o;