implementing searchprovider

This commit is contained in:
Jonas Heinrich 2017-01-09 14:36:07 +01:00
parent 1253c560f3
commit be3953d06f
7 changed files with 20 additions and 37 deletions

View File

@ -23,8 +23,6 @@
* *
*/ */
OCP\App::registerAdmin( 'radio', 'settings' );
OCP\App::addNavigationEntry( array( OCP\App::addNavigationEntry( array(
'id' => 'radio', 'id' => 'radio',
'order' => 74, 'order' => 74,

View File

@ -8,8 +8,6 @@
/** @var $this \OCP\Route\IRouter */ /** @var $this \OCP\Route\IRouter */
$this->create('radio_index', '/') $this->create('radio_index', '/')
->actionInclude('radio/index.php'); ->actionInclude('radio/index.php');
$this->create('radio_ajax_seturl', 'ajax/seturl.php')
->actionInclude('radio/ajax/seturl.php');
return [ return [
'resources' => [ 'resources' => [

View File

@ -26,8 +26,6 @@
// Check if we are a user // Check if we are a user
OCP\User::checkLoggedIn(); OCP\User::checkLoggedIn();
$somesetting = OCP\Config::getSystemValue( "somesetting", '' );
OCP\App::setActiveNavigationEntry( 'radio' ); OCP\App::setActiveNavigationEntry( 'radio' );
$tmpl = new OCP\Template( 'radio', 'main', 'user' ); $tmpl = new OCP\Template( 'radio', 'main', 'user' );
$tmpl->assign( 'somesetting', $somesetting );
$tmpl->printPage(); $tmpl->printPage();

View File

@ -5,6 +5,10 @@ $(window).on('load', function(){
play_station(stationid); play_station(stationid);
}); });
function station_fav(stationid){
alert("faving");
};
function play_station(stationid){ function play_station(stationid){
$.ajax({ $.ajax({
method: "GET", method: "GET",
@ -23,7 +27,7 @@ $(window).on('load', function(){
$.each(data, function(i, station) { $.each(data, function(i, station) {
$('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\ $('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\
<td class="filename">\ <td class="filename">\
<a href="#" class="action action-favorite" data-original-title="" title="">\ <a href="#" class="action action-favorite" onclick="station_fav();">\
<span class="icon icon-star"></span>\ <span class="icon icon-star"></span>\
<span class="hidden-visually">Favorite</span>\ <span class="hidden-visually">Favorite</span>\
</a>\ </a>\
@ -39,7 +43,7 @@ $(window).on('load', function(){
} }
function get_station_ids(){ function get_station_ids(){
return ["89920","44707"] return ["89920","44707","91101","85755","45281","78011","91102"]
}; };
function render_stations(station_ids){ function render_stations(station_ids){
@ -114,5 +118,15 @@ $(window).on('load', function(){
switch_menu(2); switch_menu(2);
}); });
function mySearch(query){
alert('test');
};
OC.Plugins.register('OCA.Search', {
attach: function(search) {
search.setFilter('radio', mySearch);
}
});
switch_menu(0); switch_menu(0);
}); });

View File

@ -1,11 +0,0 @@
<?php
OCP\User::checkAdminUser();
OCP\Util::addScript( "radio", "admin" );
$tmpl = new OCP\Template( 'radio', 'settings');
$tmpl->assign('url', OCP\Config::getSystemValue( "somesetting", '' ));
return $tmpl->fetchPage();

View File

@ -24,18 +24,12 @@
</li> </li>
</ul> </ul>
<div id="app-settings"> <div id="app-settings">
<div id="app-settings-header">
<button class="settings-button" data-apps-slide-toggle="#app-settings-content">
Settings </button>
</div>
<div id="app-settings-content">
<audio id="player" src="" controls></audio> <audio id="player" src="" controls></audio>
<form id="radiosearch" action="javascript:void(0);"> <form id="radiosearch" action="javascript:void(0);">
<input id="radioquery" placeholder="Search for name" autofocus required></input> <input id="radioquery" placeholder="Search for name" autofocus required></input>
</form> </form>
</div> </div>
</div> </div>
</div>
<div id="app-content"> <div id="app-content">
<div id="app-content-files" class="viewcontainer"> <div id="app-content-files" class="viewcontainer">
<table id="filestable" data-preview-x="32" data-preview-y="32"> <table id="filestable" data-preview-x="32" data-preview-y="32">

View File

@ -1,8 +0,0 @@
<form id="radio">
<div class="section">
<h2><?php p($l->t('App Template'));?></h2>
<input type="text" name="somesetting" id="somesetting" value="<?php p($_['url']); ?>" placeholder="<?php p($l->t('Some Setting'));?>" />
<br />
<span class="msg"></span>
</div>
</form>