appification of notes
This commit is contained in:
parent
b45bd901e0
commit
c3aa15cc16
@ -1,13 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Zotlabs\Module; /** @file */
|
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())
|
if(! local_channel())
|
||||||
return;
|
return EMPTY_STR;
|
||||||
|
|
||||||
|
if(! Apps::system_app_installed(local_channel(), 'Notes'))
|
||||||
|
return EMPTY_STR;
|
||||||
|
|
||||||
$ret = array('success' => true);
|
$ret = array('success' => true);
|
||||||
if(array_key_exists('note_text',$_REQUEST)) {
|
if(array_key_exists('note_text',$_REQUEST)) {
|
||||||
@ -37,4 +43,25 @@ class Notes extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,26 @@
|
|||||||
|
|
||||||
namespace Zotlabs\Widget;
|
namespace Zotlabs\Widget;
|
||||||
|
|
||||||
|
use Zotlabs\Lib\Apps;
|
||||||
|
|
||||||
class Notes {
|
class Notes {
|
||||||
|
|
||||||
function widget($arr) {
|
function widget($arr) {
|
||||||
if(! local_channel())
|
if(! local_channel())
|
||||||
return '';
|
return EMPTY_STR;
|
||||||
if(! feature_enabled(local_channel(),'private_notes'))
|
|
||||||
return '';
|
if(! Apps::system_app_installed(local_channel(), 'Notes'))
|
||||||
|
return EMPTY_STR;
|
||||||
|
|
||||||
$text = get_pconfig(local_channel(),'notes','text');
|
$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'),
|
'$banner' => t('Notes'),
|
||||||
'$text' => $text,
|
'$text' => $text,
|
||||||
'$save' => t('Save'),
|
'$save' => t('Save'),
|
||||||
|
'$app' => ((isset($arr['app'])) ? true : false)
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
6
app/notes.apd
Normal file
6
app/notes.apd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
version: 1
|
||||||
|
url: $baseurl/notes
|
||||||
|
requires: local_channel
|
||||||
|
name: Notes
|
||||||
|
photo: icon:sticky-note-o
|
||||||
|
categories: Personal, Productivity
|
@ -85,25 +85,6 @@ function get_features($filtered = true, $level = (-1)) {
|
|||||||
feature_level('start_menu',1),
|
feature_level('start_menu',1),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
|
||||||
[
|
|
||||||
'hide_rating',
|
|
||||||
t('Hide Rating'),
|
|
||||||
t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),
|
|
||||||
false,
|
|
||||||
get_config('feature_lock','hide_rating'),
|
|
||||||
feature_level('hide_rating',3),
|
|
||||||
],
|
|
||||||
*/
|
|
||||||
[
|
|
||||||
'private_notes',
|
|
||||||
t('Private Notes'),
|
|
||||||
t('Enables a tool to store notes and reminders (note: not encrypted)'),
|
|
||||||
false,
|
|
||||||
get_config('feature_lock','private_notes'),
|
|
||||||
feature_level('private_notes',1),
|
|
||||||
],
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'premium_channel',
|
'premium_channel',
|
||||||
t('Premium Channel'),
|
t('Premium Channel'),
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
|
{{if $app}}
|
||||||
|
<div class="generic-content-wrapper">
|
||||||
|
<div class="section-title-wrapper">
|
||||||
|
<h2>{{$banner}}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="section-content-wrapper">
|
||||||
|
{{else}}
|
||||||
<div class="widget">
|
<div class="widget">
|
||||||
<h3>{{$banner}}</h3>
|
<h3>{{$banner}}</h3>
|
||||||
|
{{/if}}
|
||||||
<textarea name="note_text" id="note-text">{{$text}}</textarea>
|
<textarea name="note_text" id="note-text">{{$text}}</textarea>
|
||||||
<script>
|
<script>
|
||||||
var noteSaveTimer = null;
|
var noteSaveTimer = null;
|
||||||
@ -32,4 +40,7 @@
|
|||||||
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
{{if $app}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user