FWS-V2

 view release on metacpan or  search on metacpan

lib/FWS/V2/Format.pm  view on Meta::CPAN

            $href .= $self->{scriptName} . '?s=' . $self->{siteId} . '&p=' . $hrefHash{guid};
        }
    }

    #
    # we only want the href, reguardless of antying.  give and get out
    #
    if ( $hrefHash{hrefOnly} ) {
        return $href;
    };

    #
    # URL
    #
    if ( $hrefHash{type} eq 'url' ) { $href = "<a href=\"" . $hrefHash{url} . "\"" }

    #
    # finish grooming the href if its for a page.
    #
    if ( $hrefHash{type} eq 'page' ) {
        $href = "<a href=\"" .  $href . "\""
    }

    if ( $hrefHash{type} eq "page" || $hrefHash{type} eq "url") {

        #
        # if we are on the page we are printing add "currentPage"
        #
        if ( $hrefHash{guid} eq $self->formValue( 'FWS_pageId' ) ) {
            $href .= ' class="currentPage"';
        }

        #
        # End the href part of the anchor
        #
        $href .= ">";

        #
        # html friendly the text for the between the a's
        #
        $hrefHash{name} =~ s/&/&amp;/sg;
        $hrefHash{name} =~ s/</&lt;/sg;
        $hrefHash{name} =~ s/>/&gt;/sg;

        #
        # bilingual the name, and navName;
        #
        $hrefHash{navigationName} = $self->field( 'navigationName', %hrefHash );

        #
        # add the text for the name, and close the anchor
        #
        $href .= ( $hrefHash{navigationName} ) ? $hrefHash{navigationName} : $hrefHash{name};
        
        $href .= "</a>";
    }
    return $href;
}


=head2 popupWindow

Create a link to a popup window or just the onclick.  Passing queryString is requried and pass linkHTML if you would like it to be a link.  

    $valueHash{html} .= $fws->popupWindow(queryString=>'p=somePage',$linkHTML=>'Click Here to go to some page');

NOTE: This should only be used in the context of the FWS Administration, and is only here as a reference for modifiers of the admin. 

=cut

sub popupWindow {
    my ( $self, %paramHash ) = @_;
    my $returnHTML = "window.open('" . $self->{scriptName} . $self->{queryHead} . $paramHash{queryString} . "','_blank');";
    if ( $paramHash{linkHTML} ) {
        return "<span class=\"FWSAjaxLink\" onclick=\"" . $returnHTML . "\">" . $paramHash{linkHTML} . "</span>";
    }
    return $returnHTML;
}

=head2 removeHTML

Return a string minus anything that is in < >.

    $safeForText = $fws->removeHTML( '<a href="somelink.html">This is the text that will return without the anchor</a>' );

=cut

sub removeHTML {
    my ( $self, $theString ) = @_;
    $theString =~ s/<!.*?-->//gs;
    $theString =~ s/<.*?>//gs;
    return $theString;
}

=head2 startElement

Return a the complement to endElement having the default title control and class labeling.

    $valueHash{html} .= $fws->startElement( %dataHash );
    $valueHash{html} .= $fws->endElement( %dataHash );

If there is no dataHash to pass, you can set its the keys elementClass, title, and disableTitle to control its appearence.

=cut

sub startElement {
    my ( $self, %dataHash ) = @_;

    my $elementClass = $self->formValue( 'FWS_elementClassPrefix' );
    if ( $dataHash{elementClass} ) { $elementClass = $dataHash{elementClass} }

    #
    # start two divs for positioning and backgrounds
    #
    my $html = "<div class=\"globalElementWrapper " . $elementClass . "Wrapper\"><div class=\"globalElement " . $elementClass . "\">";

    #
    # Title Field/Table
    #
    if ( !$dataHash{disableTitle} ) {
        $html .= "<div class=\"globalTitleWrapper " . $elementClass . "TitleWrapper\"><h2 class=\"globalTitle " . $elementClass . "Title\">";
        $html .= $self->field( 'title', %dataHash );
        $html .= "</h2></div>";
    }

    $html .= "<div class=\"globalContentWrapper " . $elementClass . "ContentWrapper\">";

    #
    # wrap the element
    #
    return $html;



( run in 0.658 second using v1.01-cache-2.11-cpan-364913b4093 )