Commit eaf3ec27 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '636-metager3-blade-dateien-ordnen-loschen-zusammenfassen' into 'MetaGer-Redesign'

Resolve "metager3 blade dateien ordnen/löschen/zusammenfassen"

See merge request !1191
parents 2d8e311a 4029df8f
......@@ -88,7 +88,7 @@ class MetaGer
}
# Erstellt aus den gesammelten Ergebnissen den View
public function createView($quicktipResults = NULL)
public function createView($quicktipResults = null)
{
# Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können
$focusPages = [];
......@@ -109,7 +109,7 @@ class MetaGer
if ($this->fokus === "bilder") {
switch ($this->out) {
case 'results':
return view('metager3bilderresults')
return view('resultpages.results_images')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
......@@ -119,7 +119,7 @@ class MetaGer
->with('metager', $this)
->with('browser', (new Agent())->browser());
default:
return view('metager3bilder')
return view('resultpages.resultpage_images')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
......@@ -132,7 +132,7 @@ class MetaGer
} else {
switch ($this->out) {
case 'results':
return view('metager3results')
return view('resultpages.results')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
......@@ -144,7 +144,7 @@ class MetaGer
->with('fokus', $this->fokus);
break;
case 'results-with-style':
return view('metager3')
return view('resultpages.resultpage')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
......@@ -157,7 +157,7 @@ class MetaGer
->with('fokus', $this->fokus);
break;
case 'rich':
return view('metager3rich')
return view('resultpages.metager3rich')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
......@@ -169,7 +169,7 @@ class MetaGer
->with('fokus', $this->fokus);
break;
case 'rss20':
return view('metager3resultsrss20')
return view('resultpages.metager3resultsrss20')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('apiAuthorized', $this->apiAuthorized)
......@@ -178,7 +178,7 @@ class MetaGer
->with('fokus', $this->fokus);
break;
case 'atom10':
return response()->view('metager3resultsatom10', ['results' => $viewResults,'eingabe' => $this->eingabe,'metager' => $this,'resultcount' => sizeof($viewResults)])
return response()->view('resultpages.metager3resultsatom10', ['results' => $viewResults, 'eingabe' => $this->eingabe, 'metager' => $this, 'resultcount' => sizeof($viewResults)])
->header('Content-Type', 'application/xml');
break;
case 'result-count':
......@@ -186,7 +186,7 @@ class MetaGer
return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2);
break;
default:
return view('metager3')
return view('resultpages.resultpage')
->with('eingabe', $this->eingabe)
->with('focusPages', $focusPages)
->with('mobile', $this->mobile)
......@@ -475,7 +475,8 @@ class MetaGer
}
}
public function createQuicktips() {
public function createQuicktips()
{
# Die quicktips werden als job erstellt und zur Abarbeitung freigegeben
$quicktips = new \App\Models\Quicktips\Quicktips($this->q, $this->lang, $this->getTime(), $this->getHashCode());
return $quicktips;
......@@ -501,7 +502,7 @@ class MetaGer
$isCustomSearch = $this->startsWith($this->fokus, 'focus_');
# Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt
if($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) {
if ($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) {
$isCustomSearch = false;
$this->fokus = 'web';
}
......@@ -1088,18 +1089,18 @@ class MetaGer
$this->q = $match[1] . $match[3];
}
# Overwrite Setting if it's submitted via Parameter
if($request->has('blacklist')){
if ($request->has('blacklist')) {
$this->hostBlacklist = [];
$blacklistString = trim($request->input('blacklist'));
if(strpos($blacklistString, ",") !== FALSE){
if (strpos($blacklistString, ",") !== false) {
$blacklistArray = explode(',', $blacklistString);
foreach($blacklistArray as $blacklistElement){
foreach ($blacklistArray as $blacklistElement) {
$blacklistElement = trim($blacklistElement);
if(strpos($blacklistElement, "*") !== 0){
if (strpos($blacklistElement, "*") !== 0) {
$this->hostBlacklist[] = $blacklistElement;
}
}
}else if(strpos($blacklistString, "*") !== 0){
} else if (strpos($blacklistString, "*") !== 0) {
$this->hostBlacklist[] = $blacklistString;
}
}
......@@ -1123,19 +1124,19 @@ class MetaGer
$this->q = $match[1] . $match[3];
}
# Overwrite Setting if it's submitted via Parameter
if($request->has('blacklist')){
if ($request->has('blacklist')) {
$this->domainBlacklist = [];
$blacklistString = trim($request->input('blacklist'));
if(strpos($blacklistString, ",") !== FALSE){
if (strpos($blacklistString, ",") !== false) {
$blacklistArray = explode(',', $blacklistString);
foreach($blacklistArray as $blacklistElement){
foreach ($blacklistArray as $blacklistElement) {
$blacklistElement = trim($blacklistElement);
if(strpos($blacklistElement, "*.") === 0){
$this->domainBlacklist[] = substr($blacklistElement, strpos($blacklistElement, "*.")+2);
if (strpos($blacklistElement, "*.") === 0) {
$this->domainBlacklist[] = substr($blacklistElement, strpos($blacklistElement, "*.") + 2);
}
}
}else if(strpos($blacklistString, "*.") === 0){
$this->domainBlacklist[] = substr($blacklistString, strpos($blacklistString, "*.")+2);
} else if (strpos($blacklistString, "*.") === 0) {
$this->domainBlacklist[] = substr($blacklistString, strpos($blacklistString, "*.") + 2);
}
}
// print the domain blacklist as a user warning
......@@ -1175,16 +1176,16 @@ class MetaGer
$this->q = $match[1] . $match[3];
}
# Overwrite Setting if submitted via Parameter
if($request->has('stop')){
if ($request->has('stop')) {
$this->stopWords = [];
$stop = trim($request->input('stop'));
if(strpos($stop, ',') !== FALSE){
if (strpos($stop, ',') !== false) {
$stopArray = explode(',', $stop);
foreach($stopArray as $stopElement){
foreach ($stopArray as $stopElement) {
$stopElement = trim($stopElement);
$this->stopWords[] = $stopElement;
}
}else{
} else {
$this->stopWords[] = $stop;
}
}
......@@ -1264,7 +1265,8 @@ class MetaGer
}
}
public function atLeastOneSearchengineSelected(Request $request) {
public function atLeastOneSearchengineSelected(Request $request)
{
foreach ($request->all() as $key => $value) {
if ($this->startsWith($key, 'engine')) {
return true;
......
@extends('layouts.resultPage')
@section('results')
{{-- Show all errors --}}
@if(sizeof($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
{{-- Show all warnings --}}
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
<main id="results">
{{-- Show initial ads --}}
@if($mobile)
@include('layouts.ad', ['ad' => $metager->popAd()])
@else
@for($i = 0; $i <= 2; $i++)
@include('layouts.ad', ['ad' => $metager->popAd()])
@endfor
@endif
{{-- Show map --}}
{{-- Create results and ongoing ads --}}
@foreach($metager->getResults() as $result)
@if($mobile)
@if($result->number % 4 === 0)
@include('layouts.ad', ['ad' => $metager->popAd()])
@endif
@else
@if($result->number % 7 === 0)
@include('layouts.ad', ['ad' => $metager->popAd()])
@endif
@endif
@include('layouts.result', ['result' => $result])
@endforeach
{{-- Show pagination --}}
<nav class="mg-pager" aria-label="...">
<div @if($metager->getPage() === 1) class="disabled" @endif>
<a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a>
</div>
<div @if($metager->nextSearchLink() === "#") class="disabled" @endif>
<a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a>
</div>
</nav>
</main>
@endsection
@extends('layouts.resultPage')
@section('results')
@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
<div id="container" class="image-container">
@foreach($metager->getResults() as $result)
<div class="item image-item">
<div class="img">
<a href="{{ $result->link }}" target="{{ $metager->getNewtab() }}"><img src="{{ $metager->getImageProxyLink($result->image) }}" width="150px" alt="" rel="noopener"/></a>
<span class="label label-default hostlabel">{!! $result->gefVon !!}</span>
</div>
</div>
@endforeach
</div>
<nav aria-label="...">
<ul class="pager">
<li @if($metager->getPage() === 1) class="disabled" @endif><a href="@if($metager->getPage() === 1) # @else javascript:history.back() @endif">{{ trans('results.zurueck') }}</a></li>
<li @if($metager->nextSearchLink() === "#") class="disabled" @endif><a href="{{ $metager->nextSearchLink() }}">{{ trans('results.weiter') }}</a></li>
</ul>
</nav>
@endsection
<?xmlversion = "1.0"encoding = "UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg="http://metager.de/opensearch/"
xmlns:ad="http://a9.com/-/opensearch/extensions/advertisement/1.0/">
<title>{!! htmlspecialchars($eingabe, ENT_XML1, 'UTF-8'); !!} - MetaGer</title>
<link href="{{ url()->full() }}"/>
<updated>{{ date('c') }}</updated>
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
<link rel="next" href="{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}" type="application/atom+xml"/>
<id>urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@foreach($metager->getResults() as $result)
@if($result->number % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@endif
<entry>
<title>{!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!}</title>
<link href="{!! htmlspecialchars($result->link, ENT_XML1, 'UTF-8'); !!}" />
<mg:anzeigeLink>{!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!}</mg:anzeigeLink>
<content type="text">
{!! htmlspecialchars($result->descr, ENT_XML1, 'UTF-8'); !!}
</content>
</entry>
@endforeach
</feed>
\ No newline at end of file
{{-- Show all errors --}}
@if(sizeof($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
\ No newline at end of file
{{-- Show pagination --}}
<nav class="mg-pager" aria-label="...">
<div @if($metager->getPage() === 1) class="disabled" @endif>
<a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a>
</div>
<div @if($metager->nextSearchLink() === "#") class="disabled" @endif>
<a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a>
</div>
</nav>
\ No newline at end of file
{{-- Show all warnings --}}
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
\ No newline at end of file
<?xmlversion = "1.0"encoding = "UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg="http://metager.de/opensearch/"
xmlns:ad="http://a9.com/-/opensearch/extensions/advertisement/1.0/">
<title>{!! htmlspecialchars($eingabe, ENT_XML1, 'UTF-8'); !!} - MetaGer</title>
<link href="{{ url()->full() }}"/>
<updated>{{ date('c') }}</updated>
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
<link rel="next" href="{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}" type="application/atom+xml"/>
<id>urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@foreach($metager->getResults() as $result)
@if($result->number % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@endif
<entry>
<title>{!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!}</title>
<link href="{!! htmlspecialchars($result->link, ENT_XML1, 'UTF-8'); !!}" />
<mg:anzeigeLink>{!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!}</mg:anzeigeLink>
<content type="text">
{!! htmlspecialchars($result->descr, ENT_XML1, 'UTF-8'); !!}
</content>
</entry>
@endforeach
</feed>
\ No newline at end of file
......@@ -8,7 +8,6 @@
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
<mg:nextSearchResults url="{{htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES)}}" />
@if($apiAuthorized)
@foreach($metager->getResults() as $result)
<item>
......
@extends('layouts.resultPage')
@section('results')
@include('resultpages.results')
@endsection
@extends('layouts.resultPage')
@section('results')
@include('resultpages.results_images')
@endsection
{{-- Show all errors --}}
@if(sizeof($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
{{-- Show all warnings --}}
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
@include('parts.errors')
@include('parts.warnings')
<div id="results">
@if($mobile)
@include('layouts.ad', ['ad' => $metager->popAd()])
......@@ -26,7 +8,6 @@
@include('layouts.ad', ['ad' => $metager->popAd()])
@endfor
@endif
{{-- Show map --}}
{{-- Create results and ongoing ads --}}
@foreach($metager->getResults() as $result)
@if($mobile)
......@@ -40,15 +21,7 @@
@endif
@include('layouts.result', ['result' => $result])
@endforeach
{{-- Show pagination --}}
<nav class="mg-pager" aria-label="...">
<div @if($metager->getPage() === 1) class="disabled" @endif>
<a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a>
</div>
<div @if($metager->nextSearchLink() === "#") class="disabled" @endif>
<a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a>
</div>
</nav>
@include('parts.pager')
</div>
@if( $metager->showQuicktips() )
<div id="quicktips"></div>
......
@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
@include('parts.errors')
@include('parts.warnings')
<div id="container" class="image-container">
@foreach($metager->getResults() as $result)
<div class="item image-item">
......@@ -26,9 +10,4 @@
</div>
@endforeach
</div>
<nav aria-label="...">
<ul class="pager">
<li @if($metager->getPage() === 1) class="disabled" @endif><a href="@if($metager->getPage() === 1) # @else javascript:history.back() @endif">{{ trans('results.zurueck') }}</a></li>
<li @if($metager->nextSearchLink() === "#") class="disabled" @endif><a href="{{ $metager->nextSearchLink() }}">{{ trans('results.weiter') }}</a></li>
</ul>
</nav>
@include('parts.pager')
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