Revision f6c3d7d6
Von Tamino Steinert vor 6 Monaten hinzugefügt
SL/Controller/File.pm | ||
---|---|---|
157 | 157 |
|
158 | 158 |
sub action_ajax_rename { |
159 | 159 |
my ($self) = @_; |
160 |
my ($id, $version) = split /_/, $::form->{id};
|
|
161 |
my $file = SL::File->get(id => $id);
|
|
160 |
my $guid = $::form->{id};
|
|
161 |
my $file = SL::File->get(guid => $guid);
|
|
162 | 162 |
if ( ! $file ) { |
163 | 163 |
$self->js->flash('error', $::locale->text('File not exists !'))->render(); |
164 | 164 |
return; |
... | ... | |
279 | 279 |
); |
280 | 280 |
|
281 | 281 |
if ($existobj) { |
282 |
push @existing, $existobj->id.'_'.$sfile->file_name;
|
|
282 |
push @existing, ($existobj->versions)[0]->file_version->guid.'_'.$sfile->file_name;
|
|
283 | 283 |
} else { |
284 | 284 |
my $fileobj = SL::File->save(object_id => $self->object_id, |
285 | 285 |
object_type => $self->object_type, |
... | ... | |
502 | 502 |
$self->js->html('#'.$self->file_type.'_list_'.$self->object_type, $output); |
503 | 503 |
if ( $self->existing && scalar(@{$self->existing}) > 0) { |
504 | 504 |
my $first = shift @{$self->existing}; |
505 |
my ($first_id, $sfile) = split('_', $first, 2); |
|
506 |
my $file = SL::File->get(id => $first_id );
|
|
507 |
$self->js->run('kivi.File.askForRename', $first_id, $file->file_type, $file->file_name, $sfile, join (',', @{$self->existing}), $self->is_global); |
|
505 |
my ($first_guid, $sfile) = split('_', $first, 2);
|
|
506 |
my $file = SL::File->get(guid => $first_guid );
|
|
507 |
$self->js->run('kivi.File.askForRename', $first_guid, $file->file_type, $file->file_name, $sfile, join (',', @{$self->existing}), $self->is_global);
|
|
508 | 508 |
} |
509 | 509 |
$self->js->render(); |
510 | 510 |
} else { |
js/kivi.File.js | ||
---|---|---|
14 | 14 |
alert(kivi.t8("More than one file selected, please set only one checkbox!")); |
15 | 15 |
return false; |
16 | 16 |
} |
17 |
var file_id = checkboxes[0].value; |
|
18 |
$('#newfilename_id_'+file_type).val($('#filename_'+file_id).text()); |
|
17 |
var file_guid = checkboxes[0].value;
|
|
18 |
$('#newfilename_id_'+file_type).val($('#filename_'+file_guid).text());
|
|
19 | 19 |
$('#next_ids_id_'+file_type).val(''); |
20 | 20 |
$('#is_global_id_'+file_type).val(is_global); |
21 |
$('#rename_id_id_'+file_type).val(file_id); |
|
21 |
$('#rename_id_id_'+file_type).val(file_guid);
|
|
22 | 22 |
$('#sessionfile_id_'+file_type).val(''); |
23 | 23 |
$('#rename_extra_text_'+file_type).html(''); |
24 | 24 |
kivi.popup_dialog({ |
... | ... | |
44 | 44 |
$("#rename_dialog_"+file_type).dialog('close'); |
45 | 45 |
var data = { |
46 | 46 |
action: 'File/ajax_rename', |
47 |
id: $('#rename_id_id_'+file_type).val(), |
|
47 |
id: $('#rename_id_id_'+file_type).val(), //guid
|
|
48 | 48 |
to: $('#newfilename_id_'+file_type).val(), |
49 | 49 |
next_ids: $('#next_ids_id_'+file_type).val(), |
50 | 50 |
is_global: $('#is_global_id_'+file_type).val(), |
... | ... | |
54 | 54 |
return true; |
55 | 55 |
} |
56 | 56 |
|
57 |
ns.askForRename = function(file_id,file_type,file_name,sessionfile,next_ids,is_global) { |
|
57 |
ns.askForRename = function(file_guid,file_type,file_name,sessionfile,next_ids,is_global) {
|
|
58 | 58 |
$('#newfilename_id_'+file_type).val(file_name); |
59 |
$('#rename_id_id_'+file_type).val(file_id); |
|
59 |
$('#rename_id_id_'+file_type).val(file_guid);
|
|
60 | 60 |
$('#is_global_id_'+file_type).val(is_global); |
61 | 61 |
$('#next_ids_id_'+file_type).val(next_ids); |
62 | 62 |
$('#sessionfile_id_'+file_type).val(sessionfile); |
Auch abrufbar als: Unified diff
S:C:File: verwende 'guid' statt 'id' beim Umbenennen