"Fossies" - the Fresh Open Source Software Archive

Member "metadot/metadot/AbstractCategoryGizmoHack.pm" (1 Jul 2005, 4553 Bytes) of package /linux/www/old/Metadot6.4.5.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AbstractCategoryGizmoHack.pm" see the Fossies "Dox" file reference documentation.

    1 ###########################################################################
    2 # <LICENSEINFO>
    3 # Copyright (C) Daniel Guermeur - 1999-2001
    4 # Copyright (C) Metadot Corporation - 2001-2005
    5 #
    6 # This file is part of Metadot Portal Server software $Name: Release_6_4_5_4 $
    7 #
    8 # Metadot Portal Server software is free software; you can
    9 # redistribute it and/or modify it under the terms of the GNU General Public
   10 # License as published by the Free Software Foundation; either version 2 of
   11 # the License, or (at your option) any later version.
   12 #
   13 # Metadot Portal Server software is distributed in the hope that it
   14 # will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   15 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
   16 # Public License for more details.
   17 #
   18 # You should have received a copy of the GNU General Public License along with
   19 # Metadot Portal Server; if not, write to the Free Software
   20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   21 #
   22 # For more information, please contact info@metadot.com.
   23 #</LICENSEINFO>
   24 ############################################################################
   25 package AbstractCategoryGizmoHack;
   26 
   27 
   28 
   29 
   30 
   31 
   32 ###################################################
   33 ###################################################
   34 ###################################################
   35 ###################################################
   36 ###################################################
   37 ###################################################
   38 ###################################################
   39 #
   40 # THIS CLASS IS DEPRECATED
   41 #
   42 ###################################################
   43 ###################################################
   44 ###################################################
   45 ###################################################
   46 ###################################################
   47 ###################################################
   48 ###################################################
   49 ###################################################
   50 
   51 
   52 
   53 use strict;
   54 
   55 use Metadot qw($USER %FORM $SESSION $HTTP_HEADER_SENT $PARAMS);
   56 
   57 use vars qw(@ISA);
   58 @ISA=qw(GizmoBuilder Gizmo::Category);
   59 my $version = "4.5";
   60 
   61 sub get_version {
   62     return $version;
   63 }
   64 
   65 
   66 sub customize_permissions {
   67    my $class = shift;
   68    my $AC = shift;
   69 
   70    $class->SUPER::customize_permissions($AC);
   71 
   72    $AC->add_op('MOD', 'add_child');
   73    $AC->add_op('MOD', 'create_child');
   74 }
   75 
   76 
   77 sub gizmo_list_header {
   78     my $class = shift;
   79 
   80     return "";
   81 }
   82 
   83 
   84 sub www_create_child {
   85   my $self = shift;
   86   my $child_type = shift;
   87 
   88   $self->debug_msg(3, "Gizmo::www_create_child()");
   89 
   90   my $child_isa = $FORM{child_type} || $child_type;
   91 
   92   my $parentid = $self->defined_or_exit($self->id,"parent id is missing.");
   93   # we re-instanciate the object because we want a brand new one
   94   my $child = $child_isa->new({
   95              uid => $USER->uid(),
   96              parent_id => $parentid,
   97             });
   98 
   99   # this method should ALWAYS be overridden in derived classes.
  100   $child->process_edit_form();
  101 }
  102 
  103 sub _show_create_success {
  104     my $self = shift;
  105     my $isa = $self->is_a();
  106 
  107     my $parentid = $self->parent_id();
  108 
  109     my $parent_obj = Gizmo->new($parentid);
  110 
  111     my $grandparent = $parent_obj->parent_id();
  112 
  113     $self->two_choices("<Big>New $isa added!</big><br /><br />What do you want to do?",
  114                "confirm",
  115                "Add another $isa",
  116                "index.pl?child_type=$isa&isa=Category&iid=$grandparent&op=add_child&app=",
  117                "Enough for now!",
  118                "index.pl?id=$grandparent");
  119 }
  120 
  121 sub show_summary {
  122     my $self = shift;
  123     my @args = @_;
  124 
  125     my $buttons     = $self->get_buttons();
  126     my $id = $self->id();
  127     my $isa = $self->is_a();
  128 
  129     $self->{is_inline} = 1;
  130     my $text = $self->show();
  131 
  132     return $buttons.$text;
  133 }
  134 
  135 sub www_save {
  136     my $self = shift;
  137 
  138     if (!$self->get_iid()) {
  139         use Gizmo::Category;
  140         my $cat = Gizmo->new($self->parent_id());
  141         $cat->name($FORM{name});
  142         $cat->uid($self->uid());
  143         $cat->parent_id($self->parent_id);
  144         $cat->is_a("Category");
  145         $cat->keywords("");
  146         $cat->display_look("");
  147         $cat->created_by("");
  148         $cat->t1("");
  149         $cat->t2("");
  150         $cat->t3("");
  151         my $newcatid = $cat->add();
  152 
  153         $self->{parent_id} = $newcatid;
  154     }
  155 
  156     $self->SUPER::www_save();
  157 
  158 }
  159 
  160 
  161 
  162 
  163 1;
  164 
  165 __END__
  166 
  167 =head1 NAME
  168 
  169 AbstractCategoryGizmoHack: an abstract class for creating Gizmo-Category combinations, such as FAQ
  170 
  171 =head1 SYNOPSIS
  172 
  173 =head1 DESCRIPTION
  174 
  175 =head2 Methods
  176 
  177 
  178 =cut
  179 
  180