*/ /** * This view lets you make very simple callbacks to the framework to * get very specific data. Eventually this will probably get refactored * into a much more sophisticated framework. * * @package GalleryCore * @subpackage UserInterface */ class SimpleCallbackView extends GalleryView { /** * @see GalleryView::isImmediate() */ function isImmediate() { return true; } /** * @see GalleryView::isImmediate() */ function renderImmediate($status, $error) { global $gallery; $command = GalleryUtilities::getRequestVariables('command'); list ($ret, $anonymousUserId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.anonymousUser'); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } header("Content-type: text/plain"); switch($command) { case "lookupUsername": if ($gallery->getActiveUserId() != $anonymousUserId) { $prefix = GalleryUtilities::getRequestVariables('prefix'); list ($ret, $usernames) = GalleryCoreApi::fetchUsernames(10, null, $prefix); if ($ret->isSuccess()) { print join("\n", $usernames); } } break; case "lookupGroupname": if ($gallery->getActiveUserId() != $anonymousUserId) { $prefix = GalleryUtilities::getRequestVariables('prefix'); list ($ret, $usernames) = GalleryCoreApi::fetchGroupNames(10, null, $prefix); if ($ret->isSuccess()) { print join("\n", $usernames); } } break; } return GalleryStatus::success(); } } ?>