FWS-V2

 view release on metacpan or  search on metacpan

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

                #
                # If the parent isn't a page, that means we are talking about a sub element of an element.
                # we need to make sure the ajaxID is the parent of this element and then refresh the element in place.
                #
                # if it is a sub elemenet of an element, we also need to disable the "display none" it dosn't look goofy
                #
                #if ( $self->formValue( "FWS_pageId" ) eq $editHash{parent} && !$self->formValue( "FWS_editModeUpdate" ) ) { 
                #    $ajaxID = '<div></div>';
                #}
                #else { $baseClear = "" }
        
                $editHTML .= $self->FWSIcon(
                    icon    => "delete_16.png",
                    onClick => "\$('" . $ajaxID . "').FWSDeleteElement({pageGUID: '" . $self->formValue( 'FWS_elementId' ) . "',parentGUID: '" . $editHash{parent} . "', guid: '" . $editHash{guid} . "'});", 
                    alt     => "Delete",
                    width   => "16",
                    id      => "delete_" . $editHash{guid},
                );
            }
    
            #
            # add and order Tool Button
            #
            if ( !$editHash{disableEditTool} && $editHash{type} ne 'page') {
                $editHTML .= $self->FWSIcon(     
                    icon    => "properties_16.png",
                    onClick => $self->dialogWindow( queryString => "p=fws_dataEdit&guid=" . $editHash{guid} . "&parentId=" . $editHash{parent} ),
                    alt     => "Edit",
                    width   => "16",
                );
            }
        
            #
            # ON/OFF cotnrol
            #
            if ( !$editHash{disableActiveTool} && $editHash{guid} ne $self->homeGUID() ) { $editHTML .= $self->onOffLight( $editHash{active}, $editHash{guid} ) }
        
            #
            # close the edit bar container
            #    
            if ( !$editHash{editBoxJustButtons} ) { $editHTML .= '</div>' }
    
            $editHTML .= $editHash{editBoxContent};   
            $editHTML .= $editHash{editBox};
        
            #
            # close the delete ajax container
            #    
            if ( !$editHash{editBoxJustButtons} ) { $editHTML .= '</div>' }
        }
    }

    #
    # edit mode is not on, just show the content and call this good
    #
    else { $editHTML .= $editHash{editBoxContent} . $editHash{editBox} }
    return $editHTML;
}    
    
 
=head2 FWSMenu

Return the FWS top menu bar.

=cut

sub FWSMenu {
    my ( $self, %paramHash ) = @_;

    #
    # because we have a menu, it might need tiny mce
    #
    $self->{tinyMCEEnable} = 1;
            
    my $linkSpacer = " &nbsp;&middot;&nbsp; ";
    my $FWSMenu;
    

    #
    # create a correct label for fws/devel link to know what we have access too
    #
    if ( $self->userValue( 'isAdmin' ) || $self->userValue( 'showDeveloper' ) )  {
        $FWSMenu .= $self->popupWindow( queryString => "p=fws_systemInfo", linkHTML => "System" );
        $FWSMenu .= $linkSpacer;
    }

    #
    # get the FWSMenu taged elements and add them to the list
    #
    my @elementArray    = $self->elementArray( tags => 'FWSMenu' );
    @elementArray       = $self->sortDataByNumber( 'ord', @elementArray );
    for my $i (0 .. $#elementArray) {

        #
        # blank out the adminGroup if we have access so we can pass by the security check
        #
        map { if ( $self->userValue( $_ ) eq 1 ) { $elementArray[$i]{adminGroup} = '' } } split( /,/, $elementArray[$i]{adminGroup} );

        #
        # if we have access or we are super user show it
        #
        if ( !$elementArray[$i]{adminGroup} || $self->userValue( 'isAdmin' ) ) {
    
            #
            # convert to our friendly name format
            #
            ( my $fwsLink = $elementArray[$i]{type} ) =~ s/^FWS/fws_/sg;
    
            #
            # if this is not a friendly type version menu item then use the guid
            #
            $fwsLink ||= 'fws_' . $elementArray[$i]{guid};

            my $queryString = "FWS_pageId=" . $paramHash{pageId} . "&p=" . $fwsLink . "&FWS_showElementOnly=";
            if ( $elementArray[$i]{rootElement} ) { $FWSMenu .= $self->popupWindow( queryString => $queryString . "0", linkHTML => $elementArray[$i]{title} ) }
            else { $FWSMenu .= $self->dialogWindow( queryString => $queryString . "1", linkHTML => $elementArray[$i]{title} ) }
            $FWSMenu .= $linkSpacer;
        }
    }

    if ( $self->formValue( "p" ) =~ /^fws_/ ) {
        $FWSMenu .= $self->_selfWindow( "", "View Site" );
        $FWSMenu .= $linkSpacer;
    }
    
    #    
    # ALWAYS ON
    #
    if ( $self->userValue( 'isAdmin' ) || $self->userValue( 'showDesign' ) || $self->userValue( 'showContent' ) || $self->userValue( 'showDeveloper' ) )  {
        $FWSMenu .= $self->_editModeLink( '', $linkSpacer );
    }

    $FWSMenu .= $self->_logOutLink();
    
    if ( $self->userValue( 'isAdmin' ) || $self->userValue( 'showDesign' ) || $self->userValue( 'showContent' ) || $self->userValue( 'showDeveloper' ) )  {

        #
        # just in case we havn't installed FWS core yet, lets make sure the image is there before we 
        # try to display it.
        #
        if ( -e $self->{filePath} . '/fws/icons/add_reorder_16.png' ) {
            $FWSMenu .= $linkSpacer;
            $FWSMenu .= $self->FWSIcon( 
                icon    => 'add_reorder_16.png',
                onClick => $self->dialogWindow( queryString => 'p=fws_dataOrdering&guid=' . $paramHash{pageId} . '&pageOnly=1' ),
                alt     => 'Add And Ordering',
                width   => '16',
            );
        }
    }

    $FWSMenu .= $linkSpacer;

    return $FWSMenu;
}


=head2 panel

FWS panel HTML:  Pass title, content and panelStyle keys.

=cut

sub panel {
    my ( $self, %paramHash ) = @_;
    
    my $panel;

    if ( $paramHash{inline} ) {
        $panel .= "<div style=\"width:95%;font-size:12px;margin-top:10px;padding-bottom:10px;margin-bottom:10px;border: 1px solid #d3d3d3; padding:10px;background: #ffffff; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; font...
        $panel .= "<div style=\"padding:5px 15px 15px 15px;font-weight:800;font-size:14px;color:#2B6FB6;\" class=\"FWSPanelTitle\">" . $paramHash{title} . "</div>";
        $panel .= "<div steyl=\" padding:5px 15px 15px 15px;font-size:12px;\" class=\"FWSPanelContent\">" . $paramHash{content} . "</div>";
        $panel .= "</div>";
    }
    else {
        $panel .= "<div ";
        if ( defined $paramHash{panelStyle} ) { $panel .= "style=\"" . $paramHash{panelStyle} . "\" " }
        $panel .= "class=\"FWSPanel ui-widget ui-widget-content ui-corner-all\">";
        $panel .= "<div class=\"FWSPanelTitle\">" . $paramHash{title} . "</div>";
        $panel .= "<div class=\"FWSPanelContent\">" . $paramHash{content} . "</div>";
        $panel .= "</div>";
    }
    return $panel;
}


=head2 displayAdminPage

Run the lookup and display admin pages wrapped in security precautions.

=cut

sub displayAdminPage {
    my ( $self ) = @_;

    #
    # mimic the normal element processing controls
    #
    my $pageHTML; 
    my $showElementOnly = 0;
    my $quitPageProcessing = 0;
    my $pageId = $self->safeSQL( $self->formValue( 'p' ) );
        
    if ( $self->isAdminLoggedIn() ) {
        $self->jqueryEnable( 'simplemodal-1.4.4' );
        $self->jqueryEnable( 'ui.core-1.8.9' );
        $self->jqueryEnable( 'ui.widget-1.8.9' );
        $self->jqueryEnable( 'ui.tabs-1.8.9' );
        $self->jqueryEnable( 'ui.fws-1.8.9' );
        $self->jqueryEnable( 'fileupload-ui-4.4.1' );
        $self->jqueryEnable( 'fileupload-4.5.1' );
        $self->jqueryEnable( 'fileupload-uix-4.6' );

        #



( run in 0.614 second using v1.01-cache-2.11-cpan-39bf76dae61 )