Skip to content

Commit

Permalink
bugs on new user register and all fields sort problem.
Browse files Browse the repository at this point in the history
1. user instance has to be under app\user 's interface
2. because of the cache cause the sort problem
3. working on the multiple UI function.
  • Loading branch information
taoyu65 committed Aug 18, 2017
1 parent 7b5f909 commit 35a0980
Show file tree
Hide file tree
Showing 7,329 changed files with 721,762 additions and 563 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion src/Config/umi.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|
*/

'assets_path' => 'umi/lte',
'assets_path' => 'umi/ace',

/*
|--------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion src/Http/Controllers/dashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace YM\Http\Controllers;

use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use YM\Models\User;

class DashBoardController extends Controller
{
Expand All @@ -33,6 +33,11 @@ protected function create(array $data)
]);
}

public function redirectPath()
{
return route('dashboard');
}

public function index()
{
######################get IP Information##############################
Expand Down
8 changes: 7 additions & 1 deletion src/Models/UmiModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ public function getRecordsByFields($fields)
public function getRecordsByWhere($where, $value, $useCache = true)
{
if ($this->openCache && $useCache) {

if ($this->order === 'asc')
return $this->cachedTable
->where($where, $value)
->sortBy($this->orderBy);
return $this->cachedTable
->where($where, $value);
->where($where, $value)
->sortByDesc($this->orderBy);
}

$ds = DB::table($this->tableName)
Expand Down
60 changes: 43 additions & 17 deletions src/Umi/PageBuilder/umiDataTableBuilder_ACE.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,46 +181,47 @@ public function tableBody()
//$rules = $TRO->getRulesByNames(Ym::currentTableId(), false);
$rules = $TRO->getTableRelationOperationByTableId(Ym::currentTableId());
$activeFieldValueList = [];
if ($rules) {
foreach ($dataSet as $ds) {
$activeFieldValue = '';
foreach ($rules as $rule) {
$activeTableField = $rule->active_table_field;
$dsActField = $ds->$activeTableField;
$activeFieldValue .= "\"$activeTableField\":\"$dsActField\",";
}
#转换成对象类型
#turn into object
$activeFieldValue = $activeFieldValue == '' ? '' : "{" . trim($activeFieldValue,',') . "}";
array_push($activeFieldValueList, $activeFieldValue);
}
}
if ($rules)
$activeFieldValueList = $this->getActiveFieldValue($dataSet, $rules);

#是否开启 数据映射功能
#if available for data reformat
$regulatedDataSet = '';
if (Config::get('umi.data_field_reformat'))
$regulatedDataSet = $dataTypeOp->regulatedDataSet($dataSet);

#数据表内容
#table body
$trBodyHtml = '';
$regulatedDataSet = $regulatedDataSet ?: $dataSet;
if ($regulatedDataSet) {
$pointer = 0;
foreach ($regulatedDataSet as $ds) {
$trBodyHtml .= '<tr>';
$trBodyHtml .= $this->checkboxHtml();
foreach ($ds as $item => $value) {
//$trBodyHtml .= $this->checkboxHtml();
/*foreach ($ds as $item => $value) {
$trBodyHtml .= '<td>';
$trBodyHtml .= $value;
$trBodyHtml .= '</td>';
}*/
if (is_array($ds)) {
foreach ($tHeads as $tHead) {
$showField = $tHead->field;
$trBodyHtml .= "<td>{$ds[$showField]}</td>";
}
} else if (is_object($ds)) {
foreach ($tHeads as $tHead) {
$showField = $tHead->field;
$trBodyHtml .= "<td>{$ds->$showField}</td>";
}
}

#获取数据行的主键值
#get value of primary key of record
$primaryKey = Config::get('umi.primary_key');
$recordId = array_has($ds, $primaryKey) ? $dataSet->all()[$pointer]->$primaryKey : 0;

$activeFieldValue = $activeFieldValueList[$pointer];
$activeFieldValue = isset($activeFieldValueList[$pointer]) ? $activeFieldValueList[$pointer] : '';
$trBodyHtml .= $this->breadButtonHtml($recordId, $activeFieldValue); //获取按钮 get button
$trBodyHtml .= '</tr>';

Expand Down Expand Up @@ -311,6 +312,31 @@ private function getArgs($args)
return $arr;
}

private function getActiveFieldValue($dataSet, $rules)
{
$activeFieldValueList = [];
foreach ($dataSet as $ds) {
$activeFieldValue = '';
foreach ($rules as $rule) {
$activeTableField = $rule->active_table_field;
if (!isset($ds->$activeTableField)) {
Ym::showMessage('Warning', 'Detect the rule of relation operation somewhere is wrong for operating this table, Please correct or will not work', [
'class_name' => 'gritter-error',
'sticky' => true
], false);
return [];
}
$dsActField = $ds->$activeTableField;
$activeFieldValue .= "\"$activeTableField\":\"$dsActField\",";
}
#转换成对象类型
#turn into object
$activeFieldValue = $activeFieldValue == '' ? '' : "{" . trim($activeFieldValue,',') . "}";
array_push($activeFieldValueList, $activeFieldValue);
}
return $activeFieldValueList;
}

#region component
private function checkboxHtml()
{
Expand Down
87 changes: 55 additions & 32 deletions src/Umi/PageBuilder/umiDataTableBuilder_LTE.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ public function tableHeadSuperAdmin()
return $html;
}

/**
* @return string
*/
public function tableBody()
{
#是否有权限浏览表格数据
Expand Down Expand Up @@ -184,46 +181,47 @@ public function tableBody()
//$rules = $TRO->getRulesByNames(Ym::currentTableId(), false);
$rules = $TRO->getTableRelationOperationByTableId(Ym::currentTableId());
$activeFieldValueList = [];
if ($rules) {
foreach ($dataSet as $ds) {
$activeFieldValue = '';
foreach ($rules as $rule) {
$activeTableField = $rule->active_table_field;
$dsActField = $ds->$activeTableField;
$activeFieldValue .= "\"$activeTableField\":\"$dsActField\",";
}
#转换成对象类型
#turn into object
$activeFieldValue = $activeFieldValue == '' ? '' : "{" . trim($activeFieldValue,',') . "}";
array_push($activeFieldValueList, $activeFieldValue);
}
}
if ($rules)
$activeFieldValueList = $this->getActiveFieldValue($dataSet, $rules);

#是否开启 数据映射功能
#if available for data reformat
$regulatedDataSet = '';
if (Config::get('umi.data_field_reformat'))
$regulatedDataSet = $dataTypeOp->regulatedDataSet($dataSet);

#数据表内容
#table body
$trBodyHtml = '';
$regulatedDataSet = $regulatedDataSet ?: $dataSet;
if ($regulatedDataSet) {
$pointer = 0;
foreach ($regulatedDataSet as $ds) {
$trBodyHtml .= '<tr>';
$trBodyHtml .= $this->checkboxHtml();
foreach ($ds as $item => $value) {
//$trBodyHtml .= $this->checkboxHtml();
/*foreach ($ds as $item => $value) {
$trBodyHtml .= '<td>';
$trBodyHtml .= $value;
$trBodyHtml .= '</td>';
}*/
if (is_array($ds)) {
foreach ($tHeads as $tHead) {
$showField = $tHead->field;
$trBodyHtml .= "<td>{$ds[$showField]}</td>";
}
} else if (is_object($ds)) {
foreach ($tHeads as $tHead) {
$showField = $tHead->field;
$trBodyHtml .= "<td>{$ds->$showField}</td>";
}
}

#获取数据行的主键值
#get value of primary key of record
$primaryKey = Config::get('umi.primary_key');
$recordId = array_has($ds, $primaryKey) ? $dataSet->all()[$pointer]->$primaryKey : 0;

$activeFieldValue = $activeFieldValueList[$pointer];
$activeFieldValue = isset($activeFieldValueList[$pointer]) ? $activeFieldValueList[$pointer] : '';
$trBodyHtml .= $this->breadButtonHtml($recordId, $activeFieldValue); //获取按钮 get button
$trBodyHtml .= '</tr>';

Expand Down Expand Up @@ -258,18 +256,6 @@ public function tableBody()
return $html;
}

public function getWhere()
{
if (\Request::isMethod('post')) {
#获取search_tab_id #get search_tab_id
if (isset($_REQUEST['std'])) {
$search = new Search();
$searchList = $search->getSearchByTabId($_REQUEST['std'])->all();
return $searchList;
}
}
}

public function tableFoot()
{
$html = <<< UMI
Expand All @@ -296,6 +282,18 @@ public function tableFoot()
return $html;
}

private function getWhere()
{
if (\Request::isMethod('post')) {
#获取search_tab_id #get search_tab_id
if (isset($_REQUEST['std'])) {
$search = new Search();
$searchList = $search->getSearchByTabId($_REQUEST['std'])->all();
return $searchList;
}
}
}

/**
* @param $args - 获取url参数, 可以指定键值数组 get url args, can be array of key like ['id','key','search']
* @return array - 参数的键值 the key
Expand All @@ -314,6 +312,31 @@ private function getArgs($args)
return $arr;
}

private function getActiveFieldValue($dataSet, $rules)
{
$activeFieldValueList = [];
foreach ($dataSet as $ds) {
$activeFieldValue = '';
foreach ($rules as $rule) {
$activeTableField = $rule->active_table_field;
if (!isset($ds->$activeTableField)) {
Ym::showMessage('Warning', 'Detect the rule of relation operation somewhere is wrong for operating this table, Please correct or will not work', [
'class_name' => 'gritter-error',
'sticky' => true
]);
return [];
}
$dsActField = $ds->$activeTableField;
$activeFieldValue .= "\"$activeTableField\":\"$dsActField\",";
}
#转换成对象类型
#turn into object
$activeFieldValue = $activeFieldValue == '' ? '' : "{" . trim($activeFieldValue,',') . "}";
array_push($activeFieldValueList, $activeFieldValue);
}
return $activeFieldValueList;
}

#region component
private function checkboxHtml()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Umi/Umi.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getTableIdByTableName($tableName)
return $this->table->getTableId($tableName);
}

public function showMessage($title, $content = '', $options = [])
public function showMessage($title, $content = '', $options = [], $multiple = true)
{
#设置默认的样式为深绿色的界面 gritter-success
#set default style as a gritter-success
Expand All @@ -72,7 +72,7 @@ public function showMessage($title, $content = '', $options = [])
});
</script>
UMI;
if (Session::has('showMessage'))
if (Session::has('showMessage') && $multiple)
$html .= Session::get('showMessage');

Session::flash('showMessage', $html);
Expand Down
11 changes: 11 additions & 0 deletions src/resources/assets/lte/js/jquery.gritter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/resources/assets/lte/lte/bower_components/Flot/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Flot",
"version": "0.8.3",
"main": "jquery.flot.js",
"dependencies": {
"jquery": ">= 1.2.6"
},
"homepage": "https://github.com/flot/flot",
"_release": "0.8.3",
"_resolution": {
"type": "version",
"tag": "v0.8.3",
"commit": "453b017cc5acfd75e252b93e8635f57f4196d45d"
},
"_source": "https://github.com/flot/flot.git",
"_target": "^0.8.3",
"_originalSource": "flot",
"_direct": true
}
3 changes: 3 additions & 0 deletions src/resources/assets/lte/lte/bower_components/Flot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.min.js
!excanvas.min.js
node_modules/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.8
Loading

0 comments on commit 35a0980

Please sign in to comment.