File modules/cms/action/search/SearchEditAction.class.php

Last commit: Wed Mar 9 13:28:52 2022 +0100	dankert	Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()'
1 <?php 2 namespace cms\action\search; 3 use cms\action\Method; 4 use cms\action\SearchAction; 5 use cms\base\Configuration; 6 use cms\model\User; 7 use util\Session; 8 9 class SearchEditAction extends SearchAction implements Method { 10 11 public function view() { 12 13 $searchConfig = Configuration::subset('search')->subset('quicksearch'); 14 $flag = $searchConfig->subset('flag'); 15 16 $initial = ! $this->request->isTrue('repeat'); 17 18 if ( $initial ) { 19 $searchById = $flag->is('id' ); 20 $searchByName = $flag->is('name' ); 21 $searchByFilename = $flag->is('filename' ); 22 $searchByDesc = $flag->is('description'); 23 $searchByContent = $flag->is('content' ); 24 } else { 25 $searchById = $this->request->isTrue('oid' ); 26 $searchByName = $this->request->isTrue('name' ); 27 $searchByFilename = $this->request->isTrue('filename' ); 28 $searchByDesc = $this->request->isTrue('description'); 29 $searchByContent = $this->request->isTrue('content' ); 30 } 31 32 $this->setTemplateVar('oid' ,$searchById ); 33 $this->setTemplateVar('name' ,$searchByName ); 34 $this->setTemplateVar('filename' ,$searchByFilename ); 35 $this->setTemplateVar('description',$searchByDesc ); 36 $this->setTemplateVar('content' ,$searchByContent ); 37 38 $suchText = $this->request->getText('text'); 39 $this->setTemplateVar('text',$suchText); 40 41 $searchFlags = 0; 42 43 // Always search for the id without a max length 44 if ( strlen($suchText) >= $searchConfig->get('maxlength',3 ) ) { 45 if ($searchById ) $searchFlags |= self::FLAG_ID; 46 if ($searchByFilename) $searchFlags |= self::FLAG_FILENAME; 47 if ($searchByName ) $searchFlags |= self::FLAG_NAME; 48 if ($searchByDesc ) $searchFlags |= self::FLAG_DESCRIPTION; 49 if ($searchByContent ) $searchFlags |= self::FLAG_VALUE; 50 51 } 52 53 $this->performSearch($suchText, $searchFlags); 54 } 55 56 57 public function post() { 58 } 59 }
Download modules/cms/action/search/SearchEditAction.class.php
History Wed, 9 Mar 2022 13:28:52 +0100 dankert Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()' Tue, 7 Dec 2021 00:16:02 +0100 dankert New: Enter in Search field will open a dialog for the view. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.