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(
'id' => 'radio',
'order' => 74,

View File

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

View File

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

View File

@ -5,6 +5,10 @@ $(window).on('load', function(){
play_station(stationid);
});
function station_fav(stationid){
alert("faving");
};
function play_station(stationid){
$.ajax({
method: "GET",
@ -23,7 +27,7 @@ $(window).on('load', function(){
$.each(data, function(i, station) {
$('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\
<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="hidden-visually">Favorite</span>\
</a>\
@ -39,7 +43,7 @@ $(window).on('load', function(){
}
function get_station_ids(){
return ["89920","44707"]
return ["89920","44707","91101","85755","45281","78011","91102"]
};
function render_stations(station_ids){
@ -114,5 +118,15 @@ $(window).on('load', function(){
switch_menu(2);
});
function mySearch(query){
alert('test');
};
OC.Plugins.register('OCA.Search', {
attach: function(search) {
search.setFilter('radio', mySearch);
}
});
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,16 +24,10 @@
</li>
</ul>
<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>
<form id="radiosearch" action="javascript:void(0);">
<input id="radioquery" placeholder="Search for name" autofocus required></input>
</form>
</div>
<audio id="player" src="" controls></audio>
<form id="radiosearch" action="javascript:void(0);">
<input id="radioquery" placeholder="Search for name" autofocus required></input>
</form>
</div>
</div>
<div id="app-content">

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>