Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

View File

@ -0,0 +1,436 @@
<?php
/**
* app/plugins/notes/controllers/notes.php
*
* This is the notes controller.
*
* @package TP Notes
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Controllers;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Houdini\Classes\Issues;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Classes\Forms;
use TheTempusProject\Houdini\Classes\Forms as FormBuilder;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Classes\Config;
use TheTempusProject\Classes\Controller;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Bedrock\Functions\Session;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Models\Notes as Note;
use TheTempusProject\Models\Notebooks;
use TheTempusProject\Houdini\Classes\Template;
use TheTempusProject\Houdini\Classes\Navigation;
class Notes extends Controller {
protected static $notes;
protected static $notebooks;
protected static $defaultView;
public function __construct() {
parent::__construct();
if ( !App::$isLoggedIn ) {
Session::flash( 'notice', 'You must be logged in to use this feature.' );
return Redirect::home();
}
self::$notes = new Note;
self::$notebooks = new Notebooks;
self::$title = 'Notes - {SITENAME}';
self::$pageDescription = 'On this page you can create and manage tasks and lists.';
self::$defaultView = 'byNotebook';
Components::set( 'notebookID', '' );
Components::set( 'notebookName', 'All' );
Components::set( 'notebookName', 'default' );
Template::setTemplate( 'notes' );
}
public function index() {
$this->setupMenus();
$notebooks = Views::simpleView( 'notes.notebooks.list', self::$notebooks->byUser() );
Components::set( 'notebookList', $notebooks );
$notes = Views::simpleView( 'notes.notes.list', self::$notes->byUser( 20 ) );
Components::set( 'noteList', $notes );
Views::view( 'notes.dashboard' );
}
/**
* Notes
*/
public function notes( $id = null ) {
self::$defaultView = __FUNCTION__;
Components::set( 'currentView', self::$defaultView );
$this->setupMenus( 0, $id );
Navigation::setCrumbComponent( 'NotebookBreadCrumbs', 'notes/byNotebook' );
$notes = self::$notes->findByNotebook( $id );
Views::view( 'notes.notes.list', $notes );
}
public function createNote( $id = null ) {
$this->setupMenus( 0, $id );
$select = FormBuilder::getSelectHtml(
'notebookID',
self::$notebooks->simpleList(true),
$id,
);
Components::set( 'notebookSelect', $select );
if ( !Input::exists() ) {
return Views::view( 'notes.notes.create' );
}
if ( !Forms::check( 'createNote' ) ) {
Issues::add( 'error', [ 'There was an error with your form.' => Check::userErrors() ] );
return Views::view( 'notes.notes.create' );
}
if ( !self::$notes->create( Input::post( 'title' ), Input::post( 'note' ), Input::post( 'color' ), Input::post( 'notebookID' ) ) ) {
Issues::add( 'error', [ 'There was an error with your note.' => Check::userErrors() ] );
return Views::view( 'notes.notes.create' );
}
Session::flash( 'success', 'Your note has been created.' );
if ( Input::exists( 'notebookID' ) ) {
Redirect::to( 'notes/byNotebook/' . Input::post( 'notebookID' ) );
} else {
Redirect::to( 'notes/index' );
}
}
public function editNote( $id = null ) {
$note = self::$notes->findById( $id );
if ( $note == false ) {
Issues::add( 'error', 'Note not found.' );
return $this->index();
}
if ( $note->createdBy != App::$activeUser->ID ) {
Issues::add( 'error', 'You do not have permission to modify this note.' );
return $this->index();
}
$this->setupMenus( $id );
$select = FormBuilder::getSelectHtml(
'notebookID',
self::$notebooks->simpleList(true),
$note->notebookID,
);
Components::set( 'notebookSelect', $select );
Components::set( 'color', $note->color );
if ( !Input::exists( 'submit' ) ) {
return Views::view( 'notes.notes.edit', $note );
}
if ( !Forms::check( 'editNote' ) ) {
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
return Views::view( 'notes.notes.edit', $note );
}
if ( self::$notes->update( $id, Input::post( 'title' ), Input::post( 'note' ), Input::post( 'color' ), Input::post( 'notebookID' ) ) ) {
Session::flash( 'success', 'Note updated' );
} else {
return Views::view( 'notes.notes.edit', self::$notes->findById( $data ) );
}
if ( !empty( $note->notebookID ) ) {
Redirect::to( 'notes/byNotebook/' . $note->notebookID );
} else {
Redirect::to( 'notes/index' );
}
}
public function deleteNote( $id = null ) {
$note = self::$notes->findById( $id );
if ( $note == false ) {
Issues::add( 'error', 'Note not found.' );
return $this->index();
}
if ( $note->createdBy != App::$activeUser->ID ) {
Issues::add( 'error', 'You do not have permission to modify this note.' );
return $this->index();
}
$result = self::$notes->delete( $id );
if ( !$result ) {
Session::flash( 'error', 'There was an error deleting the note(s)' );
} else {
Session::flash( 'success', 'Note deleted' );
}
if ( !empty( $note->notebookID ) ) {
Redirect::to( 'notes/byNotebook/' . $note->notebookID );
} else {
Redirect::to( 'notes/index' );
}
}
/**
* Notebooks
*/
public function notebook( $id = null ) {
self::$defaultView = __FUNCTION__;
Components::set( 'currentView', self::$defaultView );
$notebook = self::$notebooks->findById( $id );
if ( $notebook == false ) {
Issues::add( 'error', 'Notebook not found.' );
return $this->index();
}
Components::set( 'notebookID', $id );
$notes = self::$notes->findByNotebook( $notebook->ID );
Components::set( 'notebookName', $notebook->title );
Components::set( 'notebookIcon', $notebook->icon );
Components::set( 'notebookColor', $notebook->color );
Views::view( 'notes.notes.list', $notes );
}
public function createNotebook($id = null) {
$this->setupMenus( 0, $id );
$select = FormBuilder::getSelectHtml(
'notebookID',
self::$notebooks->simpleList(true),
$id,
);
Components::set( 'notebookSelect', $select );
if ( !Input::exists() ) {
return Views::view( 'notes.notebooks.create' );
}
if ( !Forms::check( 'createNotebook' ) ) {
Issues::add( 'error', [ 'There was an error creating your notebook.' => Check::userErrors() ] );
return Views::view( 'notes.notebooks.create' );
}
if ( ! input::exists('notebookID') ) {
$notebookID = 0;
} else {
$notebookID = Input::post( 'notebookID' );
}
if ( !self::$notebooks->create( Input::post( 'title' ), Input::post( 'description' ), Input::post( 'color' ), $notebookID, Input::post( 'icon' ) ) ) {
Issues::add( 'error', [ 'There was an error creating your notebook.' => Check::userErrors() ] );
return Views::view( 'notes.notebooks.create' );
}
Session::flash( 'success', 'Your notebook has been created.' );
Redirect::to( 'notes/index' );
}
public function editNotebook( $id = null ) {
$notebook = self::$notebooks->findById( $id );
$this->setupMenus( 0, $id );
if ( $notebook == false ) {
Issues::add( 'error', 'Notebook not found.' );
return Views::view( 'notes.notebooks.list', self::$notebooks->byUser() );
}
$select = FormBuilder::getSelectHtml(
'notebookID',
self::$notebooks->simpleList(true),
$notebook->notebookID,
);
Components::set( 'notebookSelect', $select );
Components::set( 'color', $notebook->color );
if ( !Input::exists() ) {
return Views::view( 'notes.notebooks.edit', $notebook );
}
if ( !Forms::check( 'editNotebook' ) ) {
Issues::add( 'error', [ 'There was an error with your notebook.' => Check::userErrors() ] );
return Views::view( 'notes.notebooks.edit', $notebook );
}
if ( ! Input::exists('notebookID') || $id == Input::post( 'notebookID' ) ) {
$notebookID = 0;
} else {
$notebookID = Input::post( 'notebookID' );
}
if ( !self::$notebooks->update( $id, Input::post( 'title' ), Input::post( 'description' ), Input::post( 'color' ), $notebookID, Input::post( 'icon' ) )) {
Issues::add( 'error', [ 'There was an error with your notebook.' => Check::userErrors() ] );
return Views::view( 'notes.notebooks.edit', $notebook );
}
Session::flash( 'success', 'Your Notebook has been saved.' );
Redirect::to( 'notes/byNotebook/' . $id );
}
public function deleteNotebook( $id = null ) {
$notebook = self::$notebooks->findById( $id );
if ( $notebook == false ) {
Issues::add( 'error', 'Notebook not found.' );
return $this->index();
}
if ( $notebook->createdBy != App::$activeUser->ID ) {
Issues::add( 'error', 'You do not have permission to modify this calendar.' );
return $this->index();
}
$result = self::$notebooks->delete( $id );
if ( !$result ) {
Issues::add( 'error', 'There was an error deleting the notebook(s)' );
} else {
Issues::add( 'success', 'Notebook deleted' );
}
return $this->index();
}
/**
* Views
*/
public function byNotebook( $id = null ) {
self::$defaultView = __FUNCTION__;
Components::set( 'currentView', self::$defaultView );
$this->setupMenus( 0, $id );
Navigation::setCrumbComponent( 'NotebookBreadCrumbs', 'notes/byNotebook' );
$notes = self::$notes->findByNotebook( $id );
Views::view( 'notes.notes.list', $notes );
}
public function byNote( $id = null ) {
self::$defaultView = __FUNCTION__;
Components::set( 'currentView', self::$defaultView );
$note = self::$notes->findById( $id );
if ( $note == false ) {
Issues::add( 'error', 'Note not found.' );
return $this->index();
}
if ( $note->createdBy != App::$activeUser->ID ) {
Issues::add( 'error', 'You do not have permission to modify this note.' );
return $this->index();
}
$this->setupMenus( $id );
$select = FormBuilder::getSelectHtml(
'notebookID',
self::$notebooks->simpleList(true),
$note->notebookID,
);
Components::set( 'notebookSelect', $select );
Components::set( 'noteID', $note->ID );
Components::set( 'color', $note->color );
if ( !Input::exists( 'submit' ) ) {
return Views::view( 'notes.notes.edit', $note );
}
if ( !Forms::check( 'editNoteSimple' ) ) {
Issues::add( 'error', [ 'There was an error with your form.' => Check::userErrors() ] );
return Views::view( 'notes.notes.edit', $note );
}
if ( self::$notes->update( $id, Input::post( 'title' ), Input::post( 'note' ), Input::post( 'color' ), Input::post( 'notebookID' ) ) ) {
Issues::add( 'success', 'Note updated' );
} else {
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
}
return Views::view( 'notes.notes.edit', self::$notes->findById( $id ) );
}
public function duplicateNote( $id = null ) {
$note = self::$notes->findById( $id );
if ( $note == false ) {
Issues::add( 'error', 'Note not found.' );
return $this->index();
}
if ( $note->createdBy != App::$activeUser->ID ) {
Issues::add( 'error', 'You do not have permission to modify this note.' );
return $this->index();
}
if ( ! self::$notes->duplicate( $id ) ) {
Session::flash( 'error', [ 'There was an error duplicating your note.'] );
} else {
Session::flash( 'success', 'Your Note has been duplicated.' );
}
if ( !empty( $note->notebookID ) ) {
Redirect::to( 'notes/byNotebook/' . $note->notebookID );
} else {
Redirect::to( 'notes/index' );
}
}
public function autoUpdate( $id = null ) {
Template::setTemplate( 'api' );
$note = self::$notes->findById( $id );
if ( $note == false ) {
return Views::view( 'api.response', ['response' => json_encode( [ 'error' => 'Note not found.' ], true )]);
}
if ( $note->createdBy != App::$activeUser->ID ) {
return Views::view( 'api.response', ['response' => json_encode( [ 'error' => 'Note not found.' ], true )]);
}
if ( !Forms::check( 'autoUpdateNote' ) ) {
return Views::view( 'api.response', ['response' => json_encode( [ 'error' => 'Error with your form.' ], true )]);
}
if ( ! self::$notes->update( $id, Input::post( 'title' ), Input::post( 'note' ), Input::post( 'color' ), Input::post( 'notebookID' ) ) ) {
return Views::view( 'api.response', ['response' => json_encode( [ 'error' => 'Error updating your note.' ], true )]);
}
return Views::view( 'api.response', ['response' => json_encode( [ 'data' => 'Note Updated.' ], true )]);
}
private function setupMenus( $note_id = 0, $notebook_id = 0 ) {
if ( ! empty( $note_id ) ) {
$note = self::$notes->findById( $note_id );
}
if ( ! empty( $note ) ) {
$notebook_id = $note->notebookID;
}
$tree = self::$notebooks->getTree();
$trunk = [];
// Get the menu
foreach( $tree as $id => $notebook ) {
if ( ! isset( $notebook['notebook'] ) ) {
continue;
}
Components::set( 'notebookID', $notebook['notebook']->ID );
Components::set( 'notebookName', $notebook['notebook']->title );
Components::set( 'notebookIcon', $notebook['notebook']->icon );
Components::set( 'notebookColor', $notebook['notebook']->color );
if ( !empty( $notebook['notebooks'] ) ) {
$menuItem = Views::simpleView( 'notes.nav.menuItemList', $notebook['notebooks'] );
} else {
$menuItem = Views::simpleView( 'notes.nav.menuItem', $notebook['notebook'] );
}
$obj = new \stdClass();
$obj->menuItem = $menuItem;
$obj->menuItem = $menuItem;
$trunk[] = $obj;
}
$notebook = self::$notebooks->findById( $notebook_id );
if ( $notebook == false ) {
$notebook_id = '';
$notebook_title = 'All';
$notebookIcon = '';
$notebookColor = 'none';
} else {
$notebook_id = $notebook->ID;
$notebook_title = $notebook->title;
$notebookIcon = $notebook->icon;
$notebookColor = $notebook->color;
}
Components::set( 'notebookID', $notebook_id );
Components::set( 'notebookName', $notebook_title );
Components::set( 'notebookIcon', $notebookIcon );
Components::set( 'notebookColor', $notebookColor );
// Notebook Sidebar
$notebookSidebar = Views::simpleView('notes.nav.notebookSidebar', $trunk );
$notebookSidebarView = Navigation::activePageSelect( $notebookSidebar, '/notes/byNotebook/' . $notebook_id, false, true );
Components::set( 'notebookSidebar', $notebookSidebarView );
// Notes Sidebar
$noteSidebar = Views::simpleView('notes.nav.noteSidebar', self::$notes->simpleObjectByNotebook( $notebook_id ) );
$noteSidebarView = Navigation::activePageSelect( $noteSidebar, '/notes/byNote/' . $note_id, false, true );
Components::set( 'notesSidebar', $noteSidebarView );
// Page Crumbs
Navigation::setCrumbComponent( 'NotebookBreadCrumbs', 'notes/byNotebook' );
// Top Tabs
$notesTabs = Views::simpleView('notes.nav.topTabs');
$tabsView = Navigation::activePageSelect( $notesTabs, Input::get( 'url' ), false, true );
// Notebook Dropdown
$notebookDropdown = Views::simpleView('notes.nav.notebookDropdown', self::$notebooks->simpleObjectByUser() );
$notebookDropdownView = Navigation::activePageSelect( $notebookDropdown, $notebook_id, false, true );
Components::set( 'notebookDropdown', $notebookDropdownView );
// Re- Parse the top tabs
Components::set( 'NotesNav', Template::parse( $tabsView ) );
}
}

View File

@ -0,0 +1,231 @@
/* Custom styles for your specific layout */
.content-area {
margin-left: 400px; /* Adjust for the width of left sidebar */
padding: 20px; /* Adjust as per your design */
padding-bottom: 50px;
}
.float-bottom {
position: absolute;
bottom: 0;
width: 100%;
background-color: #f8f9fa; /* Background color for visibility */
padding: 10px 0; /* Padding for aesthetic spacing */
text-align: center; /* Centering the content */
}
.full-width-footer {
width: 100%;
background-color: #333;
color: #fff;
padding: 20px 0;
text-align: center;
position: fixed;
bottom: 0;
left: 0;
}
.side-nav {
width: 200px;
bottom: 50px;
height: 100%; /* Adjust based on your layout, could be 100vh or another value */
}
.notes-sidebar .nav li a {
padding: 10px 10px; /* Provides padding to make links easier to click */
}
.notebook-sidebar .nav li a {
/* padding: 10px 10px; /* Provides padding to make links easier to click */
}
.note {
padding-left: 0px !important;
padding-right: 0px !important;
}
#notebook-sidebar ul {
/* background-color: #000; */
/* background-color: #898989; */
background-color: #323232;
}
.navbar-inverse .navbar-nav li a.label.label-none {
--bg-color: #222;
}
.navbar-inverse .navbar-nav li a.label.label-info {
--bg-color: #5bc0de;
}
.navbar-inverse .navbar-nav li a.label.label-danger {
--bg-color: #d9534f;
}
.navbar-inverse .navbar-nav li a.label.label-success {
--bg-color: #5cb85c;
}
.navbar-inverse .navbar-nav li a.label.label-primary {
--bg-color: #337ab7;
}
.navbar-inverse .navbar-nav li a.label.label-warning {
--bg-color: #f0ad4e;
}
.navbar-inverse .navbar-nav li a.label {
color: #ffffff;
background-color: var(--bg-color) !important;
background-image:none !important;
}
.navbar-inverse .navbar-nav li.active a.label {
color: #ffffff !important;
background-image:none !important;
font-weight: bold;
box-shadow: inset 2px -1px 2px 1px rgb(255, 255, 255) !important;
}
.notebook-sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
width: 200px; /* 1/6 width */
background-color: #00ff0d;
padding-top: 50px; /* Adjust as per your design */
}
.navbar-inverse.nav-stack .navbar-nav li a:hover,
.navbar-inverse.nav-stack .navbar-nav li a:focus {
background-color: #5a5a5a;
}
.notebook-sidebar .navbar-nav li a {
padding-top: 10px;
padding-bottom: 10px;
width: 200px;
}
.notes-sidebar .navbar-nav li.sidebar-brand a {
padding-top: 10px;
padding-bottom: 10px;
width: 200px;
background-color: #666666;
background-image:none !important;
}
.notes-sidebar .nav .sidebar-brand a {
color: #fff;
}
.notes-sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 200px; /* Width of first sidebar */
width: 200px; /* 1/6 width */
background-color: #c7c7c7;
padding-left: 0px !important;
padding-right: 0px !important;
padding-top: 50px; /* Adjust as per your design */
overflow-y: auto; /* Makes vertical overflow scrollable */
overflow-x: hidden; /* Hides horizontal overflow */
}
.notes-sidebar-width {
width: 200px;
}
.notes-sidebar .nav li {
width: 200px;
padding-left: 0 !important;
padding-right: 0 !important;
}
.notes-sidebar .nav li a {
color:#5a5a5a;
display: block;
padding-left: 10px !important;
padding-right: 0px !important;
}
.notes-sidebar .nav {
position: relative;
height: calc(100% - 50px); /* Reduce the height by the padding-top value or any other header/footer within the sidebar */
padding-bottom: 50px; /* Space for the bottom anchored item */
margin-bottom: 0; /* Removes default margin */
}
.outlined-element, .submenu {
border-bottom: 1px solid #575757;
}
li.submenu a.label {
margin-left: 15px;
padding-left: 25px;
padding-top: 10px;
padding-bottom: 10px;
text-align: left;
line-height: 20px;
}
/* .sidebar .notes-sidebar .nav li.sidebar-brand {
background-image:none;
background-color: #00ff0d !important;
} */
/* .notebook-sidebar .navbar-inverse .navbar-nav li a .label,
.notebook-sidebar .navbar-inverse .navbar-nav li a .label:hover,
.notebook-sidebar .navbar-inverse .navbar-nav li a .label:focus {
background-color: #f129d7 !important;
color: #f129d7 !important;
background-image:none !important;
} */
/* .navbar-inverse .navbar-nav li a.label:hover,
.navbar-inverse .navbar-nav li a.label:focus {
background-color: #00ff0d !important;
color: #00ff0d !important;
background-image:none;
} */
/* .sidebar .notes-sidebar .navbar-inverse .navbar-nav li .active {
background-color: #00ff0d !important;
color: #00ff0d !important;
background-image:none;
} */
/* .sidebar .notes-sidebar .navbar-inverse .navbar-nav li .active {
background-color: #f129d7 !important;
color: #f129d7 !important;
background-image:none;
} */
/* .dateMonthContainer {
background-color: #f129d7 !important;
color: #f129d7 !important;
background-image:none;
} */
/* .sidebar .notes-sidebar .navbar-inverse .navbar-nav li .active {
background-image: none;
background-color: #00ff0d !important;
color: #00ff0d !important;
} */
.side-bar-brand,
.sidebar-brand {
/* background-image: none !important; */
/* background-color: #f129d7 !important;
color: #f129d7 !important; */
}

136
app/plugins/notes/forms.php Normal file
View File

@ -0,0 +1,136 @@
<?php
/**
* app/plugins/notes/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @package TP Notes
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Notes;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Classes\Forms;
class NotesForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'createNote', __CLASS__, 'createNote' );
self::addHandler( 'createNotebook', __CLASS__, 'createNotebook' );
self::addHandler( 'editNote', __CLASS__, 'editNote' );
self::addHandler( 'editNoteSimple', __CLASS__, 'editNoteSimple' );
self::addHandler( 'editNotebook', __CLASS__, 'editNotebook' );
self::addHandler( 'autoUpdateNote', __CLASS__, 'autoUpdateNote' );
}
public static function createNote() {
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must include a title.' );
return false;
}
if ( ! Input::exists( 'color' ) ) {
Check::addUserError( 'You must include a color.' );
return false;
}
// if ( !self::token() ) {
// Check::addUserError( 'token - comment out later.' );
// return false;
// }
return true;
}
public static function createNotebook() {
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must include a title.' );
return false;
}
if ( ! Input::exists( 'color' ) ) {
Check::addUserError( 'You must include a color.' );
return false;
}
// if ( ! self::token() ) {
// Check::addUserError( 'token - comment out later.' );
// return false;
// }
return true;
}
public static function autoUpdateNote() {
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must include a title.' );
return false;
}
// if ( ! self::token() ) {
// Check::addUserError( 'token - comment out later.' );
// return false;
// }
return true;
}
public static function editNote() {
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must include a title.' );
return false;
}
if ( ! Input::exists( 'color' ) ) {
Check::addUserError( 'You must include a color.' );
return false;
}
// if ( !self::token() ) {
// Check::addUserError( 'token - comment out later.' );
// return false;
// }
return true;
}
public static function editNoteSimple() {
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must include a title.' );
return false;
}
// if ( !self::token() ) {
// Check::addUserError( 'token - comment out later.' );
// return false;
// }
return true;
}
public static function editNotebook() {
if ( ! Input::exists( 'submit' ) ) {
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must include a title.' );
return false;
}
if ( ! Input::exists( 'color' ) ) {
Check::addUserError( 'You must include a color.' );
return false;
}
// if ( !self::token() ) {
// Check::addUserError( 'token - comment out later.' );
// return false;
// }
return true;
}
}
new NotesForms;

View File

@ -0,0 +1,32 @@
function setIcon(iconName, iconText) {
document.getElementById('iconValue').value = iconName;
document.getElementById('selected-icon').innerHTML = '<span class="glyphicon glyphicon-' + iconName + '"></span> ' + iconText;
}
$( document ).ready( function () {
function autosave() {
var title = $( "#title" ).val();
var color = $( "#color" ).val();
var notebookID = $( "#notebookID" ).val();
var noteID = $( "#noteID" ).val();
var note = $( "#note" ).val();
$.post( "/notes/autoUpdate/" + noteID, {
title: title,
color: color,
notebookID: notebookID,
note: note,
});
console.log( 'note saved' );
}
var lastSegment = window.location.pathname.split('/').pop();
if (!isNaN(lastSegment)) {
if (window.location.pathname.endsWith('/notes/byNote/'+lastSegment)) {
console.log( 'autosave enabled' );
setInterval(autosave, 60 * 1000);
}
}
});

View File

@ -0,0 +1,169 @@
<?php
/**
* app/plugins/notes/models/notebooks.php
*
* This class is used for the manipulation of the notebooks database table.
*
* @package TP Notes
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Models;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Canary\Canary as Debug;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Houdini\Classes\Filters;
use TheTempusProject\Bedrock\Classes\CustomException;
class Notebooks extends DatabaseModel {
public $tableName = 'notebooks';
public $databaseMatrix = [
[ 'title', 'varchar', '256' ],
[ 'description', 'text', '' ],
[ 'color', 'varchar', '48' ],
[ 'icon', 'varchar', '48' ],
[ 'createdBy', 'int', '11' ],
[ 'createdAt', 'int', '11' ],
[ 'notebookID', 'int', '11' ],
[ 'order', 'int', '11' ],
];
/**
* The model constructor.
*/
public function __construct() {
parent::__construct();
}
public function create( $title, $description = '', $color = 'default', $notebookID = 0, $icon = '' ) {
if ( ! Check::dataTitle( $title ) ) {
Debug::info( 'Notebooks: illegal title.' );
return false;
}
$fields = [
'title' => $title,
'description' => $description,
'color' => $color,
'notebookID' => $notebookID,
'icon' => $icon,
'createdBy' => App::$activeUser->ID,
'createdAt' => time(),
];
if ( ! self::$db->insert( $this->tableName, $fields ) ) {
new CustomException( 'notebookCreate' );
Debug::error( "Notebooks: not created " . var_export($fields,true) );
return false;
}
return self::$db->lastId();
}
public function update( $id, $title, $description = '', $color = 'default', $notebookID = 0, $icon = '' ) {
if ( !Check::id( $id ) ) {
Debug::info( 'Notebooks: illegal ID.' );
return false;
}
if ( !Check::dataTitle( $title ) ) {
Debug::info( 'Notebooks: illegal title.' );
return false;
}
$fields = [
'title' => $title,
'notebookID' => $notebookID,
'description' => $description,
'color' => $color,
'icon' => $icon,
];
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
new CustomException( 'notebooksUpdate' );
Debug::error( "Notebooks: $id not updated" );
return false;
}
return true;
}
public function byUser( $limit = null ) {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
if ( empty( $limit ) ) {
$notebooks = self::$db->get( $this->tableName, $whereClause );
} else {
$notebooks = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$notebooks->count() ) {
Debug::info( 'No Notebooks found.' );
return false;
}
return $this->filter( $notebooks->results() );
}
public function getName( $id ) {
$notebooks = self::findById( $id );
return $notebooks->title;
}
public function simpleList( $param = '') {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
$notebooks = self::$db->get( $this->tableName, $whereClause );
if ( !$notebooks->count() ) {
Debug::warn( 'Could not find any notebooks' );
return [];
}
$notebooks = $notebooks->results();
$out = [ 'None' => '0'];
foreach ( $notebooks as &$notebook ) {
$out[ $notebook->title ] = $notebook->ID;
}
return $out;
}
public function simpleObjectByUser() {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
$notebooks = self::$db->get( $this->tableName, $whereClause );
if ( !$notebooks->count() ) {
Debug::warn( 'Could not find any notebooks' );
return false;
}
$notebooks = $notebooks->results();
$out = [];
foreach ( $notebooks as &$notebook ) {
$obj = new \stdClass();
$obj->title = $notebook->title;
$obj->ID = $notebook->ID;
$out[] = $obj;
}
return $out;
}
public function getTree() {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
$notebooks = self::$db->get( $this->tableName, $whereClause );
if ( !$notebooks->count() ) {
Debug::warn( 'Could not find any notebooks' );
return [];
}
$notebooks = $notebooks->results();
$formattedNotebooks = [];
foreach ($notebooks as $notebook) {
if ( !empty($notebook->notebookID) ) {
$notebookID = $notebook->notebookID;
if ( ! isset( $formattedNotebooks[ $notebookID ])) {
$formattedNotebooks[ $notebookID ][ 'notebooks' ] = [];
}
$formattedNotebooks[ $notebookID ][ 'notebooks' ][] = $notebook;
} else {
$notebookID = $notebook->ID;
$formattedNotebooks[ $notebookID ][ 'notebook' ] = $notebook;
}
}
return $formattedNotebooks;
}
}

View File

@ -0,0 +1,222 @@
<?php
/**
* app/plugins/notes/models/notes.php
*
* This class is used for the manipulation of the notes database table.
*
* @package TP Notes
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Models;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Canary\Canary as Debug;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Houdini\Classes\Filters;
use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Bedrock\Functions\Sanitize;
class Notes extends DatabaseModel {
public $tableName = 'notes';
public $databaseMatrix = [
[ 'title', 'varchar', '256' ],
[ 'note', 'text', '' ],
[ 'color', 'varchar', '48' ],
[ 'notebookID', 'int', '11' ],
[ 'createdBy', 'int', '11' ],
[ 'createdAt', 'int', '11' ],
[ 'order', 'int', '11' ],
];
/**
* The model constructor.
*/
public function __construct() {
parent::__construct();
}
public function create( $title, $note = '', $color = 'default', $notebookID = 0 ) {
$fields = [
'title' => $title,
'note' => $note,
'color' => $color,
'notebookID' => $notebookID,
'createdBy' => App::$activeUser->ID,
'createdAt' => time(),
];
if ( ! self::$db->insert( $this->tableName, $fields ) ) {
new CustomException( 'noteCreate' );
Debug::error( "Notes: not created " . var_export($fields,true) );
return false;
}
return self::$db->lastId();
}
public function update( $id, $title, $note = '', $color = 'default', $notebookID= 0 ) {
if ( !Check::id( $id ) ) {
Debug::info( 'Notes: illegal ID.' );
return false;
}
if ( !Check::id( $notebookID ) ) {
Debug::info( 'Notes: illegal ID.' );
return false;
}
$fields = [
'title' => $title,
'note' => $note,
'color' => $color,
'notebookID' => $notebookID,
];
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
new CustomException( 'noteUpdate' );
Debug::error( "Notes: $id not updated: $fields" );
return false;
}
return true;
}
public function byUser( $limit = null ) {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
if ( empty( $limit ) ) {
$notes = self::$db->get( $this->tableName, $whereClause );
} else {
$notes = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$notes->count() ) {
Debug::info( 'No Notes found.' );
return false;
}
return $this->filter( $notes->results() );
}
public function getName( $id ) {
$note = self::findById( $id );
return $note->title;
}
public function simpleByUser() {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
$notes = self::$db->get( $this->tableName, $whereClause );
if ( !$notes->count() ) {
Debug::warn( 'Could not find any notes' );
return false;
}
$notes = $notes->results();
$out = [];
foreach ( $notes as &$note ) {
$out[ $note->title ] = $note->ID;
}
return $out;
}
public function simpleObjectByUser() {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
$notes = self::$db->get( $this->tableName, $whereClause );
if ( !$notes->count() ) {
Debug::warn( 'Could not find any notes' );
return false;
}
$notes = $notes->results();
$out = [];
foreach ( $notes as &$note ) {
$obj = new \stdClass();
$obj->title = $note->title;
$obj->ID = $note->ID;
$out[] = $obj;
}
return $out;
}
public function simpleObjectByNotebook( $id = 0 ) {
$whereClause = [];
if ( ! empty( $id ) ) {
$whereClause = [
'notebookID', '=', $id, 'AND',
];
}
$whereClause = array_merge( $whereClause, [
'createdBy', '=', App::$activeUser->ID,
] );
$notes = self::$db->get( $this->tableName, $whereClause );
if ( !$notes->count() ) {
Debug::warn( 'Could not find any notes' );
return false;
}
$notes = $notes->results();
$out = [];
foreach ( $notes as &$note ) {
$obj = new \stdClass();
$obj->title = $note->title;
$obj->ID = $note->ID;
$out[] = $obj;
}
return $out;
}
public function findByNotebook( $id = 0 ) {
$whereClause = [];
if ( ! empty( $id ) ) {
$whereClause = [
'notebookID', '=', $id, 'AND',
];
}
$whereClause = array_merge( $whereClause, [
'createdBy', '=', App::$activeUser->ID,
] );
$notes = self::$db->get( $this->tableName, $whereClause );
if ( ! $notes->count() ) {
Debug::info( 'No ' . $this->tableName . ' data found.' );
return [];
}
return $this->filter( $notes->results() );
}
public function filter( $postArray, $params = [] ) {
foreach ( $postArray as $instance ) {
if ( !is_object( $instance ) ) {
$instance = $postArray;
$end = true;
}
$cleanPost = Sanitize::contentShort( $instance->note );
$postSpace = explode( ' ', $cleanPost );
$postLine = explode( "\n", $cleanPost );
// summary by words: 100
$spaceSummary = implode( ' ', array_splice( $postSpace, 0, 100 ) );
// summary by lines: 5
$lineSummary = implode( "\n", array_splice( $postLine, 0, 5 ) );
if ( strlen( $spaceSummary ) < strlen( $lineSummary ) ) {
$contentSummary = $spaceSummary;
$contentSummaryNoLink = $contentSummary;
if ( count( $postSpace, 1 ) <= 100 ) {
$contentSummaryNoLink = $contentSummary;
$contentSummary .= '... <a href="{ROOT_URL}blog/post/' . $instance->ID . '">Read More</a>';
}
} else {
// @todo: need to refine this after testing
$contentSummaryNoLink = $lineSummary;
$contentSummary = $lineSummary . '... <a href="{ROOT_URL}blog/post/' . $instance->ID . '">Read More</a>';
}
$instance->contentSummaryNoLink = $contentSummaryNoLink;
$instance->contentSummary = $contentSummary;
if ( isset( $params['stripHtml'] ) && $params['stripHtml'] === true ) {
$instance->contentSummary = strip_tags( $instance->content );
}
// $instance->content = Filters::applyOne( 'mentions.0', $instance->content, true );
// $instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
$out[] = $instance;
if ( !empty( $end ) ) {
$out = $out[0];
break;
}
}
return $out;
}
}

View File

@ -0,0 +1,57 @@
<?php
/**
* app/plugins/notes/plugin.php
*
* This houses all of the main plugin info and functionality.
*
* @package TP Notes
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins;
use TheTempusProject\Classes\Plugin;
use TheTempusProject\Models\Notes as Note;
use TheTempusProject\Models\Notebooks;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Template;
class Notes extends Plugin {
public $pluginName = 'TP Notes';
public $configName = 'notes';
public $pluginAuthor = 'JoeyK';
public $pluginWebsite = 'https://TheTempusProject.com';
public $modelVersion = '1.0';
public $pluginVersion = '3.0';
public $pluginDescription = 'A simple plugin which adds a site wide notes system.';
public $permissionMatrix = [
'useNotes' => [
'pretty' => 'Can use the notes feature',
'default' => false,
],
];
public $main_links = [
[
'text' => 'Notes',
'url' => '{ROOT_URL}notes/index/',
'filter' => 'loggedin',
],
];
public $configMatrix = [
'enabled' => [
'type' => 'radio',
'pretty' => 'Enable Notes.',
'default' => true,
],
];
public $notes;
public $notebooks;
public function __construct( $load = false ) {
// $this->notes = new Note;
// $this->notebooks = new Notebooks;
parent::__construct( $load );
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* app/plugins/notes/templates/notes.inc.php
*
* This is the loader for the notes template.
*
* @package TP Notes
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Templates;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Navigation;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Models\Notebooks;
class NotesLoader extends DefaultLoader {
/**
* This is the function used to generate any components that may be
* needed by this template.
*/
public function __construct() {
$notebooks = new Notebooks;
Navigation::setCrumbComponent( 'NotebookBreadCrumbs', Input::get( 'url' ) );
$this->addJs( '<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{ROOT_URL}app/plugins/notes/js/notes.js"></script>' );
parent::__construct();
}
}

View File

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="en">
<!--
* app/plugins/calendar/templates/calendar.tpl
*
* @package TP Calendar
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta property="og:url" content="{CURRENT_URL}">
<meta name='twitter:card' content='summary' />
<title>{TITLE}</title>
<meta itemprop="name" content="{TITLE}">
<meta name="twitter:title" content="{TITLE}">
<meta property="og:title" content="{TITLE}">
<meta name="description" content="{PAGE_DESCRIPTION}">
<meta itemprop="description" content="{PAGE_DESCRIPTION}">
<meta name="twitter:description" content="{PAGE_DESCRIPTION}">
<meta property="og:description" content="{PAGE_DESCRIPTION}">
<meta itemprop="image" content="{META_IMAGE}">
<meta name="twitter:image" content="{META_IMAGE}">
<meta property="og:image" content="{META_IMAGE}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="The Tempus Project">
{ROBOT}
<link rel="alternate" hreflang="en-us" href="alternateURL">
<link rel="icon" href="{ROOT_URL}images/favicon.ico">
<!-- Required CSS -->
<link rel="stylesheet" href="{FONT_AWESOME_URL}font-awesome.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="{BOOTSTRAP_CDN}css/bootstrap-theme.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="{BOOTSTRAP_CDN}css/bootstrap.min.css" crossorigin="anonymous">
<!-- RSS -->
<link rel="alternate" href="{ROOT_URL}blog/rss" title="{TITLE} Feed" type="application/rss+xml" />
<!-- Custom styles for this template -->
<link rel="stylesheet" href="{ROOT_URL}app/plugins/notes/css/notes.css" />
{TEMPLATE_CSS_INCLUDES}
</head>
<body>
<!-- Top / Main Nav -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Name and dropdown-->
<div class="navbar-header">
<a href="{ROOT_URL}" class="navbar-brand">{SITENAME}</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Right Menu Dropdown -->
<div class="container-fluid">
<div class="collapse navbar-collapse navbar-ex1-collapse">
{topNavLeft}
<div class="navbar-right">
<ul class="nav navbar-nav">
{topNavRight}
</ul>
</div>
</div>
</div>
</nav>
<div class="sidebar col-lg-4">
<!-- Notebooks Sidebar -->
<div class="notebook-sidebar">
{notebookSidebar}
</div>
<!-- Notes Sidebar -->
<div class="notes-sidebar">
{notesSidebar}
</div>
</div>
<!-- Main content area -->
<div class="content-area left-nav-buffer col-lg-8">
<div class="container-fluid">
{ISSUES}
<div class="row">
<div class="container">
{ERROR}
{NOTICE}
{SUCCESS}
</div>
</div>
{/ISSUES}
<div class="row">
<div class="container">
{NotesNav}
{CONTENT}
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer>
<div class="sticky-foot">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center sticky-copy">
<p class="text-muted">Powered by <a href="https://thetempusproject.com">The Tempus Project</a>.</p>
</div>
</div>
</footer>
<!-- Bootstrap core JavaScript and jquery -->
<script src="{JQUERY_CDN}jquery.min.js" crossorigin="anonymous"></script>
<script src="{BOOTSTRAP_CDN}js/bootstrap.min.js" crossorigin="anonymous"></script>
<!-- Custom javascript for this template -->
{TEMPLATE_JS_INCLUDES}
</body>
</html>

View File

@ -0,0 +1,12 @@
<h3>Notebooks</h3>
<div class="row">
<div class="col-xlg-12 col-lg-12">
{notebookList}
</div>
</div>
<h3>Notes</h3>
<div class="row">
<div class="col-xlg-12 col-lg-12">
{noteList}
</div>
</div>

View File

@ -0,0 +1 @@
<a href="{ROOT_URL}notes/byNotebook/{ID}" class="label label-{color}"><i class="glyphicon glyphicon-{icon}"></i> {title}</a>

View File

@ -0,0 +1,18 @@
<a href="#" class="label label-{notebookColor} outlined-element" data-toggle="collapse" data-target="#menu-collapse-{notebookID}">
<i class="glyphicon glyphicon-{notebookIcon}"></i> {notebookName}
<i class="fa fa-fw fa-angle-down"></i>
</a>
<ul id="menu-collapse-{notebookID}" class="collapse">
<li class="submenu">
<a href="{ROOT_URL}notes/byNotebook/{notebookID}" class="label label-{notebookColor}"><i class="glyphicon glyphicon-{notebookIcon}"></i> {notebookName}</a>
</li>
{LOOP}
<li class="submenu">
<a href="{ROOT_URL}notes/byNotebook/{ID}" class="label label-{color}"><i class="glyphicon glyphicon-{icon}"></i> {title}</a>
</li>
{/LOOP}
{ALT}
<li>
</li>
{/ALT}
</ul>

View File

@ -0,0 +1,19 @@
<nav class="navbar-inverse nav-stack navbar-pills flex-grow-1" role="navigation">
<ul class="nav navbar-nav nav-stack">
<li class="sidebar-brand">
<a href="{ROOT_URL}notes/byNotebook/{notebookID}" class="label label-{notebookColor}" data-id="all">{noteBookName}</a>
</li>
{LOOP}
<li>
<a href="{ROOT_URL}notes/byNote/{ID}" data-id="{ID}">{title}</a>
</li>
{/LOOP}
{ALT}
<li>
</li>
{/ALT}
<li class="bottom-nav active">
<a href="{ROOT_URL}notes/createNote/{notebookID}" class="text-center active"><i class="fa fa-fw fa-plus"></i></a>
</li>
</ul>
</nav>

View File

@ -0,0 +1,11 @@
<ul class="dropdown-menu">
<li><a href="{ROOT_URL}notes/byNotebook/">All</a></li>
<li role="separator" class="divider"></li>
{LOOP}
<li><a href="{ROOT_URL}notes/byNotebook/{ID}">{title}</a></li>
{/LOOP}
<li role="separator" class="divider"></li>
<li><a href="{ROOT_URL}notes/createNotebook">Create Notebook</a></li>
<li><a href="{ROOT_URL}notes/editNotebook/{notebookID}">Edit Notebook</a></li>
<li><a href="{ROOT_URL}notes/deleteNotebook/{notebookID}">Delete Notebook</a></li>
</ul>

View File

@ -0,0 +1,19 @@
<nav class="navbar-inverse nav-stack navbar-pills flex-grow-1" role="navigation">
<ul id="notebook-sidebar" class="nav navbar-nav nav-stack side-nav" style="width: 200px;">
<li class="active notebook-sidebar-brand">
<a href="{ROOT_URL}notes/byNotebook/" class="text-center">All Notes</a>
</li>
{LOOP}
<li class="outlined-element">
{menuItem}
</li>
{/LOOP}
{ALT}
<li>
</li>
{/ALT}
<li class="active">
<a href="{ROOT_URL}notes/createNotebook/" class="text-center"><i class="fa fa-fw fa-plus"></i></a>
</li>
</ul>
</nav>

View File

@ -0,0 +1,10 @@
<ul class="nav nav-tabs">
<li><a href="{ROOT_URL}notes/byNotebook/{notebookID}">All Notes</a></li>
<li><a href="{ROOT_URL}notes/editNotebook/{notebookID}">Notebook</a></li>
<li class="pull-right dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Notebooks <span class="caret"></span>
</button>
{notebookDropdown}
</li>
</ul>

View File

@ -0,0 +1,41 @@
<legend>Create Notebook</legend>
<form action="" method="post" class="form-horizontal">
<input type="hidden" name="token" value="{TOKEN}">
<div class="form-group">
<label for="notebookID" class="col-lg-3 control-label">Parent Notebook</label>
<div class="col-lg-3">
{notebookSelect}
</div>
</div>
<div class="form-group">
<label for="title" class="col-lg-3 control-label">Title</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="title" id="title">
</div>
</div>
<div class="form-group">
<label for="description" class="col-lg-3 control-label">Description</label>
<div class="col-lg-3">
<textarea class="form-control" name="description" maxlength="2000" rows="10" cols="50" id="description"></textarea>
</div>
</div>
<div class="form-group">
<label for="color" class="col-lg-3 control-label">Color</label>
<div class="col-lg-3 select-container" id="colorContainer">
{colorSelect}
</div>
</div>
<div class="form-group">
<label for="dropdown" class="col-lg-3 control-label">Icon</label>
<div class="dropdow col-lg-3">
{iconSelect}
</div>
<input type="hidden" id="iconValue" name="icon" value="">
</div>
<div class="form-group">
<label for="submit" class="col-lg-3 control-label"></label>
<div class="col-lg-3">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</div>
</div>
</form>

View File

@ -0,0 +1,39 @@
<form action="" method="post" class="form-horizontal">
<input type="hidden" name="token" value="{TOKEN}">
<div class="form-group" style="margin-top: 20px;">
<label for="notebookID" class="col-lg-3 control-label">Parent Notebook</label>
<div class="col-lg-3">
{notebookSelect}
</div>
</div>
<div class="form-group">
<label for="title" class="col-lg-3 control-label">Title</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="title" id="title" value="{title}">
</div>
</div>
<div class="form-group">
<label for="description" class="col-lg-3 control-label">Description</label>
<div class="col-lg-3">
<textarea class="form-control" name="description" maxlength="2000" rows="10" cols="50" id="description">{description}</textarea>
</div>
</div>
<div class="form-group">
<label for="color" class="col-lg-3 control-label">Color</label>
<div class="col-lg-3 select-container" id="colorContainer">
{colorSelect}
</div>
</div>
<div class="form-group">
<label for="dropdown" class="col-lg-3 control-label">Icon</label>
<div class="dropdow col-lg-3">
{iconSelect}
</div>
</div>
<div class="form-group">
<label for="submit" class="col-lg-3 control-label"></label>
<div class="col-lg-3">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</div>
</div>
</form>

View File

@ -0,0 +1,35 @@
<div class="row" style="margin-top: 30px; margin-bottom: 50px;">
<form action="" method="post">
<table class="table table-striped">
<thead>
<tr>
<th style="width: 55%">Title</th>
<th style="width: 30%">Description</th>
<th style="width: 5%"></th>
<th style="width: 5%"></th>
<th style="width: 5%"></th>
</tr>
</thead>
<tbody>
{LOOP}
<tr>
<td><a href='{ROOT_URL}notes/byNotebook/{ID}'>{title}</a></td>
<td>{description}</td>
<td><a href="{ROOT_URL}notes/byNotebook/{ID}" class="btn btn-sm btn-primary" role="button"><i class="glyphicon glyphicon-open"></i></a></td>
<td><a href="{ROOT_URL}notes/editNotebook/{ID}" class="btn btn-sm btn-warning" role="button"><i class="glyphicon glyphicon-edit"></i></a></td>
<td><a href="{ROOT_URL}notes/deleteNotebook/{ID}" class="btn btn-sm btn-danger" role="button"><i class="glyphicon glyphicon-trash"></i></a></td>
</tr>
{/LOOP}
{ALT}
<tr>
<td colspan="7">
No Notebooks
</td>
</tr>
{/ALT}
</tbody>
</table>
<a href="{ROOT_URL}notes/createNotebook" class="btn btn-sm btn-primary" role="button">New Notebook</a>
</form>
</div>

View File

@ -0,0 +1,32 @@
<legend>Create Note</legend>
<form action="" method="post" class="form-horizontal">
<input type="hidden" name="token" value="{TOKEN}">
<div class="col-lg-4">
<label for="notebookID" class="col-lg-3 control-label">Notebook</label>
{notebookSelect}
</div>
<div class="form-group">
<label for="title" class="col-lg-3 control-label">Title</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="title" id="title">
</div>
</div>
<div class="form-group">
<label for="note" class="col-lg-3 control-label">Note</label>
<div class="col-lg-3">
<textarea class="form-control" name="note" maxlength="5000" rows="10" cols="50" id="note"></textarea>
</div>
</div>
<div class="form-group">
<label for="color" class="col-lg-3 control-label">Color</label>
<div class="col-lg-3 select-container" id="colorContainer">
{colorSelect}
</div>
</div>
<div class="form-group">
<label for="submit" class="col-lg-3 control-label"></label>
<div class="col-lg-3">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</div>
</div>
</form>

View File

@ -0,0 +1,29 @@
<legend>Edit Note</legend>
<form action="" method="post" class="form-horizontal">
<input type="hidden" name="token" value="{TOKEN}">
<input type="hidden" name="noteID" id="noteID" value="{noteID}">
<div class="form-group">
<div class="col-lg-4">
<label for="title" class="control-label">Title</label>
<input type="text" class="form-control" name="title" id="title" value="{title}">
</div>
<div class="col-lg-4">
<label for="color" class="col-lg-3 control-label">Color</label>
<div class="select-container" id="colorContainer">
{colorSelect}
</div>
</div>
<div class="col-lg-4">
<label for="notebookID" class="col-lg-3 control-label">Notebook</label>
{notebookSelect}
</div>
<div class="col-lg-12">
<label for="color" class="control-label">Note</label>
<textarea class="form-control" name="note" maxlength="5000" rows="25" cols="50" id="note">{note}</textarea>
</div>
<div class="col-lg-12">
<label for="submit" class="control-label"></label>
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</div>
</div>
</form>

View File

@ -0,0 +1,35 @@
<div class="row" style="margin-top: 30px; margin-bottom: 50px;">
<form action="" method="post">
<table class="table table-striped">
<thead>
<tr>
<th style="width: 20%">Title</th>
<th style="width: 60%">Note</th>
<th style="width: 20%">Created</th>
<th style="width: 5%"></th>
<th style="width: 5%"></th>
</tr>
</thead>
<tbody>
{LOOP}
<tr>
<td>{title}</td>
<td>{contentSummaryNoLink}</td>
<td>{DTC}{createdAt}{/DTC}</td>
<td><a href="{ROOT_URL}notes/duplicateNote/{ID}" class="btn btn-sm btn-primary" role="button"><i class="glyphicon glyphicon-copy"></i></a></td>
<td><a href="{ROOT_URL}notes/editNote/{ID}" class="btn btn-sm btn-warning" role="button"><i class="glyphicon glyphicon-edit"></i></a></td>
<td><a href="{ROOT_URL}notes/deleteNote/{ID}" class="btn btn-sm btn-danger" role="button"><i class="glyphicon glyphicon-trash"></i></a></td>
</tr>
{/LOOP}
{ALT}
<tr>
<td colspan="7">
No Notes
</td>
</tr>
{/ALT}
</tbody>
</table>
<a href="{ROOT_URL}notes/createNote/{notebookID}" class="btn btn-sm btn-primary" role="button">New Note</a>
</form>
</div>