Skip to content

Commit baf5acc

Browse files
committed
When creating a new entry, and validation redirects back to the form, ensure our RDN readonly is preserved
1 parent 00a8350 commit baf5acc

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function entry_create(EntryAddRequest $request)
137137
abort(599,$e->getDetailedError()->getErrorMessage());
138138
}
139139

140-
// @todo To test and valide this Exception is caught
140+
// @todo when we create an entry, and it already exists, enable a redirect to it
141141
} catch (LdapRecordException $e) {
142142
$request->flash();
143143

resources/views/components/attribute/rdn.blade.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434
@section('page-scripts')
3535
<script type="text/javascript">
3636
$(document).ready(function() {
37-
var rdn_value_set = null;
38-
var rdn_attr = null;
37+
var rdn_value_set = $('input#rdn_value').val();
38+
rdn_attr = $('select#rdn').val();
39+
40+
if (rdn_attr) {
41+
$('#'+rdn_attr).find('input').attr('readonly',true);
42+
set_rdn_value();
43+
}
3944
4045
function set_rdn_value() {
4146
if (rdn_attr && rdn_value_set)

resources/views/frames/create.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
@section('page-scripts')
6969
<script type="text/javascript">
7070
var oc = {!! $oo->getObject('objectclass')->values !!};
71+
var rdn_attr;
7172
7273
function editmode() {
7374
// Find all input items and turn off readonly
@@ -76,6 +77,10 @@ function editmode() {
7677
if ($(this)[0].name.match(/^objectclass/))
7778
return;
7879
80+
// Dont take of the readonly value for our RDN if it is set
81+
if (rdn_attr && ($(this)[0].name === rdn_attr+'[]'))
82+
return;
83+
7984
$(this).attr('readonly',false);
8085
});
8186

0 commit comments

Comments
 (0)