porting the hooks and starting with the templates
This commit is contained in:
parent
4a89eb77c1
commit
9bcc5c11a8
|
@ -7,7 +7,7 @@ OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php';
|
|||
OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php';
|
||||
OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php';
|
||||
OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
|
||||
OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
|
||||
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
|
||||
OCP\Util::addscript('calendar','loader');
|
||||
OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min");
|
||||
OCP\Util::addStyle("3rdparty", "chosen/chosen");
|
||||
|
|
|
@ -25,7 +25,7 @@ foreach($calendars as $calendar){
|
|||
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true');
|
||||
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
|
||||
|
||||
OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
|
||||
OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources));
|
||||
$categories = OC_Calendar_App::getCategoryOptions();
|
||||
|
||||
//Fix currentview for fullcalendar
|
||||
|
|
|
@ -338,7 +338,7 @@ class OC_Calendar_App{
|
|||
OCP\Response::setETagHeader($calendar['ctag']);
|
||||
$events = OC_Calendar_Object::allInPeriod($calendar_id, $start, $end);
|
||||
} else {
|
||||
OC_Hook::emit('OC_Calendar', 'getEvents', array('calendar_id' => $calendar_id, 'events' => &$events));
|
||||
OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendar_id, 'events' => &$events));
|
||||
}
|
||||
}
|
||||
return $events;
|
||||
|
|
|
@ -5,9 +5,9 @@ OC::$CLASSPATH['OC_Contacts_VCard'] = 'apps/contacts/lib/vcard.php';
|
|||
OC::$CLASSPATH['OC_Contacts_Hooks'] = 'apps/contacts/lib/hooks.php';
|
||||
OC::$CLASSPATH['OC_Connector_Sabre_CardDAV'] = 'apps/contacts/lib/connector_sabre.php';
|
||||
OC::$CLASSPATH['OC_Search_Provider_Contacts'] = 'apps/contacts/lib/search.php';
|
||||
OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'deleteUser');
|
||||
OC_HOOK::connect('OC_Calendar', 'getEvents', 'OC_Contacts_Hooks', 'getBirthdayEvents');
|
||||
OC_HOOK::connect('OC_Calendar', 'getSources', 'OC_Contacts_Hooks', 'getCalenderSources');
|
||||
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'deleteUser');
|
||||
OCP\Util::connectHook('OC_Calendar', 'getEvents', 'OC_Contacts_Hooks', 'getBirthdayEvents');
|
||||
OCP\Util::connectHook('OC_Calendar', 'getSources', 'OC_Contacts_Hooks', 'getCalenderSources');
|
||||
|
||||
OCP\App::register( array(
|
||||
'order' => 10,
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
|
||||
OC::$CLASSPATH['OC_Filestorage_Archive']='apps/files_archive/lib/storage.php';
|
||||
|
||||
OC_Hook::connect('OC_Filesystem','get_mountpoint','OC_Filestorage_Archive','autoMount');
|
||||
OCP\Util::connectHook('OC_Filesystem','get_mountpoint','OC_Filestorage_Archive','autoMount');
|
||||
|
||||
OCP\Util::addscript( 'files_archive', 'archive' );
|
||||
|
|
|
@ -6,7 +6,7 @@ OC::$CLASSPATH['OC_FileProxy_Encryption'] = 'apps/files_encryption/lib/proxy.php
|
|||
|
||||
OC_FileProxy::register(new OC_FileProxy_Encryption());
|
||||
|
||||
OC_Hook::connect('OC_User','post_login','OC_Crypt','loginListener');
|
||||
OCP\Util::connectHook('OC_User','post_login','OC_Crypt','loginListener');
|
||||
|
||||
stream_wrapper_register('crypt','OC_CryptStream');
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ require_once('apps/files_sharing/sharedstorage.php');
|
|||
|
||||
OC::$CLASSPATH['OC_Share'] = "apps/files_sharing/lib_share.php";
|
||||
OCP\App::registerAdmin('files_sharing', 'settings');
|
||||
OC_Hook::connect("OC_Filesystem", "post_delete", "OC_Share", "deleteItem");
|
||||
OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Share", "renameItem");
|
||||
OC_Hook::connect("OC_Filesystem", "post_write", "OC_Share", "updateItem");
|
||||
OC_Hook::connect('OC_User', 'post_deleteUser', 'OC_Share', 'removeUser');
|
||||
OC_Hook::connect('OC_User', 'post_addToGroup', 'OC_Share', 'addToGroupShare');
|
||||
OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OC_Share', 'removeFromGroupShare');
|
||||
OCP\Util::connectHook("OC_Filesystem", "post_delete", "OC_Share", "deleteItem");
|
||||
OCP\Util::connectHook("OC_Filesystem", "post_rename", "OC_Share", "renameItem");
|
||||
OCP\Util::connectHook("OC_Filesystem", "post_write", "OC_Share", "updateItem");
|
||||
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Share', 'removeUser');
|
||||
OCP\Util::connectHook('OC_User', 'post_addToGroup', 'OC_Share', 'addToGroupShare');
|
||||
OCP\Util::connectHook('OC_User', 'post_removeFromGroup', 'OC_Share', 'removeFromGroupShare');
|
||||
$dir = isset($_GET['dir']) ? $_GET['dir'] : '/';
|
||||
if ($dir != '/Shared' || OCP\Config::getAppValue('files_sharing', 'resharing', 'yes') == 'yes') {
|
||||
OCP\Util::addscript("files_sharing", "share");
|
||||
|
|
|
@ -410,7 +410,7 @@ class OC_Share {
|
|||
$source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']);
|
||||
if ($target = self::getTarget($source)) {
|
||||
// Forward hook to notify of changes to target file
|
||||
OC_Hook::emit("OC_Filesystem", "post_delete", array('path' => $target));
|
||||
OCP\Util::emitHook("OC_Filesystem", "post_delete", array('path' => $target));
|
||||
$query = OCP\DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?");
|
||||
$query->execute(array(strlen($source), $source, OCP\USER::getUser()));
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ class OC_Share {
|
|||
$source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']);
|
||||
if ($target = self::getTarget($source)) {
|
||||
// Forward hook to notify of changes to target file
|
||||
OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target));
|
||||
OCP\Util::emitHook("OC_Filesystem", "post_write", array('path' => $target));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ OCP\App::registerAdmin('files_versions', 'settings');
|
|||
OCP\Util::addscript('files_versions', 'versions');
|
||||
|
||||
// Listen to write signals
|
||||
OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OCA_Versions\Storage", "write_hook");
|
||||
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OCA_Versions\Storage", "write_hook");
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OC_Gallery_Hooks_Handlers", "addPhotoFromPath");
|
||||
OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, "OC_Gallery_Hooks_Handlers", "removePhoto");
|
||||
//OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, "OC_Gallery_Hooks_Handlers", "renamePhoto");
|
||||
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OC_Gallery_Hooks_Handlers", "addPhotoFromPath");
|
||||
OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, "OC_Gallery_Hooks_Handlers", "removePhoto");
|
||||
//OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, "OC_Gallery_Hooks_Handlers", "renamePhoto");
|
||||
|
||||
require_once(OC::$CLASSPATH['OC_Gallery_Album']);
|
||||
require_once(OC::$CLASSPATH['OC_Gallery_Photo']);
|
||||
|
|
|
@ -22,16 +22,16 @@
|
|||
*/
|
||||
|
||||
//we need to have the sha256 hash of passwords for ampache
|
||||
OC_Hook::connect('OC_User','post_login','OC_MEDIA','loginListener');
|
||||
OCP\Util::connectHook('OC_User','post_login','OC_MEDIA','loginListener');
|
||||
|
||||
//connect to the filesystem for auto updating
|
||||
OC_Hook::connect('OC_Filesystem','post_write','OC_MEDIA','updateFile');
|
||||
OCP\Util::connectHook('OC_Filesystem','post_write','OC_MEDIA','updateFile');
|
||||
|
||||
//listen for file deletions to clean the database if a song is deleted
|
||||
OC_Hook::connect('OC_Filesystem','post_delete','OC_MEDIA','deleteFile');
|
||||
OCP\Util::connectHook('OC_Filesystem','post_delete','OC_MEDIA','deleteFile');
|
||||
|
||||
//list for file moves to update the database
|
||||
OC_Hook::connect('OC_Filesystem','post_rename','OC_MEDIA','moveFile');
|
||||
OCP\Util::connectHook('OC_Filesystem','post_rename','OC_MEDIA','moveFile');
|
||||
|
||||
class OC_MEDIA{
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Public interface of ownCloud for apps to use.
|
||||
* Template Class
|
||||
*
|
||||
*/
|
||||
|
||||
// use OCP namespace for all classes that are considered public.
|
||||
// This means that they should be used by apps instead of the internal ownCloud classes
|
||||
namespace OCP;
|
||||
|
||||
|
||||
/**
|
||||
* @brief make OC_Helper::imagePath available as a simple function
|
||||
* @param $app app
|
||||
* @param $image image
|
||||
* @returns link to the image
|
||||
*
|
||||
* For further information have a look at OC_Helper::imagePath
|
||||
*/
|
||||
function image_path( $app, $image ){
|
||||
return(image_path( $app, $image ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Template extends OC_Template {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -191,8 +191,37 @@ class Util {
|
|||
return(\OC_Helper::computerFileSize( $str ));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief connects a function to a hook
|
||||
* @param $signalclass class name of emitter
|
||||
* @param $signalname name of signal
|
||||
* @param $slotclass class name of slot
|
||||
* @param $slotname name of slot
|
||||
* @returns true/false
|
||||
*
|
||||
* This function makes it very easy to connect to use hooks.
|
||||
*
|
||||
* TODO: write example
|
||||
*/
|
||||
static public function connectHook( $signalclass, $signalname, $slotclass, $slotname ){
|
||||
return(\OC_Hook::connect( $signalclass, $signalname, $slotclass, $slotname ));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief emitts a signal
|
||||
* @param $signalclass class name of emitter
|
||||
* @param $signalname name of signal
|
||||
* @param $params defautl: array() array with additional data
|
||||
* @returns true if slots exists or false if not
|
||||
*
|
||||
* Emits a signal. To get data from the slot use references!
|
||||
*
|
||||
* TODO: write example
|
||||
*/
|
||||
static public function emitHook( $signalclass, $signalname, $params = array()){
|
||||
return(\OC_Hook::emit( $signalclass, $signalname, $params ));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue