<br/>

<progress-spinner ng:show="!info"></progress-spinner>

<div ng:show="info">
    <div class="row">
        <div class="col-md-9">
            <div class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Name</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{info.name}}
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Full path</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{info.path}}
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Type</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            <span class="label label-info" ng:show="info.isDir">
                                <i class="fa fa-folder-o"></i>
                                &nbsp;
                                <span translate>DIRECTORY</span>
                            </span>
                            <span class="label label-info" ng:show="info.isFile">
                                <i class="fa fa-file-o"></i>
                                &nbsp;
                                <span translate>FILE</span>
                            </span>
                            &nbsp;
                            <span class="label label-info" ng:show="info.isLink">
                                <i class="fa fa-link"></i>
                                &nbsp;
                                <span translate>LINK</span>
                            </span>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Access</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            <span class="label" ng:class="{'label-success': info.readAccess, 'label-warning': !info.readAccess}">
                                <i class="fa fa-check" ng:show="info.readAccess"></i>
                                <i class="fa fa-times" ng:show="!info.readAccess"></i>
                                &nbsp;
                                <span translate>READ</span>
                            </span>
                            &nbsp;
                            <span class="label" ng:class="{'label-success': info.writeAccess, 'label-warning': !info.writeAccess}">
                                <i class="fa fa-check" ng:show="info.writeAccess"></i>
                                <i class="fa fa-times" ng:show="!info.writeAccess"></i>
                                &nbsp;
                                <span translate>WRITE</span>
                            </span>
                            &nbsp;
                            <span class="label" ng:class="{'label-success': info.executeAccess, 'label-warning': !info.executeAccess}">
                                <i class="fa fa-check" ng:show="info.executeAccess"></i>
                                <i class="fa fa-times" ng:show="!info.executeAccess"></i>
                                &nbsp;
                                <span translate>EXECUTE</span>
                            </span>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Size</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{info.size|bytes}}
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Modified</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{(info.mtime*1000)|date:'medium'}}
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Owner</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{info.user}} <span class="subtle">UID {{info.uid}}</span>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Group</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{info.group}} <span class="subtle">GID {{info.gid}}</span>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" translate>Mode</label>
                    <div class="col-sm-10">
                        <label class="form-control-static">
                            {{info.mode.toString(8)}}
                        </label>
                        <br/>
                        <a ng:click="permissionsDialogVisible = true" ng:disabled="!info.writeAccess" class="btn btn-default">
                            <i class="fa fa-lock"></i> <span translate>Change permissions</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <a ng:href="{{urlPrefix}}/view/notepad/{{info.path}}" ng:show="ajentiPlugins.notepad && info.isFile && info.size < (1024 * 1024 * 64) && info.writeAccess" class="btn btn-default btn-block">
                <i class="fa fa-pencil"></i> <span translate>Edit in Notepad</span>
            </a>
            <a ng:href="{{urlPrefix}}/view/notepad/{{info.path}}" ng:show="ajentiPlugins.notepad && info.isFile && info.size < (1024 * 1024 * 64) && !info.writeAccess && info.readAccess" class="btn btn-default btn-block">
                <i class="fa fa-pencil"></i> <span translate>Show in Notepad</span>
            </a>
            <br/>
        </div>
    </div>
    <floating-toolbar>
        <a ng:href="{{urlPrefix}}/view/filemanager/{{parent}}" class="btn btn-default btn-flat" test-bind="cutButton" translate>< Back</a>
    </floating-toolbar>
</div>

<dialog ng:show="permissionsDialogVisible" ng:cloak>
    <div class="modal-header">
        <h4 translate>Permission bits</h4>
    </div>
    <div class="modal-body">
        <table class="table">
            <tr>
                <th translate>User</th>
                <td>
                    <span checkbox ng:model="mode.ur" text="R"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.uw" text="W"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.ux" text="X"></span>
                </td>
            </tr>
            <tr>
                <th translate>Group</th>
                <td>
                    <span checkbox ng:model="mode.gr" text="R"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.gw" text="W"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.gx" text="X"></span>
                </td>
            </tr>
            <tr>
                <th translate>All</th>
                <td>
                    <span checkbox ng:model="mode.ar" text="R"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.aw" text="W"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.ax" text="X"></span>
                </td>
            </tr>
            <tr>
                <th translate>Extra</th>
                <td>
                    <span checkbox ng:model="mode.sticky" text="Sticky"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.setuid" text="Set UID"></span>
                </td>
                <td>
                    <span checkbox ng:model="mode.setgid" text="Set GID"></span>
                </td>
            </tr>
        </table>
    </div>
    <div class="modal-footer">
        <a ng:click="applyPermissions()" class="btn btn-default btn-flat" translate>Apply</a>
        <a ng:click="hidePermissionsDialog()" class="btn btn-default btn-flat" translate>Cancel</a>
    </div>
</dialog>