parse_adf_return_simple_array(); if( !is_array( $opensam_adf_values ) ) { $ErrMsg = "FAILED parsing $adf_file - $opensam_adf_values"; break; } // Diagnostic: //$opensam_adf_obj->dump_this_guy(); // We've got the details from the ADF. Now build the dump table and validate the // values. $DumpTable = ""; dump_check_value( $DumpTable, $InvalidMsg, "Canonical URL", $opensam_adf_values['Description'], true ); dump_check_value( $DumpTable, $InvalidMsg, "Application Name", $opensam_adf_values['title'] ); dump_check_value( $DumpTable, $InvalidMsg, "Description", $opensam_adf_values['description'] ); dump_check_value( $DumpTable, $InvalidMsg, "Owner", $opensam_adf_values['author'] ); dump_check_value( $DumpTable, $InvalidMsg, "Instance Host", $opensam_adf_values['publisher'] ); // Gather the application types: $apptypes = ""; if( is_nested_value( $opensam_adf_values['applicationType'] ) ) { $apptypes = implode_values( ", ", $opensam_adf_values['applicationType'] ); if( false === has_nested_value( 'Web20', $opensam_adf_values['applicationType'] ) ) $WarningMsg .= "WARNING: Web20 not included in applicationType list
"; if( false === has_nested_value( 'OpenSAM', $opensam_adf_values['applicationType'] ) ) $WarningMsg .= "WARNING: OpenSAM not included in applicationType list
"; } dump_check_value( $DumpTable, $InvalidMsg, "Application Types", $apptypes ); // Gather openSAM Types: $opensam_types = ""; if( is_nested_value( $opensam_adf_values['openSAMType'] ) ) { $opensam_types = implode_values( ", ", $opensam_adf_values['openSAMType'] ); } dump_check_value( $DumpTable, $InvalidMsg, "OpenSAM Types", $opensam_types ); if( is_nested_value( $opensam_adf_values['openSAMType'] ) ) { // Check for all the URIs associated with the OpenSAM types: if( false !== has_nested_value( 'belaunched', $opensam_adf_values['openSAMType'] ) ) { dump_check_value( $DumpTable, $InvalidMsg, "Launch URL", $opensam_adf_values['openSAMLaunchURI'] ); } if( false !== has_nested_value( 'storage', $opensam_adf_values['openSAMType'] ) ) { dump_check_value( $DumpTable, $InvalidMsg, "WebDAV URL", $opensam_adf_values['openSAMWebDAVURI'] ); } if( false !== has_nested_value( 'launch', $opensam_adf_values['openSAMType'] ) ) { dump_check_value( $DumpTable, $InvalidMsg, "Launch Dispatch URL", $opensam_adf_values['openSAMLaunchDispatchURI'], true ); } if( false !== has_nested_value( 'search', $opensam_adf_values['openSAMType'] ) ) { dump_check_value( $DumpTable, $InvalidMsg, "Search URL", $opensam_adf_values['openSAMSearchURI'], true ); } if( false !== has_nested_value( 'emailsend', $opensam_adf_values['openSAMType'] ) ) { dump_check_value( $DumpTable, $InvalidMsg, "Compose Email URL", $opensam_adf_values['openSAMComposeEmailURI'], true ); } if( false !== has_nested_value( 'addressbook', $opensam_adf_values['openSAMType'] ) ) { dump_check_value( $DumpTable, $InvalidMsg, "Address Book URL (LDAP)", $opensam_adf_values['openSAMAddressBookURI'], true ); } } // Gather File Types: $file_types_handled = ""; if( is_nested_value( $opensam_adf_values['fileTypes'] ) ) { $file_types_handled = implode_values( ", ", $opensam_adf_values['fileTypes'] ); } dump_check_value( $DumpTable, $InvalidMsg, "File Types Handled", $file_types_handled ); dump_check_value( $DumpTable, $InvalidMsg, "Home Page", $opensam_adf_values['homePage'], true ); dump_check_value( $DumpTable, $InvalidMsg, "Help Page", $opensam_adf_values['helpPage'], true ); dump_check_value( $DumpTable, $InvalidMsg, "Signup Page", $opensam_adf_values['signupPage'], true ); dump_check_value( $DumpTable, $InvalidMsg, "EULA Page", $opensam_adf_values['eulaPage'], true ); dump_value( $DumpTable, "Free Trial Length, in days", $opensam_adf_values['freeTrialDays'] ); dump_value( $DumpTable, "Price", $opensam_adf_values['price'] ); dump_value( $DumpTable, "Hosting Options", $opensam_adf_values['hosting'] ); dump_check_value( $DumpTable, $InvalidMsg, "App Brief Label", $opensam_adf_values['nameLabel'] ); dump_check_value( $DumpTable, $InvalidMsg, "App Tag-line", $opensam_adf_values['nameTagline'] ); $logo_html = ""; $logo_dark_html = "
"; foreach( $opensam_adf_values['logos']['_collection_'] as $alogo ) { if( empty( $alogo['width'] ) ) $InvalidMsg .= "A logo element is missing the width: attribute
"; if( empty( $alogo['height'] ) ) $InvalidMsg .= "A logo element is missing the height: attribute
"; $logo_1img = "    "; $logo_html .= $logo_1img; $logo_dark_html .= $logo_1img; } $pass_in_value = array( 'value' => $logo_html ); dump_check_value( $DumpTable, $InvalidMsg, "Logos of various sizes", $pass_in_value ); $pass_in_value = array( 'value' => $logo_dark_html . "
" ); dump_check_value( $DumpTable, $InvalidMsg, "Logos on gray background (use .png for best results)", $pass_in_value ); // // WRAP UP and combine messages: // $ErrMsg .= $InvalidMsg . $WarningMsg; $DumpTable .= "
"; //dump_check_value( $DumpTable, $InvalidMsg, "", $opensam_adf_values[''] ); if( empty( $InvalidMsg ) ) $Msg1 .= ". . . . . VALID"; else $Msg1 .= "...INVALID!"; } while( false ); } // Some values we get back in the 'simple' array are have arrays contained in their ['value'] // guy. These are values that correspond to sets of nodes in a or some such. // RETURNS: true if this value is one of those nested array values. function is_nested_value( &$check_this ) { return( array_key_exists( '_collection_', $check_this ) ); } // Does a certain value exist in our nested object? function has_nested_value( $searchvalue, &$collection ) { foreach( $collection['_collection_'] as $oneitem ) { if( array_key_exists( 'value', $oneitem ) && $oneitem['value'] == $searchvalue ) return( true ); } return( false ); } function implode_values( $sep, &$array_with_values ) { if( !is_array( $array_with_values ) || !array_key_exists( '_collection_', $array_with_values ) ) return( "" ); // safety. $ret = ""; $sep2use = ""; foreach( $array_with_values['_collection_'] as $oneval ) { if( array_key_exists( 'value', $oneval ) ) { $ret .= $sep2use . $oneval['value']; $sep2use = $sep; } } return( $ret ); } function dump_value( &$DumpTable, $value_name, $value_value ) { // Values can come in as sub elements in an array or come in directly: if( is_array( $value_value ) ) $value = $value_value['value']; else $value = $value_value; if( !empty( $value ) ) { //if( $fLink ) $value = "".$value.""; $DumpTable .= "$value_name:$value\n"; } } function dump_check_value( &$DumpTable, &$InvalidMsg, $value_name, $value_value, $fLink = false ) { // Values can come in as sub elements in an array or come in directly: if( is_array( $value_value ) ) $value = $value_value['value']; else $value = $value_value; if( empty( $value ) ) $InvalidMsg .= "INVALID: $value_name not supplied
"; else { if( $fLink ) $value = "$value"; $DumpTable .= "$value_name:$value\n"; } } ?> ADF Validator

Application Description File (ADF)

 

Validate and Display ADF

Enter application URL:
  try iNetWord


$Msg1

\n"; } if( !empty( $ErrMsg ) ) { print "

$ErrMsg

\n"; } print "

 

"; if( !empty( $DumpTable ) ) { print "
"; print $DumpTable; print "
"; } ?>