Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated submodule reference for altumo #9

Merged
merged 4 commits into from
Apr 3, 2012
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
12 changes: 11 additions & 1 deletion config/sfAltumoPluginConfiguration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ public function initialize() {
sfConfig::set( 'altumo_javascript_lib_dir', sfConfig::get( 'altumo_plugin_dir' ) . '/lib/vendor/altumo/lib/javascript' );
sfConfig::set( 'altumo_javascript_src_dir', sfConfig::get( 'altumo_plugin_dir' ) . '/lib/vendor/altumo/source/javascript' );

// Set credentials for AWS

/**
* If the AWS module is enabled, set credentials for sdk
*
* To enable, add a section to settings.yml, like so:
* sfAltumoPlugin:
* aws:
* enable: true
* key: "MY_AWS_KE_HERE"
* secret: "MY_AWS_SECRET_HERE"
*/
$aws_configuration = sfConfig::get( 'sf_sfAltumoPlugin_aws', array('enable'=>false) );

if( $aws_configuration['enable'] ){
Expand Down
8 changes: 4 additions & 4 deletions lib/Frontend/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,16 @@ protected function loadLibraries(){
$javascripts['jquery'] = '//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';

// Crockford's JSON library (used by backbone)
$javascripts['json2'] = '/altumo/js/lib/vendor/douglascrockford/json2.js';
$javascripts['json2'] = '/sfAltumoPlugin/js/altumo/vendor/douglascrockford/json2.js';

// Google Closure Base (for dependency management)
$javascripts['closure-base'] = '/altumo/js/lib/vendor/google/closure-library/closure/goog/base.js';
$javascripts['closure-base'] = '/sfAltumoPlugin/js/altumo/vendor/google/closure-library/closure/goog/base.js';

// Underscore
$javascripts['underscore'] = '/sfAltumoPlugin/js/lib/vendor/underscore/underscore-1.3.1-min.js';
$javascripts['underscore'] = '/sfAltumoPlugin/js/altumo/vendor/underscore/underscore-1.3.1-min.js';

// Backbone
$javascripts['backbone'] = '/sfAltumoPlugin/js/lib/vendor/backbone/backbone-0.9.1-min.js';
$javascripts['backbone'] = '/sfAltumoPlugin/js/altumo/vendor/backbone/backbone-0.9.1-min.js';

foreach( $javascripts as $javascript ){

Expand Down
2 changes: 1 addition & 1 deletion lib/task/sfAltumoBuildJavascriptDependenciesTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function execute( $arguments = array(), $options = array() ) {


$command = $deps_writer
. ' --root_with_prefix="' . sfConfig::get( 'sf_web_dir' ) . '/sfAltumoPlugin/js/src' . ' /../../../../../../../../../altumo/js/src"'
. ' --root_with_prefix="' . sfConfig::get( 'sf_web_dir' ) . '/sfAltumoPlugin/js/lib/vendor/altumo' . ' /../../../../../../../../../altumo/js/src"'
. ' --root_with_prefix="' . sfConfig::get( 'sf_web_dir' ) . '/js' . ' /../../../../../../../../../js"'
. ' --output_file="' . sfConfig::get( 'sf_web_dir' ) . '/js/app-deps.js"';

Expand Down
146 changes: 146 additions & 0 deletions modules/sfAltumoPlugin_api_documentation/actions/actions.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?php

/**
* documentation actions.
*
* @package reseller_platform
* @subpackage documentation
* @author Your name here
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class sfAltumoPlugin_api_documentationActions extends sfActions {


/**
* Simple (and temporary) authentication.
*
*/
public function preExecute(){

$expected_username = sfConfig::get( 'app_api_documentation_username', 'api' );
$expected_password = sfConfig::get( 'app_api_documentation_password', 'api' );

if (!isset($_SERVER['PHP_AUTH_USER'])) {

header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Unable to authenticate';
exit;

} else {

if( $_SERVER['PHP_AUTH_USER'] != $expected_username || $_SERVER['PHP_AUTH_PW'] != $expected_password ){
echo 'Unable to authenticate';
exit;
}

}

}


/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request){
$this->forward('default', 'module');
}


/**
* Shows the API Documentation page based on a json documentation file corresponding to api_version.
*
* @param sfWebRequest $request
* @return mixed
*/
public function executeViewDocumentation( sfWebRequest $request ){

$api_version = $request->getParameter( 'api_version', '1.0' );

sfContext::getInstance()->getConfiguration()->loadHelpers( array( 'Url' ) );

// Pass the location of the JSON documentation to the template
$this->documentation_json_route = url_for( '@api_documentation_data_version?api_version=' . $api_version );

return 'Success';
}


/**
* Returns the documentation JSON data with the javascript contenttype.
*
* @param sfWebRequest $request
*/
public function executeGetDocumentationData( sfWebRequest $request ){

$api_version = $request->getParameter( 'api_version', '1.0' );

$this->setLayout( false );
$this->getResponse()->setContentType('application/javascript');

$this->getResponse()->setHttpHeader( 'Expires', 'Mon, 20 Dec 1998 01:00:00 GMT' );
$this->getResponse()->setHttpHeader( 'Last-Modified', gmdate("D, d M Y H:i:s") . " GMT" );
$this->getResponse()->setHttpHeader( 'Cache-Control', 'no-cache, must-revalidate' );
$this->getResponse()->setHttpHeader( 'Pragma', 'no-cache' );

$this->renderText( $this->getApiDocumentationJsonData($api_version) );

return sfView::NONE;
}


/**
* Reads the api documentation JSON file for the given api version and returns it (as a string).
*
* @param mixed $api_version
* @return string
*/
protected function getApiDocumentationJsonData( $api_version ){

//determine the documenation path
$json_data_path = sfConfig::get( 'sf_app_dir' ) . "/data/api_docs/{$api_version}";

//read the layout contents
$layout_file_path = $json_data_path . "/layout.json";
if( !is_readable( $layout_file_path ) ){
throw new Exception( "Cannot read <{$layout_file_path}>" );
}
$template_contents = file_get_contents( $layout_file_path );

//read all of the method files and concatenate them (with a , separating them)
$method_files = sfFinder::type('file')->name('*.json')->in( $json_data_path . '/methods' );
$methods = array();
foreach( $method_files as $method_file ){
$methods[] = file_get_contents( $method_file );
}
$all_methods = implode(', ', $methods);

//read all of the event files and concatenate them (with a , separating them)
$event_files = sfFinder::type('file')->name('*.json')->in( $json_data_path . '/events' );
$events = array();
foreach( $event_files as $event_file ){
$events[] = file_get_contents( $event_file );
}
$all_events = implode(', ', $events);


//compile all of the parts and return the full json document as a string
$suffix = <<<SUFFIX

"objects" : {
$all_methods
},

"events": {
$all_events
}
}

SUFFIX;

return $template_contents . $suffix;

}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

use_javascript( 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' );
use_javascript( '/sfAltumoPlugin/js/lib/vendor/json-org/json.js' );
//use_javascript( '/js/api/widgets/alApiDocumentationBrowserWidget.js' );
use_javascript( '/sfAltumoPlugin/js/lib/vendor/sencha/ext-4.0.2a/bootstrap.js' );

use_javascript( '/sfAltumoPlugin/js/api/documentation/ApiClient.js' );
use_javascript( '/sfAltumoPlugin/js/api/documentation/Documentation.js' );

//use_stylesheet( '/css/blueprint/screen.css' );
use_stylesheet( '/sfAltumoPlugin/js/lib/vendor/sencha/ext-4.0.2a/resources/css/ext-all.css' );
use_stylesheet( '/sfAltumoPlugin/css/api/documentation.css' );

?>
<script type="text/javascript">

Ext.Loader.setConfig({enabled: true});

Ext.require([
'Ext.grid.*',
'Ext.tree.*',
'Ext.data.*',
'Ext.util.*',
'Ext.Action',
'Ext.tab.*',
'Ext.button.*',
'Ext.form.*',
'Ext.layout.container.Card',
'Ext.layout.container.Border'
]);

Ext.onReady(function(){

var app = new Documentation.App({
<?php if( !in_array( sfConfig::get('sf_environment'), array( 'production' ) ) ): ?>
default_authorization_header: "Basic czEPgiRdcAPIedJGOpMFbNwyuDKkzCqP",
<?php endif; ?>
documentation_data_route: "<?php echo $documentation_json_route; ?>",
border: 0,
frame:false
});
});
</script>
<div id="api_documentation_body">
</div>
95 changes: 95 additions & 0 deletions web/css/api/api.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@


body{
font-family: Trebuchet MS,sans-serif;

}


#panda{

text-align: center;

}


.category, .request{
padding-left: 40px;
}

.category_contents{
padding-left: 20px;
margin-bottom: 15px;
}

h1,h2{
padding: 11px 11px 11px 18px;
-moz-border-radius: 10px;
border-radius: 10px;
}

h1{
border-bottom: 1px solid black;
}

h2{
background-color: #EEEEEE;
margin-left: 20px;

font-family: Trebuchet MS,sans-serif;
font-weight: bold;

}


.request{
margin-bottom: 50px;
}

.request_label{
font-weight: bold;
}
.request_header{
padding: 20px;
background-color: #eeeeee;
margin-bottom: 20px;
}
.request_header div{
margin-bottom: 10px;
}
.request_body{
padding-left: 20px;
}

.example_code{
overflow: hidden;
white-space: pre-wrap;
padding: 10px;
border: 1px dashed #008e98;
background-color: #cdf5f8;
}


.parameters{
margin-left: 10px;
margin-top: 10px;
margin-bottom: 20px;
width: 859px;
border-right: 1px solid #cccccc;
}

.parameters td{
vertical-align: top;
border-left: 1px solid #cccccc;
border-bottom: 1px solid #cccccc;
}



.disabled{
text-decoration: line-through;
color: #bbbbbb;
}
.disabled a{
color: #bbbbbb;
}
Loading