Skip to content

Commit

Permalink
Merge pull request crocodic-studio#1383 from lucianobapo/5.4.0
Browse files Browse the repository at this point in the history
 Update on admin_template.blade.php
  • Loading branch information
fherryfherry authored Mar 12, 2019
2 parents 2741c3d + 6f15611 commit ea60d9b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 27 deletions.
35 changes: 21 additions & 14 deletions src/controllers/CBController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

error_reporting(E_ALL ^ E_NOTICE);


use CB;
use CRUDBooster;
use Illuminate\Support\Facades\App;
Expand Down Expand Up @@ -1151,7 +1152,11 @@ public function postAddSave()

// $this->arr[$this->primary_key] = $id = CRUDBooster::newId($this->table); //error on sql server
$lastInsertId = $id = DB::table($this->table)->insertGetId($this->arr);


//fix bug if primary key is uuid
if($this->arr[$this->primary_key]!=$id)
$id = $this->arr[$this->primary_key];

//Looping Data Input Again After Insert
foreach ($this->data_inputan as $ro) {
$name = $ro['name'];
Expand Down Expand Up @@ -1208,16 +1213,19 @@ public function postAddSave()
$getColName = Request::get($name.'-'.$columns[0]['name']);
$count_input_data = ($getColName)?(count($getColName) - 1):0;
$child_array = [];
$fk = $ro['foreign_key'];

for ($i = 0; $i <= $count_input_data; $i++) {
$fk = $ro['foreign_key'];
$column_data = [];
$column_data[$fk] = $id;
foreach ($columns as $col) {
$colname = $col['name'];
$column_data[$colname] = Request::get($name.'-'.$colname)[$i];
$colvalue = Request::get($name.'-'.$colname)[$i];
if(!empty($colvalue)) $column_data[$colname] = $colvalue;
}
if(!empty($column_data)){
$column_data[$fk] = $id;
$child_array[] = $column_data;
}
$child_array[] = $column_data;
}

$childtable = CRUDBooster::parseSqlTable($ro['table'])['table'];
Expand Down Expand Up @@ -1359,21 +1367,20 @@ public function postEditSave($id)
$childtablePK = CB::pk($childtable);

for ($i = 0; $i <= $count_input_data; $i++) {

$column_data = [];
$column_data[$childtablePK] = $lastId;
$column_data[$fk] = $id;
foreach ($columns as $col) {
$colname = $col['name'];
$column_data[$colname] = Request::get($name.'-'.$colname)[$i];
$colvalue = Request::get($name.'-'.$colname)[$i];
if(!empty($colvalue)) $column_data[$colname] = $colvalue;
}
if(!empty($column_data)){
$column_data[$childtablePK] = $lastId;
$column_data[$fk] = $id;
$child_array[] = $column_data;
$lastId++;
}
$child_array[] = $column_data;

$lastId++;
}

$child_array = array_reverse($child_array);

DB::table($childtable)->insert($child_array);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/controllers/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ public function getPreview($one, $two = null, $three = null, $four = null, $five
$fullStoragePath = storage_path('app/'.$fullFilePath);
$lifetime = 31556926; // One year in seconds

$handler = new \Symfony\Component\HttpFoundation\File\File(storage_path('app/'.$fullFilePath));


if (! Storage::exists($fullFilePath)) {
abort(404);
}

$handler = new \Symfony\Component\HttpFoundation\File\File(storage_path('app/'.$fullFilePath));

$extension = strtolower(File::extension($fullStoragePath));
$images_ext = config('crudbooster.IMAGE_EXTENSIONS', 'jpg,png,gif,bmp');
$images_ext = explode(',', $images_ext);
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/MenusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function format(icon) {
"name" => "name",
"type" => "text",
"required" => true,
"validation" => "required|min:3|max:255|alpha_num_spaces",
"validation" => "required|min:3|max:255",
"placeholder" => "You can only enter alphanumeric character and spaces only",
];
$this->form[] = [
Expand Down
20 changes: 11 additions & 9 deletions src/helpers/CRUDBooster.php
Original file line number Diff line number Diff line change
Expand Up @@ -1045,15 +1045,17 @@ public static function urlFilterColumn($key, $type, $value = '', $singleSorting

public static function insertLog($description, $details = '')
{
$a = [];
$a['created_at'] = date('Y-m-d H:i:s');
$a['ipaddress'] = $_SERVER['REMOTE_ADDR'];
$a['useragent'] = $_SERVER['HTTP_USER_AGENT'];
$a['url'] = Request::url();
$a['description'] = $description;
$a['details'] = $details;
$a['id_cms_users'] = self::myId();
DB::table('cms_logs')->insert($a);
if (CRUDBooster::getSetting('api_debug_mode')) {
$a = [];
$a['created_at'] = date('Y-m-d H:i:s');
$a['ipaddress'] = $_SERVER['REMOTE_ADDR'];
$a['useragent'] = $_SERVER['HTTP_USER_AGENT'];
$a['url'] = Request::url();
$a['description'] = $description;
$a['details'] = $details;
$a['id_cms_users'] = self::myId();
DB::table('cms_logs')->insert($a);
}
}

public static function referer()
Expand Down
2 changes: 1 addition & 1 deletion src/views/admin_template.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class="btn btn-sm btn-primary btn-import-data">
</ol>
@else
<h1>{{Session::get('appname')}}
<small>Information</small>
<small> {{ trans('crudbooster.text_dashboard') }} </small>
</h1>
@endif
</section>
Expand Down
16 changes: 15 additions & 1 deletion src/views/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@
<p class='login-box-msg'>{{trans("crudbooster.login_message")}}</p>
<form autocomplete='off' action="{{ route('postLogin') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>

@if(!empty(config('services.google')))

<div style="margin-bottom:10px" class='row'>
<div class='col-xs-12'>

<a href='{{route("redirect", 'google')}}' class="btn btn-primary btn-block btn-flat"><i class='fa fa-google'></i>
Google Login</a>

<hr>
</div>
</div>
@endif

<div class="form-group has-feedback">
<input autocomplete='off' type="text" class="form-control" name='email' required placeholder="Email"/>
<span class="glyphicon glyphicon-user form-control-feedback"></span>
Expand Down Expand Up @@ -110,4 +124,4 @@
<!-- Bootstrap 3.3.2 JS -->
<script src="{{asset('vendor/crudbooster/assets/adminlte/bootstrap/js/bootstrap.min.js')}}" type="text/javascript"></script>
</body>
</html>
</html>

0 comments on commit ea60d9b

Please sign in to comment.