From 6da31c02b65174e01967629c65c0d449cce59879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=8A=BC?= Date: Wed, 26 Nov 2014 11:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7edit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publisher/app/controllers/UsersController.php | 19 +++--- publisher/app/views/users/edit.blade.php | 61 +++++++++++++++++ publisher/app/views/users/pwd.blade.php | 66 +++++++++++++++++++ 3 files changed, 136 insertions(+), 10 deletions(-) diff --git a/publisher/app/controllers/UsersController.php b/publisher/app/controllers/UsersController.php index 26c02a5..fda092c 100644 --- a/publisher/app/controllers/UsersController.php +++ b/publisher/app/controllers/UsersController.php @@ -29,7 +29,7 @@ public function edit() { $username = trim(Input::get('username')); $password = trim(Input::get('password')); - $is_superadmin = trim(Input::get('is_superadmin')); + $is_superadmin = intval(Input::get('is_superadmin')); $project_ids = Input::get('project'); if($user) { @@ -57,18 +57,17 @@ public function edit() $user->username = $username; $user->password = Hash::make($password); } + $user->is_superadmin = $is_superadmin; $user->save(); - //处理传过来的项目id数组 - return Redirect::route('users/index'); + //如果不是超级管理员,处理传过来的项目id数组 + if(!$user->is_superadmin) + { + + } + return Redirect::to('/users/index'); } } - //当前用户拥有的所有项目 - $projects = Project::whereIn('id',Auth::user()->pj_ids())->get(); - $prj_list = array(); - foreach ($projects as $value) { - $prj_list[$value->id] = $value->title; - } - return View::make('users/edit',array('user'=>$user,'error' => $error)); + return View::make('users/edit',array('user'=>$user,'error' => $error,'projects'=>Project::all())); } //改密码 diff --git a/publisher/app/views/users/edit.blade.php b/publisher/app/views/users/edit.blade.php index e69de29..c2d36ab 100644 --- a/publisher/app/views/users/edit.blade.php +++ b/publisher/app/views/users/edit.blade.php @@ -0,0 +1,61 @@ +@extends('layouts.master') +@section('title') + 编辑用户-username; ?> 新增用户- @parent @stop +@section('sidebar') + @include('sidebar', array('currpage'=>'users')) +@stop +@section('content') + +{{ Form::model($user, array('url' => '/users/edit' ,'class' => 'uk-form uk-form-horizontal' )) }} +
+ +
id;?>id);?>
+
+
+ {{ Form::label('username','用户名',array('class' => 'uk-form-label')) }} +
+ {{ $user->username }} +
+
+ +{{ Form::open(array('url' => '/users/add' ,'class' => 'uk-form uk-form-horizontal' )) }} +
+ {{ Form::label('username','用户名',array('class' => 'uk-form-label')) }} +
+ {{ Form::text('username') }} +
+
+ +
+ {{ Form::label('password','密码',array('class' => 'uk-form-label')) }} +
+ {{ Form::password('password') }} +
+
+
+ {{ Form::label('is_superadmin','超级管理员',array('class' => 'uk-form-label')) }} +
+ {{ Form::checkbox('is_superadmin','1',($user && $user->is_superadmin)) }} +
+
+
+ {{ Form::label('','项目',array('class' => 'uk-form-label')) }} +
+
    + +
  • + {{ Form::checkbox('project[]',$_row->id,($user && in_array($_row->id,$user->pj_ids()))) }} {{ $_row->title }} +
  • + + +
+
+
+ +
{{ $error }}
+ +
+ {{ Form::submit('提交',array('class'=>'uk-button uk-button-primary')) }} +
+{{ Form::close() }} +@stop \ No newline at end of file diff --git a/publisher/app/views/users/pwd.blade.php b/publisher/app/views/users/pwd.blade.php index e69de29..b72786c 100644 --- a/publisher/app/views/users/pwd.blade.php +++ b/publisher/app/views/users/pwd.blade.php @@ -0,0 +1,66 @@ +@extends('layouts.master') +@section('title') + 编辑项目-title; ?> 新增项目- @parent @stop +@section('sidebar') + @include('sidebar', array('currpage'=>'users')) +@stop +@section('content') +{{ Form::open(array('url' => '/users/password' ,'class' => 'uk-form uk-form-horizontal' )) }} +
+ {{ Form::label('title','项目名',array('class' => 'uk-form-label')) }} +
+ {{ Form::text('title') }} +
+
+
+ {{ Form::label('manager','项目管理员',array('class' => 'uk-form-label')) }} +
+ {{ Form::text('manager') }} +
+
+
+ {{ Form::label('vcs_type','版本管理工具',array('class' => 'uk-form-label')) }} +
+ {{ Form::select('vcs_type',Project::$vcs_types) }} +
+
+
+ {{ Form::label('src_addr','源码地址',array('class' => 'uk-form-label')) }} +
+ {{ Form::text('src_addr',null,array('class'=>'uk-form-width-large')) }} +
+
+
+ {{ Form::label('username','账号密码',array('class' => 'uk-form-label')) }} +
+ {{ Form::text('username') }} {{ Form::text('password') }} +
+
+ +
+ {{ Form::label('current_version','当前版本',array('class' => 'uk-form-label')) }} +
+ {{ $project->current_version }} +
+
+ +
+ {{ Form::label('ignore_files','同步时忽略',array('class' => 'uk-form-label')) }} +
+ {{ Form::textarea('ignore_files',null,array('rows'=>3)) }} +
+
+
+ {{ Form::label('comments','备注',array('class' => 'uk-form-label')) }} +
+ {{ Form::textarea('comments',null,array('rows'=>3)) }} +
+
+ +
{{ $error }}
+ +
+ {{ Form::submit('提交',array('class'=>'uk-button uk-button-primary')) }} +
+{{ Form::close() }} +@stop \ No newline at end of file