Commit fed7821a authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '65-interface-fur-die-uni-mainz-bereitstellen' into 'master'

Suchinterface für die Uni-Mainz eingefügt

Closes #65

See merge request !69
parents 562fb3e1 1586d455
......@@ -6,6 +6,7 @@ use Jenssegers\Agent\Agent;
use App;
use Storage;
use Log;
use Config;
use App\lib\TextLanguageDetect\TextLanguageDetect;
use App\lib\TextLanguageDetect\LanguageDetect\TextLanguageDetectException;
use Illuminate\Pagination\LengthAwarePaginator;
......@@ -119,9 +120,18 @@ class MetaGer
->with('errors', $this->errors)
->with('metager', $this);
break;
default:
case 'results-with-style':
return view('metager3')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
->with('warnings', $this->warnings)
->with('errors', $this->errors)
->with('metager', $this)
->with('suspendheader', "yes");
break;
default:
return view('metager3')
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
->with('warnings', $this->warnings)
......@@ -217,6 +227,19 @@ class MetaGer
}
$this->results = $paginatedSearchResults;
if( isset($this->password) )
{
# Wir bieten einen bezahlten API-Zugriff an, bei dem dementsprechend die Werbung ausgeblendet wurde:
# Aktuell ist es nur die Uni-Mainz. Deshalb überprüfen wir auch nur diese.
$password = getenv('mainz');
$eingabe = $this->eingabe;
$password = md5($eingabe . $password);
if( $this->password === $password )
{
$this->ads = [];
}
}
}
public function createSearchEngines (Request $request)
......@@ -502,6 +525,13 @@ class MetaGer
{
$this->tab = "_blank";
}
if( $request->has('password') )
$this->password = $request->input('password');
if( $request->has('quicktips') )
$this->quicktips = false;
else
$this->quicktips = true;
$this->out = $request->input('out', "html");
if($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style")
$this->out = "html";
......@@ -517,6 +547,11 @@ class MetaGer
$this->q = $match[1] . $match[3];
$this->warnings[] = "Sie führen eine Sitesearch durch. Es werden nur Ergebnisse von der Seite: \"" . $this->site . "\" angezeigt.";
}
if( $request->has('site') )
{
$this->site = $request->input('site');
$this->warnings[] = "Sie führen eine Sitesearch durch. Es werden nur Ergebnisse von der Seite: \"" . $this->site . "\" angezeigt.";
}
# Wenn die Suchanfrage um das Schlüsselwort "-host:*" ergänzt ist, sollen bestimmte Hosts nicht eingeblendet werden
# Wir prüfen, ob das hier der Fall ist:
while(preg_match("/(.*)(^|\s)-host:(\S+)(.*)/si", $this->q, $match))
......@@ -765,4 +800,8 @@ class MetaGer
$link = action('Pictureproxy@get', $requestData);
return $link;
}
public function showQuicktips ()
{
return $this->quicktips;
}
}
\ No newline at end of file
<div class="content-wrapper">
<header id="research">
<nav>
<ul class="list-inline">
<li class="hidden-xs hidden-sm pull-left">
<div class="logo"><a href="/"><h1>MetaGer</h1></a>
</div>
</li>
<li class="visible-xs visible-sm pull-left">
<div class="logo"><a href="/"><h1>MG</h1></a>
</div>
</li>
<li class="pull-right">
<form method="get" accept-charset="UTF-8" class="form" id="submitForm">
<div class="input-group">
<input autocomplete="off" class="form-control" form="submitForm" id="eingabeTop" name="eingabe" placeholder="Suchbegriffe erweitern/verändern, oder völlig neue Suche:" tabindex="1" type="text" value="{{ $eingabe }}" />
<div class="input-group-addon">
<button type='submit' form="submitForm" id='search'><span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
@foreach( $metager->request->all() as $key => $value)
@if($key !== "eingabe" && $key !== "page")
<input type='hidden' name='{{ $key }}' value='{{ $value }}' form='submitForm' />
@endif
@endforeach
</form>
</li>
</ul>
</nav>
</header>
<ul class="nav nav-tabs" id="foki" role="tablist">
@if( $metager->getFokus() === "web" )
<li id="webTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="web" data-href="#web" href="#web">
<span class='glyphicon glyphicon-globe'></span>
<span class="hidden-xs">Web</span>
</a>
</li>
@else
<li data-loaded="0" id="webTabSelector" role="presentation">
<a aria-controls="web" data-href="{{ $metager->generateSearchLink('web') }}" href="{{ $metager->generateSearchLink('web') }}">
<span class='glyphicon glyphicon-globe'></span>
<span class="hidden-xs">Web</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "bilder" )
<li id="bilderTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="bilder" data-href="#bilder" href="#bilder">
<span class='glyphicon glyphicon-picture'></span>
<span class="hidden-xs">Bilder</span>
</a>
</li>
@else
<li data-loaded="0" id="bilderTabSelector" role="presentation">
<a aria-controls="bilder" data-href="{{ $metager->generateSearchLink('bilder') }}" href="{{ $metager->generateSearchLink('bilder') }}">
<span class='glyphicon glyphicon-picture'></span>
<span class="hidden-xs">Bilder</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "nachrichten" )
<li id="nachrichtenTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="nachrichten" data-href="#nachrichten" href="#nachrichten">
<span class='glyphicon glyphicon-bullhorn'></span>
<span class="hidden-xs">Nachrichten</span>
</a>
</li>
@else
<li data-loaded="0" id="nachrichtenTabSelector" role="presentation" >
<a aria-controls="nachrichten" data-href="{{ $metager->generateSearchLink('nachrichten') }}" href="{{ $metager->generateSearchLink('nachrichten') }}">
<span class='glyphicon glyphicon-bullhorn'></span>
<span class="hidden-xs">Nachrichten</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "wissenschaft" )
<li id="wissenschaftTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="wissenschaft" data-href="#wissenschaft" href="#wissenschaft">
<span class='glyphicon glyphicon-file'></span>
<span class="hidden-xs">Wissenschaft</span>
</a>
</li>
@else
<li data-loaded="0" id="wissenschaftTabSelector" role="presentation">
<a aria-controls="wissenschaft" data-href="{{ $metager->generateSearchLink('wissenschaft') }}" href="{{ $metager->generateSearchLink('wissenschaft') }}">
<span class='glyphicon glyphicon-file'></span>
<span class="hidden-xs">Wissenschaft</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "produktsuche" )
<li id="produktsucheTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="produktsuche" data-href="#produktsuche" href="#produktsuche">
<span class='glyphicon glyphicon-shopping-cart'></span>
<span class="hidden-xs">Produktsuche</span>
</a>
</li>
@else
<li data-loaded="0" id="produktsucheTabSelector" role="presentation" >
<a aria-controls="produktsuche" data-href="{{ $metager->generateSearchLink('produktsuche') }}" href="{{ $metager->generateSearchLink('produktsuche') }}">
<span class='glyphicon glyphicon-shopping-cart'></span>
<span class="hidden-xs">Produktsuche</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "angepasst" )
<li id="angepasstTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="angepasst" data-href="#angepasst" href="#angepasst">
<span class='glyphicon glyphicon-cog'></span>
<span class="hidden-xs">angepasst</span>
</a>
</li>
@endif
</ul>
<div class="tab-content container-fluid">
@if( sizeof($errors) > 0 )
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if( sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{{ $warning }}</li>
@endforeach
</ul>
</div>
@endif
@if( $metager->getFokus() === "web" )
<div role="tabpanel" class="tab-pane active" id="web">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="web">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "bilder" )
<div role="tabpanel" class="tab-pane active" id="bilder">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="bilder">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "nachrichten" )
<div role="tabpanel" class="tab-pane active" id="nachrichten">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="nachrichten">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "wissenschaft" )
<div role="tabpanel" class="tab-pane active" id="wissenschaft">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="wissenschaft">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "produktsuche" )
<div role="tabpanel" class="tab-pane active" id="produktsuche">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="produktsuche">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "angepasst" )
<div role="tabpanel" class="tab-pane active" id="angepasst">
<div class="row">
@yield('results')
</div>
</div>
@endif
</div>
</div>
\ No newline at end of file
......@@ -18,236 +18,32 @@
</head>
<body id="resultBody">
<div class="content-wrapper">
<header id="research">
<nav>
<ul class="list-inline">
<li class="hidden-xs hidden-sm pull-left">
<div class="logo"><a href="/"><h1>MetaGer</h1></a>
</div>
</li>
<li class="visible-xs visible-sm pull-left">
<div class="logo"><a href="/"><h1>MG</h1></a>
</div>
</li>
<li class="pull-right">
<form method="get" accept-charset="UTF-8" class="form" id="submitForm">
<div class="input-group">
<input autocomplete="off" class="form-control" form="submitForm" id="eingabeTop" name="eingabe" placeholder="Suchbegriffe erweitern/verändern, oder völlig neue Suche:" tabindex="1" type="text" value="{{ $eingabe }}" />
<div class="input-group-addon">
<button type='submit' form="submitForm" id='search'><span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
@foreach( $metager->request->all() as $key => $value)
@if($key !== "eingabe" && $key !== "page")
<input type='hidden' name='{{ $key }}' value='{{ $value }}' form='submitForm' />
@endif
@endforeach
</form>
</li>
</ul>
</nav>
</header>
<ul class="nav nav-tabs" id="foki" role="tablist">
@if( $metager->getFokus() === "web" )
<li id="webTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="web" data-href="#web" href="#web">
<span class='glyphicon glyphicon-globe'></span>
<span class="hidden-xs">Web</span>
</a>
</li>
@else
<li data-loaded="0" id="webTabSelector" role="presentation">
<a aria-controls="web" data-href="{{ $metager->generateSearchLink('web') }}" href="{{ $metager->generateSearchLink('web') }}">
<span class='glyphicon glyphicon-globe'></span>
<span class="hidden-xs">Web</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "bilder" )
<li id="bilderTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="bilder" data-href="#bilder" href="#bilder">
<span class='glyphicon glyphicon-picture'></span>
<span class="hidden-xs">Bilder</span>
</a>
</li>
@else
<li data-loaded="0" id="bilderTabSelector" role="presentation">
<a aria-controls="bilder" data-href="{{ $metager->generateSearchLink('bilder') }}" href="{{ $metager->generateSearchLink('bilder') }}">
<span class='glyphicon glyphicon-picture'></span>
<span class="hidden-xs">Bilder</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "nachrichten" )
<li id="nachrichtenTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="nachrichten" data-href="#nachrichten" href="#nachrichten">
<span class='glyphicon glyphicon-bullhorn'></span>
<span class="hidden-xs">Nachrichten</span>
</a>
</li>
@else
<li data-loaded="0" id="nachrichtenTabSelector" role="presentation" >
<a aria-controls="nachrichten" data-href="{{ $metager->generateSearchLink('nachrichten') }}" href="{{ $metager->generateSearchLink('nachrichten') }}">
<span class='glyphicon glyphicon-bullhorn'></span>
<span class="hidden-xs">Nachrichten</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "wissenschaft" )
<li id="wissenschaftTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="wissenschaft" data-href="#wissenschaft" href="#wissenschaft">
<span class='glyphicon glyphicon-file'></span>
<span class="hidden-xs">Wissenschaft</span>
</a>
</li>
@else
<li data-loaded="0" id="wissenschaftTabSelector" role="presentation">
<a aria-controls="wissenschaft" data-href="{{ $metager->generateSearchLink('wissenschaft') }}" href="{{ $metager->generateSearchLink('wissenschaft') }}">
<span class='glyphicon glyphicon-file'></span>
<span class="hidden-xs">Wissenschaft</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "produktsuche" )
<li id="produktsucheTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="produktsuche" data-href="#produktsuche" href="#produktsuche">
<span class='glyphicon glyphicon-shopping-cart'></span>
<span class="hidden-xs">Produktsuche</span>
</a>
</li>
@else
<li data-loaded="0" id="produktsucheTabSelector" role="presentation" >
<a aria-controls="produktsuche" data-href="{{ $metager->generateSearchLink('produktsuche') }}" href="{{ $metager->generateSearchLink('produktsuche') }}">
<span class='glyphicon glyphicon-shopping-cart'></span>
<span class="hidden-xs">Produktsuche</span>
</a>
</li>
@endif
@if( $metager->getFokus() === "angepasst" )
<li id="angepasstTabSelector" role="presentation" data-loaded="1" class="active">
<a aria-controls="angepasst" data-href="#angepasst" href="#angepasst">
<span class='glyphicon glyphicon-cog'></span>
<span class="hidden-xs">angepasst</span>
</a>
</li>
@endif
@if( isset($header) )
@include('layouts.researchandtabs')
@else
<div class="tab-content container-fluid">
@if( sizeof($errors) > 0 )
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
<div class="tab-content container-fluid">
@if( sizeof($errors) > 0 )
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if( sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{{ $warning }}</li>
@endforeach
</ul>
</div>
@endif
@if( $metager->getFokus() === "web" )
<div role="tabpanel" class="tab-pane active" id="web">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="web">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "bilder" )
<div role="tabpanel" class="tab-pane active" id="bilder">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="bilder">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "nachrichten" )
<div role="tabpanel" class="tab-pane active" id="nachrichten">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="nachrichten">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "wissenschaft" )
<div role="tabpanel" class="tab-pane active" id="wissenschaft">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="wissenschaft">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "produktsuche" )
<div role="tabpanel" class="tab-pane active" id="produktsuche">
<div class="row">
@yield('results')
</div>
</div>
@else
<div role="tabpanel" class="tab-pane" id="produktsuche">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
@if( $metager->getFokus() === "angepasst" )
<div role="tabpanel" class="tab-pane active" id="angepasst">
<div class="row">
@yield('results')
</div>
</div>
@endif
</div>
</div>
@endif
@if( sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{{ $warning }}</li>
@endforeach
</ul>
</div>
@endif
@yield('results')
</div>
@endif
<footer>
<ul class="list-unstyled list-inline footer">
......
......@@ -2,7 +2,11 @@
@section('results')
@if( $metager->showQuicktips() )
<div class="col-xs-12 col-md-8 resultContainer">
@else
<div class="col-xs-12 col-md-12 resultContainer">
@endif
{{-- 3-Mal Werbung --}}
@for($i = 0; $i <= 2; $i++)
@include('layouts.ad', ['ad' => $metager->popAd()])
......@@ -18,9 +22,11 @@
{!! $metager->getResults()->links() !!}
</nav>
</div>
@if( $metager->showQuicktips() )
<div class="hidden-xs col-md-4" id="quicktips">
<iframe class="col-mod-4 hidden-xs hidden-sm" src="/qt?q={{ $metager->getQ() }}&sprueche={{ $metager->getSprueche() }}"></iframe>
</div>
@endif
@endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment