Thingy now has a copy thing data option.
This commit is contained in:
parent
55da5c6889
commit
1cc87c159b
3 changed files with 97 additions and 1 deletions
|
|
@ -947,7 +947,7 @@ sub www_viewGradeBook{
|
|||
unless ( $self->session->user->isInGroup( $self->get("groupToViewReports") ) );
|
||||
my @peoples = $self->session->db->quickArray("SELECT UNIQUE(Survey_responseId) from Survey_tempReport where assetId = ?",[$self->getId()]);
|
||||
for my $people(@peoples){
|
||||
|
||||
#my $
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -325,6 +325,35 @@ sub deleteField {
|
|||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 copyThingData ( )
|
||||
|
||||
Copies data in a Thing.
|
||||
|
||||
=head3 thingId
|
||||
|
||||
The id of the Thing that should be copied.
|
||||
|
||||
=head3 thingDataId
|
||||
|
||||
The id of row of data that should be copied.
|
||||
|
||||
=cut
|
||||
|
||||
sub copyThingData {
|
||||
my $self = shift;
|
||||
my $thingId = shift;
|
||||
my $thingDataId = shift;
|
||||
my $db = $self->session->db;
|
||||
return undef unless $self->canEditThingData($thingId, $thingDataId);;
|
||||
|
||||
$self->copyCollateral("Thingy_".$thingId,"thingDataId",$thingDataId);
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 deleteThingData ( )
|
||||
|
|
@ -1368,6 +1397,27 @@ sub www_deleteFieldConfirm {
|
|||
}
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_copyThingData( )
|
||||
|
||||
Copies data in a Thing.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_copyThingData{
|
||||
|
||||
my $self = shift;
|
||||
my $thingId = $self->session->form->process("thingId");
|
||||
my $thingDataId = $self->session->form->process('thingDataId');
|
||||
|
||||
return $self->session->privilege->insufficient() unless $self->canEditThingData($thingId, $thingDataId);
|
||||
|
||||
$self->copyThingData($thingId,$thingDataId);
|
||||
|
||||
return $self->www_search;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteThingConfirm ( )
|
||||
|
||||
Deletes a Thing, including field definitions and instances of this Thing and drops the table that holds the
|
||||
|
|
@ -2201,6 +2251,12 @@ sub editThingData {
|
|||
$var->{"manage_url"} = $session->url->append($url, 'func=manage');
|
||||
$var->{"thing_label"} = $thingProperties->{label};
|
||||
|
||||
if($canEditThingData){
|
||||
if ($thingDataId ne "new"){
|
||||
$var->{"copy_url"} = $session->url->append($url, 'func=copyThingData;thingId='.$thingId.';thingDataId='.$thingDataId);
|
||||
}
|
||||
}
|
||||
|
||||
if($canEditThingData){
|
||||
if ($thingDataId ne "new"){
|
||||
$var->{"delete_url"} = $session->url->append($url, 'func=deleteThingDataConfirm;thingId='
|
||||
|
|
@ -2208,6 +2264,7 @@ sub editThingData {
|
|||
}
|
||||
$var->{"delete_confirm"} = "onclick=\"return confirm('".$i18n->get("delete thing data warning")."')\"";
|
||||
}
|
||||
|
||||
if($self->hasPrivileges($thingProperties->{groupIdAdd}) && !$self->hasEnteredMaxPerUser($thingId)){
|
||||
$var->{"add_url"} = $session->url->append($url,'func=editThingData;thingId='.$thingId.';thingDataId=new');
|
||||
}
|
||||
|
|
@ -3083,6 +3140,8 @@ sequenceNumber');
|
|||
.$thingId.';thingDataId='.$thingDataId,$self->get("url"),$i18n->get('delete thing data warning'));
|
||||
$templateVars{searchResult_edit_icon} = $session->icon->edit('func=editThingData;thingId='
|
||||
.$thingId.';thingDataId='.$thingDataId,$self->get("url"));
|
||||
$templateVars{searchResult_copy_icon} = $session->icon->copy('func=copyThingData;thingId='
|
||||
.$thingId.';thingDataId='.$thingDataId,$self->get("url"));
|
||||
}
|
||||
push(@searchResult_loop,\%templateVars);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue