-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
149 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?php | ||
/** | ||
* ownCloud - ownnote | ||
* | ||
* This file is licensed under the Affero General Public License version 3 or | ||
* later. See the COPYING file. | ||
* | ||
* @author Ben Curtis <ownclouddev@nosolutions.com> | ||
* @copyright Ben Curtis 2015 | ||
*/ | ||
|
||
namespace OCA\OwnNote\Controller; | ||
|
||
use \OCP\AppFramework\ApiController; | ||
use \OCP\AppFramework\Http\JSONResponse; | ||
use \OCP\AppFramework\Http\Response; | ||
use \OCP\AppFramework\Http; | ||
use \OCP\IRequest; | ||
use \OCA\OwnNote\Lib\Backend; | ||
|
||
\OCP\App::checkAppEnabled('ownnote'); | ||
|
||
|
||
|
||
class OwnnoteAjaxController extends ApiController { | ||
|
||
private $backend; | ||
|
||
|
||
public function __construct($appName, IRequest $request){ | ||
parent::__construct($appName, $request); | ||
$this->backend = new Backend(); | ||
} | ||
|
||
/** | ||
* AJAX FUNCTIONS | ||
*/ | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxindex() { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
return $this->backend->getListing($FOLDER, false); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxannouncement() { | ||
return $this->backend->getAnnouncement(); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxcreate($name, $group) { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
if (isset($name) && isset($group)) | ||
return $this->backend->createNote($FOLDER, $name, $group); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxdel($name, $group) { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
if (isset($name) && isset($group)) | ||
return $this->backend->deleteNote($FOLDER, $name, $group); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxedit($name, $group) { | ||
if (isset($name) && isset($group)) | ||
return $this->backend->editNote($name, $group); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxsave($name, $group, $content) { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
if (isset($name) && isset($group) && isset($content)) | ||
return $this->backend->saveNote($FOLDER, $name, $group, $content, 0); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxren($name, $group, $newname, $newgroup) { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
if (isset($name) && isset($newname) && isset($group) && isset($newgroup)) | ||
return $this->backend->renameNote($FOLDER, $name, $group, $newname, $newgroup); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxdelgroup($group) { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
if (isset($group)) | ||
return $this->backend->deleteGroup($FOLDER, $group); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxrengroup($group, $newgroup) { | ||
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes'); | ||
if (isset($group) && isset($newgroup)) | ||
return $this->backend->renameGroup($FOLDER, $group, $newgroup); | ||
} | ||
|
||
/** | ||
* @NoAdminRequired | ||
*/ | ||
public function ajaxversion() { | ||
return $this->backend->getVersion(); | ||
} | ||
|
||
/** | ||
*/ | ||
public function ajaxsetval($field, $value) { | ||
return $this->backend->setAdminVal($field, $value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters