FWS-V2
view release on metacpan or search on metacpan
lib/FWS/V2/Display.pm view on Meta::CPAN
#
$valueHash{type} = $userHash{elementType};
#
# you must be admin logged in to see it.
#
if ( $userHash{userGroup} eq '-101' && !$self->isAdminLoggedIn() ) {
$valueHash{type} = '';
}
#
# you must be admin logged in to see it.
#
if ( $userHash{userGroup} eq '-102' && $self->isAdminLoggedIn() ) {
$valueHash{type} = '';
}
#
# you can't be logged in to see it. supress the element
#
if ( $userHash{userGroup} eq '-1' && $userHash{active} ) {
$valueHash{type} = '';
}
#
# if this is set to 0 then negative the login because it must have been set that way
# from the loginMod, This is a string and can contain guids, so we can't use math here
#
if ( $userHash{userGroup} !~ /^-/ || $userHash{userGroup} eq '0') {
#
# If group ID is "1" then all I need to be is just logged in
#
if ( $userHash{userGroup} eq '1' && $userHash{active} ) {
#DON't panic. we good to go! we won't switch anyting
}
#
# If we have a spacific group, figure it out and do it
#
elsif ( $userHash{group}{$userHash{userGroup}} && $userHash{active} ) {
#Nice! we are gtg, don't do anything
}
#
# Set elementType your not set to see, set login or blank the element
#
else {
if ( $userHash{show_login} ) {
$valueHash{type} = 'FWSLogin';
}
else {
$valueHash{type} = '';
}
}
}
}
#
# If your a mobile device, and your mobile is set to (2) show desktop only then eat the type
#
if ( $ENV{HTTP_USER_AGENT} =~ /mobile/i && $valueHash{showMobile} eq '2' ) {
$valueHash{type} = '';
}
#
# If your NOT a mobile device, and your mobile is set to (1) show mobile only then eat the type
#
if ( $ENV{HTTP_USER_AGENT} !~ /mobile/i && $valueHash{showMobile} eq '1' ) {
$valueHash{type} = '';
}
#
# set defaults and get the editBox going
#
my $html;
#
# set elementId in a formValue so the FWS can use it when working with adminField function
#
$self->formValue( 'FWS_elementId', $valueHash{guid} );
$self->formValue( 'FWS_pageId', $pageId );
#
# Get the element
#
my %elementHash = $self->elementHash( guid => $valueHash{type} );
#
# add css or js if its needed
#
if ( !$JSHash{$valueHash{type}} && $elementHash{jsDevel} ) {
$JSHash{$valueHash{type}} = 1;
$self->_jsEnable( $elementHash{siteGUID} . "/" . $valueHash{type} . "/FWSElement-" . $elementHash{jsDevel},-1000 );
}
if ( !$CSSHash{$valueHash{type}} && $elementHash{cssDevel} ) {
$CSSHash{$valueHash{type}} = 1;
$self->_cssEnable( $elementHash{siteGUID} . "/" . $valueHash{type} . "/FWSElement-" . $elementHash{cssDevel},-1000 );
}
#
# convert the code to the fws friendly version
#
$elementHash{scriptDevel} =~ s/self-/fws-/g;
#
# copy the GNF object to fws
#
my $fws = $self;
#
# set the valueHash for value conduit style programming
#
#my %valueHash;
$valueHash{pageId} = $pageId;
$valueHash{elementId} = $valueHash{guid};
$valueHash{elementWebPath} = $self->{fileWebPath} . "/" . $elementHash{siteGUID} . "/" . $valueHash{type};
#
# set this so its available in the elementStart via the FWS_elementClassPrefix, and valueHash
( run in 1.756 second using v1.01-cache-2.11-cpan-df04353d9ac )