mirror of
https://github.com/mickael-kerjean/filestash
synced 2026-01-04 14:52:36 +01:00
feature (backend): ldap backend
This commit is contained in:
parent
aaf33996c8
commit
8bbe2fac0b
5 changed files with 4096 additions and 7 deletions
|
|
@ -154,8 +154,12 @@ export class ViewerPage extends React.Component {
|
|||
<VideoPlayer data={this.state.url} filename={this.state.filename} path={this.state.path} />
|
||||
</NgIf>
|
||||
<NgIf cond={this.state.opener === 'form'}>
|
||||
<FormViewer filename={this.state.filename}
|
||||
content={this.state.content || ""} />
|
||||
<FormViewer needSavingUpdate={this.needSaving.bind(this)}
|
||||
needSaving={this.state.needSaving}
|
||||
isSaving={this.state.isSaving}
|
||||
onSave={this.save.bind(this)}
|
||||
content={this.state.content || ""}
|
||||
filename={this.state.filename} />
|
||||
</NgIf>
|
||||
<NgIf cond={this.state.opener === 'audio'}>
|
||||
<AudioPlayer data={this.state.url} filename={this.state.filename} />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import React from 'react';
|
||||
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
|
||||
|
||||
import { MenuBar } from './menubar';
|
||||
import { Container, FormBuilder } from '../../components/';
|
||||
import { Container, FormBuilder, NgIf, Icon, Fab } from '../../components/';
|
||||
import './formviewer.scss';
|
||||
|
||||
export class FormViewer extends React.Component {
|
||||
|
|
@ -17,6 +19,19 @@ export class FormViewer extends React.Component {
|
|||
|
||||
onChange(){
|
||||
this.setState({refresh: Math.random()});
|
||||
if(JSON.stringify(this.state.form) === this.props.content){
|
||||
this.props.needSavingUpdate(false);
|
||||
} else {
|
||||
this.props.needSavingUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
save(){
|
||||
if(this.props.needSaving === false) return;
|
||||
let blob = new window.Blob([JSON.stringify(this.state.form)], {type : 'text/plain'});
|
||||
return this.props
|
||||
.onSave(blob)
|
||||
.then(() => this.props.needSavingUpdate(false));
|
||||
}
|
||||
|
||||
render(){
|
||||
|
|
@ -31,7 +46,7 @@ export class FormViewer extends React.Component {
|
|||
<label className={"no-select"}>
|
||||
<div>
|
||||
<span>
|
||||
{ struct.label }:
|
||||
{ struct.label }<span className="mandatory">{struct.required ? "*" : ""}</span>
|
||||
</span>
|
||||
<div style={{width: '100%'}}>
|
||||
{ $input }
|
||||
|
|
@ -46,9 +61,19 @@ export class FormViewer extends React.Component {
|
|||
</label>
|
||||
);
|
||||
}}/>
|
||||
</form>
|
||||
</form>
|
||||
</Container>
|
||||
</div>
|
||||
<ReactCSSTransitionGroup transitionName="fab" transitionLeave={true} transitionEnter={true} transitionAppear={true} transitionAppearTimeout={400} transitionEnterTimeout={400} transitionLeaveTimeout={200}>
|
||||
<NgIf key={this.props.needSaving} cond={this.props.needSaving}>
|
||||
<NgIf cond={!this.props.isSaving}>
|
||||
<Fab onClick={this.save.bind(this)}><Icon name="save" style={{height: '100%', width: '100%'}}/></Fab>
|
||||
</NgIf>
|
||||
<NgIf cond={this.props.isSaving}>
|
||||
<Fab><Icon name="loading" style={{height: '100%', width: '100%'}}/></Fab>
|
||||
</NgIf>
|
||||
</NgIf>
|
||||
</ReactCSSTransitionGroup>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@
|
|||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.mandatory{
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ type FormElement struct {
|
|||
MultiValue bool `json:"multi,omitempty"`
|
||||
Datalist []string `json:"datalist,omitempty"`
|
||||
Order int `json:"-"`
|
||||
Required bool `json:"required"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -142,7 +143,6 @@ func (this Form) MarshalJSON() ([]byte, error) {
|
|||
|
||||
func (this Form) toJSON(fn func(el FormElement) string) string {
|
||||
formatKey := func(str string) string {
|
||||
str = strings.ToLower(str)
|
||||
return strings.Replace(str, " ", "_", -1)
|
||||
}
|
||||
ret := ""
|
||||
|
|
|
|||
4057
server/plugin/plg_backend_ldap/index.go
Normal file
4057
server/plugin/plg_backend_ldap/index.go
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue