@@ -217,7 +217,7 @@ sub getEditForm {
217
217
value => ' new' ,
218
218
);
219
219
$form -> addField( " hidden" ,
220
- name => ' class ' ,
220
+ name => ' className ' ,
221
221
value => ' WebGUI::Asset::MatrixListing' ,
222
222
);
223
223
}
@@ -324,18 +324,39 @@ sub getEditForm {
324
324
}
325
325
326
326
my $buttons = $form -> addField( " ButtonGroup" , name => " saveButtons" , rowClass => " saveButtons" );
327
- $buttons -> addButton( " Submit" , name => " send" );
328
- $buttons -> addButton( " Button" ,
327
+ $buttons -> addButton( " Submit" , { name => " send" , } );
328
+ $buttons -> addButton( " Button" , {
329
329
name => " cancel" ,
330
330
value => $i18n -> get(' cancel' , ' WebGUI' ),
331
331
extras => q{ onclick="history.go(-1);" class="backwardButton"} ,
332
- );
332
+ } );
333
333
334
334
return $form ;
335
335
}
336
336
337
337
# -------------------------------------------------------------------
338
338
339
+ =head2 getEditTemplate ( )
340
+
341
+ Override the base method to get the template from the parent Matrix asset.
342
+
343
+ =cut
344
+
345
+ sub getEditTemplate {
346
+ my $self = shift ;
347
+ my $var = $self -> get;
348
+ my $matrix = $self -> getParent;
349
+ my $template = eval { WebGUI::Asset-> newById($self -> session, $matrix -> get(' editListingTemplateId' )); };
350
+ # TODO: Change to FormBuilder
351
+ $var -> {form } = $self -> getEditForm-> toHtml;
352
+ $self -> session-> log -> warn ($var -> {form });
353
+ $template -> setParam(%{ $var });
354
+ $template -> style($matrix -> getStyleTemplateId);
355
+ return $template ;
356
+ }
357
+
358
+ # -------------------------------------------------------------------
359
+
339
360
=head2 hasRated ( )
340
361
341
362
Returns whether the user has already rated this listing or not.
@@ -813,33 +834,6 @@ sub www_deleteStickied {
813
834
814
835
# -------------------------------------------------------------------
815
836
816
- =head2 www_edit ( )
817
-
818
- Web facing method which is the default edit page
819
-
820
- =cut
821
-
822
- sub www_edit {
823
- my $self = shift ;
824
- my $i18n = WebGUI::International-> new($self -> session, " Asset_MatrixListing" );
825
-
826
- if ($self -> session-> form-> process(' func' ) eq ' add' ){
827
- return $self -> session-> privilege-> noAccess() unless $self -> getParent-> canAddMatrixListing();
828
- }else {
829
- return $self -> session-> privilege-> insufficient() unless $self -> canEdit;
830
- return $self -> session-> privilege-> locked() unless $self -> canEditIfLocked;
831
- }
832
-
833
- my $var = $self -> get;
834
- my $matrix = $self -> getParent;
835
- # TODO: Change to FormBuilder
836
- $var -> {form } = $self -> getEditForm-> toHtml;
837
-
838
- return $matrix -> processStyle($self -> processTemplate($var ,$matrix -> get(" editListingTemplateId" )));
839
- }
840
-
841
- # -------------------------------------------------------------------
842
-
843
837
=head2 www_getAttributes ( )
844
838
845
839
Gets a listings attributes grouped by category as json.
0 commit comments