repo
string
commit
string
message
string
diff
string
valaravena/Glo
95adda8e70d10827357e6212256180258281a52d
Adding Schema
diff --git a/app/config/schema/schema.php b/app/config/schema/schema.php index cf73222..011401d 100644 --- a/app/config/schema/schema.php +++ b/app/config/schema/schema.php @@ -1,118 +1,133 @@ <?php /* SVN FILE: $Id$ */ -/* App schema generated on: 2010-08-23 17:08:55 : 1282597675*/ +/* App schema generated on: 2010-09-15 16:09:38 : 1284583118*/ class AppSchema extends CakeSchema { var $name = 'App'; function before($event = array()) { return true; } function after($event = array()) { } var $account_types = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => false, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'indexes' => array(), 'tableParameters' => array() ); var $accounts = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'account_type_id' => array('type' => 'text', 'null' => false, 'default' => NULL, 'length' => 11), 'user_id' => array('type' => 'text', 'null' => false, 'default' => NULL, 'length' => 11), 'first_name' => array('type' => 'string', 'null' => false, 'default' => NULL), 'last_name' => array('type' => 'string', 'null' => false, 'default' => NULL), + 'bio' => array('type' => 'text', 'null' => true, 'default' => NULL), + 'location' => array('type' => 'string', 'null' => true, 'default' => NULL), 'date_of_birth' => array('type' => 'date', 'null' => true, 'default' => NULL), 'gender_id' => array('type' => 'text', 'null' => true, 'default' => NULL, 'length' => 11), - 'email' => array('type' => 'string', 'null' => false, 'default' => NULL), 'image' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'newsletter' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 1), 'active' => array('type' => 'text', 'null' => true, 'default' => NULL, 'length' => 1), 'key' => array('type' => 'string', 'null' => true, 'default' => NULL), 'source_id' => array('type' => 'text', 'null' => true, 'default' => NULL, 'length' => 11), 'source_extra' => array('type' => 'string', 'null' => true, 'default' => NULL), 'ip' => array('type' => 'string', 'null' => true, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'indexes' => array(), 'tableParameters' => array() ); var $acos = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'indexes' => array(), 'tableParameters' => array() ); var $aros = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'indexes' => array(), 'tableParameters' => array() ); var $aros_acos = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'aro_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), 'aco_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), 'indexes' => array(), 'tableParameters' => array() ); var $core_resources = array( - 'code' => array('type' => 'string', 'null' => false, 'default' => NULL, 'key' => 'primary', 'length' => 50), + 'code' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 50, 'key' => 'primary'), 'version' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 50), - 'indexes' => array('PRIMARY' => array('column' => 'code', 'unique' => 1)), + 'indexes' => array(), 'tableParameters' => array() ); var $genders = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => false, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'indexes' => array(), 'tableParameters' => array() ); var $groups = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'indexes' => array(), 'tableParameters' => array() ); + var $pages = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'name' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'title' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'meta_description' => array('type' => 'text', 'null' => true, 'default' => NULL), + 'meta_keywords' => array('type' => 'text', 'null' => true, 'default' => NULL), + 'slug' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'content' => array('type' => 'text', 'null' => true, 'default' => NULL), + 'top_show' => array('type' => 'boolean', 'null' => false, 'default' => '0'), + 'bottom_show' => array('type' => 'boolean', 'null' => false, 'default' => '0'), + 'top_order' => array('type' => 'text', 'null' => true, 'default' => '0', 'length' => 3), + 'bottom_order' => array('type' => 'text', 'null' => true, 'default' => '0', 'length' => 3), + 'indexes' => array(), + 'tableParameters' => array() + ); var $sources = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'indexes' => array(), 'tableParameters' => array() ); var $users = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'group_id' => array('type' => 'integer', 'null' => false, 'default' => NULL), 'username' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100), - 'first_name' => array('type' => 'string', 'null' => true, 'default' => NULL), - 'last_name' => array('type' => 'string', 'null' => true, 'default' => NULL), 'password' => array('type' => 'string', 'null' => false, 'default' => NULL), 'email' => array('type' => 'string', 'null' => true, 'default' => NULL), 'active' => array('type' => 'boolean', 'null' => false, 'default' => NULL), - 'key' => array('type' => 'string', 'null' => false), + 'key' => array('type' => 'string', 'null' => false, 'default' => NULL), 'ip' => array('type' => 'string', 'null' => false, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), 'indexes' => array(), 'tableParameters' => array() ); } ?> \ No newline at end of file diff --git a/app/plugins/core/config/schema/schema.php b/app/plugins/core/config/schema/schema.php index 1a00849..7767035 100644 --- a/app/plugins/core/config/schema/schema.php +++ b/app/plugins/core/config/schema/schema.php @@ -1,67 +1,67 @@ <?php /* SVN FILE: $Id$ */ -/* App schema generated on: 2010-08-23 17:08:25 : 1282597945*/ +/* App schema generated on: 2010-09-15 16:09:03 : 1284583143*/ class AppSchema extends CakeSchema { var $name = 'App'; function before($event = array()) { return true; } function after($event = array()) { } var $acos = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'indexes' => array(), 'tableParameters' => array() ); var $aros = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'indexes' => array(), 'tableParameters' => array() ); var $aros_acos = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'aro_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), 'aco_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), 'indexes' => array(), 'tableParameters' => array() ); var $setting_datas = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'setting_id' => array('type' => 'text', 'null' => true, 'default' => NULL, 'length' => 11), 'key' => array('type' => 'string', 'null' => true, 'default' => NULL), 'value' => array('type' => 'text', 'null' => true, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'indexes' => array(), 'tableParameters' => array() ); var $settings = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => true, 'default' => NULL), 'type' => array('type' => 'string', 'null' => true, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'indexes' => array(), 'tableParameters' => array() ); } ?> \ No newline at end of file diff --git a/app/plugins/simple_geo/config/schema/schema.php b/app/plugins/simple_geo/config/schema/schema.php index 9d8201b..5d5bdb2 100644 --- a/app/plugins/simple_geo/config/schema/schema.php +++ b/app/plugins/simple_geo/config/schema/schema.php @@ -1,58 +1,58 @@ <?php /* SVN FILE: $Id$ */ -/* App schema generated on: 2010-09-01 17:09:45 : 1283378385*/ +/* App schema generated on: 2010-09-15 16:09:54 : 1284583194*/ class AppSchema extends CakeSchema { var $name = 'App'; function before($event = array()) { return true; } function after($event = array()) { } var $acos = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'indexes' => array(), 'tableParameters' => array() ); var $aros = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), 'indexes' => array(), 'tableParameters' => array() ); var $aros_acos = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'aro_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), 'aco_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), 'indexes' => array(), 'tableParameters' => array() ); var $simple_geo_layers = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), 'name' => array('type' => 'string', 'null' => false, 'default' => NULL), 'title' => array('type' => 'string', 'null' => false, 'default' => NULL), 'description' => array('type' => 'text', 'null' => true, 'default' => NULL), 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), 'indexes' => array(), 'tableParameters' => array() ); } ?> \ No newline at end of file
valaravena/Glo
afc799604d7ddc32a5dad8dd006679f325826ee0
Adding Update to Map and options
diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index 3b06435..74d2045 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,145 +1,144 @@ <?php echo $javascript->link("http://www.google.com/jsapi"); echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); echo $javascript->codeBlock(); ?> var infowindow; $(document).ready(function() { var myOptions = { zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false }; var map = new google.maps.Map(document.getElementById("map"), myOptions); var mapDrag = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'dragend', mapDrag, true); var mapZoom = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'zoom_changed', mapZoom, true); if (geocoder) { geocoder.geocode({'address': "<?php echo $account['Account']['location'];?>"}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); updateLayer(results[0].geometry.location); } else { } } ); } function updateLayer(latlng) { var epm_data = [ {"epm":56,"ame":2300,"ami":"Yes","renew":"CNG","ev":"No","leed":"NOT CERTIFIED"}, {"epm":67,"ame":1800,"ami":"Yes","renew":"NOT CERTIFIED","ev":"No","leed":"NOT CERTIFIED"}, {"epm":45,"ame":2546,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":88,"ame":3050,"ami":"No","renew":"CNG","ev":"No","leed":"CERTIFIED"}, {"epm":44,"ame":1457,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":87,"ame":2199,"ami":"Yes","renew":"CNG","ev":"No","leed":"SILVER"}, {"epm":77,"ame":2892,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":35,"ame":1913,"ami":"Yes","renew":"SOLAR","0":"CNG","ev":"No","leed":"NOT CERTIFIED"}, {"epm":96,"ame":3520,"ami":"Yes","renew":"SOLAR","ev":"Yes","leed":"PLATINUM"}, {"epm":58,"ame":4200,"ami":"No","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":67,"ame":2765,"ami":"No","renew":"NONE","ev":"No","leed":"GOLD"}, {"epm":59,"ame":1965,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":68,"ame":3275,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":37,"ame":2134,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":52,"ame":2755,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":85,"ame":3877,"ami":"Yes","renew":"NONE","ev":"Yes","leed":"CERTIFIED"}, {"epm":34,"ame":2433,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":66,"ame":1933,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":87,"ame":1456,"ami":"No","renew":"SOLAR","ev":"No","leed":"CERTIFIED"}, {"epm":84,"ame":2345,"ami":"Yes","renew":"NONE","ev":"No","leed":"SILVER"}, {"epm":76,"ame":2756,"ami":"Yes","renew":"NONE","ev":"No","leed":"CERTIFIED"}, {"epm":56,"ame":4234,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":74,"ame":3244,"ami":"No","renew":"SOLAR","0":"CNG","ev":"Yes","leed":"NOT CERTIFIED"}, {"epm":73,"ame":1655,"ami":"Yes","renew":"SOLAR","ev":"No","leed":"NOT CERTIFIED"}, {"epm":62,"ame":4266,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":45,"ame":2311,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":52,"ame":1966,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":60,"ame":1077,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":28,"ame":2234,"ami":"No","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, {"epm":65,"ame":3200,"ami":"Yes","renew":"NONE","ev":"No","leed":"CERTIFIED"} ]; $.ajax({ url: "/simple_geo/simple_geo/nearby/?hash="+latlng.toUrlValue(), dataType: 'json', success: function(result) { $.each(result, function(i, data) { var latlng = new google.maps.LatLng(data.Point.latitude,data.Point.longitude); var recordNum = i % epm_data.length; var imgNum = ((epm_data[recordNum].epm%10)*10); var content = '<div class="map_popup" style="padding:0;margin:0;width:250px;">'+ '<h2 class="title" style="border-bottom: 1px solid #000">'+data.Point.name+'</h2>'+ '<div style="padding:5px 0; margin:5px 0;border-bottom:1px solid #000;overflow:hidden"><strong>EPM-Premise Rating:</strong> '+epm_data[recordNum].epm+'<br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ '<p><strong>Avg. Monthly Usage:</strong> '+epm_data[recordNum].ame+' kWh</p>'+ '<p><strong>AMI Ready:</strong> '+epm_data[recordNum].ami+'<br />'+ '<p><strong>Renewable Sources:</strong> '+epm_data[recordNum].renew+'</p>'+ '<p><strong>EV Charging Station:</strong> '+epm_data[recordNum].ev+'</p>'+ '<p><strong>LEED Certification:</strong> '+epm_data[recordNum].leed+'</p>'+ '</div>'; var marker = new google.maps.Marker({ position: latlng, map: map, icon: "/img/SGBluePin.png" }); google.maps.event.addListener(marker, 'click', function() { if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({content: content}); infowindow.open(map,marker); $('.map_popup').parent().parent().css('overflow','hidden'); $('.map_popup').parent().css('overflow','hidden'); }); - map.setCenter(latlng); }); } }); } }); <?php echo $javascript->blockEnd();?> <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div> <div id="map"style="width:100%; height: 500px;" ></div> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> </div>
valaravena/Glo
8341998fb83c2d41db9df75aca5d07a9271a99ca
Adding Update to Map and options
diff --git a/app/plugins/simple_geo/controllers/simple_geo_controller.php b/app/plugins/simple_geo/controllers/simple_geo_controller.php index b72301c..6bd5c92 100644 --- a/app/plugins/simple_geo/controllers/simple_geo_controller.php +++ b/app/plugins/simple_geo/controllers/simple_geo_controller.php @@ -1,50 +1,50 @@ <?php class SimpleGeoController extends SimpleGeoAppController { var $name = "SimpleGeo"; var $uses = array('SimpleGeo.SimpleGeo'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('records'); } function admin_index() { $this->set('title_for_layout', __('Simple Geo', true)); } function nearby() { $this->layout = 'ajax'; $simpleGeoLayer = 'com.simplegeo.us.business'; $points = array(); if (!empty($simpleGeoLayer)) { if (!empty($this->params['url']['hash'])) { - $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('radius' => 200, 'limit' => 30)); + $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50)); if (!empty($result->features)) { foreach ($result->features as $feature) { $point['Point']['id'] = $feature->id; $point['Point']['name'] = $feature->properties->std_name; $point['Point']['longitude'] = $feature->geometry->coordinates[0]; $point['Point']['latitude'] = $feature->geometry->coordinates[1]; $point['Point']['created'] = $feature->created; $points[] = $point; } } else { if (!empty($result->message)) { #die($result->message); } } } $this->set('points', $points); } } function records($id = null, $simpleGeoLayer = null) { } } \ No newline at end of file diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index bd0ab04..3b06435 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,145 +1,145 @@ <?php echo $javascript->link("http://www.google.com/jsapi"); echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); echo $javascript->codeBlock(); ?> var infowindow; $(document).ready(function() { var myOptions = { zoom: 12, - mapTypeId: google.maps.MapTypeId.SATELLITE, + mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false }; var map = new google.maps.Map(document.getElementById("map"), myOptions); var mapDrag = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'dragend', mapDrag, true); var mapZoom = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'zoom_changed', mapZoom, true); if (geocoder) { geocoder.geocode({'address': "<?php echo $account['Account']['location'];?>"}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); updateLayer(results[0].geometry.location); } else { } } ); } function updateLayer(latlng) { var epm_data = [ - {"epm":56,"ame":2300,"ami":1,"renew":"CNG","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":67,"ame":1800,"ami":1,"renew":"NOT CERTIFIED","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":45,"ame":2546,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":88,"ame":3050,"ami":0,"renew":"CNG","ev":0,"leed":"CERTIFIED"}, - {"epm":44,"ame":1457,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":87,"ame":2199,"ami":1,"renew":"CNG","ev":0,"leed":"SILVER"}, - {"epm":77,"ame":2892,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":35,"ame":1913,"ami":1,"renew":"SOLAR","0":"CNG","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":96,"ame":3520,"ami":1,"renew":"SOLAR","ev":1,"leed":"PLATINUM"}, - {"epm":58,"ame":4200,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":67,"ame":2765,"ami":0,"renew":"NONE","ev":0,"leed":"GOLD"}, - {"epm":59,"ame":1965,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":68,"ame":3275,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":37,"ame":2134,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":52,"ame":2755,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":85,"ame":3877,"ami":1,"renew":"NONE","ev":1,"leed":"CERTIFIED"}, - {"epm":34,"ame":2433,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":66,"ame":1933,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":87,"ame":1456,"ami":0,"renew":"SOLAR","ev":0,"leed":"CERTIFIED"}, - {"epm":84,"ame":2345,"ami":1,"renew":"NONE","ev":0,"leed":"SILVER"}, - {"epm":76,"ame":2756,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"}, - {"epm":56,"ame":4234,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":74,"ame":3244,"ami":0,"renew":"SOLAR","0":"CNG","ev":1,"leed":"NOT CERTIFIED"}, - {"epm":73,"ame":1655,"ami":1,"renew":"SOLAR","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":62,"ame":4266,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":45,"ame":2311,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":52,"ame":1966,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":60,"ame":1077,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":28,"ame":2234,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, - {"epm":65,"ame":3200,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"} + {"epm":56,"ame":2300,"ami":"Yes","renew":"CNG","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":67,"ame":1800,"ami":"Yes","renew":"NOT CERTIFIED","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":45,"ame":2546,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":88,"ame":3050,"ami":"No","renew":"CNG","ev":"No","leed":"CERTIFIED"}, + {"epm":44,"ame":1457,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":87,"ame":2199,"ami":"Yes","renew":"CNG","ev":"No","leed":"SILVER"}, + {"epm":77,"ame":2892,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":35,"ame":1913,"ami":"Yes","renew":"SOLAR","0":"CNG","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":96,"ame":3520,"ami":"Yes","renew":"SOLAR","ev":"Yes","leed":"PLATINUM"}, + {"epm":58,"ame":4200,"ami":"No","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":67,"ame":2765,"ami":"No","renew":"NONE","ev":"No","leed":"GOLD"}, + {"epm":59,"ame":1965,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":68,"ame":3275,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":37,"ame":2134,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":52,"ame":2755,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":85,"ame":3877,"ami":"Yes","renew":"NONE","ev":"Yes","leed":"CERTIFIED"}, + {"epm":34,"ame":2433,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":66,"ame":1933,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":87,"ame":1456,"ami":"No","renew":"SOLAR","ev":"No","leed":"CERTIFIED"}, + {"epm":84,"ame":2345,"ami":"Yes","renew":"NONE","ev":"No","leed":"SILVER"}, + {"epm":76,"ame":2756,"ami":"Yes","renew":"NONE","ev":"No","leed":"CERTIFIED"}, + {"epm":56,"ame":4234,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":74,"ame":3244,"ami":"No","renew":"SOLAR","0":"CNG","ev":"Yes","leed":"NOT CERTIFIED"}, + {"epm":73,"ame":1655,"ami":"Yes","renew":"SOLAR","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":62,"ame":4266,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":45,"ame":2311,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":52,"ame":1966,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":60,"ame":1077,"ami":"Yes","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":28,"ame":2234,"ami":"No","renew":"NONE","ev":"No","leed":"NOT CERTIFIED"}, + {"epm":65,"ame":3200,"ami":"Yes","renew":"NONE","ev":"No","leed":"CERTIFIED"} ]; $.ajax({ url: "/simple_geo/simple_geo/nearby/?hash="+latlng.toUrlValue(), dataType: 'json', success: function(result) { $.each(result, function(i, data) { var latlng = new google.maps.LatLng(data.Point.latitude,data.Point.longitude); var recordNum = i % epm_data.length; var imgNum = ((epm_data[recordNum].epm%10)*10); var content = '<div class="map_popup" style="padding:0;margin:0;width:250px;">'+ '<h2 class="title" style="border-bottom: 1px solid #000">'+data.Point.name+'</h2>'+ - '<div style="padding:5px 0; margin:5px 0;border-bottom:1px solid #000;overflow:hidden"><strong>EPM-Premise Rating:</strong><br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ - - '<p><strong>Avg. Monthly Usage:</strong> '+epm_data[recordNum].ame+'</p>'+ + '<div style="padding:5px 0; margin:5px 0;border-bottom:1px solid #000;overflow:hidden"><strong>EPM-Premise Rating:</strong> '+epm_data[recordNum].epm+'<br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ + + '<p><strong>Avg. Monthly Usage:</strong> '+epm_data[recordNum].ame+' kWh</p>'+ '<p><strong>AMI Ready:</strong> '+epm_data[recordNum].ami+'<br />'+ '<p><strong>Renewable Sources:</strong> '+epm_data[recordNum].renew+'</p>'+ '<p><strong>EV Charging Station:</strong> '+epm_data[recordNum].ev+'</p>'+ - '<p><strong>LEED Certifications:</strong> '+epm_data[recordNum].leed+'</p>'+ + '<p><strong>LEED Certification:</strong> '+epm_data[recordNum].leed+'</p>'+ '</div>'; var marker = new google.maps.Marker({ position: latlng, map: map, icon: "/img/SGBluePin.png" }); google.maps.event.addListener(marker, 'click', function() { if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({content: content}); infowindow.open(map,marker); $('.map_popup').parent().parent().css('overflow','hidden'); $('.map_popup').parent().css('overflow','hidden'); }); map.setCenter(latlng); }); } }); } }); <?php echo $javascript->blockEnd();?> <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div> <div id="map"style="width:100%; height: 500px;" ></div> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> </div>
valaravena/Glo
90dfaa06f240baa9261946cac6871364313a8d45
Adding update
diff --git a/app/controllers/users_controller.php b/app/controllers/users_controller.php index f628aa6..f821a8c 100644 --- a/app/controllers/users_controller.php +++ b/app/controllers/users_controller.php @@ -1,306 +1,307 @@ <?php class UsersController extends AppController { var $name = 'Users'; var $components = array('Recaptcha'); var $helpers = array('Recaptcha', 'SimpleGeo.GoogleMap'); var $uses = array('SimpleGeo.SimpleGeo'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); if (!empty($this->Auth)) { $this->Auth->allow('activate', 'register', 'reset', 'recover', 'resend', 'login', 'logout'); $this->Auth->allow('*'); } } - function index() { + function index() { + $this->set('title_for_layout', __('Account', true)); if ($this->Session->check('Auth.User')) { $simpleGeoLayer = 'iWobbleTestLayer'; $points = array(); if (!empty($simpleGeoLayer)) { if (!empty($this->params['url']['hash'])) { $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); if (!empty($result->features)) { foreach ($result->features as $feature) { $point['Point']['id'] = $feature->id; $point['Point']['name'] = $feature->id; $point['Point']['longitude'] = $feature->geometry->coordinates[0]; $point['Point']['latitude'] = $feature->geometry->coordinates[1]; $point['Point']['created'] = $feature->created; $points[] = $point; } } else { if (!empty($result->message)) { #die($result->message); } } } $this->set('points', $points); } } else { $this->redirect('/login'); } } function login() { $this->set('title_for_layout', __('Login', true)); if (!empty($this->data)) { if (!empty($this->data['User']['remember_me']) && $this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function register($status = '') { $this->set('title_for_layout', __('Register with Gridglo', true)); if (!$this->Session->check('Auth.User')) { if (!empty($this->data)) { $this->data['User']['group_id'] = 3; $this->data['User']['active'] = 1; if ($user = $this->User->register($this->data)) { $this->_sendEmail($user); $this->Session->write('Registration.email', $user['to']); $this->redirect(array('action' => 'register', 'success')); } else { $this->Session->setFlash(__('We were unable to register your account!', true), 'error'); } } elseif ($status) { if ($this->Session->check('Registration.email')) { $this->set('email', $this->Session->read('Registration.email')); $this->render($this->action.'_'.$status); } else { $this->redirect(array('action' => 'register')); } } } else { $this->redirect('/'); } } function activate($key = null) { if (!$this->Session->check('Auth.User')) { if (!is_null($key)) { if ($user = $this->User->activate($key)) { $this->Auth->login($user); $this->_sendEmail($user); $this->Session->setFlash(__('Your account is verified!', true), 'success'); $this->redirect(array('action' => 'done')); } else { $this->Session->setFlash(__('We were unable to verify you account! Account may already be active.', true), 'error'); $this->redirect(array('action' => 'login')); } } else { $this->redirect(array('action' => 'login')); } } else { $this->redirect('/'); } } function done() { if ($this->Session->check('Auth.User')) { if (!empty($this->data)) { if ($this->Auth->user('id')) { $user = $this->User->read(null, $this->Auth->user('id')); $this->User->save($this->data); $this->Auth->login($user); $this->redirect($this->Auth->redirect('/')); } else { $this->redirect(array('action' => 'login')); } } else { $this->data = $this->Auth->user(); } } else { $this->redirect('/'); } } function skip() { $this->redirect($this->Auth->redirect('/')); // Track User/Insert History // Send to Home Page } function recover() { $this->set('title_for_layout', __('Reset your Password', true)); if (!empty($this->data)) { if ($user = $this->User->recover($this->data)) { $this->_sendEmail($user); $this->Session->setFlash(__('Password Change Email has been sent!', true), 'success'); $this->redirect(array('action' => 'login')); } else { $this->Session->setFlash(__('No user found with that email', true), 'error'); } } } function reset($key = null) { if (!is_null($key)) { if ($user = $this->User->resetKey($key)) { $this->Session->write('Reset.User', $user); } } if ($user = $this->Session->read('Reset.User')) { $this->set('user', $user); if (!empty($this->data)) { if ($this->User->reset($this->data, $user['User']['id'])) { $this->Session->delete('Reset'); $this->redirect('/'); } } } else { $this->redirect('/'); } } function resend($email = null) { if (!is_null($email)) { if ($user = $this->User->resend($email)) { $this->_sendEmail($user); } else { $this->Session->setFlash(__('Unable to send activation email. It may be that the account is already active or the email doesn\'t exisit.', true), 'error'); } } $this->redirect(array('action' => 'login')); } function changepassword() { $this->layout = 'account'; $this->set('title_for_layout', __('Change Password', true)); if (!empty($this->data)) { if ($user = $this->User->reset($this->data)) { $this->Session->setFlash(__('Password Change Email has been sent!', true), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Unable to change your password. Please try again.', true), 'error'); $this->redirect(array('action' => 'changepassword')); } } } function admin_login() { $this->set('title_for_layout', __('Administration Login', true)); $this->layout = "admin_login"; if (!empty($this->data)) { if ($this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function admin_logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function admin_index() { $this->set('title_for_layout', __('Users', true)); $this->User->recursive = 0; $this->set('users', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } $this->set('user', $this->User->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->User->create(); if ($this->User->register($this->data)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } $this->set('title_for_layout', sprintf(__('Add %s', true), 'User')); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->User->register($this->data, $id)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } if (empty($this->data)) { $this->data = $this->User->read(null, $id); } $this->set('title_for_layout', sprintf(__('Edit "%s"', true), $this->data['User']['username'])); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid id for %s', true), 'User')); $this->redirect(array('action' => 'index')); } if ($this->User->delete($id)) { $this->Session->setFlash(sprintf(__('%s deleted', true), 'User')); $this->redirect(array('action' => 'index')); } } /* API STUFF */ function authenticate() { $user = array(); if ($this->Auth->user('id')) { $this->log('Logged in as '. $this->Auth->user('username')); $user = $this->User->Account->getAccountByIdOrUsername($this->Auth->user('id')); } $this->set(compact('user')); } }
valaravena/Glo
377120c0c9ed1fcfa88925191e9d35a58ac3f8bd
Adding update
diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index 3c2ce60..bd0ab04 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,142 +1,145 @@ <?php echo $javascript->link("http://www.google.com/jsapi"); echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); echo $javascript->codeBlock(); ?> var infowindow; $(document).ready(function() { var myOptions = { zoom: 12, mapTypeId: google.maps.MapTypeId.SATELLITE, streetViewControl: false }; var map = new google.maps.Map(document.getElementById("map"), myOptions); var mapDrag = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'dragend', mapDrag, true); var mapZoom = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'zoom_changed', mapZoom, true); if (geocoder) { geocoder.geocode({'address': "<?php echo $account['Account']['location'];?>"}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); updateLayer(results[0].geometry.location); } else { } } ); } function updateLayer(latlng) { var epm_data = [ {"epm":56,"ame":2300,"ami":1,"renew":"CNG","ev":0,"leed":"NOT CERTIFIED"}, {"epm":67,"ame":1800,"ami":1,"renew":"NOT CERTIFIED","ev":0,"leed":"NOT CERTIFIED"}, {"epm":45,"ame":2546,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":88,"ame":3050,"ami":0,"renew":"CNG","ev":0,"leed":"CERTIFIED"}, {"epm":44,"ame":1457,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":87,"ame":2199,"ami":1,"renew":"CNG","ev":0,"leed":"SILVER"}, {"epm":77,"ame":2892,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":35,"ame":1913,"ami":1,"renew":"SOLAR","0":"CNG","ev":0,"leed":"NOT CERTIFIED"}, {"epm":96,"ame":3520,"ami":1,"renew":"SOLAR","ev":1,"leed":"PLATINUM"}, {"epm":58,"ame":4200,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":67,"ame":2765,"ami":0,"renew":"NONE","ev":0,"leed":"GOLD"}, {"epm":59,"ame":1965,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":68,"ame":3275,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":37,"ame":2134,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":52,"ame":2755,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":85,"ame":3877,"ami":1,"renew":"NONE","ev":1,"leed":"CERTIFIED"}, {"epm":34,"ame":2433,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":66,"ame":1933,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":87,"ame":1456,"ami":0,"renew":"SOLAR","ev":0,"leed":"CERTIFIED"}, {"epm":84,"ame":2345,"ami":1,"renew":"NONE","ev":0,"leed":"SILVER"}, {"epm":76,"ame":2756,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"}, {"epm":56,"ame":4234,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":74,"ame":3244,"ami":0,"renew":"SOLAR","0":"CNG","ev":1,"leed":"NOT CERTIFIED"}, {"epm":73,"ame":1655,"ami":1,"renew":"SOLAR","ev":0,"leed":"NOT CERTIFIED"}, {"epm":62,"ame":4266,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":45,"ame":2311,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":52,"ame":1966,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":60,"ame":1077,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":28,"ame":2234,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":65,"ame":3200,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"} ]; $.ajax({ url: "/simple_geo/simple_geo/nearby/?hash="+latlng.toUrlValue(), dataType: 'json', success: function(result) { - $.each(result, function(i, data) { + $.each(result, function(i, data) { var latlng = new google.maps.LatLng(data.Point.latitude,data.Point.longitude); var recordNum = i % epm_data.length; var imgNum = ((epm_data[recordNum].epm%10)*10); - var content = '<div class="map_popup" style="padding:0;margin:0;overflow:hidden">'+ - '<h2 class="title">'+data.Point.name+'</h2>'+ - '<hr />'+ - '<div><strong>EPM-Premise Rating:</strong><br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ - '<hr />'+ + var content = '<div class="map_popup" style="padding:0;margin:0;width:250px;">'+ + '<h2 class="title" style="border-bottom: 1px solid #000">'+data.Point.name+'</h2>'+ + + '<div style="padding:5px 0; margin:5px 0;border-bottom:1px solid #000;overflow:hidden"><strong>EPM-Premise Rating:</strong><br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ + '<p><strong>Avg. Monthly Usage:</strong> '+epm_data[recordNum].ame+'</p>'+ '<p><strong>AMI Ready:</strong> '+epm_data[recordNum].ami+'<br />'+ '<p><strong>Renewable Sources:</strong> '+epm_data[recordNum].renew+'</p>'+ '<p><strong>EV Charging Station:</strong> '+epm_data[recordNum].ev+'</p>'+ '<p><strong>LEED Certifications:</strong> '+epm_data[recordNum].leed+'</p>'+ '</div>'; var marker = new google.maps.Marker({ position: latlng, map: map, icon: "/img/SGBluePin.png" }); google.maps.event.addListener(marker, 'click', function() { if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({content: content}); - infowindow.open(map,marker); + infowindow.open(map,marker); + $('.map_popup').parent().parent().css('overflow','hidden'); + $('.map_popup').parent().css('overflow','hidden'); + }); map.setCenter(latlng); }); } }); } }); <?php echo $javascript->blockEnd();?> <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div> <div id="map"style="width:100%; height: 500px;" ></div> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> </div> diff --git a/app/webroot/css/style.css b/app/webroot/css/style.css index 6fe01ef..58418b5 100644 --- a/app/webroot/css/style.css +++ b/app/webroot/css/style.css @@ -1,232 +1,233 @@ /** document general options **/ body{font:9pt Tahoma,Helvetica,Arial,Tahoma,sans-serif;background:#d3ebfd;} body,html{height:100%} span.clearFix{width:100%;height:0px;visibility:hidden;clear:both;display:block;margin:0;padding:0;font-size:0px;} .hidden{display:none;} /** button stylings **/ div.inner-nav{clear:both;margin:10px 0;} a.button{display:inline-block;background:url(../../img/admin/bg-buttons-left.gif) no-repeat;text-decoration:none;height:21px;padding:0 0 0 15px;color:#fff;font-weight:bold;font-size:9pt;} div.inner-nav a:hover,a.button:hover{color:#333;} div.inner-nav a span,a.button span{display:block;background:url(../../img/admin/bg-buttons-right.gif) no-repeat right;padding:0 15px 0 0;line-height:21px;} .align-left{float:left;} .align-right{float:right;} /** text colors assigned to elements in various areas **/ .yellow{color:#e8e4a2;} .light-blue{color:#a6b7c0;} .blue{color:#508db8 !important;} .light-grey{color:#d7d7d7} .white{color:#fff;} img{border:0;} p{font-size:13px;} h2{margin:0 5px 5px 0;padding:0;font-size:20px;font-weight:bold;} h2 span{color:#ff931f;text-transform:uppercase;font-weight:bold;} h2.login{padding:5px;color:#ffad1f;padding-left:35px;background:#fff4ca url(../img/h1-pencil.png) no-repeat 10px 50%;} h2.platform{padding:5px;padding-left:35px;color:#5da2d7;background:#e6f2fb url(../img/h1-swoop.png) no-repeat 10px 50%;} div.home_demo{margin: 25px 25px;} ul.login_sub{display:block;list-style:none;} ul.login_sub li{float:left;height:15px;position:relative;border-right:1px solid #508db8;} ul.login_sub li a{text-decoration:none;padding:0 10px;display:inline-block;position:relative;} ul.login_sub li.last{border:0;} div#container{width:960px;position:relative;margin:0 auto;padding:5px 5px;background:#fff;} /** HEADER AND NAVIGATION **/ div#header{background:#fff url(../img/bg.png) repeat-x;height:149px;} /** logo,which is a typographical h1 element (you can edit this part if you want to replace with your logo graphic) **/ div#logo{padding:20px;height:77px;} div#logo h1{font-size:250%;text-transform:uppercase;letter-spacing:-1px;font-weight:bold;float:left;width:450px;/** mac safari & firefox hack */height:39px;/**/} div#logo h1 a{color:#fff;text-decoration:none;} div#logo h1 a:hover{color:#ccc;} /** header userbox **/ p#userbox{float:right;color:#c1cad0;background:url(../img/icon-greet-user.gif) no-repeat 0px 5px;padding:5px 0px 0px 18px;margin:0;} p#userbox a{color:#ceac0f;text-decoration:none;font-weight:bold;} p#userbox a:hover{color:#fff;} p#userbox small{display:block;margin-top:5px;color:#8d9599;font-size:0.9em;} /** menu **/ div#header ul.menu{display:block;list-style:none;background:url(../img/menu-btn.gif) repeat-x;height:32px;} div#header ul.menu li{float:left;height:32px;position:relative;border-right:1px solid #fff;} div#header ul.menu li.last{border:0;} div#header ul.menu li a{color:#717171;text-decoration:none;padding:9px 20px 7px 20px;display:inline-block;text-align:center;text-transform:uppercase;position:relative;} div#header ul.menu li a:hover{background:url(../img/menu-btn-on.gif) repeat-x top left;color:#fff;} /** END OF HEADER **/ /** CONTENT **/ div#content{background:url(../img/content-bg.gif) repeat-y;padding:0;} /** main heading of the page **/ div#content-top{padding:20px 0 0 0;background-color: #599fd4;} div#content-top h2{font-size:200%;font-weight:bold;color:#373d40;margin-left:12px;float:left;} div#content-top p{margin-left:12px;margin-top:5px;} div#content-top p a{color:#508db8;text-decoration:none;} div#content-top p a:hover{color:#333;} div#content-top a#topLink{float:right;background:url(../../img/admin/icon-blue-arrow.gif) no-repeat;display:inline-block;padding-left:23px;text-decoration:none;font-weight:bold;color:#508db8;height:16px;margin-top:10px;margin-right:12px;} div#content-top a#topLink:hover{color:#333;} div#content-top-left{width:681px;height:223px;float:left;position:relative;} div#content-top-right{padding:0 20px;width:239px;height:223px;float:left;background-color:#599fd4;} div#content-top-left:hover a.close { text-decoration: none;background:url('../img/close-button.png') no-repeat;width:25px;height:25px;position:absolute;top:-10px;right:-10px;cursor:pointer;} div#content-top-left a.close span {display: none;} /** Account Heading of the Page *// div#account-top {padding: 20px 0 0 0;background-color:#599fd4;border: 1px solid #666;} div#account-top-left { width:681px;height:25px;float:left;} div#account-top-right{padding: 0 20px;width:239px; height: 25px; float:left;background-color:#B2C8D7;} .profile_image {position:absolute;top:45px;right:20px;background:#DDE5EB;} .profile_image img { margin: 5px;} /** box general settings **/ div.sbox{background:url(../img/sbox-bg.png)repeat-x;height:172px;width:225px;padding:0 10px;} div.sbox p{padding:10px 0;margin:0;color:#fff;font-size:11px;} div.sbox .button{float:right;} .box{float:left;margin:5px;} .box div{margin:0.1em 0 0 0.1em;} .box div.topleft{display:block;background:url("../img/box-bg.png") top left no-repeat;padding:5px 0em 0em -5px;} .box div.topright{display:block;background:url("../img/box-bg.png") top right no-repeat;padding:5px 5px 0 0;margin:-5px 0 0 5px;} .box div.bottomleft{display:block;height:45px;margin-top:-5px;background:url("../img/box-bg.png") bottom left no-repeat;} .box div.bottomright{display:block;background:url("../img/box-bg.png") bottom right no-repeat;height:45px;margin-left:5px;} /* ul.box-top-buttons{float:right;width:270px;padding-right:15px;} ul.box-top-buttons li{float:right;padding-left:15px;height:18px} ul.box-top-buttons li a{outline:none;padding:6px 15px 6px 0;display:block;font-size:0.9em;text-decoration:none;color:#ddd;} ul.box-top-buttons li a:hover{color:#fff;} ul.box-top-buttons li.selected{} ul.box-top-buttons li.selected a{color:#867946;} */ /** Button **/ a.button{background:transparent url(../img/btn-rht.png) no-repeat scroll top right;display:block;float:left;height:20px;margin-right:1px;padding-right:7px;text-decoration:none;color:#fff;font-size:11px;text-transform:lowercase;} a.button span{background:transparent url(../img/btn-lft.png) no-repeat;display:block;padding:0 5px 0 7px;line-height:20px;} a.button:hover{background-position:right -20px;} a.button:hover span{color:#fff;background-position:left -20px;} a.button span.arrow{background:url(../img/sml-arrow.png) no-repeat 0 50%;display:block;padding-left:20px;} /** columns **/ div#left-col{float:left;width:670px;padding:10px 5px;margin:0;} div#right-col{width:276px;float:left;} div.full-col{width:980px !important;margin-right:0px !important;} div.half-col{width:740px !important;margin-right:0px !important;} /** list links **/ ul.list-links,div#to-do-list ul{width:223px;margin-left:-10px;margin-top:-5px;} ul.list-links li{border-bottom:1px dotted #d6d8d9;} ul.list-links li a{padding:8px 3px 6px 20px;display:block;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px #fff;color:#5c6467;text-decoration:none;} ul.list-links li a:hover,ul.list-links li.selected a:hover{background:url(../../img/admin/link-arrow-hover.gif) no-repeat 10px 10px #fafae9;color:#000;} ul.list-links li ul{background:#fcfbf2 !important;padding-left:10px;padding-top:10px;width:213px;font-size:0.9em;} ul.list-links li ul li{border-bottom:none;} ul.list-links li ul li a{background:none;padding:5px 3px 5px 20px !important;} ul.list-links li ul li a:hover{background-color:#fcfbf2;background-position:8px 10px} ul.list-links li a.ui-state-active{font-weight:bold;} /** forms **/ div.input{padding:2px;} label{display:block;} .required label:after { content:"*"; color: red;} fieldset { border: 0;} legend { font-size: 15px; color: #5DA2D7; font-weight: bold; text-transform:uppercase;} input{border:1px solid #5da2d7;line-height:35px;padding:2px;} form.middle-forms{padding:5px;color:#3a4043} form.middle-forms p{margin:10px 0;} form.middle-forms h3{color:#1d8895;font-weight:bold;font-size:150%;margin-bottom:10px;} form.middle-forms fieldset{padding-top:10px;} form.middle-forms fieldset ol li{padding:15px;} form.middle-forms fieldset ol li.even{background:#f3f3f3;} form.middle-forms fieldset ol li input/*,form.middle-forms fieldset ol li textarea*/{padding:5px;border:1px solid #dedede;background:url(../../img/admin/bg-textbox.gif) repeat-x #fff;} form.middle-forms fieldset ol li input[type="radio"],form.middle-forms fieldset ol li input[type="checkbox"]{border:none;background:none;} input.txtbox-short{width:122px;} input.txtbox-middle{width:190px;} input.txtbox-long,form.middle-forms textarea{width:305px;} form.middle-forms label{float:left;width:50px;padding-right:10px;margin-right:10px;display:block;} form.middle-forms label.field-title{font-weight:bold;width:100px;padding-top:3px;} span.form-confirm-inline,span.form-error-inline{display:inline-block;padding-left:20px;margin-left:10px;height:16px;} span.form-confirm-inline{color:#72a101;background:url(../../img/admin/icon-confirm.gif) no-repeat;} span.form-error-inline{color:#a10101;background:url(../../img/admin/icon-error.gif) no-repeat;} a.heading-link{color:#cae6ed;text-transform:capitalize;font-size:0.9em;font-weight:normal;display:inline-block;padding-left:15px;text-decoration:none;} a.heading-link:hover{color:#fff;} /* tables */ table.table-short{width:500px;margin:-5px 0 0 -5px;border-collapse:collapse;} table.table-long{width:740px;margin-left:-10px} table.table-full{width:100%;} table.table-short td,table.table-long td{border-top:1px solid #dfdfdf;font-size:0.9em;padding:10px 0;margin:0;color:#666;} table.table-short thead th,table.table-long thead th{font-weight:bold;color:#666;padding:10px 0;} table.table-short thead th a,table.table-long thead th a{color:#666;} table.table-short thead th,table.table-short tfoot td,table.table-long thead th,table.table-long tfoot td{border:none;} table.table-short td:first-child,table.table-long td:first-child{text-align:left;padding:0 0 0 10px;} table.table-short tfoot,table.table-long tfoot{border-top:1px solid #ccc;} table.table-short tr.altRow,table.table-long tr.altRow{background:url(../../img/admin/bg_tableRow.gif) repeat-x 0px 1px;} table.table-short td a,table.table-long td a{color:#508db8;font-weight:bold;} table.table-short td a:hover,table.table-long td a:hover{text-decoration:none;color:#333;} td.col-chk{width:40px;} td.col-first{font-weight:bold;width:200px;} td.col-second a{color:#508db8;font-weight:bold;} td.col-second a:hover{text-decoration:none;color:#333;} td.actions{width:110px;} a.table-edit-link,a.table-delete-link{color:#666;text-decoration:none;display:inline-block;margin-right:10px;padding-left:20px;height:16px;text-align:right;} a.table-edit-link:hover,a.table-delete-link:hover{color:#000;} a.table-delete-link{margin-right:0px !important;background:url(../../img/admin/icon-delete.gif) no-repeat;} a.table-edit-link{background:url(../../img/admin/icon-edit.gif) no-repeat;} /** FOOTER **/ div#footer{margin:0 auto;height:57px;background:url(../img/bg-footer.png) repeat-x;padding:5;position:relative;} div#footer-top{color:#f2f2f2;} div#footer-top h4{color:#fff;text-transform:uppercase;margin:5px 0;font-size:120%;font-weight:bold;} div#footer-top a{color:#adc3d3;font-weight:bold;font-size:0.9em;text-decoration:none;} div#footer-top a:hover{color:#fff;} div#footer-top h2{font-size:160%;text-transform:uppercase;padding-top:10px;padding-right:10px;font-weight:bold;} div#footer-top h2 a{color:#a1a5a6;} div#footer-top h2 a:hover{color:#c7cdcf;} div#footer-bottom{margin-top:25px;} div#footer-bottom p{color:#717272;font-size:0.9em;} div#footer-bottom p a{color:#ccc;text-decoration:none;} div#footer ul.menu{display:block;list-style:none;padding:10px 0 5px 15px} div#footer ul.menu li{float:left;position:relative;border-right:1px solid #717171;} div#footer ul.menu li.last{border:0;} div#footer ul.menu li a{color:#717171;text-decoration:none;padding:0 10px;display:inline-block;text-align:center;position:relative;} div#footer .logo{position:absolute;right:15px;height:15px;top:15px;} div#footer .copyright{font:8pt Tahoma;padding:10px 0 10px 25px;} /********** Modal **********/ #mask{display:none;position:absolute;top:0;left:0;background:url('../img/mask.gif');z-index:9000;} .modal-container{display:none;position:absolute;top:0;left:0;z-index:9999;} #modal{margin:40px auto;padding:25px;background:#fff;border:7px solid #ccc;-moz-border-radius:10px;-webkit-border-radius:10px;} #modal-content h2{padding-bottom:5px;font-size:18px;font-weight:normal;border-bottom:1px solid #ddd;} #modal-content label{color:#7a7a7a;font-weight:bold;} #modal-content input[type=text]{margin:5px 0 10px;width:241px;background:#f8f8f8;border:1px solid #aaa;} #modal-close {background:url('../img/close-button.png');width:22px;height:22px;position:absolute;top:-15px;right:-15px;cursor:pointer;} #modal-close a { display: block; border: 1px solid #666;} #modal-close span { display: none;} /********** End of Modal **********/ #message {margin:0 auto; display:none;position:fixed;top:0px;left:10px;right:10px;z-index:100;} .msg-error,.msg-success,.msg-attention,.msg-info{padding:0;margin:0;padding-left:17px;height:30px;line-height:30px;position:relative;border:1px solid #666;} .remove-btn{position:absolute;top:0;right:17px;padding-right:20px;background:url('../img/remove-btn.png') no-repeat center right;color:#333 !important;} .remove-btn:hover{color:#666 !important;} .msg-error{background:#ffd6d6;color:#df5c0c;border: 1px solid #ebb1b1;} .msg-success{background:#eaf8d5;color:#829b36;border:1px solid #829b36;} .msg-attention{background:#fffbcc;color:#c0a443;border:1px solid #c0a443;} .msg-info{background:#d2eef1;color:#369fb4;border:1px solid #369fb4;} /* ============================================= info messages ============================================= */ .form-error { float:left; border: 1px solid #ebb1b1;} .info_success { display:inline;background:url(../img/success.png) no-repeat; padding-left:20px; color:#afda2d; } .error-message {display:inline;background:url(../img/wrong.png) no-repeat; padding-left:20px; color:#df5c0c; } .info_loading {display:inline; background:url(../img/loading.gif) no-repeat; padding-left:20px; } .current-city { color: #000; font-weight: bold;} .current-city span { color: #000; text-decoration: underline; } div#right-col .menu{list-style:none;} div#right-col .menu li { display: block;padding:10px 25px;} div#right-col .menu li a { display: block; font-weight: bold; color: #fff;text-decoration:none;} div#right-col .menu li a:hover { text-decoration:underline;} div#signup_steps .step {padding: 0;margin:0; margin: 5px 5px; } div#signup_steps .step h2 { padding:26px 8px; text-transform:uppercase;color:#fff; background: #ccc;} div#signup_steps .selected {background: url(../img/tri-blue.png) no-repeat;margin-left:-8px;} div#signup_steps .selected h2 {background: #5DA2D7; display:block;margin-left:8px;} #signup_steps ul li.active { padding-left:0; margin-left:0px;background: url(../img/tri-blue.png) no-repeat;} /* Map stuff */ .map_popup { } .map_popup .title { font-weight: bold; text-align:center; font-size:15px; -} +} +
valaravena/Glo
e2eb82422972f74ca20594c744ef2f412aef39c9
Adding update
diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index b57d69b..3c2ce60 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,143 +1,142 @@ <?php echo $javascript->link("http://www.google.com/jsapi"); echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); echo $javascript->codeBlock(); ?> var infowindow; $(document).ready(function() { var myOptions = { zoom: 12, mapTypeId: google.maps.MapTypeId.SATELLITE, streetViewControl: false }; var map = new google.maps.Map(document.getElementById("map"), myOptions); var mapDrag = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'dragend', mapDrag, true); var mapZoom = function(event) {updateLayer(map.getCenter());} google.maps.event.addListener(map, 'zoom_changed', mapZoom, true); if (geocoder) { geocoder.geocode({'address': "<?php echo $account['Account']['location'];?>"}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); updateLayer(results[0].geometry.location); } else { } } ); } function updateLayer(latlng) { - var iconimage = "http://glow/img/SGBluePin.png"; var epm_data = [ {"epm":56,"ame":2300,"ami":1,"renew":"CNG","ev":0,"leed":"NOT CERTIFIED"}, {"epm":67,"ame":1800,"ami":1,"renew":"NOT CERTIFIED","ev":0,"leed":"NOT CERTIFIED"}, {"epm":45,"ame":2546,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":88,"ame":3050,"ami":0,"renew":"CNG","ev":0,"leed":"CERTIFIED"}, {"epm":44,"ame":1457,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":87,"ame":2199,"ami":1,"renew":"CNG","ev":0,"leed":"SILVER"}, {"epm":77,"ame":2892,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":35,"ame":1913,"ami":1,"renew":"SOLAR","0":"CNG","ev":0,"leed":"NOT CERTIFIED"}, {"epm":96,"ame":3520,"ami":1,"renew":"SOLAR","ev":1,"leed":"PLATINUM"}, {"epm":58,"ame":4200,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":67,"ame":2765,"ami":0,"renew":"NONE","ev":0,"leed":"GOLD"}, {"epm":59,"ame":1965,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":68,"ame":3275,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":37,"ame":2134,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":52,"ame":2755,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":85,"ame":3877,"ami":1,"renew":"NONE","ev":1,"leed":"CERTIFIED"}, {"epm":34,"ame":2433,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":66,"ame":1933,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":87,"ame":1456,"ami":0,"renew":"SOLAR","ev":0,"leed":"CERTIFIED"}, {"epm":84,"ame":2345,"ami":1,"renew":"NONE","ev":0,"leed":"SILVER"}, {"epm":76,"ame":2756,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"}, {"epm":56,"ame":4234,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":74,"ame":3244,"ami":0,"renew":"SOLAR","0":"CNG","ev":1,"leed":"NOT CERTIFIED"}, {"epm":73,"ame":1655,"ami":1,"renew":"SOLAR","ev":0,"leed":"NOT CERTIFIED"}, {"epm":62,"ame":4266,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":45,"ame":2311,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":52,"ame":1966,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":60,"ame":1077,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":28,"ame":2234,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, {"epm":65,"ame":3200,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"} ]; $.ajax({ url: "/simple_geo/simple_geo/nearby/?hash="+latlng.toUrlValue(), dataType: 'json', success: function(result) { $.each(result, function(i, data) { var latlng = new google.maps.LatLng(data.Point.latitude,data.Point.longitude); var recordNum = i % epm_data.length; var imgNum = ((epm_data[recordNum].epm%10)*10); var content = '<div class="map_popup" style="padding:0;margin:0;overflow:hidden">'+ '<h2 class="title">'+data.Point.name+'</h2>'+ '<hr />'+ '<div><strong>EPM-Premise Rating:</strong><br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ '<hr />'+ '<p><strong>Avg. Monthly Usage:</strong> '+epm_data[recordNum].ame+'</p>'+ '<p><strong>AMI Ready:</strong> '+epm_data[recordNum].ami+'<br />'+ '<p><strong>Renewable Sources:</strong> '+epm_data[recordNum].renew+'</p>'+ '<p><strong>EV Charging Station:</strong> '+epm_data[recordNum].ev+'</p>'+ '<p><strong>LEED Certifications:</strong> '+epm_data[recordNum].leed+'</p>'+ '</div>'; var marker = new google.maps.Marker({ position: latlng, map: map, - icon: "http://glow/img/SGBluePin.png" + icon: "/img/SGBluePin.png" }); google.maps.event.addListener(marker, 'click', function() { if (infowindow) infowindow.close(); infowindow = new google.maps.InfoWindow({content: content}); infowindow.open(map,marker); }); map.setCenter(latlng); }); } }); } }); <?php echo $javascript->blockEnd();?> <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div> <div id="map"style="width:100%; height: 500px;" ></div> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> </div>
valaravena/Glo
57eeda0b3832c5b51d8168bf48f1c292ec8f1e06
Adding images, and maps info
diff --git a/app/config/schema/glow.sqlite b/app/config/schema/glow.sqlite index 628738b..3d72a53 100644 Binary files a/app/config/schema/glow.sqlite and b/app/config/schema/glow.sqlite differ diff --git a/app/controllers/accounts_controller.php b/app/controllers/accounts_controller.php index 69860df..84de92c 100644 --- a/app/controllers/accounts_controller.php +++ b/app/controllers/accounts_controller.php @@ -1,203 +1,204 @@ <?php class AccountsController extends AppController { var $name = 'Accounts'; var $helpers = array('Gravatar'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); } function index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function profile() { $this->set('title_for_layout', __('Account Profile', true)); if ($this->Auth->user()) { $account = $this->Account->findByUserId($this->Auth->user('id')); $account['Account']['full_name'] = $account['Account']['first_name'] . " ". $account['Account']['last_name']; if (!empty($this->data)) { $fullName = explode(" ", trim($this->data['Account']['full_name'])); - list($firstName, $lastName) = $fullName; + list($firstName, $lastName) = $fullName; + $this->data['Account']['id'] = $account['Account']['id']; $this->data['Account']['first_name'] = $firstName; $this->data['Account']['last_name'] = $lastName; if ($this->Account->save($this->data)) { $this->Session->setFlash(__('Your profile has been updated.', true), 'success'); $this->redirect(array('action' => 'profile')); } else { $this->Session->setFlash(__('Your profile could not be saved. Please, try again.', true), 'error'); } } $this->data =$account; } else { $this->redirect('/login'); } } function admin_index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function authenticate() { $account = array(); if ($this->Auth->user('id')) { $this->Account->recursive = 0; $account = $this->Account->getAccountByIdOrUsername($this->Auth->user('id')); if (!empty($account)) { # $account['User'] = # $return['User'] = # $account['Account'] = array($account['Account'][]) #$account = am($account['User'], $account['Account']); } } $this->set(compact('account')); } function location() { if (!$this->RequestHandler->isAjax()) { $this->redirect(array('action' => 'index')); } if (!empty($this->params['form']['Account'])) { $this->Account->recursive = 0; $account = $this->Account->findByUserId($this->Auth->user('id')); $this->Account->id = $account['Account']['id']; $this->Account->saveField('location', $this->params['form']['Account']['location']); } } } ?> \ No newline at end of file diff --git a/app/controllers/users_controller.php b/app/controllers/users_controller.php index bcf283e..f628aa6 100644 --- a/app/controllers/users_controller.php +++ b/app/controllers/users_controller.php @@ -1,302 +1,306 @@ <?php class UsersController extends AppController { var $name = 'Users'; var $components = array('Recaptcha'); var $helpers = array('Recaptcha', 'SimpleGeo.GoogleMap'); var $uses = array('SimpleGeo.SimpleGeo'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); if (!empty($this->Auth)) { $this->Auth->allow('activate', 'register', 'reset', 'recover', 'resend', 'login', 'logout'); $this->Auth->allow('*'); } } - function index() { - $simpleGeoLayer = 'iWobbleTestLayer'; - $points = array(); - if (!empty($simpleGeoLayer)) { - if (!empty($this->params['url']['hash'])) { - $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); - if (!empty($result->features)) { - foreach ($result->features as $feature) { - $point['Point']['id'] = $feature->id; - $point['Point']['name'] = $feature->id; - $point['Point']['longitude'] = $feature->geometry->coordinates[0]; - $point['Point']['latitude'] = $feature->geometry->coordinates[1]; - $point['Point']['created'] = $feature->created; - $points[] = $point; - } - } else { - if (!empty($result->message)) { - #die($result->message); + function index() { + if ($this->Session->check('Auth.User')) { + $simpleGeoLayer = 'iWobbleTestLayer'; + $points = array(); + if (!empty($simpleGeoLayer)) { + if (!empty($this->params['url']['hash'])) { + $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); + if (!empty($result->features)) { + foreach ($result->features as $feature) { + $point['Point']['id'] = $feature->id; + $point['Point']['name'] = $feature->id; + $point['Point']['longitude'] = $feature->geometry->coordinates[0]; + $point['Point']['latitude'] = $feature->geometry->coordinates[1]; + $point['Point']['created'] = $feature->created; + $points[] = $point; + } + } else { + if (!empty($result->message)) { + #die($result->message); + } } } - } - $this->set('points', $points); - } + $this->set('points', $points); + } + } else { + $this->redirect('/login'); + } } function login() { $this->set('title_for_layout', __('Login', true)); if (!empty($this->data)) { if (!empty($this->data['User']['remember_me']) && $this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function register($status = '') { $this->set('title_for_layout', __('Register with Gridglo', true)); if (!$this->Session->check('Auth.User')) { if (!empty($this->data)) { $this->data['User']['group_id'] = 3; $this->data['User']['active'] = 1; if ($user = $this->User->register($this->data)) { $this->_sendEmail($user); $this->Session->write('Registration.email', $user['to']); $this->redirect(array('action' => 'register', 'success')); } else { $this->Session->setFlash(__('We were unable to register your account!', true), 'error'); } } elseif ($status) { if ($this->Session->check('Registration.email')) { $this->set('email', $this->Session->read('Registration.email')); $this->render($this->action.'_'.$status); } else { $this->redirect(array('action' => 'register')); } } } else { $this->redirect('/'); } } function activate($key = null) { if (!$this->Session->check('Auth.User')) { if (!is_null($key)) { if ($user = $this->User->activate($key)) { $this->Auth->login($user); $this->_sendEmail($user); $this->Session->setFlash(__('Your account is verified!', true), 'success'); $this->redirect(array('action' => 'done')); } else { $this->Session->setFlash(__('We were unable to verify you account! Account may already be active.', true), 'error'); $this->redirect(array('action' => 'login')); } } else { $this->redirect(array('action' => 'login')); } } else { $this->redirect('/'); } } function done() { if ($this->Session->check('Auth.User')) { if (!empty($this->data)) { if ($this->Auth->user('id')) { $user = $this->User->read(null, $this->Auth->user('id')); $this->User->save($this->data); $this->Auth->login($user); $this->redirect($this->Auth->redirect('/')); } else { $this->redirect(array('action' => 'login')); } } else { $this->data = $this->Auth->user(); } } else { $this->redirect('/'); } } function skip() { $this->redirect($this->Auth->redirect('/')); // Track User/Insert History // Send to Home Page } function recover() { $this->set('title_for_layout', __('Reset your Password', true)); if (!empty($this->data)) { if ($user = $this->User->recover($this->data)) { $this->_sendEmail($user); $this->Session->setFlash(__('Password Change Email has been sent!', true), 'success'); $this->redirect(array('action' => 'login')); } else { $this->Session->setFlash(__('No user found with that email', true), 'error'); } } } function reset($key = null) { if (!is_null($key)) { if ($user = $this->User->resetKey($key)) { $this->Session->write('Reset.User', $user); } } if ($user = $this->Session->read('Reset.User')) { $this->set('user', $user); if (!empty($this->data)) { if ($this->User->reset($this->data, $user['User']['id'])) { $this->Session->delete('Reset'); $this->redirect('/'); } } } else { $this->redirect('/'); } } function resend($email = null) { if (!is_null($email)) { if ($user = $this->User->resend($email)) { $this->_sendEmail($user); } else { $this->Session->setFlash(__('Unable to send activation email. It may be that the account is already active or the email doesn\'t exisit.', true), 'error'); } } $this->redirect(array('action' => 'login')); } function changepassword() { $this->layout = 'account'; $this->set('title_for_layout', __('Change Password', true)); if (!empty($this->data)) { if ($user = $this->User->reset($this->data)) { $this->Session->setFlash(__('Password Change Email has been sent!', true), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Unable to change your password. Please try again.', true), 'error'); $this->redirect(array('action' => 'changepassword')); } } } function admin_login() { $this->set('title_for_layout', __('Administration Login', true)); $this->layout = "admin_login"; if (!empty($this->data)) { if ($this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function admin_logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function admin_index() { $this->set('title_for_layout', __('Users', true)); $this->User->recursive = 0; $this->set('users', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } $this->set('user', $this->User->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->User->create(); if ($this->User->register($this->data)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } $this->set('title_for_layout', sprintf(__('Add %s', true), 'User')); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->User->register($this->data, $id)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } if (empty($this->data)) { $this->data = $this->User->read(null, $id); } $this->set('title_for_layout', sprintf(__('Edit "%s"', true), $this->data['User']['username'])); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid id for %s', true), 'User')); $this->redirect(array('action' => 'index')); } if ($this->User->delete($id)) { $this->Session->setFlash(sprintf(__('%s deleted', true), 'User')); $this->redirect(array('action' => 'index')); } } /* API STUFF */ function authenticate() { $user = array(); if ($this->Auth->user('id')) { $this->log('Logged in as '. $this->Auth->user('username')); $user = $this->User->Account->getAccountByIdOrUsername($this->Auth->user('id')); } $this->set(compact('user')); } } diff --git a/app/plugins/simple_geo/controllers/simple_geo_controller.php b/app/plugins/simple_geo/controllers/simple_geo_controller.php index 961f568..b72301c 100644 --- a/app/plugins/simple_geo/controllers/simple_geo_controller.php +++ b/app/plugins/simple_geo/controllers/simple_geo_controller.php @@ -1,48 +1,50 @@ <?php class SimpleGeoController extends SimpleGeoAppController { var $name = "SimpleGeo"; var $uses = array('SimpleGeo.SimpleGeo'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('records'); } function admin_index() { $this->set('title_for_layout', __('Simple Geo', true)); } - function nearby() { + function nearby() { + $this->layout = 'ajax'; + $simpleGeoLayer = 'com.simplegeo.us.business'; $points = array(); if (!empty($simpleGeoLayer)) { - if (!empty($this->params['url']['hash'])) { - $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); + if (!empty($this->params['url']['hash'])) { + $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('radius' => 200, 'limit' => 30)); if (!empty($result->features)) { foreach ($result->features as $feature) { $point['Point']['id'] = $feature->id; - $point['Point']['name'] = $feature->id; + $point['Point']['name'] = $feature->properties->std_name; $point['Point']['longitude'] = $feature->geometry->coordinates[0]; $point['Point']['latitude'] = $feature->geometry->coordinates[1]; $point['Point']['created'] = $feature->created; $points[] = $point; } } else { if (!empty($result->message)) { #die($result->message); } } } $this->set('points', $points); - } + } } function records($id = null, $simpleGeoLayer = null) { } } \ No newline at end of file diff --git a/app/plugins/simple_geo/models/datasource/simple_geo.php b/app/plugins/simple_geo/models/datasource/simple_geo.php index f830b7c..1480f3f 100644 --- a/app/plugins/simple_geo/models/datasource/simple_geo.php +++ b/app/plugins/simple_geo/models/datasource/simple_geo.php @@ -1,281 +1,281 @@ <?php App::import('Vendor', 'SimpleGeo.HttpSocketOauth'); class SimpleGeo extends DataSource { static private $_days = array('mon', 'wed', 'tue', 'thu', 'fri', 'sat', 'sun'); /** * Version of the API to use * * @var string $_version The version of the API to use */ private $_version = '0.1'; /** * Base URI of the API * * @var string $_api The base URI for the SimpleGeo API */ private $_api = 'api.simplegeo.com'; /** * OAuth client * * @var object $_oauth Instance of OAuth client * @see OAuthConsumer */ private $_oauth = null; /** * API token * * @var string $_token OAuth token */ private $_token; /** * API secret * * @var string $_secret OAuth secret */ private $_secret; public function __construct($config) { $config['token'] = 'wKh7XbnNrZ556LUU94gRSZf5NvmPWmvr'; $config['secret'] = 'Y6LYJXZmFaQUEp95taTVPWWeA86ZA3qY'; $config['version'] = '0.1'; $this->_oauth = new HttpSocketOauth(); $this->_version = $config['version']; $this->_token = $config['token']; $this->_secret = $config['secret']; parent::__construct($config); } public function describe($model) { } public function listSources() { } public function read($model, $queryData = array()) { } public function create($model, $fields = array(), $values = array()) { } #public function update($model, $fields) public function delete($model, $id = null) { } public function getAddress($lat, $lon) { return $this->_sendRequest('/nearby/address/' . $lat .','. $lon.'.json'); } public function getRecord($layer, $id) { return $this->_sendRequest('/records/' . $layer . DS . $id . '.json'); } public function getRecords($layer, $ids) { return $this->_sendRequest('/records/' . $layer . DS . implode(',', $ids) . '.json'); } public function getHistory($layer, $id, array $args = array()) { return $this->_sendRequest('/records/' . $layer . DS . $id . '/history.json', $args); } - public function getNearby($layer, $arg, array $args = array()) { + public function getNearby($layer, $arg, array $args = array()) { return $this->_sendRequest('/records/' . $layer . DS . 'nearby' . DS . $arg . '.json', $args); } public function addRecord(SimpleGeo_Record $rec) { return $this->_sendRequestWithBody('/records/' . $rec->layer . DS .$rec->id . '.json', (string)$rec); } public function addRecords($layer, array $records) { $body = array( 'type' => 'FeatureCollection', 'features' => array() ); foreach ($records as $rec) { if (!$rec instanceof SimpleGeo_Record) { $this->log(__FILE__ . " " . sprintf(__('Error: %s', true), __('Records must be instances of SimpleGeo_Record', true))); return; } $body['features'][] = $rec->toArray(); } return $this->_sendRequestWithBody('/records/' . $layer . '.json', json_encode($body), "POST"); } public function deleteRecord($layer, $id) { $result = $this->_sendRequest('/records/' . $layer . DS . $id . '.json', array(), 'DELETE'); return ($result === null); } public function getContains($lat, $lon) { return $this->_sendRequest('/contains/' . $lat . ',' . $lon . '.json'); } public function getOverlaps($south, $west, $north, $east, $args = array()) { return $this->_sendRequest('/overlaps/' . $south. ',' . $west . ',' . $north . ',' . $east .'.json', $args); } public function getBoundary($id) { return $this->_sendRequest('/boundary/' . $id . '.json'); } public function getDensity($lat, $lon, $day = null, $hour = null) { if ($day === null) { $day = strtolower(date("D")); } elseif (!in_array($day, self::$_days)) { $this->log(sprintf(__('Error: %s', true), sprintf(__('%s in not a valid day of the week. Falling back to %s', true), $day, strtolower(date("D"))))); $day = strtolower(date("D")); } // Default Endpoint $endpoint = '/density/' . $day . DS . $lat . ',' . $lon . '.json'; if ($hour !== null) { if ($hour < 0 || $hour > 23) { $this->log(sprintf(__('Error: %s', true), __('Hour must be between 0 and 23.', true))); } else { $endpoint = '/density/' . $day . DS . $hour . DS . $lat . ',' . $lon . '.json'; } } return $this->_sendRequest($endpoint); } private function _createRequest($endPoint, $args = array(), $method = 'GET') { $request = array( 'uri' => array( 'host' => $this->_api, 'path' => $this->_getPath($endPoint), 'query' => (!empty($args)?$args:''), ), 'method' => $method, 'auth' => array( 'method' => 'OAuth', 'oauth_consumer_key' => $this->_token, 'oauth_consumer_secret' => $this->_secret, ) ); return $request; } private function _sendRequestWithBody($endPoint, $body, $method = 'PUT') { $request = $this->_createRequest($endPoint, array(), $method); $request['body'] = $body; if (($result = $this->_oauth->request($request)) !== false) { if (!empty($this->_oauth->response['status']['code']) && substr($this->_oauth->response['status']['code'], 0, 1) !== '2') { $body = @json_decode($result); $this->log(__FILE__ . " " . sprintf(__('Error: %s', true), $body->message)); #$this->cakeError('error404', array('message' => $body->message, 'code' => $body->code)); } } return $result; } private function _sendRequest($endPoint, $args = array(), $method = 'GET') { $request = $this->_createRequest($endPoint, $args, $method); if (($result = $this->_oauth->request($request)) !== false) { $body = @json_decode($result); if (!empty($this->_oauth->response['status']['code']) && substr($this->_oauth->response['status']['code'], 0, 1) == '2') { return $body; } else { $this->log(__FILE__ . " " . sprintf(__('Error: %s', true), $body->message)); } } return @json_decode($result); } private function _getPath($endPoint) { return DS . $this->_version . $endPoint; } } class SimpleGeo_Record { public $layer; public $id; public $lat; public $lon; public $type = 'object'; public $created = 0; private $_properties = array(); public function __construct($layer, $id, $lat, $lon, $properties = array(), $type = 'object', $created = null) { if ($created == null) { $created = time(); } $this->layer = $layer; $this->id = $id; $this->lat = (float)$lat; $this->lon = (float)$lon; $this->type = $type; $this->created = $created; if (!empty($properties)) { foreach ($properties as $key => $value) { $this->$key = $value; } } } public function __set($var, $val) { $this->_properties[$var] = $val; } public function __toString() { $array = $this->toArray(); if (empty($array['properties'])) { $array['properties'] = new stdClass; } return json_encode($array); } public function toArray() { return array( 'type' => 'Feature', 'id' => $this->id, 'created' => $this->created, 'geometry' => array( 'type' => 'Point', 'coordinates' => array($this->lon, $this->lat) ), 'properties' => (empty($this->_properties)?new stdClass:$this->_properties) ); } } diff --git a/app/plugins/simple_geo/views/helpers/google_map.php b/app/plugins/simple_geo/views/helpers/google_map.php index efc27ad..54735bc 100644 --- a/app/plugins/simple_geo/views/helpers/google_map.php +++ b/app/plugins/simple_geo/views/helpers/google_map.php @@ -1,198 +1,198 @@ <?php /* * CakeMap -- a google maps integrated application built on CakePHP framework. * Copyright (c) 2005 Garrett J. Woodworth : [email protected] * rd11,inc : http://rd11.com * * @author gwoo <[email protected]> * @version 0.10.1311_pre_beta * @license OPPL * * Modified by Mahmoud Lababidi <[email protected]> * Date Dec 16, 2006 * * */ class GoogleMapHelper extends Helper { var $errors = array(); var $types = array('ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN'); function map($default, $style = 'width: 400px; height: 400px' ) { $out = "<div id=\"map\""; $out .= isset($style) ? "style=\"".$style."\"" : null; $out .= " ></div>"; $out .= " <script type=\"text/javascript\"> //<![CDATA[ var directionDisplay; var directionsService = new google.maps.DirectionsService(); var map; var lat; var lon; - var iconimage = \"http://labs.google.com/ridefinder/images/mm_20_red.png\"; - var iconshadow = \"http://labs.google.com/ridefinder/images/mm_20_shadow.png\"; + var iconimage = \"http://glow/img/SGBluePin.png\"; + var iconshadow = \"hhttp://glow/img/SGBluePin.png\"; if (google.loader.ClientLocation) { lat = google.loader.ClientLocation.latitude; lon = google.loader.ClientLocation.longitude; } "; $default['type'] = (empty($default['type']) || (!empty($default['type']) && !in_array(strtoupper($default['type']), $this->types)))?"ROADMAP":strtoupper($default['type']); if (!empty($default['lat']) || !empty($default['lon'])) { $out .="lat = ".$default['lat'].";"; $out .="lon = ".$default['lon'].";"; } $out .=" var myOptions = { zoom: ".$default['zoom'].", center: new google.maps.LatLng(lat, lon), mapTypeId: google.maps.MapTypeId.".$default['type'].", streetViewControl: true }; var map = new google.maps.Map(document.getElementById(\"map\"), myOptions); function cleardirs() { if(directionsDisplay) { directionsDisplay.setMap(null); } div = document.getElementById('".(isset($default['directions_div'])?$default['directions_div']:'directions_div')."'); if(div) { div.innerHTML = \"\"; }"; if(isset($default['directions_div'])) { $out .= " directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById('".$default['directions_div']."')); function calcRoute(fromid,tolat,tolon) { directionsDisplay.setMap(map); from = document.getElementById(fromid).value; var start = from; var end = new google.maps.LatLng(tolat,tolon); var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(result, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(result); } }); }"; } $out .="} //]]> </script>"; return $out; } function addOverlay(&$data) { $out = " <script type=\"text/javascript\"> //<![CDATA[ "; $out .= " //]]> </script>"; return $out; } function addMarkers(&$data, $icon=null) { $out = " <script type=\"text/javascript\"> //<![CDATA[ "; if(is_array($data)) { $i = 0; foreach ( $data as $n=>$m ) { $keys = array_keys($m); $point = $m[$keys[0]]; if(!preg_match('/[^0-9\\.\\-]+/',$point['longitude']) && preg_match('/^[-]?(?:180|(?:1[0-7]\\d)|(?:\\d?\\d))[.]{1,1}[0-9]{0,15}/',$point['longitude']) && !preg_match('/[^0-9\\.\\-]+/',$point['latitude']) && preg_match('/^[-]?(?:180|(?:1[0-7]\\d)|(?:\\d?\\d))[.]{1,1}[0-9]{0,15}/',$point['latitude'])) { $out .= " var point".$i." = new google.maps.LatLng(".$point['latitude'].",".$point['longitude']."); var marker".$i." = new google.maps.Marker({ position: point".$i.", map: map, title:\"".(isset($point['title'])?$point['title']:'')."\", shadow: iconshadow, icon: iconimage, });"; if(isset($point['title'])&&isset($point['html'])) { $out .= " var infowindow$i = new google.maps.InfoWindow({ content: \"$point[title]$point[html]\" }); google.maps.event.addListener(marker".$i.", 'click', function() { infowindow$i.open(map,marker".$i."); });"; } $data[$n][$keys[0]]['js']="marker$i.openInfoWindowHtml(marker$i.html);"; $i++; } } } $out .= " //]]> </script>"; return $out; } function addEvent ( $event='click', $var, $script=null ) { $out = " <script type=\"text/javascript\"> //<![CDATA[ $script google.maps.event.addListener(map, '".$event."', ".$var.", true); //]]> </script>"; return $out; } function addMarkerOnClick ( $innerHtml = null ) { $mapClick = ' var mapClick = function (event) { var marker = new google.maps.Marker({ position:event.latLng, icon: iconimage, map:map }); var infowindow = new google.maps.InfoWindow({ content: \"'.$innerHtml.'\" }); google.maps.event.addListener(marker, \'click\', function() { infowindow.open(map,marker); }); } '; return $this->addEvent('click', 'mapClick', $mapClick); } function moveMarkerOnClick ($lngctl, $latctl, $innerHtml = null) { $mapClick = ' var mapClick = function (event) { marker0.setPosition(event.latLng); lngctl = document.getElementById(\''.$lngctl.'\'); latctl = document.getElementById(\''.$latctl.'\'); if(lngctl) lngctl.value = event.latLng.lng(); if(latctl) latctl.value = event.latLng.lat(); } '; return $this->addEvent('click', 'mapClick', $mapClick); } } ?> diff --git a/app/plugins/simple_geo/views/simple_geo/json/nearby.ctp b/app/plugins/simple_geo/views/simple_geo/json/nearby.ctp new file mode 100644 index 0000000..d341537 --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo/json/nearby.ctp @@ -0,0 +1,5 @@ +<?php + + +debug($points); +?> \ No newline at end of file diff --git a/app/plugins/simple_geo/views/simple_geo/nearby.ctp b/app/plugins/simple_geo/views/simple_geo/nearby.ctp index a7d9d14..f0fd5c0 100644 --- a/app/plugins/simple_geo/views/simple_geo/nearby.ctp +++ b/app/plugins/simple_geo/views/simple_geo/nearby.ctp @@ -1,20 +1,3 @@ <?php - if (!empty($points)) { - foreach($points as $n=>$point){ - $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b><br />"; - $points[$n]['Point']['html'] = $point['Point']['name']; - } - } - $default = array('zoom' => 12); - echo $googleMap->map($default, $style = 'width:100%; height: 500px;'); - echo $googleMap->addEvent('dragend', 'mapDrag', "var mapDrag = function(event){}"); - - if (isset($overLay)) { - echo $googleMap->addOverlay($overLay); - } - - if(isset($points)){ - echo $googleMap->addMarkers($points, 'http://boingboing.net/style/reportthis.png'); - echo $googleMap->addMarkerOnClick("<h1>This is the Point</h1>"); - } + echo json_encode($points); ?> diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index 57a9643..b57d69b 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,74 +1,143 @@ -<?php +<?php echo $javascript->link("http://www.google.com/jsapi"); echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); -echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); +echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); echo $javascript->codeBlock(); -?> -$(document).ready(function() { +?> +var infowindow; +$(document).ready(function() { + var myOptions = { + zoom: 12, + mapTypeId: google.maps.MapTypeId.SATELLITE, + streetViewControl: false + }; + + var map = new google.maps.Map(document.getElementById("map"), myOptions); + var mapDrag = function(event) {updateLayer(map.getCenter());} + google.maps.event.addListener(map, 'dragend', mapDrag, true); + var mapZoom = function(event) {updateLayer(map.getCenter());} + google.maps.event.addListener(map, 'zoom_changed', mapZoom, true); + + + if (geocoder) { geocoder.geocode({'address': "<?php echo $account['Account']['location'];?>"}, function(results, status) { - if (status == google.maps.GeocoderStatus.OK) { + if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); updateLayer(results[0].geometry.location); } else { } } ); } + - function updateLayer(latlng) { - - } -}); + function updateLayer(latlng) { + var iconimage = "http://glow/img/SGBluePin.png"; + var epm_data = [ + {"epm":56,"ame":2300,"ami":1,"renew":"CNG","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":67,"ame":1800,"ami":1,"renew":"NOT CERTIFIED","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":45,"ame":2546,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":88,"ame":3050,"ami":0,"renew":"CNG","ev":0,"leed":"CERTIFIED"}, + {"epm":44,"ame":1457,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":87,"ame":2199,"ami":1,"renew":"CNG","ev":0,"leed":"SILVER"}, + {"epm":77,"ame":2892,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":35,"ame":1913,"ami":1,"renew":"SOLAR","0":"CNG","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":96,"ame":3520,"ami":1,"renew":"SOLAR","ev":1,"leed":"PLATINUM"}, + {"epm":58,"ame":4200,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":67,"ame":2765,"ami":0,"renew":"NONE","ev":0,"leed":"GOLD"}, + {"epm":59,"ame":1965,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":68,"ame":3275,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":37,"ame":2134,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":52,"ame":2755,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":85,"ame":3877,"ami":1,"renew":"NONE","ev":1,"leed":"CERTIFIED"}, + {"epm":34,"ame":2433,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":66,"ame":1933,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":87,"ame":1456,"ami":0,"renew":"SOLAR","ev":0,"leed":"CERTIFIED"}, + {"epm":84,"ame":2345,"ami":1,"renew":"NONE","ev":0,"leed":"SILVER"}, + {"epm":76,"ame":2756,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"}, + {"epm":56,"ame":4234,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":74,"ame":3244,"ami":0,"renew":"SOLAR","0":"CNG","ev":1,"leed":"NOT CERTIFIED"}, + {"epm":73,"ame":1655,"ami":1,"renew":"SOLAR","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":62,"ame":4266,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":45,"ame":2311,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":52,"ame":1966,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":60,"ame":1077,"ami":1,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":28,"ame":2234,"ami":0,"renew":"NONE","ev":0,"leed":"NOT CERTIFIED"}, + {"epm":65,"ame":3200,"ami":1,"renew":"NONE","ev":0,"leed":"CERTIFIED"} + ]; + $.ajax({ + url: "/simple_geo/simple_geo/nearby/?hash="+latlng.toUrlValue(), + dataType: 'json', + success: function(result) { + $.each(result, function(i, data) { + var latlng = new google.maps.LatLng(data.Point.latitude,data.Point.longitude); + var recordNum = i % epm_data.length; + var imgNum = ((epm_data[recordNum].epm%10)*10); + var content = '<div class="map_popup" style="padding:0;margin:0;overflow:hidden">'+ + '<h2 class="title">'+data.Point.name+'</h2>'+ + '<hr />'+ + '<div><strong>EPM-Premise Rating:</strong><br /><img src="/img/meter/b_'+imgNum+'.png" alt="'+imgNum+'"></div>'+ + '<hr />'+ + '<p><strong>Avg. Monthly Usage:</strong> '+epm_data[recordNum].ame+'</p>'+ + '<p><strong>AMI Ready:</strong> '+epm_data[recordNum].ami+'<br />'+ + '<p><strong>Renewable Sources:</strong> '+epm_data[recordNum].renew+'</p>'+ + '<p><strong>EV Charging Station:</strong> '+epm_data[recordNum].ev+'</p>'+ + '<p><strong>LEED Certifications:</strong> '+epm_data[recordNum].leed+'</p>'+ + '</div>'; + var marker = new google.maps.Marker({ + position: latlng, + map: map, + icon: "http://glow/img/SGBluePin.png" + }); + google.maps.event.addListener(marker, 'click', function() { + + if (infowindow) infowindow.close(); + infowindow = new google.maps.InfoWindow({content: content}); + infowindow.open(map,marker); + }); + map.setCenter(latlng); + }); + + } + }); + } + +}); + <?php echo $javascript->blockEnd();?> + <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> - <div> - <?php - if (!empty($points)) { - foreach($points as $n=>$point){ - $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b><br />"; - $points[$n]['Point']['html'] = $point['Point']['name']; - } - } - $default = array('zoom' => 12); - echo $googleMap->map($default, $style = 'width:100%; height: 500px;'); - echo $googleMap->addEvent('dragend', 'mapDrag', "var mapDrag = function(event){}"); - - if (isset($overLay)) { - echo $googleMap->addOverlay($overLay); - } - - if(isset($points)){ - echo $googleMap->addMarkers($points, 'http://boingboing.net/style/reportthis.png'); - echo $googleMap->addMarkerOnClick("<h1>This is the Point</h1>"); - } - ?> + <div> + <div id="map"style="width:100%; height: 500px;" ></div> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> -</div> +</div> + + diff --git a/app/webroot/css/style.css b/app/webroot/css/style.css index 5700dde..6fe01ef 100644 --- a/app/webroot/css/style.css +++ b/app/webroot/css/style.css @@ -1,218 +1,232 @@ /** document general options **/ body{font:9pt Tahoma,Helvetica,Arial,Tahoma,sans-serif;background:#d3ebfd;} body,html{height:100%} span.clearFix{width:100%;height:0px;visibility:hidden;clear:both;display:block;margin:0;padding:0;font-size:0px;} .hidden{display:none;} /** button stylings **/ div.inner-nav{clear:both;margin:10px 0;} a.button{display:inline-block;background:url(../../img/admin/bg-buttons-left.gif) no-repeat;text-decoration:none;height:21px;padding:0 0 0 15px;color:#fff;font-weight:bold;font-size:9pt;} div.inner-nav a:hover,a.button:hover{color:#333;} div.inner-nav a span,a.button span{display:block;background:url(../../img/admin/bg-buttons-right.gif) no-repeat right;padding:0 15px 0 0;line-height:21px;} .align-left{float:left;} .align-right{float:right;} /** text colors assigned to elements in various areas **/ .yellow{color:#e8e4a2;} .light-blue{color:#a6b7c0;} .blue{color:#508db8 !important;} .light-grey{color:#d7d7d7} .white{color:#fff;} img{border:0;} p{font-size:13px;} h2{margin:0 5px 5px 0;padding:0;font-size:20px;font-weight:bold;} h2 span{color:#ff931f;text-transform:uppercase;font-weight:bold;} h2.login{padding:5px;color:#ffad1f;padding-left:35px;background:#fff4ca url(../img/h1-pencil.png) no-repeat 10px 50%;} h2.platform{padding:5px;padding-left:35px;color:#5da2d7;background:#e6f2fb url(../img/h1-swoop.png) no-repeat 10px 50%;} div.home_demo{margin: 25px 25px;} ul.login_sub{display:block;list-style:none;} ul.login_sub li{float:left;height:15px;position:relative;border-right:1px solid #508db8;} ul.login_sub li a{text-decoration:none;padding:0 10px;display:inline-block;position:relative;} ul.login_sub li.last{border:0;} div#container{width:960px;position:relative;margin:0 auto;padding:5px 5px;background:#fff;} /** HEADER AND NAVIGATION **/ div#header{background:#fff url(../img/bg.png) repeat-x;height:149px;} /** logo,which is a typographical h1 element (you can edit this part if you want to replace with your logo graphic) **/ div#logo{padding:20px;height:77px;} div#logo h1{font-size:250%;text-transform:uppercase;letter-spacing:-1px;font-weight:bold;float:left;width:450px;/** mac safari & firefox hack */height:39px;/**/} div#logo h1 a{color:#fff;text-decoration:none;} div#logo h1 a:hover{color:#ccc;} /** header userbox **/ p#userbox{float:right;color:#c1cad0;background:url(../img/icon-greet-user.gif) no-repeat 0px 5px;padding:5px 0px 0px 18px;margin:0;} p#userbox a{color:#ceac0f;text-decoration:none;font-weight:bold;} p#userbox a:hover{color:#fff;} p#userbox small{display:block;margin-top:5px;color:#8d9599;font-size:0.9em;} /** menu **/ div#header ul.menu{display:block;list-style:none;background:url(../img/menu-btn.gif) repeat-x;height:32px;} div#header ul.menu li{float:left;height:32px;position:relative;border-right:1px solid #fff;} div#header ul.menu li.last{border:0;} div#header ul.menu li a{color:#717171;text-decoration:none;padding:9px 20px 7px 20px;display:inline-block;text-align:center;text-transform:uppercase;position:relative;} div#header ul.menu li a:hover{background:url(../img/menu-btn-on.gif) repeat-x top left;color:#fff;} /** END OF HEADER **/ /** CONTENT **/ div#content{background:url(../img/content-bg.gif) repeat-y;padding:0;} /** main heading of the page **/ div#content-top{padding:20px 0 0 0;background-color: #599fd4;} div#content-top h2{font-size:200%;font-weight:bold;color:#373d40;margin-left:12px;float:left;} div#content-top p{margin-left:12px;margin-top:5px;} div#content-top p a{color:#508db8;text-decoration:none;} div#content-top p a:hover{color:#333;} div#content-top a#topLink{float:right;background:url(../../img/admin/icon-blue-arrow.gif) no-repeat;display:inline-block;padding-left:23px;text-decoration:none;font-weight:bold;color:#508db8;height:16px;margin-top:10px;margin-right:12px;} div#content-top a#topLink:hover{color:#333;} div#content-top-left{width:681px;height:223px;float:left;position:relative;} div#content-top-right{padding:0 20px;width:239px;height:223px;float:left;background-color:#599fd4;} div#content-top-left:hover a.close { text-decoration: none;background:url('../img/close-button.png') no-repeat;width:25px;height:25px;position:absolute;top:-10px;right:-10px;cursor:pointer;} div#content-top-left a.close span {display: none;} /** Account Heading of the Page *// div#account-top {padding: 20px 0 0 0;background-color:#599fd4;border: 1px solid #666;} div#account-top-left { width:681px;height:25px;float:left;} div#account-top-right{padding: 0 20px;width:239px; height: 25px; float:left;background-color:#B2C8D7;} .profile_image {position:absolute;top:45px;right:20px;background:#DDE5EB;} .profile_image img { margin: 5px;} /** box general settings **/ div.sbox{background:url(../img/sbox-bg.png)repeat-x;height:172px;width:225px;padding:0 10px;} div.sbox p{padding:10px 0;margin:0;color:#fff;font-size:11px;} div.sbox .button{float:right;} .box{float:left;margin:5px;} .box div{margin:0.1em 0 0 0.1em;} .box div.topleft{display:block;background:url("../img/box-bg.png") top left no-repeat;padding:5px 0em 0em -5px;} .box div.topright{display:block;background:url("../img/box-bg.png") top right no-repeat;padding:5px 5px 0 0;margin:-5px 0 0 5px;} .box div.bottomleft{display:block;height:45px;margin-top:-5px;background:url("../img/box-bg.png") bottom left no-repeat;} .box div.bottomright{display:block;background:url("../img/box-bg.png") bottom right no-repeat;height:45px;margin-left:5px;} /* ul.box-top-buttons{float:right;width:270px;padding-right:15px;} ul.box-top-buttons li{float:right;padding-left:15px;height:18px} ul.box-top-buttons li a{outline:none;padding:6px 15px 6px 0;display:block;font-size:0.9em;text-decoration:none;color:#ddd;} ul.box-top-buttons li a:hover{color:#fff;} ul.box-top-buttons li.selected{} ul.box-top-buttons li.selected a{color:#867946;} */ /** Button **/ a.button{background:transparent url(../img/btn-rht.png) no-repeat scroll top right;display:block;float:left;height:20px;margin-right:1px;padding-right:7px;text-decoration:none;color:#fff;font-size:11px;text-transform:lowercase;} a.button span{background:transparent url(../img/btn-lft.png) no-repeat;display:block;padding:0 5px 0 7px;line-height:20px;} a.button:hover{background-position:right -20px;} a.button:hover span{color:#fff;background-position:left -20px;} a.button span.arrow{background:url(../img/sml-arrow.png) no-repeat 0 50%;display:block;padding-left:20px;} /** columns **/ div#left-col{float:left;width:670px;padding:10px 5px;margin:0;} div#right-col{width:276px;float:left;} div.full-col{width:980px !important;margin-right:0px !important;} div.half-col{width:740px !important;margin-right:0px !important;} /** list links **/ ul.list-links,div#to-do-list ul{width:223px;margin-left:-10px;margin-top:-5px;} ul.list-links li{border-bottom:1px dotted #d6d8d9;} ul.list-links li a{padding:8px 3px 6px 20px;display:block;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px #fff;color:#5c6467;text-decoration:none;} ul.list-links li a:hover,ul.list-links li.selected a:hover{background:url(../../img/admin/link-arrow-hover.gif) no-repeat 10px 10px #fafae9;color:#000;} ul.list-links li ul{background:#fcfbf2 !important;padding-left:10px;padding-top:10px;width:213px;font-size:0.9em;} ul.list-links li ul li{border-bottom:none;} ul.list-links li ul li a{background:none;padding:5px 3px 5px 20px !important;} ul.list-links li ul li a:hover{background-color:#fcfbf2;background-position:8px 10px} ul.list-links li a.ui-state-active{font-weight:bold;} /** forms **/ div.input{padding:2px;} label{display:block;} .required label:after { content:"*"; color: red;} fieldset { border: 0;} legend { font-size: 15px; color: #5DA2D7; font-weight: bold; text-transform:uppercase;} input{border:1px solid #5da2d7;line-height:35px;padding:2px;} form.middle-forms{padding:5px;color:#3a4043} form.middle-forms p{margin:10px 0;} form.middle-forms h3{color:#1d8895;font-weight:bold;font-size:150%;margin-bottom:10px;} form.middle-forms fieldset{padding-top:10px;} form.middle-forms fieldset ol li{padding:15px;} form.middle-forms fieldset ol li.even{background:#f3f3f3;} form.middle-forms fieldset ol li input/*,form.middle-forms fieldset ol li textarea*/{padding:5px;border:1px solid #dedede;background:url(../../img/admin/bg-textbox.gif) repeat-x #fff;} form.middle-forms fieldset ol li input[type="radio"],form.middle-forms fieldset ol li input[type="checkbox"]{border:none;background:none;} input.txtbox-short{width:122px;} input.txtbox-middle{width:190px;} input.txtbox-long,form.middle-forms textarea{width:305px;} form.middle-forms label{float:left;width:50px;padding-right:10px;margin-right:10px;display:block;} form.middle-forms label.field-title{font-weight:bold;width:100px;padding-top:3px;} span.form-confirm-inline,span.form-error-inline{display:inline-block;padding-left:20px;margin-left:10px;height:16px;} span.form-confirm-inline{color:#72a101;background:url(../../img/admin/icon-confirm.gif) no-repeat;} span.form-error-inline{color:#a10101;background:url(../../img/admin/icon-error.gif) no-repeat;} a.heading-link{color:#cae6ed;text-transform:capitalize;font-size:0.9em;font-weight:normal;display:inline-block;padding-left:15px;text-decoration:none;} a.heading-link:hover{color:#fff;} /* tables */ table.table-short{width:500px;margin:-5px 0 0 -5px;border-collapse:collapse;} table.table-long{width:740px;margin-left:-10px} table.table-full{width:100%;} table.table-short td,table.table-long td{border-top:1px solid #dfdfdf;font-size:0.9em;padding:10px 0;margin:0;color:#666;} table.table-short thead th,table.table-long thead th{font-weight:bold;color:#666;padding:10px 0;} table.table-short thead th a,table.table-long thead th a{color:#666;} table.table-short thead th,table.table-short tfoot td,table.table-long thead th,table.table-long tfoot td{border:none;} table.table-short td:first-child,table.table-long td:first-child{text-align:left;padding:0 0 0 10px;} table.table-short tfoot,table.table-long tfoot{border-top:1px solid #ccc;} table.table-short tr.altRow,table.table-long tr.altRow{background:url(../../img/admin/bg_tableRow.gif) repeat-x 0px 1px;} table.table-short td a,table.table-long td a{color:#508db8;font-weight:bold;} table.table-short td a:hover,table.table-long td a:hover{text-decoration:none;color:#333;} td.col-chk{width:40px;} td.col-first{font-weight:bold;width:200px;} td.col-second a{color:#508db8;font-weight:bold;} td.col-second a:hover{text-decoration:none;color:#333;} td.actions{width:110px;} a.table-edit-link,a.table-delete-link{color:#666;text-decoration:none;display:inline-block;margin-right:10px;padding-left:20px;height:16px;text-align:right;} a.table-edit-link:hover,a.table-delete-link:hover{color:#000;} a.table-delete-link{margin-right:0px !important;background:url(../../img/admin/icon-delete.gif) no-repeat;} a.table-edit-link{background:url(../../img/admin/icon-edit.gif) no-repeat;} /** FOOTER **/ div#footer{margin:0 auto;height:57px;background:url(../img/bg-footer.png) repeat-x;padding:5;position:relative;} div#footer-top{color:#f2f2f2;} div#footer-top h4{color:#fff;text-transform:uppercase;margin:5px 0;font-size:120%;font-weight:bold;} div#footer-top a{color:#adc3d3;font-weight:bold;font-size:0.9em;text-decoration:none;} div#footer-top a:hover{color:#fff;} div#footer-top h2{font-size:160%;text-transform:uppercase;padding-top:10px;padding-right:10px;font-weight:bold;} div#footer-top h2 a{color:#a1a5a6;} div#footer-top h2 a:hover{color:#c7cdcf;} div#footer-bottom{margin-top:25px;} div#footer-bottom p{color:#717272;font-size:0.9em;} div#footer-bottom p a{color:#ccc;text-decoration:none;} div#footer ul.menu{display:block;list-style:none;padding:10px 0 5px 15px} div#footer ul.menu li{float:left;position:relative;border-right:1px solid #717171;} div#footer ul.menu li.last{border:0;} div#footer ul.menu li a{color:#717171;text-decoration:none;padding:0 10px;display:inline-block;text-align:center;position:relative;} div#footer .logo{position:absolute;right:15px;height:15px;top:15px;} div#footer .copyright{font:8pt Tahoma;padding:10px 0 10px 25px;} /********** Modal **********/ #mask{display:none;position:absolute;top:0;left:0;background:url('../img/mask.gif');z-index:9000;} .modal-container{display:none;position:absolute;top:0;left:0;z-index:9999;} #modal{margin:40px auto;padding:25px;background:#fff;border:7px solid #ccc;-moz-border-radius:10px;-webkit-border-radius:10px;} #modal-content h2{padding-bottom:5px;font-size:18px;font-weight:normal;border-bottom:1px solid #ddd;} #modal-content label{color:#7a7a7a;font-weight:bold;} #modal-content input[type=text]{margin:5px 0 10px;width:241px;background:#f8f8f8;border:1px solid #aaa;} #modal-close {background:url('../img/close-button.png');width:22px;height:22px;position:absolute;top:-15px;right:-15px;cursor:pointer;} #modal-close a { display: block; border: 1px solid #666;} #modal-close span { display: none;} /********** End of Modal **********/ #message {margin:0 auto; display:none;position:fixed;top:0px;left:10px;right:10px;z-index:100;} .msg-error,.msg-success,.msg-attention,.msg-info{padding:0;margin:0;padding-left:17px;height:30px;line-height:30px;position:relative;border:1px solid #666;} .remove-btn{position:absolute;top:0;right:17px;padding-right:20px;background:url('../img/remove-btn.png') no-repeat center right;color:#333 !important;} .remove-btn:hover{color:#666 !important;} .msg-error{background:#ffd6d6;color:#df5c0c;border: 1px solid #ebb1b1;} .msg-success{background:#eaf8d5;color:#829b36;border:1px solid #829b36;} .msg-attention{background:#fffbcc;color:#c0a443;border:1px solid #c0a443;} .msg-info{background:#d2eef1;color:#369fb4;border:1px solid #369fb4;} /* ============================================= info messages ============================================= */ .form-error { float:left; border: 1px solid #ebb1b1;} .info_success { display:inline;background:url(../img/success.png) no-repeat; padding-left:20px; color:#afda2d; } .error-message {display:inline;background:url(../img/wrong.png) no-repeat; padding-left:20px; color:#df5c0c; } .info_loading {display:inline; background:url(../img/loading.gif) no-repeat; padding-left:20px; } .current-city { color: #000; font-weight: bold;} .current-city span { color: #000; text-decoration: underline; } div#right-col .menu{list-style:none;} div#right-col .menu li { display: block;padding:10px 25px;} div#right-col .menu li a { display: block; font-weight: bold; color: #fff;text-decoration:none;} div#right-col .menu li a:hover { text-decoration:underline;} div#signup_steps .step {padding: 0;margin:0; margin: 5px 5px; } div#signup_steps .step h2 { padding:26px 8px; text-transform:uppercase;color:#fff; background: #ccc;} div#signup_steps .selected {background: url(../img/tri-blue.png) no-repeat;margin-left:-8px;} div#signup_steps .selected h2 {background: #5DA2D7; display:block;margin-left:8px;} -#signup_steps ul li.active { padding-left:0; margin-left:0px;background: url(../img/tri-blue.png) no-repeat;} +#signup_steps ul li.active { padding-left:0; margin-left:0px;background: url(../img/tri-blue.png) no-repeat;} + + + + +/* Map stuff */ +.map_popup { + +} + +.map_popup .title { + font-weight: bold; + text-align:center; + font-size:15px; +} diff --git a/app/webroot/img/SGBluePin.png b/app/webroot/img/SGBluePin.png new file mode 100644 index 0000000..6e97824 Binary files /dev/null and b/app/webroot/img/SGBluePin.png differ diff --git a/app/webroot/img/meter/b_10.png b/app/webroot/img/meter/b_10.png new file mode 100644 index 0000000..13874a1 Binary files /dev/null and b/app/webroot/img/meter/b_10.png differ diff --git a/app/webroot/img/meter/b_100.png b/app/webroot/img/meter/b_100.png new file mode 100644 index 0000000..06fad68 Binary files /dev/null and b/app/webroot/img/meter/b_100.png differ diff --git a/app/webroot/img/meter/b_20.png b/app/webroot/img/meter/b_20.png new file mode 100644 index 0000000..c809006 Binary files /dev/null and b/app/webroot/img/meter/b_20.png differ diff --git a/app/webroot/img/meter/b_30.png b/app/webroot/img/meter/b_30.png new file mode 100644 index 0000000..9db4149 Binary files /dev/null and b/app/webroot/img/meter/b_30.png differ diff --git a/app/webroot/img/meter/b_40.png b/app/webroot/img/meter/b_40.png new file mode 100644 index 0000000..850a052 Binary files /dev/null and b/app/webroot/img/meter/b_40.png differ diff --git a/app/webroot/img/meter/b_50.png b/app/webroot/img/meter/b_50.png new file mode 100644 index 0000000..a84b1f7 Binary files /dev/null and b/app/webroot/img/meter/b_50.png differ diff --git a/app/webroot/img/meter/b_60.png b/app/webroot/img/meter/b_60.png new file mode 100644 index 0000000..79004a0 Binary files /dev/null and b/app/webroot/img/meter/b_60.png differ diff --git a/app/webroot/img/meter/b_70.png b/app/webroot/img/meter/b_70.png new file mode 100644 index 0000000..0d0fb1c Binary files /dev/null and b/app/webroot/img/meter/b_70.png differ diff --git a/app/webroot/img/meter/b_80.png b/app/webroot/img/meter/b_80.png new file mode 100644 index 0000000..e6a24c1 Binary files /dev/null and b/app/webroot/img/meter/b_80.png differ diff --git a/app/webroot/img/meter/b_90.png b/app/webroot/img/meter/b_90.png new file mode 100644 index 0000000..56c87ed Binary files /dev/null and b/app/webroot/img/meter/b_90.png differ
valaravena/Glo
7bac3106397bc7e6b2ccecc49a6f7a72cc5e2f68
Adding update
diff --git a/app/webroot/img/profile/140/empty b/app/webroot/img/profile/140/empty new file mode 100644 index 0000000..e69de29 diff --git a/app/webroot/img/profile/empty b/app/webroot/img/profile/empty new file mode 100644 index 0000000..e69de29
valaravena/Glo
e6c67b9183dc300dba627ee0dd7e397e12506563
Adding update
diff --git a/app/models/account.php b/app/models/account.php index b3b5263..0852fae 100644 --- a/app/models/account.php +++ b/app/models/account.php @@ -1,82 +1,82 @@ <?php class Account extends AppModel { var $name = 'Account'; var $displayField = 'account_type_id'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $actsAs = array( 'FileUpload' => array( 'image' => array( 'required' => array('add' => true, 'edit' => false), 'directory' => 'img/profile', - 'allowed_mime' => array('image/jpg', 'image/jpeg'), - 'allowed_extensions' => array('.jpg', '.jpeg'), + 'allowed_mime' => array('image/jpeg', 'image/pjpeg', 'image/gif', 'image/png'), + 'allowed_extensions' => array('.jpg', '.jpeg', '.png', '.gif'), 'allowed_size' => 2097152, 'random_filename' => true, 'resize' => array( '70' => array( 'directory' => 'img/profile/140', 'width' => 140, 'phpThumb' => array( 'far' => 1, 'bg' => 'FFFFFF' ) ) ) ) ) ); var $belongsTo = array( 'AccountType' => array( 'className' => 'AccountType', 'foreignKey' => 'account_type_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Gender' => array( 'className' => 'Gender', 'foreignKey' => 'gender_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Source' => array( 'className' => 'Source', 'foreignKey' => 'source_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); function getAccountByIdOrUsername($id = null) { if (!empty($id)) { $account = $this->find('first', array( 'conditions' => array( 'OR' => array( array('User.id' => $id), array('User.username' => $id) ), ), ) ); if (!empty($account)) { return $account; } } return false; } } ?> \ No newline at end of file
valaravena/Glo
bfe906cf2257b27fad5d677d95679c72d36d02d5
Adding update
diff --git a/app/app_controller.php b/app/app_controller.php index 428433b..7a5d926 100644 --- a/app/app_controller.php +++ b/app/app_controller.php @@ -1,454 +1,459 @@ <?php class AppController extends Controller { var $helpers = array('Html', 'Form', 'Time', 'Number', 'Javascript', 'Cache', 'Text', 'Session','Menu','Sidebar'); var $components = array('Security', 'Acl', 'Auth', 'Acl.AclFilter', 'Cookie', 'RequestHandler', 'Session', 'Mailer', 'Security'); var $uses = array('User', 'Core.Setting'); var $view = 'Theme'; var $apiRequest = false; var $apiError = false; var $appConfigurations; function __construct() { parent::__construct(); $this->appConfigurations = Configure::read('App'); $this->set('appConfigurations', $this->appConfigurations); } function beforeFilter() { $this->AclFilter->auth(); #$this->Security->blackHoleCallback = '__securityError'; $this->set('title_for_layout', __('Error: Title For Layout needed', true)); $this->Security->validatePost = false; $this->Setting->applyAllUpdates(); if (isset($this->params['admin'])) { $this->layout = 'admin'; } $this->Auth->allow('*'); if (Configure::read('Site.theme') && !isset($this->params['admin'])) { $this->theme = Configure::read('Site.theme'); } elseif (Configure::read('Site.admin_theme') && isset($this->params['admin'])) { $this->theme = Configure::read('Site.admin_theme'); } if (!isset($this->params['admin']) && Configure::read('Site.status') == 0) { $this->layout = 'maintenance'; $this->set('title_for_layout', __('Site down for maintenance', true)); $this->render('../elements/blank'); } if (isset($this->params['locale'])) { Configure::write('Config.language', $this->params['locale']); + } + + if ($this->Auth->user()) { + $account = $this->User->Account->findByUserId($this->Auth->user('id')); + $this->set('account', $account); } /* API Actions */ if ($this->RequestHandler->isXml() || $this->RequestHandler->ext == 'json') { Configure::write('debug',0); $this->Security->loginOptions = array( 'type'=>'basic', 'login'=>'apiLogin', 'realm'=>$this->appConfigurations['name'], ); $status = array(); $user = array(); // Check API Key if (!empty($this->params['url']['api_key'])) { $user = $this->User->findByKey($this->params['url']['api_key']); if (empty($user)) { $status['status'] = array('code' => 500, 'msg' => 'invalid_api_key'); } } else { $status['status'] = array('code' => 500, 'msg' => 'missing_api_key'); $this->apiError = true; } // Check Limit IP if (!$this->apiError && $this->appConfigurations['Api']['limitIp']) { if (!empty($user)) { if (!empty($user['User']['ip']) && $user['User']['ip'] != $this->RequestHandler->getClientIp()) { $status['status'] = array('code' => 500, 'msg' => 'ip_not_accepted', 'received' => $this->RequestHandler->getClientIp(), 'expected' => $user['User']['ip']); $this->apiError = true; } } } $this->set(compact('status')); } } function apiLogin($args) { $data[$this->Auth->fields['username']] = $args['username']; $data[$this->Auth->fields['password']] = $this->Auth->password($args['password']); if ($this->Auth->login($data)) { return true; } else { $this->Security->blackHole($this, 'login'); return false; } } function _sendEmail($data) { if (!empty($data)) { if ($this->Mailer) { $emailConfigurations = Configure::read('Email'); if (!empty($emailConfigurations['Host'])) { $this->Mailer->Host = $emailConfigurations['Host']; } else { $this->log('_sendEmail(), Host parameter required'); return false; } if (!empty($emailConfigurations['Port'])) { $this->Mailer->Port = $emailConfigurations['Port']; } else { $this->log('_sendEmail(), Port parameter required'); return false; } if (!empty($emailConfigurations['IsSMTP'])) { $this->Mailer->IsSMTP(); if (!empty($emailConfigurations['Username'])) { $this->Mailer->Username = $emailConfigurations['Username']; } else { $this->log('_sendEmail(), Username parameter required if using SMTP'); return false; } if (!empty($emailConfigurations['Password'])) { $this->Mailer->Password = $emailConfigurations['Password']; } else { $this->log('_sendEmail(), Password parameter required if using SMTP'); return false; } } if (!empty($emailConfigurations['SMTPAuth'])) { $this->Mailer->SMTPAuth = $emailConfigurations['SMTPAuth']; } if (!empty($emailConfigurations['SMTPSecure'])) { $this->Mailer->SMTPSecure = $emailConfigurations['SMTPSecure']; } if (!empty($emailConfigurations['WordWrap'])) { $this->Mailer->WordWrap = $emailConfigurations['WordWrap']; } if (!empty($emailConfigurations['From'])) { $this->Mailer->From = $emailConfigurations['From']; } else { $this->log('_sendEmail(), From name parameter required'); return false; } if (!empty($emailConfigurations['FromName'])) { $this->Mailer->FromName = $emailConfigurations['FromName']; } if (!empty($data['subject'])) { $this->Mailer->Subject = $data['subject']; } else { $this->log('_sendEmail(), Subject paramerter required'); return false; } if (!empty($data['to'])) { if (is_array($data['to'])) { foreach ($data['to'] as $recipient) { if (!empty($recipient['name'])) { $this->Mailer->AddAddress($recipient['to'], $recipient['name']); } else { $this->Mailer->AddAddress($recipient['to']); } } } else { if (!empty($data['name'])) { $this->Mailer->AddAddress($data['to'], $data['name']); } else { $this->Mailer->AddAddress($data['to']); } } } else { $this->log('_sendEmail(), To parameter required'); return false; } $tmp = array( 'autoRender' => $this->autoRender, 'autoLayout' => $this->autoLayout, 'layout' => $this->layout, 'viewPath' => $this->viewPath, ); $this->set('data', $data); $this->autoRender = false; $this->autoLayout = false; if (empty($data['layout'])) { $data['layout'] = 'default'; } if (empty($data['template'])) { $data['template'] = $this->action; } if (!empty($emailConfigurations['IsHTML'])) { $this->Mailer->IsHTML($emailConfigurations['IsHTML']); $this->layout = 'email'.DS.'html'.DS.$data['layout']; $this->viewPath = 'elements'.DS.'email'.DS.'html'; $bodyHtml = $this->render($data['template']); $this->Mailer->MsgHTML($bodyHtml); } else { $this->layout = 'email'.DS.'text'.DS.$data['layout']; $this->viewPath = 'elements'.DS.'email'.DS.'text'; $bodyText = $this->render($data['template']); $this->Mailer->AltBody = $bodyText; } // Get things back to normal $this->autoRender = $tmp['autoRender']; $this->autoLayout = $tmp['autoLayout']; $this->layout = $tmp['layout']; $this->viewPath = $tmp['viewPath']; if (!$return = $this->Mailer->Send()) { $this->log($this->Mailer->ErrorInfo); $return = false; } $this->Mailer->ClearAddresses(); $this->Mailer->ClearAllRecipients(); $this->Mailer->ClearCustomHeaders(); $this->Mailer->ClearAttachments(); return $return; } else { $this->log('_sendEmail(), PhpMailer component required'); return false; } } else { $this->log('_sendEmail(), data parameter required'); return false; } } /* Can this be placed somewhere else */ function build_acl() { if (!Configure::read('debug')) { return $this->_stop(); } $log = array(); $aco =& $this->Acl->Aco; $root = $aco->node('controllers'); if (!$root) { $aco->create(array('parent_id' => null, 'model' => null, 'alias' => 'controllers')); $root = $aco->save(); $root['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for controllers'; } else { $root = $root[0]; } App::import('Core', 'File'); $Controllers = Configure::listObjects('controller'); $appIndex = array_search('App', $Controllers); if ($appIndex !== false ) { unset($Controllers[$appIndex]); } $baseMethods = get_class_methods('Controller'); $baseMethods[] = 'buildAcl'; $Plugins = $this->_getPluginControllerNames(); $Controllers = array_merge($Controllers, $Plugins); // look at each controller in app/controllers foreach ($Controllers as $ctrlName) { $methods = $this->_getClassMethods($this->_getPluginControllerPath($ctrlName)); // Do all Plugins First if ($this->_isPlugin($ctrlName)){ $pluginNode = $aco->node('controllers/'.$this->_getPluginName($ctrlName)); if (!$pluginNode) { $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $this->_getPluginName($ctrlName))); $pluginNode = $aco->save(); $pluginNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $this->_getPluginName($ctrlName) . ' Plugin'; } } // find / make controller node $controllerNode = $aco->node('controllers/'.$ctrlName); if (!$controllerNode) { if ($this->_isPlugin($ctrlName)){ $pluginNode = $aco->node('controllers/' . $this->_getPluginName($ctrlName)); $aco->create(array('parent_id' => $pluginNode['0']['Aco']['id'], 'model' => null, 'alias' => $this->_getPluginControllerName($ctrlName))); $controllerNode = $aco->save(); $controllerNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $this->_getPluginControllerName($ctrlName) . ' ' . $this->_getPluginName($ctrlName) . ' Plugin Controller'; } else { $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $ctrlName)); $controllerNode = $aco->save(); $controllerNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $ctrlName; } } else { $controllerNode = $controllerNode[0]; } //clean the methods. to remove those in Controller and private actions. foreach ($methods as $k => $method) { if (strpos($method, '_', 0) === 0) { unset($methods[$k]); continue; } if (in_array($method, $baseMethods)) { unset($methods[$k]); continue; } $methodNode = $aco->node('controllers/'.$ctrlName.'/'.$method); if (!$methodNode) { $aco->create(array('parent_id' => $controllerNode['Aco']['id'], 'model' => null, 'alias' => $method)); $methodNode = $aco->save(); $log[] = 'Created Aco node for '. $method; } } } if(count($log)>0) { debug($log); } } function _getClassMethods($ctrlName = null) { App::import('Controller', $ctrlName); if (strlen(strstr($ctrlName, '.')) > 0) { // plugin's controller $num = strpos($ctrlName, '.'); $ctrlName = substr($ctrlName, $num+1); } $ctrlclass = $ctrlName . 'Controller'; $methods = get_class_methods($ctrlclass); // Add scaffold defaults if scaffolds are being used $properties = get_class_vars($ctrlclass); if (array_key_exists('scaffold',$properties)) { if($properties['scaffold'] == 'admin') { $methods = array_merge($methods, array('admin_add', 'admin_edit', 'admin_index', 'admin_view', 'admin_delete')); } else { $methods = array_merge($methods, array('add', 'edit', 'index', 'view', 'delete')); } } return $methods; } function _isPlugin($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) > 1) { return true; } else { return false; } } function _getPluginControllerPath($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[0] . '.' . $arr[1]; } else { return $arr[0]; } } function _getPluginName($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[0]; } else { return false; } } function _getPluginControllerName($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[1]; } else { return false; } } /** * Get the names of the plugin controllers ... * * This function will get an array of the plugin controller names, and * also makes sure the controllers are available for us to get the * method names by doing an App::import for each plugin controller. * * @return array of plugin names. * */ function _getPluginControllerNames() { App::import('Core', 'File', 'Folder'); $paths = Configure::getInstance(); $folder =& new Folder(); $folder->cd(APP . 'plugins'); // Get the list of plugins $Plugins = $folder->read(); $Plugins = $Plugins[0]; $arr = array(); // Loop through the plugins foreach($Plugins as $pluginName) { // Change directory to the plugin $didCD = $folder->cd(APP . 'plugins'. DS . $pluginName . DS . 'controllers'); // Get a list of the files that have a file name that ends // with controller.php $files = $folder->findRecursive('.*_controller\.php'); // Loop through the controllers we found in the plugins directory foreach($files as $fileName) { // Get the base file name $file = basename($fileName); // Get the controller name $file = Inflector::camelize(substr($file, 0, strlen($file)-strlen('_controller.php'))); if (!preg_match('/^'. Inflector::humanize($pluginName). 'App/', $file)) { if (!App::import('Controller', $pluginName.'.'.$file)) { debug('Error importing '.$file.' for plugin '.$pluginName); } else { /// Now prepend the Plugin name ... // This is required to allow us to fetch the method names. $arr[] = Inflector::humanize($pluginName) . "/" . $file; } } } } return $arr; } } diff --git a/app/config/core.php b/app/config/core.php index ad8877d..4e6ebbe 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -1,302 +1,302 @@ <?php /** * This is core configuration file. * * Use it to configure core behavior of Cake. * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package cake * @subpackage cake.app.config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** * CakePHP Debug Level: * * Production Mode: * 0: No error messages, errors, or warnings shown. Flash messages redirect. * * Development Mode: * 1: Errors and warnings shown, model caches refreshed, flash messages halted. * 2: As in 1, but also with full debug messages and SQL output.ad * * In production mode, flash messages redirect after a time interval. * In development mode, you need to click the flash message to continue. */ - Configure::write('debug', 0); + Configure::write('debug', 2); /** * CakePHP Log Level: * * In case of Production Mode CakePHP gives you the possibility to continue logging errors. * * The following parameters can be used: * Boolean: Set true/false to activate/deactivate logging * Configure::write('log', true); * * Integer: Use built-in PHP constants to set the error level (see error_reporting) * Configure::write('log', E_ERROR | E_WARNING); * Configure::write('log', E_ALL ^ E_NOTICE); */ Configure::write('log', true); /** * Application wide charset encoding */ Configure::write('App.encoding', 'UTF-8'); /** * To configure CakePHP *not* to use mod_rewrite and to * use CakePHP pretty URLs, remove these .htaccess * files: * * /.htaccess * /app/.htaccess * /app/webroot/.htaccess * * And uncomment the App.baseUrl below: */ //Configure::write('App.baseUrl', env('SCRIPT_NAME')); /** * Uncomment the define below to use CakePHP prefix routes. * * The value of the define determines the names of the routes * and their associated controller actions: * * Set to an array of prefixes you want to use in your application. Use for * admin or other prefixed routes. * * Routing.prefixes = array('admin'); * * Enables: * `admin_index()` and `/admin/controller/index` * `manager_index()` and `/manager/controller/index` * * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] */ Configure::write('Routing.prefixes', array('admin')); /** * Turn off all caching application-wide. * */ //Configure::write('Cache.disable', true); /** * Enable cache checking. * * If set to true, for view caching you must still use the controller * var $cacheAction inside your controllers to define caching settings. * You can either set it controller-wide by setting var $cacheAction = true, * or in each action using $this->cacheAction = true. * */ //Configure::write('Cache.check', true); /** * Defines the default error type when using the log() function. Used for * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. */ define('LOG_ERROR', 2); /** * The preferred session handling method. Valid values: * * 'php' Uses settings defined in your php.ini. * 'cake' Saves session files in CakePHP's /tmp directory. * 'database' Uses CakePHP's database sessions. * * To define a custom session handler, save it at /app/config/<name>.php. * Set the value of 'Session.save' to <name> to utilize it in CakePHP. * * To use database sessions, run the app/config/schema/sessions.php schema using * the cake shell command: cake schema run create Sessions * */ Configure::write('Session.save', 'php'); /** * The model name to be used for the session model. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The model name set here should *not* be used elsewhere in your application. */ //Configure::write('Session.model', 'Session'); /** * The name of the table used to store CakePHP database sessions. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The table name set here should *not* include any table prefix defined elsewhere. * * Please note that if you set a value for Session.model (above), any value set for * Session.table will be ignored. * * [Note: Session.table is deprecated as of CakePHP 1.3] */ //Configure::write('Session.table', 'cake_sessions'); /** * The DATABASE_CONFIG::$var to use for database session handling. * * 'Session.save' must be set to 'database' in order to utilize this constant. */ //Configure::write('Session.database', 'default'); /** * The name of CakePHP's session cookie. * * Note the guidelines for Session names states: "The session name references * the session id in cookies and URLs. It should contain only alphanumeric * characters." * @link http://php.net/session_name */ Configure::write('Session.cookie', 'CAKEPHP'); /** * Session time out time (in seconds). * Actual value depends on 'Security.level' setting. */ Configure::write('Session.timeout', '120'); /** * If set to false, sessions are not automatically started. */ Configure::write('Session.start', true); /** * When set to false, HTTP_USER_AGENT will not be checked * in the session */ Configure::write('Session.checkAgent', true); /** * The level of CakePHP security. The session timeout time defined * in 'Session.timeout' is multiplied according to the settings here. * Valid values: * * 'high' Session timeout in 'Session.timeout' x 10 * 'medium' Session timeout in 'Session.timeout' x 5040 * 'low' Session timeout in 'Session.timeout' x 2628000 * * CakePHP session IDs are also regenerated between requests if * 'Security.level' is set to 'high'. */ Configure::write('Security.level', 'medium'); /** * A random string used in security hashing methods. */ Configure::write('Security.salt', '087333c18fff60a7d94188f724d362191ee4b429'); /** * A random numeric string (digits only) used to encrypt/decrypt strings. */ Configure::write('Security.cipherSeed', '67004110033610364'); /** * Apply timestamps with the last modified time to static assets (js, css, images). * Will append a querystring parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable * timestamping. */ //Configure::write('Asset.timestamp', true); /** * Compress CSS output by removing comments, whitespace, repeating tags, etc. * This requires a/var/cache directory to be writable by the web server for caching. * and /vendors/csspp/csspp.php * * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). */ //Configure::write('Asset.filter.css', 'css.php'); /** * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the * output, and setting the config below to the name of the script. * * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). */ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** * The classname and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); /** * If you are on PHP 5.3 uncomment this line and correct your server timezone * to fix the date & time related errors. */ //date_default_timezone_set('UTC'); /** * * Cache Engine Configuration * Default settings provided below * * File storage engine. * * Cache::config('default', array( * 'engine' => 'File', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path * 'prefix' => 'cake_', //[optional] prefix every cache file with this string * 'lock' => false, //[optional] use file locking * 'serialize' => true, [optional] * )); * * * APC (http://pecl.php.net/package/APC) * * Cache::config('default', array( * 'engine' => 'Apc', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * )); * * Xcache (http://xcache.lighttpd.net/) * * Cache::config('default', array( * 'engine' => 'Xcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'user' => 'user', //user from xcache.admin.user settings * 'password' => 'password', //plaintext password (xcache.admin.pass) * )); * * * Memcache (http://www.danga.com/memcached/) * * Cache::config('default', array( * 'engine' => 'Memcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'servers' => array( * '127.0.0.1:11211' // localhost, default port 11211 * ), //[optional] * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) * )); * */ Cache::config('default', array('engine' => 'File')); diff --git a/app/config/schema/glow.sqlite b/app/config/schema/glow.sqlite index 7fd0fd8..6962410 100644 Binary files a/app/config/schema/glow.sqlite and b/app/config/schema/glow.sqlite differ diff --git a/app/controllers/accounts_controller.php b/app/controllers/accounts_controller.php index 46f166d..69860df 100644 --- a/app/controllers/accounts_controller.php +++ b/app/controllers/accounts_controller.php @@ -1,201 +1,203 @@ <?php class AccountsController extends AppController { var $name = 'Accounts'; var $helpers = array('Gravatar'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); } function index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function profile() { $this->set('title_for_layout', __('Account Profile', true)); if ($this->Auth->user()) { - $account = $this->Account->findByUserId($this->Auth->user('id')); + $account = $this->Account->findByUserId($this->Auth->user('id')); $account['Account']['full_name'] = $account['Account']['first_name'] . " ". $account['Account']['last_name']; if (!empty($this->data)) { $fullName = explode(" ", trim($this->data['Account']['full_name'])); - list($lastName) = $fullName; - die($lastName); + list($firstName, $lastName) = $fullName; + $this->data['Account']['id'] = $account['Account']['id']; + $this->data['Account']['first_name'] = $firstName; + $this->data['Account']['last_name'] = $lastName; - if ($user = $this->Account->register($this->data, $this->Auth->user('id'))) { - $this->Session->setFlash(__('Your profile as been updated.', true), 'success'); - $this->redirect(array('action' => 'account')); - } else { + if ($this->Account->save($this->data)) { + $this->Session->setFlash(__('Your profile has been updated.', true), 'success'); + $this->redirect(array('action' => 'profile')); + } else { $this->Session->setFlash(__('Your profile could not be saved. Please, try again.', true), 'error'); } } $this->data =$account; } else { $this->redirect('/login'); } } function admin_index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function authenticate() { $account = array(); if ($this->Auth->user('id')) { $this->Account->recursive = 0; $account = $this->Account->getAccountByIdOrUsername($this->Auth->user('id')); if (!empty($account)) { # $account['User'] = # $return['User'] = # $account['Account'] = array($account['Account'][]) #$account = am($account['User'], $account['Account']); } } $this->set(compact('account')); } function location() { - debug($this->params); if (!$this->RequestHandler->isAjax()) { $this->redirect(array('action' => 'index')); - } - if (!empty($location)) { - echo $location; - } - echo "NO Location"; - - + } + + if (!empty($this->params['form']['Account'])) { + $this->Account->recursive = 0; + $account = $this->Account->findByUserId($this->Auth->user('id')); + $this->Account->id = $account['Account']['id']; + $this->Account->saveField('location', $this->params['form']['Account']['location']); + } } } ?> \ No newline at end of file diff --git a/app/controllers/users_controller.php b/app/controllers/users_controller.php index 352357d..bcf283e 100644 --- a/app/controllers/users_controller.php +++ b/app/controllers/users_controller.php @@ -1,301 +1,302 @@ <?php class UsersController extends AppController { var $name = 'Users'; var $components = array('Recaptcha'); - var $helpers = array('Recaptcha', 'SimpleGeo.GoogleMap'); + var $helpers = array('Recaptcha', 'SimpleGeo.GoogleMap'); + var $uses = array('SimpleGeo.SimpleGeo'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); if (!empty($this->Auth)) { $this->Auth->allow('activate', 'register', 'reset', 'recover', 'resend', 'login', 'logout'); $this->Auth->allow('*'); } } function index() { $simpleGeoLayer = 'iWobbleTestLayer'; $points = array(); if (!empty($simpleGeoLayer)) { if (!empty($this->params['url']['hash'])) { $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); if (!empty($result->features)) { foreach ($result->features as $feature) { $point['Point']['id'] = $feature->id; $point['Point']['name'] = $feature->id; $point['Point']['longitude'] = $feature->geometry->coordinates[0]; $point['Point']['latitude'] = $feature->geometry->coordinates[1]; $point['Point']['created'] = $feature->created; $points[] = $point; } } else { if (!empty($result->message)) { #die($result->message); } } } $this->set('points', $points); } } function login() { $this->set('title_for_layout', __('Login', true)); if (!empty($this->data)) { if (!empty($this->data['User']['remember_me']) && $this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function register($status = '') { $this->set('title_for_layout', __('Register with Gridglo', true)); if (!$this->Session->check('Auth.User')) { if (!empty($this->data)) { $this->data['User']['group_id'] = 3; $this->data['User']['active'] = 1; if ($user = $this->User->register($this->data)) { $this->_sendEmail($user); $this->Session->write('Registration.email', $user['to']); $this->redirect(array('action' => 'register', 'success')); } else { $this->Session->setFlash(__('We were unable to register your account!', true), 'error'); } } elseif ($status) { if ($this->Session->check('Registration.email')) { $this->set('email', $this->Session->read('Registration.email')); $this->render($this->action.'_'.$status); } else { $this->redirect(array('action' => 'register')); } } } else { $this->redirect('/'); } } function activate($key = null) { if (!$this->Session->check('Auth.User')) { if (!is_null($key)) { if ($user = $this->User->activate($key)) { $this->Auth->login($user); $this->_sendEmail($user); $this->Session->setFlash(__('Your account is verified!', true), 'success'); $this->redirect(array('action' => 'done')); } else { $this->Session->setFlash(__('We were unable to verify you account! Account may already be active.', true), 'error'); $this->redirect(array('action' => 'login')); } } else { $this->redirect(array('action' => 'login')); } } else { $this->redirect('/'); } } function done() { if ($this->Session->check('Auth.User')) { if (!empty($this->data)) { if ($this->Auth->user('id')) { $user = $this->User->read(null, $this->Auth->user('id')); $this->User->save($this->data); $this->Auth->login($user); $this->redirect($this->Auth->redirect('/')); } else { $this->redirect(array('action' => 'login')); } } else { $this->data = $this->Auth->user(); } } else { $this->redirect('/'); } } function skip() { $this->redirect($this->Auth->redirect('/')); // Track User/Insert History // Send to Home Page } function recover() { $this->set('title_for_layout', __('Reset your Password', true)); if (!empty($this->data)) { if ($user = $this->User->recover($this->data)) { $this->_sendEmail($user); $this->Session->setFlash(__('Password Change Email has been sent!', true), 'success'); $this->redirect(array('action' => 'login')); } else { $this->Session->setFlash(__('No user found with that email', true), 'error'); } } } function reset($key = null) { if (!is_null($key)) { if ($user = $this->User->resetKey($key)) { $this->Session->write('Reset.User', $user); } } if ($user = $this->Session->read('Reset.User')) { $this->set('user', $user); if (!empty($this->data)) { if ($this->User->reset($this->data, $user['User']['id'])) { $this->Session->delete('Reset'); $this->redirect('/'); } } } else { $this->redirect('/'); } } function resend($email = null) { if (!is_null($email)) { if ($user = $this->User->resend($email)) { $this->_sendEmail($user); } else { $this->Session->setFlash(__('Unable to send activation email. It may be that the account is already active or the email doesn\'t exisit.', true), 'error'); } } $this->redirect(array('action' => 'login')); } function changepassword() { $this->layout = 'account'; $this->set('title_for_layout', __('Change Password', true)); if (!empty($this->data)) { if ($user = $this->User->reset($this->data)) { $this->Session->setFlash(__('Password Change Email has been sent!', true), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Unable to change your password. Please try again.', true), 'error'); $this->redirect(array('action' => 'changepassword')); } } } function admin_login() { $this->set('title_for_layout', __('Administration Login', true)); $this->layout = "admin_login"; if (!empty($this->data)) { if ($this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function admin_logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function admin_index() { $this->set('title_for_layout', __('Users', true)); $this->User->recursive = 0; $this->set('users', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } $this->set('user', $this->User->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->User->create(); if ($this->User->register($this->data)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } $this->set('title_for_layout', sprintf(__('Add %s', true), 'User')); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->User->register($this->data, $id)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } if (empty($this->data)) { $this->data = $this->User->read(null, $id); } $this->set('title_for_layout', sprintf(__('Edit "%s"', true), $this->data['User']['username'])); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid id for %s', true), 'User')); $this->redirect(array('action' => 'index')); } if ($this->User->delete($id)) { $this->Session->setFlash(sprintf(__('%s deleted', true), 'User')); $this->redirect(array('action' => 'index')); } } /* API STUFF */ function authenticate() { $user = array(); if ($this->Auth->user('id')) { $this->log('Logged in as '. $this->Auth->user('username')); $user = $this->User->Account->getAccountByIdOrUsername($this->Auth->user('id')); } $this->set(compact('user')); } } diff --git a/app/models/account.php b/app/models/account.php index 7f71ddd..b3b5263 100644 --- a/app/models/account.php +++ b/app/models/account.php @@ -1,82 +1,82 @@ <?php class Account extends AppModel { var $name = 'Account'; var $displayField = 'account_type_id'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $actsAs = array( 'FileUpload' => array( 'image' => array( 'required' => array('add' => true, 'edit' => false), - 'directory' => 'img/publicacion', + 'directory' => 'img/profile', 'allowed_mime' => array('image/jpg', 'image/jpeg'), 'allowed_extensions' => array('.jpg', '.jpeg'), 'allowed_size' => 2097152, 'random_filename' => true, 'resize' => array( '70' => array( - 'directory' => 'img/140', + 'directory' => 'img/profile/140', 'width' => 140, 'phpThumb' => array( 'far' => 1, 'bg' => 'FFFFFF' ) ) ) ) ) ); var $belongsTo = array( 'AccountType' => array( 'className' => 'AccountType', 'foreignKey' => 'account_type_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Gender' => array( 'className' => 'Gender', 'foreignKey' => 'gender_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Source' => array( 'className' => 'Source', 'foreignKey' => 'source_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); function getAccountByIdOrUsername($id = null) { if (!empty($id)) { $account = $this->find('first', array( 'conditions' => array( 'OR' => array( array('User.id' => $id), array('User.username' => $id) ), ), ) ); if (!empty($account)) { return $account; } } return false; } } ?> \ No newline at end of file diff --git a/app/models/behaviors/file_upload.php b/app/models/behaviors/file_upload.php index 17b935c..9509ea0 100644 --- a/app/models/behaviors/file_upload.php +++ b/app/models/behaviors/file_upload.php @@ -1,288 +1,289 @@ <?php App::import('Core', array('Folder', 'File')); App::import('Vendor', 'phpthumb', array('file' => 'phpthumb'.DS.'phpthumb.php')); class FileUploadBehavior extends ModelBehavior{ var $options = array( 'required' => false, 'directory' => 'img/upload', 'allowed_mime' => array('image/jpeg', 'image/pjpeg', 'image/gif', 'image/png'), 'allowed_extensions' => array('.jpg', '.jpeg', '.png', '.gif'), 'allowed_size' => 1048576, 'random_filename' => true, 'resize' => array( 'max' => array( 'directory' => 'img/upload/max', 'width' => 640, 'height' => 480, 'phpThumb' => array( 'zc' => 0 ) ), 'thumb' => array( 'directory' => 'img/upload/thumbs', 'width' => 320, 'height' => 240, 'phpThumb' => array( 'zc' => 0 ) ) ) ); /** * Array of errors */ var $errors = array(); var $__fields; function setup(&$model, $config = array()){ $config_temp = array(); $config = array_merge($this->options, $config); foreach($config as $field => $options){ // Check if given field exists if(!$model->hasField($field)){ unset($config[$field]); unset($model->data[$model->name][$field]); continue; } if(substr($options['directory'], -1) != '/'){ $options['directory'] = $options['directory'] . DS; } if ($options['resize']) { foreach($options['resize'] as $name => $resize){ if(isset($options['resize'][$name]['directory']) && substr($options['resize'][$name]['directory'], -1) != '/'){ $options['resize'][$name]['directory'] = $options['resize'][$name]['directory'] . DS; } } } $config_temp[$field] = $options; } - $this->__fields = $config_temp; + $this->__fields = $config_temp; } function beforeSave(&$model) { if(count($this->__fields) > 0) { foreach($this->__fields as $field => $options){ // Check for model data whether has been set or not if(!isset($model->data[$model->name][$field])){ continue; } // Check the data if it's not an array if(isset($model->data) && !is_array($model->data[$model->name][$field])){ unset($model->data[$model->name][$field]); continue; } // Check any error occur if($model->data[$model->name][$field]['error'] > 0){ // if error == 4 then we are not loading a file, so lets see if we want to delete it if(!empty($model->data[$model->name][$field]['delete'])) { // lets delete the old images $current = $model->findById($model->data[$model->name][$field]['delete']); if(!empty($current[$model->name][$field])) { $this->removeFiles($current[$model->name][$field], $options); } $model->data[$model->name][$field] = ''; } else { unset($model->data[$model->name][$field]); } continue; } // Create final save path if(!isset($options['random_filename']) || !$options['random_filename']) { $saveAs = realpath($options['directory']) . DS . $model->data[$model->name][$field]['name']; } else { // Remove any file which did exist for this model if(!empty($model->data[$model->name]['id'])) { $current = $model->findById($model->data[$model->name]['id']); // lets delete the old images if(!empty($current[$model->name][$field])) { $this->removeFiles($current[$model->name][$field], $options); } } if(!isset($options['random_filename']) || !$options['random_filename']) { - $saveAs = realpath(WWW_ROOT . $options['directory']) .DS. $model->data[$model->name][$field]['name']; + $saveAs = realpath(WWW_ROOT . $options['directory']) . DS . $model->data[$model->name][$field]['name']; } else { $uniqueFileName = sha1(uniqid(rand(), true)); $extension = explode('.', $model->data[$model->name][$field]['name']); - $saveAs = realpath(WWW_ROOT . $options['directory']) .DS. $uniqueFileName . '.' . $extension[count($extension)-1]; + $saveAs = realpath(WWW_ROOT . $options['directory']) . DS . $uniqueFileName . '.' . $extension[count($extension)-1]; } - } + } - // Attempt to move uploaded file - if(!move_uploaded_file($model->data[$model->name][$field]['tmp_name'], $saveAs)) { + // Attempt to move uploaded file + if(!move_uploaded_file($model->data[$model->name][$field]['tmp_name'], $saveAs)) { + die('coud not upload'); unset($model->data[$model->name][$field]); continue; } // Update model data $model->data[$model->name]['type'] = $model->data[$model->name][$field]['type']; $model->data[$model->name]['size'] = $model->data[$model->name][$field]['size']; $model->data[$model->name][$field] = basename($saveAs); if(!empty($options['resize'])){ foreach($options['resize'] as $name => $resize){ $this->generateThumbnail($saveAs, $resize); } } } } return true; } function beforeValidate(&$model) { - foreach($this->__fields as $field => $options) { + foreach($this->__fields as $field => $options) { if(!empty($model->data[$model->name][$field]['type']) && !empty($options['allowed_mime'])) { // Check extensions if(count($options['allowed_extensions']) > 0) { $matches = 0; foreach($options['allowed_extensions'] as $extension){ if(strtolower(substr($model->data[$model->name][$field]['name'],-strlen($extension))) == $extension){ $matches++; } } if($matches == 0) { $allowed_ext = implode(', ', $options['allowed_extensions']); $model->invalidate($field, sprintf(__('Invalid file type. Only %s allowed.', true), $allowed_ext)); continue; } } // Check mime if(count($options['allowed_mime']) > 0 && !in_array($model->data[$model->name][$field]['type'], $options['allowed_mime'])) { $model->invalidate($field, __('Invalid file type', true)); continue; } // Check the size if($model->data[$model->name][$field]['size'] > $options['allowed_size']) { $model->invalidate($field, sprintf(__('The image you uploaded exceeds the maximum file size of %d bytes', true), $options['allowed_size'])); continue; } }else{ if(is_array($options['required'])) { foreach ($options['required'] as $action => $required) { $empty = false; switch($action){ case 'add': if($required == true && empty($mode->data[$model->name]['id'])){ $empty = true; continue; } break; case 'edit': if($required == true && !empty($mode->data[$model->name]['id'])){ $empty = true; continue; } break; } if($empty){ $model->invalidate($field, sprintf(__('%s is required.', true), Inflector::humanize($field))); continue; } } } elseif($options['required'] == true) { $model->invalidate($field, sprintf(__('%s is required.', true), Inflector::humanize($field))); continue; } } } } function beforeDelete(&$model) { if(count($this->__fields) > 0){ $model->read(null, $model->id); if (isset($model->data)) { foreach($this->__fields as $field => $options){ if(!empty($model->data[$model->name][$field])) { $this->removeFiles($model->data[$model->name][$field], $options); } } } } return true; } function removeFiles($file, $options) { $file_with_ext = WWW_ROOT . $options['directory'] . $file; if(file_exists($file_with_ext)) { unlink($file_with_ext); } if (!empty($options['resize'])) { foreach($options['resize'] as $name => $resize){ $resizePath = WWW_ROOT . $resize['directory'] . $file; if(file_exists($resizePath)){ unlink($resizePath); } } } } function generateThumbnail($saveAs, $options){ $destination = WWW_ROOT . $options['directory'] . DS . basename($saveAs); $ext = substr(basename($saveAs), strrpos(basename($saveAs), '.') + 1); if($ext == '.jpg' || $ext == '.jpeg'){ $format = 'jpeg'; }elseif($ext == 'png'){ $format = 'png'; }elseif($ext == 'gif'){ $format = 'gif'; }else{ $format = 'jpeg'; } $phpThumb = new phpthumb(); $phpThumb->setSourceFilename($saveAs); $phpThumb->setCacheDirectory(CACHE); $phpThumb->setParameter('w', $options['width']); if (!empty($option['height'])) { $phpThumb->setParameter('h', $options['height']); } $phpThumb->setParameter('f', $format); if(!empty($options['phpThumb'])){ foreach($options['phpThumb'] as $name => $value){ if(!empty($value)){ $phpThumb->setParameter($name, $value); } } } if($phpThumb->generateThumbnail()){ if($phpThumb->RenderToFile($destination)){ chmod($destination, 0644); return true; }else{ return false; } }else{ return false; } } } ?> diff --git a/app/plugins/simple_geo/controllers/simple_geo_controller.php b/app/plugins/simple_geo/controllers/simple_geo_controller.php index 2b79e5c..961f568 100644 --- a/app/plugins/simple_geo/controllers/simple_geo_controller.php +++ b/app/plugins/simple_geo/controllers/simple_geo_controller.php @@ -1,48 +1,48 @@ <?php class SimpleGeoController extends SimpleGeoAppController { var $name = "SimpleGeo"; var $uses = array('SimpleGeo.SimpleGeo'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('records'); } function admin_index() { $this->set('title_for_layout', __('Simple Geo', true)); } - function nearby($simpleGeoLayer) { + function nearby() { $points = array(); if (!empty($simpleGeoLayer)) { if (!empty($this->params['url']['hash'])) { $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); if (!empty($result->features)) { foreach ($result->features as $feature) { $point['Point']['id'] = $feature->id; $point['Point']['name'] = $feature->id; $point['Point']['longitude'] = $feature->geometry->coordinates[0]; $point['Point']['latitude'] = $feature->geometry->coordinates[1]; $point['Point']['created'] = $feature->created; $points[] = $point; } } else { if (!empty($result->message)) { #die($result->message); } } } $this->set('points', $points); } } function records($id = null, $simpleGeoLayer = null) { } } \ No newline at end of file diff --git a/app/views/accounts/profile.ctp b/app/views/accounts/profile.ctp index ad60681..5b51136 100644 --- a/app/views/accounts/profile.ctp +++ b/app/views/accounts/profile.ctp @@ -1,47 +1,47 @@ <div class="clearfix"></div> <div id="left-col"> <?php $html->addCrumb(__('Account Profile', true), '/accounts/profile'); ?> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div style="position:relative;"> <h2 class="login"><?php echo __('Account Profile', true); ?></h2> <fieldset> - <?php echo $form->create('Account');?> + <?php echo $form->create('Account', array('type' => 'file'));?> <?php echo $form->input('image', array('type' => 'file', 'label' => __('Profile Image', true)))?> <?php echo $form->input('full_name', array('label' => __('Full Name', true)))?> <?php echo $form->input('location', array('label' => __('Current Location', true)))?> <?php echo $form->input('bio', array('label' => __('About Yourself', true)));?> <?php echo $form->input('date_of_birth', array('label' => __('Date of Birth', true)))?> <?php echo $form->input('gender_id', array('label' => __('Gender', true)))?> <?php echo $form->end(__('Update Profile', true));?> </fieldset> <div class="profile_image" > <?php if (!empty($this->data['Account']['image'])): ?> - <?php echo $this->data['Account']['image']?> + <?php echo $html->image('profile/140/'. $this->data['Account']['image'])?> <?php else: ?> <?php echo $html->image('no_photo.png', array('alt' => __('No Profile Photo', true)))?> <?php endif; ?> </div> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu'); ?> </div> diff --git a/app/views/elements/menu_top.ctp b/app/views/elements/menu_top.ctp index 19f290f..68306e8 100644 --- a/app/views/elements/menu_top.ctp +++ b/app/views/elements/menu_top.ctp @@ -1,43 +1,43 @@ <?php echo $javascript->codeBlock(); ?> $(function(){ $('.editable').inlineEdit({ save: function(e, data) { - $.post("<?php echo $html->url(array('controller' => 'accounts', 'action' => 'location')); ?>", data); + $.post("<?php echo $html->url(array('controller' => 'accounts', 'action' => 'location')); ?>", {"Account[location]": data}); } }); }); <?php echo $javascript->blockEnd(); ?> <?php $pages = $this->requestAction('/pages/getpages/top');?> <ul class="menu"> <li><?php echo $html->link(__('Home', true), '/');?></li> <?php if(!empty($pages)): ?> <?php foreach ($pages as $page): ?> <li><?php echo $html->link($page['Page']['name'], array('controller' => 'pages', 'action' => 'view', $page['Page']['slug'])); ?></li> <?php endforeach; ?> <?php endif; ?> </ul> <?php if ($session->check('Auth.User')): ?> <div style="float:right; margin:-25px 25px 0 0;"> <div class="current-city"> - <?php echo sprintf(__('Currently in %s', true), $html->tag('span', 'Some City, St', array('class' => 'editable'))); ?> + <?php echo sprintf(__('Currently in %s', true), $html->tag('span', $account['Account']['location'], array('class' => 'editable'))); ?> </div> </div> <!-- <div style="float:right; border: 1px solid #666;"> <dl> <dt>test</dt> <dd>EPM</dd> </dl> <div class="settings-menu"> <div class="settings-menu-top"> <?php echo $html->link($html->tag('span', 'Test'), array(), array('class' => '', 'escape' => false))?> </div> <div class="settings-menu-dropdown"> <ul> <li><?php echo $html->link(__('Profile', true), array('controller' => 'accounts', 'action' => 'profile')); ?></li> </ul> </div> </div> </div> --> <?php endif; ?> diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index 8b2f537..57a9643 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,56 +1,74 @@ <?php echo $javascript->link("http://www.google.com/jsapi"); -echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); +echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); +echo $javascript->codeBlock("geocoder = new google.maps.Geocoder();"); echo $javascript->codeBlock(); -?> +?> $(document).ready(function() { - $.get('<?php echo $html->url(array('admin' => false, 'plugin' => 'simple_geo', 'controller' => 'simple_geo', 'action' => 'nearby', $simpleGeoLayer['SimpleGeoLayer']['name'],)) ?>', {hash: google.loader.ClientLocation.latitude+','+google.loader.ClientLocation.longitude}, function (data) { $("#map_box").html(data)}); -}) + if (geocoder) { + geocoder.geocode({'address': "<?php echo $account['Account']['location'];?>"}, + function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + map.setCenter(results[0].geometry.location); + updateLayer(results[0].geometry.location); + } else { + + } + } + ); + } + + function updateLayer(latlng) { + + } +}); + + <?php echo $javascript->blockEnd();?> <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div> <?php if (!empty($points)) { foreach($points as $n=>$point){ $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b><br />"; $points[$n]['Point']['html'] = $point['Point']['name']; } } $default = array('zoom' => 12); echo $googleMap->map($default, $style = 'width:100%; height: 500px;'); echo $googleMap->addEvent('dragend', 'mapDrag', "var mapDrag = function(event){}"); if (isset($overLay)) { echo $googleMap->addOverlay($overLay); } if(isset($points)){ echo $googleMap->addMarkers($points, 'http://boingboing.net/style/reportthis.png'); echo $googleMap->addMarkerOnClick("<h1>This is the Point</h1>"); } ?> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> </div> diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo.html b/app/webroot/img/Error_ Title For Layout needed _ Gridglo.html deleted file mode 100644 index a4bcd67..0000000 --- a/app/webroot/img/Error_ Title For Layout needed _ Gridglo.html +++ /dev/null @@ -1,149 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head> - - - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> - Error: Title For Layout needed :: - Gridglo </title> - <link rel="stylesheet" type="text/css" href="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/style.css"><script type="text/javascript" src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/jquery.js"></script><script type="text/javascript" src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/common.js"></script><link type="text/css" rel="stylesheet" id="webdeveloper-outline-current-element" href="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/outline_current_element.css"></head><body> - <div id="container"> - <div id="header"> - <div id="logo"> - <a href="http://glow/"><img src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/logo.gif" alt="Gridglo" title="Gridglo"></a> </div> - <div id="top-menu"> - <ul class="menu"> - <li><a href="http://glow/">Home</a></li> - <li><a href="http://glow/pages/about_us">About Us</a></li> - <li><a href="http://glow/pages/home/pages/platform">Platform</a></li> - <li><a href="http://glow/pages/home/pages/developers">Developers</a></li> - <li><a href="http://glow/pages/home/pages/utility">Utility</a></li> - <li class="last"><a href="http://glow/pages/home/pages/services">Services</a></li> -</ul> -<span class="clearFix"></span> - </div> - </div> - - <div id="content" class="clearfix"> - <div id="content-top" class="clearfix"> - <div id="content-top-left"> - <object height="223" width="681"> - <param name="movie" value="/img/flash/gg_anim.swf"> - <embed src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/gg_anim.swf" height="223" width="681"> - - </object> - </div> - <div id="content-top-right" class="clearfix"> - <div id="home_news"> - <img src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/why-gridglo.png" alt="Why Gridglow"> <div class="sbox"> - <p>As volcanoes go, the eruption of Iceland's Eyjafjallajokull on -Tuesday, April 13, won't make the science books. Though scientists -haven't yet been able to gather enough information on the eruption to -give it a score on the Volcanic Explosivity Index — which ranks volcanic - events on a 1-to-8 scale — it's unlikely to score very high.</p> - <a href="http://glow/pages/home" class="button"><span class="icon"><span class="arrow">More</span></span></a> </div> -</div> </div> - <span class="clearFix"></span> -</div> - - - <div id="left-col"> - <div id="left-col"> - <script type="text/javascript"> -//<![CDATA[ - $(document).ready(function() { - $('#loginSubmit').click(function() { - $('#UserDisplayForm').submit(); - return false; - }) - }) - -//]]> -</script><div class="box" style="width: 275px;"> - <div class="topleft"> - <div class="topright"> - <div> - <h2 class="login">Sign in to <span>Gridglo</span></h2> - <form class="middle-forms" id="UserHomeForm" method="post" action="/users/home" accept-charset="utf-8"><div style="display: none;"><input name="_method" value="POST" type="hidden"><input name="data[_Token][key]" value="e6d4935bbfedd7be66fde911eb0f627d712b37b2" id="Token326110559" type="hidden"></div> <div class="input text required"><label for="UserUsername">User ID</label><input style="outline: 1px solid rgb(255, 0, 0);" name="data[User][username]" maxlength="100" id="UserUsername" type="text"></div> <div class="input password"><label for="UserPassword">Password</label><input name="data[User][password]" id="UserPassword" type="password"></div> <div style="display: none;"><input name="data[_Token][fields]" value="691f07062434038354dec10aa7c2a40e22a59681%3An%3A0%3A%7B%7D" id="TokenFields2118107777" type="hidden"></div></form> <div class="input"><a href="http://glow/pages/home" class="button" id="loginSubmit" style="float: right; margin-right: 10px;"><span>Sign in</span></a></div> <span class="clearFix"></span> - <ul class="login_sub"> - <li><a href="http://glow/recover" class="blue">Forgot Password</a></li> - <li class="last"><a href="http://glow/register" class="blue">New user register</a></li> - </ul> - <span class="clearFix"></span> - </div> - </div> - </div> - <div class="bottomleft"> - <div class="bottomright"> </div> - </div> -</div> <div class="box" style="width: 345px;"> - <div class="topleft"> - <div class="topright"> - <div> - <h2 class="platform blue">Platform</h2> - <p> - <img src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/gears.png" style="float: right;" alt="Platform"> - Currently there is little evidence to support the use of Shiatsu in the - treatment of any diseases or disorders. Cancer Research UK makes it -clear that they don't believe Shiatsu is beneficial for the treatment of - cancer, however they do state that "some studies using massage therapy -in general (including shiatsu massage) suggest it might be helpful as a -complementary therapy for people with cancer and other illnesses - </p> - </div> - </div> - </div> - <div class="bottomleft"> - <div class="bottomright"> </div> - </div> -</div> -</div> -<div id="right-col"> - <div class="home_demo"> - <img src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/demo.png" alt="Demo"></div></div> </div> - <div id="right-col"> - <div class="home_demo"> - <img src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/demo.png" alt="Demo"></div> - </div> - - <span class="clearFix"></span> - - - </div> - <div id="footer"> - <ul class="menu"> - <li><a href="http://glow/pages/home">Home</a></li> - <li><a href="http://glow/pages/home">Site Map</a></li> - <li><a href="http://glow/pages/home">Privacy Policy</a></li> - <li class="last"><a href="http://glow/pages/home">Contact Us</a></li> -</ul> -<div class="logo"> - <a href="http://glow/pages/home"><img src="Error_%20Title%20For%20Layout%20needed%20_%20Gridglo_files/logo-sm.gif" alt=""></a></div> -<div style="clear: both;"></div> <span class="copyright">Copyright (C) 2010 Gridglo. All rights reserved</span></div> - </div> - <div id="mask"><div id="modal" class="modal-container"><div id="modal-content"></div><div id="modal-close">&nbsp;</div></div></div> - <table class="cake-sql-log" id="cakeSqlLog_12835253224c810aca76c526_05220571" summary="Cake SQL Log" border="0" cellspacing="0"><caption>(default) 13 queries took 0 ms</caption><thead> - <tr><th>Nr</th><th>Query</th><th>Error</th><th>Affected</th><th>Num. rows</th><th>Took (ms)</th></tr> -</thead> -<tbody> -<tr><td>1</td><td>SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>2</td><td>PRAGMA table_info("aros")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>3</td><td>PRAGMA table_info("acos")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>4</td><td>PRAGMA table_info("aros_acos")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>5</td><td>PRAGMA table_info("users")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>6</td><td>PRAGMA table_info("groups")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>7</td><td>PRAGMA table_info("accounts")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>8</td><td>PRAGMA table_info("account_types")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>9</td><td>PRAGMA table_info("genders")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>10</td><td>PRAGMA table_info("sources")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>11</td><td>PRAGMA table_info("settings")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>12</td><td>PRAGMA table_info("setting_datas")</td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -<tr><td>13</td><td>SELECT "Aco"."id", "Aco"."parent_id", "Aco"."model", -"Aco"."foreign_key", "Aco"."alias" FROM "acos" AS "Aco" LEFT JOIN "acos" - AS "Aco0" ON ("Aco0"."alias" = 'controllers') LEFT JOIN "acos" AS -"Aco1" ON ("Aco1"."lft" &gt; "Aco0"."lft" AND "Aco1"."rght" &lt; -"Aco0"."rght" AND "Aco1"."alias" = 'Pages' AND "Aco0"."id" = -"Aco1"."parent_id") WHERE (("Aco"."lft" &lt;= "Aco0"."lft" AND -"Aco"."rght" &gt;= "Aco0"."rght") OR ("Aco"."lft" &lt;= "Aco1"."lft" AND - "Aco"."rght" &gt;= "Aco1"."rght")) ORDER BY "Aco"."lft" DESC </td><td></td><td style="text-align: right;"></td><td style="text-align: right;"></td><td style="text-align: right;">0</td></tr> -</tbody></table> -</body></html> \ No newline at end of file diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/common.js b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/common.js deleted file mode 100644 index 7e2a41e..0000000 --- a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/common.js +++ /dev/null @@ -1,25 +0,0 @@ -$(document).ready(function() { - $(".remove-btn").bind('click', function(){messageRemove(this);return false;}); - $('a.modal').click(function(e) { - e.preventDefault(); - $('#modal-content').load($(this).attr('href')); - var maskHeight = $(document).height(); - var maskWidth = $(window).width(); - $('#mask').css({'width':maskWidth,'height':maskHeight}); - $('#mask').fadeTo(800,0.95); - var winH = $(window).height(); - var winW = $(window).width(); - $('#modal').css('top', winH/2-$('#modal').height()/2); - $('#modal').css('left', winW/2-$('#modal').width()/2); - $('#modal').fadeIn(2000); - }); - $('#modal-close').click(function () { - $('#mask').hide(); - $('.modal-container').hide(); - }); -}); - -function messageRemove(that) { - $(that).parent().slideUp(200); -} - diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/demo.png b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/demo.png deleted file mode 100644 index ff7712e..0000000 Binary files a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/demo.png and /dev/null differ diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/gears.png b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/gears.png deleted file mode 100644 index 3c766e8..0000000 Binary files a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/gears.png and /dev/null differ diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/gg_anim.swf b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/gg_anim.swf deleted file mode 100644 index 348340e..0000000 Binary files a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/gg_anim.swf and /dev/null differ diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/jquery.js b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/jquery.js deleted file mode 100644 index 7c24308..0000000 --- a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/jquery.js +++ /dev/null @@ -1,154 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? -e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r= -j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g, -"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= -true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)|| -c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded", -L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype, -"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ -a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f], -d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]=== -a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&& -!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari= -true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ", -i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ", -" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className= -this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i= -e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!= -null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this, -"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent= -a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y, -isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit= -{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}}; -if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&& -!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}}, -toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector, -u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), -function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q]; -if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[]; -for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length- -1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, -CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, -relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]= -l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[]; -h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m= -m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition|| -!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m= -h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/, -gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; -c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)? -a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&& -this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]|| -u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length=== -1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== -"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, -serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), -function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, -global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& -e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? -"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== -false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= -false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", -c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| -d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); -g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== -1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== -"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; -if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay"); -this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a], -"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)}, -animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing= -j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]); -this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== -"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| -c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; -this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= -this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, -e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length|| -c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement? -function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b= -this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle; -k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&& -f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; -a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, -d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- -f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": -"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in -e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/logo-sm.gif b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/logo-sm.gif deleted file mode 100644 index b7b32ee..0000000 Binary files a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/logo-sm.gif and /dev/null differ diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/logo.gif b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/logo.gif deleted file mode 100644 index f489abf..0000000 Binary files a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/logo.gif and /dev/null differ diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/outline_current_element.css b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/outline_current_element.css deleted file mode 100644 index 9333c3c..0000000 --- a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/outline_current_element.css +++ /dev/null @@ -1,4 +0,0 @@ -* -{ - cursor: crosshair !important; -} diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/style.css b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/style.css deleted file mode 100644 index 0cc1a8d..0000000 --- a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/style.css +++ /dev/null @@ -1,188 +0,0 @@ -/** document general options **/ -body{font:9pt Tahoma,Helvetica,Arial,Tahoma,sans-serif;background:#d3ebfd;} -body,html{height:100%} -span.clearFix{width:100%;height:0px;visibility:hidden;clear:both;display:block;margin:0;padding:0;font-size:0px;} -.hidden{display:none;} -/** button stylings **/ -div.inner-nav{clear:both;margin:10px 0;} -div.inner-nav a,a.button{display:inline-block;background:url(../../img/admin/bg-buttons-left.gif) no-repeat;text-decoration:none;height:21px;padding:0 0 0 15px;color:#fff;font-weight:bold;font-size:9pt;} -div.inner-nav a:hover,a.button:hover{color:#333;} -div.inner-nav a span,a.button span{display:block;background:url(../../img/admin/bg-buttons-right.gif) no-repeat right;padding:0 15px 0 0;line-height:21px;} -.align-left{float:left;} -.align-right{float:right;} -/** text colors assigned to elements in various areas **/ -.yellow{color:#e8e4a2;} -.light-blue{color:#a6b7c0;} -.blue{color:#508db8 !important;} -.light-grey{color:#d7d7d7} -.white{color:#fff;} -img{border:0;} -p{font-size:11px;} -h2{margin:0 5px 5px 0;padding:0;} -h2 span{color:#ff931f;text-transform:uppercase;font-weight:bold;} -h2.login{padding:5px;color:#ffad1f;padding-left:35px;background:#fff4ca url(../img/h1-pencil.png) no-repeat 10px 50%;} -h2.platform{padding:5px;padding-left:35px;color:#5da2d7;background:#e6f2fb url(../img/h1-swoop.png) no-repeat 10px 50%;} -div.home_demo{padding:10px;} -ul.login_sub{display:block;list-style:none;} -ul.login_sub li{float:left;height:15px;position:relative;border-right:1px solid #508db8;} -ul.login_sub li a{text-decoration:none;padding:0 10px;display:inline-block;position:relative;} -ul.login_sub li.last{border:0;} -div#container{width:960px;position:relative;margin:0 auto;padding:0px 5px 25px;background:#fff;} -/** HEADER AND NAVIGATION **/ -div#header{background:#fff url(../img/bg.png) repeat-x;height:149px;} -/** logo,which is a typographical h1 element (you can edit this part if you want to replace with your logo graphic) **/ -div#logo{border:1px solid $#666;padding:20px;} -div#logo h1{font-size:250%;text-transform:uppercase;letter-spacing:-1px;font-weight:bold;float:left;width:450px;/** mac safari & firefox hack */height:39px;/**/} -div#logo h1 a{color:#fff;text-decoration:none;} -div#logo h1 a:hover{color:#ccc;} -/** header userbox **/ -p#userbox{float:right;color:#c1cad0;background:url(../img/icon-greet-user.gif) no-repeat 0px 5px;padding:5px 0px 0px 18px;margin:0;} -p#userbox a{color:#ceac0f;text-decoration:none;font-weight:bold;} -p#userbox a:hover{color:#fff;} -p#userbox small{display:block;margin-top:5px;color:#8d9599;font-size:0.9em;} -/** menu **/ -div#header ul.menu{display:block;list-style:none;background:url(../img/menu-btn.gif) repeat-x;height:32px;} -div#header ul.menu li{float:left;height:32px;position:relative;border-right:1px solid #fff;} -div#header ul.menu li.last{border:0;} -div#header ul.menu li a{color:#717171;text-decoration:none;padding:9px 20px 7px 20px;display:inline-block;text-align:center;text-transform:uppercase;position:relative;} -div#header ul.menu li a:hover{background:url(../img/menu-btn-on.gif) repeat-x top left;color:#fff;} -/** END OF HEADER **/ -/** CONTENT **/ -div#content{background:url(../img/content-bg.gif) repeat-y;padding:0;} -/** main heading of the page **/ -div#content-top{padding:20px 0 0 0;background-color:#599fd4;} -div#content-top h2{font-size:200%;font-weight:bold;color:#373d40;margin-left:12px;float:left;} -div#content-top p{margin-left:12px;margin-top:5px;} -div#content-top p a{color:#508db8;text-decoration:none;} -div#content-top p a:hover{color:#333;} -div#content-top a#topLink{float:right;background:url(../../img/admin/icon-blue-arrow.gif) no-repeat;display:inline-block;padding-left:23px;text-decoration:none;font-weight:bold;color:#508db8;height:16px;margin-top:10px;margin-right:12px;} -div#content-top a#topLink:hover{color:#333;} -div#content-top-left{width:681px;height:223px;float:left;} -div#content-top-right{padding:0 20px;width:239px;height:223px;float:left;background-color:#599fd4;} -/** box general settings **/ -div.sbox{background:url(../img/sbox-bg.png)repeat-x;height:172px;width:225px;padding:0 10px;} -div.sbox p{padding:10px 0;margin:0;color:#fff;font-size:11px;} -div.sbox .button{float:right;} -.box{float:left;} -.box div{margin:0.1em 0 0 0.1em;} -.box div.topleft{display:block;background:url("../img/box-bg.png") top left no-repeat;padding:5px 0em 0em -5px;} -.box div.topright{display:block;background:url("../img/box-bg.png") top right no-repeat;padding:5px 5px 0 0;margin:-5px 0 0 5px;} -.box div.bottomleft{display:block;height:45px;margin-top:-5px;background:url("../img/box-bg.png") bottom left no-repeat;} -.box div.bottomright{display:block;background:url("../img/box-bg.png") bottom right no-repeat;height:45px;margin-left:5px;} -/* ul.box-top-buttons{float:right;width:270px;padding-right:15px;} -ul.box-top-buttons li{float:right;padding-left:15px;height:18px} -ul.box-top-buttons li a{outline:none;padding:6px 15px 6px 0;display:block;font-size:0.9em;text-decoration:none;color:#ddd;} -ul.box-top-buttons li a:hover{color:#fff;} -ul.box-top-buttons li.selected{} -ul.box-top-buttons li.selected a{color:#867946;} -*/ -/** Button **/ -a.button{background:transparent url(../img/btn-rht.png) no-repeat scroll top right;display:block;float:left;height:20px;margin-right:1px;padding-right:7px;text-decoration:none;color:#fff;font-size:11px;text-transform:lowercase;} -a.button span{background:transparent url(../img/btn-lft.png) no-repeat;display:block;padding:0 5px 0 7px;line-height:20px;} -a.button:hover{background-position:right -20px;} -a.button:hover span{color:#fff;background-position:left -20px;} -a.button span.arrow{background:url(../img/sml-arrow.png) no-repeat 0 50%;display:block;padding-left:20px;} -/** columns **/ -div#left-col{float:left;width:661px;padding:10px 10px;} -div#right-col{width:229px;float:left;padding:10px 10px ;} -div.full-col{width:980px !important;margin-right:0px !important;} -div.half-col{width:740px !important;margin-right:0px !important;} -/** list links **/ -ul.list-links,div#to-do-list ul{width:223px;margin-left:-10px;margin-top:-5px;} -ul.list-links li{border-bottom:1px dotted #d6d8d9;} -ul.list-links li a{padding:8px 3px 6px 20px;display:block;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px #fff;color:#5c6467;text-decoration:none;} -ul.list-links li a:hover,ul.list-links li.selected a:hover{background:url(../../img/admin/link-arrow-hover.gif) no-repeat 10px 10px #fafae9;color:#000;} -ul.list-links li ul{background:#fcfbf2 !important;padding-left:10px;padding-top:10px;width:213px;font-size:0.9em;} -ul.list-links li ul li{border-bottom:none;} -ul.list-links li ul li a{background:none;padding:5px 3px 5px 20px !important;} -ul.list-links li ul li a:hover{background-color:#fcfbf2;background-position:8px 10px} -ul.list-links li a.ui-state-active{font-weight:bold;} -/** forms **/ -div.input{padding:2px;} -label{display:block;} -input{border:1px solid #5da2d7;line-height:35px;padding:2px;} -form.middle-forms{padding:5px;color:#3a4043} -form.middle-forms p{margin:10px 0;} -form.middle-forms h3{color:#1d8895;font-weight:bold;font-size:150%;margin-bottom:10px;} -form.middle-forms fieldset{padding-top:10px;} -form.middle-forms fieldset ol li{padding:15px;} -form.middle-forms fieldset ol li.even{background:#f3f3f3;} -form.middle-forms fieldset ol li input/*,form.middle-forms fieldset ol li textarea*/{padding:5px;border:1px solid #dedede;background:url(../../img/admin/bg-textbox.gif) repeat-x #fff;} -form.middle-forms fieldset ol li input[type="radio"],form.middle-forms fieldset ol li input[type="checkbox"]{border:none;background:none;} -input.txtbox-short{width:122px;} -input.txtbox-middle{width:190px;} -input.txtbox-long,form.middle-forms textarea{width:305px;} -form.middle-forms label{float:left;width:50px;padding-right:10px;margin-right:10px;display:block;} -form.middle-forms label.field-title{font-weight:bold;width:100px;padding-top:3px;} -span.form-confirm-inline,span.form-error-inline{display:inline-block;padding-left:20px;margin-left:10px;height:16px;} -span.form-confirm-inline{color:#72a101;background:url(../../img/admin/icon-confirm.gif) no-repeat;} -span.form-error-inline{color:#a10101;background:url(../../img/admin/icon-error.gif) no-repeat;} -a.heading-link{color:#cae6ed;text-transform:capitalize;font-size:0.9em;font-weight:normal;display:inline-block;padding-left:15px;text-decoration:none;} -a.heading-link:hover{color:#fff;} -/* tables */ -table.table-short{width:500px;margin:-5px 0 0 -5px;border-collapse:collapse;} -table.table-long{width:740px;margin-left:-10px} -table.table-full{width:100%;} -table.table-short td,table.table-long td{border-top:1px solid #dfdfdf;font-size:0.9em;padding:10px 0;margin:0;color:#666;} -table.table-short thead th,table.table-long thead th{font-weight:bold;color:#666;padding:10px 0;} -table.table-short thead th a,table.table-long thead th a{color:#666;} -table.table-short thead th,table.table-short tfoot td,table.table-long thead th,table.table-long tfoot td{border:none;} -table.table-short td:first-child,table.table-long td:first-child{text-align:left;padding:0 0 0 10px;} -table.table-short tfoot,table.table-long tfoot{border-top:1px solid #ccc;} -table.table-short tr.altRow,table.table-long tr.altRow{background:url(../../img/admin/bg_tableRow.gif) repeat-x 0px 1px;} -table.table-short td a,table.table-long td a{color:#508db8;font-weight:bold;} -table.table-short td a:hover,table.table-long td a:hover{text-decoration:none;color:#333;} -td.col-chk{width:40px;} -td.col-first{font-weight:bold;width:200px;} -td.col-second a{color:#508db8;font-weight:bold;} -td.col-second a:hover{text-decoration:none;color:#333;} -td.actions{width:110px;} -a.table-edit-link,a.table-delete-link{color:#666;text-decoration:none;display:inline-block;margin-right:10px;padding-left:20px;height:16px;text-align:right;} -a.table-edit-link:hover,a.table-delete-link:hover{color:#000;} -a.table-delete-link{margin-right:0px !important;background:url(../../img/admin/icon-delete.gif) no-repeat;} -a.table-edit-link{background:url(../../img/admin/icon-edit.gif) no-repeat;} -a{color:#fff;} -/** FOOTER **/ -div#footer{margin:0 auto;height:57px;background:url(../img/bg-footer.png) repeat-x;padding:5;position:relative;} -div#footer-top{color:#f2f2f2;} -div#footer-top h4{color:#fff;text-transform:uppercase;margin:5px 0;font-size:120%;font-weight:bold;} -div#footer-top a{color:#adc3d3;font-weight:bold;font-size:0.9em;text-decoration:none;} -div#footer-top a:hover{color:#fff;} -div#footer-top h2{font-size:160%;text-transform:uppercase;padding-top:10px;padding-right:10px;font-weight:bold;} -div#footer-top h2 a{color:#a1a5a6;} -div#footer-top h2 a:hover{color:#c7cdcf;} -div#footer-bottom{margin-top:25px;} -div#footer-bottom p{color:#717272;font-size:0.9em;} -div#footer-bottom p a{color:#ccc;text-decoration:none;} -div#footer ul.menu{display:block;list-style:none;padding:10px 0 5px 15px} -div#footer ul.menu li{float:left;position:relative;border-right:1px solid #717171;} -div#footer ul.menu li.last{border:0;} -div#footer ul.menu li a{color:#717171;text-decoration:none;padding:0 10px;display:inline-block;text-align:center;position:relative;} -div#footer .logo{position:absolute;right:15px;height:15px;top:15px;} -div#footer .copyright{font:8pt Tahoma;padding:10px 0 10px 25px;} -/********** Modal **********/ -#mask{display:none;position:absolute;top:0;left:0;background:url('../img/mask.gif');z-index:9000;} -.modal-container{display:none;position:absolute;top:0;left:0;z-index:9999;} -#modal{margin:40px auto;padding:25px;background:#fff;border:7px solid #ccc;-moz-border-radius:10px;-webkit-border-radius:10px;} -#modal-content h2{padding-bottom:5px;font-size:18px;font-weight:normal;border-bottom:1px solid #ddd;} -#modal-content label{color:#7a7a7a;font-weight:bold;} -#modal-content input[type=text]{margin:5px 0 10px;width:241px;background:#f8f8f8;border:1px solid #aaa;} -#modal-close {background:url('../img/close-button.png');width:22px;height:22px;position:absolute;top:-15px;right:-15px;cursor:pointer;} -#modal-close a { display: block; border: 1px solid #666;} -#modal-close span { display: none;} -/********** End of Modal **********/ - -.msg-error,.msg-success,.msg-attention,.msg-info{padding-left:17px;height:30px;line-height:30px;position:relative;} -.remove-btn{position:absolute;top:0;right:17px;padding-right:20px;background:url('../img/remove-btn.png') no-repeat center right;color:#333 !important;} -.remove-btn:hover{color:#666 !important;} -.msg-error{background:#ffd6d6;color:#df5c0c;border: 1px solid #ebb1b1;} -.msg-success{background:#eaf8d5;color:#829b36;border:1px solid #829b36;} -.msg-attention{background:#fffbcc;color:#c0a443;border:1px solid #c0a443;} -.msg-info{background:#d2eef1;color:#369fb4;border:1px solid #369fb4;} - -/* ============================================= info messages ============================================= */ -.form-error { float:left; border: 1px solid #ebb1b1;} -.info_success { display:inline;background:url(../img/success.png) no-repeat; padding-left:20px; color:#afda2d; } -.error-message {display:inline;background:url(../img/wrong.png) no-repeat; padding-left:20px; color:#df5c0c; } -.info_loading {display:inline; background:url(../img/loading.gif) no-repeat; padding-left:20px; } - diff --git a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/why-gridglo.png b/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/why-gridglo.png deleted file mode 100644 index df298d2..0000000 Binary files a/app/webroot/img/Error_ Title For Layout needed _ Gridglo_files/why-gridglo.png and /dev/null differ
valaravena/Glo
4a3b91e4b91e1294f0f536d57c8c1764e4a2cefa
Adding Update
diff --git a/app/config/core.php b/app/config/core.php index 4e6ebbe..ad8877d 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -1,302 +1,302 @@ <?php /** * This is core configuration file. * * Use it to configure core behavior of Cake. * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package cake * @subpackage cake.app.config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** * CakePHP Debug Level: * * Production Mode: * 0: No error messages, errors, or warnings shown. Flash messages redirect. * * Development Mode: * 1: Errors and warnings shown, model caches refreshed, flash messages halted. * 2: As in 1, but also with full debug messages and SQL output.ad * * In production mode, flash messages redirect after a time interval. * In development mode, you need to click the flash message to continue. */ - Configure::write('debug', 2); + Configure::write('debug', 0); /** * CakePHP Log Level: * * In case of Production Mode CakePHP gives you the possibility to continue logging errors. * * The following parameters can be used: * Boolean: Set true/false to activate/deactivate logging * Configure::write('log', true); * * Integer: Use built-in PHP constants to set the error level (see error_reporting) * Configure::write('log', E_ERROR | E_WARNING); * Configure::write('log', E_ALL ^ E_NOTICE); */ Configure::write('log', true); /** * Application wide charset encoding */ Configure::write('App.encoding', 'UTF-8'); /** * To configure CakePHP *not* to use mod_rewrite and to * use CakePHP pretty URLs, remove these .htaccess * files: * * /.htaccess * /app/.htaccess * /app/webroot/.htaccess * * And uncomment the App.baseUrl below: */ //Configure::write('App.baseUrl', env('SCRIPT_NAME')); /** * Uncomment the define below to use CakePHP prefix routes. * * The value of the define determines the names of the routes * and their associated controller actions: * * Set to an array of prefixes you want to use in your application. Use for * admin or other prefixed routes. * * Routing.prefixes = array('admin'); * * Enables: * `admin_index()` and `/admin/controller/index` * `manager_index()` and `/manager/controller/index` * * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] */ Configure::write('Routing.prefixes', array('admin')); /** * Turn off all caching application-wide. * */ //Configure::write('Cache.disable', true); /** * Enable cache checking. * * If set to true, for view caching you must still use the controller * var $cacheAction inside your controllers to define caching settings. * You can either set it controller-wide by setting var $cacheAction = true, * or in each action using $this->cacheAction = true. * */ //Configure::write('Cache.check', true); /** * Defines the default error type when using the log() function. Used for * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. */ define('LOG_ERROR', 2); /** * The preferred session handling method. Valid values: * * 'php' Uses settings defined in your php.ini. * 'cake' Saves session files in CakePHP's /tmp directory. * 'database' Uses CakePHP's database sessions. * * To define a custom session handler, save it at /app/config/<name>.php. * Set the value of 'Session.save' to <name> to utilize it in CakePHP. * * To use database sessions, run the app/config/schema/sessions.php schema using * the cake shell command: cake schema run create Sessions * */ Configure::write('Session.save', 'php'); /** * The model name to be used for the session model. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The model name set here should *not* be used elsewhere in your application. */ //Configure::write('Session.model', 'Session'); /** * The name of the table used to store CakePHP database sessions. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The table name set here should *not* include any table prefix defined elsewhere. * * Please note that if you set a value for Session.model (above), any value set for * Session.table will be ignored. * * [Note: Session.table is deprecated as of CakePHP 1.3] */ //Configure::write('Session.table', 'cake_sessions'); /** * The DATABASE_CONFIG::$var to use for database session handling. * * 'Session.save' must be set to 'database' in order to utilize this constant. */ //Configure::write('Session.database', 'default'); /** * The name of CakePHP's session cookie. * * Note the guidelines for Session names states: "The session name references * the session id in cookies and URLs. It should contain only alphanumeric * characters." * @link http://php.net/session_name */ Configure::write('Session.cookie', 'CAKEPHP'); /** * Session time out time (in seconds). * Actual value depends on 'Security.level' setting. */ Configure::write('Session.timeout', '120'); /** * If set to false, sessions are not automatically started. */ Configure::write('Session.start', true); /** * When set to false, HTTP_USER_AGENT will not be checked * in the session */ Configure::write('Session.checkAgent', true); /** * The level of CakePHP security. The session timeout time defined * in 'Session.timeout' is multiplied according to the settings here. * Valid values: * * 'high' Session timeout in 'Session.timeout' x 10 * 'medium' Session timeout in 'Session.timeout' x 5040 * 'low' Session timeout in 'Session.timeout' x 2628000 * * CakePHP session IDs are also regenerated between requests if * 'Security.level' is set to 'high'. */ Configure::write('Security.level', 'medium'); /** * A random string used in security hashing methods. */ Configure::write('Security.salt', '087333c18fff60a7d94188f724d362191ee4b429'); /** * A random numeric string (digits only) used to encrypt/decrypt strings. */ Configure::write('Security.cipherSeed', '67004110033610364'); /** * Apply timestamps with the last modified time to static assets (js, css, images). * Will append a querystring parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable * timestamping. */ //Configure::write('Asset.timestamp', true); /** * Compress CSS output by removing comments, whitespace, repeating tags, etc. * This requires a/var/cache directory to be writable by the web server for caching. * and /vendors/csspp/csspp.php * * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). */ //Configure::write('Asset.filter.css', 'css.php'); /** * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the * output, and setting the config below to the name of the script. * * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). */ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** * The classname and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); /** * If you are on PHP 5.3 uncomment this line and correct your server timezone * to fix the date & time related errors. */ //date_default_timezone_set('UTC'); /** * * Cache Engine Configuration * Default settings provided below * * File storage engine. * * Cache::config('default', array( * 'engine' => 'File', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path * 'prefix' => 'cake_', //[optional] prefix every cache file with this string * 'lock' => false, //[optional] use file locking * 'serialize' => true, [optional] * )); * * * APC (http://pecl.php.net/package/APC) * * Cache::config('default', array( * 'engine' => 'Apc', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * )); * * Xcache (http://xcache.lighttpd.net/) * * Cache::config('default', array( * 'engine' => 'Xcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'user' => 'user', //user from xcache.admin.user settings * 'password' => 'password', //plaintext password (xcache.admin.pass) * )); * * * Memcache (http://www.danga.com/memcached/) * * Cache::config('default', array( * 'engine' => 'Memcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'servers' => array( * '127.0.0.1:11211' // localhost, default port 11211 * ), //[optional] * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) * )); * */ Cache::config('default', array('engine' => 'File')); diff --git a/app/controllers/accounts_controller.php b/app/controllers/accounts_controller.php index cd5ad63..46f166d 100644 --- a/app/controllers/accounts_controller.php +++ b/app/controllers/accounts_controller.php @@ -1,201 +1,201 @@ <?php class AccountsController extends AppController { var $name = 'Accounts'; var $helpers = array('Gravatar'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); } function index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function profile() { $this->set('title_for_layout', __('Account Profile', true)); if ($this->Auth->user()) { $account = $this->Account->findByUserId($this->Auth->user('id')); $account['Account']['full_name'] = $account['Account']['first_name'] . " ". $account['Account']['last_name']; - if (!empty($this->data)) { - list($this->data['Account']['first_name'], $this->data['Account']['last_name']) = explode(" ", trim($this->data['Account']['full_name'])); - debug($this->data); - die(); + if (!empty($this->data)) { + $fullName = explode(" ", trim($this->data['Account']['full_name'])); + list($lastName) = $fullName; + die($lastName); if ($user = $this->Account->register($this->data, $this->Auth->user('id'))) { $this->Session->setFlash(__('Your profile as been updated.', true), 'success'); $this->redirect(array('action' => 'account')); } else { $this->Session->setFlash(__('Your profile could not be saved. Please, try again.', true), 'error'); } } $this->data =$account; } else { $this->redirect('/login'); } } function admin_index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function authenticate() { $account = array(); if ($this->Auth->user('id')) { $this->Account->recursive = 0; $account = $this->Account->getAccountByIdOrUsername($this->Auth->user('id')); if (!empty($account)) { # $account['User'] = # $return['User'] = # $account['Account'] = array($account['Account'][]) #$account = am($account['User'], $account['Account']); } } $this->set(compact('account')); } function location() { debug($this->params); if (!$this->RequestHandler->isAjax()) { $this->redirect(array('action' => 'index')); } if (!empty($location)) { echo $location; } echo "NO Location"; } } ?> \ No newline at end of file diff --git a/app/views/users/index.ctp b/app/views/users/index.ctp index 86ba554..8b2f537 100644 --- a/app/views/users/index.ctp +++ b/app/views/users/index.ctp @@ -1,46 +1,56 @@ +<?php +echo $javascript->link("http://www.google.com/jsapi"); +echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); +echo $javascript->codeBlock(); +?> +$(document).ready(function() { + $.get('<?php echo $html->url(array('admin' => false, 'plugin' => 'simple_geo', 'controller' => 'simple_geo', 'action' => 'nearby', $simpleGeoLayer['SimpleGeoLayer']['name'],)) ?>', {hash: google.loader.ClientLocation.latitude+','+google.loader.ClientLocation.longitude}, function (data) { $("#map_box").html(data)}); +}) +<?php echo $javascript->blockEnd();?> + <div class="clearfix"></div> <div id="left-col"> <div class="box" style="width:99%"> <div class="topleft"> <div class="topright"> <div> <?php if (!empty($points)) { foreach($points as $n=>$point){ $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b><br />"; $points[$n]['Point']['html'] = $point['Point']['name']; } } $default = array('zoom' => 12); echo $googleMap->map($default, $style = 'width:100%; height: 500px;'); echo $googleMap->addEvent('dragend', 'mapDrag', "var mapDrag = function(event){}"); if (isset($overLay)) { echo $googleMap->addOverlay($overLay); } if(isset($points)){ echo $googleMap->addMarkers($points, 'http://boingboing.net/style/reportthis.png'); echo $googleMap->addMarkerOnClick("<h1>This is the Point</h1>"); } ?> </div> </div> </div> <div class="bottomleft"> <div class="bottomright"> </div> </div> </div> </div> <div id="right-col"> <?php echo $this->element('account_menu')?> </div>
valaravena/Glo
b96443d76e8b9c6bff225bc319a7b92ff27f099d
Adding Schema to Plugin Simple Geo
diff --git a/app/plugins/simple_geo/config/schema/schema.php b/app/plugins/simple_geo/config/schema/schema.php new file mode 100644 index 0000000..9d8201b --- /dev/null +++ b/app/plugins/simple_geo/config/schema/schema.php @@ -0,0 +1,58 @@ +<?php +/* SVN FILE: $Id$ */ +/* App schema generated on: 2010-09-01 17:09:45 : 1283378385*/ +class AppSchema extends CakeSchema { + var $name = 'App'; + + function before($event = array()) { + return true; + } + + function after($event = array()) { + } + + var $acos = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'indexes' => array(), + 'tableParameters' => array() + ); + var $aros = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'model' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'alias' => array('type' => 'string', 'null' => true, 'default' => NULL), + 'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'indexes' => array(), + 'tableParameters' => array() + ); + var $aros_acos = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'aro_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), + 'aco_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10), + '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), + 'indexes' => array(), + 'tableParameters' => array() + ); + var $simple_geo_layers = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'name' => array('type' => 'string', 'null' => false, 'default' => NULL), + 'title' => array('type' => 'string', 'null' => false, 'default' => NULL), + 'description' => array('type' => 'text', 'null' => true, 'default' => NULL), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), + 'indexes' => array(), + 'tableParameters' => array() + ); +} +?> \ No newline at end of file
valaravena/Glo
fa42518a3558ee3feaac85072b3692e53d26adae
Adding update
diff --git a/app/app_controller.php b/app/app_controller.php index 14346be..9a30f52 100644 --- a/app/app_controller.php +++ b/app/app_controller.php @@ -1,448 +1,451 @@ <?php class AppController extends Controller { var $helpers = array('Html', 'Form', 'Time', 'Number', 'Javascript', 'Cache', 'Text', 'Session','Menu','Sidebar'); var $components = array('Security', 'Acl', 'Auth', 'Acl.AclFilter', 'Cookie', 'RequestHandler', 'Session', 'Mailer', 'Security'); var $uses = array('User', 'Core.Setting'); var $view = 'Theme'; var $apiRequest = false; var $apiError = false; var $appConfigurations; - + + function __construct() { + parent::__construct(); + $this->appConfigurations = Configure::read('App'); + $this->set('appConfigurtions', $this->appConfigurations); + } function beforeFilter() { $this->AclFilter->auth(); #$this->Security->blackHoleCallback = '__securityError'; - $this->appConfigurations = Configure::read('App'); - $this->set('appConfigurations', $this->appConfigurations); $this->set('title_for_layout', __('Error: Title For Layout needed', true)); $this->Setting->applyAllUpdates(); if (isset($this->params['admin'])) { $this->layout = 'admin'; } $this->Auth->allow('*'); if (Configure::read('Site.theme') && !isset($this->params['admin'])) { $this->theme = Configure::read('Site.theme'); } elseif (Configure::read('Site.admin_theme') && isset($this->params['admin'])) { $this->theme = Configure::read('Site.admin_theme'); } if (!isset($this->params['admin']) && Configure::read('Site.status') == 0) { $this->layout = 'maintenance'; $this->set('title_for_layout', __('Site down for maintenance', true)); $this->render('../elements/blank'); } if (isset($this->params['locale'])) { Configure::write('Config.language', $this->params['locale']); } /* API Actions */ if ($this->RequestHandler->isXml() || $this->RequestHandler->ext == 'json') { Configure::write('debug',0); $this->Security->loginOptions = array( 'type'=>'basic', 'login'=>'apiLogin', 'realm'=>$this->appConfigurations['name'], ); $status = array(); $user = array(); // Check API Key if (!empty($this->params['url']['api_key'])) { $user = $this->User->findByKey($this->params['url']['api_key']); if (empty($user)) { $status['status'] = array('code' => 500, 'msg' => 'invalid_api_key'); } } else { $status['status'] = array('code' => 500, 'msg' => 'missing_api_key'); $this->apiError = true; } // Check Limit IP if (!$this->apiError && $this->appConfigurations['Api']['limitIp']) { if (!empty($user)) { if (!empty($user['User']['ip']) && $user['User']['ip'] != $this->RequestHandler->getClientIp()) { $status['status'] = array('code' => 500, 'msg' => 'ip_not_accepted', 'received' => $this->RequestHandler->getClientIp(), 'expected' => $user['User']['ip']); $this->apiError = true; } } } $this->set(compact('status')); } } function apiLogin($args) { $data[$this->Auth->fields['username']] = $args['username']; $data[$this->Auth->fields['password']] = $this->Auth->password($args['password']); if ($this->Auth->login($data)) { return true; } else { $this->Security->blackHole($this, 'login'); return false; } } function _sendEmail($data) { if (!empty($data)) { if ($this->Mailer) { $emailConfigurations = Configure::read('Email'); if (!empty($emailConfigurations['Host'])) { $this->Mailer->Host = $emailConfigurations['Host']; } else { $this->log('_sendEmail(), Host parameter required'); return false; } if (!empty($emailConfigurations['Port'])) { $this->Mailer->Port = $emailConfigurations['Port']; } else { $this->log('_sendEmail(), Port parameter required'); return false; } if (!empty($emailConfigurations['IsSMTP'])) { $this->Mailer->IsSMTP(); if (!empty($emailConfigurations['Username'])) { $this->Mailer->Username = $emailConfigurations['Username']; } else { $this->log('_sendEmail(), Username parameter required if using SMTP'); return false; } if (!empty($emailConfigurations['Password'])) { $this->Mailer->Password = $emailConfigurations['Password']; } else { $this->log('_sendEmail(), Password parameter required if using SMTP'); return false; } } if (!empty($emailConfigurations['SMTPAuth'])) { $this->Mailer->SMTPAuth = $emailConfigurations['SMTPAuth']; } if (!empty($emailConfigurations['SMTPSecure'])) { $this->Mailer->SMTPSecure = $emailConfigurations['SMTPSecure']; } if (!empty($emailConfigurations['WordWrap'])) { $this->Mailer->WordWrap = $emailConfigurations['WordWrap']; } if (!empty($emailConfigurations['From'])) { $this->Mailer->From = $emailConfigurations['From']; } else { $this->log('_sendEmail(), From name parameter required'); return false; } if (!empty($emailConfigurations['FromName'])) { $this->Mailer->FromName = $emailConfigurations['FromName']; } if (!empty($data['subject'])) { $this->Mailer->Subject = $data['subject']; } else { $this->log('_sendEmail(), Subject paramerter required'); return false; } if (!empty($data['to'])) { if (is_array($data['to'])) { foreach ($data['to'] as $recipient) { if (!empty($recipient['name'])) { $this->Mailer->AddAddress($recipient['to'], $recipient['name']); } else { $this->Mailer->AddAddress($recipient['to']); } } } else { if (!empty($data['name'])) { $this->Mailer->AddAddress($data['to'], $data['name']); } else { $this->Mailer->AddAddress($data['to']); } } } else { $this->log('_sendEmail(), To parameter required'); return false; } $tmp = array( 'autoRender' => $this->autoRender, 'autoLayout' => $this->autoLayout, 'layout' => $this->layout, 'viewPath' => $this->viewPath, ); $this->set('data', $data); $this->autoRender = false; $this->autoLayout = false; if (empty($data['layout'])) { $data['layout'] = 'default'; } if (empty($data['template'])) { $data['template'] = $this->action; } if (!empty($emailConfigurations['IsHTML'])) { $this->Mailer->IsHTML($emailConfigurations['IsHTML']); $this->layout = 'email'.DS.'html'.DS.$data['layout']; $this->viewPath = 'elements'.DS.'email'.DS.'html'; $bodyHtml = $this->render($data['template']); $this->Mailer->MsgHTML($bodyHtml); } else { $this->layout = 'email'.DS.'text'.DS.$data['layout']; $this->viewPath = 'elements'.DS.'email'.DS.'text'; $bodyText = $this->render($data['template']); $this->Mailer->AltBody = $bodyText; } // Get things back to normal $this->autoRender = $tmp['autoRender']; $this->autoLayout = $tmp['autoLayout']; $this->layout = $tmp['layout']; $this->viewPath = $tmp['viewPath']; if (!$return = $this->Mailer->Send()) { $this->log($this->Mailer->ErrorInfo); $return = false; } $this->Mailer->ClearAddresses(); $this->Mailer->ClearAllRecipients(); $this->Mailer->ClearCustomHeaders(); $this->Mailer->ClearAttachments(); return $return; } else { $this->log('_sendEmail(), PhpMailer component required'); return false; } } else { $this->log('_sendEmail(), data parameter required'); return false; } } /* Can this be placed somewhere else */ function build_acl() { if (!Configure::read('debug')) { return $this->_stop(); } $log = array(); $aco =& $this->Acl->Aco; $root = $aco->node('controllers'); if (!$root) { $aco->create(array('parent_id' => null, 'model' => null, 'alias' => 'controllers')); $root = $aco->save(); $root['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for controllers'; } else { $root = $root[0]; } App::import('Core', 'File'); $Controllers = Configure::listObjects('controller'); $appIndex = array_search('App', $Controllers); if ($appIndex !== false ) { unset($Controllers[$appIndex]); } $baseMethods = get_class_methods('Controller'); $baseMethods[] = 'buildAcl'; $Plugins = $this->_getPluginControllerNames(); $Controllers = array_merge($Controllers, $Plugins); // look at each controller in app/controllers foreach ($Controllers as $ctrlName) { $methods = $this->_getClassMethods($this->_getPluginControllerPath($ctrlName)); // Do all Plugins First if ($this->_isPlugin($ctrlName)){ $pluginNode = $aco->node('controllers/'.$this->_getPluginName($ctrlName)); if (!$pluginNode) { $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $this->_getPluginName($ctrlName))); $pluginNode = $aco->save(); $pluginNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $this->_getPluginName($ctrlName) . ' Plugin'; } } // find / make controller node $controllerNode = $aco->node('controllers/'.$ctrlName); if (!$controllerNode) { if ($this->_isPlugin($ctrlName)){ $pluginNode = $aco->node('controllers/' . $this->_getPluginName($ctrlName)); $aco->create(array('parent_id' => $pluginNode['0']['Aco']['id'], 'model' => null, 'alias' => $this->_getPluginControllerName($ctrlName))); $controllerNode = $aco->save(); $controllerNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $this->_getPluginControllerName($ctrlName) . ' ' . $this->_getPluginName($ctrlName) . ' Plugin Controller'; } else { $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $ctrlName)); $controllerNode = $aco->save(); $controllerNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $ctrlName; } } else { $controllerNode = $controllerNode[0]; } //clean the methods. to remove those in Controller and private actions. foreach ($methods as $k => $method) { if (strpos($method, '_', 0) === 0) { unset($methods[$k]); continue; } if (in_array($method, $baseMethods)) { unset($methods[$k]); continue; } $methodNode = $aco->node('controllers/'.$ctrlName.'/'.$method); if (!$methodNode) { $aco->create(array('parent_id' => $controllerNode['Aco']['id'], 'model' => null, 'alias' => $method)); $methodNode = $aco->save(); $log[] = 'Created Aco node for '. $method; } } } if(count($log)>0) { debug($log); } } function _getClassMethods($ctrlName = null) { App::import('Controller', $ctrlName); if (strlen(strstr($ctrlName, '.')) > 0) { // plugin's controller $num = strpos($ctrlName, '.'); $ctrlName = substr($ctrlName, $num+1); } $ctrlclass = $ctrlName . 'Controller'; $methods = get_class_methods($ctrlclass); // Add scaffold defaults if scaffolds are being used $properties = get_class_vars($ctrlclass); if (array_key_exists('scaffold',$properties)) { if($properties['scaffold'] == 'admin') { $methods = array_merge($methods, array('admin_add', 'admin_edit', 'admin_index', 'admin_view', 'admin_delete')); } else { $methods = array_merge($methods, array('add', 'edit', 'index', 'view', 'delete')); } } return $methods; } function _isPlugin($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) > 1) { return true; } else { return false; } } function _getPluginControllerPath($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[0] . '.' . $arr[1]; } else { return $arr[0]; } } function _getPluginName($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[0]; } else { return false; } } function _getPluginControllerName($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[1]; } else { return false; } } /** * Get the names of the plugin controllers ... * * This function will get an array of the plugin controller names, and * also makes sure the controllers are available for us to get the * method names by doing an App::import for each plugin controller. * * @return array of plugin names. * */ function _getPluginControllerNames() { App::import('Core', 'File', 'Folder'); $paths = Configure::getInstance(); $folder =& new Folder(); $folder->cd(APP . 'plugins'); // Get the list of plugins $Plugins = $folder->read(); $Plugins = $Plugins[0]; $arr = array(); // Loop through the plugins foreach($Plugins as $pluginName) { // Change directory to the plugin $didCD = $folder->cd(APP . 'plugins'. DS . $pluginName . DS . 'controllers'); // Get a list of the files that have a file name that ends // with controller.php $files = $folder->findRecursive('.*_controller\.php'); // Loop through the controllers we found in the plugins directory foreach($files as $fileName) { // Get the base file name $file = basename($fileName); // Get the controller name $file = Inflector::camelize(substr($file, 0, strlen($file)-strlen('_controller.php'))); if (!preg_match('/^'. Inflector::humanize($pluginName). 'App/', $file)) { if (!App::import('Controller', $pluginName.'.'.$file)) { debug('Error importing '.$file.' for plugin '.$pluginName); } else { /// Now prepend the Plugin name ... // This is required to allow us to fetch the method names. $arr[] = Inflector::humanize($pluginName) . "/" . $file; } } } } return $arr; } } diff --git a/app/config/core.php b/app/config/core.php index ad8877d..4e6ebbe 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -1,302 +1,302 @@ <?php /** * This is core configuration file. * * Use it to configure core behavior of Cake. * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package cake * @subpackage cake.app.config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** * CakePHP Debug Level: * * Production Mode: * 0: No error messages, errors, or warnings shown. Flash messages redirect. * * Development Mode: * 1: Errors and warnings shown, model caches refreshed, flash messages halted. * 2: As in 1, but also with full debug messages and SQL output.ad * * In production mode, flash messages redirect after a time interval. * In development mode, you need to click the flash message to continue. */ - Configure::write('debug', 0); + Configure::write('debug', 2); /** * CakePHP Log Level: * * In case of Production Mode CakePHP gives you the possibility to continue logging errors. * * The following parameters can be used: * Boolean: Set true/false to activate/deactivate logging * Configure::write('log', true); * * Integer: Use built-in PHP constants to set the error level (see error_reporting) * Configure::write('log', E_ERROR | E_WARNING); * Configure::write('log', E_ALL ^ E_NOTICE); */ Configure::write('log', true); /** * Application wide charset encoding */ Configure::write('App.encoding', 'UTF-8'); /** * To configure CakePHP *not* to use mod_rewrite and to * use CakePHP pretty URLs, remove these .htaccess * files: * * /.htaccess * /app/.htaccess * /app/webroot/.htaccess * * And uncomment the App.baseUrl below: */ //Configure::write('App.baseUrl', env('SCRIPT_NAME')); /** * Uncomment the define below to use CakePHP prefix routes. * * The value of the define determines the names of the routes * and their associated controller actions: * * Set to an array of prefixes you want to use in your application. Use for * admin or other prefixed routes. * * Routing.prefixes = array('admin'); * * Enables: * `admin_index()` and `/admin/controller/index` * `manager_index()` and `/manager/controller/index` * * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] */ Configure::write('Routing.prefixes', array('admin')); /** * Turn off all caching application-wide. * */ //Configure::write('Cache.disable', true); /** * Enable cache checking. * * If set to true, for view caching you must still use the controller * var $cacheAction inside your controllers to define caching settings. * You can either set it controller-wide by setting var $cacheAction = true, * or in each action using $this->cacheAction = true. * */ //Configure::write('Cache.check', true); /** * Defines the default error type when using the log() function. Used for * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. */ define('LOG_ERROR', 2); /** * The preferred session handling method. Valid values: * * 'php' Uses settings defined in your php.ini. * 'cake' Saves session files in CakePHP's /tmp directory. * 'database' Uses CakePHP's database sessions. * * To define a custom session handler, save it at /app/config/<name>.php. * Set the value of 'Session.save' to <name> to utilize it in CakePHP. * * To use database sessions, run the app/config/schema/sessions.php schema using * the cake shell command: cake schema run create Sessions * */ Configure::write('Session.save', 'php'); /** * The model name to be used for the session model. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The model name set here should *not* be used elsewhere in your application. */ //Configure::write('Session.model', 'Session'); /** * The name of the table used to store CakePHP database sessions. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The table name set here should *not* include any table prefix defined elsewhere. * * Please note that if you set a value for Session.model (above), any value set for * Session.table will be ignored. * * [Note: Session.table is deprecated as of CakePHP 1.3] */ //Configure::write('Session.table', 'cake_sessions'); /** * The DATABASE_CONFIG::$var to use for database session handling. * * 'Session.save' must be set to 'database' in order to utilize this constant. */ //Configure::write('Session.database', 'default'); /** * The name of CakePHP's session cookie. * * Note the guidelines for Session names states: "The session name references * the session id in cookies and URLs. It should contain only alphanumeric * characters." * @link http://php.net/session_name */ Configure::write('Session.cookie', 'CAKEPHP'); /** * Session time out time (in seconds). * Actual value depends on 'Security.level' setting. */ Configure::write('Session.timeout', '120'); /** * If set to false, sessions are not automatically started. */ Configure::write('Session.start', true); /** * When set to false, HTTP_USER_AGENT will not be checked * in the session */ Configure::write('Session.checkAgent', true); /** * The level of CakePHP security. The session timeout time defined * in 'Session.timeout' is multiplied according to the settings here. * Valid values: * * 'high' Session timeout in 'Session.timeout' x 10 * 'medium' Session timeout in 'Session.timeout' x 5040 * 'low' Session timeout in 'Session.timeout' x 2628000 * * CakePHP session IDs are also regenerated between requests if * 'Security.level' is set to 'high'. */ Configure::write('Security.level', 'medium'); /** * A random string used in security hashing methods. */ Configure::write('Security.salt', '087333c18fff60a7d94188f724d362191ee4b429'); /** * A random numeric string (digits only) used to encrypt/decrypt strings. */ Configure::write('Security.cipherSeed', '67004110033610364'); /** * Apply timestamps with the last modified time to static assets (js, css, images). * Will append a querystring parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable * timestamping. */ //Configure::write('Asset.timestamp', true); /** * Compress CSS output by removing comments, whitespace, repeating tags, etc. * This requires a/var/cache directory to be writable by the web server for caching. * and /vendors/csspp/csspp.php * * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). */ //Configure::write('Asset.filter.css', 'css.php'); /** * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the * output, and setting the config below to the name of the script. * * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). */ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** * The classname and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); /** * If you are on PHP 5.3 uncomment this line and correct your server timezone * to fix the date & time related errors. */ //date_default_timezone_set('UTC'); /** * * Cache Engine Configuration * Default settings provided below * * File storage engine. * * Cache::config('default', array( * 'engine' => 'File', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path * 'prefix' => 'cake_', //[optional] prefix every cache file with this string * 'lock' => false, //[optional] use file locking * 'serialize' => true, [optional] * )); * * * APC (http://pecl.php.net/package/APC) * * Cache::config('default', array( * 'engine' => 'Apc', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * )); * * Xcache (http://xcache.lighttpd.net/) * * Cache::config('default', array( * 'engine' => 'Xcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'user' => 'user', //user from xcache.admin.user settings * 'password' => 'password', //plaintext password (xcache.admin.pass) * )); * * * Memcache (http://www.danga.com/memcached/) * * Cache::config('default', array( * 'engine' => 'Memcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'servers' => array( * '127.0.0.1:11211' // localhost, default port 11211 * ), //[optional] * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) * )); * */ Cache::config('default', array('engine' => 'File')); diff --git a/app/config/schema/glow.sqlite b/app/config/schema/glow.sqlite index 9fe823b..dc8cb8c 100644 Binary files a/app/config/schema/glow.sqlite and b/app/config/schema/glow.sqlite differ diff --git a/app/config/settings.yml b/app/config/settings.yml index 83f8f70..6e9054f 100644 --- a/app/config/settings.yml +++ b/app/config/settings.yml @@ -1,21 +1,21 @@ --- Install: date: Thu, 22 Jul 10 18:16:23 -0400 App: base: baseUrl: timezone: America/Santiago theme: cleanity name: Gridglo base: finalus Api: limitIp: true Site: name: theme: admin_theme: cleanity status: 1 Hook: - bootstraps: core,acl + bootstraps: core,acl,simple_geo components: - routes: core,acl \ No newline at end of file + routes: core,acl,simple_geo \ No newline at end of file diff --git a/app/controllers/records_controller.php b/app/controllers/records_controller.php new file mode 100644 index 0000000..3feebf3 --- /dev/null +++ b/app/controllers/records_controller.php @@ -0,0 +1,93 @@ +<?php +class RecordsController extends AppController { + + var $name = 'Records'; + var $uses = array(); + + function beforeFilter() { + parent::beforeFilter(); + + # $this->Security->requireLogin('authenticate'); + } + + + function records() { + $records['Records'] = array('record' => + array( + 'emp_rating' => 33, + 'avm' => 12, + 'ami_ready' => true, + 'sources' => array( + 'id' => '1', + 'name' => 'SOLAR', + ), + 'ev_station' => false, + 'leed_cert' => array( + 'id' => 1, + 'name' => 'PLATINUM', + ) + ), + array( + 'emp_rating' => 33, + 'avm' => 12, + 'ami_ready' => true, + 'sources' => array( + 'id' => '1', + 'name' => 'SOLAR', + ), + 'ev_station' => false, + 'leed_cert' => array( + 'id' => 1, + 'name' => 'PLATINUM', + ) + ), + array( + 'emp_rating' => 33, + 'avm' => 12, + 'ami_ready' => true, + 'sources' => array( + 'id' => '1', + 'name' => 'SOLAR', + ), + 'ev_station' => false, + 'leed_cert' => array( + 'id' => 1, + 'name' => 'PLATINUM', + ) + ), + array( + 'emp_rating' => 33, + 'avm' => 12, + 'ami_ready' => true, + 'sources' => array( + 'id' => '1', + 'name' => 'SOLAR', + ), + 'ev_station' => false, + 'leed_cert' => array( + 'id' => 1, + 'name' => 'PLATINUM', + ) + ), + array( + 'emp_rating' => 33, + 'avm' => 12, + 'ami_ready' => true, + 'sources' => array( + 'id' => '1', + 'name' => 'SOLAR', + ), + 'ev_station' => false, + 'leed_cert' => array( + 'id' => 1, + 'name' => 'PLATINUM', + ) + ), + ); + + $this->set('records', $records); + } + + +} +?> \ No newline at end of file diff --git a/app/controllers/users_controller.php b/app/controllers/users_controller.php index 52b4222..8ae4ea6 100644 --- a/app/controllers/users_controller.php +++ b/app/controllers/users_controller.php @@ -1,262 +1,261 @@ <?php class UsersController extends AppController { var $name = 'Users'; var $components = array('Recaptcha'); var $helpers = array('Recaptcha'); function beforeFilter() { parent::beforeFilter(); $this->Security->requireLogin('authenticate'); if (!empty($this->Auth)) { $this->Auth->allow('activate', 'register', 'reset', 'recover', 'resend', 'login', 'logout'); $this->Auth->allow('*'); } } function index() {} function login() { if (!empty($this->data)) { if ($this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function register($status = '') { if (!$this->Session->check('Auth.User')) { if (!empty($this->data)) { if ($user = $this->User->register($this->data)) { $this->_sendEmail($user); $this->Session->write('Registration.email', $user['to']); $this->redirect(array('action' => 'register', 'success')); } else { $this->Session->setFlash(__('We were unable to register your account!', true)); } } elseif ($status) { if ($this->Session->check('Registration.email')) { $this->set('email', $this->Session->read('Registration.email')); $this->render($this->action.'_'.$status); } else { $this->redirect(array('action' => 'register')); } } } else { $this->redirect('/'); } } function activate($key = null) { if (!$this->Session->check('Auth.User')) { if (!is_null($key)) { if ($user = $this->User->activate($key)) { $this->Auth->login($user); $this->_sendEmail($user); $this->Session->setFlash(__('Your account is verified!', true)); $this->redirect(array('action' => 'done')); } else { $this->Session->setFlash(__('We were unable to verify you account! Account may already be active.', true)); $this->redirect(array('action' => 'login')); } } else { $this->redirect(array('action' => 'login')); } } else { $this->redirect('/'); } } function done() { if ($this->Session->check('Auth.User')) { if (!empty($this->data)) { if ($this->Auth->user('id')) { $user = $this->User->read(null, $this->Auth->user('id')); $this->User->save($this->data); $this->Auth->login($user); $this->redirect($this->Auth->redirect('/')); } else { $this->redirect(array('action' => 'login')); } } else { $this->data = $this->Auth->user(); } } else { $this->redirect('/'); } } function skip() { $this->redirect($this->Auth->redirect('/')); // Track User/Insert History // Send to Home Page } function recover() { if (!empty($this->data)) { if ($user = $this->User->recover($this->data)) { $this->_sendEmail($user); $this->Session->setFlash(__('Password Change Email has been sent!', true)); $this->redirect(array('action' => 'recover')); } else { $this->Session->setFlash(__('No user found with that email', true)); } } } function reset($key = null) { if (!is_null($key)) { if ($user = $this->User->resetKey($key)) { $this->Session->write('Reset.User', $user); } } if ($user = $this->Session->read('Reset.User')) { $this->set('user', $user); if (!empty($this->data)) { if ($this->User->reset($this->data, $user['User']['id'])) { $this->Session->delete('Reset'); $this->redirect('/'); } } } else { $this->redirect('/'); } } function resend($email = null) { if (!is_null($email)) { if ($user = $this->User->resend($email)) { $this->_sendEmail($user); } else { $this->Session->setFlash(__('Unable to send activation email. It may be that the account is already active or the email doesn\'t exisit.', true)); } } $this->redirect(array('action' => 'login')); } function admin_login() { $this->set('title_for_layout', __('Administration Login', true)); $this->layout = "admin_login"; if (!empty($this->data)) { if ($this->data['User']['remember_me'] == 1) { $this->Cookie->write('User.id', $this->Auth->user('id')); } } if ($this->Session->check('Auth.User')) { $this->redirect($this->Auth->redirect()); } } function admin_logout() { if ($this->Cookie->read('User.id')) { $this->Cookie->delete('User.id'); } $this->redirect($this->Auth->logout()); } function admin_index() { $this->set('title_for_layout', __('Users', true)); $this->User->recursive = 0; $this->set('users', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } $this->set('user', $this->User->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->User->create(); if ($this->User->register($this->data)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } $this->set('title_for_layout', sprintf(__('Add %s', true), 'User')); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(sprintf(__('Invalid %s', true), 'user'), 'attention'); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->User->register($this->data, $id)) { $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'user'), 'success'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'user'), 'error'); } } if (empty($this->data)) { $this->data = $this->User->read(null, $id); } $this->set('title_for_layout', sprintf(__('Edit "%s"', true), $this->data['User']['username'])); $groups = $this->User->Group->find('list'); $this->set(compact('groups')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(sprintf(__('Invalid id for %s', true), 'User')); $this->redirect(array('action' => 'index')); } if ($this->User->delete($id)) { $this->Session->setFlash(sprintf(__('%s deleted', true), 'User')); $this->redirect(array('action' => 'index')); } } /* API STUFF */ function authenticate() { $user = array(); if ($this->Auth->user('id')) { $this->log('Logged in as '. $this->Auth->user('username')); $user = $this->User->Account->getAccountByIdOrUsername($this->Auth->user('id')); } $this->set(compact('user')); } function profile() { $user = arrray(); - $this->set(compact('user')); } } diff --git a/app/plugins/simple_geo/config/bootstrap.php b/app/plugins/simple_geo/config/bootstrap.php new file mode 100644 index 0000000..a4abe2d --- /dev/null +++ b/app/plugins/simple_geo/config/bootstrap.php @@ -0,0 +1,2 @@ +<?php + diff --git a/app/plugins/simple_geo/config/routes.php b/app/plugins/simple_geo/config/routes.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/app/plugins/simple_geo/config/routes.php @@ -0,0 +1 @@ +<?php diff --git a/app/plugins/simple_geo/config/settings.yml b/app/plugins/simple_geo/config/settings.yml new file mode 100644 index 0000000..aa056d8 --- /dev/null +++ b/app/plugins/simple_geo/config/settings.yml @@ -0,0 +1,19 @@ +SimpleGeo: + Version: 0.1.0 + +Menu: + plugins: + title: Plugins + sort_order: 50 + url: + admin: true + controller: plugins + children: + simple_geo: + title: Simple Geo + sort_order: 10 + url: + admin: true + controller: simple_geo + + diff --git a/app/plugins/simple_geo/controllers/simple_geo_controller.php b/app/plugins/simple_geo/controllers/simple_geo_controller.php new file mode 100644 index 0000000..2b79e5c --- /dev/null +++ b/app/plugins/simple_geo/controllers/simple_geo_controller.php @@ -0,0 +1,48 @@ +<?php + + +class SimpleGeoController extends SimpleGeoAppController { + + + var $name = "SimpleGeo"; + var $uses = array('SimpleGeo.SimpleGeo'); + + function beforeFilter() { + parent::beforeFilter(); + $this->Security->requireLogin('records'); + } + + function admin_index() { + $this->set('title_for_layout', __('Simple Geo', true)); + } + + + function nearby($simpleGeoLayer) { + $points = array(); + if (!empty($simpleGeoLayer)) { + if (!empty($this->params['url']['hash'])) { + $result = $this->SimpleGeo->getNearby($simpleGeoLayer, $this->params['url']['hash'], array('limit' => 50, 'radius' => 200)); + if (!empty($result->features)) { + foreach ($result->features as $feature) { + $point['Point']['id'] = $feature->id; + $point['Point']['name'] = $feature->id; + $point['Point']['longitude'] = $feature->geometry->coordinates[0]; + $point['Point']['latitude'] = $feature->geometry->coordinates[1]; + $point['Point']['created'] = $feature->created; + $points[] = $point; + } + } else { + if (!empty($result->message)) { + #die($result->message); + } + } + } + $this->set('points', $points); + } + } + + function records($id = null, $simpleGeoLayer = null) { + + + } +} \ No newline at end of file diff --git a/app/plugins/simple_geo/controllers/simple_geo_layers_controller.php b/app/plugins/simple_geo/controllers/simple_geo_layers_controller.php new file mode 100644 index 0000000..0482865 --- /dev/null +++ b/app/plugins/simple_geo/controllers/simple_geo_layers_controller.php @@ -0,0 +1,86 @@ +<?php +class SimpleGeoLayersController extends AppController { + + var $name = 'SimpleGeoLayers'; + var $uses = array('SimpleGeoLayer', 'SimpleGeo.SimpleGeo'); + + function admin_index() { + $this->set('title_for_layout', __('Simple Geo Layers', true)); + #$this->SimpleGeoLayer->recursive = 0; + $this->set('simpleGeoLayers', $this->paginate()); + } + + function admin_view($id = null) { + if (!empty($id)) { + $simpleGeoLayer = $this->SimpleGeoLayer->read(null, $id); + if (!empty($simpleGeoLayer)) { + #$result = $this->SimpleGeo->getLayer($simpleGeoLayer['SimpleGeoLayer']['name']); + + #if (!empty($result->features)) { + # $points = array(); + # foreach ($result->features as $feature) { + # $point['Point']['id'] = $feature->id; + # $point['Point']['name'] = $feature->id; + # $point['Point']['longitude'] = $feature->geometry->coordinates[0]; + # $point['Point']['latitude'] = $feature->geometry->coordinates[1]; + # $point['Point']['created'] = $feature->created; + # $points[] = $point; + # } + #} else { + # if (!empty($result->message)) { + # die($result->message); + # } + #} + #$this->set('points', $points); + #$this->Session->setFlash(sprintf(__('Invalid %s', true), 'simple geo layer'), 'admin/attention'); + #$this->redirect(array('action' => 'index')); + } + } + $this->set('simpleGeoLayer', $simpleGeoLayer); + } + + function admin_add() { + if (!empty($this->data)) { + $this->SimpleGeoLayer->create(); + if ($this->SimpleGeoLayer->save($this->data)) { + $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'simple geo layer'), 'admin/success'); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'simple geo layer'), 'admin/error'); + } + } + } + + function admin_edit($id = null) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(sprintf(__('Invalid %s', true), 'simple geo layer'), 'admin/attention'); + $this->redirect(array('action' => 'index')); + } + if (!empty($this->data)) { + if ($this->SimpleGeoLayer->save($this->data)) { + $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'simple geo layer'), 'admin/success'); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'simple geo layer'), 'admin/error'); + } + } + if (empty($this->data)) { + $this->data = $this->SimpleGeoLayer->read(null, $id); + } + } + + function admin_delete($id = null) { + if (!$id) { + $this->Session->setFlash(sprintf(__('Invalid id for %s', true), 'simple geo layer'), 'admin/attention'); + $this->redirect(array('action'=>'index')); + } + if ($this->SimpleGeoLayer->delete($id)) { + $this->Session->setFlash(sprintf(__('%s deleted', true), 'Simple geo layer'), 'admin/success'); + $this->redirect(array('action'=>'index')); + } + $this->Session->setFlash(sprintf(__('%s was not deleted', true), 'Simple geo layer'), 'admin/error'); + $this->redirect(array('action' => 'index')); + } + +} +?> diff --git a/app/plugins/simple_geo/models/datasource/simple_geo.php b/app/plugins/simple_geo/models/datasource/simple_geo.php new file mode 100644 index 0000000..f830b7c --- /dev/null +++ b/app/plugins/simple_geo/models/datasource/simple_geo.php @@ -0,0 +1,281 @@ +<?php + +App::import('Vendor', 'SimpleGeo.HttpSocketOauth'); + +class SimpleGeo extends DataSource { + + static private $_days = array('mon', 'wed', 'tue', 'thu', 'fri', + 'sat', 'sun'); + + /** + * Version of the API to use + * + * @var string $_version The version of the API to use + */ + private $_version = '0.1'; + + /** + * Base URI of the API + * + * @var string $_api The base URI for the SimpleGeo API + */ + private $_api = 'api.simplegeo.com'; + + /** + * OAuth client + * + * @var object $_oauth Instance of OAuth client + * @see OAuthConsumer + */ + private $_oauth = null; + + /** + * API token + * + * @var string $_token OAuth token + */ + private $_token; + + /** + * API secret + * + * @var string $_secret OAuth secret + */ + private $_secret; + + + + public function __construct($config) { + $config['token'] = 'wKh7XbnNrZ556LUU94gRSZf5NvmPWmvr'; + $config['secret'] = 'Y6LYJXZmFaQUEp95taTVPWWeA86ZA3qY'; + $config['version'] = '0.1'; + + + $this->_oauth = new HttpSocketOauth(); + $this->_version = $config['version']; + $this->_token = $config['token']; + $this->_secret = $config['secret']; + + parent::__construct($config); + } + + public function describe($model) { + + } + + public function listSources() { + + } + + public function read($model, $queryData = array()) { + + } + + public function create($model, $fields = array(), $values = array()) { + + } + + #public function update($model, $fields) + + public function delete($model, $id = null) { + + } + + public function getAddress($lat, $lon) { + return $this->_sendRequest('/nearby/address/' . $lat .','. $lon.'.json'); + } + + public function getRecord($layer, $id) { + return $this->_sendRequest('/records/' . $layer . DS . $id . '.json'); + } + + public function getRecords($layer, $ids) { + return $this->_sendRequest('/records/' . $layer . DS . implode(',', $ids) . '.json'); + } + + public function getHistory($layer, $id, array $args = array()) { + return $this->_sendRequest('/records/' . $layer . DS . $id . '/history.json', $args); + } + + public function getNearby($layer, $arg, array $args = array()) { + return $this->_sendRequest('/records/' . $layer . DS . 'nearby' . DS . $arg . '.json', $args); + } + + public function addRecord(SimpleGeo_Record $rec) { + return $this->_sendRequestWithBody('/records/' . $rec->layer . DS .$rec->id . '.json', (string)$rec); + } + + public function addRecords($layer, array $records) { + $body = array( + 'type' => 'FeatureCollection', + 'features' => array() + ); + + foreach ($records as $rec) { + if (!$rec instanceof SimpleGeo_Record) { + $this->log(__FILE__ . " " . sprintf(__('Error: %s', true), __('Records must be instances of SimpleGeo_Record', true))); + return; + } + $body['features'][] = $rec->toArray(); + } + return $this->_sendRequestWithBody('/records/' . $layer . '.json', json_encode($body), "POST"); + } + + public function deleteRecord($layer, $id) { + $result = $this->_sendRequest('/records/' . $layer . DS . $id . '.json', array(), 'DELETE'); + return ($result === null); + } + + public function getContains($lat, $lon) { + return $this->_sendRequest('/contains/' . $lat . ',' . $lon . '.json'); + } + + public function getOverlaps($south, $west, $north, $east, $args = array()) { + return $this->_sendRequest('/overlaps/' . $south. ',' . $west . ',' . $north . ',' . $east .'.json', $args); + } + + public function getBoundary($id) { + return $this->_sendRequest('/boundary/' . $id . '.json'); + } + + public function getDensity($lat, $lon, $day = null, $hour = null) { + if ($day === null) { + $day = strtolower(date("D")); + } elseif (!in_array($day, self::$_days)) { + $this->log(sprintf(__('Error: %s', true), sprintf(__('%s in not a valid day of the week. Falling back to %s', true), $day, strtolower(date("D"))))); + $day = strtolower(date("D")); + } + + // Default Endpoint + $endpoint = '/density/' . $day . DS . $lat . ',' . $lon . '.json'; + + if ($hour !== null) { + if ($hour < 0 || $hour > 23) { + $this->log(sprintf(__('Error: %s', true), __('Hour must be between 0 and 23.', true))); + } else { + $endpoint = '/density/' . $day . DS . $hour . DS . $lat . ',' . $lon . '.json'; + } + } + return $this->_sendRequest($endpoint); + } + + + + + + private function _createRequest($endPoint, $args = array(), $method = 'GET') { + $request = array( + 'uri' => array( + 'host' => $this->_api, + 'path' => $this->_getPath($endPoint), + 'query' => (!empty($args)?$args:''), + ), + 'method' => $method, + 'auth' => array( + 'method' => 'OAuth', + 'oauth_consumer_key' => $this->_token, + 'oauth_consumer_secret' => $this->_secret, + ) + ); + return $request; + } + + private function _sendRequestWithBody($endPoint, $body, $method = 'PUT') { + + $request = $this->_createRequest($endPoint, array(), $method); + $request['body'] = $body; + if (($result = $this->_oauth->request($request)) !== false) { + if (!empty($this->_oauth->response['status']['code']) && + substr($this->_oauth->response['status']['code'], 0, 1) !== '2') { + $body = @json_decode($result); + $this->log(__FILE__ . " " . sprintf(__('Error: %s', true), $body->message)); + #$this->cakeError('error404', array('message' => $body->message, 'code' => $body->code)); + } + } + return $result; + } + + private function _sendRequest($endPoint, $args = array(), $method = 'GET') { + + $request = $this->_createRequest($endPoint, $args, $method); + if (($result = $this->_oauth->request($request)) !== false) { + $body = @json_decode($result); + if (!empty($this->_oauth->response['status']['code']) && + substr($this->_oauth->response['status']['code'], 0, 1) == '2') { + return $body; + } else { + $this->log(__FILE__ . " " . sprintf(__('Error: %s', true), $body->message)); + } + } + return @json_decode($result); + } + + private function _getPath($endPoint) { + return DS . $this->_version . $endPoint; + } + + +} + + + +class SimpleGeo_Record { + + public $layer; + + public $id; + + public $lat; + + public $lon; + + public $type = 'object'; + + public $created = 0; + + private $_properties = array(); + + public function __construct($layer, $id, $lat, $lon, $properties = array(), $type = 'object', $created = null) { + if ($created == null) { + $created = time(); + } + + $this->layer = $layer; + $this->id = $id; + $this->lat = (float)$lat; + $this->lon = (float)$lon; + $this->type = $type; + $this->created = $created; + + if (!empty($properties)) { + foreach ($properties as $key => $value) { + $this->$key = $value; + } + } + } + + public function __set($var, $val) { + $this->_properties[$var] = $val; + } + + public function __toString() { + $array = $this->toArray(); + if (empty($array['properties'])) { + $array['properties'] = new stdClass; + } + return json_encode($array); + } + + public function toArray() { + return array( + 'type' => 'Feature', + 'id' => $this->id, + 'created' => $this->created, + 'geometry' => array( + 'type' => 'Point', + 'coordinates' => array($this->lon, $this->lat) + ), + 'properties' => (empty($this->_properties)?new stdClass:$this->_properties) + ); + } +} diff --git a/app/plugins/simple_geo/models/simple_geo_layer.php b/app/plugins/simple_geo/models/simple_geo_layer.php new file mode 100644 index 0000000..9173b86 --- /dev/null +++ b/app/plugins/simple_geo/models/simple_geo_layer.php @@ -0,0 +1,44 @@ +<?php +class SimpleGeoLayer extends SimpleGeoAppModel { + + var $name = 'SimpleGeoLayer'; + + var $displayField = 'name'; + + function __construct($id = false, $table = null, $ds = null) { + parent::__construct($id, $table, $ds); + $validate = array( + 'name' => array( + 'alphanumeric' => array( + 'rule' => array('alphanumeric'), + 'message' => __('Name can only contain letters a-z and numbers 0-9 (.)', true), + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + 'notempty' => array( + 'rule' => array('notempty'), + 'message' => __('Layer name can not be empty.', true), + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), + 'title' => array( + 'notempty' => array( + 'rule' => array('notempty'), + 'message' => __('Please enter a title for this Layer.', true), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), + ); + } + +} +?> \ No newline at end of file diff --git a/app/plugins/simple_geo/simple_geo_app_controller.php b/app/plugins/simple_geo/simple_geo_app_controller.php new file mode 100644 index 0000000..89efb44 --- /dev/null +++ b/app/plugins/simple_geo/simple_geo_app_controller.php @@ -0,0 +1,8 @@ +<?php + + + +class SimpleGeoAppController extends AppController { + + var $helpers = array('Html', 'Form', 'Ajax', 'Javascript', 'SimpleGeo.GoogleMap'); +} \ No newline at end of file diff --git a/app/plugins/simple_geo/simple_geo_app_model.php b/app/plugins/simple_geo/simple_geo_app_model.php new file mode 100644 index 0000000..110ee2a --- /dev/null +++ b/app/plugins/simple_geo/simple_geo_app_model.php @@ -0,0 +1,6 @@ +<?php + +class SimpleGeoAppModel extends AppModel { + + +} \ No newline at end of file diff --git a/app/plugins/simple_geo/vendors/http_socket_oauth.php b/app/plugins/simple_geo/vendors/http_socket_oauth.php new file mode 100644 index 0000000..422c0fb --- /dev/null +++ b/app/plugins/simple_geo/vendors/http_socket_oauth.php @@ -0,0 +1,300 @@ +<?php +App::import('Core', 'HttpSocket'); + +/** + * Extension to CakePHP core HttpSocket class that overrides the request method + * and intercepts requests whose $request['auth']['method'] param is 'OAuth'. + * + * The correct OAuth Authorization header is determined from the request params + * and then set in the $request['header']['Authorization'] param of the request + * array before passing it back to HttpSocket::request() to send the request and + * parse the response. + * + * So to trigger OAuth, add $request['auth']['method'] = 'OAuth' to your + * request. In addition, you'll need to add your consumer key in the + * $request['auth']['oauth_consumer_key'] and your consumer secret in the + * $request['auth']['oauth_consumer_secret'] param. These are given to you by + * the OAuth provider. And once you have them, $request['auth']['oauth_token'] + * and $request['auth']['oauth_token_secret'] params. Your OAuth provider may + * require you to send additional params too. Include them in the + * $request['auth'] array and they'll be passed on in the Authorization header + * and considered when signing the request. + * + * @author Neil Crookes <[email protected]> + * @link http://www.neilcrookes.com + * @copyright (c) 2010 Neil Crookes + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + */ +class HttpSocketOauth extends HttpSocket { + + /** + * Default OAuth parameters. These get merged into the $request['auth'] param. + * + * @var array + */ + var $defaults = array( + 'oauth_version' => '1.0', + 'oauth_signature_method' => 'HMAC-SHA1', + ); + + /** + * Overrides HttpSocket::request() to handle cases where + * $request['auth']['method'] is 'OAuth'. + * + * @param array $request As required by HttpSocket::request(). NOTE ONLY + * THE ARRAY TYPE OF REQUEST IS SUPPORTED + * @return array + */ + function request($request = array()) { + + // If the request does not need OAuth Authorization header, let the parent + // deal with it. + if (!isset($request['auth']['method']) || $request['auth']['method'] != 'OAuth') { + return parent::request($request); + } + + // Generate the OAuth Authorization Header content for this request from the + // request data and add it into the request's Authorization Header. Note, we + // don't just add the header directly in the request variable and return the + // whole thing from the authorizationHeader() method because in some cases + // we may not want the authorization header content in the request's + // authorization header, for example, OAuth Echo as used by Twitpic and + // Twitter includes an Authorization Header as required by twitter's verify + // credentials API in the X-Verify-Credentials-Authorization header. + $request['header']['Authorization'] = $this->authorizationHeader($request); + + // Now the Authorization header is built, fire the request off to the parent + // HttpSocket class request method that we intercepted earlier. + return parent::request($request); + + } + + /** + * Returns the OAuth Authorization Header string for a given request array. + * + * This method is called by request but can also be called directly, which is + * useful if you need to get the OAuth Authorization Header string, such as + * when integrating with a service that uses OAuth Echo (Authorization + * Delegation) e.g. Twitpic. In this case you send a normal unauthenticated + * request to the service e.g. Twitpic along with 2 extra headers: + * - X-Auth-Service-Provider - effectively, this is the realm that identity + * delegation should be sent to - in the case of Twitter, just set this to + * https://api.twitter.com/1/account/verify_credentials.json; + * - X-Verify-Credentials-Authorization - Consumer should create all the OAuth + * parameters necessary so it could call + * https://api.twitter.com/1/account/verify_credentials.json using OAuth in + * the HTTP header (e.g. it should look like OAuth oauth_consumer_key="...", + * oauth_token="...", oauth_signature_method="...", oauth_signature="...", + * oauth_timestamp="...", oauth_nonce="...", oauth_version="...". + * + * @param array $request As required by HttpSocket::request(). NOTE ONLY + * THE ARRAY TYPE OF REQUEST IS SUPPORTED + * @return String + */ + function authorizationHeader($request) { + + $request['auth'] = array_merge($this->defaults, $request['auth']); + + // Nonce, or number used once is used to distinguish between different + // requests to the OAuth provider + if (!isset($request['auth']['oauth_nonce'])) { + $request['auth']['oauth_nonce'] = md5(uniqid(rand(), true)); + } + + if (!isset($request['auth']['oauth_timestamp'])) { + $request['auth']['oauth_timestamp'] = time(); + } + + // Now starts the process of signing the request. The signature is a hash of + // a signature base string with the secret keys. The signature base string + // is made up of the request http verb, the request uri and the request + // params, and the secret keys are the consumer secret (for your + // application) and the access token secret generated for the user by the + // provider, e.g. twitter, when the user authorizes your app to access their + // details. + + // Building the request uri, note we don't include the query string or + // fragment. Standard ports must not be included but non standard ones must. + $uriFormat = '%scheme://%host'; + if (isset($request['uri']['port']) && !in_array($request['uri']['port'], array(80, 443))) { + $uriFormat .= ':' . $request['uri']['port']; + } + $uriFormat .= '/%path'; + $requestUrl = $this->_buildUri($request['uri'], $uriFormat); + + // OAuth reference states that the request params, i.e. oauth_ params, body + // params and query string params need to be normalised, i.e. combined in a + // single string, separated by '&' in the format name=value. But they also + // need to be sorted by key, then by value. You can't just merge the auth, + // body and query arrays together then do a ksort because there may be + // parameters with the same name. Instead we've got to get them into an + // array of array('name' => '<name>', 'value' => '<value>') elements, then + // sort those elements. + + // Let's start with the auth params - however, we shouldn't include the auth + // method (OAuth), and OAuth reference says not to include the realm or the + // consumer or token secrets + $requestParams = $this->assocToNumericNameValue(array_diff_key( + $request['auth'], + array_flip(array('realm', 'method', 'oauth_consumer_secret', 'oauth_token_secret')) + )); + + // Next add the body params if there are any and the content type header is + // not set, or it's application/x-www-form-urlencoded + if (isset($request['body']) && (!isset($request['header']['Content-Type']) || stristr($request['header']['Content-Type'], 'application/x-www-form-urlencoded'))) { + $requestParams = array_merge($requestParams, $this->assocToNumericNameValue($request['body'])); + } + + // Finally the query params + if (isset($request['uri']['query'])) { + $requestParams = array_merge($requestParams, $this->assocToNumericNameValue($request['uri']['query'])); + } + + // Now we can sort them by name then value + usort($requestParams, array($this, 'sortByNameThenByValue')); + + // Now we concatenate them together in name=value pairs separated by & + $normalisedRequestParams = ''; + foreach ($requestParams as $k => $requestParam) { + if ($k) { + $normalisedRequestParams .= '&'; + } + $normalisedRequestParams .= $requestParam['name'] . '=' . $this->parameterEncode($requestParam['value']); + } + + // The signature base string consists of the request method (uppercased) and + // concatenated with the request URL and normalised request parameters + // string, both encoded, and separated by & + $signatureBaseString = strtoupper($request['method']) . '&' + . $this->parameterEncode($requestUrl) . '&' + . $this->parameterEncode($normalisedRequestParams); + + // The signature base string is hashed with a key which is the consumer + // secret (assigned to your application by the provider) and the token + // secret (also known as the access token secret, if you've got it yet), + // both encoded and separated by an & + $key = ''; + if (isset($request['auth']['oauth_consumer_secret'])) { + $key .= $this->parameterEncode($request['auth']['oauth_consumer_secret']); + } + $key .= '&'; + if (isset($request['auth']['oauth_token_secret'])) { + $key .= $this->parameterEncode($request['auth']['oauth_token_secret']); + } + + // Finally construct the signature according to the value of the + // oauth_signature_method auth param in the request array. + switch ($request['auth']['oauth_signature_method']) { + case 'HMAC-SHA1': + $request['auth']['oauth_signature'] = base64_encode(hash_hmac('sha1', $signatureBaseString, $key, true)); + break; + default: + // @todo implement the other 2 hashing methods + break; + } + + // Finally, we have all the Authorization header parameters so we can build + // the header string. + $authorizationHeader = 'OAuth'; + + // We don't want to include the realm, method or secrets though + $authorizationHeaderParams = array_diff_key( + $request['auth'], + array_flip(array('method', 'oauth_consumer_secret', 'oauth_token_secret', 'realm')) + ); + + // Add the Authorization header params to the Authorization header string, + // properly encoded. + $first = true; + + if (isset($request['auth']['realm'])) { + $authorizationHeader .= ' realm="' . $request['auth']['realm'] . '"'; + $first = false; + } + + foreach ($authorizationHeaderParams as $name => $value) { + if (!$first) { + $authorizationHeader .= ','; + } else { + $authorizationHeader .= ' '; + $first = false; + } + $authorizationHeader .= $this->authorizationHeaderParamEncode($name, $value); + } + + return $authorizationHeader; + + } + + /** + * Builds an Authorization header param string from the supplied name and + * value. See below for example: + * + * @param string $name E.g. 'oauth_signature_method' + * @param string $value E.g. 'HMAC-SHA1' + * @return string E.g. 'oauth_signature_method="HMAC-SHA1"' + */ + function authorizationHeaderParamEncode($name, $value) { + return $this->parameterEncode($name) . '="' . $this->parameterEncode($value) . '"'; + } + + /** + * Converts an associative array of name => value pairs to a numerically + * indexed array of array('name' => '<name>', 'value' => '<value>') elements. + * + * @param array $array Associative array + * @return array + */ + function assocToNumericNameValue($array) { + $return = array(); + if (is_array($array)) { + foreach ($array as $name => $value) { + $return[] = array( + 'name' => $name, + 'value' => $value, + ); + } + } + return $return; + } + + /** + * User defined function to lexically sort an array of + * array('name' => '<name>', 'value' => '<value>') elements by the value of + * the name key, and if they're the same, then by the value of the value key. + * + * @param array $a Array with key for 'name' and one for 'value' + * @param array $b Array with key for 'name' and one for 'value' + * @return integer 1, 0 or -1 depending on whether a greater than b, less than + * or the same. + */ + function sortByNameThenByValue($a, $b) { + if ($a['name'] == $b['name']) { + if ($a['value'] == $b['value']) { + return 0; + } + return ($a['value'] > $b['value']) ? 1 : -1; + } + return ($a['name'] > $b['name']) ? 1 : -1; + } + + /** + * Encodes paramters as per the OAuth spec by utf 8 encoding the param (if it + * is not already utf 8 encoded) and then percent encoding it according to + * RFC3986 + * + * @param string $param + * @return string + */ + function parameterEncode($param) { + $encoding = mb_detect_encoding($param); + if ($encoding != 'UTF-8') { + $param = mb_convert_encoding($param, 'UTF-8', $encoding); + } + $param = rawurlencode($param); + $param = str_replace('%7E', '~', $param); + return $param; + } + +} +?> \ No newline at end of file diff --git a/app/plugins/simple_geo/views/helpers/google_map.php b/app/plugins/simple_geo/views/helpers/google_map.php new file mode 100644 index 0000000..efc27ad --- /dev/null +++ b/app/plugins/simple_geo/views/helpers/google_map.php @@ -0,0 +1,198 @@ +<?php +/* + * CakeMap -- a google maps integrated application built on CakePHP framework. + * Copyright (c) 2005 Garrett J. Woodworth : [email protected] + * rd11,inc : http://rd11.com + * + * @author gwoo <[email protected]> + * @version 0.10.1311_pre_beta + * @license OPPL + * + * Modified by Mahmoud Lababidi <[email protected]> + * Date Dec 16, 2006 + * + * + */ + +class GoogleMapHelper extends Helper { + + var $errors = array(); + var $types = array('ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN'); + + function map($default, $style = 'width: 400px; height: 400px' ) { + + $out = "<div id=\"map\""; + $out .= isset($style) ? "style=\"".$style."\"" : null; + $out .= " ></div>"; + $out .= " + <script type=\"text/javascript\"> + //<![CDATA[ + var directionDisplay; + var directionsService = new google.maps.DirectionsService(); + var map; + var lat; + var lon; + var iconimage = \"http://labs.google.com/ridefinder/images/mm_20_red.png\"; + var iconshadow = \"http://labs.google.com/ridefinder/images/mm_20_shadow.png\"; + if (google.loader.ClientLocation) { + lat = google.loader.ClientLocation.latitude; + lon = google.loader.ClientLocation.longitude; + } + "; + $default['type'] = (empty($default['type']) || (!empty($default['type']) && + !in_array(strtoupper($default['type']), $this->types)))?"ROADMAP":strtoupper($default['type']); + if (!empty($default['lat']) || !empty($default['lon'])) { + $out .="lat = ".$default['lat'].";"; + $out .="lon = ".$default['lon'].";"; + } + $out .=" + var myOptions = { + zoom: ".$default['zoom'].", + center: new google.maps.LatLng(lat, lon), + mapTypeId: google.maps.MapTypeId.".$default['type'].", + streetViewControl: true + }; + + var map = new google.maps.Map(document.getElementById(\"map\"), myOptions); + + function cleardirs() { + if(directionsDisplay) { + directionsDisplay.setMap(null); + } + div = document.getElementById('".(isset($default['directions_div'])?$default['directions_div']:'directions_div')."'); + if(div) { + div.innerHTML = \"\"; + }"; + if(isset($default['directions_div'])) { + $out .= " + directionsDisplay = new google.maps.DirectionsRenderer(); + directionsDisplay.setMap(map); + directionsDisplay.setPanel(document.getElementById('".$default['directions_div']."')); + function calcRoute(fromid,tolat,tolon) { + directionsDisplay.setMap(map); + from = document.getElementById(fromid).value; + var start = from; + var end = new google.maps.LatLng(tolat,tolon); + var request = { + origin:start, + destination:end, + travelMode: google.maps.DirectionsTravelMode.DRIVING + }; + directionsService.route(request, function(result, status) { + if (status == google.maps.DirectionsStatus.OK) { + directionsDisplay.setDirections(result); + } + }); + }"; + } + $out .="} + //]]> + </script>"; + return $out; + } + + function addOverlay(&$data) { + $out = " + <script type=\"text/javascript\"> + //<![CDATA[ + "; + + $out .= " + //]]> + </script>"; + return $out; + } + + function addMarkers(&$data, $icon=null) { + + $out = " + <script type=\"text/javascript\"> + //<![CDATA[ + "; + if(is_array($data)) { + $i = 0; + foreach ( $data as $n=>$m ) { + $keys = array_keys($m); + $point = $m[$keys[0]]; + if(!preg_match('/[^0-9\\.\\-]+/',$point['longitude']) && + preg_match('/^[-]?(?:180|(?:1[0-7]\\d)|(?:\\d?\\d))[.]{1,1}[0-9]{0,15}/',$point['longitude']) && + !preg_match('/[^0-9\\.\\-]+/',$point['latitude']) && + preg_match('/^[-]?(?:180|(?:1[0-7]\\d)|(?:\\d?\\d))[.]{1,1}[0-9]{0,15}/',$point['latitude'])) { + $out .= " + var point".$i." = new google.maps.LatLng(".$point['latitude'].",".$point['longitude']."); + var marker".$i." = new google.maps.Marker({ + position: point".$i.", + map: map, + title:\"".(isset($point['title'])?$point['title']:'')."\", + shadow: iconshadow, + icon: iconimage, + });"; + + if(isset($point['title'])&&isset($point['html'])) { + $out .= " + var infowindow$i = new google.maps.InfoWindow({ + content: \"$point[title]$point[html]\" + + }); + google.maps.event.addListener(marker".$i.", 'click', function() { + infowindow$i.open(map,marker".$i."); + });"; + } + $data[$n][$keys[0]]['js']="marker$i.openInfoWindowHtml(marker$i.html);"; + $i++; + } + } + } + $out .= " + //]]> + </script>"; + return $out; + + } + + function addEvent ( $event='click', $var, $script=null ) { + $out = " + <script type=\"text/javascript\"> + //<![CDATA[ + $script + google.maps.event.addListener(map, '".$event."', ".$var.", true); + //]]> + </script>"; + return $out; + } + + function addMarkerOnClick ( $innerHtml = null ) { + $mapClick = ' + var mapClick = function (event) { + var marker = new google.maps.Marker({ + position:event.latLng, + icon: iconimage, + map:map + }); + var infowindow = new google.maps.InfoWindow({ + content: \"'.$innerHtml.'\" + }); + google.maps.event.addListener(marker, \'click\', function() { + infowindow.open(map,marker); + }); + } + '; + return $this->addEvent('click', 'mapClick', $mapClick); + } + + function moveMarkerOnClick ($lngctl, $latctl, $innerHtml = null) { + $mapClick = ' + var mapClick = function (event) { + marker0.setPosition(event.latLng); + lngctl = document.getElementById(\''.$lngctl.'\'); + latctl = document.getElementById(\''.$latctl.'\'); + if(lngctl) + lngctl.value = event.latLng.lng(); + if(latctl) + latctl.value = event.latLng.lat(); + } + '; + return $this->addEvent('click', 'mapClick', $mapClick); + } +} +?> diff --git a/app/plugins/simple_geo/views/simple_geo/admin_index.ctp b/app/plugins/simple_geo/views/simple_geo/admin_index.ctp new file mode 100644 index 0000000..4bcd067 --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo/admin_index.ctp @@ -0,0 +1,4 @@ +<?php + $html->addCrumb(__('Plugins', true), '/admin/plugins'); + $html->addCrumb(__('Simple Geo', true)); +?> \ No newline at end of file diff --git a/app/plugins/simple_geo/views/simple_geo/nearby.ctp b/app/plugins/simple_geo/views/simple_geo/nearby.ctp new file mode 100644 index 0000000..a7d9d14 --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo/nearby.ctp @@ -0,0 +1,20 @@ +<?php + if (!empty($points)) { + foreach($points as $n=>$point){ + $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b><br />"; + $points[$n]['Point']['html'] = $point['Point']['name']; + } + } + $default = array('zoom' => 12); + echo $googleMap->map($default, $style = 'width:100%; height: 500px;'); + echo $googleMap->addEvent('dragend', 'mapDrag', "var mapDrag = function(event){}"); + + if (isset($overLay)) { + echo $googleMap->addOverlay($overLay); + } + + if(isset($points)){ + echo $googleMap->addMarkers($points, 'http://boingboing.net/style/reportthis.png'); + echo $googleMap->addMarkerOnClick("<h1>This is the Point</h1>"); + } + ?> diff --git a/app/plugins/simple_geo/views/simple_geo_layers/admin_add.ctp b/app/plugins/simple_geo/views/simple_geo_layers/admin_add.ctp new file mode 100644 index 0000000..e1e302f --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo_layers/admin_add.ctp @@ -0,0 +1,19 @@ +<div class="simpleGeoLayers form"> +<?php echo $this->Form->create('SimpleGeoLayer');?> + <fieldset> + <legend><?php __('Admin Add Simple Geo Layer'); ?></legend> + <?php + echo $this->Form->input('name'); + echo $this->Form->input('title'); + echo $this->Form->input('description'); + ?> + </fieldset> +<?php echo $this->Form->end(__('Submit', true));?> +</div> +<div class="actions"> + <h3><?php __('Actions'); ?></h3> + <ul> + + <li><?php echo $this->Html->link(__('List Simple Geo Layers', true), array('action' => 'index'));?></li> + </ul> +</div> \ No newline at end of file diff --git a/app/plugins/simple_geo/views/simple_geo_layers/admin_edit.ctp b/app/plugins/simple_geo/views/simple_geo_layers/admin_edit.ctp new file mode 100644 index 0000000..55661b2 --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo_layers/admin_edit.ctp @@ -0,0 +1,21 @@ +<div class="simpleGeoLayers form"> +<?php echo $this->Form->create('SimpleGeoLayer');?> + <fieldset> + <legend><?php __('Admin Edit Simple Geo Layer'); ?></legend> + <?php + echo $this->Form->input('id'); + echo $this->Form->input('name'); + echo $this->Form->input('title'); + echo $this->Form->input('description'); + ?> + </fieldset> +<?php echo $this->Form->end(__('Submit', true));?> +</div> +<div class="actions"> + <h3><?php __('Actions'); ?></h3> + <ul> + + <li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('SimpleGeoLayer.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('SimpleGeoLayer.id'))); ?></li> + <li><?php echo $this->Html->link(__('List Simple Geo Layers', true), array('action' => 'index'));?></li> + </ul> +</div> \ No newline at end of file diff --git a/app/plugins/simple_geo/views/simple_geo_layers/admin_index.ctp b/app/plugins/simple_geo/views/simple_geo_layers/admin_index.ctp new file mode 100644 index 0000000..1bc8a8d --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo_layers/admin_index.ctp @@ -0,0 +1,55 @@ +<div class="simpleGeoLayers index"> + <h2><?php __('Simple Geo Layers');?></h2> + <table cellpadding="0" cellspacing="0"> + <tr> + <th><?php echo $this->Paginator->sort('id');?></th> + <th><?php echo $this->Paginator->sort('name');?></th> + <th><?php echo $this->Paginator->sort('title');?></th> + <th><?php echo $this->Paginator->sort('description');?></th> + <th><?php echo $this->Paginator->sort('created');?></th> + <th><?php echo $this->Paginator->sort('modified');?></th> + <th class="actions"><?php __('Actions');?></th> + </tr> + <?php + $i = 0; + foreach ($simpleGeoLayers as $simpleGeoLayer): + $class = null; + if ($i++ % 2 == 0) { + $class = ' class="altrow"'; + } + ?> + <tr<?php echo $class;?>> + <td><?php echo $simpleGeoLayer['SimpleGeoLayer']['id']; ?>&nbsp;</td> + <td><?php echo $simpleGeoLayer['SimpleGeoLayer']['name']; ?>&nbsp;</td> + <td><?php echo $simpleGeoLayer['SimpleGeoLayer']['title']; ?>&nbsp;</td> + <td><?php echo $simpleGeoLayer['SimpleGeoLayer']['description']; ?>&nbsp;</td> + <td><?php echo $simpleGeoLayer['SimpleGeoLayer']['created']; ?>&nbsp;</td> + <td><?php echo $simpleGeoLayer['SimpleGeoLayer']['modified']; ?>&nbsp;</td> + <td class="actions"> + <?php echo $this->Html->link(__('View', true), array('action' => 'view', $simpleGeoLayer['SimpleGeoLayer']['id'])); ?> + <?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $simpleGeoLayer['SimpleGeoLayer']['id'])); ?> + <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $simpleGeoLayer['SimpleGeoLayer']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $simpleGeoLayer['SimpleGeoLayer']['id'])); ?> + </td> + </tr> +<?php endforeach; ?> + </table> + <p> + <?php + echo $this->Paginator->counter(array( + 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) + )); + ?> </p> + + <div class="paging"> + <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?> + | <?php echo $this->Paginator->numbers();?> + | + <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?> + </div> +</div> +<div class="actions"> + <h3><?php __('Actions'); ?></h3> + <ul> + <li><?php echo $this->Html->link(__('New Simple Geo Layer', true), array('action' => 'add')); ?></li> + </ul> +</div> \ No newline at end of file diff --git a/app/plugins/simple_geo/views/simple_geo_layers/admin_view.ctp b/app/plugins/simple_geo/views/simple_geo_layers/admin_view.ctp new file mode 100644 index 0000000..f17f4cb --- /dev/null +++ b/app/plugins/simple_geo/views/simple_geo_layers/admin_view.ctp @@ -0,0 +1,42 @@ +<?php + echo $sidebar->addTitle(sprintf(__('%s Menu', true), __('Simple Geo Layer', true))); + echo $sidebar->addMenu('users', array('title' => sprintf(__('Manage %s',true), __('Layers', true)), 'sort_order' => 10)); + echo $sidebar->addMenu('new_user', array('title' => sprintf(__('New %s',true), __('Layer', true)), 'sort_order' => 10, 'url' => array('action' => 'add')), 'users'); + +echo $javascript->link("http://www.google.com/jsapi"); +echo $javascript->codeBlock("google.load('maps', '3', {other_params:'sensor=false'});"); +echo $javascript->codeBlock(); +?> +$(document).ready(function() { + $.get('<?php echo $html->url(array('admin' => false, 'plugin' => 'simple_geo', 'controller' => 'simple_geo', 'action' => 'nearby', $simpleGeoLayer['SimpleGeoLayer']['name'],)) ?>', {hash: google.loader.ClientLocation.latitude+','+google.loader.ClientLocation.longitude}, function (data) { $("#map_box").html(data)}); +}) +<?php echo $javascript->blockEnd(); +?> +<div class="box simpleGeoLayers view"> + <div class="box-top rounded_by_jQuery_corners" style="-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;"> + <h4 class="white"><?php echo $simpleGeoLayer['SimpleGeoLayer']['name'] ?></h4> + </div> + <div id="map_box" style="-moz-border-radius-bottomleft: 5px; -moz-border-radius-bottomright: 5px;" class="box-container rounded_by_jQuery_corners form"> + <?php echo $html->tag('span', __('Loading Map Data', true), array('class' => 'loading'));?> +<?php +/* $points = $this->requestAction(array('plugin' => 'simple_geo', 'controller' => 'simple_geo', 'action' => 'nearby'), array('pass' => array($simpleGeoLayer['SimpleGeoLayer'], ''))); + + die(); + if (!empty($points)) { + foreach($points as $n=>$point){ + $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b>"; + $points[$n]['Point']['html'] = $point['Point']['name']; + } + } + $default = array('zoom' => 12); + echo $googleMap->map($default, $style = 'width:100%; height: 500px;'); + + if(isset($points)){ + echo $googleMap->addMarkers($points); + echo $googleMap->addMarkerOnClick(); + } + +*/ +?> + </div> +</div> \ No newline at end of file diff --git a/app/views/records/json/records.ctp b/app/views/records/json/records.ctp new file mode 100644 index 0000000..d2c0723 --- /dev/null +++ b/app/views/records/json/records.ctp @@ -0,0 +1,5 @@ +<?php + $rsp = array('rsp' => array('account')); + $rsp['rsp']['records'] = $records; + echo json_encode($rsp); +?> \ No newline at end of file diff --git a/app/views/records/xml/records.ctp b/app/views/records/xml/records.ctp new file mode 100644 index 0000000..2172908 --- /dev/null +++ b/app/views/records/xml/records.ctp @@ -0,0 +1 @@ +<?php echo $xml->serialize($records, array('root' => 'rsp')); ?> \ No newline at end of file diff --git a/app/views/themed/cleanity/webroot/css/admin/style.css b/app/views/themed/cleanity/webroot/css/admin/style.css index ec4760b..40ac39d 100644 --- a/app/views/themed/cleanity/webroot/css/admin/style.css +++ b/app/views/themed/cleanity/webroot/css/admin/style.css @@ -1,210 +1,213 @@ /** document general options **/ body{font:9pt Helvetica,Arial,Tahoma,sans-serif;background:url(../../img/admin/bg-body.gif) repeat-x #e8e8dd;} body,html{height:100%} span.clearFix{width:100%;height:0px;visibility:hidden;clear:both;display:block;margin:0;padding:0;font-size:0px;} .hidden{display:none;} /** button stylings **/ div.inner-nav{clear:both;margin:10px 0;} div.inner-nav a,a.button{display:inline-block;background:url(../../img/admin/bg-buttons-left.gif) no-repeat;text-decoration:none;height:21px;padding:0 0 0 15px;color:#fff;font-weight:bold;font-size:9pt;} div.inner-nav a:hover,a.button:hover{color:#333;} div.inner-nav a span,a.button span{display:block;background:url(../../img/admin/bg-buttons-right.gif) no-repeat right;padding:0 15px 0 0;line-height:21px;} a.button{margin:0 10px;} .align-left{float:left;} .align-right{float:right;} /** text colors assigned to elements in various areas **/ .yellow{color:#e8e4a2;} .light-blue{color:#a6b7c0;} .blue{color:#508db8 !important;} .light-grey{color:#d7d7d7} .white{color:#fff;} div#container{width:980px;position:relative;min-height:100%;height:auto !important;height:100%;margin:0 auto -113px;} .push{height:133px;} /** HEADER AND NAVIGATION **/ div#header{padding-top:20px;} /** logo,which is a typographical h1 element (you can edit this part if you want to replace with your logo graphic) **/ div#header h1{font-size:250%;text-transform:uppercase;letter-spacing:-1px;font-weight:bold;float:left;width:450px;/** mac safari & firefox hack */height:39px;/**/} div#header h1 a{color:#fff;text-decoration:none;} div#header h1 a:hover{color:#ccc;} /** header userbox **/ p#userbox{float:right;color:#c1cad0;background:url(../../img/admin/icon-greet-user.gif) no-repeat 0px 5px;padding:5px 0px 0px 18px;margin:0;} p#userbox a{color:#ceac0f;text-decoration:none;font-weight:bold;} p#userbox a:hover{color:#fff;} p#userbox small{display:block;margin-top:5px;color:#8d9599;font-size:0.9em;} div#top{margin-bottom:18px;} /** menu **/ ul#menu{width:600px;float:left;} ul#menu li{float:left;height:40px;position:relative} ul#menu li a{color:#e0e0e0;text-decoration:none;padding:13px 15px 7px 15px;height:20px;display:inline-block;text-align:center;text-transform:uppercase;font-weight:bold;background:url(../../img/admin/bg-topnav-mask.gif) no-repeat 0 0;position:relative;} ul#menu li a:hover{color:#508db8;background:#fff;background:url(../../img/admin/bg-topnav-mask.gif) no-repeat top right;} ul#menu li a.top-level{position:relative;padding-right:25px;} ul#menu li a.top-level span{background:url(../../img/admin/bg-toplevel.gif) no-repeat 0px 2px;width:11px;height:8px;display:block;position:absolute;right:10px;top:13px;} ul#menu li a.top-level:hover span,.blue span{background-image:url(../../img/admin/bg-toplevel-hover.png) !important;} ul#menu li ul{position:absolute;top:40px;min-width:200px !important;left:0px;z-index:999;background:#fff;visibility:hidden;display:none;padding-bottom:10px;border:2px solid #ccc;border-left:none;border-top:none;border-right-width:1px;padding-top:5px;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;-webkit-border-bottom-left-radius:5px;} ul#menu li ul li{float:none;height:auto;border-bottom:1px dotted #d6d8d9;} ul#menu li ul li:hover{background:url(../../img/admin/bg-submenu-hover.gif) no-repeat;} ul#menu li ul li a{padding:6px 3px 6px 20px;display:block !important;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px !important;color:#5c6467;text-decoration:none;text-align:left;text-transform:capitalize;height:auto;background-color:none !important;font-weight:normal;} ul#menu li ul li a:hover{color:#fff;background-image:url(../../img/admin/submenuhover.gif) !important;} ul#menu li.selected a{background:#6c7275;color:#fff;} ul#menu li ul ul{-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;-webkit-border-top-left-radius:5px;margin:-1.5em 0 0 10em;} /** search form **/ div#header form{float:right;width:246px;margin-top:9px;} div#header form fieldset legend{display:none;} div#header form fieldset label#searchbox{display:block;background:url(../../img/admin/bg-search.gif) no-repeat;height:21px;width:246px;} div#header form fieldset label#searchbox input{background:none;border:none;outline:none;padding:4px 0 0 23px;color:#666;font-size:0.9em;} /** END OF HEADER **/ /** CONTENT **/ div#content{padding-top:25px;} /** main heading of the page **/ div#content-top{border-bottom:1px solid #bcbcb7;padding-bottom:8px;margin-bottom:15px;} div#content-top h2{font-size:200%;font-weight:bold;color:#373d40;margin-left:12px;float:left;} div#content-top p{margin-left:12px;margin-top:5px;} div#content-top p a{color:#508db8;text-decoration:none;} div#content-top p a:hover{color:#333;} div#content-top a#topLink{float:right;background:url(../../img/admin/icon-blue-arrow.gif) no-repeat;display:inline-block;padding-left:23px;text-decoration:none;font-weight:bold;color:#508db8;height:16px;margin-top:10px;margin-right:12px;} div#content-top a#topLink:hover{color:#333;} /** box general settings **/ div.box{margin-bottom:15px;width:100%;} div.box-container{background-color:#fff;padding:10px;} div.box-container h5{color:#333;padding-left:20px;border-bottom:1px solid #d7d9d9;font-weight:bold;padding-bottom:7px;margin-bottom:1px;padding-top:1px;} div.box-container h5 span{font-weight:normal;font-size:0.9em;} div.box-top { background:#3a4043;padding:10px;} div.box-top h4{text-transform:uppercase;font-weight:bold;} /* ul.box-top-buttons { float:right; width:270px; padding-right:15px;} ul.box-top-buttons li {float:right; padding-left:15px; height:18px} ul.box-top-buttons li a {outline:none; padding:6px 15px 6px 0; display:block; font-size:0.9em; text-decoration:none; color:#ddd;} ul.box-top-buttons li a:hover {color:#fff;} ul.box-top-buttons li.selected {} ul.box-top-buttons li.selected a {color:#867946; } */ /** columns **/ div#left-col,div#mid-col{float:left;margin-right:12px;} div#mid-col{width:510px;} div#right-col{margin-right:0px;float:right;} div#left-col,div#right-col{width:223px;} div.full-col{width:980px !important;margin-right:0px !important;} div.half-col{width:740px !important;margin-right:0px !important;} /** list links **/ ul.list-links,div#to-do-list ul{width:223px;margin-left:-10px;margin-top:-5px;} ul.list-links li{border-bottom:1px dotted #d6d8d9;} ul.list-links li a{padding:8px 3px 6px 20px;display:block;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px #fff;color:#5c6467;text-decoration:none;} ul.list-links li a:hover,ul.list-links li.selected a:hover{background:url(../../img/admin/link-arrow-hover.gif) no-repeat 10px 10px #fafae9;color:#000;} ul.list-links li ul{background:#fcfbf2 !important;padding-left:10px;padding-top:10px;width:213px;font-size:0.9em;} ul.list-links li ul li{border-bottom:none;} ul.list-links li ul li a{background:none;padding:5px 3px 5px 20px !important;} ul.list-links li ul li a:hover{background-color:#fcfbf2;background-position:8px 10px} ul.list-links li a.ui-state-active{font-weight:bold;} /** system messages **/ div#sys-messages-container h5{background:url(../../img/admin/icon-messages.gif) no-repeat;} div#quick-send-message-container h5{background:url(../../img/admin/icon-quick-send-message.gif) no-repeat;} div#sys-messages-container ul{margin-bottom:20px;} div#sys-messages-container ul li{font-size:0.8em;padding:8px;position:relative;} div#sys-messages-container ul li a.sysmessage-delete{position:absolute;right:8px;top:7px;} div#sys-messages-container ul li a:hover{text-decoration:none;} div#sys-messages-container ul li.even-messages{background:#f3f6f7;} div#sys-messages-container ul li.even-messages a{color:#314d5b;} div#sys-messages-container ul li.odd-messages{background:#ebf0f3;} div#sys-messages-container ul li.odd-messages a{color:#1f2f35;} /** quick send message **/ div#quick-send-message-container form{background:#f2f2f2;padding:8px;font-size:0.9em;color:#333;margin-bottom:5px;} div#quick-send-message-container form fieldset p{margin-bottom:6px !important;} div#quick-send-message-container form p:first-child{margin-top:0px;} div#quick-send-message-container form p label{font-weight:bold;display:block;margin-bottom:5px;} div#quick-send-message-container form input#message-title,div#quick-send-message-container form textarea{padding:5px;font-size:0.9em;border:1px solid #ccc;width:175px;font-family:Helvetica,Arial,sans-serif} /** to-dos **/ ul.tab-menu{border-bottom:2px solid #3a4043;height:27px;} ul.tab-menu li{float:left;margin-right:5px;} ul.tab-menu li.tabs-selected a{background:#3a4043;color:#c4a93d;font-weight:bold;} ul.tab-menu li a{display:inline-block;background:#737d81;color:#ccc;font-weight:normal;padding:6px 10px;text-transform:uppercase;text-decoration:none;} .tabs-hide{display:none;} div#to-do-list ul{margin-top:-10px;} div#to-do-list ul li{border-bottom:1px solid #eeeddb;padding:8px 10px;} div#to-do-list ul li.even{background:#f5f4eb;} div#to-do-list ul li.odd{background:#fbfbf7;} div#to-do-list ul li a{font-weight:bold;color:#ae9a62;} div#to-do-list ul li a:hover{color:#666;text-decoration:none;} div#to-do-list ul li small{display:block;padding:5px 0 0 24px;font-size:0.9em;color:#999;} /** forms **/ form.middle-forms{padding:5px;color:#3a4043} form.middle-forms p{margin:10px 0;} form.middle-forms h3{color:#1d8895;font-weight:bold;font-size:150%;margin-bottom:10px;} form.middle-forms fieldset{padding-top:10px;} form.middle-forms fieldset ol li{padding:15px;} form.middle-forms fieldset ol li.even{background:#f3f3f3;} form.middle-forms fieldset ol li input/*,form.middle-forms fieldset ol li textarea*/{padding:5px;border:1px solid #dedede;background:url(../../img/admin/bg-textbox.gif) repeat-x #fff;} form.middle-forms fieldset ol li input[type="radio"],form.middle-forms fieldset ol li input[type="checkbox"]{border:none;background:none;} input.txtbox-short{width:122px;} input.txtbox-middle{width:190px;} input.txtbox-long,form.middle-forms fieldset ol li textarea{width:305px;} form.middle-forms fieldset ol li label{float:left;margin-right:15px;display:block;} form.middle-forms fieldset ol li label.field-title{font-weight:bold;width:100px;padding-top:3px;} span.form-confirm-inline,span.form-error-inline{display:inline-block;padding-left:20px;margin-left:10px;height:16px;} span.form-confirm-inline{color:#72a101;background:url(../../img/admin/icon-confirm.gif) no-repeat;} span.form-error-inline{color:#a10101;background:url(../../img/admin/icon-error.gif) no-repeat;} a.heading-link{color:#cae6ed;text-transform:capitalize;font-size:0.9em;font-weight:normal;display:inline-block;padding-left:15px;text-decoration:none;} a.heading-link:hover{color:#fff;} /* tables */ table.table-short{width:500px;margin:-5px 0 0 -5px;border-collapse:collapse;} table.table-long{width:740px;margin-left:-10px} table.table-full{width:100%;} table.table-short td,table.table-long td{border-top:1px solid #dfdfdf;font-size:0.9em;padding:10px 0;margin:0;color:#666;} table.table-short thead th,table.table-long thead th{font-weight:bold;color:#666;padding:10px 0;} table.table-short thead th a,table.table-long thead th a{color:#666;} table.table-short thead th,table.table-short tfoot td,table.table-long thead th,table.table-long tfoot td{border:none;} table.table-short td:first-child,table.table-long td:first-child{text-align:left;padding:0 0 0 10px;} table.table-short tfoot,table.table-long tfoot{border-top:1px solid #ccc;} table.table-short tr.altRow,table.table-long tr.altRow{background:url(../../img/admin/bg_tableRow.gif) repeat-x 0px 1px;} table.table-short td a,table.table-long td a{color:#508db8;font-weight:bold;} table.table-short td a:hover,table.table-long td a:hover{text-decoration:none;color:#333;} td.col-chk{width:40px;} td.col-first{font-weight:bold;width:200px;} td.col-second a{color:#508db8;font-weight:bold;} td.col-second a:hover{text-decoration:none;color:#333;} td.actions{width:110px;} a.table-edit-link,a.table-delete-link{color:#666;text-decoration:none;display:inline-block;margin-right:10px;padding-left:20px;height:16px;text-align:right;} a.table-edit-link:hover,a.table-delete-link:hover{color:#000;} a.table-delete-link{margin-right:0px !important;background:url(../../img/admin/icon-delete.gif) no-repeat;} a.table-edit-link{background:url(../../img/admin/icon-edit.gif) no-repeat;} /** CALENDAR & DATE **/ div#date-container{background-color:#f3f6f7;margin:-10px -10px 15px -10px;padding:10px;} div#date-container img{float:left;margin-right:10px;} div#date-container span.hour,div#date-container span.date{display:block;float:left;} div#date-container span.hour{font-size:220%;font-weight:bold;color:#d8a416;padding-top:2px;margin-right:10px;} div#date-container span.date{color:#666;font-size:0.8em;padding-top:4px;} div#calendar-container{width:100%;} div#calendar-container h5{background-image:url(../../img/admin/icon-calendar.gif);background-repeat:no-repeat;display:block;} div#calendar-container div.ui-datepicker-header{background:#a1b1b3;padding:10px;text-align:center;position:relative;color:#fff;font-weight:bold;margin-bottom:1px;} span.ui-icon{position:absolute;top:10px;cursor:pointer;} .ui-icon-circle-triangle-e{right:10px;} .ui-icon-circle-triangle-w{left:10px;} a.ui-state-highlight{background:#fff;color:#ac0000;font-weight:bold;} a.ui-datepicker-next-hover span,a.ui-datepicker-prev-hover span{color:#000 !important;} table.ui-datepicker-calendar{width:203px;padding:5px;background:#f2f2f2;font-size:0.9em;} table.ui-datepicker-calendar th,table.ui-datepicker-calendar td{text-align:center;font-weight:bold;padding:2px;} table.ui-datepicker-calendar a{text-decoration:none;display:block;text-align:center;color:#666;padding:3px;border:1px solid #f2f2f2;} table.ui-datepicker-calendar a:hover{border:1px solid #ccc;} table.ui-datepicker-calendar a.ui-state-active{color:#ac0000 !important;border:1px solid #ccc;background:#fff;} td.ui-datepicker-week-end a{color:#999;} /** QUICK VISUAL LINKS **/ ul#quick-visual-links{width:100%;} ul#quick-visual-links li{float:left;} ul#quick-visual-links li a{width:62px;text-align:center;margin:0 3px 5px 0;font-size:0.9em;border:1px solid #ccc;display:block;padding:5px 0;text-decoration:none;color:#444;-moz-border-radius:3px;-webkit-border-radius:3px;} ul#quick-visual-links li img{margin-bottom:3px;} ul#quick-visual-links li a:hover{color:#000;border-color:#999;background:#f3f6f7} /** FOOTER **/ div#footer-wrap{background:url(../../img/admin/bg-footer.gif) repeat-x;height:113px;position:relative;} div#footer{width:960px;margin:0 auto;padding:10px;} div#footer-top{color:#f2f2f2;} div#footer-top h4{color:#fff;text-transform:uppercase;margin:5px 0;font-size:120%;font-weight:bold;} div#footer-top a{color:#adc3d3;font-weight:bold;font-size:0.9em;text-decoration:none;} div#footer-top a:hover{color:#fff;} div#footer-top h2{font-size:160%;text-transform:uppercase;padding-top:10px;padding-right:10px;font-weight:bold;} div#footer-top h2 a{color:#a1a5a6;} div#footer-top h2 a:hover{color:#c7cdcf;} div#footer-bottom{margin-top:25px;} div#footer-bottom p{color:#717272;font-size:0.9em;} div#footer-bottom p a{color:#ccc;text-decoration:none;} .pagination{width:95%;background-color:#FFFFFF;text-align:center;font-size:10px;margin:0 auto;margin-top:1em;padding:5px;} .pagination a{font-size:11px;text-decoration:none;color:#000;border:1px solid #DDD !important;padding:3px;-moz-border-radius:3px;-webkit-border-radius:3px;border:3px;} .pagination a:hover{font-size:11px;text-decoration:none;color:#000000;border:1px solid #A7A7A7;background-color:white;padding:3px;-moz-border-radius:3px;} .pagination span.current{font-size:10px;text-decoration:none;color:#FFF;border:1px solid #999;background-color:#666;padding:3px;-moz-border-radius:3px;} .pagination span.disabled{font-size:10px;text-decoration:none;color:#C6C7C7;border:1px solid #C6C7C7;background-color:white;padding:3px;-moz-border-radius:3px;} + +.loading { margin:0 auto; background: url(../../img/admin/loader.gif) no-repeat; padding: 10px 0 10px 50px;} + diff --git a/app/views/themed/cleanity/webroot/img/admin/loader.gif b/app/views/themed/cleanity/webroot/img/admin/loader.gif new file mode 100644 index 0000000..488f982 Binary files /dev/null and b/app/views/themed/cleanity/webroot/img/admin/loader.gif differ diff --git a/app/views/users/admin_index.ctp b/app/views/users/admin_index.ctp index d99ca78..749ae3a 100644 --- a/app/views/users/admin_index.ctp +++ b/app/views/users/admin_index.ctp @@ -1,87 +1,84 @@ <?php echo $html->addCrumb(__('User', true)); echo $sidebar->addTitle(sprintf(__('%s Menu', true), __('User', true))); echo $sidebar->addMenu('users', array('title' => sprintf(__('Manage %s',true), __('Users', true)), 'sort_order' => 10)); echo $sidebar->addMenu('new_user', array('title' => sprintf(__('New %s',true), __('Users', true)), 'sort_order' => 10, 'url' => array('action' => 'add')), 'users'); echo $sidebar->addMenu('groups', array('title' => sprintf(__('Manage %s', true), __('Groups', true)), 'sort_order' => 20)); echo $sidebar->addMenu('list groups', array('title' => sprintf(__('List %s', true), __('Groups', true)), 'sort_order' => 20, 'url' => array('controller' => 'groups', 'action' => 'index')), 'groups'); echo $sidebar->addMenu('new groups', array('title' => sprintf(__('New %s', true), __('Group', true)), 'sort_order' => 20, array('controller' => 'groups', 'action' => 'add')), 'groups'); ?> - - - <div class="box"> <div class="box-top rounded_by_jQuery_corners" style="-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;"> <h4 class="white"><?php __('Users');?></h4> </div> <div style="-moz-border-radius-bottomleft: 5px; -moz-border-radius-bottomright: 5px;" class="box-container rounded_by_jQuery_corners"> <table cellpadding="0" cellspacing="0" class="table-long"> <thead> <tr> <th>&nbsp;</th> <th><?php echo $this->Paginator->sort('username');?></th> <th><?php echo $this->Paginator->sort('first_name');?></th> <th><?php echo $this->Paginator->sort('last_name');?></th> <th><?php echo $this->Paginator->sort('active');?></th> <th><?php echo $this->Paginator->sort('group_id');?></th> - <th class="actions"><?php __('Actions', true);?></th> + <th class="actions"><a href="">Link</a><?php __('Actions', true);?></th> </tr> </thead> <tbody> <?php $i = 0; $count = 0; if (!empty($users)): foreach ($users as $user): $class = null; $count = count($user['User']); if ($i++ % 2 == 0) { $class = ' class="altrow"'; } ?> <tr<?php echo $class;?>> <td class="col-chk"><input type="checkbox" name="mass[]" value="<?php echo $user['User']['id']; ?>" /></td> <td><?php echo $user['User']['username']; ?>&nbsp;</td> <td><?php echo $user['User']['first_name']; ?>&nbsp;</td> <td><?php echo $user['User']['last_name']; ?>&nbsp;</td> <td><?php echo $user['User']['active']; ?>&nbsp;</td> <td> <?php echo $this->Html->link($user['Group']['name'], array('controller' => 'groups', 'action' => 'view', $user['Group']['id'])); ?> </td> <td class="actions"> <?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $user['User']['id']), array('title' => __('Edit', true), 'class' => 'table-edit-link')); ?> <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $user['User']['id']), array('title' => __('Delete', true), 'class' => 'table-delete-link'), sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> </td> </tr> <?php endforeach; ?> <?php else: ?> <tr> <td colspan=''><?php echo sprintf(__('No %s Found', true), __('User', true)); ?></td> </tr> <?php endif; ?> </tbody> <tfoot> <td class="col-chk"><input type="checkbox" name="" /></td> <td colspan="14"> </td> <tr> <td colspan="14"> <div class="pagination"> <?php echo $this->Paginator->first('<'.__('First', true), array()); ?> <?php echo $this->Paginator->prev('<<'.__('Previous', true), array(), null, array('class' => 'disabled')); ?> <?php echo $this->Paginator->numbers(array('class' => 'number', 'separator' => '')); ?> <?php echo $this->Paginator->next(__('Next', true).'>>', array(), null, array('class' => 'disabled')); ?> <?php echo $this->Paginator->last(__('Last', true).'>', array()); ?> </div> <div class="clear"></div> </td> </tr> </tfoot> </table> </div> </div>
valaravena/Glo
70e773929cf81408af3b0c4cd24d34b54e176b09
Adding SQL Database
diff --git a/app/config/schema/glow.sqlite b/app/config/schema/glow.sqlite index 1ad0138..9fe823b 100644 Binary files a/app/config/schema/glow.sqlite and b/app/config/schema/glow.sqlite differ
valaravena/Glo
856f1f261e8231e2884b33e02f1eb0293a6bc7df
Allowing empty for IP Address
diff --git a/app/models/user.php b/app/models/user.php index 7f2d62d..7ae22cf 100644 --- a/app/models/user.php +++ b/app/models/user.php @@ -1,319 +1,320 @@ <?php class User extends AppModel { var $name = 'User'; var $order = 'name ASC'; var $actsAs = array('Containable', 'Acl.Acl' => 'requester'); var $belongsTo = array( 'Group' => array( 'className' => 'Group', 'foreignKey' => 'group_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); var $hasMany = array( 'Account' => array( 'className' => 'Account', 'foreignKey' => 'user_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array( 'username' => array( 'notEmpty' => array( 'rule' => array('notEmpty'), 'message' => __('Username must not be empty.', true), ), 'isUnique' => array( 'rule' => array('isUnique' , 'username'), 'message' => __('Username is already taken. Please choose a different username', true) ), 'alphaNumeric' => array( 'rule' => 'alphaNumeric', 'message' => __('The username can contain letters and numbers only.', true) ), 'between' => array( 'rule' => array('between', 3, 16), 'message' => __('Username must be between 3 and 16 characters long.', true), ), 'minLength' => array( 'rule' => array('minLength', 1), 'message' => __('Username is a required field', true) ) ), 'password_before' => array( 'between' => array( 'rule' => array('between', 6, 20), 'message' => __('Password must be between 6 and 20 characters long.', true) ), 'minLength' => array( 'rule' => array('minLength', '1'), 'message' => __('A valid password is required.', true) ), ), 'password_confirmation' => array( 'matchFields' => array( 'rule' => array('matchFields', 'password_before'), 'message' => __('Password and Retype Password do not match.', true) ), 'minLength' => array( 'rule' => array('minLength', 1), 'message' => __('A valid retype password is required.', true) ), ), 'email' => array( 'isUnique' => array( 'rule' => array('isUnique', 'email'), 'message' => __('The email was already used by another user.', true) ), 'email' => array( 'rule' => 'email', 'message' => __('The email you provided does not appear to be valid.', true) ), 'minlength' => array( 'rule' => array('minLength', 1), 'message' => __('A valid email is required.', true) ), ), 'ip' => array( 'userIp' => array( 'rule' => 'ip', - 'message' => __('Please specify a valid ip address', true) + 'message' => __('Please specify a valid ip address', true), + 'allowEmpty' => true, ), ), ); } function parentNode($type='Aro') { if ($type == 'Aro') { if (!$this->id && empty($this->data)) { return null; } $data = $this->data; if (empty($this->data)) { $data = $this->read(); } if (empty($data['User']['group_id'])) { return null; } else { return array('model' => 'Group', 'foreign_key' => $data['User']['group_id']); } } return false; } function afterSave($created) { if (!$created) { $parent = $this->parentNode(); $parent = $this->node($parent); $node = $this->node(); $aro = $node[0]; $aro['Aro']['parent_id'] = $parent[0]['Aro']['id']; $this->Aro->save($aro); } } function register($data, $id = null) { if (is_array($data)) { if (!empty($data['User'])) { if (empty($id) || !empty($data['User']['reset_key'])) { $data['User']['key'] = Security::hash(uniqid(rand(), true).Configure::read('Security.salt')); } if (!empty($data['User']['password_before'])) { $data['User']['password'] = Security::hash(Configure::read('Security.salt').$data['User']['password_before']); } if (!empty($id)) { $data['User']['id'] = $id; } else { $data['User']['ip'] = $_SERVER['REMOTE_ADDR']; $this->create(); } if ($this->save($data)) { $user = $this->read(null, $this->getLastInsertId()); #$user['User']['username'] = $data['User']['username']; #$user['User']['password'] = $data['User']['before_password']; #$user['User']['activate_link'] = $this->appConfigurations['url'].'/users/activate/'. $data['User']['key']; #$user['to'] = $data['User']['email']; # if ($admin == true) { # } else { # $user['subject'] = sprintf(__('Registration Verification - %s', true), $this->appConfigurations['name']); # } # $user['template'] = 'users/activate'; return $user; } else { return false; } } else { return false; } } } function recover($data, $newPasswordLength = 8) { $conditions = array(); if (is_array($data)) { if (!empty($data['User'])) { foreach ($data['User'] as $key => $datum) { if ($this->hasField($key)) { $conditions[$key] = $datum; } } $user = $this->find('first', array('conditions' => $conditions)); if (!empty($user)) { $user['User']['key'] = Security::hash(uniqid(rand(), true)); $user['User']['before_password'] = substr(sha1(uniqid(rand(), true)), 0, $newPasswordLength); $user['to'] = $user['User']['email']; $user['subject'] = sprintf(__('Account Reset - %s', true), $this->appConfigurations['name']); $user['template'] = 'users/reset'; $user['User']['password'] = Security::hash(Configure::read('Security.salt').$user['User']['before_password']); $user['User']['reset_link'] = $this->appConfigurations['url'].'/users/reset/'. $user['User']['key']; $this->save($user, false); return $user; } else { return false; } } else { return false; } } else { return false; } } function reset($data, $id = null) { if (is_array($data)) { if (!empty($data['User'])) { if (!empty($data['User']['before_password'])) { $data['User']['password'] = Security::hash(Configure::read('Security.salt').$data['User']['before_password']); } if (!empty($id)) { $data['User']['id'] = $id; if ($this->save($data)) { return true; } } } } return false; } function resetKey($key) { if (isset($key)) { $user = $this->find('first', array('conditions' => array('User.key' => $key))); if (!empty($user)) { $user['User']['key'] = ''; $this->save($user); return $user; } else { return false; } } return false; } function resend($email) { if (!is_null($email)) { $user = $this->find('first', array('contitions' => array('User.email' => $email, 'User.active' => 0))); if (!empty($user)) { $data['User']['key'] = Security::hash(uniqid(rand(), true)); $this->read(null, $user['User']['id']); $this->save($data); $user['User']['activate_link'] = $this->appConfigurations['url'].'/users/activate/'. $data['User']['key']; $user['to'] = $user['User']['email']; $user['subject'] = sprintf(__('Resent Verification - %s', true), $this->appConfigurations['name']); $user['template'] = 'users/activate'; return $user; } } return false; } function activate($key) { $user = $this->find('first', array('conditions' => array('User.key' => $key, 'User.active' => 0))); if (!empty($user)) { $user['User']['active'] = 1; $user['User']['key'] = ''; $this->save($user); $user['to'] = $user['User']['email']; $user['subject'] = sprintf(__('Welcome to %s, %s', true), $this->appConfigurations['name'], $user['User']['username']); $user['template'] = 'users/welcome'; return $user; } else { return false; } } function getUserByIdOrUsername($id = null) { if (!empty($id)) { $user = $this->find('first', array( 'conditions' => array( 'OR' => array( array('User.id' => $id), array('User.username' => $id) ), ), /* 'fields' => array( 'User.id', 'User.first_name', 'User.last_name', 'User.username', 'User.email', )*/ ) ); if (!empty($user)) { return $user; } } return false; } }
valaravena/Glo
6330771cf31f4538128407b8c195bc11b12de0b5
Adding Update to user; allowing for IP address to be specified
diff --git a/app/config/schema/glow.sqlite b/app/config/schema/glow.sqlite index 6e7f2fe..1ad0138 100644 Binary files a/app/config/schema/glow.sqlite and b/app/config/schema/glow.sqlite differ diff --git a/app/models/user.php b/app/models/user.php index 197caba..7f2d62d 100644 --- a/app/models/user.php +++ b/app/models/user.php @@ -1,313 +1,319 @@ <?php class User extends AppModel { var $name = 'User'; var $order = 'name ASC'; var $actsAs = array('Containable', 'Acl.Acl' => 'requester'); var $belongsTo = array( 'Group' => array( 'className' => 'Group', 'foreignKey' => 'group_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); var $hasMany = array( 'Account' => array( 'className' => 'Account', 'foreignKey' => 'user_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array( 'username' => array( 'notEmpty' => array( 'rule' => array('notEmpty'), 'message' => __('Username must not be empty.', true), ), 'isUnique' => array( 'rule' => array('isUnique' , 'username'), 'message' => __('Username is already taken. Please choose a different username', true) ), 'alphaNumeric' => array( 'rule' => 'alphaNumeric', 'message' => __('The username can contain letters and numbers only.', true) ), 'between' => array( 'rule' => array('between', 3, 16), 'message' => __('Username must be between 3 and 16 characters long.', true), ), 'minLength' => array( 'rule' => array('minLength', 1), 'message' => __('Username is a required field', true) ) ), 'password_before' => array( 'between' => array( 'rule' => array('between', 6, 20), 'message' => __('Password must be between 6 and 20 characters long.', true) ), 'minLength' => array( 'rule' => array('minLength', '1'), 'message' => __('A valid password is required.', true) ), ), 'password_confirmation' => array( 'matchFields' => array( 'rule' => array('matchFields', 'password_before'), 'message' => __('Password and Retype Password do not match.', true) ), 'minLength' => array( 'rule' => array('minLength', 1), 'message' => __('A valid retype password is required.', true) ), ), 'email' => array( 'isUnique' => array( 'rule' => array('isUnique', 'email'), 'message' => __('The email was already used by another user.', true) ), 'email' => array( 'rule' => 'email', 'message' => __('The email you provided does not appear to be valid.', true) ), 'minlength' => array( 'rule' => array('minLength', 1), 'message' => __('A valid email is required.', true) ), ), + 'ip' => array( + 'userIp' => array( + 'rule' => 'ip', + 'message' => __('Please specify a valid ip address', true) + ), + ), ); } function parentNode($type='Aro') { if ($type == 'Aro') { if (!$this->id && empty($this->data)) { return null; } $data = $this->data; if (empty($this->data)) { $data = $this->read(); } if (empty($data['User']['group_id'])) { return null; } else { return array('model' => 'Group', 'foreign_key' => $data['User']['group_id']); } } return false; } function afterSave($created) { if (!$created) { $parent = $this->parentNode(); $parent = $this->node($parent); $node = $this->node(); $aro = $node[0]; $aro['Aro']['parent_id'] = $parent[0]['Aro']['id']; $this->Aro->save($aro); } } function register($data, $id = null) { if (is_array($data)) { if (!empty($data['User'])) { if (empty($id) || !empty($data['User']['reset_key'])) { $data['User']['key'] = Security::hash(uniqid(rand(), true).Configure::read('Security.salt')); } if (!empty($data['User']['password_before'])) { $data['User']['password'] = Security::hash(Configure::read('Security.salt').$data['User']['password_before']); } if (!empty($id)) { $data['User']['id'] = $id; } else { $data['User']['ip'] = $_SERVER['REMOTE_ADDR']; $this->create(); } if ($this->save($data)) { $user = $this->read(null, $this->getLastInsertId()); #$user['User']['username'] = $data['User']['username']; #$user['User']['password'] = $data['User']['before_password']; #$user['User']['activate_link'] = $this->appConfigurations['url'].'/users/activate/'. $data['User']['key']; #$user['to'] = $data['User']['email']; # if ($admin == true) { # } else { # $user['subject'] = sprintf(__('Registration Verification - %s', true), $this->appConfigurations['name']); # } # $user['template'] = 'users/activate'; return $user; } else { return false; } } else { return false; } } } function recover($data, $newPasswordLength = 8) { $conditions = array(); if (is_array($data)) { if (!empty($data['User'])) { foreach ($data['User'] as $key => $datum) { if ($this->hasField($key)) { $conditions[$key] = $datum; } } $user = $this->find('first', array('conditions' => $conditions)); if (!empty($user)) { $user['User']['key'] = Security::hash(uniqid(rand(), true)); $user['User']['before_password'] = substr(sha1(uniqid(rand(), true)), 0, $newPasswordLength); $user['to'] = $user['User']['email']; $user['subject'] = sprintf(__('Account Reset - %s', true), $this->appConfigurations['name']); $user['template'] = 'users/reset'; $user['User']['password'] = Security::hash(Configure::read('Security.salt').$user['User']['before_password']); $user['User']['reset_link'] = $this->appConfigurations['url'].'/users/reset/'. $user['User']['key']; $this->save($user, false); return $user; } else { return false; } } else { return false; } } else { return false; } } function reset($data, $id = null) { if (is_array($data)) { if (!empty($data['User'])) { if (!empty($data['User']['before_password'])) { $data['User']['password'] = Security::hash(Configure::read('Security.salt').$data['User']['before_password']); } if (!empty($id)) { $data['User']['id'] = $id; if ($this->save($data)) { return true; } } } } return false; } function resetKey($key) { if (isset($key)) { $user = $this->find('first', array('conditions' => array('User.key' => $key))); if (!empty($user)) { $user['User']['key'] = ''; $this->save($user); return $user; } else { return false; } } return false; } function resend($email) { if (!is_null($email)) { $user = $this->find('first', array('contitions' => array('User.email' => $email, 'User.active' => 0))); if (!empty($user)) { $data['User']['key'] = Security::hash(uniqid(rand(), true)); $this->read(null, $user['User']['id']); $this->save($data); $user['User']['activate_link'] = $this->appConfigurations['url'].'/users/activate/'. $data['User']['key']; $user['to'] = $user['User']['email']; $user['subject'] = sprintf(__('Resent Verification - %s', true), $this->appConfigurations['name']); $user['template'] = 'users/activate'; return $user; } } return false; } function activate($key) { $user = $this->find('first', array('conditions' => array('User.key' => $key, 'User.active' => 0))); if (!empty($user)) { $user['User']['active'] = 1; $user['User']['key'] = ''; $this->save($user); $user['to'] = $user['User']['email']; $user['subject'] = sprintf(__('Welcome to %s, %s', true), $this->appConfigurations['name'], $user['User']['username']); $user['template'] = 'users/welcome'; return $user; } else { return false; } } function getUserByIdOrUsername($id = null) { if (!empty($id)) { $user = $this->find('first', array( 'conditions' => array( 'OR' => array( array('User.id' => $id), array('User.username' => $id) ), ), /* 'fields' => array( 'User.id', 'User.first_name', 'User.last_name', 'User.username', 'User.email', )*/ ) ); if (!empty($user)) { return $user; } } return false; } } diff --git a/app/views/users/admin_add.ctp b/app/views/users/admin_add.ctp index e06fd51..14a4d74 100644 --- a/app/views/users/admin_add.ctp +++ b/app/views/users/admin_add.ctp @@ -1,27 +1,28 @@ <div class="box users form"> <div class="box-top rounded_by_jQuery_corners" style="-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;"> <h4 class="white"><?php printf(__('Admin Add %s', true), __('User', true)); ?></h4> </div> <div style="-moz-border-radius-bottomleft: 5px; -moz-border-radius-bottomright: 5px;" class="box-container rounded_by_jQuery_corners form"> <?php echo $form->create('User', array('class' => 'middle-forms', 'inputDefaults' => array('div' => array('tag' => 'li')))); ?> <fieldset> <legend><?php printf(__('User %s', true), __('Information', true)); ?></legend> <ol> <?php echo $form->input('first_name', array('label' => array('text' => __('First Name', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('last_name', array('label' => array('text' => __('Last Name', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('username', array('label' => array('text' => __('User Name', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('email', array('label' => array('text' => __('Email', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('password_before', array('type' => 'password', 'label' => array('text' => __('Password', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('password_confirmation', array('type' => 'password', 'label' => array('text' => __('Password Confirmation', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); + echo $form->input('ip', array('label' => array('text' => __('IP Address', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('active', array('type' => 'checkbox', 'label' => array('text' => __('Active', true), 'class' => 'field-title'))); echo $this->Form->input('group_id', array('label' => array('text' => __('Group', true), 'class' => 'field-title'))); ?> </ol> <?php echo $this->Form->end(array('name' => __('Submit', true), 'class' => 'button'));?> </fieldset> </div> </div> diff --git a/app/views/users/admin_edit.ctp b/app/views/users/admin_edit.ctp index dd6446c..8d2f757 100644 --- a/app/views/users/admin_edit.ctp +++ b/app/views/users/admin_edit.ctp @@ -1,29 +1,30 @@ <div class="box users form"> <div class="box-top rounded_by_jQuery_corners" style="-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;"> <h4 class="white"><?php printf(__('Admin Edit %s', true), __('User', true)); ?></h4> </div> <div style="-moz-border-radius-bottomleft: 5px; -moz-border-radius-bottomright: 5px;" class="box-container rounded_by_jQuery_corners form"> <?php echo $form->create('User', array('class' => 'middle-forms', 'inputDefaults' => array('div' => array('tag' => 'li')))); ?> <fieldset> <legend><?php printf(__('User %s', true), __('Information', true)); ?></legend> <ol> <?php echo $this->Form->input('id'); echo $form->input('first_name', array('label' => array('text' => __('First Name', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('last_name', array('label' => array('text' => __('Last Name', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('username', array('label' => array('text' => __('User Name', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('email', array('label' => array('text' => __('Email', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('password_before', array('type' => 'password', 'label' => array('text' => __('Password', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('password_confirmation', array('type' => 'password', 'label' => array('text' => __('Password Confirmation', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('reset_key', array('type' => 'checkbox', 'label' => array('text' => __('Reset API Key', true), 'class' => 'field-title'), 'after' => sprintf('<strong>%s</strong>', $this->data['User']['key']))); + echo $form->input('ip', array('label' => array('text' => __('IP Address', true), 'class' => 'field-title'), 'class' => 'txtbox-long')); echo $form->input('active', array('type' => 'checkbox', 'label' => array('text' => __('Active', true), 'class' => 'field-title'))); echo $this->Form->input('group_id', array('label' => array('text' => __('Group', true), 'class' => 'field-title'))); ?> </ol> <?php echo $this->Form->end(array('name' => __('Submit', true), 'class' => 'button'));?> </fieldset> </div> </div>
valaravena/Glo
29843d2b978bd1054faa6e315f73da3308465fcc
Making changes to .gitignore and app_controller
diff --git a/.gitignore b/.gitignore index 1de3861..05450a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,9 @@ /cakephp /app/config/*.yml -/app/tmp/cache/*.* -/app/tmp/cache/persistent/cake_* -/app/tmp/cache/models/cake_* -/app/tmp/cache/views/cake_* +/app/tmp/cache/**/cake_* /app/tmp/logs/*.log /app/webroot/files/**/*.* /app/config/config.php diff --git a/app/app_controller.php b/app/app_controller.php index 3273534..14346be 100644 --- a/app/app_controller.php +++ b/app/app_controller.php @@ -1,448 +1,448 @@ <?php class AppController extends Controller { var $helpers = array('Html', 'Form', 'Time', 'Number', 'Javascript', 'Cache', 'Text', 'Session','Menu','Sidebar'); var $components = array('Security', 'Acl', 'Auth', 'Acl.AclFilter', 'Cookie', 'RequestHandler', 'Session', 'Mailer', 'Security'); var $uses = array('User', 'Core.Setting'); var $view = 'Theme'; var $apiRequest = false; var $apiError = false; var $appConfigurations; function beforeFilter() { $this->AclFilter->auth(); #$this->Security->blackHoleCallback = '__securityError'; $this->appConfigurations = Configure::read('App'); $this->set('appConfigurations', $this->appConfigurations); $this->set('title_for_layout', __('Error: Title For Layout needed', true)); $this->Setting->applyAllUpdates(); if (isset($this->params['admin'])) { $this->layout = 'admin'; } $this->Auth->allow('*'); if (Configure::read('Site.theme') && !isset($this->params['admin'])) { $this->theme = Configure::read('Site.theme'); } elseif (Configure::read('Site.admin_theme') && isset($this->params['admin'])) { $this->theme = Configure::read('Site.admin_theme'); } if (!isset($this->params['admin']) && Configure::read('Site.status') == 0) { $this->layout = 'maintenance'; $this->set('title_for_layout', __('Site down for maintenance', true)); $this->render('../elements/blank'); } if (isset($this->params['locale'])) { Configure::write('Config.language', $this->params['locale']); } /* API Actions */ if ($this->RequestHandler->isXml() || $this->RequestHandler->ext == 'json') { Configure::write('debug',0); $this->Security->loginOptions = array( 'type'=>'basic', 'login'=>'apiLogin', 'realm'=>$this->appConfigurations['name'], ); $status = array(); $user = array(); // Check API Key if (!empty($this->params['url']['api_key'])) { $user = $this->User->findByKey($this->params['url']['api_key']); if (empty($user)) { $status['status'] = array('code' => 500, 'msg' => 'invalid_api_key'); } } else { $status['status'] = array('code' => 500, 'msg' => 'missing_api_key'); $this->apiError = true; } // Check Limit IP if (!$this->apiError && $this->appConfigurations['Api']['limitIp']) { if (!empty($user)) { - if ($user['User']['ip'] != $this->RequestHandler->getClientIp()) { + if (!empty($user['User']['ip']) && $user['User']['ip'] != $this->RequestHandler->getClientIp()) { $status['status'] = array('code' => 500, 'msg' => 'ip_not_accepted', 'received' => $this->RequestHandler->getClientIp(), 'expected' => $user['User']['ip']); $this->apiError = true; } } } $this->set(compact('status')); } } function apiLogin($args) { $data[$this->Auth->fields['username']] = $args['username']; $data[$this->Auth->fields['password']] = $this->Auth->password($args['password']); if ($this->Auth->login($data)) { return true; } else { $this->Security->blackHole($this, 'login'); return false; } } function _sendEmail($data) { if (!empty($data)) { if ($this->Mailer) { $emailConfigurations = Configure::read('Email'); if (!empty($emailConfigurations['Host'])) { $this->Mailer->Host = $emailConfigurations['Host']; } else { $this->log('_sendEmail(), Host parameter required'); return false; } if (!empty($emailConfigurations['Port'])) { $this->Mailer->Port = $emailConfigurations['Port']; } else { $this->log('_sendEmail(), Port parameter required'); return false; } if (!empty($emailConfigurations['IsSMTP'])) { $this->Mailer->IsSMTP(); if (!empty($emailConfigurations['Username'])) { $this->Mailer->Username = $emailConfigurations['Username']; } else { $this->log('_sendEmail(), Username parameter required if using SMTP'); return false; } if (!empty($emailConfigurations['Password'])) { $this->Mailer->Password = $emailConfigurations['Password']; } else { $this->log('_sendEmail(), Password parameter required if using SMTP'); return false; } } if (!empty($emailConfigurations['SMTPAuth'])) { $this->Mailer->SMTPAuth = $emailConfigurations['SMTPAuth']; } if (!empty($emailConfigurations['SMTPSecure'])) { $this->Mailer->SMTPSecure = $emailConfigurations['SMTPSecure']; } if (!empty($emailConfigurations['WordWrap'])) { $this->Mailer->WordWrap = $emailConfigurations['WordWrap']; } if (!empty($emailConfigurations['From'])) { $this->Mailer->From = $emailConfigurations['From']; } else { $this->log('_sendEmail(), From name parameter required'); return false; } if (!empty($emailConfigurations['FromName'])) { $this->Mailer->FromName = $emailConfigurations['FromName']; } if (!empty($data['subject'])) { $this->Mailer->Subject = $data['subject']; } else { $this->log('_sendEmail(), Subject paramerter required'); return false; } if (!empty($data['to'])) { if (is_array($data['to'])) { foreach ($data['to'] as $recipient) { if (!empty($recipient['name'])) { $this->Mailer->AddAddress($recipient['to'], $recipient['name']); } else { $this->Mailer->AddAddress($recipient['to']); } } } else { if (!empty($data['name'])) { $this->Mailer->AddAddress($data['to'], $data['name']); } else { $this->Mailer->AddAddress($data['to']); } } } else { $this->log('_sendEmail(), To parameter required'); return false; } $tmp = array( 'autoRender' => $this->autoRender, 'autoLayout' => $this->autoLayout, 'layout' => $this->layout, 'viewPath' => $this->viewPath, ); $this->set('data', $data); $this->autoRender = false; $this->autoLayout = false; if (empty($data['layout'])) { $data['layout'] = 'default'; } if (empty($data['template'])) { $data['template'] = $this->action; } if (!empty($emailConfigurations['IsHTML'])) { $this->Mailer->IsHTML($emailConfigurations['IsHTML']); $this->layout = 'email'.DS.'html'.DS.$data['layout']; $this->viewPath = 'elements'.DS.'email'.DS.'html'; $bodyHtml = $this->render($data['template']); $this->Mailer->MsgHTML($bodyHtml); } else { $this->layout = 'email'.DS.'text'.DS.$data['layout']; $this->viewPath = 'elements'.DS.'email'.DS.'text'; $bodyText = $this->render($data['template']); $this->Mailer->AltBody = $bodyText; } // Get things back to normal $this->autoRender = $tmp['autoRender']; $this->autoLayout = $tmp['autoLayout']; $this->layout = $tmp['layout']; $this->viewPath = $tmp['viewPath']; if (!$return = $this->Mailer->Send()) { $this->log($this->Mailer->ErrorInfo); $return = false; } $this->Mailer->ClearAddresses(); $this->Mailer->ClearAllRecipients(); $this->Mailer->ClearCustomHeaders(); $this->Mailer->ClearAttachments(); return $return; } else { $this->log('_sendEmail(), PhpMailer component required'); return false; } } else { $this->log('_sendEmail(), data parameter required'); return false; } } /* Can this be placed somewhere else */ function build_acl() { if (!Configure::read('debug')) { return $this->_stop(); } $log = array(); $aco =& $this->Acl->Aco; $root = $aco->node('controllers'); if (!$root) { $aco->create(array('parent_id' => null, 'model' => null, 'alias' => 'controllers')); $root = $aco->save(); $root['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for controllers'; } else { $root = $root[0]; } App::import('Core', 'File'); $Controllers = Configure::listObjects('controller'); $appIndex = array_search('App', $Controllers); if ($appIndex !== false ) { unset($Controllers[$appIndex]); } $baseMethods = get_class_methods('Controller'); $baseMethods[] = 'buildAcl'; $Plugins = $this->_getPluginControllerNames(); $Controllers = array_merge($Controllers, $Plugins); // look at each controller in app/controllers foreach ($Controllers as $ctrlName) { $methods = $this->_getClassMethods($this->_getPluginControllerPath($ctrlName)); // Do all Plugins First if ($this->_isPlugin($ctrlName)){ $pluginNode = $aco->node('controllers/'.$this->_getPluginName($ctrlName)); if (!$pluginNode) { $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $this->_getPluginName($ctrlName))); $pluginNode = $aco->save(); $pluginNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $this->_getPluginName($ctrlName) . ' Plugin'; } } // find / make controller node $controllerNode = $aco->node('controllers/'.$ctrlName); if (!$controllerNode) { if ($this->_isPlugin($ctrlName)){ $pluginNode = $aco->node('controllers/' . $this->_getPluginName($ctrlName)); $aco->create(array('parent_id' => $pluginNode['0']['Aco']['id'], 'model' => null, 'alias' => $this->_getPluginControllerName($ctrlName))); $controllerNode = $aco->save(); $controllerNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $this->_getPluginControllerName($ctrlName) . ' ' . $this->_getPluginName($ctrlName) . ' Plugin Controller'; } else { $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $ctrlName)); $controllerNode = $aco->save(); $controllerNode['Aco']['id'] = $aco->id; $log[] = 'Created Aco node for ' . $ctrlName; } } else { $controllerNode = $controllerNode[0]; } //clean the methods. to remove those in Controller and private actions. foreach ($methods as $k => $method) { if (strpos($method, '_', 0) === 0) { unset($methods[$k]); continue; } if (in_array($method, $baseMethods)) { unset($methods[$k]); continue; } $methodNode = $aco->node('controllers/'.$ctrlName.'/'.$method); if (!$methodNode) { $aco->create(array('parent_id' => $controllerNode['Aco']['id'], 'model' => null, 'alias' => $method)); $methodNode = $aco->save(); $log[] = 'Created Aco node for '. $method; } } } if(count($log)>0) { debug($log); } } function _getClassMethods($ctrlName = null) { App::import('Controller', $ctrlName); if (strlen(strstr($ctrlName, '.')) > 0) { // plugin's controller $num = strpos($ctrlName, '.'); $ctrlName = substr($ctrlName, $num+1); } $ctrlclass = $ctrlName . 'Controller'; $methods = get_class_methods($ctrlclass); // Add scaffold defaults if scaffolds are being used $properties = get_class_vars($ctrlclass); if (array_key_exists('scaffold',$properties)) { if($properties['scaffold'] == 'admin') { $methods = array_merge($methods, array('admin_add', 'admin_edit', 'admin_index', 'admin_view', 'admin_delete')); } else { $methods = array_merge($methods, array('add', 'edit', 'index', 'view', 'delete')); } } return $methods; } function _isPlugin($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) > 1) { return true; } else { return false; } } function _getPluginControllerPath($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[0] . '.' . $arr[1]; } else { return $arr[0]; } } function _getPluginName($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[0]; } else { return false; } } function _getPluginControllerName($ctrlName = null) { $arr = String::tokenize($ctrlName, '/'); if (count($arr) == 2) { return $arr[1]; } else { return false; } } /** * Get the names of the plugin controllers ... * * This function will get an array of the plugin controller names, and * also makes sure the controllers are available for us to get the * method names by doing an App::import for each plugin controller. * * @return array of plugin names. * */ function _getPluginControllerNames() { App::import('Core', 'File', 'Folder'); $paths = Configure::getInstance(); $folder =& new Folder(); $folder->cd(APP . 'plugins'); // Get the list of plugins $Plugins = $folder->read(); $Plugins = $Plugins[0]; $arr = array(); // Loop through the plugins foreach($Plugins as $pluginName) { // Change directory to the plugin $didCD = $folder->cd(APP . 'plugins'. DS . $pluginName . DS . 'controllers'); // Get a list of the files that have a file name that ends // with controller.php $files = $folder->findRecursive('.*_controller\.php'); // Loop through the controllers we found in the plugins directory foreach($files as $fileName) { // Get the base file name $file = basename($fileName); // Get the controller name $file = Inflector::camelize(substr($file, 0, strlen($file)-strlen('_controller.php'))); if (!preg_match('/^'. Inflector::humanize($pluginName). 'App/', $file)) { if (!App::import('Controller', $pluginName.'.'.$file)) { debug('Error importing '.$file.' for plugin '.$pluginName); } else { /// Now prepend the Plugin name ... // This is required to allow us to fetch the method names. $arr[] = Inflector::humanize($pluginName) . "/" . $file; } } } } return $arr; } }
valaravena/Glo
694b0fb18510947761cc31742428d0f7e7bae92d
Adding SqliteDb
diff --git a/.gitignore b/.gitignore index 9d2f7bc..1de3861 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,12 @@ /cakephp /app/config/*.yml /app/tmp/cache/*.* /app/tmp/cache/persistent/cake_* /app/tmp/cache/models/cake_* /app/tmp/cache/views/cake_* /app/tmp/logs/*.log /app/webroot/files/**/*.* /app/config/config.php -/app/config/schema/*.sqlite diff --git a/app/config/schema/glow.sqlite b/app/config/schema/glow.sqlite new file mode 100644 index 0000000..6e7f2fe Binary files /dev/null and b/app/config/schema/glow.sqlite differ
valaravena/Glo
3b93b0accac71546bf3163bfcded933f4ac7fd8a
Ading Update to Glow Project
diff --git a/.gitignore b/.gitignore index 199ce3a..9d2f7bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,13 @@ /cakephp /app/config/*.yml +/app/tmp/cache/*.* /app/tmp/cache/persistent/cake_* /app/tmp/cache/models/cake_* /app/tmp/cache/views/cake_* /app/tmp/logs/*.log /app/webroot/files/**/*.* /app/config/config.php /app/config/schema/*.sqlite diff --git a/app/config/core.php b/app/config/core.php index 4e6ebbe..ad8877d 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -1,302 +1,302 @@ <?php /** * This is core configuration file. * * Use it to configure core behavior of Cake. * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package cake * @subpackage cake.app.config * @since CakePHP(tm) v 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ /** * CakePHP Debug Level: * * Production Mode: * 0: No error messages, errors, or warnings shown. Flash messages redirect. * * Development Mode: * 1: Errors and warnings shown, model caches refreshed, flash messages halted. * 2: As in 1, but also with full debug messages and SQL output.ad * * In production mode, flash messages redirect after a time interval. * In development mode, you need to click the flash message to continue. */ - Configure::write('debug', 2); + Configure::write('debug', 0); /** * CakePHP Log Level: * * In case of Production Mode CakePHP gives you the possibility to continue logging errors. * * The following parameters can be used: * Boolean: Set true/false to activate/deactivate logging * Configure::write('log', true); * * Integer: Use built-in PHP constants to set the error level (see error_reporting) * Configure::write('log', E_ERROR | E_WARNING); * Configure::write('log', E_ALL ^ E_NOTICE); */ Configure::write('log', true); /** * Application wide charset encoding */ Configure::write('App.encoding', 'UTF-8'); /** * To configure CakePHP *not* to use mod_rewrite and to * use CakePHP pretty URLs, remove these .htaccess * files: * * /.htaccess * /app/.htaccess * /app/webroot/.htaccess * * And uncomment the App.baseUrl below: */ //Configure::write('App.baseUrl', env('SCRIPT_NAME')); /** * Uncomment the define below to use CakePHP prefix routes. * * The value of the define determines the names of the routes * and their associated controller actions: * * Set to an array of prefixes you want to use in your application. Use for * admin or other prefixed routes. * * Routing.prefixes = array('admin'); * * Enables: * `admin_index()` and `/admin/controller/index` * `manager_index()` and `/manager/controller/index` * * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] */ Configure::write('Routing.prefixes', array('admin')); /** * Turn off all caching application-wide. * */ //Configure::write('Cache.disable', true); /** * Enable cache checking. * * If set to true, for view caching you must still use the controller * var $cacheAction inside your controllers to define caching settings. * You can either set it controller-wide by setting var $cacheAction = true, * or in each action using $this->cacheAction = true. * */ //Configure::write('Cache.check', true); /** * Defines the default error type when using the log() function. Used for * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. */ define('LOG_ERROR', 2); /** * The preferred session handling method. Valid values: * * 'php' Uses settings defined in your php.ini. * 'cake' Saves session files in CakePHP's /tmp directory. * 'database' Uses CakePHP's database sessions. * * To define a custom session handler, save it at /app/config/<name>.php. * Set the value of 'Session.save' to <name> to utilize it in CakePHP. * * To use database sessions, run the app/config/schema/sessions.php schema using * the cake shell command: cake schema run create Sessions * */ Configure::write('Session.save', 'php'); /** * The model name to be used for the session model. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The model name set here should *not* be used elsewhere in your application. */ //Configure::write('Session.model', 'Session'); /** * The name of the table used to store CakePHP database sessions. * * 'Session.save' must be set to 'database' in order to utilize this constant. * * The table name set here should *not* include any table prefix defined elsewhere. * * Please note that if you set a value for Session.model (above), any value set for * Session.table will be ignored. * * [Note: Session.table is deprecated as of CakePHP 1.3] */ //Configure::write('Session.table', 'cake_sessions'); /** * The DATABASE_CONFIG::$var to use for database session handling. * * 'Session.save' must be set to 'database' in order to utilize this constant. */ //Configure::write('Session.database', 'default'); /** * The name of CakePHP's session cookie. * * Note the guidelines for Session names states: "The session name references * the session id in cookies and URLs. It should contain only alphanumeric * characters." * @link http://php.net/session_name */ Configure::write('Session.cookie', 'CAKEPHP'); /** * Session time out time (in seconds). * Actual value depends on 'Security.level' setting. */ Configure::write('Session.timeout', '120'); /** * If set to false, sessions are not automatically started. */ Configure::write('Session.start', true); /** * When set to false, HTTP_USER_AGENT will not be checked * in the session */ Configure::write('Session.checkAgent', true); /** * The level of CakePHP security. The session timeout time defined * in 'Session.timeout' is multiplied according to the settings here. * Valid values: * * 'high' Session timeout in 'Session.timeout' x 10 * 'medium' Session timeout in 'Session.timeout' x 5040 * 'low' Session timeout in 'Session.timeout' x 2628000 * * CakePHP session IDs are also regenerated between requests if * 'Security.level' is set to 'high'. */ Configure::write('Security.level', 'medium'); /** * A random string used in security hashing methods. */ Configure::write('Security.salt', '087333c18fff60a7d94188f724d362191ee4b429'); /** * A random numeric string (digits only) used to encrypt/decrypt strings. */ Configure::write('Security.cipherSeed', '67004110033610364'); /** * Apply timestamps with the last modified time to static assets (js, css, images). * Will append a querystring parameter containing the time the file was modified. This is * useful for invalidating browser caches. * * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable * timestamping. */ //Configure::write('Asset.timestamp', true); /** * Compress CSS output by removing comments, whitespace, repeating tags, etc. * This requires a/var/cache directory to be writable by the web server for caching. * and /vendors/csspp/csspp.php * * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). */ //Configure::write('Asset.filter.css', 'css.php'); /** * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the * output, and setting the config below to the name of the script. * * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). */ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** * The classname and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); /** * If you are on PHP 5.3 uncomment this line and correct your server timezone * to fix the date & time related errors. */ //date_default_timezone_set('UTC'); /** * * Cache Engine Configuration * Default settings provided below * * File storage engine. * * Cache::config('default', array( * 'engine' => 'File', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path * 'prefix' => 'cake_', //[optional] prefix every cache file with this string * 'lock' => false, //[optional] use file locking * 'serialize' => true, [optional] * )); * * * APC (http://pecl.php.net/package/APC) * * Cache::config('default', array( * 'engine' => 'Apc', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * )); * * Xcache (http://xcache.lighttpd.net/) * * Cache::config('default', array( * 'engine' => 'Xcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'user' => 'user', //user from xcache.admin.user settings * 'password' => 'password', //plaintext password (xcache.admin.pass) * )); * * * Memcache (http://www.danga.com/memcached/) * * Cache::config('default', array( * 'engine' => 'Memcache', //[required] * 'duration'=> 3600, //[optional] * 'probability'=> 100, //[optional] * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string * 'servers' => array( * '127.0.0.1:11211' // localhost, default port 11211 * ), //[optional] * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) * )); * */ Cache::config('default', array('engine' => 'File')); diff --git a/app/config/routes.php b/app/config/routes.php index a003833..796442f 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -1,50 +1,50 @@ <?php class SuperRouter extends Router { function connect($route , $default = array(), $params = array()) { parent::connect($route, $default, $params); if ($route == '/') { $route = ''; } parent::connect('/:locale', $default, array_merge(array('locale' => '[a-z]{3}'), $params)); } function plugins() { $pluginRoutes = Configure::read("Hook.routes"); if (!$pluginRoutes) { return; } $plugins = explode(',', $pluginRoutes); foreach ($plugins as $plugin) { if (file_exists(APP.'plugins'.DS.$plugin.DS.'config'.DS.'routes.php')) { require_once(APP.'plugins'.DS.$plugin.DS.'config'.DS.'routes.php'); } } } } SuperRouter::plugins(); if (!isInstalled()) { SuperRouter::connect('/', array('plugin' => 'install', 'controller' => 'wizard')); } // Basic SuperRouter::connect('/admin', array('admin' => true, 'controller' => 'dashboard')); // Pages SuperRouter::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - SuperRouter::connect('/pages/:slug', array('controller' => 'pages', 'action' => 'display')); + SuperRouter::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); // Users SuperRouter::connect('/register', array('controller' => 'users', 'action' => 'register')); SuperRouter::connect('/login', array('controller' => 'users', 'action' => 'login')); SuperRouter::connect('/recover', array('controller' => 'users', 'action' => 'recover')); Router::parseExtensions('xml','json', 'csv'); diff --git a/app/controllers/accounts_controller.php b/app/controllers/accounts_controller.php index 257230e..a6f6cd4 100644 --- a/app/controllers/accounts_controller.php +++ b/app/controllers/accounts_controller.php @@ -1,150 +1,161 @@ <?php class AccountsController extends AppController { var $name = 'Accounts'; + + function beforeFilter() { + parent::beforeFilter(); + + $this->Security->requireLogin('authenticate'); + } function index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function admin_index() { $this->Account->recursive = 0; $this->set('accounts', $this->paginate()); } function admin_view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } $this->set('account', $this->Account->read(null, $id)); } function admin_add() { if (!empty($this->data)) { $this->Account->create(); if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid account', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Account->save($this->data)) { $this->Session->setFlash(__('The account has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Account->read(null, $id); } $accountTypes = $this->Account->AccountType->find('list'); $users = $this->Account->User->find('list'); $genders = $this->Account->Gender->find('list'); $sources = $this->Account->Source->find('list'); $this->set(compact('accountTypes', 'users', 'genders', 'sources')); } function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for account', true)); $this->redirect(array('action'=>'index')); } if ($this->Account->delete($id)) { $this->Session->setFlash(__('Account deleted', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Account was not deleted', true)); $this->redirect(array('action' => 'index')); } function authenticate() { $account = array(); if ($this->Auth->user('id')) { + $this->Account->recursive = 0; $account = $this->Account->getAccountByIdOrUsername($this->Auth->user('id')); if (!empty($account)) { - $account = am($account['User'], $account['Account']); + # $account['User'] = + # $return['User'] = + # $account['Account'] = array($account['Account'][]) + + #$account = am($account['User'], $account['Account']); } } $this->set(compact('account')); } } ?> \ No newline at end of file diff --git a/app/models/account.php b/app/models/account.php index 81e5082..c3546b7 100644 --- a/app/models/account.php +++ b/app/models/account.php @@ -1,66 +1,58 @@ <?php class Account extends AppModel { var $name = 'Account'; var $displayField = 'first_name'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'AccountType' => array( 'className' => 'AccountType', 'foreignKey' => 'account_type_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Gender' => array( 'className' => 'Gender', 'foreignKey' => 'gender_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Source' => array( 'className' => 'Source', 'foreignKey' => 'source_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); function getAccountByIdOrUsername($id = null) { if (!empty($id)) { $account = $this->find('first', array( 'conditions' => array( 'OR' => array( array('User.id' => $id), array('User.username' => $id) ), ), - 'fields' => array( - 'User.id', - 'User.username', - 'Account.first_name', - 'Account.last_name', - 'Account.email', - 'Account.image' - ) ) ); - + if (!empty($account)) { return $account; } } return false; } } ?> \ No newline at end of file diff --git a/app/views/elements/footer_menu.ctp b/app/views/elements/footer_menu.ctp index 08d76df..47bf266 100644 --- a/app/views/elements/footer_menu.ctp +++ b/app/views/elements/footer_menu.ctp @@ -1,10 +1,10 @@ <ul class="menu"> <li><?php echo $html->link(__('Home', true), array('/'))?></li> <li><?php echo $html->link(__('Site Map', true), array('/'));?></li> <li><?php echo $html->link(__('Privacy Policy', true), array('/'));?></li> - <li><?php echo $html->link(__('Contact Us', true), array('/'));?></li> + <li class="last"><?php echo $html->link(__('Contact Us', true), array('/'));?></li> </ul> <div class="logo"> <?php echo $html->link($html->image('logo-sm.gif', array('alt' => '')), array('/'), array('escape' => false))?> </div> <div style="clear:both"></div> \ No newline at end of file diff --git a/app/views/elements/home_demo.ctp b/app/views/elements/home_demo.ctp new file mode 100644 index 0000000..834f795 --- /dev/null +++ b/app/views/elements/home_demo.ctp @@ -0,0 +1,3 @@ +<div class="home_demo"> + <?php echo $html->image('demo.png', array('alt' => __('Demo', true))); ?> +</div> \ No newline at end of file diff --git a/app/views/elements/home_flash.ctp b/app/views/elements/home_flash.ctp new file mode 100644 index 0000000..1ddf4e5 --- /dev/null +++ b/app/views/elements/home_flash.ctp @@ -0,0 +1,14 @@ +<div id="content-top" class="clearfix"> + <div id="content-top-left"> + <object width="681" height="223"> + <param name="movie" value="/img/flash/gg_anim.swf"> + <embed src="/img/flash/gg_anim.swf" width="681" height="223"> + </embed> + </object> + </div> + <div id="content-top-right" class="clearfix"> + <?php echo $this->element('home_news')?> + </div> + <span class="clearFix"></span> +</div> + diff --git a/app/views/elements/home_login.ctp b/app/views/elements/home_login.ctp new file mode 100644 index 0000000..7959df2 --- /dev/null +++ b/app/views/elements/home_login.ctp @@ -0,0 +1,31 @@ +<?php echo $javascript->codeBlock(); ?> + $(document).ready(function() { + $('#loginSubmit').click(function() { + $('#UserDisplayForm').submit(); + return false; + }) + }) +<?php echo $javascript->blockEnd(); ?> +<div class="box" style="width: 275px"> + <div class="topleft"> + <div class="topright"> + <div> + <h2 class="login"><?php echo sprintf(__('Sign in to %s', true), $html->tag('span', $appConfigurations['name']))?></h2> + <?php echo $form->create('User', array('class' => 'middle-forms')); ?> + <?php echo $form->input('User.username', array('label' => __('User ID', true)))?> + <?php echo $form->input('User.password', array('label' => __('Password', true)))?> + <?php echo $form->end(); ?> + <?php echo $html->div('input', $html->link($html->tag('span', __('Sign in', true)), array('/'), array('class'=>'button', 'escape' => false, 'id' =>'loginSubmit', 'style' => 'float:right;margin-right:10px;')))?> + <span class="clearFix"></span> + <ul class="login_sub"> + <li><?php echo $html->link(__('Forgot Password', true), array(), array('class' => 'blue'))?></li> + <li class="last"><?php echo $html->link(__('New user register', true), array(), array('class' => 'blue')); ?></li> + </ul> + <span class="clearFix"></span> + </div> + </div> + </div> + <div class="bottomleft"> + <div class="bottomright"> </div> + </div> +</div> \ No newline at end of file diff --git a/app/views/elements/home_news.ctp b/app/views/elements/home_news.ctp new file mode 100644 index 0000000..99cc8eb --- /dev/null +++ b/app/views/elements/home_news.ctp @@ -0,0 +1,7 @@ +<div id="home_news"> + <?php echo $html->image('why-gridglo.png', array('alt' => __('Why Gridglow', true))); ?> + <div class="sbox"> + <p>As volcanoes go, the eruption of Iceland's Eyjafjallajokull on Tuesday, April 13, won't make the science books. Though scientists haven't yet been able to gather enough information on the eruption to give it a score on the Volcanic Explosivity Index — which ranks volcanic events on a 1-to-8 scale — it's unlikely to score very high.</p> + <?php echo $html->link($html->tag('span', $html->tag('span', __('More', true), array('class' => 'arrow')), array('class' => 'icon')), array('/'), array('class'=>'button', 'escape' => false))?> + </div> +</div> \ No newline at end of file diff --git a/app/views/elements/home_platform.ctp b/app/views/elements/home_platform.ctp new file mode 100644 index 0000000..8dc1f86 --- /dev/null +++ b/app/views/elements/home_platform.ctp @@ -0,0 +1,15 @@ +<div class="box" style="width: 345px"> + <div class="topleft"> + <div class="topright"> + <div> + <h2 class="platform blue"><?php echo __('Platform', true)?></h2> + <p> + <?php echo $html->image('gears.png', array('style' => 'float:right', 'alt' => __('Platform', true))); ?> Currently there is little evidence to support the use of Shiatsu in the treatment of any diseases or disorders. Cancer Research UK makes it clear that they don't believe Shiatsu is beneficial for the treatment of cancer, however they do state that "some studies using massage therapy in general (including shiatsu massage) suggest it might be helpful as a complementary therapy for people with cancer and other illnesses + </p> + </div> + </div> + </div> + <div class="bottomleft"> + <div class="bottomright"> </div> + </div> +</div> \ No newline at end of file diff --git a/app/views/elements/menu_top.ctp b/app/views/elements/menu_top.ctp index a8496e2..9d00baa 100644 --- a/app/views/elements/menu_top.ctp +++ b/app/views/elements/menu_top.ctp @@ -1,9 +1,9 @@ <ul class="menu"> <li><?php echo $html->link(__('Home', true), array('/'));?></li> - <li><?php echo $html->link(__('About Us', true), array('/'));?></li> - <li><?php echo $html->link(__('Platform', true), array('/'));?></li> - <li><?php echo $html->link(__('Developers', true), array('/'));?></li> - <li><?php echo $html->link(__('Utility', true), array('/'));?></li> - <li><?php echo $html->link(__('Services', true), array('/'));?></li> + <li><?php echo $html->link(__('About Us', true), array('/about_us'));?></li> + <li><?php echo $html->link(__('Platform', true), array('/pages/platform'));?></li> + <li><?php echo $html->link(__('Developers', true), array('/pages/developers'));?></li> + <li><?php echo $html->link(__('Utility', true), array('/pages/utility'));?></li> + <li class="last"><?php echo $html->link(__('Services', true), array('/pages/services'));?></li> </ul> -<span class="clearFix"></span> \ No newline at end of file +<span class="clearFix"></span> diff --git a/app/views/layouts/default.ctp b/app/views/layouts/default.ctp index 87421be..c74fc61 100644 --- a/app/views/layouts/default.ctp +++ b/app/views/layouts/default.ctp @@ -1,60 +1,59 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php echo $html->charset(); ?> <title> <?php echo $title_for_layout; ?> :: <?php echo $appConfigurations['name']; ?> </title> - <!-- <link rel="alternate" type="application/rss+xml" href="/auctions/index.rss" title="<?php __('Live Auctions');?>"> --> <?php if(!empty($meta_description)) : echo $html->meta('description', $meta_description); endif; if(!empty($meta_keywords)) : echo $html->meta('keywords', $meta_keywords); endif; echo $html->css('style'); - - echo $javascript->link('jquery/jquery'); - echo $javascript->link('jquery/ui'); - echo $javascript->link('default'); - + echo $javascript->link('http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'); echo $scripts_for_layout; ?> - <!--[if lt IE 7]> - <?php echo $javascript->link('dropdown'); ?> - <![endif]--> </head> <body> - -<div id="container"> - <div id="header"> - <div id="logo"> - <?php echo $html->link($html->image('logo.gif', array('alt' => $appConfigurations['name'], 'title' => $appConfigurations['name'])), '/', array('escape' => false)); ?> - </div> - <div id="top-menu"> - <?php echo $this->element('menu_top');?> + <div id="container"> + <div id="header"> + <div id="logo"> + <?php echo $html->link($html->image('logo.gif', array('alt' => $appConfigurations['name'], 'title' => $appConfigurations['name'])), '/', array('escape' => false)); ?> + </div> + <div id="top-menu"> + <?php echo $this->element('menu_top');?> + </div> </div> - - </div> - - <div id="content" class="clearfix"> - <?php - if($session->check('Message.flash')){ - $session->flash(); - } - if($session->check('Message.auth')){ - $session->flash('auth'); - } - ?> - <?php echo $content_for_layout; ?> + <div id="content" class="clearfix"> + <?php echo $this->element('home_flash')?> + <div id="left-col"> + <?php echo $this->element('home_login')?> + <?php echo $this->element('home_platform'); ?> + <?php + if($session->check('Message.flash')){ + $session->flash(); + } + if($session->check('Message.auth')){ + $session->flash('auth'); + } + ?> + <?php echo $content_for_layout; ?> + </div> + <div id="right-col"> + <?php echo $this->element('home_demo');?> + </div> + <span class="clearFix"></span> + + + </div> + <?php echo $this->element('footer');?> </div> - - <?php echo $this->element('footer');?> -</div> -<?php echo $this->element('sql_dump'); ?> + <?php echo $this->element('sql_dump'); ?> </body> </html> diff --git a/app/webroot/css/style.css b/app/webroot/css/style.css index 43f3662..c207f52 100644 --- a/app/webroot/css/style.css +++ b/app/webroot/css/style.css @@ -1,168 +1,165 @@ /** document general options **/ body{font:9pt Tahoma,Helvetica,Arial,Tahoma,sans-serif;background:#d3ebfd;} body,html{height:100%} span.clearFix{width:100%;height:0px;visibility:hidden;clear:both;display:block;margin:0;padding:0;font-size:0px;} .hidden{display:none;} /** button stylings **/ div.inner-nav{clear:both;margin:10px 0;} div.inner-nav a,a.button{display:inline-block;background:url(../../img/admin/bg-buttons-left.gif) no-repeat;text-decoration:none;height:21px;padding:0 0 0 15px;color:#fff;font-weight:bold;font-size:9pt;} div.inner-nav a:hover,a.button:hover{color:#333;} div.inner-nav a span,a.button span{display:block;background:url(../../img/admin/bg-buttons-right.gif) no-repeat right;padding:0 15px 0 0;line-height:21px;} -a.button{margin:0 10px;} .align-left{float:left;} .align-right{float:right;} /** text colors assigned to elements in various areas **/ .yellow{color:#e8e4a2;} .light-blue{color:#a6b7c0;} .blue{color:#508db8 !important;} .light-grey{color:#d7d7d7} .white{color:#fff;} img{border:0;} +p { font-size: 11px; } +h2 { margin: 0 5px 5px 0; padding: 0;} +h2 span { color: #ff931f; text-transform: uppercase; font-weight: bold;} +h2.login { padding: 5px; color: #ffad1f;padding-left: 35px; background: #fff4ca url(../img/h1-pencil.png) no-repeat 10px 50%; } +h2.platform { padding: 5px; padding-left: 35px; color:#5da2d7; background: #e6f2fb url(../img/h1-swoop.png) no-repeat 10px 50%;} +div.home_demo { padding: 10px; } +ul.login_sub { display: block; list-style: none;} +ul.login_sub li { float: left; height: 15px; position:relative; border-right: 1px solid #508db8; } +ul.login_sub li a {text-decoration: none;padding: 0 10px;display:inline-block;position:relative;} +ul.login_sub li.last { border: 0; } -div#container{width:960px;position:relative;margin:0 auto;padding:0 5px;background:#fff;} - - - -.push{height:133px;} +div#container{width:960px;position:relative;margin:0 auto;padding:0px 5px 25px;background:#fff;} /** HEADER AND NAVIGATION **/ -div#header{background: #fff url(../img/bg.png) repeat-x;height:116px;} +div#header{background:#fff url(../img/bg.png) repeat-x;height:149px;} /** logo,which is a typographical h1 element (you can edit this part if you want to replace with your logo graphic) **/ -div#logo { border: 1px solid $#666; padding:20px;} +div#logo{border:1px solid $#666;padding:20px;} div#logo h1{font-size:250%;text-transform:uppercase;letter-spacing:-1px;font-weight:bold;float:left;width:450px;/** mac safari & firefox hack */height:39px;/**/} div#logo h1 a{color:#fff;text-decoration:none;} div#logo h1 a:hover{color:#ccc;} /** header userbox **/ -p#userbox{float:right;color:#c1cad0;background:url(../../img/admin/icon-greet-user.gif) no-repeat 0px 5px;padding:5px 0px 0px 18px;margin:0;} +p#userbox{float:right;color:#c1cad0;background:url(../img/icon-greet-user.gif) no-repeat 0px 5px;padding:5px 0px 0px 18px;margin:0;} p#userbox a{color:#ceac0f;text-decoration:none;font-weight:bold;} p#userbox a:hover{color:#fff;} p#userbox small{display:block;margin-top:5px;color:#8d9599;font-size:0.9em;} -div#top{margin-bottom:18px;} /** menu **/ -div#header ul.menu{display:block;list-style:none;} -div#header ul.menu li{float:left;height:40px;position:relative} -div#header ul.menu li a{color:#717171;text-decoration:none;padding:13px 15px 7px 15px;height:20px;display:inline-block;text-align:center;text-transform:uppercase;font-weight:bold;background:url(../../img/admin/bg-topnav-mask.gif) no-repeat 0 0;position:relative;} -div#header ul.menu li a:hover{color:#508db8;background: #fff url(../../img/admin/bg-topnav-mask.gif) no-repeat top right;} -div#header ul.menu li a.top-level{position:relative;padding-right:25px;} -div#header ul.menu li a.top-level span{background:url(../../img/admin/bg-toplevel.gif) no-repeat 0px 2px;width:11px;height:8px;display:block;position:absolute;right:10px;top:13px;} -div#header ul.menu li a.top-level:hover span,.blue span{background-image:url(../../img/admin/bg-toplevel-hover.png) !important;} -div#header ul.menu li ul{position:absolute;top:40px;min-width:200px !important;left:0px;z-index:999;background:#fff;visibility:hidden;display:none;padding-bottom:10px;border:2px solid #ccc;border-left:none;border-top:none;border-right-width:1px;padding-top:5px;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;-webkit-border-bottom-left-radius:5px;} -div#header ul.menu li ul li{float:none;height:auto;border-bottom:1px dotted #d6d8d9;} -div#header ul.menu li ul li:hover{background:url(../../img/admin/bg-submenu-hover.gif) no-repeat;} -div#header ul.menu li ul li a{padding:6px 3px 6px 20px;display:block !important;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px !important;color:#5c6467;text-decoration:none;text-align:left;text-transform:capitalize;height:auto;background-color:none !important;font-weight:normal;} -div#header ul.menu li ul li a:hover{color:#fff;background-image:url(../../img/admin/submenuhover.gif) !important;} -div#header ul.menu li.selected a{background:#6c7275;color:#fff;} -div#header ul.menu li ul ul{-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;-webkit-border-top-left-radius:5px;margin:-1.5em 0 0 10em;} -/** search form **/ -div#header form{float:right;width:246px;margin-top:9px;} -div#header form fieldset legend{display:none;} -div#header form fieldset label#searchbox{display:block;background:url(../../img/admin/bg-search.gif) no-repeat;height:21px;width:246px;} -div#header form fieldset label#searchbox input{background:none;border:none;outline:none;padding:4px 0 0 23px;color:#666;font-size:0.9em;} +div#header ul.menu{display:block;list-style:none;background:url(../img/menu-btn.gif) repeat-x;height:32px;} +div#header ul.menu li{float:left;height:32px;position:relative;border-right:1px solid #fff;} +div#header ul.menu li.last{border:0;} +div#header ul.menu li a{color:#717171;text-decoration:none;padding:9px 20px 7px 20px;display:inline-block;text-align:center;text-transform:uppercase;position:relative;} +div#header ul.menu li a:hover{background:url(../img/menu-btn-on.gif) repeat-x top left;color:#fff;} /** END OF HEADER **/ /** CONTENT **/ -div#content{padding-top:25px;} +div#content{background:url(../img/content-bg.gif) repeat-y;padding:0;} /** main heading of the page **/ -div#content-top{border-bottom:1px solid #bcbcb7;padding-bottom:8px;margin-bottom:15px;} +div#content-top{padding:20px 0 0 0;background-color:#599fd4;} div#content-top h2{font-size:200%;font-weight:bold;color:#373d40;margin-left:12px;float:left;} div#content-top p{margin-left:12px;margin-top:5px;} div#content-top p a{color:#508db8;text-decoration:none;} div#content-top p a:hover{color:#333;} div#content-top a#topLink{float:right;background:url(../../img/admin/icon-blue-arrow.gif) no-repeat;display:inline-block;padding-left:23px;text-decoration:none;font-weight:bold;color:#508db8;height:16px;margin-top:10px;margin-right:12px;} div#content-top a#topLink:hover{color:#333;} +div#content-top-left{width:681px;height:223px;float:left;} +div#content-top-right{padding:0 20px;width:239px;height:223px;float:left;background-color:#599fd4;} /** box general settings **/ -div.box{margin-bottom:15px;width:100%;} -div.box-container{background-color:#fff;padding:10px;} -div.box-container h5{color:#333;padding-left:20px;border-bottom:1px solid #d7d9d9;font-weight:bold;padding-bottom:7px;margin-bottom:1px;padding-top:1px;} -div.box-container h5 span{font-weight:normal;font-size:0.9em;} -div.box-top { background:#3a4043;padding:10px;} -div.box-top h4{text-transform:uppercase;font-weight:bold;} -/* ul.box-top-buttons { float:right; width:270px; padding-right:15px;} -ul.box-top-buttons li {float:right; padding-left:15px; height:18px} -ul.box-top-buttons li a {outline:none; padding:6px 15px 6px 0; display:block; font-size:0.9em; text-decoration:none; color:#ddd;} -ul.box-top-buttons li a:hover {color:#fff;} -ul.box-top-buttons li.selected {} -ul.box-top-buttons li.selected a {color:#867946; } +div.sbox{background:url(../img/sbox-bg.png)repeat-x;height:172px;width:225px;padding:0 10px;} +div.sbox p{padding:10px 0;margin:0;color:#fff;font-size:11px;} +div.sbox .button{float:right;} +.box{margin: 10px; float: left;} +.box div{margin:0.1em 0 0 0.1em;} +.box div.topleft{display:block;background:url("../img/box-bg.png") top left no-repeat;padding:5px 0em 0em -5px;} +.box div.topright{display:block;background:url("../img/box-bg.png") top right no-repeat;padding:5px 5px 0 0;margin:-5px 0 0 5px;} +.box div.bottomleft{display:block;height:45px;margin-top:-5px;background:url("../img/box-bg.png") bottom left no-repeat;} +.box div.bottomright{display:block;background:url("../img/box-bg.png") bottom right no-repeat;height:45px;margin-left:5px;} +/* ul.box-top-buttons{float:right;width:270px;padding-right:15px;} +ul.box-top-buttons li{float:right;padding-left:15px;height:18px} +ul.box-top-buttons li a{outline:none;padding:6px 15px 6px 0;display:block;font-size:0.9em;text-decoration:none;color:#ddd;} +ul.box-top-buttons li a:hover{color:#fff;} +ul.box-top-buttons li.selected{} +ul.box-top-buttons li.selected a{color:#867946;} */ +/** Button **/ +a.button{background:transparent url(../img/btn-rht.png) no-repeat scroll top right;display:block;float:left;height:20px;margin-right:1px;padding-right:7px;text-decoration:none;color:#fff;font-size:11px;text-transform:lowercase;} +a.button span{background:transparent url(../img/btn-lft.png) no-repeat;display:block;padding:0 5px 0 7px;line-height:20px;} +a.button:hover{background-position:right -20px;} +a.button:hover span{color:#fff;background-position:left -20px;} +a.button span.arrow{background:url(../img/sml-arrow.png) no-repeat 0 50%;display:block;padding-left:20px;} /** columns **/ -div#left-col,div#mid-col{float:left;margin-right:12px;} -div#mid-col{width:510px;} -div#right-col{margin-right:0px;float:right;} -div#left-col,div#right-col{width:223px;} +div#left-col{ float: left;width:661px; padding: 10px 10px;} +div#right-col { width:229px; float: left; padding:10px 10px ; } div.full-col{width:980px !important;margin-right:0px !important;} div.half-col{width:740px !important;margin-right:0px !important;} /** list links **/ ul.list-links,div#to-do-list ul{width:223px;margin-left:-10px;margin-top:-5px;} ul.list-links li{border-bottom:1px dotted #d6d8d9;} ul.list-links li a{padding:8px 3px 6px 20px;display:block;background:url(../../img/admin/link-arrow-regular.gif) no-repeat 10px 10px #fff;color:#5c6467;text-decoration:none;} ul.list-links li a:hover,ul.list-links li.selected a:hover{background:url(../../img/admin/link-arrow-hover.gif) no-repeat 10px 10px #fafae9;color:#000;} ul.list-links li ul{background:#fcfbf2 !important;padding-left:10px;padding-top:10px;width:213px;font-size:0.9em;} ul.list-links li ul li{border-bottom:none;} ul.list-links li ul li a{background:none;padding:5px 3px 5px 20px !important;} ul.list-links li ul li a:hover{background-color:#fcfbf2;background-position:8px 10px} ul.list-links li a.ui-state-active{font-weight:bold;} - - /** forms **/ +div.input { padding:2px;} +label { display: block; } +input { border: 1px solid #5da2d7; line-height: 35px; padding: 2px;} form.middle-forms{padding:5px;color:#3a4043} form.middle-forms p{margin:10px 0;} form.middle-forms h3{color:#1d8895;font-weight:bold;font-size:150%;margin-bottom:10px;} form.middle-forms fieldset{padding-top:10px;} form.middle-forms fieldset ol li{padding:15px;} form.middle-forms fieldset ol li.even{background:#f3f3f3;} form.middle-forms fieldset ol li input/*,form.middle-forms fieldset ol li textarea*/{padding:5px;border:1px solid #dedede;background:url(../../img/admin/bg-textbox.gif) repeat-x #fff;} form.middle-forms fieldset ol li input[type="radio"],form.middle-forms fieldset ol li input[type="checkbox"]{border:none;background:none;} input.txtbox-short{width:122px;} input.txtbox-middle{width:190px;} -input.txtbox-long,form.middle-forms fieldset ol li textarea{width:305px;} -form.middle-forms fieldset ol li label{float:left;margin-right:15px;display:block;} -form.middle-forms fieldset ol li label.field-title{font-weight:bold;width:100px;padding-top:3px;} +input.txtbox-long,form.middle-forms textarea {width:305px;} +form.middle-forms label{float:left;width:50px; padding-right:10px; margin-right:10px;display:block; } +form.middle-forms label.field-title{font-weight:bold;width:100px;padding-top:3px;} span.form-confirm-inline,span.form-error-inline{display:inline-block;padding-left:20px;margin-left:10px;height:16px;} span.form-confirm-inline{color:#72a101;background:url(../../img/admin/icon-confirm.gif) no-repeat;} span.form-error-inline{color:#a10101;background:url(../../img/admin/icon-error.gif) no-repeat;} a.heading-link{color:#cae6ed;text-transform:capitalize;font-size:0.9em;font-weight:normal;display:inline-block;padding-left:15px;text-decoration:none;} a.heading-link:hover{color:#fff;} /* tables */ table.table-short{width:500px;margin:-5px 0 0 -5px;border-collapse:collapse;} table.table-long{width:740px;margin-left:-10px} table.table-full{width:100%;} table.table-short td,table.table-long td{border-top:1px solid #dfdfdf;font-size:0.9em;padding:10px 0;margin:0;color:#666;} table.table-short thead th,table.table-long thead th{font-weight:bold;color:#666;padding:10px 0;} table.table-short thead th a,table.table-long thead th a{color:#666;} table.table-short thead th,table.table-short tfoot td,table.table-long thead th,table.table-long tfoot td{border:none;} table.table-short td:first-child,table.table-long td:first-child{text-align:left;padding:0 0 0 10px;} table.table-short tfoot,table.table-long tfoot{border-top:1px solid #ccc;} table.table-short tr.altRow,table.table-long tr.altRow{background:url(../../img/admin/bg_tableRow.gif) repeat-x 0px 1px;} table.table-short td a,table.table-long td a{color:#508db8;font-weight:bold;} table.table-short td a:hover,table.table-long td a:hover{text-decoration:none;color:#333;} td.col-chk{width:40px;} td.col-first{font-weight:bold;width:200px;} td.col-second a{color:#508db8;font-weight:bold;} td.col-second a:hover{text-decoration:none;color:#333;} td.actions{width:110px;} a.table-edit-link,a.table-delete-link{color:#666;text-decoration:none;display:inline-block;margin-right:10px;padding-left:20px;height:16px;text-align:right;} a.table-edit-link:hover,a.table-delete-link:hover{color:#000;} a.table-delete-link{margin-right:0px !important;background:url(../../img/admin/icon-delete.gif) no-repeat;} a.table-edit-link{background:url(../../img/admin/icon-edit.gif) no-repeat;} - -a { color: #fff;} - - +a{color:#fff;} /** FOOTER **/ -div#footer{margin:0 auto;height:57px;background:url(../img/bg-footer.png) repeat-x;padding:5;} +div#footer{margin:0 auto;height:57px;background:url(../img/bg-footer.png) repeat-x;padding:5;position:relative;} div#footer-top{color:#f2f2f2;} div#footer-top h4{color:#fff;text-transform:uppercase;margin:5px 0;font-size:120%;font-weight:bold;} div#footer-top a{color:#adc3d3;font-weight:bold;font-size:0.9em;text-decoration:none;} div#footer-top a:hover{color:#fff;} div#footer-top h2{font-size:160%;text-transform:uppercase;padding-top:10px;padding-right:10px;font-weight:bold;} div#footer-top h2 a{color:#a1a5a6;} div#footer-top h2 a:hover{color:#c7cdcf;} div#footer-bottom{margin-top:25px;} div#footer-bottom p{color:#717272;font-size:0.9em;} div#footer-bottom p a{color:#ccc;text-decoration:none;} - -div#footer .logo { position: absolute; right:25px; height: 25px; float: right;} -div#footer ul.menu {border: 1px solid #666;list-style:none;} -div#footer ul.menu li{float:left;} -div#footer ul.menu li a{color:#717171;text-decoration:none;padding:13px 15px 7px 0;height:10px;display:inline-block;text-align:center;position:relative;} -div#footer .copyright { font:8pt Tahoma; padding: 10px 0 10px 25px;} +div#footer ul.menu{display:block;list-style:none;padding:10px 0 5px 15px} +div#footer ul.menu li{float:left;position:relative;border-right:1px solid #717171;} +div#footer ul.menu li.last{border:0;} +div#footer ul.menu li a{color:#717171;text-decoration:none;padding:0 10px;display:inline-block;text-align:center;position:relative;} +div#footer .logo{position:absolute;right:15px;height:15px;top:15px;} +div#footer .copyright{font:8pt Tahoma;padding:10px 0 10px 25px;} diff --git a/app/webroot/img/box-bg.png b/app/webroot/img/box-bg.png new file mode 100644 index 0000000..2e70e8d Binary files /dev/null and b/app/webroot/img/box-bg.png differ diff --git a/app/webroot/img/btn-lft.png b/app/webroot/img/btn-lft.png new file mode 100644 index 0000000..ae296e5 Binary files /dev/null and b/app/webroot/img/btn-lft.png differ diff --git a/app/webroot/img/btn-rht.png b/app/webroot/img/btn-rht.png new file mode 100644 index 0000000..737e785 Binary files /dev/null and b/app/webroot/img/btn-rht.png differ diff --git a/app/webroot/img/content-bg.gif b/app/webroot/img/content-bg.gif new file mode 100644 index 0000000..6bf145c Binary files /dev/null and b/app/webroot/img/content-bg.gif differ diff --git a/app/webroot/img/demo.png b/app/webroot/img/demo.png new file mode 100644 index 0000000..ff7712e Binary files /dev/null and b/app/webroot/img/demo.png differ diff --git a/app/webroot/img/flash/gg_anim.swf b/app/webroot/img/flash/gg_anim.swf new file mode 100644 index 0000000..348340e Binary files /dev/null and b/app/webroot/img/flash/gg_anim.swf differ diff --git a/app/webroot/img/gears.png b/app/webroot/img/gears.png new file mode 100644 index 0000000..3c766e8 Binary files /dev/null and b/app/webroot/img/gears.png differ diff --git a/app/webroot/img/h1-pencil.png b/app/webroot/img/h1-pencil.png new file mode 100644 index 0000000..3e55a07 Binary files /dev/null and b/app/webroot/img/h1-pencil.png differ diff --git a/app/webroot/img/h1-swoop.png b/app/webroot/img/h1-swoop.png new file mode 100644 index 0000000..927819c Binary files /dev/null and b/app/webroot/img/h1-swoop.png differ diff --git a/app/webroot/img/icon-greet-user.gif b/app/webroot/img/icon-greet-user.gif new file mode 100644 index 0000000..ab10db2 Binary files /dev/null and b/app/webroot/img/icon-greet-user.gif differ diff --git a/app/webroot/img/menu-btn-on.gif b/app/webroot/img/menu-btn-on.gif new file mode 100644 index 0000000..d0057f3 Binary files /dev/null and b/app/webroot/img/menu-btn-on.gif differ diff --git a/app/webroot/img/menu-btn.gif b/app/webroot/img/menu-btn.gif new file mode 100644 index 0000000..2aba615 Binary files /dev/null and b/app/webroot/img/menu-btn.gif differ diff --git a/app/webroot/img/menu-btn.png b/app/webroot/img/menu-btn.png deleted file mode 100644 index 00e4271..0000000 Binary files a/app/webroot/img/menu-btn.png and /dev/null differ diff --git a/app/webroot/img/sbox-bg.png b/app/webroot/img/sbox-bg.png new file mode 100644 index 0000000..505efc6 Binary files /dev/null and b/app/webroot/img/sbox-bg.png differ diff --git a/app/webroot/img/sml-arrow.png b/app/webroot/img/sml-arrow.png new file mode 100644 index 0000000..4500e0e Binary files /dev/null and b/app/webroot/img/sml-arrow.png differ diff --git a/app/webroot/img/why-gridglo.gif b/app/webroot/img/why-gridglo.gif new file mode 100644 index 0000000..1f7e1de Binary files /dev/null and b/app/webroot/img/why-gridglo.gif differ diff --git a/app/webroot/img/why-gridglo.png b/app/webroot/img/why-gridglo.png new file mode 100644 index 0000000..df298d2 Binary files /dev/null and b/app/webroot/img/why-gridglo.png differ
valaravena/Glo
d29b48b0073f884119c2c0adb17e284e4a13dbd3
Adding Update to Glow
diff --git a/app/controllers/accounts_controller.php b/app/controllers/accounts_controller.php new file mode 100644 index 0000000..257230e --- /dev/null +++ b/app/controllers/accounts_controller.php @@ -0,0 +1,150 @@ +<?php +class AccountsController extends AppController { + + var $name = 'Accounts'; + + function index() { + $this->Account->recursive = 0; + $this->set('accounts', $this->paginate()); + } + + function view($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid account', true)); + $this->redirect(array('action' => 'index')); + } + $this->set('account', $this->Account->read(null, $id)); + } + + function add() { + if (!empty($this->data)) { + $this->Account->create(); + if ($this->Account->save($this->data)) { + $this->Session->setFlash(__('The account has been saved', true)); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); + } + } + $accountTypes = $this->Account->AccountType->find('list'); + $users = $this->Account->User->find('list'); + $genders = $this->Account->Gender->find('list'); + $sources = $this->Account->Source->find('list'); + $this->set(compact('accountTypes', 'users', 'genders', 'sources')); + } + + function edit($id = null) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(__('Invalid account', true)); + $this->redirect(array('action' => 'index')); + } + if (!empty($this->data)) { + if ($this->Account->save($this->data)) { + $this->Session->setFlash(__('The account has been saved', true)); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); + } + } + if (empty($this->data)) { + $this->data = $this->Account->read(null, $id); + } + $accountTypes = $this->Account->AccountType->find('list'); + $users = $this->Account->User->find('list'); + $genders = $this->Account->Gender->find('list'); + $sources = $this->Account->Source->find('list'); + $this->set(compact('accountTypes', 'users', 'genders', 'sources')); + } + + function delete($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid id for account', true)); + $this->redirect(array('action'=>'index')); + } + if ($this->Account->delete($id)) { + $this->Session->setFlash(__('Account deleted', true)); + $this->redirect(array('action'=>'index')); + } + $this->Session->setFlash(__('Account was not deleted', true)); + $this->redirect(array('action' => 'index')); + } + function admin_index() { + $this->Account->recursive = 0; + $this->set('accounts', $this->paginate()); + } + + function admin_view($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid account', true)); + $this->redirect(array('action' => 'index')); + } + $this->set('account', $this->Account->read(null, $id)); + } + + function admin_add() { + if (!empty($this->data)) { + $this->Account->create(); + if ($this->Account->save($this->data)) { + $this->Session->setFlash(__('The account has been saved', true)); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); + } + } + $accountTypes = $this->Account->AccountType->find('list'); + $users = $this->Account->User->find('list'); + $genders = $this->Account->Gender->find('list'); + $sources = $this->Account->Source->find('list'); + $this->set(compact('accountTypes', 'users', 'genders', 'sources')); + } + + function admin_edit($id = null) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(__('Invalid account', true)); + $this->redirect(array('action' => 'index')); + } + if (!empty($this->data)) { + if ($this->Account->save($this->data)) { + $this->Session->setFlash(__('The account has been saved', true)); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The account could not be saved. Please, try again.', true)); + } + } + if (empty($this->data)) { + $this->data = $this->Account->read(null, $id); + } + $accountTypes = $this->Account->AccountType->find('list'); + $users = $this->Account->User->find('list'); + $genders = $this->Account->Gender->find('list'); + $sources = $this->Account->Source->find('list'); + $this->set(compact('accountTypes', 'users', 'genders', 'sources')); + } + + function admin_delete($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid id for account', true)); + $this->redirect(array('action'=>'index')); + } + if ($this->Account->delete($id)) { + $this->Session->setFlash(__('Account deleted', true)); + $this->redirect(array('action'=>'index')); + } + $this->Session->setFlash(__('Account was not deleted', true)); + $this->redirect(array('action' => 'index')); + } + + function authenticate() { + $account = array(); + if ($this->Auth->user('id')) { + $account = $this->Account->getAccountByIdOrUsername($this->Auth->user('id')); + if (!empty($account)) { + $account = am($account['User'], $account['Account']); + } + } + $this->set(compact('account')); + } + + +} +?> \ No newline at end of file diff --git a/app/views/accounts/json/authenticate.ctp b/app/views/accounts/json/authenticate.ctp new file mode 100644 index 0000000..125d219 --- /dev/null +++ b/app/views/accounts/json/authenticate.ctp @@ -0,0 +1,5 @@ +<?php + $rsp = array('rsp' => array('account')); + $rsp['rsp']['account'] = $account; + echo json_encode($rsp); +?> \ No newline at end of file diff --git a/app/views/accounts/xml/authenticate.ctp b/app/views/accounts/xml/authenticate.ctp new file mode 100644 index 0000000..fbd7323 --- /dev/null +++ b/app/views/accounts/xml/authenticate.ctp @@ -0,0 +1 @@ +<?php echo $xml->serialize($account, array('root' => 'rsp')); ?> \ No newline at end of file diff --git a/app/views/elements/footer_menu.ctp b/app/views/elements/footer_menu.ctp new file mode 100644 index 0000000..08d76df --- /dev/null +++ b/app/views/elements/footer_menu.ctp @@ -0,0 +1,10 @@ +<ul class="menu"> + <li><?php echo $html->link(__('Home', true), array('/'))?></li> + <li><?php echo $html->link(__('Site Map', true), array('/'));?></li> + <li><?php echo $html->link(__('Privacy Policy', true), array('/'));?></li> + <li><?php echo $html->link(__('Contact Us', true), array('/'));?></li> +</ul> +<div class="logo"> + <?php echo $html->link($html->image('logo-sm.gif', array('alt' => '')), array('/'), array('escape' => false))?> +</div> +<div style="clear:both"></div> \ No newline at end of file diff --git a/app/views/layouts/json/default.ctp b/app/views/layouts/json/default.ctp new file mode 100644 index 0000000..efcc270 --- /dev/null +++ b/app/views/layouts/json/default.ctp @@ -0,0 +1,7 @@ +<?php +header('Pragma: no-cache'); +header('Cache-Control: no-store, no-cache, max-age=0, must-revalidate'); +header('Content-Type: text/x-JSON'); +header('X-JSON: '. (!empty($status))?json_encode(array('rsp' => $status)):$content_for_layout); +?> +<?php echo (!empty($status))?json_encode(array('rsp' => $status)):$content_for_layout; ?> \ No newline at end of file diff --git a/app/views/layouts/json/empty b/app/views/layouts/json/empty new file mode 100644 index 0000000..e69de29 diff --git a/app/views/layouts/xml/default.ctp b/app/views/layouts/xml/default.ctp new file mode 100644 index 0000000..20e4bb4 --- /dev/null +++ b/app/views/layouts/xml/default.ctp @@ -0,0 +1,4 @@ +<?php +echo $this->Xml->header(); +echo (!empty($status))?$this->Xml->serialize($status, array('root' => 'rsp')):$content_for_layout; +?> \ No newline at end of file diff --git a/app/webroot/img/bg-footer.png b/app/webroot/img/bg-footer.png new file mode 100644 index 0000000..d771db2 Binary files /dev/null and b/app/webroot/img/bg-footer.png differ diff --git a/app/webroot/img/bg.png b/app/webroot/img/bg.png new file mode 100644 index 0000000..f33139a Binary files /dev/null and b/app/webroot/img/bg.png differ diff --git a/app/webroot/img/logo-sm.gif b/app/webroot/img/logo-sm.gif new file mode 100644 index 0000000..b7b32ee Binary files /dev/null and b/app/webroot/img/logo-sm.gif differ diff --git a/app/webroot/img/logo.gif b/app/webroot/img/logo.gif new file mode 100644 index 0000000..f489abf Binary files /dev/null and b/app/webroot/img/logo.gif differ diff --git a/app/webroot/img/menu-btn.png b/app/webroot/img/menu-btn.png new file mode 100644 index 0000000..00e4271 Binary files /dev/null and b/app/webroot/img/menu-btn.png differ
valaravena/Glo
d3c1880f6c1545a373d8eb3ff48a90d2c61a5484
Adding .gitignore
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3bb2fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/cakephp + +/app/config/*.yml +/app/tmp/cache/persistent/cake_* +/app/tmp/cache/models/cake_* +/app/tmp/cache/views/cake_* +/app/tmp/logs/*.log + +/app/webroot/files/**/*.* + +/app/config/config.php
valaravena/Glo
d3665628d666617e42a6dc9854e66138cfd1f932
Adding CakePHP Submodule
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..007e7d2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cakephp"] + path = cakephp + url = git://github.com/cakephp/cakephp1x.git diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..0ed8662 --- /dev/null +++ b/.htaccess @@ -0,0 +1,5 @@ +<IfModule mod_rewrite.c> + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + </IfModule> \ No newline at end of file diff --git a/cakephp b/cakephp new file mode 160000 index 0000000..0eea0ce --- /dev/null +++ b/cakephp @@ -0,0 +1 @@ +Subproject commit 0eea0ce0f89e195efb20727319427f960824fecb
srid/debris
bc437d2fbd082f7623de75009ab890e1a60efab9
Pygments support; fix html double escape
diff --git a/3rdparty/pygments-1.0.zip b/3rdparty/pygments-1.0.zip new file mode 100644 index 0000000..8dfdf9a Binary files /dev/null and b/3rdparty/pygments-1.0.zip differ diff --git a/debris/html.py b/debris/html.py index 54b0f0c..f316535 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,93 +1,93 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue - if value is not None: - value = cgi.escape(value) + #if value is not None: + # value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) # XXX: refactor - http://github.com/btbytes/gappsites/blob/76facbb0ebef7aab8ad9ff18ffdbc37a62a86026/utils.py#L12 def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, 'site_author': meta.SITE_AUTHOR, 'disqus_name': meta.DISQUS_NAME }) if 'messages' not in values: values['messages'] = [] response.out.write(gae_template.render(path, values)) def error_404(handler): handler.error(404) handler.response.out.write('Page <b>not</b> found!') def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt', 'initial_header_level': 3 }) return parts['fragment'] diff --git a/debris/rstcode.py b/debris/rstcode.py new file mode 100644 index 0000000..fa405db --- /dev/null +++ b/debris/rstcode.py @@ -0,0 +1,80 @@ +""" + The Pygments reStructuredText directive + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + This fragment is a Docutils_ 0.4 directive that renders source code + (to HTML only, currently) via Pygments. + + To use it, adjust the options below and copy the code into a module + that you import on initialization. The code then automatically + registers a ``sourcecode`` directive that you can use instead of + normal code blocks like this:: + + .. sourcecode:: python + + My code goes here. + + If you want to have different code styles, e.g. one with line numbers + and one without, add formatters with their names in the VARIANTS dict + below. You can invoke them instead of the DEFAULT one by using a + directive option:: + + .. sourcecode:: python + :linenos: + + My code goes here. + + Look at the `directive documentation`_ to get all the gory details. + + .. _Docutils: http://docutils.sf.net/ + .. _directive documentation: + http://docutils.sourceforge.net/docs/howto/rst-directives.html + + :copyright: 2007 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" + +# Options +# ~~~~~~~ + +# Set to True if you want inline CSS styles instead of classes +INLINESTYLES = True + +from pygments.formatters import HtmlFormatter +from pygments.styles import get_style_by_name + + +mystyle = get_style_by_name('colorful') + +# The default formatter +DEFAULT = HtmlFormatter(noclasses=INLINESTYLES, style=mystyle) + +# Add name -> formatter pairs for every variant you want to use +VARIANTS = { + # 'linenos': HtmlFormatter(noclasses=INLINESTYLES, linenos=True), +} + + +from docutils import nodes +from docutils.parsers.rst import directives + +from pygments import highlight +from pygments.lexers import get_lexer_by_name, TextLexer + +def pygments_directive(name, arguments, options, content, lineno, + content_offset, block_text, state, state_machine): + try: + lexer = get_lexer_by_name(arguments[0]) + except ValueError: + # no lexer found - use the text one instead of an exception + lexer = TextLexer() + # take an arbitrary option if more than one is given + formatter = options and VARIANTS[options.keys()[0]] or DEFAULT + parsed = highlight(u'\n'.join(content), lexer, formatter) + return [nodes.raw('', parsed, format='html')] + +pygments_directive.arguments = (1, 0, 1) +pygments_directive.content = 1 +pygments_directive.options = dict([(key, directives.flag) for key in VARIANTS]) + +directives.register_directive('sourcecode', pygments_directive) diff --git a/import_wrapper.py b/import_wrapper.py index 9278822..b21b8e5 100644 --- a/import_wrapper.py +++ b/import_wrapper.py @@ -1,10 +1,12 @@ import os import sys import glob import logging # Add 3rdparty/*.zip to sys.path so that we can import them seamlessly root = os.path.dirname(__file__) for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): logging.debug("Adding 3rdparty library '%s' to sys.path" % ziplib) sys.path.insert(0, ziplib) + +import debris.rstcode \ No newline at end of file diff --git a/main.py b/main.py index b931755..7910bf9 100644 --- a/main.py +++ b/main.py @@ -1,100 +1,101 @@ from __future__ import with_statement import import_wrapper import meta import logging from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import debris.filters # load and register the filters from debris.page import BlikiPage from debris.html import template, site_url, form_to_db, error_404 from debris.rss import rss_worthy_pages_xml + def draft_filter(pages): """Filter the list of `pages' by removing 'draft' pages if admin is not logged in """ if not users.is_current_user_admin(): return (page for page in pages if page.draft == False) else: return pages class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() pages = draft_filter(pages) template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) if page is None: error_404(self) else: template(self.response, 'blikipage.html', {'page': page, 'single': True}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) pages = draft_filter(pages) template(self.response, 'tag.html', { 'tag': tag, 'pages': pages, 'messages': ["You are viewing pages tagged '<b>%s</b>'" % tag] }) class ViewRSSPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_rss_worthy_pages() pages = draft_filter(pages) self.response.headers['Content-Type'] = 'application/rss+xml' self.response.out.write(rss_worthy_pages_xml(self.request, pages)) class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) results = draft_filter(results) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/rss', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/srid.css b/static/srid.css index 2b636d3..edb73c2 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,39 +1,45 @@ div.container { /* since blueprintcss sets the font-size to 75%, we * increase the size again here */ font-size: 120%; } a.draft { color: red !important; } div.page h2 a{ text-decoration: none; color: inherit; } div.footer { text-align: right; } ul.raw { list-style-type: none; margin: 0 0 0 1em; padding: 0; } p.page_meta { font-size: 80%; color: #999999; float: right; } p.page_meta a { text-decoration: none; color: inherit; } p.page_meta a:hover { color: black; +} + +/* used by Pygments sourcecode rst directive */ +div.highlight { + background-color: transparent; + padding-left: 20px; } \ No newline at end of file diff --git a/templates/srid/part-page.html b/templates/srid/part-page.html index 14d3b75..6da26b2 100644 --- a/templates/srid/part-page.html +++ b/templates/srid/part-page.html @@ -1,14 +1,15 @@ <div class="page"> <h2><a {% if page.draft %} class="draft" {% endif %} href="/{{ page.path }}">{{ page.title }}</a></h2> <p> {{ page.content|rstify }} </p> + <p class="page_meta"> {% block extra %}{% endblock %} </p> <hr /> {% if single and page.has_comments %} <div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/{{ disqus_name }}/embed.js"></script><noscript><a href="http://{{ disqus_name }}.disqus.com/?url=ref">View the discussion thread.</a></noscript><a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a> {% endif %} </div>
srid/debris
9f099b3d8e7b0f71a38b56c911e25c2606236e7b
include link to user page
diff --git a/templates/srid/part-blikipage.html b/templates/srid/part-blikipage.html index 8c59a89..a9f2a35 100644 --- a/templates/srid/part-blikipage.html +++ b/templates/srid/part-blikipage.html @@ -1,15 +1,16 @@ {% extends "part-page.html" %} {% block extra %} - <b>Created</b> on {{ page.created_date|date:"d M Y" }} by srid + <b>Created</b> on {{ page.created_date|date:"d M Y" }} by + <a href="/SridharRatnakumar">srid</a> {% if page.tags %} <br/> <b>Tagged</b> {{ page.tags|display_tags }} {% endif %} {% if is_admin %} <br/> (<a href="/-/admin/edit/{{page.path}}" accesskey="e">edit</a>) {% endif %} {% endblock %}
srid/debris
cd882294417c06003e51a14bfdea200ddfd115b9
add projects and twitter to menu
diff --git a/templates/srid/base.html b/templates/srid/base.html index 816abc8..d8947ce 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,51 +1,53 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <meta name="author" content="{{ site_author }}" /> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <link rel="alternate" type="application/rss+xml" title="New Bliki Pages" href="http://feeds2.feedburner.com/Srid" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24"> &nbsp; {% if messages %} {% for m in messages %} <p style="text-align: center;"><span class="highlight"> {{ m }} </span></p> {% endfor %} {% endif %} </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> {% if is_admin %} <a href="/-/admin/newpage">New Page</a> | <a href="{{ logout_url }}"><b>Logout</b></a> | {% else %} <a href="{{ login_url }}" style="color: white;">Login</a> {% endif %} <a href="/">Home</a> | - <a href="/AboutThisSite">About</a> + <a href="/AboutThisSite">About</a> | + <a href="/projects">Projects</a> | + <a href="http://twitter.com/nearfar">Twitter</a> <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> </form> --> </div> </div> </body> </html>
srid/debris
f6767919032e3bccec82bca766b8507ac47ef007
use unique rss url lest be embarrased by old stupid posts from google reader cache
diff --git a/templates/srid/base.html b/templates/srid/base.html index e006a76..816abc8 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,51 +1,51 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <meta name="author" content="{{ site_author }}" /> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> - <link rel="alternate" type="application/rss+xml" title="New Bliki Pages" href="/rss" /> + <link rel="alternate" type="application/rss+xml" title="New Bliki Pages" href="http://feeds2.feedburner.com/Srid" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24"> &nbsp; {% if messages %} {% for m in messages %} <p style="text-align: center;"><span class="highlight"> {{ m }} </span></p> {% endfor %} {% endif %} </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> {% if is_admin %} <a href="/-/admin/newpage">New Page</a> | <a href="{{ logout_url }}"><b>Logout</b></a> | {% else %} <a href="{{ login_url }}" style="color: white;">Login</a> {% endif %} <a href="/">Home</a> | <a href="/AboutThisSite">About</a> <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> </form> --> </div> </div> </body> </html>
srid/debris
73ef90cd79f3469bb121511a6a7c031a16dcfd81
support for disqus.com comments
diff --git a/debris/html.py b/debris/html.py index eea4f20..54b0f0c 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,92 +1,93 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) # XXX: refactor - http://github.com/btbytes/gappsites/blob/76facbb0ebef7aab8ad9ff18ffdbc37a62a86026/utils.py#L12 def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, - 'site_author': meta.SITE_AUTHOR + 'site_author': meta.SITE_AUTHOR, + 'disqus_name': meta.DISQUS_NAME }) if 'messages' not in values: values['messages'] = [] response.out.write(gae_template.render(path, values)) def error_404(handler): handler.error(404) handler.response.out.write('Page <b>not</b> found!') def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt', 'initial_header_level': 3 }) return parts['fragment'] diff --git a/debris/page.py b/debris/page.py index 3e199d3..f9c6f5a 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,64 +1,65 @@ from google.appengine.ext import db from google.appengine.ext import search class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) - created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() tags = db.StringListProperty() - rss_worthy = db.BooleanProperty() draft = db.BooleanProperty() + created_date = db.DateTimeProperty(auto_now_add=True) + rss_worthy = db.BooleanProperty() + has_comments = db.BooleanProperty() def __form_set_tags__(self, tags_list_as_string): tags = tags_list_as_string.split(' ') tags = [tag.strip() for tag in tags] self.tags = tags def get_url(self): return self.path # abs url? @staticmethod def search(keywords): query = search.SearchableQuery('BlikiPage') query.Search(keywords) return query.Run() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.rss_worthy = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_all_rss_worthy_pages(): return db.GqlQuery( "SELECT * FROM BlikiPage WHERE rss_worthy = True ORDER BY created_date DESC" ) @staticmethod def get_all_pages(): return db.GqlQuery( "SELECT * FROM BlikiPage ORDER BY created_date DESC" ) @staticmethod def get_all_by_tag(tag): """Get all pages by tag""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE tags = :1", tag ) @staticmethod def get_by_path(path): q = db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path) if q.count() > 0: return q[0] else: return None # none found diff --git a/index.yaml b/index.yaml index c92dcda..889c6a9 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc -# Used 2 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index 08b642b..b931755 100644 --- a/main.py +++ b/main.py @@ -1,101 +1,100 @@ from __future__ import with_statement import import_wrapper import meta import logging from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import debris.filters # load and register the filters from debris.page import BlikiPage from debris.html import template, site_url, form_to_db, error_404 from debris.rss import rss_worthy_pages_xml def draft_filter(pages): """Filter the list of `pages' by removing 'draft' pages if admin is not logged in """ if not users.is_current_user_admin(): return (page for page in pages if page.draft == False) else: return pages class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() pages = draft_filter(pages) template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) if page is None: error_404(self) else: - template(self.response, 'blikipage.html', - {'page': page}) + template(self.response, 'blikipage.html', {'page': page, 'single': True}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) pages = draft_filter(pages) template(self.response, 'tag.html', { 'tag': tag, 'pages': pages, 'messages': ["You are viewing pages tagged '<b>%s</b>'" % tag] }) class ViewRSSPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_rss_worthy_pages() pages = draft_filter(pages) self.response.headers['Content-Type'] = 'application/rss+xml' self.response.out.write(rss_worthy_pages_xml(self.request, pages)) class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) results = draft_filter(results) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/rss', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/meta.py b/meta.py index 429f3f3..e0b3a3e 100644 --- a/meta.py +++ b/meta.py @@ -1,10 +1,11 @@ # keep all meta information here -SITE_TITLE = "Yet Another Debris Bliki" +SITE_TITLE = "srid's bliki" SITE_AUTHOR = "Sridhar Ratnakumar" SITE_DESCRIPTION = "Personal bliki site by " + SITE_AUTHOR +DISQUS_NAME = 'debris' # use ./templates/$TEMPLATE_GROUP as template directory TEMPLATE_GROUP = 'srid' diff --git a/templates/srid/edit.html b/templates/srid/edit.html index 63dd063..560ed61 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,39 +1,44 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> <fieldset> <legend>Editing "{{page.path}}"</legend> <p><label for="titleID">Title</label><br/> <input id="titleID" type="text" name="title" size="75" value="{{page.title}}" /> <p><label for="pathID">Path (www.nearfar.org/&lt;Path&gt;)</label><br/> <input id="pathID" type="path" name="path" size="50" value="{{page.path}}" /> <p><label for="contentID">Content</label><br/> <textarea id="contentID" style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> <p><label for="tagsID">Tags (eg: "Python GoogleAppEngine CookbookRecipes")</label><br/> <input id="tagsID" type="text" name="tags" size="75" value="{{page.tags|join:" " }}" /> <p><input type="checkbox" name="draft" {% if page.draft %}checked{% endif %} /> Draft </p> <p><input type="checkbox" name="rss_worthy" {% if page.rss_worthy %}checked{% endif %} /> RSS worthy </p> + <p><input type="checkbox" name="has_comments" + {% if page.rss_worthy %}checked{% endif %} /> + Has comments + </p> + <div> <input type="submit" value="Save" accesskey="s" /> <!-- input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} / --> </div> </fieldset> </form> {% endblock %} diff --git a/templates/srid/part-page.html b/templates/srid/part-page.html index d156014..14d3b75 100644 --- a/templates/srid/part-page.html +++ b/templates/srid/part-page.html @@ -1,10 +1,14 @@ <div class="page"> <h2><a {% if page.draft %} class="draft" {% endif %} href="/{{ page.path }}">{{ page.title }}</a></h2> <p> {{ page.content|rstify }} </p> <p class="page_meta"> {% block extra %}{% endblock %} </p> <hr /> + + {% if single and page.has_comments %} +<div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/{{ disqus_name }}/embed.js"></script><noscript><a href="http://{{ disqus_name }}.disqus.com/?url=ref">View the discussion thread.</a></noscript><a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a> + {% endif %} </div>
srid/debris
2df2dd7dab871aa6084a03500c595338202ffb82
add/remove TODO
diff --git a/README.rst b/README.rst index ecd4919..4cb05ef 100644 --- a/README.rst +++ b/README.rst @@ -1,15 +1,14 @@ **debris** is a simple bliki_ for personal purposes. As of now, the bliki is pretty simple - you create/edit pages that can have created date and tag meta data. You can list pages by tag. **Nice to have features:** - - Test cases - - Save as draft + - Edit in emacs (using ATOM API?) as it has got a good ReST major mode. - Paging - Tag clouds and other tag navigation - Respond by email (like Google Groups UI) .. _bliki: http://en.wikipedia.org/wiki/Bliki - \ No newline at end of file +
srid/debris
dfc0d77bc88acf1bf578dc28a974209375163ddf
draft support
diff --git a/debris/rss.py b/debris/rss.py index a42cfff..441bc86 100644 --- a/debris/rss.py +++ b/debris/rss.py @@ -1,38 +1,37 @@ # Manage creation of site RSS from PyRSS2Gen import RSS2, RSSItem, Guid import meta from debris.html import site_url, rst2html from debris.page import BlikiPage from debris.util import file_write_to_string -def rss_worthy_pages_xml(request): +def rss_worthy_pages_xml(request, pages): """Return the rss xml content containing all newly created pages that are 'rss worthy' """ - pages = BlikiPage.get_all_rss_worthy_pages() rss_items = [] for page in pages: rss_items.append( RSSItem( title = page.title, link = site_url(request, page.path), author = meta.SITE_AUTHOR, description = rst2html(page.content), guid = Guid(site_url(request, page.path)), pubDate = page.created_date ) ) rss = RSS2( title = meta.SITE_TITLE, link = site_url(request), description = meta.SITE_DESCRIPTION, items = rss_items ) return file_write_to_string(rss.write_xml) diff --git a/index.yaml b/index.yaml index 484ff90..c92dcda 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc -# Used once in query history. +# Used 2 times in query history. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index cb0766e..08b642b 100644 --- a/main.py +++ b/main.py @@ -1,88 +1,101 @@ from __future__ import with_statement import import_wrapper import meta import logging +from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import debris.filters # load and register the filters from debris.page import BlikiPage from debris.html import template, site_url, form_to_db, error_404 from debris.rss import rss_worthy_pages_xml +def draft_filter(pages): + """Filter the list of `pages' by removing 'draft' pages if admin is not logged in + """ + if not users.is_current_user_admin(): + return (page for page in pages if page.draft == False) + else: + return pages class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() + pages = draft_filter(pages) template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) if page is None: error_404(self) else: template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) + pages = draft_filter(pages) template(self.response, 'tag.html', { 'tag': tag, 'pages': pages, 'messages': ["You are viewing pages tagged '<b>%s</b>'" % tag] }) class ViewRSSPage(webapp.RequestHandler): def get(self): + pages = BlikiPage.get_all_rss_worthy_pages() + pages = draft_filter(pages) self.response.headers['Content-Type'] = 'application/rss+xml' - self.response.out.write(rss_worthy_pages_xml(self.request)) + self.response.out.write(rss_worthy_pages_xml(self.request, pages)) class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) + results = draft_filter(results) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/rss', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/srid.css b/static/srid.css index c31c6ad..2b636d3 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,35 +1,39 @@ div.container { /* since blueprintcss sets the font-size to 75%, we * increase the size again here */ font-size: 120%; } +a.draft { + color: red !important; +} + div.page h2 a{ text-decoration: none; color: inherit; } div.footer { text-align: right; } ul.raw { list-style-type: none; margin: 0 0 0 1em; padding: 0; } p.page_meta { font-size: 80%; color: #999999; float: right; } p.page_meta a { text-decoration: none; color: inherit; } p.page_meta a:hover { color: black; } \ No newline at end of file diff --git a/templates/srid/edit.html b/templates/srid/edit.html index 2893926..63dd063 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,34 +1,39 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> <fieldset> <legend>Editing "{{page.path}}"</legend> <p><label for="titleID">Title</label><br/> <input id="titleID" type="text" name="title" size="75" value="{{page.title}}" /> <p><label for="pathID">Path (www.nearfar.org/&lt;Path&gt;)</label><br/> <input id="pathID" type="path" name="path" size="50" value="{{page.path}}" /> <p><label for="contentID">Content</label><br/> <textarea id="contentID" style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> <p><label for="tagsID">Tags (eg: "Python GoogleAppEngine CookbookRecipes")</label><br/> <input id="tagsID" type="text" name="tags" size="75" value="{{page.tags|join:" " }}" /> + <p><input type="checkbox" name="draft" + {% if page.draft %}checked{% endif %} /> + Draft + </p> + <p><input type="checkbox" name="rss_worthy" {% if page.rss_worthy %}checked{% endif %} /> RSS worthy </p> <div> <input type="submit" value="Save" accesskey="s" /> <!-- input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} / --> </div> </fieldset> </form> {% endblock %} diff --git a/templates/srid/main.html b/templates/srid/main.html index e0c3aa4..8c5af61 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,25 +1,26 @@ {% extends "base.html" %} {% block title %}{{ site_title }}{% endblock %} {% block content %} <div class="span-24"> <div class="box"> <p>A listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - - <a href="/{{page.path}}">{{ page.title }}</a> + <a {% if page.draft %} class="draft" {% endif %} + href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-24"> <p>To read more about this site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/srid/part-page.html b/templates/srid/part-page.html index d10c273..d156014 100644 --- a/templates/srid/part-page.html +++ b/templates/srid/part-page.html @@ -1,10 +1,10 @@ <div class="page"> - <h2><a href="/{{ page.path }}">{{ page.title }}</a></h2> + <h2><a {% if page.draft %} class="draft" {% endif %} href="/{{ page.path }}">{{ page.title }}</a></h2> <p> {{ page.content|rstify }} </p> <p class="page_meta"> {% block extra %}{% endblock %} </p> <hr /> -</div> \ No newline at end of file +</div>
srid/debris
55e111470fb5b12083d51d06f0fa70e453853df2
implement 404 error for broken links - i don't care about /admin/ broken links though
diff --git a/debris/html.py b/debris/html.py index e3e3957..eea4f20 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,88 +1,92 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) # XXX: refactor - http://github.com/btbytes/gappsites/blob/76facbb0ebef7aab8ad9ff18ffdbc37a62a86026/utils.py#L12 def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, 'site_author': meta.SITE_AUTHOR }) if 'messages' not in values: values['messages'] = [] response.out.write(gae_template.render(path, values)) + +def error_404(handler): + handler.error(404) + handler.response.out.write('Page <b>not</b> found!') def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt', 'initial_header_level': 3 }) return parts['fragment'] diff --git a/debris/page.py b/debris/page.py index 95f0f8d..3e199d3 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,61 +1,64 @@ from google.appengine.ext import db from google.appengine.ext import search class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() tags = db.StringListProperty() rss_worthy = db.BooleanProperty() draft = db.BooleanProperty() def __form_set_tags__(self, tags_list_as_string): tags = tags_list_as_string.split(' ') tags = [tag.strip() for tag in tags] self.tags = tags def get_url(self): return self.path # abs url? @staticmethod def search(keywords): query = search.SearchableQuery('BlikiPage') query.Search(keywords) return query.Run() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.rss_worthy = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_all_rss_worthy_pages(): return db.GqlQuery( "SELECT * FROM BlikiPage WHERE rss_worthy = True ORDER BY created_date DESC" ) @staticmethod def get_all_pages(): return db.GqlQuery( "SELECT * FROM BlikiPage ORDER BY created_date DESC" ) @staticmethod def get_all_by_tag(tag): """Get all pages by tag""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE tags = :1", tag ) @staticmethod def get_by_path(path): - return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", - path)[0] + q = db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path) + if q.count() > 0: + return q[0] + else: + return None # none found diff --git a/index.yaml b/index.yaml index 889c6a9..484ff90 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc -# Unused in query history -- copied from input. +# Used once in query history. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index 01ab459..cb0766e 100644 --- a/main.py +++ b/main.py @@ -1,85 +1,88 @@ from __future__ import with_statement import import_wrapper import meta import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import debris.filters # load and register the filters from debris.page import BlikiPage -from debris.html import template, site_url, form_to_db +from debris.html import template, site_url, form_to_db, error_404 from debris.rss import rss_worthy_pages_xml class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) - template(self.response, 'blikipage.html', - {'page': page}) + if page is None: + error_404(self) + else: + template(self.response, 'blikipage.html', + {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) template(self.response, 'tag.html', { 'tag': tag, 'pages': pages, 'messages': ["You are viewing pages tagged '<b>%s</b>'" % tag] }) class ViewRSSPage(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'application/rss+xml' self.response.out.write(rss_worthy_pages_xml(self.request)) class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/rss', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main()
srid/debris
ca5e1e094772b359a413a81d797f2e9bac4c7654
license under WTFPL
diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..2978491 --- /dev/null +++ b/COPYING @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + 14 rue de Plaisance, 75014 Paris, France + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/debris/html.py b/debris/html.py index faa814b..e3e3957 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,87 +1,88 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) +# XXX: refactor - http://github.com/btbytes/gappsites/blob/76facbb0ebef7aab8ad9ff18ffdbc37a62a86026/utils.py#L12 def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, 'site_author': meta.SITE_AUTHOR }) if 'messages' not in values: values['messages'] = [] response.out.write(gae_template.render(path, values)) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt', 'initial_header_level': 3 }) return parts['fragment'] diff --git a/index.yaml b/index.yaml index e4e24ee..889c6a9 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Used 5 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc
srid/debris
c3fabc4fcd0315f2fa538569e5b3a5d813469727
meta author tag
diff --git a/debris/html.py b/debris/html.py index ac22e7a..faa814b 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,86 +1,87 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, + 'site_author': meta.SITE_AUTHOR }) if 'messages' not in values: values['messages'] = [] response.out.write(gae_template.render(path, values)) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt', 'initial_header_level': 3 }) return parts['fragment'] diff --git a/templates/srid/base.html b/templates/srid/base.html index 5db2363..e006a76 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,50 +1,51 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> + <meta name="author" content="{{ site_author }}" /> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <link rel="alternate" type="application/rss+xml" title="New Bliki Pages" href="/rss" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24"> &nbsp; {% if messages %} {% for m in messages %} <p style="text-align: center;"><span class="highlight"> {{ m }} </span></p> {% endfor %} {% endif %} </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> {% if is_admin %} <a href="/-/admin/newpage">New Page</a> | <a href="{{ logout_url }}"><b>Logout</b></a> | {% else %} <a href="{{ login_url }}" style="color: white;">Login</a> {% endif %} <a href="/">Home</a> | <a href="/AboutThisSite">About</a> <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> </form> --> </div> </div> </body> </html>
srid/debris
2be0c831950ac6edf3f97be59d4c38acee552f42
removing the site warning -- ready for production? look! http://srid.nearfar.org/
diff --git a/debris/html.py b/debris/html.py index 541a3f2..ac22e7a 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,93 +1,86 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, }) if 'messages' not in values: values['messages'] = [] - # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) - values['messages'].append( - "Please note that this site is a <b>test deployment environment</b> for " + - "a software that I am currently writing. It will eventually become a place " + - "for me to write; until then what you will see here is just random text." - ) - response.out.write(gae_template.render(path, values)) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt', 'initial_header_level': 3 }) return parts['fragment']
srid/debris
ad42d90735a3437d96190174fa8cfb662d62420e
accesskeys - now use 'e' for edit; 's' for save. in firefox, use shift+alt
diff --git a/index.yaml b/index.yaml index 01871ac..e4e24ee 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Used 4 times in query history. +# Used 5 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/templates/srid/edit.html b/templates/srid/edit.html index b3cc3f4..2893926 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,34 +1,34 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> <fieldset> <legend>Editing "{{page.path}}"</legend> <p><label for="titleID">Title</label><br/> <input id="titleID" type="text" name="title" size="75" value="{{page.title}}" /> <p><label for="pathID">Path (www.nearfar.org/&lt;Path&gt;)</label><br/> <input id="pathID" type="path" name="path" size="50" value="{{page.path}}" /> <p><label for="contentID">Content</label><br/> <textarea id="contentID" style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> <p><label for="tagsID">Tags (eg: "Python GoogleAppEngine CookbookRecipes")</label><br/> <input id="tagsID" type="text" name="tags" size="75" value="{{page.tags|join:" " }}" /> <p><input type="checkbox" name="rss_worthy" {% if page.rss_worthy %}checked{% endif %} /> RSS worthy </p> <div> - <input type="submit" value="Save" /> + <input type="submit" value="Save" accesskey="s" /> <!-- input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} / --> </div> </fieldset> </form> -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/srid/part-blikipage.html b/templates/srid/part-blikipage.html index d80b80d..8c59a89 100644 --- a/templates/srid/part-blikipage.html +++ b/templates/srid/part-blikipage.html @@ -1,15 +1,15 @@ {% extends "part-page.html" %} {% block extra %} <b>Created</b> on {{ page.created_date|date:"d M Y" }} by srid {% if page.tags %} <br/> <b>Tagged</b> {{ page.tags|display_tags }} {% endif %} {% if is_admin %} <br/> - (<a href="/-/admin/edit/{{page.path}}">edit</a>) + (<a href="/-/admin/edit/{{page.path}}" accesskey="e">edit</a>) {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %}
srid/debris
2d2ac5de48d10eaaa3322ca525eb998ab4c765cc
set initial header level in reStructuredText to h3
diff --git a/debris/html.py b/debris/html.py index 74dbda8..541a3f2 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,92 +1,93 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def template(response, name, values): """Render the given template to the `response' object """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, }) if 'messages' not in values: values['messages'] = [] # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) values['messages'].append( "Please note that this site is a <b>test deployment environment</b> for " + "a software that I am currently writing. It will eventually become a place " + "for me to write; until then what you will see here is just random text." ) response.out.write(gae_template.render(path, values)) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): """Convert reStructedText into a HTML fragment """ parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', - 'template': 'data/docutils/html4css1/template.txt' + 'template': 'data/docutils/html4css1/template.txt', + 'initial_header_level': 3 }) return parts['fragment']
srid/debris
0e46043d4fd9f7f3413f76ff669653348c1b1a00
switching back to emacs and converting all the TABs to SPACEs
diff --git a/README.rst b/README.rst index f332571..ecd4919 100644 --- a/README.rst +++ b/README.rst @@ -1,16 +1,15 @@ **debris** is a simple bliki_ for personal purposes. As of now, the bliki is pretty simple - you create/edit pages that can have created date and tag meta data. You can list pages by tag. **Nice to have features:** - - Code Cleanups - Test cases - Save as draft - Paging - Tag clouds and other tag navigation - Respond by email (like Google Groups UI) .. _bliki: http://en.wikipedia.org/wiki/Bliki \ No newline at end of file diff --git a/debris/debug.py b/debris/debug.py index bad8433..010c1cb 100644 --- a/debris/debug.py +++ b/debris/debug.py @@ -1,11 +1,12 @@ # Debug related functions import sys import pdb def SHELL(): - """Break the application and run the PDB shell""" + """Break the application and run the PDB shell + """ pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) diff --git a/debris/html.py b/debris/html.py index 5ac0727..74dbda8 100644 --- a/debris/html.py +++ b/debris/html.py @@ -1,91 +1,92 @@ # Functions related to HTML import os import cgi from docutils import core from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users import meta def form_to_db(request, model_instance): """Copy the FORM values to the given entity properties (datastore model fields) - """ + """ for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def template(response, name, values): - """Render the given template to the `response' object""" + """Render the given template to the `response' object + """ # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', meta.TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/"), 'site_title': meta.SITE_TITLE, }) if 'messages' not in values: values['messages'] = [] # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) values['messages'].append( "Please note that this site is a <b>test deployment environment</b> for " + - "a software that I am currently writing. It will eventually become a place " + - "for me to write; until then what you will see here is just random text." + "a software that I am currently writing. It will eventually become a place " + + "for me to write; until then what you will see here is just random text." ) response.out.write(gae_template.render(path, values)) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary - """ + """ base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): - """Convert reStructedText into a HTML fragment - """ - parts = core.publish_parts( - text, - writer_name='html4css1', - settings_overrides={ - '_disable_config': True, - 'embed_stylesheet': False, - 'stylesheet_path': 'data/html4css1/html4css1.css', - 'template': 'data/docutils/html4css1/template.txt' - }) - return parts['fragment'] + """Convert reStructedText into a HTML fragment + """ + parts = core.publish_parts( + text, + writer_name='html4css1', + settings_overrides={ + '_disable_config': True, + 'embed_stylesheet': False, + 'stylesheet_path': 'data/html4css1/html4css1.css', + 'template': 'data/docutils/html4css1/template.txt' + }) + return parts['fragment'] diff --git a/debris/rss.py b/debris/rss.py index 031abfb..a42cfff 100644 --- a/debris/rss.py +++ b/debris/rss.py @@ -1,36 +1,38 @@ # Manage creation of site RSS from PyRSS2Gen import RSS2, RSSItem, Guid import meta from debris.html import site_url, rst2html from debris.page import BlikiPage from debris.util import file_write_to_string def rss_worthy_pages_xml(request): - """Return the rss xml content containing all newly created pages - that are 'rss worthy' - """ - pages = BlikiPage.get_all_rss_worthy_pages() - rss_items = [] - - for page in pages: - rss_items.append(RSSItem( - title = page.title, - link = site_url(request, page.path), - author = meta.SITE_AUTHOR, - description = rst2html(page.content), - guid = Guid(site_url(request, page.path)), - pubDate = page.created_date - )) - - rss = RSS2( - title = meta.SITE_TITLE, - link = site_url(request), - description = meta.SITE_DESCRIPTION, - items = rss_items - ) - - return file_write_to_string(rss.write_xml) - \ No newline at end of file + """Return the rss xml content containing all newly created pages + that are 'rss worthy' + """ + pages = BlikiPage.get_all_rss_worthy_pages() + rss_items = [] + + for page in pages: + rss_items.append( + RSSItem( + title = page.title, + link = site_url(request, page.path), + author = meta.SITE_AUTHOR, + description = rst2html(page.content), + guid = Guid(site_url(request, page.path)), + pubDate = page.created_date + ) + ) + + rss = RSS2( + title = meta.SITE_TITLE, + link = site_url(request), + description = meta.SITE_DESCRIPTION, + items = rss_items + ) + + return file_write_to_string(rss.write_xml) + diff --git a/debris/util.py b/debris/util.py index b0d73e9..69d09f7 100644 --- a/debris/util.py +++ b/debris/util.py @@ -1,22 +1,22 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' try: - from cStringIO import StringIO + from cStringIO import StringIO except ImportError: - from StringIO import StringIO + from StringIO import StringIO def file_write_to_string(file_writer): """Call `file_writer' with a file-like object as argument and return the written contents of that file """ sio = StringIO() try: file_writer(sio) text = sio.getvalue() finally: sio.close() - return text \ No newline at end of file + return text diff --git a/import_wrapper.py b/import_wrapper.py index ad197bd..9278822 100644 --- a/import_wrapper.py +++ b/import_wrapper.py @@ -1,10 +1,10 @@ import os import sys import glob import logging # Add 3rdparty/*.zip to sys.path so that we can import them seamlessly root = os.path.dirname(__file__) for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): - logging.debug("Adding 3rdparty library '%s' to sys.path" % ziplib) - sys.path.insert(0, ziplib) + logging.debug("Adding 3rdparty library '%s' to sys.path" % ziplib) + sys.path.insert(0, ziplib) diff --git a/index.yaml b/index.yaml index 64e9245..01871ac 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Used 5 times in query history. +# Used 4 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc -# Used 5 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc
srid/debris
b3242323105032748019eff276468d3b4217f667
refactor: distribute code in debris/__init__.py to debris/foo.py where foo is the feature of the code
diff --git a/debris/__init__.py b/debris/__init__.py index 0e6801e..8b13789 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,138 +1 @@ -# I keep utility and wrapper code here -# So simply do `from debris import foo' to use the feature `foo' -import os -import cgi -import sys -import re -from contextlib import contextmanager - -from google.appengine.ext.webapp import template as gae_template -from google.appengine.api import users - -from docutils import core - -import meta - - -TEMPLATE_GROUP = 'srid' # /templates/srid/ -def template(response, name, values): - """Render the given template to the `response' object""" - # find templates in ../templates/ - path = os.path.join(os.path.dirname(__file__), - '..', - 'templates', - TEMPLATE_GROUP, - name) - - # Values common to all templates go here - values.update({ - 'is_admin': users.is_current_user_admin(), - 'login_url': users.create_login_url("/"), - 'logout_url': users.create_logout_url("/"), - 'site_title': meta.SITE_TITLE, - }) - - if 'messages' not in values: - values['messages'] = [] - - # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) - values['messages'].append( - "Please note that this site is a <b>test deployment environment</b> for " + - "a software that I am currently writing. It will eventually become a place " + - "for me to write; until then what you will see here is just random text." - ) - - response.out.write(gae_template.render(path, values)) - - -def SHELL(): - """Break the application and run the PDB shell""" - from pdb import Pdb - Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) - -def form_to_db(request, model_instance): - """Set table attributes from form values""" - for key, field in model_instance.fields().items(): - value = request.get(key, default_value=None) - - field_type = field.data_type - if field_type is basestring: - field_type = str # basestring cannot be initiated - - # Skip fields that are not part of form (value == None), except in the - # case of HTML checkbox where the corresponding form field in request.get - # is 'absent by design' if the checkbox is unchecked - # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html - # to understand how Google works around this HTML spec wart. - if value == None and field_type is not bool: - continue - - if value is not None: - value = cgi.escape(value) - - # if __form_set_<key>__ is defined, use it instead of 'setattr' - try: - setter = getattr(model_instance, '__form_set_%s__' % key) - field_value = value # need not to apply `field_type` as that will be done by the above custom setter - except AttributeError: - setter = lambda v: setattr(model_instance, key, v) - field_value = field_type(value) - - setter(field_value) - -def site_url(req, path=''): - """Return the absolute site URL appending the `path' element if necessary""" - base_url = req.url[ : len(req.url) - len(req.path)] - return base_url + '/' + path - -def rst2html(text): - parts = core.publish_parts( - text, - writer_name='html4css1', - settings_overrides={ - '_disable_config': True, - 'embed_stylesheet': False, - 'stylesheet_path': 'data/html4css1/html4css1.css', - 'template': 'data/docutils/html4css1/template.txt' - }) - return parts['fragment'] - -register = gae_template.create_template_register() [email protected] -def rstify(text): - return rst2html(text) - -display_tag_re = re.compile('([a-z])([A-Z])') [email protected] -def display_tag(tag): - """Display tag in readable way. - Eg: display_tag("GoogleAppEngine") = "Google App Engine" - """ - return display_tag_re.sub(r'\1 \2', tag) - [email protected] -def display_tags(tag_list): - tags = [] - for tag in tag_list: - tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) - return ', '.join(tags) - -gae_template.register_template_library('debris') # this module itself - - -@contextmanager -def StringIO(): - """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 - """ - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - - sio = StringIO() - - try: - yield sio - finally: - sio.close() diff --git a/debris/debug.py b/debris/debug.py new file mode 100644 index 0000000..bad8433 --- /dev/null +++ b/debris/debug.py @@ -0,0 +1,11 @@ +# Debug related functions + +import sys +import pdb + + +def SHELL(): + """Break the application and run the PDB shell""" + pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) + + diff --git a/debris/filters.py b/debris/filters.py new file mode 100644 index 0000000..55f635c --- /dev/null +++ b/debris/filters.py @@ -0,0 +1,31 @@ +# Django template filters + +import re + +from google.appengine.ext.webapp import template + +from debris.html import rst2html + + +register =template.create_template_register() + [email protected] +def rstify(text): + return rst2html(text) + +display_tag_re = re.compile('([a-z])([A-Z])') [email protected] +def display_tag(tag): + """Display tag in readable way. + Eg: display_tag("GoogleAppEngine") = "Google App Engine" + """ + return display_tag_re.sub(r'\1 \2', tag) + [email protected] +def display_tags(tag_list): + tags = [] + for tag in tag_list: + tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) + return ', '.join(tags) + +template.register_template_library('debris.filters') # this module itself diff --git a/debris/html.py b/debris/html.py new file mode 100644 index 0000000..5ac0727 --- /dev/null +++ b/debris/html.py @@ -0,0 +1,91 @@ +# Functions related to HTML + +import os +import cgi + +from docutils import core +from google.appengine.ext.webapp import template as gae_template +from google.appengine.api import users + +import meta + + +def form_to_db(request, model_instance): + """Copy the FORM values to the given entity properties (datastore model fields) + """ + for key, field in model_instance.fields().items(): + value = request.get(key, default_value=None) + + field_type = field.data_type + if field_type is basestring: + field_type = str # basestring cannot be initiated + + # Skip fields that are not part of form (value == None), except in the + # case of HTML checkbox where the corresponding form field in request.get + # is 'absent by design' if the checkbox is unchecked + # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html + # to understand how Google works around this HTML spec wart. + if value == None and field_type is not bool: + continue + + if value is not None: + value = cgi.escape(value) + + # if __form_set_<key>__ is defined, use it instead of 'setattr' + try: + setter = getattr(model_instance, '__form_set_%s__' % key) + field_value = value # need not to apply `field_type` as that will be done by the above custom setter + except AttributeError: + setter = lambda v: setattr(model_instance, key, v) + field_value = field_type(value) + + setter(field_value) + +def template(response, name, values): + """Render the given template to the `response' object""" + # find templates in ../templates/ + path = os.path.join(os.path.dirname(__file__), + '..', + 'templates', + meta.TEMPLATE_GROUP, + name) + + # Values common to all templates go here + values.update({ + 'is_admin': users.is_current_user_admin(), + 'login_url': users.create_login_url("/"), + 'logout_url': users.create_logout_url("/"), + 'site_title': meta.SITE_TITLE, + }) + + if 'messages' not in values: + values['messages'] = [] + + # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) + values['messages'].append( + "Please note that this site is a <b>test deployment environment</b> for " + + "a software that I am currently writing. It will eventually become a place " + + "for me to write; until then what you will see here is just random text." + ) + + response.out.write(gae_template.render(path, values)) + +def site_url(req, path=''): + """Return the absolute site URL appending the `path' element if necessary + """ + base_url = req.url[ : len(req.url) - len(req.path)] + return base_url + '/' + path + +def rst2html(text): + """Convert reStructedText into a HTML fragment + """ + parts = core.publish_parts( + text, + writer_name='html4css1', + settings_overrides={ + '_disable_config': True, + 'embed_stylesheet': False, + 'stylesheet_path': 'data/html4css1/html4css1.css', + 'template': 'data/docutils/html4css1/template.txt' + }) + return parts['fragment'] diff --git a/debris/rss.py b/debris/rss.py new file mode 100644 index 0000000..031abfb --- /dev/null +++ b/debris/rss.py @@ -0,0 +1,36 @@ +# Manage creation of site RSS + +from PyRSS2Gen import RSS2, RSSItem, Guid + +import meta +from debris.html import site_url, rst2html +from debris.page import BlikiPage +from debris.util import file_write_to_string + + +def rss_worthy_pages_xml(request): + """Return the rss xml content containing all newly created pages + that are 'rss worthy' + """ + pages = BlikiPage.get_all_rss_worthy_pages() + rss_items = [] + + for page in pages: + rss_items.append(RSSItem( + title = page.title, + link = site_url(request, page.path), + author = meta.SITE_AUTHOR, + description = rst2html(page.content), + guid = Guid(site_url(request, page.path)), + pubDate = page.created_date + )) + + rss = RSS2( + title = meta.SITE_TITLE, + link = site_url(request), + description = meta.SITE_DESCRIPTION, + items = rss_items + ) + + return file_write_to_string(rss.write_xml) + \ No newline at end of file diff --git a/debris/util.py b/debris/util.py new file mode 100644 index 0000000..b0d73e9 --- /dev/null +++ b/debris/util.py @@ -0,0 +1,22 @@ +# I keep utility and wrapper code here +# So simply do `from debris import foo' to use the feature `foo' + +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO + + +def file_write_to_string(file_writer): + """Call `file_writer' with a file-like object as argument and return + the written contents of that file + """ + sio = StringIO() + + try: + file_writer(sio) + text = sio.getvalue() + finally: + sio.close() + + return text \ No newline at end of file diff --git a/import_wrapper.py b/import_wrapper.py index 9cb14f2..ad197bd 100644 --- a/import_wrapper.py +++ b/import_wrapper.py @@ -1,10 +1,10 @@ import os import sys import glob import logging # Add 3rdparty/*.zip to sys.path so that we can import them seamlessly root = os.path.dirname(__file__) for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): - logging.info("Adding 3rdparty library '%s' to sys.path" % ziplib) + logging.debug("Adding 3rdparty library '%s' to sys.path" % ziplib) sys.path.insert(0, ziplib) diff --git a/index.yaml b/index.yaml index e6b1da4..64e9245 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 7 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 6 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Used 14 times in query history. +# Used 5 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc -# Used 6 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: path direction: desc -# Used 12 times in query history. +# Used 5 times in query history. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index 31ab800..01ab459 100644 --- a/main.py +++ b/main.py @@ -1,110 +1,85 @@ from __future__ import with_statement import import_wrapper import meta import logging -from google.appengine.ext import webapp +from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app -from PyRSS2Gen import RSS2, RSSItem, Guid - -from debris.page import BlikiPage -from debris import template, form_to_db, site_url, rst2html, StringIO, SHELL +import debris.filters # load and register the filters +from debris.page import BlikiPage +from debris.html import template, site_url, form_to_db +from debris.rss import rss_worthy_pages_xml class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) template(self.response, 'tag.html', { 'tag': tag, 'pages': pages, 'messages': ["You are viewing pages tagged '<b>%s</b>'" % tag] }) class ViewRSSPage(webapp.RequestHandler): - def get(self, name): - if name == "all": - # RSS of newly created pages - pages = BlikiPage.get_all_rss_worthy_pages() - rss_items = [] - for page in pages: - rss_items.append(RSSItem( - title = page.title, - link = site_url(self.request, page.path), - author = meta.SITE_AUTHOR, - description = rst2html(page.content), - guid = Guid(page.get_url()), - pubDate = page.created_date - )) - - rss = RSS2( - title = meta.SITE_TITLE, - link = site_url(self.request), - description = meta.SITE_DESCRIPTION, - items = rss_items - ) - - self.response.headers['Content-Type'] = 'application/rss+xml' - with StringIO() as sio: - rss.write_xml(sio) - self.response.out.write(sio.getvalue()) - else: - raise Exception, 'unknown RSS type "%s"' % name + def get(self): + self.response.headers['Content-Type'] = 'application/rss+xml' + self.response.out.write(rss_worthy_pages_xml(self.request)) class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), - (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), + (r'/rss', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/meta.py b/meta.py index efdd3b7..429f3f3 100644 --- a/meta.py +++ b/meta.py @@ -1,7 +1,10 @@ # keep all meta information here SITE_TITLE = "Yet Another Debris Bliki" SITE_AUTHOR = "Sridhar Ratnakumar" SITE_DESCRIPTION = "Personal bliki site by " + SITE_AUTHOR +# use ./templates/$TEMPLATE_GROUP as template directory +TEMPLATE_GROUP = 'srid' + diff --git a/templates/srid/base.html b/templates/srid/base.html index a5677d4..5db2363 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,50 +1,50 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> - <link rel="alternate" type="application/rss+xml" title="New Bliki Articles" href="/RSS/all" /> + <link rel="alternate" type="application/rss+xml" title="New Bliki Pages" href="/rss" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24"> &nbsp; {% if messages %} {% for m in messages %} <p style="text-align: center;"><span class="highlight"> {{ m }} </span></p> {% endfor %} {% endif %} </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> {% if is_admin %} <a href="/-/admin/newpage">New Page</a> | <a href="{{ logout_url }}"><b>Logout</b></a> | {% else %} <a href="{{ login_url }}" style="color: white;">Login</a> {% endif %} <a href="/">Home</a> | <a href="/AboutThisSite">About</a> <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> </form> --> </div> </div> </body> </html>
srid/debris
d5b642326a3665931f22c663e7bbcf7452478128
fix magic title strings
diff --git a/debris/__init__.py b/debris/__init__.py index f45f410..0e6801e 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,135 +1,138 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os import cgi import sys import re from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users from docutils import core +import meta + TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), - 'logout_url': users.create_logout_url("/") + 'logout_url': users.create_logout_url("/"), + 'site_title': meta.SITE_TITLE, }) if 'messages' not in values: values['messages'] = [] # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) values['messages'].append( "Please note that this site is a <b>test deployment environment</b> for " + "a software that I am currently writing. It will eventually become a place " + "for me to write; until then what you will see here is just random text." ) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary""" base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) display_tag_re = re.compile('([a-z])([A-Z])') @register.filter def display_tag(tag): """Display tag in readable way. Eg: display_tag("GoogleAppEngine") = "Google App Engine" """ return display_tag_re.sub(r'\1 \2', tag) @register.filter def display_tags(tag_list): tags = [] for tag in tag_list: tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) return ', '.join(tags) gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/index.yaml b/index.yaml index 55e1657..e6b1da4 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Used 7 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Used 6 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Used 13 times in query history. +# Used 14 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Used 6 times in query history. - kind: BlikiPage properties: - name: path direction: desc -# Used 11 times in query history. +# Used 12 times in query history. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/meta.py b/meta.py index bcf32d5..efdd3b7 100644 --- a/meta.py +++ b/meta.py @@ -1,7 +1,7 @@ # keep all meta information here -SITE_TITLE = "Yet Another Debris Blog" +SITE_TITLE = "Yet Another Debris Bliki" SITE_AUTHOR = "Sridhar Ratnakumar" SITE_DESCRIPTION = "Personal bliki site by " + SITE_AUTHOR diff --git a/templates/srid/main.html b/templates/srid/main.html index 1f2cd32..e0c3aa4 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,25 +1,25 @@ {% extends "base.html" %} -{% block title %}Yet Another Debris Bliki{% endblock %} +{% block title %}{{ site_title }}{% endblock %} {% block content %} <div class="span-24"> <div class="box"> <p>A listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-24"> <p>To read more about this site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> {% endblock %} \ No newline at end of file
srid/debris
de4c305b6a8c746232a42623efc04539775ca2c8
messaging system in templates
diff --git a/debris/__init__.py b/debris/__init__.py index 2c0e291..f45f410 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,124 +1,135 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os import cgi import sys import re from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users from docutils import core TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/") }) + + if 'messages' not in values: + values['messages'] = [] + + # Testing warning (XXX: remove this once content is cleaned up at www.nearfar.org) + values['messages'].append( + "Please note that this site is a <b>test deployment environment</b> for " + + "a software that I am currently writing. It will eventually become a place " + + "for me to write; until then what you will see here is just random text." + ) + response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def site_url(req, path=''): """Return the absolute site URL appending the `path' element if necessary""" base_url = req.url[ : len(req.url) - len(req.path)] return base_url + '/' + path def rst2html(text): parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) display_tag_re = re.compile('([a-z])([A-Z])') @register.filter def display_tag(tag): """Display tag in readable way. Eg: display_tag("GoogleAppEngine") = "Google App Engine" """ return display_tag_re.sub(r'\1 \2', tag) @register.filter def display_tags(tag_list): tags = [] for tag in tag_list: tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) return ', '.join(tags) gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/index.yaml b/index.yaml index c00f21e..55e1657 100644 --- a/index.yaml +++ b/index.yaml @@ -1,44 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Used 7 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Used 6 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Used 10 times in query history. +# Used 13 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Used 6 times in query history. - kind: BlikiPage properties: - name: path direction: desc -# Used 8 times in query history. +# Used 11 times in query history. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index 6d6ae8f..31ab800 100644 --- a/main.py +++ b/main.py @@ -1,106 +1,110 @@ from __future__ import with_statement import import_wrapper import meta import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid from debris.page import BlikiPage from debris import template, form_to_db, site_url, rst2html, StringIO, SHELL class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) - template(self.response, 'tag.html', {'tag': tag, 'pages': pages}) + template(self.response, 'tag.html', { + 'tag': tag, + 'pages': pages, + 'messages': ["You are viewing pages tagged '<b>%s</b>'" % tag] + }) class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages pages = BlikiPage.get_all_rss_worthy_pages() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, link = site_url(self.request, page.path), author = meta.SITE_AUTHOR, description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( title = meta.SITE_TITLE, link = site_url(self.request), description = meta.SITE_DESCRIPTION, items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/base.html b/templates/srid/base.html index 900f6b7..a5677d4 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,48 +1,50 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <link rel="alternate" type="application/rss+xml" title="New Bliki Articles" href="/RSS/all" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> - <div class="span-24 header"> + <div class="span-24"> &nbsp; - <p class="highlight"> - Please note that this site is a <b>test deployment environment</b> for - a software that I am currently writing. It will eventually become a place - for me to write; until then what you will see here is just random text. - </p> + {% if messages %} + {% for m in messages %} + <p style="text-align: center;"><span class="highlight"> + {{ m }} + </span></p> + {% endfor %} + {% endif %} </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> {% if is_admin %} <a href="/-/admin/newpage">New Page</a> | <a href="{{ logout_url }}"><b>Logout</b></a> | {% else %} <a href="{{ login_url }}" style="color: white;">Login</a> {% endif %} <a href="/">Home</a> | <a href="/AboutThisSite">About</a> <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> </form> --> </div> </div> </body> </html>
srid/debris
86371f1da77c0078a9f52e7fa40f6dfc94974adb
fix RSS links
diff --git a/debris/__init__.py b/debris/__init__.py index 6727297..2c0e291 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,119 +1,124 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os import cgi import sys import re from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users from docutils import core TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/") }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) + +def site_url(req, path=''): + """Return the absolute site URL appending the `path' element if necessary""" + base_url = req.url[ : len(req.url) - len(req.path)] + return base_url + '/' + path def rst2html(text): parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) display_tag_re = re.compile('([a-z])([A-Z])') @register.filter def display_tag(tag): """Display tag in readable way. Eg: display_tag("GoogleAppEngine") = "Google App Engine" """ return display_tag_re.sub(r'\1 \2', tag) @register.filter def display_tags(tag_list): tags = [] for tag in tag_list: tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) return ', '.join(tags) gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/index.yaml b/index.yaml index 357c32f..c00f21e 100644 --- a/index.yaml +++ b/index.yaml @@ -1,38 +1,44 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. # Used 7 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Used 6 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc +# Used 10 times in query history. +- kind: BlikiPage + properties: + - name: created_date + direction: desc + # Used 6 times in query history. - kind: BlikiPage properties: - name: path direction: desc -# Used 2 times in query history. +# Used 8 times in query history. - kind: BlikiPage properties: - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index 44fa22f..6d6ae8f 100644 --- a/main.py +++ b/main.py @@ -1,106 +1,106 @@ from __future__ import with_statement import import_wrapper - +import meta import logging - from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid from debris.page import BlikiPage -from debris import template, form_to_db, rst2html, StringIO +from debris import template, form_to_db, site_url, rst2html, StringIO, SHELL class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_all_pages() template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) template(self.response, 'tag.html', {'tag': tag, 'pages': pages}) class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages pages = BlikiPage.get_all_rss_worthy_pages() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, - link = page.get_url(), + link = site_url(self.request, page.path), + author = meta.SITE_AUTHOR, description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( - title = 'Yet Another Debris Bliki', - link = "http://www.google.com/", # XXX - description = "Foo", + title = meta.SITE_TITLE, + link = site_url(self.request), + description = meta.SITE_DESCRIPTION, items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/meta.py b/meta.py new file mode 100644 index 0000000..bcf32d5 --- /dev/null +++ b/meta.py @@ -0,0 +1,7 @@ +# keep all meta information here + +SITE_TITLE = "Yet Another Debris Blog" +SITE_AUTHOR = "Sridhar Ratnakumar" +SITE_DESCRIPTION = "Personal bliki site by " + SITE_AUTHOR + + diff --git a/templates/srid/main.html b/templates/srid/main.html index 99fd6d6..1f2cd32 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,30 +1,25 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} - <div class="span-24"> - <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> - is a combination of blog and wiki.</p> - </div> - <div class="span-24"> <div class="box"> <p>A listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-24"> - <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> + <p>To read more about this site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> {% endblock %} \ No newline at end of file
srid/debris
39a261377e3dfaa11d9ff7c940a1c7f3e4cff784
remove the explicit blog concept
diff --git a/README.rst b/README.rst index 57d7423..f332571 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,16 @@ **debris** is a simple bliki_ for personal purposes. -I might drop this project and start a new one where you store pages in -git repository itself albeit with a datastore based cache to perform -GQL queries. +As of now, the bliki is pretty simple - you create/edit pages that can have +created date and tag meta data. You can list pages by tag. - **Nice to have features:** - Code Cleanups - Test cases + - Save as draft - Paging - Tag clouds and other tag navigation - Respond by email (like Google Groups UI) .. _bliki: http://en.wikipedia.org/wiki/Bliki \ No newline at end of file diff --git a/app.yaml b/app.yaml index c09f094..de9a564 100644 --- a/app.yaml +++ b/app.yaml @@ -1,16 +1,16 @@ application: debris-1 -version: 1 +version: 2 runtime: python api_version: 1 handlers: - url: /static static_dir: static - url: /-/admin/.* script: main.py login: admin - url: /.* script: main.py \ No newline at end of file diff --git a/debris/page.py b/debris/page.py index 695c6c3..95f0f8d 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,71 +1,61 @@ from google.appengine.ext import db from google.appengine.ext import search class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() tags = db.StringListProperty() - belongs_to_blog = db.BooleanProperty() + rss_worthy = db.BooleanProperty() draft = db.BooleanProperty() def __form_set_tags__(self, tags_list_as_string): - #SHELL() tags = tags_list_as_string.split(' ') tags = [tag.strip() for tag in tags] self.tags = tags def get_url(self): return self.path # abs url? @staticmethod def search(keywords): query = search.SearchableQuery('BlikiPage') query.Search(keywords) return query.Run() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True - page.belongs_to_blog = True + page.rss_worthy = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod - def get_recent_blog_entries(): - """Get all pages that were created recently and belongs to blog""" + def get_all_rss_worthy_pages(): return db.GqlQuery( - "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC" + "SELECT * FROM BlikiPage WHERE rss_worthy = True ORDER BY created_date DESC" ) @staticmethod - def get_non_blog_pages(): - """Get all pages that do NOT belong to blog""" + def get_all_pages(): return db.GqlQuery( - "SELECT * FROM BlikiPage WHERE belongs_to_blog = False ORDER BY path DESC" + "SELECT * FROM BlikiPage ORDER BY created_date DESC" ) @staticmethod def get_all_by_tag(tag): """Get all pages by tag""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE tags = :1", tag ) - @staticmethod - def get_recent_entries(): - """Get the last 10 pages that were created recently""" - return db.GqlQuery( - "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10" - ) - @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] diff --git a/index.yaml b/index.yaml index e107da8..357c32f 100644 --- a/index.yaml +++ b/index.yaml @@ -1,37 +1,38 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 5 times in query history. +# Used 7 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 4 times in query history. +# Used 6 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc -# Unused in query history -- copied from input. +# Used 6 times in query history. - kind: BlikiPage properties: - - name: created_date + - name: path direction: desc -# Unused in query history -- copied from input. -- kind: Page +# Used 2 times in query history. +- kind: BlikiPage properties: + - name: rss_worthy - name: created_date direction: desc diff --git a/main.py b/main.py index da2524c..44fa22f 100644 --- a/main.py +++ b/main.py @@ -1,112 +1,106 @@ +from __future__ import with_statement import import_wrapper import logging + from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid from debris.page import BlikiPage from debris import template, form_to_db, rst2html, StringIO class MainPage(webapp.RequestHandler): def get(self): - blog_pages = BlikiPage.get_recent_blog_entries() - non_blog_pages = BlikiPage.get_non_blog_pages() - template(self.response, 'main.html', {'blog_pages': blog_pages, - 'non_blog_pages': non_blog_pages}) - -class BlogPage(webapp.RequestHandler): - def get(self): - pages = BlikiPage.get_recent_blog_entries() - template(self.response, 'recent.html', {'pages': pages}) + pages = BlikiPage.get_all_pages() + template(self.response, 'main.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) template(self.response, 'tag.html', {'tag': tag, 'pages': pages}) class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages - pages = BlikiPage.get_recent_entries() + pages = BlikiPage.get_all_rss_worthy_pages() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, link = page.get_url(), description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( title = 'Yet Another Debris Bliki', link = "http://www.google.com/", # XXX description = "Foo", items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), - (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/edit.html b/templates/srid/edit.html index 3118872..b3cc3f4 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,34 +1,34 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> <fieldset> <legend>Editing "{{page.path}}"</legend> <p><label for="titleID">Title</label><br/> <input id="titleID" type="text" name="title" size="75" value="{{page.title}}" /> <p><label for="pathID">Path (www.nearfar.org/&lt;Path&gt;)</label><br/> <input id="pathID" type="path" name="path" size="50" value="{{page.path}}" /> <p><label for="contentID">Content</label><br/> <textarea id="contentID" style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> <p><label for="tagsID">Tags (eg: "Python GoogleAppEngine CookbookRecipes")</label><br/> <input id="tagsID" type="text" name="tags" size="75" value="{{page.tags|join:" " }}" /> - <p><input type="checkbox" name="belongs_to_blog" - {% if page.belongs_to_blog %}checked{% endif %} /> - Belongs to blog + <p><input type="checkbox" name="rss_worthy" + {% if page.rss_worthy %}checked{% endif %} /> + RSS worthy </p> <div> <input type="submit" value="Save" /> - <input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} /> + <!-- input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} / --> </div> </fieldset> </form> {% endblock %} \ No newline at end of file diff --git a/templates/srid/main.html b/templates/srid/main.html index 0274fef..99fd6d6 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,48 +1,30 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} <div class="span-24"> <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> - is a combination of blog and wiki. There are two ways to - natigate this site:</p> + is a combination of blog and wiki.</p> </div> - <div class="span-12"> + <div class="span-24"> <div class="box"> - <p>Read the <a href="/blog">blog</a>, a listing of pages in reverse - chronological order:</p> + <p>A listing of pages in reverse chronological order:</p> <ul class="raw"> - {% for page in blog_pages %} + {% for page in pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> - <div class="span-12 last"> - <div class="box"> - <p>Or navigate by tags..</p> - - <p>(Alright, how do we aggregate appengine's ListProperty?? -- for now see pages - that do not belong to blog)</p> - - <ul class="raw"> - {% for page in non_blog_pages %} - <li><a href="/{{page.path}}">{{ page.title }}</a> - </li> - {% endfor %} - </ul> - </div> - </div> - <div class="span-24"> <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> {% endblock %} \ No newline at end of file
srid/debris
a4968ccfe3e87e0c4907f3c2da634e9e7f521b92
debris might be dropped; see README.rst for details
diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..57d7423 --- /dev/null +++ b/README.rst @@ -0,0 +1,17 @@ +**debris** is a simple bliki_ for personal purposes. + +I might drop this project and start a new one where you store pages in +git repository itself albeit with a datastore based cache to perform +GQL queries. + + +**Nice to have features:** + + - Code Cleanups + - Test cases + - Paging + - Tag clouds and other tag navigation + - Respond by email (like Google Groups UI) + + .. _bliki: http://en.wikipedia.org/wiki/Bliki + \ No newline at end of file diff --git a/README.txt b/README.txt deleted file mode 100644 index 07cab6f..0000000 --- a/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -debris is a simple bliki for personal purposes. - -Milestone 0.1 -============= - - Purpose: deploy for real world usage (www.nearfar.org) - for publishing - articles and, well, blog posts if I feel like. - - - Features - -------- - - - Backup: periodically download the datastore data - in case google goes out of business or does - something 'evil' - - Nice to have - ------------- - - - Code Cleanups - - Test cases - - Paging - - Tag clouds and other tag navigation - - Respond by email: comments are not supported, but there - should be a way to 'respond' to every page - (for UI: see reply option in google groups) - \ No newline at end of file
srid/debris
3445e3119641892fd21a5a661d3e0e52c8c2208d
refactor: use netbeans suggestions
diff --git a/debris/__init__.py b/debris/__init__.py index 1713389..6727297 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,116 +1,119 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' -import os, cgi, sys, logging, re +import os +import cgi +import sys +import re from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users from docutils import core TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # Values common to all templates go here values.update({ 'is_admin': users.is_current_user_admin(), 'login_url': users.create_login_url("/"), 'logout_url': users.create_logout_url("/") }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) # if __form_set_<key>__ is defined, use it instead of 'setattr' try: setter = getattr(model_instance, '__form_set_%s__' % key) field_value = value # need not to apply `field_type` as that will be done by the above custom setter except AttributeError: setter = lambda v: setattr(model_instance, key, v) field_value = field_type(value) setter(field_value) def rst2html(text): parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) display_tag_re = re.compile('([a-z])([A-Z])') @register.filter def display_tag(tag): """Display tag in readable way. Eg: display_tag("GoogleAppEngine") = "Google App Engine" """ return display_tag_re.sub(r'\1 \2', tag) @register.filter def display_tags(tag_list): tags = [] for tag in tag_list: tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) return ', '.join(tags) gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/debris/page.py b/debris/page.py index eb66fca..695c6c3 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,74 +1,71 @@ from google.appengine.ext import db from google.appengine.ext import search -from debris import rst2html - -from debris import SHELL class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() tags = db.StringListProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() def __form_set_tags__(self, tags_list_as_string): #SHELL() tags = tags_list_as_string.split(' ') tags = [tag.strip() for tag in tags] self.tags = tags def get_url(self): return self.path # abs url? @staticmethod def search(keywords): query = search.SearchableQuery('BlikiPage') query.Search(keywords) return query.Run() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_recent_blog_entries(): """Get all pages that were created recently and belongs to blog""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC" ) @staticmethod def get_non_blog_pages(): """Get all pages that do NOT belong to blog""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE belongs_to_blog = False ORDER BY path DESC" ) @staticmethod def get_all_by_tag(tag): """Get all pages by tag""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE tags = :1", tag ) @staticmethod def get_recent_entries(): """Get the last 10 pages that were created recently""" return db.GqlQuery( "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10" ) @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] diff --git a/import_wrapper.py b/import_wrapper.py index d964215..9cb14f2 100644 --- a/import_wrapper.py +++ b/import_wrapper.py @@ -1,7 +1,10 @@ -import os, sys, glob, logging +import os +import sys +import glob +import logging # Add 3rdparty/*.zip to sys.path so that we can import them seamlessly root = os.path.dirname(__file__) for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): logging.info("Adding 3rdparty library '%s' to sys.path" % ziplib) sys.path.insert(0, ziplib) diff --git a/index.yaml b/index.yaml index cdfcfe7..e107da8 100644 --- a/index.yaml +++ b/index.yaml @@ -1,37 +1,37 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 81 times in query history. +# Used 5 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 7 times in query history. +# Used 4 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index c6b3847..da2524c 100644 --- a/main.py +++ b/main.py @@ -1,112 +1,112 @@ -from __future__ import with_statement import import_wrapper + import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid from debris.page import BlikiPage -from debris import template, form_to_db, rst2html, StringIO, SHELL +from debris import template, form_to_db, rst2html, StringIO class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() non_blog_pages = BlikiPage.get_non_blog_pages() template(self.response, 'main.html', {'blog_pages': blog_pages, 'non_blog_pages': non_blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) template(self.response, 'tag.html', {'tag': tag, 'pages': pages}) class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages pages = BlikiPage.get_recent_entries() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, link = page.get_url(), description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( title = 'Yet Another Debris Bliki', link = "http://www.google.com/", # XXX description = "Foo", items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/edit.html b/templates/srid/edit.html index 0312527..3118872 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,33 +1,34 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> <fieldset> <legend>Editing "{{page.path}}"</legend> <p><label for="titleID">Title</label><br/> <input id="titleID" type="text" name="title" size="75" value="{{page.title}}" /> <p><label for="pathID">Path (www.nearfar.org/&lt;Path&gt;)</label><br/> <input id="pathID" type="path" name="path" size="50" value="{{page.path}}" /> <p><label for="contentID">Content</label><br/> <textarea id="contentID" style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> <p><label for="tagsID">Tags (eg: "Python GoogleAppEngine CookbookRecipes")</label><br/> <input id="tagsID" type="text" name="tags" size="75" value="{{page.tags|join:" " }}" /> <p><input type="checkbox" name="belongs_to_blog" {% if page.belongs_to_blog %}checked{% endif %} /> Belongs to blog </p> <div> <input type="submit" value="Save" /> <input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} /> </div> + </fieldset> </form> {% endblock %} \ No newline at end of file
srid/debris
2068b0e177d8fc306a87a7108124502c394c6753
move the warning to base.html
diff --git a/index.yaml b/index.yaml index 8d79651..cdfcfe7 100644 --- a/index.yaml +++ b/index.yaml @@ -1,37 +1,37 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 76 times in query history. +# Used 81 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 3 times in query history. +# Used 7 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: path direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/templates/srid/base.html b/templates/srid/base.html index c07b7b4..900f6b7 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,42 +1,48 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <link rel="alternate" type="application/rss+xml" title="New Bliki Articles" href="/RSS/all" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; + <p class="highlight"> + Please note that this site is a <b>test deployment environment</b> for + a software that I am currently writing. It will eventually become a place + for me to write; until then what you will see here is just random text. + </p> + </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> {% if is_admin %} <a href="/-/admin/newpage">New Page</a> | <a href="{{ logout_url }}"><b>Logout</b></a> | {% else %} <a href="{{ login_url }}" style="color: white;">Login</a> {% endif %} <a href="/">Home</a> | <a href="/AboutThisSite">About</a> <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> </form> --> </div> </div> </body> </html> diff --git a/templates/srid/main.html b/templates/srid/main.html index 8315119..0274fef 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,54 +1,48 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} <div class="span-24"> - <p class="highlight"> - Please note that this site is a <b>test deployment environment</b> for - a software that I am currently writing. It will eventually become a place - for me to write; until then what you will see here is just random text. - </p> - <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> is a combination of blog and wiki. There are two ways to natigate this site:</p> </div> <div class="span-12"> <div class="box"> <p>Read the <a href="/blog">blog</a>, a listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in blog_pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-12 last"> <div class="box"> <p>Or navigate by tags..</p> <p>(Alright, how do we aggregate appengine's ListProperty?? -- for now see pages that do not belong to blog)</p> <ul class="raw"> {% for page in non_blog_pages %} <li><a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-24"> <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> {% endblock %} \ No newline at end of file
srid/debris
b5e333c62c16f96ebe1df107d8c296e8feab1dc9
list other pages in main page for now
diff --git a/README.txt b/README.txt index 7c04ec6..07cab6f 100644 --- a/README.txt +++ b/README.txt @@ -1,26 +1,27 @@ debris is a simple bliki for personal purposes. Milestone 0.1 ============= Purpose: deploy for real world usage (www.nearfar.org) - for publishing articles and, well, blog posts if I feel like. Features -------- - Backup: periodically download the datastore data in case google goes out of business or does something 'evil' Nice to have ------------- - Code Cleanups - Test cases - Paging + - Tag clouds and other tag navigation - Respond by email: comments are not supported, but there should be a way to 'respond' to every page (for UI: see reply option in google groups) \ No newline at end of file diff --git a/debris/page.py b/debris/page.py index c5df19c..eb66fca 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,67 +1,74 @@ from google.appengine.ext import db from google.appengine.ext import search from debris import rst2html from debris import SHELL class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() tags = db.StringListProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() def __form_set_tags__(self, tags_list_as_string): #SHELL() tags = tags_list_as_string.split(' ') tags = [tag.strip() for tag in tags] self.tags = tags def get_url(self): return self.path # abs url? @staticmethod def search(keywords): query = search.SearchableQuery('BlikiPage') query.Search(keywords) return query.Run() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_recent_blog_entries(): """Get all pages that were created recently and belongs to blog""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC" ) + @staticmethod + def get_non_blog_pages(): + """Get all pages that do NOT belong to blog""" + return db.GqlQuery( + "SELECT * FROM BlikiPage WHERE belongs_to_blog = False ORDER BY path DESC" + ) + @staticmethod def get_all_by_tag(tag): """Get all pages by tag""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE tags = :1", tag ) @staticmethod def get_recent_entries(): """Get the last 10 pages that were created recently""" return db.GqlQuery( "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10" ) @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] diff --git a/index.yaml b/index.yaml index 2d56495..8d79651 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,37 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 61 times in query history. +# Used 76 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc +# Used 3 times in query history. +- kind: BlikiPage + properties: + - name: belongs_to_blog + - name: path + direction: desc + # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index ac91ae6..c6b3847 100644 --- a/main.py +++ b/main.py @@ -1,110 +1,112 @@ from __future__ import with_statement import import_wrapper import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid from debris.page import BlikiPage from debris import template, form_to_db, rst2html, StringIO, SHELL class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() - template(self.response, 'main.html', {'blog_pages': blog_pages}) + non_blog_pages = BlikiPage.get_non_blog_pages() + template(self.response, 'main.html', {'blog_pages': blog_pages, + 'non_blog_pages': non_blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewTagPage(webapp.RequestHandler): def get(self, tag): pages = BlikiPage.get_all_by_tag(tag) template(self.response, 'tag.html', {'tag': tag, 'pages': pages}) class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages pages = BlikiPage.get_recent_entries() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, link = page.get_url(), description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( title = 'Yet Another Debris Bliki', link = "http://www.google.com/", # XXX description = "Foo", items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/main.html b/templates/srid/main.html index 0ae44dc..8315119 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,46 +1,54 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} <div class="span-24"> <p class="highlight"> Please note that this site is a <b>test deployment environment</b> for a software that I am currently writing. It will eventually become a place for me to write; until then what you will see here is just random text. </p> <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> is a combination of blog and wiki. There are two ways to natigate this site:</p> </div> <div class="span-12"> <div class="box"> <p>Read the <a href="/blog">blog</a>, a listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in blog_pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} - </ul> + </ul> </div> </div> <div class="span-12 last"> <div class="box"> <p>Or navigate by tags..</p> - (Alright, how do we aggregate appengine's ListProperty??) + <p>(Alright, how do we aggregate appengine's ListProperty?? -- for now see pages + that do not belong to blog)</p> + + <ul class="raw"> + {% for page in non_blog_pages %} + <li><a href="/{{page.path}}">{{ page.title }}</a> + </li> + {% endfor %} + </ul> </div> </div> <div class="span-24"> <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> {% endblock %} \ No newline at end of file
srid/debris
a85299d76e67d7691522b3587c09fdd6d1858d77
warning text
diff --git a/README.txt b/README.txt index 9e304b5..7c04ec6 100644 --- a/README.txt +++ b/README.txt @@ -1,29 +1,26 @@ debris is a simple bliki for personal purposes. Milestone 0.1 ============= Purpose: deploy for real world usage (www.nearfar.org) - for publishing articles and, well, blog posts if I feel like. Features -------- - - Categories: pages should be navigatable by categories - (just like wikipedia?) - - Backup: periodically download the datastore data in case google goes out of business or does something 'evil' Nice to have ------------- - Code Cleanups - Test cases - Paging - Respond by email: comments are not supported, but there should be a way to 'respond' to every page (for UI: see reply option in google groups) \ No newline at end of file diff --git a/index.yaml b/index.yaml index 6bb0a6e..2d56495 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 54 times in query history. +# Used 61 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/templates/srid/main.html b/templates/srid/main.html index 23c4f3e..0ae44dc 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,38 +1,46 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} <div class="span-24"> + <p class="highlight"> + Please note that this site is a <b>test deployment environment</b> for + a software that I am currently writing. It will eventually become a place + for me to write; until then what you will see here is just random text. + </p> + <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> is a combination of blog and wiki. There are two ways to natigate this site:</p> </div> <div class="span-12"> <div class="box"> <p>Read the <a href="/blog">blog</a>, a listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in blog_pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-12 last"> <div class="box"> - <p>Or navigate by categories..</p> + <p>Or navigate by tags..</p> + + (Alright, how do we aggregate appengine's ListProperty??) </div> </div> <div class="span-24"> <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> <hr /> {% endblock %} \ No newline at end of file
srid/debris
01dfe10a6c3a1c8383ba28c64df1f488368db602
tag support
diff --git a/README.txt b/README.txt index 914399f..9e304b5 100644 --- a/README.txt +++ b/README.txt @@ -1 +1,29 @@ debris is a simple bliki for personal purposes. + +Milestone 0.1 +============= + + Purpose: deploy for real world usage (www.nearfar.org) - for publishing + articles and, well, blog posts if I feel like. + + + Features + -------- + + - Categories: pages should be navigatable by categories + (just like wikipedia?) + + - Backup: periodically download the datastore data + in case google goes out of business or does + something 'evil' + + Nice to have + ------------- + + - Code Cleanups + - Test cases + - Paging + - Respond by email: comments are not supported, but there + should be a way to 'respond' to every page + (for UI: see reply option in google groups) + \ No newline at end of file diff --git a/debris/__init__.py b/debris/__init__.py index 450f439..1713389 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,99 +1,116 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' -import os, cgi, sys, logging +import os, cgi, sys, logging, re from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users from docutils import core TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) - - # generate the greeting urls (login/logout) - user = users.get_current_user() - if user: - greeting = "Welcome %s! <a href=\"%s\">Logout</a>" % \ - (user.nickname(), users.create_logout_url("/")) - else: - greeting = "<a href=\"%s\">Login</a>" % users.create_login_url("/") - + + # Values common to all templates go here values.update({ - 'auth_greeting': greeting + 'is_admin': users.is_current_user_admin(), + 'login_url': users.create_login_url("/"), + 'logout_url': users.create_logout_url("/") }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) + + # if __form_set_<key>__ is defined, use it instead of 'setattr' + try: + setter = getattr(model_instance, '__form_set_%s__' % key) + field_value = value # need not to apply `field_type` as that will be done by the above custom setter + except AttributeError: + setter = lambda v: setattr(model_instance, key, v) + field_value = field_type(value) - field_value = field_type(value) - setattr(model_instance, key, field_value) + setter(field_value) def rst2html(text): parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) +display_tag_re = re.compile('([a-z])([A-Z])') [email protected] +def display_tag(tag): + """Display tag in readable way. + Eg: display_tag("GoogleAppEngine") = "Google App Engine" + """ + return display_tag_re.sub(r'\1 \2', tag) + [email protected] +def display_tags(tag_list): + tags = [] + for tag in tag_list: + tags.append('<a href="/tag/%s">%s</a>' % (tag, display_tag(tag))) + return ', '.join(tags) + gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/debris/page.py b/debris/page.py index 9916cc3..c5df19c 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,65 +1,67 @@ from google.appengine.ext import db from google.appengine.ext import search from debris import rst2html +from debris import SHELL + class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() + tags = db.StringListProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() + def __form_set_tags__(self, tags_list_as_string): + #SHELL() + tags = tags_list_as_string.split(' ') + tags = [tag.strip() for tag in tags] + self.tags = tags + def get_url(self): return self.path # abs url? @staticmethod def search(keywords): query = search.SearchableQuery('BlikiPage') query.Search(keywords) return query.Run() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_recent_blog_entries(): - """Get the last 10 pages that were created recently and belongs to blog""" + """Get all pages that were created recently and belongs to blog""" + return db.GqlQuery( + "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC" + ) + + @staticmethod + def get_all_by_tag(tag): + """Get all pages by tag""" return db.GqlQuery( - "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC LIMIT 10" + "SELECT * FROM BlikiPage WHERE tags = :1", tag ) @staticmethod def get_recent_entries(): """Get the last 10 pages that were created recently""" return db.GqlQuery( "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10" ) @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] - -class SpecialPage(object): - - @property - def title(self): - return 'Special/%s' % self.__class__.__name__ - - -class AllPages(SpecialPage): - - @property - def content(self): - return 'Foo' - \ No newline at end of file diff --git a/index.yaml b/index.yaml index cd30880..6bb0a6e 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 8 times in query history. +# Used 54 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used once in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 80585cd..ac91ae6 100644 --- a/main.py +++ b/main.py @@ -1,110 +1,110 @@ from __future__ import with_statement import import_wrapper import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid -from debris.page import BlikiPage, AllPages +from debris.page import BlikiPage from debris import template, form_to_db, rst2html, StringIO, SHELL class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() template(self.response, 'main.html', {'blog_pages': blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', - {'page': page}) - -class ViewSpecialPage(webapp.RequestHandler): - def get(self, path): - page = AllPages() - template(self.response, 'specialpage.html', {'page': page}) + {'page': page}) +class ViewTagPage(webapp.RequestHandler): + def get(self, tag): + pages = BlikiPage.get_all_by_tag(tag) + template(self.response, 'tag.html', {'tag': tag, 'pages': pages}) + class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages pages = BlikiPage.get_recent_entries() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, link = page.get_url(), description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( title = 'Yet Another Debris Bliki', link = "http://www.google.com/", # XXX description = "Foo", items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name class SearchPage(webapp.RequestHandler): def get(self): q = self.request.get('q') results = BlikiPage.search(q) template(self.response, 'search.html', {'results': results, 'q': q}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), - (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), + (r'/tag/([0-9a-zA-Z]+)', ViewTagPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/srid.css b/static/srid.css index 3a5faf5..c31c6ad 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,20 +1,35 @@ div.container { /* since blueprintcss sets the font-size to 75%, we * increase the size again here */ font-size: 120%; } div.page h2 a{ text-decoration: none; color: inherit; } div.footer { text-align: right; } ul.raw { list-style-type: none; margin: 0 0 0 1em; padding: 0; +} + +p.page_meta { + font-size: 80%; + color: #999999; + float: right; +} + +p.page_meta a { + text-decoration: none; + color: inherit; +} + +p.page_meta a:hover { + color: black; } \ No newline at end of file diff --git a/templates/srid/base.html b/templates/srid/base.html index d905631..c07b7b4 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,36 +1,42 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <link rel="alternate" type="application/rss+xml" title="New Bliki Articles" href="/RSS/all" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> - <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | - <a href="/AboutThisSite">About</a> | - {{ auth_greeting }} | - <a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | + {% if is_admin %} + <a href="/-/admin/newpage">New Page</a> | + <a href="{{ logout_url }}"><b>Logout</b></a> | + {% else %} + <a href="{{ login_url }}" style="color: white;">Login</a> + {% endif %} + <a href="/">Home</a> | + <a href="/AboutThisSite">About</a> + + <!-- a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | <form action="/Search" method="GET"> <input type="text" name="q" /> <input type="submit" value="search" /> - </form> + </form> --> </div> </div> </body> </html> diff --git a/templates/srid/edit.html b/templates/srid/edit.html index cdb55c0..0312527 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,24 +1,33 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> - <div><input type="text" name="title" size="75" - value="{{page.title}}" /> (title)</div> - <div>http://debris.nearfar.org/<input type="path" name="path" size="50" - value="{{page.path}}" /> (path)</div> - <div> - <textarea style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> - (<a href="https://addons.mozilla.org/en-US/firefox/addon/4125">firefox</a> - and emacs are your friends) - </div> - <div><input type="checkbox" name="belongs_to_blog" + + <fieldset> + <legend>Editing "{{page.path}}"</legend> + + <p><label for="titleID">Title</label><br/> + <input id="titleID" type="text" name="title" size="75" value="{{page.title}}" /> + + <p><label for="pathID">Path (www.nearfar.org/&lt;Path&gt;)</label><br/> + <input id="pathID" type="path" name="path" size="50" value="{{page.path}}" /> + + <p><label for="contentID">Content</label><br/> + <textarea id="contentID" style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> + + <p><label for="tagsID">Tags (eg: "Python GoogleAppEngine CookbookRecipes")</label><br/> + <input id="tagsID" type="text" name="tags" size="75" value="{{page.tags|join:" " }}" /> + + <p><input type="checkbox" name="belongs_to_blog" {% if page.belongs_to_blog %}checked{% endif %} /> - Belongs to blog</div> + Belongs to blog + </p> + <div> <input type="submit" value="Save" /> <input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} /> </div> </form> {% endblock %} \ No newline at end of file diff --git a/templates/srid/part-blikipage.html b/templates/srid/part-blikipage.html index d9fb5ff..d80b80d 100644 --- a/templates/srid/part-blikipage.html +++ b/templates/srid/part-blikipage.html @@ -1,6 +1,15 @@ {% extends "part-page.html" %} {% block extra %} - Created on {{ page.created_date|date:"d M Y" }} by srid - (<a href="/-/admin/edit/{{page.path}}">edit</a>) + <b>Created</b> on {{ page.created_date|date:"d M Y" }} by srid + + {% if page.tags %} + <br/> + <b>Tagged</b> {{ page.tags|display_tags }} + {% endif %} + + {% if is_admin %} + <br/> + (<a href="/-/admin/edit/{{page.path}}">edit</a>) + {% endif %} {% endblock %} \ No newline at end of file diff --git a/templates/srid/part-page.html b/templates/srid/part-page.html index ae4fa26..d10c273 100644 --- a/templates/srid/part-page.html +++ b/templates/srid/part-page.html @@ -1,10 +1,10 @@ <div class="page"> <h2><a href="/{{ page.path }}">{{ page.title }}</a></h2> <p> {{ page.content|rstify }} </p> - <p class="small"> + <p class="page_meta"> {% block extra %}{% endblock %} </p> <hr /> </div> \ No newline at end of file diff --git a/templates/srid/tag.html b/templates/srid/tag.html new file mode 100644 index 0000000..f75fc51 --- /dev/null +++ b/templates/srid/tag.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block title %}Pages tagged '{{tag|display_tag}}'{% endblock %} +{% block content %} + {% for page in pages %} + {% include "part-blikipage.html" %} + {% endfor %} + +{% endblock %} \ No newline at end of file
srid/debris
cc7d7fef8412d1f8bf769597457ab9ffe1443d2d
implement search
diff --git a/debris/__init__.py b/debris/__init__.py index 5fa5c88..450f439 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,97 +1,99 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys, logging from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users +from docutils import core + + TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # generate the greeting urls (login/logout) user = users.get_current_user() if user: greeting = "Welcome %s! <a href=\"%s\">Logout</a>" % \ (user.nickname(), users.create_logout_url("/")) else: greeting = "<a href=\"%s\">Login</a>" % users.create_login_url("/") values.update({ 'auth_greeting': greeting }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): - from docutils import core parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'data/html4css1/html4css1.css', 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/debris/page.py b/debris/page.py index 9ccd2ba..9916cc3 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,58 +1,65 @@ from google.appengine.ext import db +from google.appengine.ext import search from debris import rst2html class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() def get_url(self): return self.path # abs url? + @staticmethod + def search(keywords): + query = search.SearchableQuery('BlikiPage') + query.Search(keywords) + return query.Run() + @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_recent_blog_entries(): """Get the last 10 pages that were created recently and belongs to blog""" return db.GqlQuery( "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC LIMIT 10" ) @staticmethod def get_recent_entries(): """Get the last 10 pages that were created recently""" return db.GqlQuery( "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10" ) @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] class SpecialPage(object): @property def title(self): return 'Special/%s' % self.__class__.__name__ class AllPages(SpecialPage): @property def content(self): return 'Foo' \ No newline at end of file diff --git a/index.yaml b/index.yaml index d654940..cd30880 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 25 times in query history. +# Used 8 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 9 times in query history. +# Used once in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 9001ab6..80585cd 100644 --- a/main.py +++ b/main.py @@ -1,103 +1,110 @@ from __future__ import with_statement import import_wrapper import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from PyRSS2Gen import RSS2, RSSItem, Guid from debris.page import BlikiPage, AllPages from debris import template, form_to_db, rst2html, StringIO, SHELL class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() template(self.response, 'main.html', {'blog_pages': blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewSpecialPage(webapp.RequestHandler): def get(self, path): page = AllPages() template(self.response, 'specialpage.html', {'page': page}) class ViewRSSPage(webapp.RequestHandler): def get(self, name): if name == "all": # RSS of newly created pages pages = BlikiPage.get_recent_entries() rss_items = [] for page in pages: rss_items.append(RSSItem( title = page.title, link = page.get_url(), description = rst2html(page.content), guid = Guid(page.get_url()), pubDate = page.created_date )) rss = RSS2( title = 'Yet Another Debris Bliki', link = "http://www.google.com/", # XXX description = "Foo", items = rss_items ) self.response.headers['Content-Type'] = 'application/rss+xml' with StringIO() as sio: rss.write_xml(sio) self.response.out.write(sio.getvalue()) else: raise Exception, 'unknown RSS type "%s"' % name +class SearchPage(webapp.RequestHandler): + def get(self): + q = self.request.get('q') + results = BlikiPage.search(q) + template(self.response, 'search.html', {'results': results, 'q': q}) + class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), + (r'/Search', SearchPage), (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/base.html b/templates/srid/base.html index a949b5d..d905631 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,32 +1,36 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <link rel="alternate" type="application/rss+xml" title="New Bliki Articles" href="/RSS/all" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | <a href="/AboutThisSite">About</a> | {{ auth_greeting }} | - <a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> + <a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> | + <form action="/Search" method="GET"> + <input type="text" name="q" /> + <input type="submit" value="search" /> + </form> </div> </div> </body> </html> diff --git a/templates/srid/search.html b/templates/srid/search.html new file mode 100644 index 0000000..d45c719 --- /dev/null +++ b/templates/srid/search.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% block title %}Search '{{q}}'{% endblock %} + +{% block content %} + <h2>Search '{{q}}'</h2> + {% for result in results %} + <li><a href="/{{ result.path }}">{{ result.title }}</a>: {{ ressult.content|truncatewords:10 }} </li> + {% endfor %} +{% endblock %} \ No newline at end of file
srid/debris
852235af1a15123f950707f1347b0331485970c5
fix: keep a copy of html4css1.css in static/ directory for css reference in HTML
diff --git a/static/docutils/html4css1/html4css1.css b/static/docutils/html4css1/html4css1.css new file mode 100644 index 0000000..a1e39f4 --- /dev/null +++ b/static/docutils/html4css1/html4css1.css @@ -0,0 +1,273 @@ +/* +:Author: David Goodger ([email protected]) +:Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $ +:Copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. +*/ + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 ! important } + +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } + +a.toc-backref { + text-decoration: none ; + color: black } + +blockquote.epigraph { + margin: 2em 5em ; } + +dl.docutils dd { + margin-bottom: 0.5em } + +/* Uncomment (and remove this text!) to get bold-faced definition list terms +dl.docutils dt { + font-weight: bold } +*/ + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em ; + margin-right: 2em } + +div.footer, div.header { + clear: both; + font-size: smaller } + +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin: 0 0 0.5em 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr.docutils { + width: 75% } + +img.align-left { + clear: left } + +img.align-right { + clear: right } + +ol.simple, ul.simple { + margin-bottom: 1em } + +ol.arabic { + list-style: decimal } + +ol.loweralpha { + list-style: lower-alpha } + +ol.upperalpha { + list-style: upper-alpha } + +ol.lowerroman { + list-style: lower-roman } + +ol.upperroman { + list-style: upper-roman } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font-family: serif ; + font-size: 100% } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid 1px gray; + margin-left: 1px } + +table.docinfo { + margin: 2em 4em } + +table.docutils { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.footnote { + border-left: solid 1px black; + margin-left: 1px } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +table.docutils th.field-name, table.docinfo th.docinfo-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + padding-left: 0 } + +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { + font-size: 100% } + +ul.auto-toc { + list-style-type: none }
srid/debris
9696c43c6470e73fbef925909a89c482cf69be45
fix: use separate data directory for files that has to be read (eg: docutils template.txt) to work around a restriction in GAE
diff --git a/static/docutils/html4css1/html4css1.css b/data/docutils/html4css1/html4css1.css similarity index 100% rename from static/docutils/html4css1/html4css1.css rename to data/docutils/html4css1/html4css1.css diff --git a/static/docutils/html4css1/template.txt b/data/docutils/html4css1/template.txt similarity index 100% rename from static/docutils/html4css1/template.txt rename to data/docutils/html4css1/template.txt diff --git a/debris/__init__.py b/debris/__init__.py index e74ca9b..5fa5c88 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,97 +1,97 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys, logging from contextlib import contextmanager from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # generate the greeting urls (login/logout) user = users.get_current_user() if user: greeting = "Welcome %s! <a href=\"%s\">Logout</a>" % \ (user.nickname(), users.create_logout_url("/")) else: greeting = "<a href=\"%s\">Login</a>" % users.create_login_url("/") values.update({ 'auth_greeting': greeting }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, - 'stylesheet_path': 'static/html4css1/html4css1.css', - 'template': 'static/docutils/html4css1/template.txt' + 'stylesheet_path': 'data/html4css1/html4css1.css', + 'template': 'data/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself @contextmanager def StringIO(): """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO sio = StringIO() try: yield sio finally: sio.close() diff --git a/index.yaml b/index.yaml index 97e4f16..d654940 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 23 times in query history. +# Used 25 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 5 times in query history. +# Used 9 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc
srid/debris
3f259c37ebdb3ca822d481d2a5ddfae695dbf691
add RSS support
diff --git a/3rdparty/PyRSS2Gen-1.0.0.zip b/3rdparty/PyRSS2Gen-1.0.0.zip new file mode 100644 index 0000000..a99c552 Binary files /dev/null and b/3rdparty/PyRSS2Gen-1.0.0.zip differ diff --git a/debris/__init__.py b/debris/__init__.py index 6350c91..e74ca9b 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,79 +1,97 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys, logging +from contextlib import contextmanager + from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # generate the greeting urls (login/logout) user = users.get_current_user() if user: greeting = "Welcome %s! <a href=\"%s\">Logout</a>" % \ (user.nickname(), users.create_logout_url("/")) else: greeting = "<a href=\"%s\">Login</a>" % users.create_login_url("/") values.update({ 'auth_greeting': greeting }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts( text, writer_name='html4css1', settings_overrides={ '_disable_config': True, 'embed_stylesheet': False, 'stylesheet_path': 'static/html4css1/html4css1.css', 'template': 'static/docutils/html4css1/template.txt' }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself + +@contextmanager +def StringIO(): + """Add support for 'with' statement to StringIO - http://bugs.python.org/issue1286 + """ + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO + + sio = StringIO() + + try: + yield sio + finally: + sio.close() diff --git a/debris/page.py b/debris/page.py index fc1c288..9ccd2ba 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,47 +1,58 @@ from google.appengine.ext import db from debris import rst2html class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() + def get_url(self): + return self.path # abs url? + @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_recent_blog_entries(): """Get the last 10 pages that were created recently and belongs to blog""" return db.GqlQuery( - "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC LIMIT 10") + "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC LIMIT 10" + ) + + @staticmethod + def get_recent_entries(): + """Get the last 10 pages that were created recently""" + return db.GqlQuery( + "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10" + ) @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] class SpecialPage(object): @property def title(self): return 'Special/%s' % self.__class__.__name__ class AllPages(SpecialPage): @property def content(self): return 'Foo' \ No newline at end of file diff --git a/index.yaml b/index.yaml index 5f4da0d..97e4f16 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 21 times in query history. +# Used 23 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Unused in query history -- copied from input. +# Used 5 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 9e2f2dd..9001ab6 100644 --- a/main.py +++ b/main.py @@ -1,71 +1,103 @@ -import logging - +from __future__ import with_statement import import_wrapper +import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app +from PyRSS2Gen import RSS2, RSSItem, Guid + from debris.page import BlikiPage, AllPages -from debris import template, form_to_db, SHELL +from debris import template, form_to_db, rst2html, StringIO, SHELL class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() template(self.response, 'main.html', {'blog_pages': blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewSpecialPage(webapp.RequestHandler): def get(self, path): page = AllPages() template(self.response, 'specialpage.html', {'page': page}) +class ViewRSSPage(webapp.RequestHandler): + def get(self, name): + if name == "all": + # RSS of newly created pages + pages = BlikiPage.get_recent_entries() + rss_items = [] + for page in pages: + rss_items.append(RSSItem( + title = page.title, + link = page.get_url(), + description = rst2html(page.content), + guid = Guid(page.get_url()), + pubDate = page.created_date + )) + + rss = RSS2( + title = 'Yet Another Debris Bliki', + link = "http://www.google.com/", # XXX + description = "Foo", + items = rss_items + ) + + self.response.headers['Content-Type'] = 'application/rss+xml' + with StringIO() as sio: + rss.write_xml(sio) + self.response.out.write(sio.getvalue()) + else: + raise Exception, 'unknown RSS type "%s"' % name + class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), + (r'/RSS/([0-9a-zA-Z]+)', ViewRSSPage), (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/base.html b/templates/srid/base.html index 71ad3f4..a949b5d 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,30 +1,32 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> + + <link rel="alternate" type="application/rss+xml" title="New Bliki Articles" href="/RSS/all" /> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | <a href="/AboutThisSite">About</a> | {{ auth_greeting }} | <a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> </div> </div> </body> </html>
srid/debris
40816f7a40373ce156e56caf896fd5886a5d5959
move zip imports code to module in order to cache it
diff --git a/import_wrapper.py b/import_wrapper.py new file mode 100644 index 0000000..d964215 --- /dev/null +++ b/import_wrapper.py @@ -0,0 +1,7 @@ +import os, sys, glob, logging + +# Add 3rdparty/*.zip to sys.path so that we can import them seamlessly +root = os.path.dirname(__file__) +for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): + logging.info("Adding 3rdparty library '%s' to sys.path" % ziplib) + sys.path.insert(0, ziplib) diff --git a/index.yaml b/index.yaml index 145f4ef..5f4da0d 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 10 times in query history. +# Used 21 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index a28a366..9e2f2dd 100644 --- a/main.py +++ b/main.py @@ -1,73 +1,71 @@ -import os, glob, sys, logging +import logging + +import import_wrapper from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.page import BlikiPage, AllPages from debris import template, form_to_db, SHELL + class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() template(self.response, 'main.html', {'blog_pages': blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewSpecialPage(webapp.RequestHandler): def get(self, path): page = AllPages() template(self.response, 'specialpage.html', {'page': page}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) - application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): - root = os.path.dirname(__file__) - for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): - logging.info("Adding 3rdparty library '%s' to sys.path" % ziplib) - sys.path.insert(0, ziplib) run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/base.html b/templates/srid/base.html index 3bf413a..71ad3f4 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,29 +1,30 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | <a href="/AboutThisSite">About</a> | - {{ auth_greeting }} + {{ auth_greeting }} | + <a href="http://creativecommons.org/licenses/by/2.5/ca/">Rights</a> </div> </div> </body> </html>
srid/debris
b9caee1b8c824fc48212c985cd6a0e428f184c96
3rdparty libraryes (such as docutils) now belong to their own zip files
diff --git a/3rdparty/docutils.zip b/3rdparty/docutils.zip new file mode 100644 index 0000000..c822d71 Binary files /dev/null and b/3rdparty/docutils.zip differ diff --git a/debris/__init__.py b/debris/__init__.py index 41047fd..6350c91 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,71 +1,79 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys, logging from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) # generate the greeting urls (login/logout) user = users.get_current_user() if user: greeting = "Welcome %s! <a href=\"%s\">Logout</a>" % \ (user.nickname(), users.create_logout_url("/")) else: greeting = "<a href=\"%s\">Login</a>" % users.create_login_url("/") values.update({ 'auth_greeting': greeting }) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core - parts = core.publish_parts(text, writer_name='html4css1', settings_overrides={'_disable_config': True}) + parts = core.publish_parts( + text, + writer_name='html4css1', + settings_overrides={ + '_disable_config': True, + 'embed_stylesheet': False, + 'stylesheet_path': 'static/html4css1/html4css1.css', + 'template': 'static/docutils/html4css1/template.txt' + }) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself diff --git a/index.yaml b/index.yaml index cf52a75..145f4ef 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 3 times in query history. +# Used 10 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc # Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index a6f594c..a28a366 100644 --- a/main.py +++ b/main.py @@ -1,69 +1,73 @@ -import logging +import os, glob, sys, logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.page import BlikiPage, AllPages from debris import template, form_to_db, SHELL class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() template(self.response, 'main.html', {'blog_pages': blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewSpecialPage(webapp.RequestHandler): def get(self, path): page = AllPages() template(self.response, 'specialpage.html', {'page': page}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): + root = os.path.dirname(__file__) + for ziplib in glob.glob(os.path.join(root, '3rdparty', '*.zip')): + logging.info("Adding 3rdparty library '%s' to sys.path" % ziplib) + sys.path.insert(0, ziplib) run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/docutils/html4css1/html4css1.css b/static/docutils/html4css1/html4css1.css new file mode 100644 index 0000000..a1e39f4 --- /dev/null +++ b/static/docutils/html4css1/html4css1.css @@ -0,0 +1,273 @@ +/* +:Author: David Goodger ([email protected]) +:Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $ +:Copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. +*/ + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 ! important } + +.last, .with-subtitle { + margin-bottom: 0 ! important } + +.hidden { + display: none } + +a.toc-backref { + text-decoration: none ; + color: black } + +blockquote.epigraph { + margin: 2em 5em ; } + +dl.docutils dd { + margin-bottom: 0.5em } + +/* Uncomment (and remove this text!) to get bold-faced definition list terms +dl.docutils dt { + font-weight: bold } +*/ + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +/* Uncomment (and remove this text!) to get reduced vertical space in + compound paragraphs. +div.compound .compound-first, div.compound .compound-middle { + margin-bottom: 0.5em } + +div.compound .compound-last, div.compound .compound-middle { + margin-top: 0.5em } +*/ + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em ; + margin-right: 2em } + +div.footer, div.header { + clear: both; + font-size: smaller } + +div.line-block { + display: block ; + margin-top: 1em ; + margin-bottom: 1em } + +div.line-block div.line-block { + margin-top: 0 ; + margin-bottom: 0 ; + margin-left: 1.5em } + +div.sidebar { + margin: 0 0 0.5em 1em ; + border: medium outset ; + padding: 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, +h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { + margin-top: 0.4em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr.docutils { + width: 75% } + +img.align-left { + clear: left } + +img.align-right { + clear: right } + +ol.simple, ul.simple { + margin-bottom: 1em } + +ol.arabic { + list-style: decimal } + +ol.loweralpha { + list-style: lower-alpha } + +ol.upperalpha { + list-style: upper-alpha } + +ol.lowerroman { + list-style: lower-roman } + +ol.upperroman { + list-style: upper-roman } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font-family: serif ; + font-size: 100% } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80% } + +table.citation { + border-left: solid 1px gray; + margin-left: 1px } + +table.docinfo { + margin: 2em 4em } + +table.docutils { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.footnote { + border-left: solid 1px black; + margin-left: 1px } + +table.docutils td, table.docutils th, +table.docinfo td, table.docinfo th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +table.docutils th.field-name, table.docinfo th.docinfo-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + padding-left: 0 } + +h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, +h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { + font-size: 100% } + +ul.auto-toc { + list-style-type: none } diff --git a/static/docutils/html4css1/template.txt b/static/docutils/html4css1/template.txt new file mode 100644 index 0000000..2591bce --- /dev/null +++ b/static/docutils/html4css1/template.txt @@ -0,0 +1,8 @@ +%(head_prefix)s +%(head)s +%(stylesheet)s +%(body_prefix)s +%(body_pre_docinfo)s +%(docinfo)s +%(body)s +%(body_suffix)s diff --git a/templates/srid/base.html b/templates/srid/base.html index 0b04eae..3bf413a 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,26 +1,29 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> - <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> + + <link rel="stylesheet" href="/static/srid.css" type="text/css"> + + <link rel="stylesheet" href="/static/docutils/html4css1/html4css1.css" type="text/css"> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | <a href="/AboutThisSite">About</a> | {{ auth_greeting }} </div> </div> </body> </html>
srid/debris
209564e47cff8f0d202bed32ba8d25781e9361bd
refactor: remove admin_only decorator in favor of the 'login' keyword in app.yaml
diff --git a/app.yaml b/app.yaml index 578abd3..c09f094 100644 --- a/app.yaml +++ b/app.yaml @@ -1,12 +1,16 @@ application: debris-1 version: 1 runtime: python api_version: 1 handlers: - url: /static static_dir: static +- url: /-/admin/.* + script: main.py + login: admin + - url: /.* script: main.py \ No newline at end of file diff --git a/debris/__init__.py b/debris/__init__.py index 056b12d..41047fd 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,70 +1,71 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys, logging from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) + + # generate the greeting urls (login/logout) + user = users.get_current_user() + if user: + greeting = "Welcome %s! <a href=\"%s\">Logout</a>" % \ + (user.nickname(), users.create_logout_url("/")) + else: + greeting = "<a href=\"%s\">Login</a>" % users.create_login_url("/") + + values.update({ + 'auth_greeting': greeting + }) response.out.write(gae_template.render(path, values)) + def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = request.get(key, default_value=None) field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated # Skip fields that are not part of form (value == None), except in the # case of HTML checkbox where the corresponding form field in request.get # is 'absent by design' if the checkbox is unchecked # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html # to understand how Google works around this HTML spec wart. if value == None and field_type is not bool: continue if value is not None: value = cgi.escape(value) field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts(text, writer_name='html4css1', settings_overrides={'_disable_config': True}) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself -def admin_only(handler_method): - """Decorator to restrict a method to be run by site administrator only""" - def check_login(self, *args, **kwargs): - user = users.get_current_user() - is_admin = users.is_current_user_admin() - if not user: - self.redirect(users.create_login_url(self.request.uri)) - elif is_admin: - handler_method(self, *args, **kwargs) - else: - self.error(403) - return check_login diff --git a/index.yaml b/index.yaml index 2eac8fc..cf52a75 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 16 times in query history. +# Used 3 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc -# Used 23 times in query history. +# Unused in query history -- copied from input. - kind: BlikiPage properties: - name: created_date direction: desc -# Used 71 times in query history. +# Unused in query history -- copied from input. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index a63bcbc..a6f594c 100644 --- a/main.py +++ b/main.py @@ -1,72 +1,69 @@ import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.page import BlikiPage, AllPages -from debris import template, form_to_db, SHELL, admin_only +from debris import template, form_to_db, SHELL class MainPage(webapp.RequestHandler): def get(self): blog_pages = BlikiPage.get_recent_blog_entries() template(self.response, 'main.html', {'blog_pages': blog_pages}) class BlogPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) class ViewBlikiPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class ViewSpecialPage(webapp.RequestHandler): def get(self, path): page = AllPages() template(self.response, 'specialpage.html', {'page': page}) class Admin_NewPage(webapp.RequestHandler): - @admin_only def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) - @admin_only + def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_EditPage(webapp.RequestHandler): - @admin_only def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) - @admin_only def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/templates/srid/base.html b/templates/srid/base.html index 80e5048..0b04eae 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,25 +1,26 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | - <a href="/AboutThisSite">About</a> + <a href="/AboutThisSite">About</a> | + {{ auth_greeting }} </div> </div> </body> </html>
srid/debris
5654f9e342cfdf197a064e60d78b8d2ec8190d99
fix: make belongs_to_blog checkbox work
diff --git a/debris/__init__.py b/debris/__init__.py index 3af6e17..056b12d 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,59 +1,70 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' -import os, cgi, sys +import os, cgi, sys, logging from google.appengine.ext.webapp import template as gae_template from google.appengine.api import users TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): - value = cgi.escape(request.get(key)) - if value == "": # not available in form - continue + value = request.get(key, default_value=None) + field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated + + # Skip fields that are not part of form (value == None), except in the + # case of HTML checkbox where the corresponding form field in request.get + # is 'absent by design' if the checkbox is unchecked + # See http://code.google.com/appengine/docs/python/tools/webapp/requestdata.html + # to understand how Google works around this HTML spec wart. + if value == None and field_type is not bool: + continue + + if value is not None: + value = cgi.escape(value) + field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts(text, writer_name='html4css1', settings_overrides={'_disable_config': True}) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself def admin_only(handler_method): """Decorator to restrict a method to be run by site administrator only""" def check_login(self, *args, **kwargs): user = users.get_current_user() is_admin = users.is_current_user_admin() if not user: self.redirect(users.create_login_url(self.request.uri)) elif is_admin: handler_method(self, *args, **kwargs) else: self.error(403) return check_login diff --git a/index.yaml b/index.yaml index 1e6b7db..2eac8fc 100644 --- a/index.yaml +++ b/index.yaml @@ -1,30 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used once in query history. +# Used 16 times in query history. - kind: BlikiPage properties: - name: belongs_to_blog - name: created_date direction: desc # Used 23 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Used 71 times in query history. - kind: Page properties: - name: created_date direction: desc diff --git a/templates/srid/base.html b/templates/srid/base.html index a01f93d..80e5048 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,25 +1,25 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> - <div>A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> by ... (more about text here)</div> - <div><a href="/-/admin/newpage">New Page</a> | <a href="/">Home</a> </div> + <a href="/">Home</a> | <a href="/-/admin/newpage">New Page</a> | + <a href="/AboutThisSite">About</a> </div> </div> </body> </html> diff --git a/templates/srid/main.html b/templates/srid/main.html index 71a7ca1..23c4f3e 100644 --- a/templates/srid/main.html +++ b/templates/srid/main.html @@ -1,36 +1,38 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} <div class="span-24"> <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> is a combination of blog and wiki. There are two ways to natigate this site:</p> </div> <div class="span-12"> <div class="box"> <p>Read the <a href="/blog">blog</a>, a listing of pages in reverse chronological order:</p> <ul class="raw"> {% for page in blog_pages %} <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - <a href="/{{page.path}}">{{ page.title }}</a> </li> {% endfor %} </ul> </div> </div> <div class="span-12 last"> <div class="box"> <p>Or navigate by categories..</p> </div> </div> <div class="span-24"> <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> </div> + <hr /> + {% endblock %} \ No newline at end of file
srid/debris
c062f71ef89e47a697458947825c8a6fa08034bc
the main page for bliki - blog or wiki
diff --git a/debris/page.py b/debris/page.py index 514e14e..fc1c288 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,47 +1,47 @@ from google.appengine.ext import db from debris import rst2html class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod - def get_latest(): - """Get the last 10 pages that were created recently""" + def get_recent_blog_entries(): + """Get the last 10 pages that were created recently and belongs to blog""" return db.GqlQuery( - "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10") + "SELECT * FROM BlikiPage WHERE belongs_to_blog = True ORDER BY created_date DESC LIMIT 10") @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] class SpecialPage(object): @property def title(self): return 'Special/%s' % self.__class__.__name__ class AllPages(SpecialPage): @property def content(self): return 'Foo' \ No newline at end of file diff --git a/index.yaml b/index.yaml index ddc60a8..1e6b7db 100644 --- a/index.yaml +++ b/index.yaml @@ -1,23 +1,30 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 16 times in query history. +# Used once in query history. +- kind: BlikiPage + properties: + - name: belongs_to_blog + - name: created_date + direction: desc + +# Used 23 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Used 71 times in query history. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 34ed7f9..a63bcbc 100644 --- a/main.py +++ b/main.py @@ -1,66 +1,72 @@ import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.page import BlikiPage, AllPages from debris import template, form_to_db, SHELL, admin_only - class MainPage(webapp.RequestHandler): def get(self): - pages = BlikiPage.get_latest() + blog_pages = BlikiPage.get_recent_blog_entries() + template(self.response, 'main.html', {'blog_pages': blog_pages}) + +class BlogPage(webapp.RequestHandler): + def get(self): + pages = BlikiPage.get_recent_blog_entries() template(self.response, 'recent.html', {'pages': pages}) + +class ViewBlikiPage(webapp.RequestHandler): + def get(self, path): + page = BlikiPage.get_by_path(path) + template(self.response, 'blikipage.html', + {'page': page}) +class ViewSpecialPage(webapp.RequestHandler): + def get(self, path): + page = AllPages() + template(self.response, 'specialpage.html', {'page': page}) + class Admin_NewPage(webapp.RequestHandler): @admin_only def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) @admin_only def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') - -class Admin_ViewPage(webapp.RequestHandler): - def get(self, path): - page = BlikiPage.get_by_path(path) - template(self.response, 'blikipage.html', - {'page': page}) - class Admin_EditPage(webapp.RequestHandler): @admin_only def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) @admin_only def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) -class Admin_ViewSpecialPage(webapp.RequestHandler): - def get(self, path): - page = AllPages() - template(self.response, 'specialpage.html', {'page': page}) + application = webapp.WSGIApplication( [(r'/', MainPage), + (r'/blog', BlogPage), (r'/-/admin/newpage', Admin_NewPage), (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), - (r'/Special/([0-9a-zA-Z/]+)', Admin_ViewSpecialPage), - (r'/([0-9a-zA-Z/]+)', Admin_ViewPage)], + (r'/Special/([0-9a-zA-Z/]+)', ViewSpecialPage), + (r'/([0-9a-zA-Z/]+)', ViewBlikiPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/srid.css b/static/srid.css index 198cc1e..3a5faf5 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,14 +1,20 @@ div.container { /* since blueprintcss sets the font-size to 75%, we * increase the size again here */ font-size: 120%; } div.page h2 a{ text-decoration: none; color: inherit; } div.footer { text-align: right; +} + +ul.raw { + list-style-type: none; + margin: 0 0 0 1em; + padding: 0; } \ No newline at end of file diff --git a/templates/srid/base.html b/templates/srid/base.html index f57e254..a01f93d 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,25 +1,25 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> <div class="span-24 small footer"> - <p>A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> by ... (more about text here)</p> + <div>A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> by ... (more about text here)</div> <div><a href="/-/admin/newpage">New Page</a> | <a href="/">Home</a> </div> </div> </div> </body> </html> diff --git a/templates/srid/main.html b/templates/srid/main.html new file mode 100644 index 0000000..71a7ca1 --- /dev/null +++ b/templates/srid/main.html @@ -0,0 +1,36 @@ +{% extends "base.html" %} + +{% block title %}Yet Another Debris Bliki{% endblock %} +{% block content %} + + <div class="span-24"> + <p>Welcome to the <b>bliki</b>. A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> + is a combination of blog and wiki. There are two ways to + natigate this site:</p> + </div> + + <div class="span-12"> + <div class="box"> + <p>Read the <a href="/blog">blog</a>, a listing of pages in reverse + chronological order:</p> + <ul class="raw"> + {% for page in blog_pages %} + <li><span class="queit small">{{ page.created_date|date:"d M Y" }}</span> - + <a href="/{{page.path}}">{{ page.title }}</a> + </li> + {% endfor %} + </ul> + </div> + </div> + + <div class="span-12 last"> + <div class="box"> + <p>Or navigate by categories..</p> + </div> + </div> + + <div class="span-24"> + <p>To know more about this bliki site, see <a href="/AboutThisSite">AboutThisSite</a>.</p> + </div> + +{% endblock %} \ No newline at end of file
srid/debris
067642667c0bd9524b1e32e71959afb4f0abbdb1
admin auth check
diff --git a/debris/__init__.py b/debris/__init__.py index 67eb29a..3af6e17 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,46 +1,59 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys from google.appengine.ext.webapp import template as gae_template +from google.appengine.api import users TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = cgi.escape(request.get(key)) if value == "": # not available in form continue field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts(text, writer_name='html4css1', settings_overrides={'_disable_config': True}) return parts['fragment'] register = gae_template.create_template_register() @register.filter def rstify(text): return rst2html(text) gae_template.register_template_library('debris') # this module itself - \ No newline at end of file + +def admin_only(handler_method): + """Decorator to restrict a method to be run by site administrator only""" + def check_login(self, *args, **kwargs): + user = users.get_current_user() + is_admin = users.is_current_user_admin() + if not user: + self.redirect(users.create_login_url(self.request.uri)) + elif is_admin: + handler_method(self, *args, **kwargs) + else: + self.error(403) + return check_login diff --git a/index.yaml b/index.yaml index 4224344..ddc60a8 100644 --- a/index.yaml +++ b/index.yaml @@ -1,23 +1,23 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 2 times in query history. +# Used 16 times in query history. - kind: BlikiPage properties: - name: created_date direction: desc # Used 71 times in query history. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 0c2f286..34ed7f9 100644 --- a/main.py +++ b/main.py @@ -1,62 +1,66 @@ import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.page import BlikiPage, AllPages -from debris import template, form_to_db, SHELL +from debris import template, form_to_db, SHELL, admin_only class MainPage(webapp.RequestHandler): def get(self): pages = BlikiPage.get_latest() template(self.response, 'recent.html', {'pages': pages}) class Admin_NewPage(webapp.RequestHandler): + @admin_only def get(self): page = BlikiPage.create_in_memory() template(self.response, 'edit.html', {'page': page}) + @admin_only def post(self): page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_ViewPage(webapp.RequestHandler): def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'blikipage.html', {'page': page}) class Admin_EditPage(webapp.RequestHandler): + @admin_only def get(self, path): page = BlikiPage.get_by_path(path) template(self.response, 'edit.html', {'page': page}) + @admin_only def post(self, path): page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) class Admin_ViewSpecialPage(webapp.RequestHandler): def get(self, path): page = AllPages() template(self.response, 'specialpage.html', {'page': page}) application = webapp.WSGIApplication( [(r'/', MainPage), (r'/-/admin/newpage', Admin_NewPage), - (r'/-/admin/edit/([a-zA-Z/]+)', Admin_EditPage), - (r'/Special/([a-zA-Z/]+)', Admin_ViewSpecialPage), - (r'/([a-zA-Z/]+)', Admin_ViewPage)], + (r'/-/admin/edit/([0-9a-zA-Z/]+)', Admin_EditPage), + (r'/Special/([0-9a-zA-Z/]+)', Admin_ViewSpecialPage), + (r'/([0-9a-zA-Z/]+)', Admin_ViewPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/srid.css b/static/srid.css index 0057915..198cc1e 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,8 +1,14 @@ +div.container { + /* since blueprintcss sets the font-size to 75%, we + * increase the size again here */ + font-size: 120%; +} + div.page h2 a{ text-decoration: none; color: inherit; } div.footer { text-align: right; } \ No newline at end of file diff --git a/templates/srid/edit.html b/templates/srid/edit.html index 1681173..cdb55c0 100644 --- a/templates/srid/edit.html +++ b/templates/srid/edit.html @@ -1,23 +1,24 @@ {% extends "base.html" %} {% block title %}Editing "{{page.path}}"{% endblock %} {% block content %} <form method="POST" action=""> - <div><input type="text" name="title" + <div><input type="text" name="title" size="75" value="{{page.title}}" /> (title)</div> - <div>http://debris.nearfar.org/<input type="path" name="path" + <div>http://debris.nearfar.org/<input type="path" name="path" size="50" value="{{page.path}}" /> (path)</div> <div> - <textarea name="content" rows="10" cols="60">{{page.content}}</textarea> - (<a href="https://addons.mozilla.org/en-US/firefox/addon/4125">firefox</a> and emacs are your friends) + <textarea style="height: 600px; width: 600px;" name="content">{{page.content}}</textarea> + (<a href="https://addons.mozilla.org/en-US/firefox/addon/4125">firefox</a> + and emacs are your friends) </div> <div><input type="checkbox" name="belongs_to_blog" {% if page.belongs_to_blog %}checked{% endif %} /> Belongs to blog</div> <div> <input type="submit" value="Save" /> <input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} /> </div> </form> {% endblock %} \ No newline at end of file diff --git a/templates/srid/part-blikipage.html b/templates/srid/part-blikipage.html index ecc2174..d9fb5ff 100644 --- a/templates/srid/part-blikipage.html +++ b/templates/srid/part-blikipage.html @@ -1,6 +1,6 @@ {% extends "part-page.html" %} {% block extra %} - Posted on {{ page.created_date }} by srid + Created on {{ page.created_date|date:"d M Y" }} by srid (<a href="/-/admin/edit/{{page.path}}">edit</a>) {% endblock %} \ No newline at end of file diff --git a/templates/srid/recent.html b/templates/srid/recent.html index 6705ec7..b25e26b 100644 --- a/templates/srid/recent.html +++ b/templates/srid/recent.html @@ -1,9 +1,9 @@ {% extends "base.html" %} -{% block title %}Yet Another Debris Weblog{% endblock %} +{% block title %}Yet Another Debris Bliki{% endblock %} {% block content %} {% for page in pages %} - {% include "part-page.html" %} + {% include "part-blikipage.html" %} {% endfor %} {% endblock %} \ No newline at end of file
srid/debris
e3d31fece24fc773d7c78a0ae8d821101fffa888
started supporting 'special pages' and some template refactoring
diff --git a/debris/__init__.py b/debris/__init__.py index c31443c..67eb29a 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,38 +1,46 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys from google.appengine.ext.webapp import template as gae_template TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', TEMPLATE_GROUP, name) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = cgi.escape(request.get(key)) if value == "": # not available in form continue field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts(text, writer_name='html4css1', settings_overrides={'_disable_config': True}) - return parts['fragment'] \ No newline at end of file + return parts['fragment'] + +register = gae_template.create_template_register() [email protected] +def rstify(text): + return rst2html(text) + +gae_template.register_template_library('debris') # this module itself + \ No newline at end of file diff --git a/debris/page.py b/debris/page.py index 573e1fc..514e14e 100644 --- a/debris/page.py +++ b/debris/page.py @@ -1,47 +1,47 @@ from google.appengine.ext import db from debris import rst2html -class BasePage(object): - - def content_as_html(self): - return rst2html(self.content) - content_as_html = property(fget=content_as_html) - -class Page(db.Model, BasePage): +class BlikiPage(db.Model): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() - + @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" - page = Page() + page = BlikiPage() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_latest(): """Get the last 10 pages that were created recently""" return db.GqlQuery( - "SELECT * FROM Page ORDER BY created_date DESC LIMIT 10") + "SELECT * FROM BlikiPage ORDER BY created_date DESC LIMIT 10") @staticmethod def get_by_path(path): - return db.GqlQuery("SELECT * FROM Page WHERE path = :1", + return db.GqlQuery("SELECT * FROM BlikiPage WHERE path = :1", path)[0] - -class SpecialPage(BasePage): - """Represent a special bliki page - not stored in DB, but act on - the DB data, for example. - """ - +class SpecialPage(object): + + @property + def title(self): + return 'Special/%s' % self.__class__.__name__ + + +class AllPages(SpecialPage): + + @property + def content(self): + return 'Foo' \ No newline at end of file diff --git a/index.yaml b/index.yaml index 737e8e1..4224344 100644 --- a/index.yaml +++ b/index.yaml @@ -1,17 +1,23 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 70 times in query history. +# Used 2 times in query history. +- kind: BlikiPage + properties: + - name: created_date + direction: desc + +# Used 71 times in query history. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 5d6dfac..0c2f286 100644 --- a/main.py +++ b/main.py @@ -1,56 +1,62 @@ import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app -from debris.page import Page +from debris.page import BlikiPage, AllPages from debris import template, form_to_db, SHELL class MainPage(webapp.RequestHandler): def get(self): - pages = Page.get_latest() + pages = BlikiPage.get_latest() template(self.response, 'recent.html', {'pages': pages}) class Admin_NewPage(webapp.RequestHandler): def get(self): - page = Page.create_in_memory() - template(self.response, 'edit-page.html', {'page': page}) + page = BlikiPage.create_in_memory() + template(self.response, 'edit.html', {'page': page}) def post(self): - page = Page.create_in_memory() + page = BlikiPage.create_in_memory() form_to_db(self.request, page) page.put() - logging.info('New Page "%s" created' % page.path) + logging.info('New BlikiPage "%s" created' % page.path) self.redirect('/') class Admin_ViewPage(webapp.RequestHandler): def get(self, path): - page = Page.get_by_path(path) - template(self.response, 'page.html', + page = BlikiPage.get_by_path(path) + template(self.response, 'blikipage.html', {'page': page}) class Admin_EditPage(webapp.RequestHandler): def get(self, path): - page = Page.get_by_path(path) - template(self.response, 'edit-page.html', {'page': page}) + page = BlikiPage.get_by_path(path) + template(self.response, 'edit.html', {'page': page}) def post(self, path): - page = Page.get_by_path(path) + page = BlikiPage.get_by_path(path) form_to_db(self.request, page) page.put() - logging.info('Page "%s" modified' % page.path) + logging.info('BlikiPage "%s" modified' % page.path) self.redirect('/' + page.path) + +class Admin_ViewSpecialPage(webapp.RequestHandler): + def get(self, path): + page = AllPages() + template(self.response, 'specialpage.html', {'page': page}) application = webapp.WSGIApplication( - [('/', MainPage), - ('/-/admin/newpage', Admin_NewPage), - ('/-/admin/edit/([a-zA-Z/]+)', Admin_EditPage), - ('/([a-zA-Z/]+)', Admin_ViewPage)], + [(r'/', MainPage), + (r'/-/admin/newpage', Admin_NewPage), + (r'/-/admin/edit/([a-zA-Z/]+)', Admin_EditPage), + (r'/Special/([a-zA-Z/]+)', Admin_ViewSpecialPage), + (r'/([a-zA-Z/]+)', Admin_ViewPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() diff --git a/static/srid.css b/static/srid.css index fcb9608..0057915 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,7 +1,8 @@ div.page h2 a{ text-decoration: none; + color: inherit; } div.footer { text-align: right; } \ No newline at end of file diff --git a/templates/srid/blikipage.html b/templates/srid/blikipage.html new file mode 100644 index 0000000..d8d8148 --- /dev/null +++ b/templates/srid/blikipage.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} + +{% block title %}{{page.title}}{% endblock %} +{% block content %} +{% include "part-blikipage.html" %} +{% endblock %} \ No newline at end of file diff --git a/templates/srid/edit-page.html b/templates/srid/edit.html similarity index 100% rename from templates/srid/edit-page.html rename to templates/srid/edit.html diff --git a/templates/srid/page.html b/templates/srid/page.html deleted file mode 100644 index 6666b59..0000000 --- a/templates/srid/page.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{page.title}}{% endblock %} -{% block content %} -<div class="page"> - <h2>{{ page.title }}</h2> - - <p> {{ page.content_as_html }} </p> - - <p class="small"> - Posted on {{ page.created_date }} by srid - (<a href="/-/admin/edit/{{page.path}}">edit</a>) - </p> - <hr /> -</div> -{% endblock %} \ No newline at end of file diff --git a/templates/srid/part-blikipage.html b/templates/srid/part-blikipage.html new file mode 100644 index 0000000..ecc2174 --- /dev/null +++ b/templates/srid/part-blikipage.html @@ -0,0 +1,6 @@ +{% extends "part-page.html" %} + +{% block extra %} + Posted on {{ page.created_date }} by srid + (<a href="/-/admin/edit/{{page.path}}">edit</a>) +{% endblock %} \ No newline at end of file diff --git a/templates/srid/part-page.html b/templates/srid/part-page.html new file mode 100644 index 0000000..ae4fa26 --- /dev/null +++ b/templates/srid/part-page.html @@ -0,0 +1,10 @@ +<div class="page"> + <h2><a href="/{{ page.path }}">{{ page.title }}</a></h2> + + <p> {{ page.content|rstify }} </p> + + <p class="small"> + {% block extra %}{% endblock %} + </p> + <hr /> +</div> \ No newline at end of file diff --git a/templates/srid/part-specialpage.html b/templates/srid/part-specialpage.html new file mode 100644 index 0000000..cc7df2f --- /dev/null +++ b/templates/srid/part-specialpage.html @@ -0,0 +1 @@ +{% extends "part-page.html" %} diff --git a/templates/srid/recent.html b/templates/srid/recent.html index de69358..6705ec7 100644 --- a/templates/srid/recent.html +++ b/templates/srid/recent.html @@ -1,19 +1,9 @@ {% extends "base.html" %} {% block title %}Yet Another Debris Weblog{% endblock %} {% block content %} {% for page in pages %} - <div class="page"> - <h2> <a href="/{{page.path}}">{{ page.title }}</a> </h2> - - <p> {{ page.content_as_html }} </p> - - <p class="small"> - Posted on {{ page.created_date }} by srid - (<a href="/-/admin/edit/{{page.path}}">edit</a>) - </p> - <hr /> - </div> + {% include "part-page.html" %} {% endfor %} {% endblock %} \ No newline at end of file diff --git a/templates/srid/specialpage.html b/templates/srid/specialpage.html new file mode 100644 index 0000000..6fcfe1f --- /dev/null +++ b/templates/srid/specialpage.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} + +{% block title %}{{page.title}}{% endblock %} +{% block content %} +{% include "part-specialpage.html" %} +{% endblock %} \ No newline at end of file
srid/debris
20ae8045c744bc3eb4a812ad1c2e920b7de5b7f2
using main() as per the advice in google groups
diff --git a/main.py b/main.py index 8280edb..5d6dfac 100644 --- a/main.py +++ b/main.py @@ -1,53 +1,56 @@ import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.page import Page from debris import template, form_to_db, SHELL class MainPage(webapp.RequestHandler): def get(self): pages = Page.get_latest() template(self.response, 'recent.html', {'pages': pages}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = Page.create_in_memory() template(self.response, 'edit-page.html', {'page': page}) def post(self): page = Page.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New Page "%s" created' % page.path) self.redirect('/') class Admin_ViewPage(webapp.RequestHandler): def get(self, path): page = Page.get_by_path(path) template(self.response, 'page.html', {'page': page}) class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = Page.get_by_path(path) template(self.response, 'edit-page.html', {'page': page}) def post(self, path): page = Page.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('Page "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [('/', MainPage), ('/-/admin/newpage', Admin_NewPage), ('/-/admin/edit/([a-zA-Z/]+)', Admin_EditPage), ('/([a-zA-Z/]+)', Admin_ViewPage)], debug=True) -if __name__ == "__main__": +def main(): run_wsgi_app(application) + +if __name__ == "__main__": + main()
srid/debris
8a0cc0147a45915ed374e1d32ac3f8b83add75f6
not blog, but bliki
diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..914399f --- /dev/null +++ b/README.txt @@ -0,0 +1 @@ +debris is a simple bliki for personal purposes. diff --git a/debris/db.py b/debris/page.py similarity index 85% rename from debris/db.py rename to debris/page.py index 0a092e7..573e1fc 100644 --- a/debris/db.py +++ b/debris/page.py @@ -1,37 +1,47 @@ from google.appengine.ext import db from debris import rst2html -class Page(db.Model): +class BasePage(object): + + def content_as_html(self): + return rst2html(self.content) + content_as_html = property(fget=content_as_html) + + +class Page(db.Model, BasePage): """Represent a webpage in database""" title = db.StringProperty(multiline=False) path = db.StringProperty(multiline=False) created_date = db.DateTimeProperty(auto_now_add=True) content = db.TextProperty() belongs_to_blog = db.BooleanProperty() draft = db.BooleanProperty() - - def content_as_html(self): - return rst2html(self.content) - content_as_html = property(fget=content_as_html) @staticmethod def create_in_memory(): "Create a new `Page' that is not persisted until `put()' is called" page = Page() page.draft = True page.belongs_to_blog = True page.title = page.path = page.content = "" # they cannot be None return page @staticmethod def get_latest(): """Get the last 10 pages that were created recently""" return db.GqlQuery( "SELECT * FROM Page ORDER BY created_date DESC LIMIT 10") @staticmethod def get_by_path(path): return db.GqlQuery("SELECT * FROM Page WHERE path = :1", path)[0] +class SpecialPage(BasePage): + """Represent a special bliki page - not stored in DB, but act on + the DB data, for example. + """ + + + \ No newline at end of file diff --git a/index.yaml b/index.yaml index 215d2be..737e8e1 100644 --- a/index.yaml +++ b/index.yaml @@ -1,17 +1,17 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 43 times in query history. +# Used 70 times in query history. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index fd955c0..8280edb 100644 --- a/main.py +++ b/main.py @@ -1,53 +1,53 @@ import logging from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app -from debris.db import Page -from debris import template, form_to_db, SHELL, rst2html +from debris.page import Page +from debris import template, form_to_db, SHELL class MainPage(webapp.RequestHandler): def get(self): pages = Page.get_latest() template(self.response, 'recent.html', {'pages': pages}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = Page.create_in_memory() template(self.response, 'edit-page.html', {'page': page}) def post(self): page = Page.create_in_memory() form_to_db(self.request, page) page.put() logging.info('New Page "%s" created' % page.path) self.redirect('/') class Admin_ViewPage(webapp.RequestHandler): def get(self, path): page = Page.get_by_path(path) template(self.response, 'page.html', {'page': page}) class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = Page.get_by_path(path) template(self.response, 'edit-page.html', {'page': page}) def post(self, path): page = Page.get_by_path(path) form_to_db(self.request, page) page.put() logging.info('Page "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [('/', MainPage), ('/-/admin/newpage', Admin_NewPage), ('/-/admin/edit/([a-zA-Z/]+)', Admin_EditPage), ('/([a-zA-Z/]+)', Admin_ViewPage)], debug=True) if __name__ == "__main__": run_wsgi_app(application) diff --git a/static/srid.css b/static/srid.css index db4ffd9..fcb9608 100644 --- a/static/srid.css +++ b/static/srid.css @@ -1,3 +1,7 @@ div.page h2 a{ text-decoration: none; +} + +div.footer { + text-align: right; } \ No newline at end of file diff --git a/templates/srid/base.html b/templates/srid/base.html index 7b3a75c..f57e254 100644 --- a/templates/srid/base.html +++ b/templates/srid/base.html @@ -1,25 +1,25 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> <div class="span-24 header"> &nbsp; </div> <div class="span-24"> {% block content %} {% endblock %} </div> - <div class="span-24 small"> - <p>A weblog by ...</p> + <div class="span-24 small footer"> + <p>A <a href="http://en.wikipedia.org/wiki/Bliki">bliki</a> by ... (more about text here)</p> <div><a href="/-/admin/newpage">New Page</a> | <a href="/">Home</a> </div> </div> </div> </body> </html>
srid/debris
2679cb6e6c451448d2af32b8aa77a0af71fb62ca
more design tweaks, etc..
diff --git a/.gitignore b/.gitignore index 0d20b64..0ad5073 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pyc +debris.kpf diff --git a/debris.kpf b/debris.kpf deleted file mode 100644 index 246b088..0000000 --- a/debris.kpf +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Komodo Project File - DO NOT EDIT --> -<project id="1486c2d1-7082-4c8f-8cd3-18895191bf93" kpf_version="4" name="debris.kpf"> -<livefolder id="1486c2d1-7082-4c8f-8cd3-18895191bf93/google_appengine" idref="1486c2d1-7082-4c8f-8cd3-18895191bf93" name="google_appengine" url="file:///home/srid/src/google_appengine"> -</livefolder> -<file id="a5f0c641-8b9d-45cc-a43c-bb9951ef432f" idref="1486c2d1-7082-4c8f-8cd3-18895191bf93/templates" name="main.py" url="main.py"> -</file> -<preference-set idref="1486c2d1-7082-4c8f-8cd3-18895191bf93"> - <boolean id="import_live">1</boolean> -</preference-set> -<preference-set idref="a5f0c641-8b9d-45cc-a43c-bb9951ef432f"> -<preference-set id="Invocations"> -<preference-set id="GAE"> - <string id="cookieparams"></string> - <string relative="path" id="cwd"></string> - <string id="documentRoot"></string> - <string id="executable-params"></string> - <string id="filename">/home/srid/src/google_appengine/dev_appserver.py</string> - <string id="getparams"></string> - <string id="language">Python</string> - <string id="mpostparams"></string> - <string id="params">.</string> - <string id="postparams"></string> - <string id="posttype">application/x-www-form-urlencoded</string> - <string id="request-method">GET</string> - <boolean id="show-dialog">1</boolean> - <boolean id="sim-cgi">0</boolean> - <boolean id="use-console">0</boolean> - <string id="userCGIEnvironment"></string> - <string id="userEnvironment"></string> -</preference-set> -<preference-set id="default"> - <string id="cookieparams"></string> - <string id="cwd"></string> - <string id="documentRoot"></string> - <string id="executable-params"></string> - <string relative="path" id="filename">main.py</string> - <string id="getparams"></string> - <string id="language">Python</string> - <string id="mpostparams"></string> - <string id="params"></string> - <string id="postparams"></string> - <string id="posttype">application/x-www-form-urlencoded</string> - <string id="request-method">GET</string> - <boolean id="show-dialog">1</boolean> - <boolean id="sim-cgi">0</boolean> - <boolean id="use-console">0</boolean> - <string id="userCGIEnvironment"></string> - <string id="userEnvironment"></string> -</preference-set> -</preference-set> - <string id="lastInvocation">GAE</string> -</preference-set> -</project> diff --git a/debris/__init__.py b/debris/__init__.py index 1f23b35..c31443c 100644 --- a/debris/__init__.py +++ b/debris/__init__.py @@ -1,36 +1,38 @@ # I keep utility and wrapper code here # So simply do `from debris import foo' to use the feature `foo' import os, cgi, sys from google.appengine.ext.webapp import template as gae_template +TEMPLATE_GROUP = 'srid' # /templates/srid/ def template(response, name, values): """Render the given template to the `response' object""" # find templates in ../templates/ path = os.path.join(os.path.dirname(__file__), '..', 'templates', + TEMPLATE_GROUP, name) response.out.write(gae_template.render(path, values)) def SHELL(): """Break the application and run the PDB shell""" from pdb import Pdb Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) def form_to_db(request, model_instance): """Set table attributes from form values""" for key, field in model_instance.fields().items(): value = cgi.escape(request.get(key)) if value == "": # not available in form continue field_type = field.data_type if field_type is basestring: field_type = str # basestring cannot be initiated field_value = field_type(value) setattr(model_instance, key, field_value) def rst2html(text): from docutils import core parts = core.publish_parts(text, writer_name='html4css1', settings_overrides={'_disable_config': True}) return parts['fragment'] \ No newline at end of file diff --git a/index.yaml b/index.yaml index cf38bf6..215d2be 100644 --- a/index.yaml +++ b/index.yaml @@ -1,17 +1,17 @@ indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. -# Used 30 times in query history. +# Used 43 times in query history. - kind: Page properties: - name: created_date direction: desc diff --git a/main.py b/main.py index 618f658..fd955c0 100644 --- a/main.py +++ b/main.py @@ -1,48 +1,53 @@ +import logging + from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from debris.db import Page from debris import template, form_to_db, SHELL, rst2html class MainPage(webapp.RequestHandler): def get(self): pages = Page.get_latest() - template(self.response, 'recent.html', {'pages': pages, 'rst2html': rst2html}) + template(self.response, 'recent.html', {'pages': pages}) class Admin_NewPage(webapp.RequestHandler): def get(self): page = Page.create_in_memory() template(self.response, 'edit-page.html', {'page': page}) def post(self): page = Page.create_in_memory() form_to_db(self.request, page) page.put() + logging.info('New Page "%s" created' % page.path) self.redirect('/') + class Admin_ViewPage(webapp.RequestHandler): def get(self, path): page = Page.get_by_path(path) - template(self.response, 'recent.html', - {'pages': [page], 'rst2html': rst2html}) + template(self.response, 'page.html', + {'page': page}) class Admin_EditPage(webapp.RequestHandler): def get(self, path): page = Page.get_by_path(path) template(self.response, 'edit-page.html', {'page': page}) def post(self, path): page = Page.get_by_path(path) form_to_db(self.request, page) page.put() + logging.info('Page "%s" modified' % page.path) self.redirect('/' + page.path) application = webapp.WSGIApplication( [('/', MainPage), ('/-/admin/newpage', Admin_NewPage), ('/-/admin/edit/([a-zA-Z/]+)', Admin_EditPage), ('/([a-zA-Z/]+)', Admin_ViewPage)], debug=True) if __name__ == "__main__": run_wsgi_app(application) diff --git a/static/srid.css b/static/srid.css new file mode 100644 index 0000000..db4ffd9 --- /dev/null +++ b/static/srid.css @@ -0,0 +1,3 @@ +div.page h2 a{ + text-decoration: none; +} \ No newline at end of file diff --git a/templates/base.html b/templates/srid/base.html similarity index 65% rename from templates/base.html rename to templates/srid/base.html index 6e1ac15..7b3a75c 100644 --- a/templates/base.html +++ b/templates/srid/base.html @@ -1,27 +1,25 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> + <link rel="stylesheet" href="/static/srid.css" type="text/css"> <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print"> <!--[if IE]><link rel="stylesheet" href="/static/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> - + <title>{% block title %} {% endblock %}</title> </head> <body> <div class="container"> - <div class="span-24"> - <hr /> - <h2 class="alt">Yet Another Debris Weblog</h2> - <hr /> + <div class="span-24 header"> + &nbsp; </div> - <div class="span-16"> + <div class="span-24"> {% block content %} {% endblock %} </div> - - <div class="span-8 last"> - <h3>About</h3> - <p>SFoo Bar</p> - </div> + <div class="span-24 small"> + <p>A weblog by ...</p> + <div><a href="/-/admin/newpage">New Page</a> | <a href="/">Home</a> </div> + </div> </div> </body> </html> diff --git a/templates/edit-page.html b/templates/srid/edit-page.html similarity index 91% rename from templates/edit-page.html rename to templates/srid/edit-page.html index 0a7868c..1681173 100644 --- a/templates/edit-page.html +++ b/templates/srid/edit-page.html @@ -1,21 +1,23 @@ {% extends "base.html" %} +{% block title %}Editing "{{page.path}}"{% endblock %} + {% block content %} <form method="POST" action=""> <div><input type="text" name="title" value="{{page.title}}" /> (title)</div> <div>http://debris.nearfar.org/<input type="path" name="path" value="{{page.path}}" /> (path)</div> <div> <textarea name="content" rows="10" cols="60">{{page.content}}</textarea> (<a href="https://addons.mozilla.org/en-US/firefox/addon/4125">firefox</a> and emacs are your friends) </div> <div><input type="checkbox" name="belongs_to_blog" {% if page.belongs_to_blog %}checked{% endif %} /> Belongs to blog</div> <div> <input type="submit" value="Save" /> <input type="submit" value="Save as draft" {% if not page.draft %} disabled {% endif %} /> </div> </form> {% endblock %} \ No newline at end of file diff --git a/templates/srid/page.html b/templates/srid/page.html new file mode 100644 index 0000000..6666b59 --- /dev/null +++ b/templates/srid/page.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block title %}{{page.title}}{% endblock %} +{% block content %} +<div class="page"> + <h2>{{ page.title }}</h2> + + <p> {{ page.content_as_html }} </p> + + <p class="small"> + Posted on {{ page.created_date }} by srid + (<a href="/-/admin/edit/{{page.path}}">edit</a>) + </p> + <hr /> +</div> +{% endblock %} \ No newline at end of file diff --git a/templates/recent.html b/templates/srid/recent.html similarity index 60% rename from templates/recent.html rename to templates/srid/recent.html index 6e985f6..de69358 100644 --- a/templates/recent.html +++ b/templates/srid/recent.html @@ -1,17 +1,19 @@ {% extends "base.html" %} +{% block title %}Yet Another Debris Weblog{% endblock %} {% block content %} {% for page in pages %} + <div class="page"> <h2> <a href="/{{page.path}}">{{ page.title }}</a> </h2> <p> {{ page.content_as_html }} </p> - <p> - <small>Posted on {{ page.created_date }}</small> + <p class="small"> + Posted on {{ page.created_date }} by srid (<a href="/-/admin/edit/{{page.path}}">edit</a>) </p> <hr /> + </div> {% endfor %} - <a href="/-/admin/newpage">New Page</a> {% endblock %} \ No newline at end of file
srid/debris
a16c807b0cfe75b4ed4835b8ce81e63208b92765
debris - init
diff --git a/app.yaml b/app.yaml new file mode 100644 index 0000000..be67c3b --- /dev/null +++ b/app.yaml @@ -0,0 +1,8 @@ +application: debris-1 +version: 1 +runtime: python +api_version: 1 + +handlers: +- url: /.* + script: main.py diff --git a/debris.kpf b/debris.kpf new file mode 100644 index 0000000..c3f7230 --- /dev/null +++ b/debris.kpf @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Komodo Project File - DO NOT EDIT --> +<project id="1486c2d1-7082-4c8f-8cd3-18895191bf93" kpf_version="4" name="debris.kpf"> +<preference-set idref="1486c2d1-7082-4c8f-8cd3-18895191bf93"> + <boolean id="import_live">1</boolean> +</preference-set> +</project> diff --git a/debris/__init__.py b/debris/__init__.py new file mode 100644 index 0000000..a18d00b --- /dev/null +++ b/debris/__init__.py @@ -0,0 +1,41 @@ +# I keep utility and wrapper code here +# So simply do `from debris import foo' to use the feature `foo' + +import os, cgi, sys +from google.appengine.ext.webapp import template as gae_template + + +def template(response, name, values): + """Render the given template to the `response' object""" + # find templates in ../templates/ + path = os.path.join(os.path.dirname(__file__), + '..', + 'templates', + name) + response.out.write(gae_template.render(path, values)) + +def SHELL(): + """Break the application and run the PDB shell""" + import pdb + debugger = pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__) + debugger.set_trace(sys._getframe().f_back) + +def form_to_db(request, model_instance): + """Set table attributes from form values""" + for key, field in model_instance.fields().items(): + value = cgi.escape(request.get(key)) + if value == "": # not available in form + continue + field_type = field.data_type + if field_type is basestring: + field_type = str # basestring cannot be initiated + field_value = field_type(value) + setattr(model_instance, key, field_value) + +class formed: + + def __init__(self, request): + self.request = request + + def get(self, key): + return cgi.escape(self.request.get(key)) diff --git a/debris/db.py b/debris/db.py new file mode 100644 index 0000000..63dd2ea --- /dev/null +++ b/debris/db.py @@ -0,0 +1,22 @@ +from google.appengine.ext import db + + +class Page(db.Model): + """Represent a webpage in database""" + title = db.StringProperty(multiline=False) + path = db.StringProperty(multiline=False) + created_date = db.DateTimeProperty(auto_now_add=True) + content = db.TextProperty() + belongs_to_blog = db.BooleanProperty() + + @staticmethod + def get_latest(): + """Get the last 10 pages that were created recently""" + return db.GqlQuery( + "SELECT * FROM Page ORDER BY created_date DESC LIMIT 10") + + @staticmethod + def get_by_path(path): + return db.GqlQuery("SELECT * FROM Page WHERE path = :1", + path)[0] + diff --git a/index.yaml b/index.yaml new file mode 100644 index 0000000..f8fe165 --- /dev/null +++ b/index.yaml @@ -0,0 +1,17 @@ +indexes: + +# AUTOGENERATED + +# This index.yaml is automatically updated whenever the dev_appserver +# detects that a new type of query is run. If you want to manage the +# index.yaml file manually, remove the above marker line (the line +# saying "# AUTOGENERATED"). If you want to manage some indexes +# manually, move them above the marker line. The index.yaml file is +# automatically uploaded to the admin console when you next deploy +# your application using appcfg.py. + +# Used 8 times in query history. +- kind: Page + properties: + - name: created_date + direction: desc diff --git a/main.py b/main.py new file mode 100644 index 0000000..421d0c4 --- /dev/null +++ b/main.py @@ -0,0 +1,38 @@ +from google.appengine.ext import webapp +from google.appengine.ext.webapp.util import run_wsgi_app + +from debris.db import Page +from debris import template, form_to_db, SHELL + + +class MainPage(webapp.RequestHandler): + def get(self): + pages = Page.get_latest() + template(self.response, 'recent.html', {'pages': pages}) + +class Admin_NewPage(webapp.RequestHandler): + def get(self): + SHELL() + template(self.response, 'new-page.html', {}) + def post(self): + page = Page() + form_to_db(self.request, page) + page.put() + self.redirect('/') + +class Admin_ViewEditPage(webapp.RequestHandler): + def get(self, path, edit): + if edit == None: + template(self.response, 'recent.html', + {'pages': [Page.get_by_path(path)]}) + else: + raise + +application = webapp.WSGIApplication( + [('/', MainPage), + ('/([a-zA-Z/]+)/(\+edit)?', Admin_ViewEditPage), + ('/-/admin/newpage', Admin_NewPage)], + debug=True) + +if __name__ == "__main__": + run_wsgi_app(application) diff --git a/templates/new-page.html b/templates/new-page.html new file mode 100644 index 0000000..7d21515 --- /dev/null +++ b/templates/new-page.html @@ -0,0 +1,15 @@ +<html> + <body> + <form method="POST" action=""> + <div><input type="text" name="title" /> (title)</div> + <div>http://debris.nearfar.org/<input type="path" name="path" /> (path)</div> + <div><textarea name="content" rows="10" cols="60"></textarea></div> + <div><input type="checkbox" name="belongs_to_blog" checked /> + Belongs to blog</div> + <div> + <input type="submit" value="Save and publish" /> + <input type="submit" value="Save only" disabled /> + </div> + </form> + </body> +</html> diff --git a/templates/recent.html b/templates/recent.html new file mode 100644 index 0000000..c8c6ebd --- /dev/null +++ b/templates/recent.html @@ -0,0 +1,12 @@ +<html> + <body> + {% for page in pages %} + <h2> <a href="/{{page.path}}/">{{ page.title }}</a> </h2> + + <p> {{ page.content }} </p> + + <p><small>Posted on {{ page.created_date }}</small></p> + <hr /> + {% endfor %} + </body> +</html>
chrido/NAdvisor
d3f4e7e00f97a5841d1409b0b9504ec622ced645
renamings, typos
diff --git a/NAdvisor.Contrib.Test/AttributeBasedJoinPointDefinitionTests.cs b/NAdvisor.Contrib.Test/AttributeBasedJoinPointDefinitionTests.cs new file mode 100644 index 0000000..142417f --- /dev/null +++ b/NAdvisor.Contrib.Test/AttributeBasedJoinPointDefinitionTests.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using NAdvisor.Core; + +namespace NAdvisor.Contrib.Test +{ + [TestClass] + public class AttributeBasedJoinPointDefinitionTests + { + [TestMethod] + public void Should_Intercept_Only_Attributed_Methods() + { + var aspectLog = new List<string>(); + var serviceLog = new List<string>(); + + //Given + var aspect = new SimpleAspect(); + aspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); + var simpleService = new SimpleService(); + simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); + var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); + + var advisor = new Advisor(JoinPointDefinition.AttributeBasedJoinPointDefinition, new List<IAspect>() {aspect, shouldNotBeCalledAspect.Object}); + var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); + + //Then + var result = myService.DoSomething("hallo"); + + //When + Assert.AreEqual(aspectLog[0], "aspectCalled"); + Assert.AreEqual(aspectLog[1], "hallo"); + Assert.AreEqual(aspectLog[2], "DoneSomething"); + + Assert.AreEqual(result, "executed"); + + Assert.AreEqual(serviceLog[0], "hallo"); + + shouldNotBeCalledAspect.VerifyAll(); + } + + [TestMethod] + public void Should_Order_Aspects_From_Left_To_Right() + { + var aspectLog = new List<string>(); + var serviceLog = new List<string>(); + + //Given + var firstAspect = new FirstAspect(); + firstAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); + + var secondAspect = new SecondAspect(); + secondAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); + + var simpleService = new SimpleService(); + simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); + var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); + + var advisor = new Advisor(JoinPointDefinition.AttributeBasedJoinPointDefinition, new List<IAspect>() { shouldNotBeCalledAspect.Object, secondAspect, shouldNotBeCalledAspect.Object, firstAspect }); + var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); + + //Then + var result = myService.DoMore("muchmore"); + + shouldNotBeCalledAspect.VerifyAll(); + + Assert.AreEqual(aspectLog.Count, 4); + Assert.AreEqual("FirstAspectBefore", aspectLog[0]); + Assert.AreEqual("SecondAspectBefore", aspectLog[1]); + Assert.AreEqual("SecondAspectAfter", aspectLog[2]); + Assert.AreEqual("FirstAspectAfter", aspectLog[3]); + + } + } + + public class SimpleAspect : IAspect + { + public EventHandler<SimpleEventArgs> DoneSomething; + + public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) + { + RaiseDoneSomething("aspectCalled"); + + if (args.Length > 0) + { + if (args[0] is string) + { + RaiseDoneSomething((string)args[0]); + } + } + + object result = proceedInvocation(args); + + if (result is string) + RaiseDoneSomething((string)result); + + return "executed"; + } + + private void RaiseDoneSomething(string doneSomething) + { + if (DoneSomething != null) + DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); + } + } + + public class FirstAspect : IAspect + { + public EventHandler<SimpleEventArgs> DoneSomething; + + public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) + { + RaiseDoneSomething("FirstAspectBefore"); + + object result = proceedInvocation(args); + + RaiseDoneSomething("FirstAspectAfter"); + return result; + } + + private void RaiseDoneSomething(string doneSomething) + { + if (DoneSomething != null) + DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); + } + } + + public class SecondAspect : IAspect + { + public EventHandler<SimpleEventArgs> DoneSomething; + + public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) + { + RaiseDoneSomething("SecondAspectBefore"); + + object result = proceedInvocation(args); + + RaiseDoneSomething("SecondAspectAfter"); + return result; + } + + private void RaiseDoneSomething(string doneSomething) + { + if (DoneSomething != null) + DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); + } + } + + public interface ISimpleService + { + string DoSomething(string arguments); + + string DoMore(string more); + } + + public class SimpleService : ISimpleService + { + public EventHandler<SimpleEventArgs> DoneSomething; + + [InterceptedBy(typeof(SimpleAspect))] + public string DoSomething(string arguments) + { + RaiseDoneSomething(arguments); + return "DoneSomething"; + } + + [InterceptedBy(typeof(FirstAspect), typeof(SecondAspect))] + public string DoMore(string more) + { + RaiseDoneSomething(more); + return "more"; + } + + private void RaiseDoneSomething(string doneSomething) + { + if (DoneSomething != null) + DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); + } + } +} \ No newline at end of file diff --git a/NAdvisor.Contrib/InterceptedBy/JoinPointDefinition.cs b/NAdvisor.Contrib/InterceptedBy/JoinPointDefinition.cs new file mode 100644 index 0000000..be8c06f --- /dev/null +++ b/NAdvisor.Contrib/InterceptedBy/JoinPointDefinition.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using NAdvisor.Core; + +namespace NAdvisor.Contrib +{ + public class JoinPointDefinition + { + public static IList<IAspect> AttributeBasedJoinPointDefinition(IAspectEnvironment aspectEnvironment, IList<IAspect> availableAspects) + { + object[] customAttributes = aspectEnvironment.ConcreteMethodInfo.GetCustomAttributes(typeof(InterceptedByAttribute), true); + if (customAttributes.Length == 0) + return new List<IAspect>(); + + var takenAspects = new List<IAspect>(); + + var attribute = customAttributes[0] as InterceptedByAttribute; + if (attribute != null) + { + foreach (Type aspectTypes in attribute.Types) //Keeping order of Aspects + { + foreach (IAspect aspect in availableAspects) + { + if(aspect.GetType() == aspectTypes) //return the Aspect if the Types Match + { + takenAspects.Add(aspect); + break; + } + } + } + } + + return takenAspects; + } + } +} \ No newline at end of file diff --git a/NAdvisor.Contrib/MemoizeJoinPointDefinition.cs b/NAdvisor.Contrib/MemoizeJoinPointDefinition.cs new file mode 100644 index 0000000..e189f6d --- /dev/null +++ b/NAdvisor.Contrib/MemoizeJoinPointDefinition.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using NAdvisor.Core; + +namespace NAdvisor.Contrib +{ + public class MemoizeJoinPointDefinition + { + private readonly Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> _joinPointDefinitionToMemoize; + + public MemoizeJoinPointDefinition(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> joinPointDefinitionToMemoize) + { + _joinPointDefinitionToMemoize = joinPointDefinitionToMemoize; + } + + public Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> GetMemoizedJoinPointDefinition() + { + return Memoization; + } + + /// <summary> + /// TODO using the additional Dictionary/MethodInfo thing is not that good idea, refactor! + /// </summary> + /// <param name="type"></param> + /// <param name="aspectEnvironment"></param> + /// <param name="availableAspects"></param> + /// <returns></returns> + private IList<IAspect> Memoization(IAspectEnvironment aspectEnvironment, IList<IAspect> availableAspects) + { + const string dictionaryKey = "__MemoizeJoinPointDefinition"; + + IList<IAspect> methodAspect = null; + + aspectEnvironment.SyncronizedKeyValueStoreMutator((keyValueStore) => + { + if (keyValueStore.ContainsKey(dictionaryKey)) + { + var methodInfoDict = keyValueStore.GetValue<Dictionary<MethodInfo, IList<IAspect>>>(dictionaryKey); + + if (methodInfoDict != null && methodInfoDict.ContainsKey(aspectEnvironment.ConcreteMethodInfo)) + { + methodAspect = methodInfoDict[aspectEnvironment.ConcreteMethodInfo]; + } + } + }); + + if (methodAspect != null) + return methodAspect; + + aspectEnvironment.GetValueOrCreate(dictionaryKey, () => new Dictionary<MethodInfo, IList<IAspect>>()); + + aspectEnvironment.SyncronizedKeyValueStoreMutator((keyValueStore) => + { + var store = keyValueStore.GetValue<Dictionary<MethodInfo, IList<IAspect>>>(dictionaryKey); + + if (!store.ContainsKey(aspectEnvironment.ConcreteMethodInfo)) //second check + { + methodAspect = _joinPointDefinitionToMemoize(aspectEnvironment, availableAspects); + store.Add(aspectEnvironment.ConcreteMethodInfo, methodAspect); + } + }); + + return methodAspect; + } + + } +}
chrido/NAdvisor
95ee442013def6bb934862e89d79c29077951967
.net 4.0/vs2010
diff --git a/Example/FreeAdvice.Aspects/DatabaseContext.cs b/Example/FreeAdvice.Aspects/DatabaseContext.cs deleted file mode 100644 index 8d9b865..0000000 --- a/Example/FreeAdvice.Aspects/DatabaseContext.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using NAdvisor.Core; - -namespace FreeAdvice.Aspects -{ - public class DatabaseContext : IAspect - { - private readonly ITransactionContext _transactionContext; - - public DatabaseContext(ITransactionContext transactionContext) - { - _transactionContext = transactionContext; - } - - public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) - { - _transactionContext.Push(); - object returnValue = null; - - try - { - returnValue = proceedInvocation.Invoke(args); - } - catch(Exception ex) - { - _transactionContext.Rollback(); - throw ex; - } - _transactionContext.Commit(); - - return returnValue; - } - } - - public interface ITransactionContext - { - void Push(); - void Rollback(); - void Commit(); - } - - public class TransactionContext : ITransactionContext - { - public void Push() - { - - } - - public void Rollback() - { - - } - - public void Commit() - { - - } - } -} diff --git a/Example/FreeAdvice.Aspects/ExternalDmsContext.cs b/Example/FreeAdvice.Aspects/ExternalDmsContext.cs deleted file mode 100644 index 46fc3d3..0000000 --- a/Example/FreeAdvice.Aspects/ExternalDmsContext.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using FreeAdvice.Common; -using NAdvisor.Core; - -namespace FreeAdvice.Aspects -{ - public class ExternalDmsContext : IAspect - { - private readonly IDms _dms; - - public ExternalDmsContext(IDms dms) - { - _dms = dms; - } - - public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) - { - object returnValue; - try - { - returnValue = proceedInvocation.Invoke(args); - _dms.Commit(); - } - catch(Exception ex) - { - _dms.Rollback(); - throw ex; - } - - return returnValue; - } - } - - public interface IDms - { - void Commit(); - void Rollback(); - void AddDocumentToFolder(Guid folderId, byte[] document, string filename); - } - - public class Dms : IDms - { - private readonly ILogger _logger; - - public Dms(ILogger logger) - { - _logger = logger; - } - - public void Commit() - { - _logger.Debug("DmsCommit"); - } - - public void Rollback() - { - _logger.Debug("DmsRollback"); - } - - public void AddDocumentToFolder(Guid folderId, byte[] document, string filename) - { - _logger.Debug(string.Format("DmsAddDocumentToFolder: {0}", filename)); - } - } -} diff --git a/Example/FreeAdvice.Aspects/FreeAdvice.Aspects.csproj b/Example/FreeAdvice.Aspects/FreeAdvice.Aspects.csproj deleted file mode 100644 index 365ca7e..0000000 --- a/Example/FreeAdvice.Aspects/FreeAdvice.Aspects.csproj +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{12BEF773-E33E-4E44-B82E-2C4D7954D773}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Aspects</RootNamespace> - <AssemblyName>FreeAdvice.Aspects</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="ExternalDmsContext.cs" /> - <Compile Include="DatabaseContext.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\NAdvisor\NAdvisor.Core.csproj"> - <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> - <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> - <Name>FreeAdvice.Common</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Aspects/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Aspects/Properties/AssemblyInfo.cs deleted file mode 100644 index 4d2ef46..0000000 --- a/Example/FreeAdvice.Aspects/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Aspects")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Aspects")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a9e76725-69e7-4ed0-923a-23d4077b98e2")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Common/Configuration.cs b/Example/FreeAdvice.Common/Configuration.cs deleted file mode 100644 index b93399e..0000000 --- a/Example/FreeAdvice.Common/Configuration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace FreeAdvice.Common -{ - public interface IConfiguration - { - Guid GetDefaultDocumentFolder { get; } - } - - public class Configuration : IConfiguration - { - private readonly Guid defaultFolder = new Guid("{52E807B7-8A73-4756-B7E8-EBDBBC9B0C62}"); - - public Guid GetDefaultDocumentFolder - { - get { return defaultFolder; } - } - } -} diff --git a/Example/FreeAdvice.Common/FreeAdvice.Common.csproj b/Example/FreeAdvice.Common/FreeAdvice.Common.csproj deleted file mode 100644 index 71d666d..0000000 --- a/Example/FreeAdvice.Common/FreeAdvice.Common.csproj +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Common</RootNamespace> - <AssemblyName>FreeAdvice.Common</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Configuration.cs" /> - <Compile Include="Logger.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="ValidationException.cs" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Common/Logger.cs b/Example/FreeAdvice.Common/Logger.cs deleted file mode 100644 index 3ded6d8..0000000 --- a/Example/FreeAdvice.Common/Logger.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace FreeAdvice.Common -{ - public interface ILogger - { - void LogError(string error); - void LogInfo(string info); - void Debug(string debug); - } - - public class Logger : ILogger - { - public EventHandler<BoringEventArgs> LoggingEvents; - - public void ThrowEvent(string logText) - { - if(LoggingEvents != null) - LoggingEvents(this, new BoringEventArgs() { Arguments = logText}); - } - - public void LogError(string error) - { - ThrowEvent("ERROR: " + error); - } - - public void LogInfo(string info) - { - ThrowEvent("INFO: " + info); - } - - public void Debug(string debug) - { - ThrowEvent("DEBUG: " + debug); - } - } - - public class BoringEventArgs : EventArgs - { - public string Arguments { get; set;} - } -} diff --git a/Example/FreeAdvice.Common/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Common/Properties/AssemblyInfo.cs deleted file mode 100644 index b5d276e..0000000 --- a/Example/FreeAdvice.Common/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Common")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Common")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("03d8d7dd-a483-43a0-b547-ddc6a0b210f0")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Common/ValidationException.cs b/Example/FreeAdvice.Common/ValidationException.cs deleted file mode 100644 index df235bd..0000000 --- a/Example/FreeAdvice.Common/ValidationException.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.Text; - -namespace FreeAdvice.Common -{ - public class ValidationException : Exception - { - public ValidationException() - { - } - - public ValidationException(string message) : base(message) - { - } - - public ValidationException(string message, Exception innerException) : base(message, innerException) - { - } - - protected ValidationException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} diff --git a/Example/FreeAdvice.Configuration/Configure.cs b/Example/FreeAdvice.Configuration/Configure.cs deleted file mode 100644 index 8dd7d7c..0000000 --- a/Example/FreeAdvice.Configuration/Configure.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Autofac; -using FreeAdvice.Common; -using FreeAdvice.Repositories; -using FreeAdvice.Repositories.Interfaces; - -namespace FreeAdvice.Configuration -{ - public class Configure - { - public static void ConfigureApplicationContainer() - { - var container = new Autofac.Builder.ContainerBuilder(); - - //Infrastructure - container.Register(d => new Logger()).As<ILogger>(); - - //Repositories - container.Register(d => new AdviceRepository()).As<IAdviceRepository>(); - - DIContainer.Container.ApplicationContainer = container.Build(); - } - - public static void ConfigureSessionContainer() - { - IContainer sessionContainer = DIContainer.Container.ApplicationContainer.CreateInnerContainer(); - - var container = new Autofac.Builder.ContainerBuilder(); - - //Register Services - - - container.Build(sessionContainer); - DIContainer.Container.SessionContainer = sessionContainer; - } - } -} diff --git a/Example/FreeAdvice.Configuration/FreeAdvice.Configuration.csproj b/Example/FreeAdvice.Configuration/FreeAdvice.Configuration.csproj deleted file mode 100644 index 47c96de..0000000 --- a/Example/FreeAdvice.Configuration/FreeAdvice.Configuration.csproj +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Configuration</RootNamespace> - <AssemblyName>FreeAdvice.Configuration</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Autofac, Version=1.4.3.536, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\References\autofac\Autofac.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Configure.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> - <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> - <Name>FreeAdvice.Common</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.DIContainer\FreeAdvice.DIContainer.csproj"> - <Project>{7F452EC5-E286-4230-99F1-25AA78A712BB}</Project> - <Name>FreeAdvice.DIContainer</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> - <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> - <Name>FreeAdvice.Repositories.Interfaces</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Repositories\FreeAdvice.Repositories.csproj"> - <Project>{20AD9BC4-3B86-485B-9062-454D04A18F14}</Project> - <Name>FreeAdvice.Repositories</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Configuration/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Configuration/Properties/AssemblyInfo.cs deleted file mode 100644 index 481af6e..0000000 --- a/Example/FreeAdvice.Configuration/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Configuration")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Configuration")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("25d3c359-c5c9-4673-bc89-68cdcb6d392d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.DIContainer/Container.cs b/Example/FreeAdvice.DIContainer/Container.cs deleted file mode 100644 index 2f590be..0000000 --- a/Example/FreeAdvice.DIContainer/Container.cs +++ /dev/null @@ -1,81 +0,0 @@ - -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Web; -using Autofac; -using IContainer=Autofac.IContainer; - -namespace FreeAdvice.DIContainer -{ - public class Container - { - private const string applicationContainerKey = "________ApplicationDependencyInjection"; - private static IContainer _applicationContainer; - - public static IContainer ApplicationContainer - { - get - { - if (HttpContext.Current == null) - return _applicationContainer; - - return HttpContext.Current.Application[applicationContainerKey] as IContainer; - } - set - { - if (HttpContext.Current == null) - { - _applicationContainer = value; - return; - } - - HttpContext.Current.Application.Lock(); - HttpContext.Current.Application[applicationContainerKey] = value; - HttpContext.Current.Application.UnLock(); - } - } - - public static IContainer CreateInnerContainer() - { - if (HttpContext.Current != null) HttpContext.Current.Application.Lock(); - IContainer innercontainer = ApplicationContainer.CreateInnerContainer(); - if (HttpContext.Current != null) HttpContext.Current.Application.UnLock(); - - return innercontainer; - } - - /// <summary> - /// Session Container - /// </summary> - private const string sessionContainerKey = "________SessionDependencyInjection"; - private static IContainer sessionContainer; - - public static IContainer SessionContainer - { - get - { - if (HttpContext.Current == null) - return sessionContainer; - - if (HttpContext.Current.Session[sessionContainerKey] == null) - { - IContainer innerContainer = CreateInnerContainer(); - HttpContext.Current.Session[sessionContainerKey] = innerContainer; - return innerContainer; - } - return HttpContext.Current.Session[sessionContainerKey] as IContainer; - } - set - { - if (HttpContext.Current != null) - { - HttpContext.Current.Session[sessionContainerKey] = value; - return; - } - sessionContainer = value; - } - } - } -} diff --git a/Example/FreeAdvice.DIContainer/FreeAdvice.DIContainer.csproj b/Example/FreeAdvice.DIContainer/FreeAdvice.DIContainer.csproj deleted file mode 100644 index eabb26f..0000000 --- a/Example/FreeAdvice.DIContainer/FreeAdvice.DIContainer.csproj +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{7F452EC5-E286-4230-99F1-25AA78A712BB}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.DIContainer</RootNamespace> - <AssemblyName>FreeAdvice.DIContainer</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Autofac, Version=1.4.3.536, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\References\autofac\Autofac.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Web" /> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Container.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.DIContainer/Properties/AssemblyInfo.cs b/Example/FreeAdvice.DIContainer/Properties/AssemblyInfo.cs deleted file mode 100644 index c8e1933..0000000 --- a/Example/FreeAdvice.DIContainer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.DIContainer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.DIContainer")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("10e893f7-014a-4b90-a0ce-d2e2a604c609")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Domain/AdviceDto.cs b/Example/FreeAdvice.Domain/AdviceDto.cs deleted file mode 100644 index 23630d6..0000000 --- a/Example/FreeAdvice.Domain/AdviceDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace FreeAdvice.Domain -{ - public class AdviceDto - { - public Guid Id { get; set; } - public string AdviceText { get; set; } - public int RandomNumber { get; set; } - } -} diff --git a/Example/FreeAdvice.Domain/FreeAdvice.Domain.csproj b/Example/FreeAdvice.Domain/FreeAdvice.Domain.csproj deleted file mode 100644 index 2b1c737..0000000 --- a/Example/FreeAdvice.Domain/FreeAdvice.Domain.csproj +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Domain</RootNamespace> - <AssemblyName>FreeAdvice.Domain</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="AdviceDto.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Domain/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Domain/Properties/AssemblyInfo.cs deleted file mode 100644 index 21416c7..0000000 --- a/Example/FreeAdvice.Domain/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Domain")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Domain")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d4e23993-7e35-49ba-9cf7-5b4b2257718f")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.MSTest/AdviceServiceTest.cs b/Example/FreeAdvice.MSTest/AdviceServiceTest.cs deleted file mode 100644 index ec2f65a..0000000 --- a/Example/FreeAdvice.MSTest/AdviceServiceTest.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using FreeAdvice.Aspects; -using FreeAdvice.Common; -using FreeAdvice.Domain; -using FreeAdvice.Repositories.Interfaces; -using FreeAdvice.Service.Interfaces; -using FreeAdvice.Services; -using Moq; -using NAdvisor.Contrib; -using NAdvisor.Core; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace FreeAdvice.MSTest -{ - [TestClass] - public class AdviceServiceTest - { - [TestMethod] - public void Should_Validate_Advice_Dto() - { - //Given - var advice = new AdviceDto(); - var service = new AdviceService(null, null, null); - - //Then - MSTestHelper.ShouldThrowException<ValidationException>(() => service.UpdateAdvice(advice)); - } - - - /// <summary> - /// Note: May not be the typical goog unit Test but shows how much you can abuse it - /// </summary> - [TestMethod] - public void Should_Update_Repository_And_Commit_To_External_Dms_When_Validated() - { - //Constants - var documentFolder = Guid.NewGuid(); - - //Given - var advice = new AdviceDto() {AdviceText = "adsfasdfasdf", Id = default(Guid), RandomNumber = 3}; - var mockFactory = new MockFactory(MockBehavior.Strict); - - - //Service Dependencies - var adviceRepository = mockFactory.Create<IAdviceRepository>(); - var configuration = mockFactory.Create<IConfiguration>(); - - var aspects = new List<IAspect>(); - var transactionContext = mockFactory.Create<ITransactionContext>(); - var dms = mockFactory.Create<IDms>(); - //Aspect Configuration - - aspects.Add(new DatabaseContext(transactionContext.Object)); - aspects.Add(new ExternalDmsContext(dms.Object)); - - var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, aspects); - var service = advisor.GetAdvicedProxy<IAdviceService>(new AdviceService(adviceRepository.Object, dms.Object, configuration.Object)); - - //setup Mocks - transactionContext.Setup(tc => tc.Push()).AtMost(1); - configuration.Setup(co => co.GetDefaultDocumentFolder).Returns(documentFolder).AtMostOnce(); - dms.Setup(dm => dm.AddDocumentToFolder(It.IsAny<Guid>(), It.IsAny<byte[]>(), It.IsAny<string>())).AtMostOnce(); - adviceRepository.Setup(ar => ar.UpdateAdvice(advice)).AtMostOnce(); - dms.Setup(dm => dm.Commit()).AtMostOnce(); - transactionContext.Setup(tc => tc.Commit()); - - //Then - service.UpdateAdvice(advice); - - //When - - mockFactory.VerifyAll(); - } - } -} diff --git a/Example/FreeAdvice.MSTest/FreeAdvice.MSTest.csproj b/Example/FreeAdvice.MSTest/FreeAdvice.MSTest.csproj deleted file mode 100644 index 83d47b7..0000000 --- a/Example/FreeAdvice.MSTest/FreeAdvice.MSTest.csproj +++ /dev/null @@ -1,91 +0,0 @@ -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{0B022C57-B497-43F9-A5F6-BAE8519F7458}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.MSTest</RootNamespace> - <AssemblyName>FreeAdvice.MSTest</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> - <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\References\moq\Moq.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="AdviceServiceTest.cs" /> - <Compile Include="MSTestHelper.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> - <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> - <Name>NAdvisor.Contrib</Name> - </ProjectReference> - <ProjectReference Include="..\..\NAdvisor\NAdvisor.Core.csproj"> - <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor.Core</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj"> - <Project>{12BEF773-E33E-4E44-B82E-2C4D7954D773}</Project> - <Name>FreeAdvice.Aspects</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> - <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> - <Name>FreeAdvice.Common</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> - <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> - <Name>FreeAdvice.Domain</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> - <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> - <Name>FreeAdvice.Repositories.Interfaces</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj"> - <Project>{B41065F5-02BC-436A-B21A-DB814C62FBDE}</Project> - <Name>FreeAdvice.Service.Interfaces</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Services\FreeAdvice.Services.csproj"> - <Project>{48D92B96-65B9-4592-AB37-76CE40515AEE}</Project> - <Name>FreeAdvice.Services</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.MSTest/MSTestHelper.cs b/Example/FreeAdvice.MSTest/MSTestHelper.cs deleted file mode 100644 index 3decc60..0000000 --- a/Example/FreeAdvice.MSTest/MSTestHelper.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; - - -namespace FreeAdvice.MSTest -{ - public static class MSTestHelper - { - public static void ShouldThrowException<TypeOfException>(Action exceptionThrowingAction) - { - try - { - exceptionThrowingAction(); - } - catch(Exception ex) - { - if(!(ex is TypeOfException)) - { - Assert.Fail("Should throw a different kind of exception"); - } - } - } - } -} diff --git a/Example/FreeAdvice.MSTest/Properties/AssemblyInfo.cs b/Example/FreeAdvice.MSTest/Properties/AssemblyInfo.cs deleted file mode 100644 index 3460aa0..0000000 --- a/Example/FreeAdvice.MSTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.MSTest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.MSTest")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM componenets. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("31ecb176-149f-45f5-9c6a-e19077966164")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Repositories.Interfaces/FreeAdvice.Repositories.Interfaces.csproj b/Example/FreeAdvice.Repositories.Interfaces/FreeAdvice.Repositories.Interfaces.csproj deleted file mode 100644 index c432a6d..0000000 --- a/Example/FreeAdvice.Repositories.Interfaces/FreeAdvice.Repositories.Interfaces.csproj +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{EF37D586-9279-434D-B22D-92C2FC60710D}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Repositories.Interfaces</RootNamespace> - <AssemblyName>FreeAdvice.Repositories.Interfaces</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="IAdviceRepository.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> - <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> - <Name>FreeAdvice.Domain</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Repositories.Interfaces/IAdviceRepository.cs b/Example/FreeAdvice.Repositories.Interfaces/IAdviceRepository.cs deleted file mode 100644 index 92cf760..0000000 --- a/Example/FreeAdvice.Repositories.Interfaces/IAdviceRepository.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using FreeAdvice.Domain; - -namespace FreeAdvice.Repositories.Interfaces -{ - public interface IAdviceRepository - { - AdviceDto GetById(Guid id); - void UpdateAdvice(AdviceDto dto); - IEnumerable<AdviceDto> GetAdviceByAdviceText(string text); - IEnumerable<AdviceDto> GetAdviceByRandomNumber(int number); - IEnumerable<AdviceDto> GetAllAdvices(); - } -} diff --git a/Example/FreeAdvice.Repositories.Interfaces/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Repositories.Interfaces/Properties/AssemblyInfo.cs deleted file mode 100644 index 01378ee..0000000 --- a/Example/FreeAdvice.Repositories.Interfaces/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Repositories.Interfaces")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Repositories.Interfaces")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5994acf1-cfbb-4af3-a12b-46dc982163fd")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Repositories/AdviceRepository.cs b/Example/FreeAdvice.Repositories/AdviceRepository.cs deleted file mode 100644 index f058589..0000000 --- a/Example/FreeAdvice.Repositories/AdviceRepository.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using FreeAdvice.Domain; -using FreeAdvice.Repositories.Interfaces; - -namespace FreeAdvice.Repositories -{ - public class AdviceRepository : IAdviceRepository - { - private readonly Dictionary<Guid, AdviceDto> _advices; - private readonly Random _random; - - public AdviceRepository() - { - _random = new Random(); - _advices = InitializeAdvices(); - } - - private Dictionary<Guid, AdviceDto> InitializeAdvices() - { - var advices = new Dictionary<Guid, AdviceDto>(); - for (int i = 0; i < 35; i++ ) - { - var dto = CreateNewRandomDto(); - advices.Add(dto.Id, dto); - } - - return advices; - } - - private AdviceDto CreateNewRandomDto() - { - var advice = new AdviceDto(); - advice.Id = Guid.NewGuid(); - - advice.AdviceText = string.Empty; - for(int i = 0; i < _random.Next(3, 12); i++) - advice.AdviceText += Convert.ToChar(Convert.ToInt32(Math.Floor(26*_random.NextDouble() + 65))); - advice.RandomNumber = _random.Next(5); - - return advice; - } - - - - public AdviceDto GetById(Guid id) - { - return _advices[id]; - } - - public void UpdateAdvice(AdviceDto dto) - { - _advices[dto.Id] = dto; - } - - public IEnumerable<AdviceDto> GetAdviceByAdviceText(string text) - { - return _advices.Values.Where(ad => ad.AdviceText.Contains(text)); - } - - public IEnumerable<AdviceDto> GetAdviceByRandomNumber(int number) - { - return _advices.Values.Where(ad => ad.RandomNumber == number); - } - - public IEnumerable<AdviceDto> GetAllAdvices() - { - return _advices.Values; - } - } -} diff --git a/Example/FreeAdvice.Repositories/FreeAdvice.Repositories.csproj b/Example/FreeAdvice.Repositories/FreeAdvice.Repositories.csproj deleted file mode 100644 index 8540144..0000000 --- a/Example/FreeAdvice.Repositories/FreeAdvice.Repositories.csproj +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{20AD9BC4-3B86-485B-9062-454D04A18F14}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Repositories</RootNamespace> - <AssemblyName>FreeAdvice.Repositories</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="AdviceRepository.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> - <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> - <Name>FreeAdvice.Domain</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> - <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> - <Name>FreeAdvice.Repositories.Interfaces</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Repositories/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Repositories/Properties/AssemblyInfo.cs deleted file mode 100644 index 8b8a61a..0000000 --- a/Example/FreeAdvice.Repositories/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Repositories")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Repositories")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("dc884abc-3e7a-4eb0-8a1c-9c44043e6e66")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Service.Interfaces/FreeAdvice.Service.Interfaces.csproj b/Example/FreeAdvice.Service.Interfaces/FreeAdvice.Service.Interfaces.csproj deleted file mode 100644 index 1fac1c2..0000000 --- a/Example/FreeAdvice.Service.Interfaces/FreeAdvice.Service.Interfaces.csproj +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{B41065F5-02BC-436A-B21A-DB814C62FBDE}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Service.Interfaces</RootNamespace> - <AssemblyName>FreeAdvice.Service.Interfaces</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="IAdviceService.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> - <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> - <Name>FreeAdvice.Domain</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Service.Interfaces/IAdviceService.cs b/Example/FreeAdvice.Service.Interfaces/IAdviceService.cs deleted file mode 100644 index f1b1ef2..0000000 --- a/Example/FreeAdvice.Service.Interfaces/IAdviceService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using FreeAdvice.Domain; - -namespace FreeAdvice.Service.Interfaces -{ - public interface IAdviceService - { - AdviceDto GetAdvice(Guid id); - IEnumerable<AdviceDto> GetAllAdvices(); - void UpdateAdvice(AdviceDto dto); - } -} diff --git a/Example/FreeAdvice.Service.Interfaces/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Service.Interfaces/Properties/AssemblyInfo.cs deleted file mode 100644 index d90476f..0000000 --- a/Example/FreeAdvice.Service.Interfaces/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Service.Interfaces")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Service.Interfaces")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("46be273f-cf61-41d1-af92-b52d5bf7e2ff")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Services/AdviceService.cs b/Example/FreeAdvice.Services/AdviceService.cs deleted file mode 100644 index 128087b..0000000 --- a/Example/FreeAdvice.Services/AdviceService.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FreeAdvice.Aspects; -using FreeAdvice.Common; -using FreeAdvice.Domain; -using FreeAdvice.Repositories.Interfaces; -using FreeAdvice.Service.Interfaces; -using NAdvisor.Contrib; - -namespace FreeAdvice.Services -{ - public class AdviceService : IAdviceService - { - private readonly IAdviceRepository _adviceRepository; - private readonly IDms _dms; - private readonly IConfiguration _configuration; - - public AdviceService(IAdviceRepository adviceRepository, IDms dms, IConfiguration configuration) - { - _adviceRepository = adviceRepository; - _dms = dms; - _configuration = configuration; - } - - public AdviceDto GetAdvice(Guid id) - { - return _adviceRepository.GetById(id); - } - - public IEnumerable<AdviceDto> GetAllAdvices() - { - return _adviceRepository.GetAllAdvices(); - } - - [InterceptedBy(typeof(DatabaseContext), typeof(ExternalDmsContext))] - public void UpdateAdvice(AdviceDto dto) - { - IEnumerable<string> validationErrors = ValidateAdvice(dto); - if (validationErrors.Count() != 0) - throw new ValidationException("Validationerrors: " + validationErrors.Aggregate((m, o) => m + "; " + o)); - - if (dto.Id == Guid.Empty) - dto.Id = Guid.NewGuid(); - - _dms.AddDocumentToFolder(_configuration.GetDefaultDocumentFolder, GenerateDocumentForAdvice(dto), GetFileNameForAdvice(dto)); - _adviceRepository.UpdateAdvice(dto); - } - - private string GetFileNameForAdvice(AdviceDto dto) - { - return dto.Id.ToString() + ".doc"; - } - - private byte[] GenerateDocumentForAdvice(AdviceDto dto) - { - return new byte[3]; - } - - private IEnumerable<string> ValidateAdvice(AdviceDto dto) - { - if (!string.IsNullOrEmpty(dto.AdviceText) && dto.AdviceText.Length < 5) - yield return "need more characters"; - - if (dto.RandomNumber == default(int)) - yield return "need a random Number"; - } - } -} diff --git a/Example/FreeAdvice.Services/FreeAdvice.Services.csproj b/Example/FreeAdvice.Services/FreeAdvice.Services.csproj deleted file mode 100644 index ba4fbdf..0000000 --- a/Example/FreeAdvice.Services/FreeAdvice.Services.csproj +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{48D92B96-65B9-4592-AB37-76CE40515AEE}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice.Services</RootNamespace> - <AssemblyName>FreeAdvice.Services</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="AdviceService.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> - <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> - <Name>NAdvisor.Contrib</Name> - </ProjectReference> - <ProjectReference Include="..\..\NAdvisor\NAdvisor.Core.csproj"> - <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj"> - <Project>{12BEF773-E33E-4E44-B82E-2C4D7954D773}</Project> - <Name>FreeAdvice.Aspects</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> - <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> - <Name>FreeAdvice.Common</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> - <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> - <Name>FreeAdvice.Domain</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> - <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> - <Name>FreeAdvice.Repositories.Interfaces</Name> - </ProjectReference> - <ProjectReference Include="..\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj"> - <Project>{B41065F5-02BC-436A-B21A-DB814C62FBDE}</Project> - <Name>FreeAdvice.Service.Interfaces</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Services/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Services/Properties/AssemblyInfo.cs deleted file mode 100644 index b49fbb9..0000000 --- a/Example/FreeAdvice.Services/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice.Services")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice.Services")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8ae9d61c-07e0-4092-a85a-8923d5bd86ff")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice/DIContainer.cs b/Example/FreeAdvice/DIContainer.cs deleted file mode 100644 index b6fa8ba..0000000 --- a/Example/FreeAdvice/DIContainer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace FreeAdvice -{ - public class DIContainer - { - - } -} diff --git a/Example/FreeAdvice/Default.aspx b/Example/FreeAdvice/Default.aspx deleted file mode 100644 index f6ab9f8..0000000 --- a/Example/FreeAdvice/Default.aspx +++ /dev/null @@ -1,16 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FreeAdvice._Default" %> - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" > -<head runat="server"> - <title></title> -</head> -<body> - <form id="form1" runat="server"> - <div> - - </div> - </form> -</body> -</html> diff --git a/Example/FreeAdvice/Default.aspx.cs b/Example/FreeAdvice/Default.aspx.cs deleted file mode 100644 index 7811ecb..0000000 --- a/Example/FreeAdvice/Default.aspx.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; - -namespace FreeAdvice -{ - public partial class _Default : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - - } - } -} diff --git a/Example/FreeAdvice/Default.aspx.designer.cs b/Example/FreeAdvice/Default.aspx.designer.cs deleted file mode 100644 index 988f9d2..0000000 --- a/Example/FreeAdvice/Default.aspx.designer.cs +++ /dev/null @@ -1,27 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace FreeAdvice -{ - - - public partial class _Default - { - - /// <summary> - /// form1 control. - /// </summary> - /// <remarks> - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// </remarks> - protected global::System.Web.UI.HtmlControls.HtmlForm form1; - } -} diff --git a/Example/FreeAdvice/FreeAdvice.csproj b/Example/FreeAdvice/FreeAdvice.csproj deleted file mode 100644 index 93c099a..0000000 --- a/Example/FreeAdvice/FreeAdvice.csproj +++ /dev/null @@ -1,117 +0,0 @@ -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}</ProjectGuid> - <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>FreeAdvice</RootNamespace> - <AssemblyName>FreeAdvice</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Autofac, Version=1.4.3.536, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\References\autofac\Autofac.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Web.Extensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Drawing" /> - <Reference Include="System.Web" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Configuration" /> - <Reference Include="System.Web.Services" /> - <Reference Include="System.EnterpriseServices" /> - <Reference Include="System.Web.Mobile" /> - </ItemGroup> - <ItemGroup> - <Content Include="Default.aspx" /> - <Content Include="Global.asax" /> - <Content Include="Web.config" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Default.aspx.cs"> - <SubType>ASPXCodeBehind</SubType> - <DependentUpon>Default.aspx</DependentUpon> - </Compile> - <Compile Include="Default.aspx.designer.cs"> - <DependentUpon>Default.aspx</DependentUpon> - </Compile> - <Compile Include="DIContainer.cs" /> - <Compile Include="Global.asax.cs"> - <DependentUpon>Global.asax</DependentUpon> - </Compile> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <Folder Include="App_Data\" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> - <WebProjectProperties> - <UseIIS>False</UseIIS> - <AutoAssignPort>True</AutoAssignPort> - <DevelopmentServerPort>2754</DevelopmentServerPort> - <DevelopmentServerVPath>/</DevelopmentServerVPath> - <IISUrl> - </IISUrl> - <NTLMAuthentication>False</NTLMAuthentication> - <UseCustomServer>False</UseCustomServer> - <CustomServerUrl> - </CustomServerUrl> - <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> - </WebProjectProperties> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> -</Project> \ No newline at end of file diff --git a/Example/FreeAdvice/Global.asax b/Example/FreeAdvice/Global.asax deleted file mode 100644 index fa6c441..0000000 --- a/Example/FreeAdvice/Global.asax +++ /dev/null @@ -1 +0,0 @@ -<%@ Application Codebehind="Global.asax.cs" Inherits="FreeAdvice.Global" Language="C#" %> diff --git a/Example/FreeAdvice/Global.asax.cs b/Example/FreeAdvice/Global.asax.cs deleted file mode 100644 index e4599ac..0000000 --- a/Example/FreeAdvice/Global.asax.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Security; -using System.Web.SessionState; - -namespace FreeAdvice -{ - public class Global : System.Web.HttpApplication - { - - protected void Application_Start(object sender, EventArgs e) - { - - } - - protected void Session_Start(object sender, EventArgs e) - { - - } - - protected void Application_BeginRequest(object sender, EventArgs e) - { - - } - - protected void Application_AuthenticateRequest(object sender, EventArgs e) - { - - } - - protected void Application_Error(object sender, EventArgs e) - { - - } - - protected void Session_End(object sender, EventArgs e) - { - - } - - protected void Application_End(object sender, EventArgs e) - { - - } - } -} \ No newline at end of file diff --git a/Example/FreeAdvice/Properties/AssemblyInfo.cs b/Example/FreeAdvice/Properties/AssemblyInfo.cs deleted file mode 100644 index e63e7c1..0000000 --- a/Example/FreeAdvice/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FreeAdvice")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeAdvice")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice/Web.config b/Example/FreeAdvice/Web.config deleted file mode 100644 index fcaa9dc..0000000 --- a/Example/FreeAdvice/Web.config +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version="1.0"?> - -<configuration> - - - <configSections> - <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> - <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> - <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> - <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> - <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> - <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> - <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> - <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> - </sectionGroup> - </sectionGroup> - </sectionGroup> - </configSections> - - - <appSettings/> - <connectionStrings/> - - <system.web> - <!-- - Set compilation debug="true" to insert debugging - symbols into the compiled page. Because this - affects performance, set this value to true only - during development. - --> - <compilation debug="false"> - - <assemblies> - <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> - <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> - <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> - </assemblies> - - </compilation> - <!-- - The <authentication> section enables configuration - of the security authentication mode used by - ASP.NET to identify an incoming user. - --> - <authentication mode="Windows" /> - <!-- - The <customErrors> section enables configuration - of what to do if/when an unhandled error occurs - during the execution of a request. Specifically, - it enables developers to configure html error pages - to be displayed in place of a error stack trace. - - <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> - <error statusCode="403" redirect="NoAccess.htm" /> - <error statusCode="404" redirect="FileNotFound.htm" /> - </customErrors> - --> - - <pages> - <controls> - <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - </controls> - </pages> - - <httpHandlers> - <remove verb="*" path="*.asmx"/> - <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> - </httpHandlers> - <httpModules> - <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - </httpModules> - - </system.web> - - <system.codedom> - <compilers> - <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" - type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <providerOption name="CompilerVersion" value="v3.5"/> - <providerOption name="WarnAsError" value="false"/> - </compiler> - </compilers> - </system.codedom> - - <!-- - The system.webServer section is required for running ASP.NET AJAX under Internet - Information Services 7.0. It is not necessary for previous version of IIS. - --> - <system.webServer> - <validation validateIntegratedModeConfiguration="false"/> - <modules> - <remove name="ScriptModule" /> - <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - </modules> - <handlers> - <remove name="WebServiceHandlerFactory-Integrated"/> - <remove name="ScriptHandlerFactory" /> - <remove name="ScriptHandlerFactoryAppServices" /> - <remove name="ScriptResource" /> - <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" - type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" - type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> - </handlers> - </system.webServer> - - <runtime> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <dependentAssembly> - <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> - <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> - <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> - </dependentAssembly> - </assemblyBinding> - </runtime> - -</configuration> diff --git a/LocalTestRun.testrunconfig b/LocalTestRun.testrunconfig index 7523e6c..37d71fa 100644 --- a/LocalTestRun.testrunconfig +++ b/LocalTestRun.testrunconfig @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestRunConfiguration name="Local Test Run" id="28fa1ee6-6953-4ff2-b14e-6de7acbbdc1f" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006"> +<?xml version="1.0" encoding="utf-8"?> +<TestRunConfiguration name="Local Test Run" id="28fa1ee6-6953-4ff2-b14e-6de7acbbdc1f" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> <Description>This is a default test run configuration for a local test run.</Description> <TestTypeSpecific /> </TestRunConfiguration> \ No newline at end of file diff --git a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index 65d7a1f..dbdf80e 100644 --- a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,72 +1,116 @@ -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> - <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AttributeBasedJointPointDefinitionTests.cs" /> <Compile Include="SampleMemozizationTests.cs" /> <Compile Include="IMethodInvokesShouldBeCachedClass.cs" /> <Compile Include="MethodInvokesShouldBeCachedClass.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SimpleEventArgs.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include=".NETFramework,Version=v4.0"> + <Visible>False</Visible> + <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index c64bc4b..1765617 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,79 +1,118 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="MemoizeJointPointDefinition.cs" /> <Compile Include="InterceptedBy\InterceptedByAttribute.cs" /> <Compile Include="InterceptedBy\JointPointDefinition.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.sln b/NAdvisor.sln index a87ccf1..727a804 100644 --- a/NAdvisor.sln +++ b/NAdvisor.sln @@ -1,128 +1,47 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Core", "NAdvisor\NAdvisor.Core.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest", "NAdvisorTest\NAdvisorTest.csproj", "{EEE750E7-0D26-4845-8AFA-9617752454A5}" -EndProject +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CF09232-5830-459C-9115-28284BA0B6A4}" ProjectSection(SolutionItems) = preProject LocalTestRun.testrunconfig = LocalTestRun.testrunconfig NAdvisor.vsmdi = NAdvisor.vsmdi EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{CC6CCF2B-D048-4DC8-80E9-CBB3523C5181}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice", "Example\FreeAdvice\FreeAdvice.csproj", "{6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Aspects", "Example\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj", "{12BEF773-E33E-4E44-B82E-2C4D7954D773}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Common", "Example\FreeAdvice.Common\FreeAdvice.Common.csproj", "{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Configuration", "Example\FreeAdvice.Configuration\FreeAdvice.Configuration.csproj", "{FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.DIContainer", "Example\FreeAdvice.DIContainer\FreeAdvice.DIContainer.csproj", "{7F452EC5-E286-4230-99F1-25AA78A712BB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Domain", "Example\FreeAdvice.Domain\FreeAdvice.Domain.csproj", "{BB90B793-65A7-4D10-9065-EC04583EAFDB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Repositories", "Example\FreeAdvice.Repositories\FreeAdvice.Repositories.csproj", "{20AD9BC4-3B86-485B-9062-454D04A18F14}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Repositories.Interfaces", "Example\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj", "{EF37D586-9279-434D-B22D-92C2FC60710D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Services", "Example\FreeAdvice.Services\FreeAdvice.Services.csproj", "{48D92B96-65B9-4592-AB37-76CE40515AEE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Service.Interfaces", "Example\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj", "{B41065F5-02BC-436A-B21A-DB814C62FBDE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.MSTest", "Example\FreeAdvice.MSTest\FreeAdvice.MSTest.csproj", "{0B022C57-B497-43F9-A5F6-BAE8519F7458}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Core", "NAdvisor\NAdvisor.Core.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Test", "NAdvisor.Contrib.Test\NAdvisor.Contrib.Test.csproj", "{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest40", "NAdvisorTest40\NAdvisorTest40.csproj", "{A8FAA007-59EB-49B9-BA44-6AC4989DD2D3}" +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = NAdvisor.vsmdi EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.Build.0 = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.ActiveCfg = Release|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.Build.0 = Release|Any CPU - {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.Build.0 = Release|Any CPU - {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Release|Any CPU.Build.0 = Release|Any CPU - {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Debug|Any CPU.Build.0 = Debug|Any CPU - {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Release|Any CPU.ActiveCfg = Release|Any CPU - {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Release|Any CPU.Build.0 = Release|Any CPU - {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Release|Any CPU.Build.0 = Release|Any CPU - {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Release|Any CPU.Build.0 = Release|Any CPU - {7F452EC5-E286-4230-99F1-25AA78A712BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F452EC5-E286-4230-99F1-25AA78A712BB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F452EC5-E286-4230-99F1-25AA78A712BB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F452EC5-E286-4230-99F1-25AA78A712BB}.Release|Any CPU.Build.0 = Release|Any CPU - {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Release|Any CPU.Build.0 = Release|Any CPU - {20AD9BC4-3B86-485B-9062-454D04A18F14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20AD9BC4-3B86-485B-9062-454D04A18F14}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20AD9BC4-3B86-485B-9062-454D04A18F14}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20AD9BC4-3B86-485B-9062-454D04A18F14}.Release|Any CPU.Build.0 = Release|Any CPU - {EF37D586-9279-434D-B22D-92C2FC60710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF37D586-9279-434D-B22D-92C2FC60710D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF37D586-9279-434D-B22D-92C2FC60710D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF37D586-9279-434D-B22D-92C2FC60710D}.Release|Any CPU.Build.0 = Release|Any CPU - {48D92B96-65B9-4592-AB37-76CE40515AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48D92B96-65B9-4592-AB37-76CE40515AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {48D92B96-65B9-4592-AB37-76CE40515AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48D92B96-65B9-4592-AB37-76CE40515AEE}.Release|Any CPU.Build.0 = Release|Any CPU - {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Release|Any CPU.Build.0 = Release|Any CPU - {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Release|Any CPU.Build.0 = Release|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.Build.0 = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU + {A8FAA007-59EB-49B9-BA44-6AC4989DD2D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8FAA007-59EB-49B9-BA44-6AC4989DD2D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8FAA007-59EB-49B9-BA44-6AC4989DD2D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8FAA007-59EB-49B9-BA44-6AC4989DD2D3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {12BEF773-E33E-4E44-B82E-2C4D7954D773} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {F889330D-DFBF-4805-8D5D-3EA3B593EDE2} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {7F452EC5-E286-4230-99F1-25AA78A712BB} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {BB90B793-65A7-4D10-9065-EC04583EAFDB} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {20AD9BC4-3B86-485B-9062-454D04A18F14} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {EF37D586-9279-434D-B22D-92C2FC60710D} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {48D92B96-65B9-4592-AB37-76CE40515AEE} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {B41065F5-02BC-436A-B21A-DB814C62FBDE} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - {0B022C57-B497-43F9-A5F6-BAE8519F7458} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} - EndGlobalSection EndGlobal diff --git a/NAdvisor.vsmdi b/NAdvisor.vsmdi index e3a5088..fa18854 100644 --- a/NAdvisor.vsmdi +++ b/NAdvisor.vsmdi @@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="UTF-8"?> -<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006"> +<?xml version="1.0" encoding="utf-8"?> +<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> <RunConfiguration id="28fa1ee6-6953-4ff2-b14e-6de7acbbdc1f" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" /> </TestList> </TestLists> \ No newline at end of file diff --git a/NAdvisor/NAdvisor.Core.csproj b/NAdvisor/NAdvisor.Core.csproj index bdd9e33..eb3dd55 100644 --- a/NAdvisor/NAdvisor.Core.csproj +++ b/NAdvisor/NAdvisor.Core.csproj @@ -1,81 +1,120 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{924BDC9D-7752-496C-B0F5-379F8D390C60}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Core</RootNamespace> <AssemblyName>NAdvisor.Core</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AdviceInterceptor.cs" /> <Compile Include="Advisor.cs" /> <Compile Include="Implementation\AspectEnvironment.cs" /> <Compile Include="Implementation\DictionaryKeyValueStore.cs" /> <Compile Include="Interfaces\IAspectEnvironment.cs" /> <Compile Include="Interfaces\IAspect.cs" /> <Compile Include="Interfaces\IKeyValueStore.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisorTest/AdvisorTests.cs b/NAdvisorTest/AdvisorTests.cs deleted file mode 100644 index 30b3249..0000000 --- a/NAdvisorTest/AdvisorTests.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NAdvisor.Core; - -namespace NAdvisorTest -{ - [TestClass] - public class AdvisorTests - { - [TestMethod] - public void Should_Only_Allow_Interfaces_to_proxy1() - { - //Given - var advisor = new Advisor(new List<IAspect>()); - - //Then - MSTestHelper.ShouldThrowException<ArgumentException>(() => advisor.GetAdvicedProxy<Target>(new Target())); - } - - [TestMethod] - public void Should_Only_Allow_Interfaces_to_proxy2() - { - //Given - var advisor = new Advisor(new List<IAspect>()); - - //Then - MSTestHelper.ShouldThrowException<ArgumentException>(() => advisor.GetAdvicedProxy(typeof(Target), new Target())); - } - - } -} diff --git a/NAdvisorTest/AspectEnvironmentDictionaryTests.cs b/NAdvisorTest/AspectEnvironmentDictionaryTests.cs deleted file mode 100644 index 2a64568..0000000 --- a/NAdvisorTest/AspectEnvironmentDictionaryTests.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NAdvisor.Core; -using Moq; - -namespace NAdvisorTest -{ - [TestClass] - public class AspectEnvironmentDictionaryTests - { - [TestMethod] - public void Should_be_able_to_get_and_set_values_in_the_AspectEnvironment() - { - //Given - var target = new Target(); - - Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> jointPointDefinition = JointPointDefinition; - var proxiedTarget = new Advisor(jointPointDefinition, new List<IAspect>()).GetAdvicedProxy<ITarget>(target); - - - //Then - proxiedTarget.DoneSomething("test"); - - //When - - } - - private IList<IAspect> JointPointDefinition(IAspectEnvironment environMent, IList<IAspect> aspectList) - { - - return aspectList; - } - - [TestMethod] - public void Should_put_value_in_KeyValueStore() - { - //Given - var keyValueStore = new Mock<IKeyValueStore>(); - keyValueStore - .Setup(kv => kv.SetValue(It.Is<string>(st => st == "test"), It.IsAny<object>())) - .AtMostOnce(); - - Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> kvSetValueFunc = - (environment, aspect) => - { - environment.SetValue("test", new object()); - return aspect; - }; - var proxiedTarget = new Advisor(kvSetValueFunc, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target(), keyValueStore.Object); - - //Then - - proxiedTarget.DoneSomething("bamm"); - - //When - keyValueStore.VerifyAll(); - } - } -} diff --git a/NAdvisorTest/AspectEnvironmentTests.cs b/NAdvisorTest/AspectEnvironmentTests.cs deleted file mode 100644 index ae67edb..0000000 --- a/NAdvisorTest/AspectEnvironmentTests.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using NAdvisor.Core; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace NAdvisorTest -{ - [TestClass] - public class AspectEnvironmentTests - { - [TestMethod] - public void Should_have_Concrete_Type_in_AspectEnvironment() - { - Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> checkConcreteType = (environMent, aspects) => - { - Assert.AreEqual(environMent.ConcretetType, typeof(Target)); - - return aspects; - }; - var proxiedClass = new Advisor(checkConcreteType, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target()); - - proxiedClass.DoneSomething("test"); - } - - [TestMethod] - public void Should_have_interface_type_in_AspectEnvironmen() - { - Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> checkConcreteType = (environMent, aspects) => - { - Assert.AreEqual(environMent.InterfaceType, typeof(ITarget)); - - return aspects; - }; - var proxiedClass = new Advisor(checkConcreteType, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target()); - - proxiedClass.DoneSomething("test"); - } - } -} diff --git a/NAdvisorTest/MSTestHelper.cs b/NAdvisorTest/MSTestHelper.cs deleted file mode 100644 index ee4e43f..0000000 --- a/NAdvisorTest/MSTestHelper.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; - - -namespace NAdvisorTest -{ - public static class MSTestHelper - { - public static void ShouldThrowException<TypeOfException>(Action exceptionThrowingAction) - { - try - { - exceptionThrowingAction(); - } - catch(Exception ex) - { - if(!(ex is TypeOfException)) - { - Assert.Fail("Should throw a different kind of exception"); - } - } - } - } -} diff --git a/NAdvisorTest/NAdvisorTest.csproj b/NAdvisorTest/NAdvisorTest.csproj deleted file mode 100644 index 5de8aa7..0000000 --- a/NAdvisorTest/NAdvisorTest.csproj +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{EEE750E7-0D26-4845-8AFA-9617752454A5}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>NAdvisorTest</RootNamespace> - <AssemblyName>NAdvisorTest</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> - <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\References\moq\Moq.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="AdvisorTests.cs" /> - <Compile Include="AspectEnvironmentDictionaryTests.cs" /> - <Compile Include="AspectEnvironmentTests.cs" /> - <Compile Include="MSTestHelper.cs" /> - <Compile Include="TestClasses\Target.cs" /> - <Compile Include="TestClasses\ITarget.cs" /> - <Compile Include="TestClasses\SimpleEventArgs.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="SimpleAspectTests.cs" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> - <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor.Core</Name> - </ProjectReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project> \ No newline at end of file diff --git a/NAdvisorTest/Properties/AssemblyInfo.cs b/NAdvisorTest/Properties/AssemblyInfo.cs deleted file mode 100644 index bd1ad22..0000000 --- a/NAdvisorTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NAdvisorTest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NAdvisorTest")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("796e82e8-b428-451a-8cc9-fa2ce56b347a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NAdvisorTest/SimpleAspectTests.cs b/NAdvisorTest/SimpleAspectTests.cs deleted file mode 100644 index 9eeef77..0000000 --- a/NAdvisorTest/SimpleAspectTests.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NAdvisor.Core; - -namespace NAdvisorTest.SimpleAspectTests -{ - [TestClass] - public class SimpleAspectTests - { - [TestMethod] - public void Should_Intercept_By_Aspects() - { - //Given - var results = new List<string>(); - var simpleAspect = new SimpleAspect(); - var simpleService = new SimpleService(); - simpleAspect.DoneSomething += (sender, args) => results.Add(args.Message); - - var advisor = new Advisor(new List<IAspect>() {simpleAspect}); - var service = advisor.GetAdvicedProxy<ISimpleService>(simpleService); - - //Then - var result = service.DoSomething("hllo"); - - //When - Assert.AreEqual("executed", result); - Assert.AreEqual("hllo", results[0]); - Assert.AreEqual("donesomething", results[1]); - } - } - - public class SimpleAspect : IAspect - { - public EventHandler<SimpleEventArgs> DoneSomething; - - public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) - { - if(args.Length > 0) - { - if(args[0] is string) - { - RaiseDoneSomething((string)args[0]); - } - } - - object result = proceedInvocation(args); - - if (result is string) - RaiseDoneSomething((string) result); - - return "executed"; - } - - private void RaiseDoneSomething(string doneSomething) - { - if (DoneSomething != null) - DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); - } - } - - public interface ISimpleService - { - string DoSomething(string somethingTodo); - } - - public class SimpleService : ISimpleService - { - public EventHandler<SimpleEventArgs> DoneSomething; - - public string DoSomething(string somethingTodo) - { - if(DoneSomething != null) - DoneSomething.Invoke(this, new SimpleEventArgs(){Message = somethingTodo}); - - return "donesomething"; - } - } -} diff --git a/NAdvisorTest/TestClasses/ITarget.cs b/NAdvisorTest/TestClasses/ITarget.cs deleted file mode 100644 index ea858cf..0000000 --- a/NAdvisorTest/TestClasses/ITarget.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NAdvisorTest -{ - public interface ITarget - { - string DoneSomething(string input); - } -} \ No newline at end of file diff --git a/NAdvisorTest/TestClasses/SimpleEventArgs.cs b/NAdvisorTest/TestClasses/SimpleEventArgs.cs deleted file mode 100644 index 7502c86..0000000 --- a/NAdvisorTest/TestClasses/SimpleEventArgs.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NAdvisorTest -{ - public class SimpleEventArgs : EventArgs - { - public string Message { get; set; } - } -} diff --git a/NAdvisorTest/TestClasses/Target.cs b/NAdvisorTest/TestClasses/Target.cs deleted file mode 100644 index 873c1cc..0000000 --- a/NAdvisorTest/TestClasses/Target.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace NAdvisorTest -{ - public class Target : ITarget - { - public string DoneSomething(string input) - { - return input + "done"; - } - } -} \ No newline at end of file diff --git a/README b/README index 88eb1af..70ced1f 100644 --- a/README +++ b/README @@ -1,32 +1,35 @@ ####################################################################################################################### NAdivsor ####################################################################################################################### -This is a small library which adds Aspects during runtime. +NAdvisor is a small library which adds Aspects during runtime. If you are looking for traditional Aspects have a look at postsharp.org - -The difference compared to traditional Aspects are: +a +The differences compared to traditional Aspects are: - Aspects can be instantiated, therefor can have dependencies in the constructor (fits very well with DI) -- Trades fast compilation against slower execution, everything is done during runtime -- Aspects can have a different lifetime than there intercepted classes. +- Pointcuts/Join Points can be changed during runtime +- Aspects can have a different lifetime than theire intercepted classes. -Some Usecases which can't be easily solved with compile time weaved aspects: -- unit testing with or without aspects (can be handy if you only like to test your logic) -- JointPoints can only be determind during runtime +Some things which are difficult to do with compile time weaved Aspects but are trivial with NAdvisor: +- unit testing with or without aspects +- unit testing of your logic inside the aspects +- JointPoints can be determined during runtime - because aspects are normal objects, they can be instantiated, they can have dependencies. - using Mocked aspects during unit tests -- swap JointPoint definition during runtime (nice for switching on/off your performance measuring aspect) +- swap JointPoint definition during runtime (e.g. switching on/off performance measuring aspect) +- no impact on build time +- readable stacktraces Usage: //Instantiate a new SecurityAspect IAspect securityAspect = new SecurityAspect(user); //Creates a Proxy, chooses the Aspect from the List by the JointPointDefinition Advisor advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {securityAspect, loggingAspect}); -//Gets the Proxy which is intercepted by Aspects -ISimpleService myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); +//Gets a Proxy which is intercepted by the Securityaspect and Loggingaspect +ISimpleService myService = advisor.GetAdvicedProxy<ISimpleService>(new SimpleService());
chrido/NAdvisor
a822772ff3a9bd106bf067e0de5a407e1c9b2d9e
.net 4.0
diff --git a/NAdvisorTest40/AdvisorTests.cs b/NAdvisorTest40/AdvisorTests.cs new file mode 100644 index 0000000..142d616 --- /dev/null +++ b/NAdvisorTest40/AdvisorTests.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Core; + +namespace NAdvisorTest40 +{ + [TestClass] + public class AdvisorTests + { + [TestMethod] + public void Should_Only_Allow_Interfaces_to_proxy1() + { + //Given + var advisor = new Advisor(new List<IAspect>()); + + //Then + MSTestHelper.ShouldThrowException<ArgumentException>(() => advisor.GetAdvicedProxy<Target>(new Target())); + } + + [TestMethod] + public void Should_Only_Allow_Interfaces_to_proxy2() + { + //Given + var advisor = new Advisor(new List<IAspect>()); + + //Then + MSTestHelper.ShouldThrowException<ArgumentException>(() => advisor.GetAdvicedProxy(typeof(Target), new Target())); + } + + } +} diff --git a/NAdvisorTest40/AspectEnvironmentDictionaryTests.cs b/NAdvisorTest40/AspectEnvironmentDictionaryTests.cs new file mode 100644 index 0000000..99513bb --- /dev/null +++ b/NAdvisorTest40/AspectEnvironmentDictionaryTests.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Core; +using Moq; + +namespace NAdvisorTest40 +{ + [TestClass] + public class AspectEnvironmentDictionaryTests + { + [TestMethod] + public void Should_be_able_to_get_and_set_values_in_the_AspectEnvironment() + { + //Given + var target = new Target(); + + Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> jointPointDefinition = JointPointDefinition; + var proxiedTarget = new Advisor(jointPointDefinition, new List<IAspect>()).GetAdvicedProxy<ITarget>(target); + + + //Then + proxiedTarget.DoneSomething("test"); + + //When + + } + + private IList<IAspect> JointPointDefinition(IAspectEnvironment environMent, IList<IAspect> aspectList) + { + + return aspectList; + } + + [TestMethod] + public void Should_put_value_in_KeyValueStore() + { + //Given + var keyValueStore = new Mock<IKeyValueStore>(); + keyValueStore + .Setup(kv => kv.SetValue(It.Is<string>(st => st == "test"), It.IsAny<object>())) + .AtMostOnce(); + + Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> kvSetValueFunc = + (environment, aspect) => + { + environment.SetValue("test", new object()); + return aspect; + }; + var proxiedTarget = new Advisor(kvSetValueFunc, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target(), keyValueStore.Object); + + //Then + + proxiedTarget.DoneSomething("bamm"); + + //When + keyValueStore.VerifyAll(); + } + } +} diff --git a/NAdvisorTest40/AspectEnvironmentTests.cs b/NAdvisorTest40/AspectEnvironmentTests.cs new file mode 100644 index 0000000..3013225 --- /dev/null +++ b/NAdvisorTest40/AspectEnvironmentTests.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using NAdvisor.Core; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace NAdvisorTest40 +{ + [TestClass] + public class AspectEnvironmentTests + { + [TestMethod] + public void Should_have_Concrete_Type_in_AspectEnvironment() + { + Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> checkConcreteType = (environMent, aspects) => + { + Assert.AreEqual(environMent.ConcretetType, typeof(Target)); + + return aspects; + }; + var proxiedClass = new Advisor(checkConcreteType, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target()); + + proxiedClass.DoneSomething("test"); + } + + [TestMethod] + public void Should_have_interface_type_in_AspectEnvironmen() + { + Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> checkConcreteType = (environMent, aspects) => + { + Assert.AreEqual(environMent.InterfaceType, typeof(ITarget)); + + return aspects; + }; + var proxiedClass = new Advisor(checkConcreteType, new List<IAspect>()).GetAdvicedProxy<ITarget>(new Target()); + + proxiedClass.DoneSomething("test"); + } + } +} diff --git a/NAdvisorTest40/MSTestHelper.cs b/NAdvisorTest40/MSTestHelper.cs new file mode 100644 index 0000000..ebc5195 --- /dev/null +++ b/NAdvisorTest40/MSTestHelper.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + + +namespace NAdvisorTest40 +{ + public static class MSTestHelper + { + public static void ShouldThrowException<TypeOfException>(Action exceptionThrowingAction) + { + try + { + exceptionThrowingAction(); + } + catch(Exception ex) + { + if(!(ex is TypeOfException)) + { + Assert.Fail("Should throw a different kind of exception"); + } + } + } + } +} diff --git a/NAdvisorTest40/NAdvisorTest40.csproj b/NAdvisorTest40/NAdvisorTest40.csproj new file mode 100644 index 0000000..0888b44 --- /dev/null +++ b/NAdvisorTest40/NAdvisorTest40.csproj @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion> + </ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{A8FAA007-59EB-49B9-BA44-6AC4989DD2D3}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>NAdvisorTest40</RootNamespace> + <AssemblyName>NAdvisorTest40</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="Moq"> + <HintPath>..\References\moq\Moq.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + </ItemGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Compile Include="AdvisorTests.cs" /> + <Compile Include="AspectEnvironmentDictionaryTests.cs" /> + <Compile Include="AspectEnvironmentTests.cs" /> + <Compile Include="MSTestHelper.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SimpleAspectTests.cs" /> + <Compile Include="TestClasses\ITarget.cs" /> + <Compile Include="TestClasses\SimpleEventArgs.cs" /> + <Compile Include="TestClasses\Target.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> + <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> + <Name>NAdvisor.Contrib</Name> + </ProjectReference> + <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> + <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> + <Name>NAdvisor.Core</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/NAdvisorTest40/Properties/AssemblyInfo.cs b/NAdvisorTest40/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8ea8d6e --- /dev/null +++ b/NAdvisorTest40/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NAdvisorTest40")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("NAdvisorTest40")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fa9629ff-cc00-48a1-815b-4a3023a724cc")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NAdvisorTest40/SimpleAspectTests.cs b/NAdvisorTest40/SimpleAspectTests.cs new file mode 100644 index 0000000..9e29ea0 --- /dev/null +++ b/NAdvisorTest40/SimpleAspectTests.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Core; + +namespace NAdvisorTest40.SimpleAspectTests +{ + [TestClass] + public class SimpleAspectTests + { + [TestMethod] + public void Should_Intercept_By_Aspects() + { + //Given + var results = new List<string>(); + var simpleAspect = new SimpleAspect(); + var simpleService = new SimpleService(); + simpleAspect.DoneSomething += (sender, args) => results.Add(args.Message); + + var advisor = new Advisor(new List<IAspect>() {simpleAspect}); + var service = advisor.GetAdvicedProxy<ISimpleService>(simpleService); + + //Then + var result = service.DoSomething("hllo"); + + //When + Assert.AreEqual("executed", result); + Assert.AreEqual("hllo", results[0]); + Assert.AreEqual("donesomething", results[1]); + } + } + + public class SimpleAspect : IAspect + { + public EventHandler<SimpleEventArgs> DoneSomething; + + public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) + { + if(args.Length > 0) + { + if(args[0] is string) + { + RaiseDoneSomething((string)args[0]); + } + } + + object result = proceedInvocation(args); + + if (result is string) + RaiseDoneSomething((string) result); + + return "executed"; + } + + private void RaiseDoneSomething(string doneSomething) + { + if (DoneSomething != null) + DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); + } + } + + public interface ISimpleService + { + string DoSomething(string somethingTodo); + } + + public class SimpleService : ISimpleService + { + public EventHandler<SimpleEventArgs> DoneSomething; + + public string DoSomething(string somethingTodo) + { + if(DoneSomething != null) + DoneSomething.Invoke(this, new SimpleEventArgs(){Message = somethingTodo}); + + return "donesomething"; + } + } +} diff --git a/NAdvisorTest40/TestClasses/ITarget.cs b/NAdvisorTest40/TestClasses/ITarget.cs new file mode 100644 index 0000000..a232a0b --- /dev/null +++ b/NAdvisorTest40/TestClasses/ITarget.cs @@ -0,0 +1,7 @@ +namespace NAdvisorTest40 +{ + public interface ITarget + { + string DoneSomething(string input); + } +} \ No newline at end of file diff --git a/NAdvisorTest40/TestClasses/SimpleEventArgs.cs b/NAdvisorTest40/TestClasses/SimpleEventArgs.cs new file mode 100644 index 0000000..dde8cdb --- /dev/null +++ b/NAdvisorTest40/TestClasses/SimpleEventArgs.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NAdvisorTest40 +{ + public class SimpleEventArgs : EventArgs + { + public string Message { get; set; } + } +} diff --git a/NAdvisorTest40/TestClasses/Target.cs b/NAdvisorTest40/TestClasses/Target.cs new file mode 100644 index 0000000..9db1108 --- /dev/null +++ b/NAdvisorTest40/TestClasses/Target.cs @@ -0,0 +1,10 @@ +namespace NAdvisorTest40 +{ + public class Target : ITarget + { + public string DoneSomething(string input) + { + return input + "done"; + } + } +} \ No newline at end of file
chrido/NAdvisor
f3a57386812a7a28737b3ad71cc357b449c4d4d0
added testresults to ignore
diff --git a/.gitignore b/.gitignore index 22c080e..2accd78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,15 @@ *~ bin obj *.user *.suo *.bak *.sln.cache _ReSharper* *.resharper */build */test-results *.pidb *.userprefs *.orig +/TestResults/*
chrido/NAdvisor
0c736533b2e8b671e61c284eb792911095842225
added resharper to ignore
diff --git a/.gitignore b/.gitignore index 90e3b00..22c080e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,14 @@ *~ bin obj *.user *.suo *.bak *.sln.cache _ReSharper* +*.resharper */build */test-results *.pidb *.userprefs -*.orig \ No newline at end of file +*.orig diff --git a/References/CastleDynamicProxy2/Castle.Core.xml b/References/CastleDynamicProxy2/Castle.Core.xml deleted file mode 100644 index ac647e6..0000000 --- a/References/CastleDynamicProxy2/Castle.Core.xml +++ /dev/null @@ -1,3197 +0,0 @@ -<?xml version="1.0"?> -<doc> - <assembly> - <name>Castle.Core</name> - </assembly> - <members> - <member name="T:Castle.Core.CastleComponentAttribute"> - <summary> - This attribute is usefull only when you want to register all components - on an assembly as a batch process. - By doing so, the batch register will look - for this attribute to distinguish components from other classes. - </summary> - </member> - <member name="T:Castle.Core.LifestyleAttribute"> - <summary> - Base for Attributes that want to express lifestyle - chosen by the component. - </summary> - </member> - <member name="M:Castle.Core.LifestyleAttribute.#ctor(Castle.Core.LifestyleType)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.LifestyleAttribute"/> class. - </summary> - <param name="type">The type.</param> - </member> - <member name="P:Castle.Core.LifestyleAttribute.Lifestyle"> - <summary> - Gets or sets the lifestyle. - </summary> - <value>The lifestyle.</value> - </member> - <member name="M:Castle.Core.CastleComponentAttribute.#ctor(System.String)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.CastleComponentAttribute"/> class. - </summary> - <param name="key">The key.</param> - </member> - <member name="M:Castle.Core.CastleComponentAttribute.#ctor(System.String,System.Type)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.CastleComponentAttribute"/> class. - </summary> - <param name="key">The key.</param> - <param name="service">The service.</param> - </member> - <member name="M:Castle.Core.CastleComponentAttribute.#ctor(System.String,System.Type,Castle.Core.LifestyleType)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.CastleComponentAttribute"/> class. - </summary> - <param name="key">The key.</param> - <param name="service">The service.</param> - <param name="lifestyle">The lifestyle.</param> - </member> - <member name="P:Castle.Core.CastleComponentAttribute.Service"> - <summary> - Gets the service. - </summary> - <value>The service.</value> - </member> - <member name="P:Castle.Core.CastleComponentAttribute.Key"> - <summary> - Gets the key. - </summary> - <value>The key.</value> - </member> - <member name="T:Castle.Core.ComponentActivatorAttribute"> - <summary> - Associates a custom component with a component - </summary> - </member> - <member name="M:Castle.Core.ComponentActivatorAttribute.#ctor(System.Type)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ComponentActivatorAttribute"/> class. - </summary> - <param name="componentActivatorType">Type of the component activator.</param> - </member> - <member name="P:Castle.Core.ComponentActivatorAttribute.ComponentActivatorType"> - <summary> - Gets the type of the component activator. - </summary> - <value>The type of the component activator.</value> - </member> - <member name="T:Castle.Core.ComponentProxyBehaviorAttribute"> - <summary> - Specifies the proxying behavior for a component. - </summary> - </member> - <member name="M:Castle.Core.ComponentProxyBehaviorAttribute.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ComponentProxyBehaviorAttribute"/> class. - </summary> - </member> - <member name="P:Castle.Core.ComponentProxyBehaviorAttribute.UseMarshalByRefProxy"> - <summary> - Gets or sets a value indicating whether the generated - interface proxy should inherit from <see cref="T:System.MarshalByRefObject"/>. - </summary> - </member> - <member name="P:Castle.Core.ComponentProxyBehaviorAttribute.UseSingleInterfaceProxy"> - <summary> - Determines if the component requires a single interface proxy. - </summary> - <value><c>true</c> if the component requires a single interface proxy.</value> - </member> - <member name="P:Castle.Core.ComponentProxyBehaviorAttribute.AdditionalInterfaces"> - <summary> - Gets or sets the additional interfaces used during proxy generation. - </summary> - </member> - <member name="T:Castle.Core.DoNotWireAttribute"> - <summary> - Marks as property to be skipped and not be wired - by the IoC container - </summary> - </member> - <member name="T:Castle.Core.InterceptorAttribute"> - <summary> - Used to declare that a component wants interceptors acting on it. - </summary> - </member> - <member name="M:Castle.Core.InterceptorAttribute.#ctor(System.String)"> - <summary> - Constructs the InterceptorAttribute pointing to - a key to a interceptor - </summary> - <param name="componentKey"></param> - </member> - <member name="M:Castle.Core.InterceptorAttribute.#ctor(System.Type)"> - <summary> - Constructs the InterceptorAttribute pointing to - a service - </summary> - <param name="interceptorType"></param> - </member> - <member name="T:Castle.Core.SingletonAttribute"> - <summary> - Indicates that the target components wants a - singleton lifestyle. - </summary> - </member> - <member name="M:Castle.Core.SingletonAttribute.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.SingletonAttribute"/> class. - </summary> - </member> - <member name="T:Castle.Core.TransientAttribute"> - <summary> - Indicates that the target components wants a - transient lifestyle. - </summary> - </member> - <member name="M:Castle.Core.TransientAttribute.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.TransientAttribute"/> class. - </summary> - </member> - <member name="T:Castle.Core.PerThreadAttribute"> - <summary> - Indicates that the target components wants a - per thread lifestyle. - </summary> - </member> - <member name="M:Castle.Core.PerThreadAttribute.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.PerThreadAttribute"/> class. - </summary> - </member> - <member name="T:Castle.Core.PerWebRequestAttribute"> - <summary> - Indicates that the target components wants a - per web request lifestyle. - </summary> - </member> - <member name="T:Castle.Core.PooledAttribute"> - <summary> - Indicates that the target components wants a - pooled lifestyle. - </summary> - </member> - <member name="M:Castle.Core.PooledAttribute.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.PooledAttribute"/> class - using the default initial pool size (5) and the max pool size (15). - </summary> - </member> - <member name="M:Castle.Core.PooledAttribute.#ctor(System.Int32,System.Int32)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.PooledAttribute"/> class. - </summary> - <param name="initialPoolSize">Initial size of the pool.</param> - <param name="maxPoolSize">Max pool size.</param> - </member> - <member name="P:Castle.Core.PooledAttribute.InitialPoolSize"> - <summary> - Gets the initial size of the pool. - </summary> - <value>The initial size of the pool.</value> - </member> - <member name="P:Castle.Core.PooledAttribute.MaxPoolSize"> - <summary> - Gets the maximum pool size. - </summary> - <value>The size of the max pool.</value> - </member> - <member name="T:Castle.Core.CustomLifestyleAttribute"> - <summary> - Indicates that the target components wants a - custom lifestyle. - </summary> - </member> - <member name="M:Castle.Core.CustomLifestyleAttribute.#ctor(System.Type)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.CustomLifestyleAttribute"/> class. - </summary> - <param name="lifestyleHandlerType">The lifestyle handler.</param> - </member> - <member name="P:Castle.Core.CustomLifestyleAttribute.LifestyleHandlerType"> - <summary> - Gets the type of the lifestyle handler. - </summary> - <value>The type of the lifestyle handler.</value> - </member> - <member name="T:Castle.Core.Interceptor.IInterceptor"> - <summary> - New interface that is going to be used by DynamicProxy 2 - </summary> - </member> - <member name="T:Castle.Core.Interceptor.IInvocation"> - <summary> - New interface that is going to be used by DynamicProxy 2 - </summary> - </member> - <member name="M:Castle.Core.Interceptor.IInvocation.GetConcreteMethod"> - <summary> - Returns the concrete instantiation of <see cref="P:Castle.Core.Interceptor.IInvocation.Method"/>, with any generic parameters bound to real types. - </summary> - <returns>The concrete instantiation of <see cref="P:Castle.Core.Interceptor.IInvocation.Method"/>, or <see cref="P:Castle.Core.Interceptor.IInvocation.Method"/> if not a generic method.</returns> - <remarks>Can be slower than calling <see cref="P:Castle.Core.Interceptor.IInvocation.Method"/>.</remarks> - </member> - <member name="M:Castle.Core.Interceptor.IInvocation.GetConcreteMethodInvocationTarget"> - <summary> - Returns the concrete instantiation of <see cref="P:Castle.Core.Interceptor.IInvocation.MethodInvocationTarget"/>, with any generic parameters bound to real types. - </summary> - <returns>The concrete instantiation of <see cref="P:Castle.Core.Interceptor.IInvocation.MethodInvocationTarget"/>, or <see cref="P:Castle.Core.Interceptor.IInvocation.MethodInvocationTarget"/> if not a generic method.</returns> - <remarks>Can be slower than calling <see cref="P:Castle.Core.Interceptor.IInvocation.MethodInvocationTarget"/>.</remarks> - </member> - <member name="M:Castle.Core.Interceptor.IInvocation.Proceed"> - <summary> - - </summary> - <returns></returns> - </member> - <member name="P:Castle.Core.Interceptor.IInvocation.GenericArguments"> - <summary> - The generic arguments of the method, or null if not a generic method. - </summary> - </member> - <member name="P:Castle.Core.Interceptor.IInvocation.Method"> - <summary> - - </summary> - </member> - <member name="P:Castle.Core.Interceptor.IInvocation.MethodInvocationTarget"> - <summary> - For interface proxies, this will point to the - <see cref="T:System.Reflection.MethodInfo"/> on the target class - </summary> - </member> - <member name="T:Castle.Core.Interceptor.IOnBehalfAware"> - <summary> - Interceptors might implement this to receive the - ComponentModel on behalf of the component where the - interceptor is acting. - </summary> - </member> - <member name="M:Castle.Core.Interceptor.IProxyTargetAccessor.DynProxyGetTarget"> - <summary> - Get the proxy target (note that null is a valid target!) - </summary> - <returns></returns> - </member> - <member name="M:Castle.Core.Interceptor.IProxyTargetAccessor.GetInterceptors"> - <summary> - Gets the interceptors for the proxy - </summary> - <returns></returns> - </member> - <member name="T:Castle.Core.IVertex"> - <summary> - Abstract representation of a vertex. - </summary> - </member> - <member name="P:Castle.Core.GraphNode.Dependers"> - <summary> - The nodes that dependes on this node - </summary> - </member> - <member name="P:Castle.Core.GraphNode.Dependents"> - <summary> - The nodes that this node depends - </summary> - </member> - <member name="F:Castle.Core.Internal.VertexColor.White"> - <summary> - The node has not been visited yet - </summary> - </member> - <member name="F:Castle.Core.Internal.VertexColor.Gray"> - <summary> - This node is in the process of being visited - </summary> - </member> - <member name="F:Castle.Core.Internal.VertexColor.Black"> - <summary> - This now was visited - </summary> - </member> - <member name="T:Castle.Core.Internal.ColorsSet"> - <summary> - Represents a collection of objects - which are guaranted to be unique - and holds a color for them - </summary> - </member> - <member name="T:Castle.Core.Internal.TimestampSet"> - <summary> - Holds a timestamp (integer) - for a given item - </summary> - </member> - <member name="M:Castle.Core.Internal.LinkedList.GetNode(System.Int32)"> - <summary> - Returns the node at the specified index. - </summary> - <param name="index">The lookup index.</param> - <returns>The node at the specified index.</returns> - <exception cref="T:System.ArgumentOutOfRangeException"> - If the specified <paramref name="index"/> is greater than the - number of objects within the list. - </exception> - </member> - <member name="M:Castle.Core.Internal.LinkedList.ValidateIndex(System.Int32)"> - <summary> - Validates the specified index. - </summary> - <param name="index">The lookup index.</param> - <exception cref="T:System.ArgumentOutOfRangeException"> - If the index is invalid. - </exception> - </member> - <member name="T:Castle.Core.IInitializable"> - <summary> - Lifecycle interface. If implemented by a component, - the method Initialized will be invoked by the container - before making the component available to the external world. - </summary> - </member> - <member name="M:Castle.Core.IInitializable.Initialize"> - <summary> - Implementors should perform any initialization logic. - </summary> - </member> - <member name="T:Castle.Core.IRecyclable"> - <summary> - Only called for components that - belongs to a pool when the component - comes back to the pool. - </summary> - </member> - <member name="M:Castle.Core.IRecyclable.Recycle"> - <summary> - Implementors should perform any - initialization/clean up. - </summary> - </member> - <member name="T:Castle.Core.IStartable"> - <summary> - Interface for components that wish to be started by the container - </summary> - </member> - <member name="M:Castle.Core.IStartable.Start"> - <summary> - Starts this instance. - </summary> - </member> - <member name="M:Castle.Core.IStartable.Stop"> - <summary> - Stops this instance. - </summary> - </member> - <member name="T:Castle.Core.Logging.IExtendedLoggerFactory"> - <summary> - Provides a factory that can produce either <see cref="T:Castle.Core.Logging.ILogger"/> or - <see cref="T:Castle.Core.Logging.IExtendedLogger"/> classes. - </summary> - </member> - <member name="T:Castle.Core.Logging.ILoggerFactory"> - <summary> - Manages the instantiation of <see cref="T:Castle.Core.Logging.ILogger"/>s. - </summary> - </member> - <member name="M:Castle.Core.Logging.ILoggerFactory.Create(System.Type)"> - <summary> - Creates a new logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.ILoggerFactory.Create(System.String)"> - <summary> - Creates a new logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.ILoggerFactory.Create(System.Type,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.ILoggerFactory.Create(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.IExtendedLoggerFactory.Create(System.Type)"> - <summary> - Creates a new extended logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.IExtendedLoggerFactory.Create(System.String)"> - <summary> - Creates a new extended logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.IExtendedLoggerFactory.Create(System.Type,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new extended logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.IExtendedLoggerFactory.Create(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new extended logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Create(System.Type)"> - <summary> - Creates a new extended logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Create(System.String)"> - <summary> - Creates a new extended logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Create(System.Type,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new extended logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Create(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new extended logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Castle#Core#Logging#ILoggerFactory#Create(System.Type)"> - <summary> - Creates a new logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Castle#Core#Logging#ILoggerFactory#Create(System.String)"> - <summary> - Creates a new logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Castle#Core#Logging#ILoggerFactory#Create(System.Type,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new logger, getting the logger name from the specified type. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.Castle#Core#Logging#ILoggerFactory#Create(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.Factories.AbstractExtendedLoggerFactory.GetConfigFile(System.String)"> - <summary> - Gets the configuration file. - </summary> - <param name="fileName">i.e. log4net.config</param> - <returns></returns> - </member> - <member name="M:Castle.Core.Logging.AbstractLoggerFactory.GetConfigFile(System.String)"> - <summary> - Gets the configuration file. - </summary> - <param name="fileName">i.e. log4net.config</param> - <returns></returns> - </member> - <member name="T:Castle.Core.Logging.ConsoleFactory"> - <summary> - Summary description for ConsoleFactory. - </summary> - </member> - <member name="T:Castle.Core.Logging.NullLogFactory"> - <summary> - NullLogFactory used when logging is turned off. - </summary> - </member> - <member name="M:Castle.Core.Logging.NullLogFactory.Create(System.String)"> - <summary> - Creates an instance of ILogger with the specified name. - </summary> - <param name="name">Name.</param> - <returns></returns> - </member> - <member name="M:Castle.Core.Logging.NullLogFactory.Create(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates an instance of ILogger with the specified name and LoggerLevel. - </summary> - <param name="name">Name.</param> - <param name="level">Level.</param> - <returns></returns> - </member> - <member name="T:Castle.Core.Logging.StreamLoggerFactory"> - <summary> - Creates <see cref="T:Castle.Core.Logging.StreamLogger"/> outputing - to files. The name of the file is derived from the log name - plus the 'log' extension. - </summary> - </member> - <member name="T:Castle.Core.Logging.TraceLoggerFactory"> - <summary> - Used to create the TraceLogger implementation of ILogger interface. See <see cref="T:Castle.Core.Logging.TraceLogger"/>. - </summary> - </member> - <member name="T:Castle.Core.Logging.ConsoleLogger"> - <summary> - The Logger sending everything to the standard output streams. - This is mainly for the cases when you have a utility that - does not have a logger to supply. - </summary> - </member> - <member name="T:Castle.Core.Logging.LevelFilteredLogger"> - <summary> - The Level Filtered Logger class. This is a base clase which - provides a LogLevel attribute and reroutes all functions into - one Log method. - </summary> - </member> - <member name="T:Castle.Core.Logging.ILogger"> - <summary> - Manages logging. - </summary> - <remarks> - This is a facade for the different logging subsystems. - It offers a simplified interface that follows IOC patterns - and a simplified priority/level/severity abstraction. - </remarks> - </member> - <member name="M:Castle.Core.Logging.ILogger.Debug(System.String)"> - <summary> - Logs a debug message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Debug(System.String,System.Exception)"> - <summary> - Logs a debug message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Debug(System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.DebugFormat(System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.DebugFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.DebugFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.DebugFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Info(System.String)"> - <summary> - Logs an info message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Info(System.String,System.Exception)"> - <summary> - Logs an info message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Info(System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.InfoFormat(System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.InfoFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.InfoFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.InfoFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Warn(System.String)"> - <summary> - Logs a warn message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Warn(System.String,System.Exception)"> - <summary> - Logs a warn message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Warn(System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.WarnFormat(System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.WarnFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.WarnFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.WarnFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Error(System.String)"> - <summary> - Logs an error message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Error(System.String,System.Exception)"> - <summary> - Logs an error message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Error(System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.ErrorFormat(System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.ErrorFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.ErrorFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.ErrorFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Fatal(System.String)"> - <summary> - Logs a fatal message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Fatal(System.String,System.Exception)"> - <summary> - Logs a fatal message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.Fatal(System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalFormat(System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalError(System.String)"> - <summary> - Logs a fatal error message. - </summary> - <param name="message">The Message</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalError(System.String,System.Exception)"> - <summary> - Logs a fatal error message. - </summary> - <param name="message">The Message</param> - <param name="exception">The Exception</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.FatalError(System.String,System.Object[])"> - <summary> - Logs a fatal error message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.ILogger.CreateChildLogger(System.String)"> - <summary> - Create a new child logger. - The name of the child logger is [current-loggers-name].[passed-in-name] - </summary> - <param name="loggerName">The Subname of this logger.</param> - <returns>The New ILogger instance.</returns> - <exception cref="T:System.ArgumentException">If the name has an empty element name.</exception> - </member> - <member name="P:Castle.Core.Logging.ILogger.IsDebugEnabled"> - <summary> - Determines if messages of priority "debug" will be logged. - </summary> - <value>True if "debug" messages will be logged.</value> - </member> - <member name="P:Castle.Core.Logging.ILogger.IsInfoEnabled"> - <summary> - Determines if messages of priority "info" will be logged. - </summary> - <value>True if "info" messages will be logged.</value> - </member> - <member name="P:Castle.Core.Logging.ILogger.IsWarnEnabled"> - <summary> - Determines if messages of priority "warn" will be logged. - </summary> - <value>True if "warn" messages will be logged.</value> - </member> - <member name="P:Castle.Core.Logging.ILogger.IsErrorEnabled"> - <summary> - Determines if messages of priority "error" will be logged. - </summary> - <value>True if "error" messages will be logged.</value> - </member> - <member name="P:Castle.Core.Logging.ILogger.IsFatalEnabled"> - <summary> - Determines if messages of priority "fatal" will be logged. - </summary> - <value>True if "fatal" messages will be logged.</value> - </member> - <member name="P:Castle.Core.Logging.ILogger.IsFatalErrorEnabled"> - <summary> - Determines if messages of priority "fatalError" will be logged. - </summary> - <value>True if "fatalError" messages will be logged.</value> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.#ctor"> - <summary> - Creates a new <c>LevelFilteredLogger</c>. - </summary> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.InitializeLifetimeService"> - <summary> - Keep the instance alive in a remoting scenario - </summary> - <returns></returns> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Debug(System.String)"> - <summary> - Logs a debug message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Debug(System.String,System.Exception)"> - <summary> - Logs a debug message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.DebugFormat(System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.DebugFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.DebugFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.DebugFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Debug(System.String,System.Object[])"> - <summary> - Logs a debug message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Info(System.String)"> - <summary> - Logs an info message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Info(System.String,System.Exception)"> - <summary> - Logs an info message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.InfoFormat(System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.InfoFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.InfoFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.InfoFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Info(System.String,System.Object[])"> - <summary> - Logs an info message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Warn(System.String)"> - <summary> - Logs a warn message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Warn(System.String,System.Exception)"> - <summary> - Logs a warn message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.WarnFormat(System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.WarnFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.WarnFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.WarnFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Warn(System.String,System.Object[])"> - <summary> - Logs a warn message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Error(System.String)"> - <summary> - Logs an error message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Error(System.String,System.Exception)"> - <summary> - Logs an error message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.ErrorFormat(System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.ErrorFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.ErrorFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.ErrorFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Error(System.String,System.Object[])"> - <summary> - Logs an error message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Fatal(System.String)"> - <summary> - Logs a fatal message. - </summary> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Fatal(System.String,System.Exception)"> - <summary> - Logs a fatal message. - </summary> - <param name="exception">The exception to log</param> - <param name="message">The message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalFormat(System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalFormat(System.Exception,System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="exception">The exception to log</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="exception">The exception to log</param> - <param name="formatProvider">The format provider to use</param> - <param name="format">Format string for the message to log</param> - <param name="args">Format arguments for the message to log</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Fatal(System.String,System.Object[])"> - <summary> - Logs a fatal message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalError(System.String)"> - <summary> - Logs a fatal error message. - </summary> - <param name="message">The Message</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalError(System.String,System.Exception)"> - <summary> - Logs a fatal error message. - </summary> - <param name="message">The Message</param> - <param name="exception">The Exception</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.FatalError(System.String,System.Object[])"> - <summary> - Logs a fatal error message. - </summary> - <param name="format">Message format</param> - <param name="args">Array of objects to write using format</param> - </member> - <member name="M:Castle.Core.Logging.LevelFilteredLogger.Log(Castle.Core.Logging.LoggerLevel,System.String,System.String,System.Exception)"> - <summary> - Implementors output the log content by implementing this method only. - Note that exception can be null - </summary> - <param name="loggerLevel"></param> - <param name="loggerName"></param> - <param name="message"></param> - <param name="exception"></param> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.Level"> - <value> - The <c>LoggerLevel</c> that this logger - will be using. Defaults to <c>LoggerLevel.Off</c> - </value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.Name"> - <value> - The name that this logger will be using. - Defaults to <c>String.Empty</c> - </value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.IsDebugEnabled"> - <summary> - Determines if messages of priority "debug" will be logged. - </summary> - <value><c>true</c> if log level flags include the <see cref="F:Castle.Core.Logging.LoggerLevel.Debug"/> bit</value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.IsInfoEnabled"> - <summary> - Determines if messages of priority "info" will be logged. - </summary> - <value><c>true</c> if log level flags include the <see cref="F:Castle.Core.Logging.LoggerLevel.Info"/> bit</value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.IsWarnEnabled"> - <summary> - Determines if messages of priority "warn" will be logged. - </summary> - <value><c>true</c> if log level flags include the <see cref="F:Castle.Core.Logging.LoggerLevel.Warn"/> bit</value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.IsErrorEnabled"> - <summary> - Determines if messages of priority "error" will be logged. - </summary> - <value><c>true</c> if log level flags include the <see cref="F:Castle.Core.Logging.LoggerLevel.Error"/> bit</value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.IsFatalEnabled"> - <summary> - Determines if messages of priority "fatal" will be logged. - </summary> - <value><c>true</c> if log level flags include the <see cref="F:Castle.Core.Logging.LoggerLevel.Fatal"/> bit</value> - </member> - <member name="P:Castle.Core.Logging.LevelFilteredLogger.IsFatalErrorEnabled"> - <summary> - Determines if messages of priority "fatal" will be logged. - </summary> - <value><c>true</c> if log level flags include the <see cref="F:Castle.Core.Logging.LoggerLevel.Fatal"/> bit</value> - </member> - <member name="M:Castle.Core.Logging.ConsoleLogger.#ctor"> - <summary> - Creates a new ConsoleLogger with the <c>Level</c> - set to <c>LoggerLevel.Debug</c> and the <c>Name</c> - set to <c>String.Empty</c>. - </summary> - </member> - <member name="M:Castle.Core.Logging.ConsoleLogger.#ctor(Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new ConsoleLogger with the <c>Name</c> - set to <c>String.Empty</c>. - </summary> - <param name="logLevel">The logs Level.</param> - </member> - <member name="M:Castle.Core.Logging.ConsoleLogger.#ctor(System.String)"> - <summary> - Creates a new ConsoleLogger with the <c>Level</c> - set to <c>LoggerLevel.Debug</c>. - </summary> - <param name="name">The logs Name.</param> - </member> - <member name="M:Castle.Core.Logging.ConsoleLogger.#ctor(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new ConsoleLogger. - </summary> - <param name="name">The logs Name.</param> - <param name="logLevel">The logs Level.</param> - </member> - <member name="M:Castle.Core.Logging.ConsoleLogger.Log(Castle.Core.Logging.LoggerLevel,System.String,System.String,System.Exception)"> - <summary> - A Common method to log. - </summary> - <param name="loggerLevel">The level of logging</param> - <param name="loggerName">The name of the logger</param> - <param name="message">The Message</param> - <param name="exception">The Exception</param> - </member> - <member name="M:Castle.Core.Logging.ConsoleLogger.CreateChildLogger(System.String)"> - <summary> - Returns a new <c>ConsoleLogger</c> with the name - added after this loggers name, with a dot in between. - </summary> - <param name="loggerName">The added hierarchical name.</param> - <returns>A new <c>ConsoleLogger</c>.</returns> - </member> - <member name="T:Castle.Core.Logging.DiagnosticsLogger"> - <summary> - The Logger using standart Diagnostics namespace. - </summary> - </member> - <member name="M:Castle.Core.Logging.DiagnosticsLogger.#ctor(System.String)"> - <summary> - Creates a logger based on <see cref="T:System.Diagnostics.EventLog"/>. - </summary> - <param name="logName"><see cref="P:System.Diagnostics.EventLog.Log"/></param> - </member> - <member name="M:Castle.Core.Logging.DiagnosticsLogger.#ctor(System.String,System.String)"> - <summary> - Creates a logger based on <see cref="T:System.Diagnostics.EventLog"/>. - </summary> - <param name="logName"><see cref="P:System.Diagnostics.EventLog.Log"/></param> - <param name="source"><see cref="P:System.Diagnostics.EventLog.Source"/></param> - </member> - <member name="M:Castle.Core.Logging.DiagnosticsLogger.#ctor(System.String,System.String,System.String)"> - <summary> - Creates a logger based on <see cref="T:System.Diagnostics.EventLog"/>. - </summary> - <param name="logName"><see cref="P:System.Diagnostics.EventLog.Log"/></param> - <param name="machineName"><see cref="P:System.Diagnostics.EventLog.MachineName"/></param> - <param name="source"><see cref="P:System.Diagnostics.EventLog.Source"/></param> - </member> - <member name="T:Castle.Core.Logging.NullLogger"> - <summary> - The Null Logger class. This is useful for implementations where you need - to provide a logger to a utility class, but do not want any output from it. - It also helps when you have a utility that does not have a logger to supply. - </summary> - </member> - <member name="T:Castle.Core.Logging.IExtendedLogger"> - <summary> - Provides an interface that supports <see cref="T:Castle.Core.Logging.ILogger"/> and - allows the storage and retrieval of Contexts. These are supported in - both log4net and NLog. - </summary> - </member> - <member name="P:Castle.Core.Logging.IExtendedLogger.GlobalProperties"> - <summary> - Exposes the Global Context of the extended logger. - </summary> - </member> - <member name="P:Castle.Core.Logging.IExtendedLogger.ThreadProperties"> - <summary> - Exposes the Thread Context of the extended logger. - </summary> - </member> - <member name="P:Castle.Core.Logging.IExtendedLogger.ThreadStacks"> - <summary> - Exposes the Thread Stack of the extended logger. - </summary> - </member> - <member name="M:Castle.Core.Logging.NullLogger.#ctor"> - <summary> - Creates a new <c>NullLogger</c>. - </summary> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Debug(System.String)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Debug(System.String,System.Exception)"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Debug(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.DebugFormat(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.DebugFormat(System.Exception,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.DebugFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.DebugFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Info(System.String)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Info(System.String,System.Exception)"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Info(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.InfoFormat(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.InfoFormat(System.Exception,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.InfoFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.InfoFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Warn(System.String)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Warn(System.String,System.Exception)"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Warn(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.WarnFormat(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.WarnFormat(System.Exception,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.WarnFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.WarnFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Error(System.String)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Error(System.String,System.Exception)"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Error(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.ErrorFormat(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.ErrorFormat(System.Exception,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.ErrorFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.ErrorFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Fatal(System.String)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Fatal(System.String,System.Exception)"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.Fatal(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalFormat(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalFormat(System.Exception,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalFormat(System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalFormat(System.Exception,System.IFormatProvider,System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="exception">Ignored</param> - <param name="formatProvider">Ignored</param> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalError(System.String)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalError(System.String,System.Exception)"> - <summary> - No-op. - </summary> - <param name="message">Ignored</param> - <param name="exception">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.FatalError(System.String,System.Object[])"> - <summary> - No-op. - </summary> - <param name="format">Ignored</param> - <param name="args">Ignored</param> - </member> - <member name="M:Castle.Core.Logging.NullLogger.CreateChildLogger(System.String)"> - <summary> - Returns this <c>NullLogger</c>. - </summary> - <param name="loggerName">Ignored</param> - <returns>This ILogger instance.</returns> - </member> - <member name="P:Castle.Core.Logging.NullLogger.IsDebugEnabled"> - <summary> - No-op. - </summary> - <value>false</value> - </member> - <member name="P:Castle.Core.Logging.NullLogger.IsInfoEnabled"> - <summary> - No-op. - </summary> - <value>false</value> - </member> - <member name="P:Castle.Core.Logging.NullLogger.IsWarnEnabled"> - <summary> - No-op. - </summary> - <value>false</value> - </member> - <member name="P:Castle.Core.Logging.NullLogger.IsErrorEnabled"> - <summary> - No-op. - </summary> - <value>false</value> - </member> - <member name="P:Castle.Core.Logging.NullLogger.IsFatalEnabled"> - <summary> - No-op. - </summary> - <value>false</value> - </member> - <member name="P:Castle.Core.Logging.NullLogger.IsFatalErrorEnabled"> - <summary> - No-op. - </summary> - <value>false</value> - </member> - <member name="P:Castle.Core.Logging.NullLogger.GlobalProperties"> - <summary> - Returns empty context properties. - </summary> - </member> - <member name="P:Castle.Core.Logging.NullLogger.ThreadProperties"> - <summary> - Returns empty context properties. - </summary> - </member> - <member name="P:Castle.Core.Logging.NullLogger.ThreadStacks"> - <summary> - Returns empty context stacks. - </summary> - </member> - <member name="T:Castle.Core.Logging.IContextProperties"> - <summary> - Interface for Context Properties implementations - </summary> - <remarks> - <para> - This interface defines a basic property get set accessor. - </para> - <para> - Based on the ContextPropertiesBase of log4net, by Nicko Cadell. - </para> - </remarks> - </member> - <member name="P:Castle.Core.Logging.IContextProperties.Item(System.String)"> - <summary> - Gets or sets the value of a property - </summary> - <value> - The value for the property with the specified key - </value> - <remarks> - <para> - Gets or sets the value of a property - </para> - </remarks> - </member> - <member name="T:Castle.Core.Logging.StreamLogger"> - <summary> - The Stream Logger class. This class can stream log information - to any stream, it is suitable for storing a log file to disk, - or to a <c>MemoryStream</c> for testing your components. - </summary> - <remarks> - This logger is not thread safe. - </remarks> - </member> - <member name="M:Castle.Core.Logging.StreamLogger.#ctor(System.String,System.IO.Stream)"> - <summary> - Creates a new <c>StreamLogger</c> with default encoding - and buffer size. Initial Level is set to Debug. - </summary> - <param name="name"> - The name of the log. - </param> - <param name="stream"> - The stream that will be used for logging, - seeking while the logger is alive - </param> - </member> - <member name="M:Castle.Core.Logging.StreamLogger.#ctor(System.String,System.IO.Stream,System.Text.Encoding)"> - <summary> - Creates a new <c>StreamLogger</c> with default buffer size. - Initial Level is set to Debug. - </summary> - <param name="name"> - The name of the log. - </param> - <param name="stream"> - The stream that will be used for logging, - seeking while the logger is alive - </param> - <param name="encoding"> - The encoding that will be used for this stream. - <see cref="T:System.IO.StreamWriter"/> - </param> - </member> - <member name="M:Castle.Core.Logging.StreamLogger.#ctor(System.String,System.IO.Stream,System.Text.Encoding,System.Int32)"> - <summary> - Creates a new <c>StreamLogger</c>. - Initial Level is set to Debug. - </summary> - <param name="name"> - The name of the log. - </param> - <param name="stream"> - The stream that will be used for logging, - seeking while the logger is alive - </param> - <param name="encoding"> - The encoding that will be used for this stream. - <see cref="T:System.IO.StreamWriter"/> - </param> - <param name="bufferSize"> - The buffer size that will be used for this stream. - <see cref="T:System.IO.StreamWriter"/> - </param> - </member> - <member name="M:Castle.Core.Logging.StreamLogger.#ctor(System.String,System.IO.StreamWriter)"> - <summary> - Creates a new <c>StreamLogger</c> with - Debug as default Level. - </summary> - <param name="name">The name of the log.</param> - <param name="writer">The <c>StreamWriter</c> the log will write to.</param> - </member> - <member name="T:Castle.Core.Logging.TraceLogger"> - <summary> - The TraceLogger sends all logging to the System.Diagnostics.TraceSource - built into the .net framework. - </summary> - <remarks> - Logging can be configured in the system.diagnostics configuration - section. - - If logger doesn't find a source name with a full match it will - use source names which match the namespace partially. For example you can - configure from all castle components by adding a source name with the - name "Castle". - - If no portion of the namespace matches the source named "Default" will - be used. - </remarks> - </member> - <member name="M:Castle.Core.Logging.TraceLogger.#ctor(System.String)"> - <summary> - Build a new trace logger based on the named TraceSource - </summary> - <param name="name">The name used to locate the best TraceSource. In most cases comes from the using type's fullname.</param> - </member> - <member name="M:Castle.Core.Logging.TraceLogger.#ctor(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Build a new trace logger based on the named TraceSource - </summary> - <param name="name">The name used to locate the best TraceSource. In most cases comes from the using type's fullname.</param> - <param name="level">The default logging level at which this source should write messages. In almost all cases this - default value will be overridden in the config file. </param> - </member> - <member name="M:Castle.Core.Logging.TraceLogger.CreateChildLogger(System.String)"> - <summary> - Create a new child logger. - The name of the child logger is [current-loggers-name].[passed-in-name] - </summary> - <param name="loggerName">The Subname of this logger.</param> - <returns>The New ILogger instance.</returns> - </member> - <member name="T:Castle.Core.Logging.WebLogger"> - <summary> - The WebLogger sends everything to the HttpContext.Trace - </summary> - <remarks> - Trace must be enabled on the Asp.Net configuration file (web.config or machine.config) - </remarks> - </member> - <member name="M:Castle.Core.Logging.WebLogger.#ctor"> - <summary> - Creates a new WebLogger with the priority set to DEBUG. - </summary> - </member> - <member name="M:Castle.Core.Logging.WebLogger.#ctor(Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new WebLogger. - </summary> - <param name="logLevel">The Log level typecode.</param> - </member> - <member name="M:Castle.Core.Logging.WebLogger.#ctor(System.String)"> - <summary> - Creates a new WebLogger. - </summary> - <param name="name">The Log name.</param> - </member> - <member name="M:Castle.Core.Logging.WebLogger.#ctor(System.String,Castle.Core.Logging.LoggerLevel)"> - <summary> - Creates a new WebLogger. - </summary> - <param name="name">The Log name.</param> - <param name="loggerLevel">The Log level typecode.</param> - </member> - <member name="M:Castle.Core.Logging.WebLogger.Log(Castle.Core.Logging.LoggerLevel,System.String,System.String,System.Exception)"> - <summary> - A Common method to log. - </summary> - <param name="loggerLevel">The level of logging</param> - <param name="loggerName">The Log name.</param> - <param name="message">The Message</param> - <param name="exception">The Exception</param> - </member> - <member name="M:Castle.Core.Logging.WebLogger.CreateChildLogger(System.String)"> - <summary> - Just returns this logger (<c>WebLogger</c> is not hierarchical). - </summary> - <param name="loggerName">Ignored</param> - <returns>This ILogger instance.</returns> - </member> - <member name="M:Castle.Core.Logging.WebLogger.TryToGetTraceContext"> - <summary> - Tries to get the current http context's trace context. - </summary> - <returns>The current http context's trace context or null if none is - available</returns> - </member> - <member name="T:Castle.Core.Logging.LoggerLevel"> - <summary> - Supporting Logger levels. - </summary> - </member> - <member name="F:Castle.Core.Logging.LoggerLevel.Off"> - <summary> - Logging will be off - </summary> - </member> - <member name="F:Castle.Core.Logging.LoggerLevel.Fatal"> - <summary> - Fatal logging level - </summary> - </member> - <member name="F:Castle.Core.Logging.LoggerLevel.Error"> - <summary> - Error logging level - </summary> - </member> - <member name="F:Castle.Core.Logging.LoggerLevel.Warn"> - <summary> - Warn logging level - </summary> - </member> - <member name="F:Castle.Core.Logging.LoggerLevel.Info"> - <summary> - Info logging level - </summary> - </member> - <member name="F:Castle.Core.Logging.LoggerLevel.Debug"> - <summary> - Debug logging level - </summary> - </member> - <member name="T:Castle.Core.Configuration.Xml.XmlConfigurationDeserializer"> - <summary> - Pendent - </summary> - </member> - <member name="M:Castle.Core.Configuration.Xml.XmlConfigurationDeserializer.Deserialize(System.Xml.XmlNode)"> - <summary> - Deserializes the specified node into an abstract representation of configuration. - </summary> - <param name="node">The node.</param> - <returns></returns> - </member> - <member name="M:Castle.Core.Configuration.Xml.XmlConfigurationDeserializer.GetConfigValue(System.String)"> - <summary> - If a config value is an empty string we return null, this is to keep - backward compability with old code - </summary> - </member> - <member name="T:Castle.Core.Configuration.AbstractConfiguration"> - <summary> - This is an abstract <see cref="T:Castle.Core.Configuration.IConfiguration"/> implementation - that deals with methods that can be abstracted away - from underlying implementations. - </summary> - <remarks> - <para><b>AbstractConfiguration</b> makes easier to implementers - to create a new version of <see cref="T:Castle.Core.Configuration.IConfiguration"/></para> - </remarks> - </member> - <member name="T:Castle.Core.Configuration.IConfiguration"> - <summary> - <see cref="T:Castle.Core.Configuration.IConfiguration"/> is a interface encapsulating a configuration node - used to retrieve configuration values. - </summary> - </member> - <member name="M:Castle.Core.Configuration.IConfiguration.GetValue(System.Type,System.Object)"> - <summary> - Gets the value of the node and converts it - into specified <see cref="T:System.Type"/>. - </summary> - <param name="type">The <see cref="T:System.Type"/></param> - <param name="defaultValue"> - The Default value returned if the convertion fails. - </param> - <returns>The Value converted into the specified type.</returns> - </member> - <member name="P:Castle.Core.Configuration.IConfiguration.Name"> - <summary> - Gets the name of the node. - </summary> - <value> - The Name of the node. - </value> - </member> - <member name="P:Castle.Core.Configuration.IConfiguration.Value"> - <summary> - Gets the value of the node. - </summary> - <value> - The Value of the node. - </value> - </member> - <member name="P:Castle.Core.Configuration.IConfiguration.Children"> - <summary> - Gets an <see cref="T:Castle.Core.Configuration.ConfigurationCollection"/> of <see cref="T:Castle.Core.Configuration.IConfiguration"/> - elements containing all node children. - </summary> - <value>The Collection of child nodes.</value> - </member> - <member name="P:Castle.Core.Configuration.IConfiguration.Attributes"> - <summary> - Gets an <see cref="T:System.Collections.IDictionary"/> of the configuration attributes. - </summary> - </member> - <member name="M:Castle.Core.Configuration.AbstractConfiguration.GetValue(System.Type,System.Object)"> - <summary> - Gets the value of the node and converts it - into specified <see cref="T:System.Type"/>. - </summary> - <param name="type">The <see cref="T:System.Type"/></param> - <param name="defaultValue"> - The Default value returned if the convertion fails. - </param> - <returns>The Value converted into the specified type.</returns> - </member> - <member name="P:Castle.Core.Configuration.AbstractConfiguration.Name"> - <summary> - Gets the name of the <see cref="T:Castle.Core.Configuration.IConfiguration"/>. - </summary> - <value> - The Name of the <see cref="T:Castle.Core.Configuration.IConfiguration"/>. - </value> - </member> - <member name="P:Castle.Core.Configuration.AbstractConfiguration.Value"> - <summary> - Gets the value of <see cref="T:Castle.Core.Configuration.IConfiguration"/>. - </summary> - <value> - The Value of the <see cref="T:Castle.Core.Configuration.IConfiguration"/>. - </value> - </member> - <member name="P:Castle.Core.Configuration.AbstractConfiguration.Children"> - <summary> - Gets all child nodes. - </summary> - <value>The <see cref="T:Castle.Core.Configuration.ConfigurationCollection"/> of child nodes.</value> - </member> - <member name="P:Castle.Core.Configuration.AbstractConfiguration.Attributes"> - <summary> - Gets node attributes. - </summary> - <value> - All attributes of the node. - </value> - </member> - <member name="T:Castle.Core.Configuration.ConfigurationCollection"> - <summary> - A collection of <see cref="T:Castle.Core.Configuration.IConfiguration"/> objects. - </summary> - </member> - <member name="M:Castle.Core.Configuration.ConfigurationCollection.#ctor"> - <summary> - Creates a new instance of <c>ConfigurationCollection</c>. - </summary> - </member> - <member name="M:Castle.Core.Configuration.ConfigurationCollection.#ctor(System.Collections.Generic.IEnumerable{Castle.Core.Configuration.IConfiguration})"> - <summary> - Creates a new instance of <c>ConfigurationCollection</c>. - </summary> - </member> - <member name="T:Castle.Core.Configuration.MutableConfiguration"> - <summary> - Summary description for MutableConfiguration. - </summary> - </member> - <member name="M:Castle.Core.Configuration.MutableConfiguration.#ctor(System.String)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.Configuration.MutableConfiguration"/> class. - </summary> - <param name="name">The name.</param> - </member> - <member name="P:Castle.Core.Configuration.MutableConfiguration.Value"> - <summary> - Gets the value of <see cref="T:Castle.Core.Configuration.IConfiguration"/>. - </summary> - <value> - The Value of the <see cref="T:Castle.Core.Configuration.IConfiguration"/>. - </value> - </member> - <member name="T:Castle.Core.LifestyleType"> - <summary> - Enumeration used to mark the component's lifestyle. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.Undefined"> - <summary> - No lifestyle specified. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.Singleton"> - <summary> - Singleton components are instantiated once, and shared - between all clients. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.Thread"> - <summary> - Thread components have a unique instance per thread. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.Transient"> - <summary> - Transient components are created on demand. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.Pooled"> - <summary> - Optimization of transient components that keeps - instance in a pool instead of always creating them. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.Custom"> - <summary> - Any other logic to create/release components. - </summary> - </member> - <member name="F:Castle.Core.LifestyleType.PerWebRequest"> - <summary> - PerWebRequest components are created once per Http Request - </summary> - </member> - <member name="T:Castle.Core.PropertiesInspectionBehavior"> - <summary> - - </summary> - </member> - <member name="T:Castle.Core.ComponentModel"> - <summary> - Represents the collection of information and - meta information collected about a component. - </summary> - </member> - <member name="F:Castle.Core.ComponentModel.name"> - <summary>Name (key) of the component</summary> - </member> - <member name="F:Castle.Core.ComponentModel.service"> - <summary>Service exposed</summary> - </member> - <member name="F:Castle.Core.ComponentModel.implementation"> - <summary>Implementation for the service</summary> - </member> - <member name="F:Castle.Core.ComponentModel.extended"> - <summary>Extended properties</summary> - </member> - <member name="F:Castle.Core.ComponentModel.lifestyleType"> - <summary>Lifestyle for the component</summary> - </member> - <member name="F:Castle.Core.ComponentModel.customLifestyle"> - <summary>Custom lifestyle, if any</summary> - </member> - <member name="F:Castle.Core.ComponentModel.customComponentActivator"> - <summary>Custom activator, if any</summary> - </member> - <member name="F:Castle.Core.ComponentModel.dependencies"> - <summary>Dependencies the kernel must resolve</summary> - </member> - <member name="F:Castle.Core.ComponentModel.constructors"> - <summary>All available constructors</summary> - </member> - <member name="F:Castle.Core.ComponentModel.properties"> - <summary>All potential properties that can be setted by the kernel</summary> - </member> - <member name="F:Castle.Core.ComponentModel.lifecycleSteps"> - <summary>Steps of lifecycle</summary> - </member> - <member name="F:Castle.Core.ComponentModel.parameters"> - <summary>External parameters</summary> - </member> - <member name="F:Castle.Core.ComponentModel.configuration"> - <summary>Configuration node associated</summary> - </member> - <member name="F:Castle.Core.ComponentModel.interceptors"> - <summary>Interceptors associated</summary> - </member> - <member name="F:Castle.Core.ComponentModel.customDependencies"> - <summary>/// Custom dependencies/// </summary> - </member> - <member name="M:Castle.Core.ComponentModel.#ctor(System.String,System.Type,System.Type)"> - <summary> - Constructs a ComponentModel - </summary> - </member> - <member name="M:Castle.Core.ComponentModel.Requires(System.Predicate{Castle.Core.PropertySet}[])"> - <summary> - Requires the selected property dependencies. - </summary> - <param name="selectors">The property selector.</param> - </member> - <member name="M:Castle.Core.ComponentModel.Requires``1"> - <summary> - Requires the property dependencies of type <typeparamref name="D"/>. - </summary> - <typeparam name="D">The dependency type.</typeparam> - </member> - <member name="P:Castle.Core.ComponentModel.Name"> - <summary> - Sets or returns the component key - </summary> - </member> - <member name="P:Castle.Core.ComponentModel.Service"> - <summary> - Gets or sets the service exposed. - </summary> - <value>The service.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Implementation"> - <summary> - Gets or sets the component implementation. - </summary> - <value>The implementation.</value> - </member> - <member name="P:Castle.Core.ComponentModel.RequiresGenericArguments"> - <summary> - Gets or sets a value indicating whether the component requires generic arguments. - </summary> - <value> - <c>true</c> if generic arguments are required; otherwise, <c>false</c>. - </value> - </member> - <member name="P:Castle.Core.ComponentModel.ExtendedProperties"> - <summary> - Gets or sets the extended properties. - </summary> - <value>The extended properties.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Constructors"> - <summary> - Gets the constructors candidates. - </summary> - <value>The constructors.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Properties"> - <summary> - Gets the properties set. - </summary> - <value>The properties.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Configuration"> - <summary> - Gets or sets the configuration. - </summary> - <value>The configuration.</value> - </member> - <member name="P:Castle.Core.ComponentModel.LifecycleSteps"> - <summary> - Gets the lifecycle steps. - </summary> - <value>The lifecycle steps.</value> - </member> - <member name="P:Castle.Core.ComponentModel.LifestyleType"> - <summary> - Gets or sets the lifestyle type. - </summary> - <value>The type of the lifestyle.</value> - </member> - <member name="P:Castle.Core.ComponentModel.InspectionBehavior"> - <summary> - Gets or sets the strategy for - inspecting public properties - on the components - </summary> - </member> - <member name="P:Castle.Core.ComponentModel.CustomLifestyle"> - <summary> - Gets or sets the custom lifestyle. - </summary> - <value>The custom lifestyle.</value> - </member> - <member name="P:Castle.Core.ComponentModel.CustomComponentActivator"> - <summary> - Gets or sets the custom component activator. - </summary> - <value>The custom component activator.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Interceptors"> - <summary> - Gets the interceptors. - </summary> - <value>The interceptors.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Parameters"> - <summary> - Gets the parameter collection. - </summary> - <value>The parameters.</value> - </member> - <member name="P:Castle.Core.ComponentModel.Dependencies"> - <summary> - Dependencies are kept within constructors and - properties. Others dependencies must be - registered here, so the kernel (as a matter - of fact the handler) can check them - </summary> - </member> - <member name="P:Castle.Core.ComponentModel.CustomDependencies"> - <summary> - Gets the custom dependencies. - </summary> - <value>The custom dependencies.</value> - </member> - <member name="T:Castle.Core.ConstructorCandidate"> - <summary> - Represents a constructor of the component - that the container can use to initialize it properly. - </summary> - </member> - <member name="M:Castle.Core.ConstructorCandidate.#ctor(System.Reflection.ConstructorInfo,Castle.Core.DependencyModel[])"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ConstructorCandidate"/> class. - </summary> - <param name="constructorInfo">The constructor info.</param> - <param name="dependencies">The dependencies.</param> - </member> - <member name="P:Castle.Core.ConstructorCandidate.Constructor"> - <summary> - Gets the ConstructorInfo (from reflection). - </summary> - <value>The constructor.</value> - </member> - <member name="P:Castle.Core.ConstructorCandidate.Dependencies"> - <summary> - Gets the dependencies this constructor candidate exposes. - </summary> - <value>The dependencies.</value> - </member> - <member name="T:Castle.Core.ConstructorCandidateCollection"> - <summary> - Collection of <see cref="T:Castle.Core.ConstructorCandidate"/> - </summary> - </member> - <member name="P:Castle.Core.ConstructorCandidateCollection.FewerArgumentsCandidate"> - <summary> - Gets the fewer arguments candidate. - </summary> - <value>The fewer arguments candidate.</value> - </member> - <member name="T:Castle.Core.DependencyModel"> - <summary> - Represents a dependency (other component or a - fixed value available through external configuration). - </summary> - </member> - <member name="M:Castle.Core.DependencyModel.#ctor(Castle.Core.DependencyType,System.String,System.Type,System.Boolean)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.DependencyModel"/> class. - </summary> - <param name="type">The type.</param> - <param name="dependencyKey">The dependency key.</param> - <param name="targetType">Type of the target.</param> - <param name="isOptional">if set to <c>true</c> [is optional].</param> - </member> - <member name="M:Castle.Core.DependencyModel.ToString"> - <summary> - Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. - </summary> - <returns> - A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. - </returns> - </member> - <member name="M:Castle.Core.DependencyModel.GetHashCode"> - <summary> - Serves as a hash function for a particular type, suitable - for use in hashing algorithms and data structures like a hash table. - </summary> - <returns> - A hash code for the current <see cref="T:System.Object"/>. - </returns> - </member> - <member name="M:Castle.Core.DependencyModel.Equals(System.Object)"> - <summary> - Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>. - </summary> - <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param> - <returns> - <see langword="true"/> if the specified <see cref="T:System.Object"/> is equal to the - current <see cref="T:System.Object"/>; otherwise, <see langword="false"/>. - </returns> - </member> - <member name="P:Castle.Core.DependencyModel.DependencyType"> - <summary> - Gets or sets the type of the dependency. - </summary> - <value>The type of the dependency.</value> - </member> - <member name="P:Castle.Core.DependencyModel.DependencyKey"> - <summary> - Gets or sets the dependency key. - </summary> - <value>The dependency key.</value> - </member> - <member name="P:Castle.Core.DependencyModel.TargetType"> - <summary> - Gets the type of the target. - </summary> - <value>The type of the target.</value> - </member> - <member name="P:Castle.Core.DependencyModel.IsOptional"> - <summary> - Gets or sets whether this dependency is optional. - </summary> - <value> - <c>true</c> if this dependency is optional; otherwise, <c>false</c>. - </value> - </member> - <member name="T:Castle.Core.DependencyModelCollection"> - <summary> - Collection of <see cref="T:Castle.Core.DependencyModel"/>. - </summary> - </member> - <member name="M:Castle.Core.DependencyModelCollection.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.DependencyModelCollection"/> class. - </summary> - </member> - <member name="M:Castle.Core.DependencyModelCollection.#ctor(System.Collections.Generic.IEnumerable{Castle.Core.DependencyModel})"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.DependencyModelCollection"/> class. - </summary> - <param name="dependencies">The dependencies.</param> - </member> - <member name="T:Castle.Core.InterceptorReference"> - <summary> - Represents an reference to a Interceptor component. - </summary> - </member> - <member name="M:Castle.Core.InterceptorReference.#ctor(System.String)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.InterceptorReference"/> class. - </summary> - <param name="componentKey">The component key.</param> - </member> - <member name="M:Castle.Core.InterceptorReference.#ctor(System.Type)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.InterceptorReference"/> class. - </summary> - <param name="serviceType">Type of the service.</param> - </member> - <member name="M:Castle.Core.InterceptorReference.ForKey(System.String)"> - <summary> - Gets an <see cref="T:Castle.Core.InterceptorReference"/> for the component key. - </summary> - <param name="key">The component key.</param> - <returns>The <see cref="T:Castle.Core.InterceptorReference"/></returns> - </member> - <member name="M:Castle.Core.InterceptorReference.ForType(System.Type)"> - <summary> - Gets an <see cref="T:Castle.Core.InterceptorReference"/> for the service. - </summary> - <param name="service">The service.</param> - <returns>The <see cref="T:Castle.Core.InterceptorReference"/></returns> - </member> - <member name="M:Castle.Core.InterceptorReference.ForType``1"> - <summary> - Gets an <see cref="T:Castle.Core.InterceptorReference"/> for the service. - </summary> - <typeparam name="T">The service type.</typeparam> - <returns>The <see cref="T:Castle.Core.InterceptorReference"/></returns> - </member> - <member name="P:Castle.Core.InterceptorReference.ServiceType"> - <summary> - Gets the type of the service. - </summary> - <value>The type of the service.</value> - </member> - <member name="P:Castle.Core.InterceptorReference.ComponentKey"> - <summary> - Gets the interceptor component key. - </summary> - <value>The component key.</value> - </member> - <member name="P:Castle.Core.InterceptorReference.ReferenceType"> - <summary> - Gets the type of the reference. - </summary> - <value>The type of the reference.</value> - </member> - <member name="T:Castle.Core.InterceptorReferenceCollection"> - <summary> - Collection of <see cref="T:Castle.Core.InterceptorReference"/> - </summary> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.Add(Castle.Core.InterceptorReference)"> - <summary> - Adds the specified item. - </summary> - <param name="item">The interceptor.</param> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.AddFirst(Castle.Core.InterceptorReference)"> - <summary> - Adds the specified interceptor as the first. - </summary> - <param name="item">The interceptor.</param> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.AddLast(Castle.Core.InterceptorReference)"> - <summary> - Adds the specified interceptor as the last. - </summary> - <param name="item">The interceptor.</param> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.Insert(System.Int32,Castle.Core.InterceptorReference)"> - <summary> - Inserts the specified interceptor at the specified index. - </summary> - <param name="index">The index.</param> - <param name="item">The interceptor.</param> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.CopyTo(System.Array,System.Int32)"> - <summary> - When implemented by a class, copies the elements of - the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index. - </summary> - <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param> - <param name="index">The zero-based index in <paramref name="array"/> at which copying begins.</param> - <exception cref="T:System.ArgumentNullException"> - <paramref name="array"/> is <see langword="null"/>.</exception> - <exception cref="T:System.ArgumentOutOfRangeException"> - <paramref name="index"/> is less than zero.</exception> - <exception cref="T:System.ArgumentException"> - <para> - <paramref name="array"/> is multidimensional.</para> - <para>-or-</para> - <para> - <paramref name="index"/> is equal to or greater than the length of <paramref name="array"/>.</para> - <para>-or-</para> - <para>The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>.</para> - </exception> - <exception cref="T:System.InvalidCastException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination <paramref name="array"/>.</exception> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.GetEnumerator"> - <summary> - Returns an enumerator that can iterate through a collection. - </summary> - <returns> - An <see cref="T:System.Collections.IEnumerator"/> - that can be used to iterate through the collection. - </returns> - </member> - <member name="M:Castle.Core.InterceptorReferenceCollection.AddIfNotInCollection(Castle.Core.InterceptorReference)"> - <summary> - Adds the interceptor to the end of the interceptors list if it does not exist already. - </summary> - <param name="interceptorReference">The interceptor reference.</param> - </member> - <member name="P:Castle.Core.InterceptorReferenceCollection.HasInterceptors"> - <summary> - Gets a value indicating whether this instance has interceptors. - </summary> - <value> - <c>true</c> if this instance has interceptors; otherwise, <c>false</c>. - </value> - </member> - <member name="P:Castle.Core.InterceptorReferenceCollection.Count"> - <summary> - Gets the number of - elements contained in the <see cref="T:System.Collections.ICollection"/>. - </summary> - <value></value> - </member> - <member name="P:Castle.Core.InterceptorReferenceCollection.SyncRoot"> - <summary> - Gets an object that - can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>. - </summary> - <value></value> - </member> - <member name="P:Castle.Core.InterceptorReferenceCollection.IsSynchronized"> - <summary> - Gets a value - indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized - (thread-safe). - </summary> - <value></value> - </member> - <member name="T:Castle.Core.LifecycleStepCollection"> - <summary> - Represents a collection of ordered lifecycle steps. - </summary> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.LifecycleStepCollection"/> class. - </summary> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.GetCommissionSteps"> - <summary> - Returns all steps for the commission phase - </summary> - <returns></returns> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.GetDecommissionSteps"> - <summary> - Returns all steps for the decommission phase - </summary> - <returns></returns> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.Add(Castle.Core.LifecycleStepType,System.Object)"> - <summary> - Adds a step to the commission or decomission phases. - </summary> - <param name="type"></param> - <param name="stepImplementation"></param> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.AddFirst(Castle.Core.LifecycleStepType,System.Object)"> - <summary> - Adds a step as the first step to execute for the commission or decomission phase. - </summary> - <param name="type"></param> - <param name="stepImplementation"></param> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.CopyTo(System.Array,System.Int32)"> - <summary> - Copies the elements of - the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index. - </summary> - <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param> - <param name="index">The zero-based index in <paramref name="array"/> at which copying begins.</param> - <exception cref="T:System.ArgumentNullException"> - <paramref name="array"/> is <see langword="null"/>.</exception> - <exception cref="T:System.ArgumentOutOfRangeException"> - <paramref name="index"/> is less than zero.</exception> - <exception cref="T:System.ArgumentException"> - <para> - <paramref name="array"/> is multidimensional.</para> - <para>-or-</para> - <para> - <paramref name="index"/> is equal to or greater than the length of <paramref name="array"/>.</para> - <para>-or-</para> - <para>The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>.</para> - </exception> - <exception cref="T:System.InvalidCastException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination <paramref name="array"/>.</exception> - </member> - <member name="M:Castle.Core.LifecycleStepCollection.GetEnumerator"> - <summary> - Returns an enumerator that can iterate through a collection. - </summary> - <returns> - An <see cref="T:System.Collections.IEnumerator"/> - that can be used to iterate through the collection. - </returns> - </member> - <member name="P:Castle.Core.LifecycleStepCollection.HasCommissionSteps"> - <summary> - Gets a value indicating whether this instance has commission steps. - </summary> - <value> - <c>true</c> if this instance has commission steps; otherwise, <c>false</c>. - </value> - </member> - <member name="P:Castle.Core.LifecycleStepCollection.HasDecommissionSteps"> - <summary> - Gets a value indicating whether this instance has decommission steps. - </summary> - <value> - <c>true</c> if this instance has decommission steps; otherwise, <c>false</c>. - </value> - </member> - <member name="P:Castle.Core.LifecycleStepCollection.Count"> - <summary> - Gets the number of - elements contained in the <see cref="T:System.Collections.ICollection"/>. - </summary> - <value></value> - </member> - <member name="P:Castle.Core.LifecycleStepCollection.SyncRoot"> - <summary> - Gets an object that - can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>. - </summary> - <value></value> - </member> - <member name="P:Castle.Core.LifecycleStepCollection.IsSynchronized"> - <summary> - Gets a value - indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized - (thread-safe). - </summary> - <value></value> - </member> - <member name="T:Castle.Core.MethodMetaModel"> - <summary> - Represents meta information associated with a method - (not yet defined) - </summary> - </member> - <member name="M:Castle.Core.MethodMetaModel.#ctor(Castle.Core.Configuration.IConfiguration)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.MethodMetaModel"/> class. - </summary> - <param name="configNode">The config node.</param> - </member> - <member name="P:Castle.Core.MethodMetaModel.ConfigNode"> - <summary> - Gets the config node. - </summary> - <value>The config node.</value> - </member> - <member name="T:Castle.Core.MethodMetaModelCollection"> - <summary> - Collection of <see cref="T:Castle.Core.MethodMetaModel"/> - </summary> - </member> - <member name="P:Castle.Core.MethodMetaModelCollection.MethodInfo2Model"> - <summary> - Gets the method info2 model. - </summary> - <value>The method info2 model.</value> - </member> - <member name="T:Castle.Core.ParameterModel"> - <summary> - Represents a parameter. Usually the parameter - comes from the external world, ie, an external configuration. - </summary> - </member> - <member name="M:Castle.Core.ParameterModel.#ctor(System.String,System.String)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ParameterModel"/> class. - </summary> - <param name="name">The name.</param> - <param name="value">The value.</param> - </member> - <member name="M:Castle.Core.ParameterModel.#ctor(System.String,Castle.Core.Configuration.IConfiguration)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ParameterModel"/> class. - </summary> - <param name="name">The name.</param> - <param name="value">The value.</param> - </member> - <member name="P:Castle.Core.ParameterModel.Name"> - <summary> - Gets the name. - </summary> - <value>The name.</value> - </member> - <member name="P:Castle.Core.ParameterModel.Value"> - <summary> - Gets the value. - </summary> - <value>The value.</value> - </member> - <member name="P:Castle.Core.ParameterModel.ConfigValue"> - <summary> - Gets the config value. - </summary> - <value>The config value.</value> - </member> - <member name="T:Castle.Core.ParameterModelCollection"> - <summary> - Collection of <see cref="T:Castle.Core.ParameterModel"/> - </summary> - </member> - <member name="M:Castle.Core.ParameterModelCollection.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ParameterModelCollection"/> class. - </summary> - </member> - <member name="M:Castle.Core.ParameterModelCollection.Add(System.String,System.String)"> - <summary> - Adds the specified name. - </summary> - <param name="name">The name.</param> - <param name="value">The value.</param> - </member> - <member name="M:Castle.Core.ParameterModelCollection.Add(System.String,Castle.Core.Configuration.IConfiguration)"> - <summary> - Adds the specified name. - </summary> - <param name="name">The name.</param> - <param name="configNode">The config node.</param> - </member> - <member name="M:Castle.Core.ParameterModelCollection.Contains(System.Object)"> - <summary> - Determines whether this collection contains the specified key. - </summary> - <param name="key">The key.</param> - <returns> - <c>true</c> if yes; otherwise, <c>false</c>. - </returns> - </member> - <member name="M:Castle.Core.ParameterModelCollection.Add(System.Object,System.Object)"> - <summary> - Adds the specified key. - </summary> - <remarks> - Not implemented - </remarks> - <param name="key">The key.</param> - <param name="value">The value.</param> - </member> - <member name="M:Castle.Core.ParameterModelCollection.Clear"> - <summary> - Clears this instance. - </summary> - <remarks> - Not implemented - </remarks> - </member> - <member name="M:Castle.Core.ParameterModelCollection.Remove(System.Object)"> - <summary> - Removes the specified key. - </summary> - <param name="key">The key.</param> - <remarks> - Not implemented - </remarks> - </member> - <member name="M:Castle.Core.ParameterModelCollection.CopyTo(System.Array,System.Int32)"> - <summary> - Copy the content to the specified array - </summary> - <param name="array">target array</param> - <param name="index">target index</param> - <remarks> - Not implemented - </remarks> - </member> - <member name="M:Castle.Core.ParameterModelCollection.GetEnumerator"> - <summary> - Returns an enumerator that can iterate through a collection. - </summary> - <returns> - An <see cref="T:System.Collections.IEnumerator"/> - that can be used to iterate through the collection. - </returns> - </member> - <member name="P:Castle.Core.ParameterModelCollection.Keys"> - <summary> - Gets the keys. - </summary> - <value>The keys.</value> - <remarks> - Not implemented - </remarks> - </member> - <member name="P:Castle.Core.ParameterModelCollection.Values"> - <summary> - Gets the values. - </summary> - <value>The values.</value> - <remarks> - Not implemented - </remarks> - </member> - <member name="P:Castle.Core.ParameterModelCollection.IsReadOnly"> - <summary> - Gets a value indicating whether this instance is read only. - </summary> - <value> - <c>true</c> if this instance is read only; otherwise, <c>false</c>. - </value> - </member> - <member name="P:Castle.Core.ParameterModelCollection.IsFixedSize"> - <summary> - Gets a value indicating whether this instance is fixed size. - </summary> - <value> - <c>true</c> if this instance is fixed size; otherwise, <c>false</c>. - </value> - </member> - <member name="P:Castle.Core.ParameterModelCollection.Item(System.Object)"> - <summary> - Gets the <see cref="T:Castle.Core.ParameterModel"/> with the specified key. - </summary> - <value></value> - </member> - <member name="P:Castle.Core.ParameterModelCollection.Count"> - <summary> - Gets the count. - </summary> - <value>The count.</value> - </member> - <member name="P:Castle.Core.ParameterModelCollection.SyncRoot"> - <summary> - Gets the sync root. - </summary> - <value>The sync root.</value> - </member> - <member name="P:Castle.Core.ParameterModelCollection.IsSynchronized"> - <summary> - Gets a value indicating whether this instance is synchronized. - </summary> - <value> - <c>true</c> if this instance is synchronized; otherwise, <c>false</c>. - </value> - </member> - <member name="T:Castle.Core.PropertySet"> - <summary> - Represents a property and the respective dependency. - </summary> - </member> - <member name="M:Castle.Core.PropertySet.#ctor(System.Reflection.PropertyInfo,Castle.Core.DependencyModel)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.PropertySet"/> class. - </summary> - <param name="propertyInfo">The property info.</param> - <param name="dependency">The dependency.</param> - </member> - <member name="P:Castle.Core.PropertySet.Property"> - <summary> - Gets the property. - </summary> - <value>The property.</value> - </member> - <member name="P:Castle.Core.PropertySet.Dependency"> - <summary> - Gets the dependency. - </summary> - <value>The dependency.</value> - </member> - <member name="T:Castle.Core.PropertySetCollection"> - <summary> - Collection of <see cref="T:Castle.Core.PropertySet"/> - </summary> - </member> - <member name="M:Castle.Core.PropertySetCollection.FindByPropertyInfo(System.Reflection.PropertyInfo)"> - <summary> - Finds a PropertySet the by PropertyInfo. - </summary> - <param name="info">The info.</param> - <returns></returns> - </member> - <member name="T:Castle.Core.Resource.IResource"> - <summary> - Represents a 'streamable' resource. Can - be a file, a resource in an assembly. - </summary> - </member> - <member name="M:Castle.Core.Resource.IResource.GetStreamReader"> - <summary> - Returns a reader for the stream - </summary> - <remarks> - It's up to the caller to dispose the reader. - </remarks> - <returns></returns> - </member> - <member name="M:Castle.Core.Resource.IResource.GetStreamReader(System.Text.Encoding)"> - <summary> - Returns a reader for the stream - </summary> - <remarks> - It's up to the caller to dispose the reader. - </remarks> - <param name="encoding"></param> - <returns></returns> - </member> - <member name="M:Castle.Core.Resource.IResource.CreateRelative(System.String)"> - <summary> - Returns an instance of <see cref="T:Castle.Core.Resource.IResource"/> - created according to the <c>relativePath</c> - using itself as the root. - </summary> - <param name="relativePath"></param> - <returns></returns> - </member> - <member name="P:Castle.Core.Resource.IResource.FileBasePath"> - <summary> - - </summary> - <remarks> - Only valid for resources that - can be obtained through relative paths - </remarks> - </member> - <member name="T:Castle.Core.Resource.AbstractStreamResource"> - <summary> - - </summary> - </member> - <member name="F:Castle.Core.Resource.AbstractStreamResource.createStream"> - <summary> - This returns a new stream instance each time it is called. - It is the responsability of the caller to dispose of this stream - </summary> - </member> - <member name="T:Castle.Core.Resource.AssemblyResourceFactory"> - <summary> - - </summary> - </member> - <member name="T:Castle.Core.Resource.IResourceFactory"> - <summary> - Depicts the contract for resource factories. - </summary> - </member> - <member name="M:Castle.Core.Resource.IResourceFactory.Accept(Castle.Core.Resource.CustomUri)"> - <summary> - Used to check whether the resource factory - is able to deal with the given resource - identifier. - </summary> - <remarks> - Implementors should return <c>true</c> - only if the given identificator is supported - by the resource factory - </remarks> - <param name="uri"></param> - <returns></returns> - </member> - <member name="M:Castle.Core.Resource.IResourceFactory.Create(Castle.Core.Resource.CustomUri)"> - <summary> - Creates an <see cref="T:Castle.Core.Resource.IResource"/> instance - for the given resource identifier - </summary> - <param name="uri"></param> - <returns></returns> - </member> - <member name="M:Castle.Core.Resource.IResourceFactory.Create(Castle.Core.Resource.CustomUri,System.String)"> - <summary> - Creates an <see cref="T:Castle.Core.Resource.IResource"/> instance - for the given resource identifier - </summary> - <param name="uri"></param> - <param name="basePath"></param> - <returns></returns> - </member> - <member name="T:Castle.Core.Resource.FileResource"> - <summary> - - </summary> - </member> - <member name="T:Castle.Core.Resource.FileResourceFactory"> - <summary> - - </summary> - </member> - <member name="T:Castle.Core.Resource.StaticContentResource"> - <summary> - Adapts a static string content as an <see cref="T:Castle.Core.Resource.IResource"/> - </summary> - </member> - <member name="T:Castle.Core.Resource.UncResource"> - <summary> - Enable access to files on network shares - </summary> - </member> - <member name="T:Castle.Core.IServiceEnabledComponent"> - <summary> - Defines that the implementation wants a - <see cref="T:System.IServiceProvider"/> in order to - access other components. The creator must be aware - that the component might (or might not) implement - the interface. - </summary> - <remarks> - Used by Castle Project components to, for example, - gather logging factories - </remarks> - </member> - <member name="T:Castle.Core.IServiceProviderEx"> - <summary> - Increments <c>IServiceProvider</c> with a generic service resolution operation. - </summary> - </member> - <member name="T:Castle.Core.IServiceProviderExAccessor"> - <summary> - This interface should be implemented by classes - that are available in a bigger context, exposing - the container to different areas in the same application. - <para> - For example, in Web application, the (global) HttpApplication - subclasses should implement this interface to expose - the configured container - </para> - </summary> - </member> - <member name="T:Castle.Core.Pair`2"> - <summary> - General purpose class to represent a standard pair of values. - </summary> - <typeparam name="TFirst">Type of the first value</typeparam> - <typeparam name="TSecond">Type of the second value</typeparam> - </member> - <member name="M:Castle.Core.Pair`2.#ctor(`0,`1)"> - <summary> - Constructs a pair with its values - </summary> - <param name="first"></param> - <param name="second"></param> - </member> - <member name="T:Castle.Core.ProxyServices"> - <summary> - List of utility methods related to dynamic proxy operations - </summary> - </member> - <member name="M:Castle.Core.ProxyServices.IsDynamicProxy(System.Type)"> - <summary> - Determines whether the specified type is a proxy generated by - DynamicProxy (1 or 2). - </summary> - <param name="type">The type.</param> - <returns> - <c>true</c> if it is a proxy; otherwise, <c>false</c>. - </returns> - </member> - <member name="T:Castle.Core.ReflectionBasedDictionaryAdapter"> - <summary> - Pendent - </summary> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.#ctor(System.Object)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.Core.ReflectionBasedDictionaryAdapter"/> class. - </summary> - <param name="target">The target.</param> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.Contains(System.Object)"> - <summary> - Determines whether the <see cref="T:System.Collections.IDictionary"/> object contains an element with the specified key. - </summary> - <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary"/> object.</param> - <returns> - true if the <see cref="T:System.Collections.IDictionary"/> contains an element with the key; otherwise, false. - </returns> - <exception cref="T:System.ArgumentNullException"> - <paramref name="key"/> is null. </exception> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.Add(System.Object,System.Object)"> - <summary> - Adds an element with the provided key and value to the <see cref="T:System.Collections.IDictionary"/> object. - </summary> - <param name="key">The <see cref="T:System.Object"/> to use as the key of the element to add.</param> - <param name="value">The <see cref="T:System.Object"/> to use as the value of the element to add.</param> - <exception cref="T:System.ArgumentNullException"> - <paramref name="key"/> is null. </exception> - <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.IDictionary"/> object. </exception> - <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.IDictionary"/> is read-only.-or- The <see cref="T:System.Collections.IDictionary"/> has a fixed size. </exception> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.Clear"> - <summary> - Removes all elements from the <see cref="T:System.Collections.IDictionary"/> object. - </summary> - <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.IDictionary"/> object is read-only. </exception> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.System#Collections#IDictionary#GetEnumerator"> - <summary> - Returns an <see cref="T:System.Collections.IDictionaryEnumerator"/> object for the <see cref="T:System.Collections.IDictionary"/> object. - </summary> - <returns> - An <see cref="T:System.Collections.IDictionaryEnumerator"/> object for the <see cref="T:System.Collections.IDictionary"/> object. - </returns> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.Remove(System.Object)"> - <summary> - Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary"/> object. - </summary> - <param name="key">The key of the element to remove.</param> - <exception cref="T:System.ArgumentNullException"> - <paramref name="key"/> is null. </exception> - <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.IDictionary"/> object is read-only.-or- The <see cref="T:System.Collections.IDictionary"/> has a fixed size. </exception> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.CopyTo(System.Array,System.Int32)"> - <summary> - Copies the elements of the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index. - </summary> - <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param> - <param name="index">The zero-based index in <paramref name="array"/> at which copying begins.</param> - <exception cref="T:System.ArgumentNullException"> - <paramref name="array"/> is null. </exception> - <exception cref="T:System.ArgumentOutOfRangeException"> - <paramref name="index"/> is less than zero. </exception> - <exception cref="T:System.ArgumentException"> - <paramref name="array"/> is multidimensional.-or- <paramref name="index"/> is equal to or greater than the length of <paramref name="array"/>.-or- The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>. </exception> - <exception cref="T:System.ArgumentException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination <paramref name="array"/>. </exception> - </member> - <member name="M:Castle.Core.ReflectionBasedDictionaryAdapter.GetEnumerator"> - <summary> - Returns an enumerator that iterates through a collection. - </summary> - <returns> - An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection. - </returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.Item(System.Object)"> - <summary> - Gets or sets the <see cref="T:System.Object"/> with the specified key. - </summary> - <value></value> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.Keys"> - <summary> - Gets an <see cref="T:System.Collections.ICollection"/> object containing the keys of the <see cref="T:System.Collections.IDictionary"/> object. - </summary> - <value></value> - <returns>An <see cref="T:System.Collections.ICollection"/> object containing the keys of the <see cref="T:System.Collections.IDictionary"/> object.</returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.Values"> - <summary> - Gets an <see cref="T:System.Collections.ICollection"/> object containing the values in the <see cref="T:System.Collections.IDictionary"/> object. - </summary> - <value></value> - <returns>An <see cref="T:System.Collections.ICollection"/> object containing the values in the <see cref="T:System.Collections.IDictionary"/> object.</returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.IsReadOnly"> - <summary> - Gets a value indicating whether the <see cref="T:System.Collections.IDictionary"/> object is read-only. - </summary> - <value></value> - <returns>true if the <see cref="T:System.Collections.IDictionary"/> object is read-only; otherwise, false.</returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.IsFixedSize"> - <summary> - Gets a value indicating whether the <see cref="T:System.Collections.IDictionary"/> object has a fixed size. - </summary> - <value></value> - <returns>true if the <see cref="T:System.Collections.IDictionary"/> object has a fixed size; otherwise, false.</returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.Count"> - <summary> - Gets the number of elements contained in the <see cref="T:System.Collections.ICollection"/>. - </summary> - <value></value> - <returns>The number of elements contained in the <see cref="T:System.Collections.ICollection"/>.</returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.SyncRoot"> - <summary> - Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>. - </summary> - <value></value> - <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.</returns> - </member> - <member name="P:Castle.Core.ReflectionBasedDictionaryAdapter.IsSynchronized"> - <summary> - Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe). - </summary> - <value></value> - <returns>true if access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe); otherwise, false.</returns> - </member> - </members> -</doc> diff --git a/References/CastleDynamicProxy2/Castle.DynamicProxy2.xml b/References/CastleDynamicProxy2/Castle.DynamicProxy2.xml deleted file mode 100644 index 9ab892a..0000000 --- a/References/CastleDynamicProxy2/Castle.DynamicProxy2.xml +++ /dev/null @@ -1,1249 +0,0 @@ -<?xml version="1.0"?> -<doc> - <assembly> - <name>Castle.DynamicProxy2</name> - </assembly> - <members> - <member name="T:Castle.DynamicProxy.Generators.Emitters.SimpleAST.IndirectReference"> - <summary> - Wraps a reference that is passed - ByRef and provides indirect load/store support. - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.Emitters.SimpleAST.NewArrayExpression"> - <summary> - Summary description for NewArrayExpression. - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.Emitters.SimpleAST.ReferencesToObjectArrayExpression"> - <summary> - - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.CustomAttributeUtil.InitializeConstructorArgs(System.Type,System.Attribute,System.Object[],System.Reflection.ParameterInfo[])"> - <summary> - Here we try to match a constructor argument to its value. - Since we can't get the values from the assembly, we use some heuristics to get it. - a/ we first try to match all the properties on the attributes by name (case insensitive) to the argument - b/ if we fail we try to match them by property type, with some smarts about convertions (i,e: can use Guid for string). - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.CustomAttributeUtil.ReplaceIfBetterMatch(System.Reflection.ParameterInfo,System.Reflection.PropertyInfo,System.Reflection.PropertyInfo)"> - <summary> - We have the following rules here. - Try to find a matching type, failing that, if the parameter is string, get the first property (under the assumption that - we can convert it. - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.CustomAttributeUtil.ConvertValue(System.Object,System.Type)"> - <summary> - Attributes can only accept simple types, so we return null for null, - if the value is passed as string we call to string (should help with converting), - otherwise, we use the value as is (enums, integer, etc). - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.Emitters.LdcOpCodesDictionary"> - <summary>s - Provides appropriate Ldc.X opcode for the type of primitive value to be loaded. - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.Emitters.LdindOpCodesDictionary"> - <summary> - Provides appropriate Ldind.X opcode for - the type of primitive value to be loaded indirectly. - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.MethodEmitter.CopyParametersAndReturnTypeFrom(System.Reflection.MethodInfo,Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter)"> - <summary> - Inspect the base method for generic definitions - and set the return type and the parameters - accordingly - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.OpCodeUtil.EmitLoadOpCodeForConstantValue(System.Reflection.Emit.ILGenerator,System.Object)"> - <summary> - Emits a load opcode of the appropriate kind for a constant string or - primitive value. - </summary> - <param name="gen"></param> - <param name="value"></param> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.OpCodeUtil.EmitLoadOpCodeForDefaultValueOfType(System.Reflection.Emit.ILGenerator,System.Type)"> - <summary> - Emits a load opcode of the appropriate kind for the constant default value of a - type, such as 0 for value types and null for reference types. - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.OpCodeUtil.EmitLoadIndirectOpCodeForType(System.Reflection.Emit.ILGenerator,System.Type)"> - <summary> - Emits a load indirect opcode of the appropriate type for a value or object reference. - Pops a pointer off the evaluation stack, dereferences it and loads - a value of the specified type. - </summary> - <param name="gen"></param> - <param name="type"></param> - </member> - <member name="M:Castle.DynamicProxy.Generators.Emitters.OpCodeUtil.EmitStoreIndirectOpCodeForType(System.Reflection.Emit.ILGenerator,System.Type)"> - <summary> - Emits a store indirectopcode of the appropriate type for a value or object reference. - Pops a value of the specified type and a pointer off the evaluation stack, and - stores the value. - </summary> - <param name="gen"></param> - <param name="type"></param> - </member> - <member name="T:Castle.DynamicProxy.Generators.Emitters.PropertiesCollection"> - <summary> - Summary description for PropertiesCollection. - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.Emitters.StindOpCodesDictionary"> - <summary> - Provides appropriate Stind.X opcode - for the type of primitive value to be stored indirectly. - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.BaseProxyGenerator"> - <summary> - Base class that exposes the common functionalities - to proxy generation. - </summary> - <remarks> - TODO: - - Add tests and fixes for 'leaking this' problem - </remarks> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.GetProxyTargetReference"> - <summary> - Used by dinamically implement <see cref="T:Castle.Core.Interceptor.IProxyTargetAccessor"/> - </summary> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.GenerateParameterlessConstructor(Castle.DynamicProxy.Generators.Emitters.ClassEmitter,System.Type,Castle.DynamicProxy.Generators.Emitters.SimpleAST.FieldReference)"> - <summary> - Generates a parameters constructor that initializes the proxy - state with <see cref="T:Castle.Core.Interceptor.StandardInterceptor"/> just to make it non-null. - <para> - This constructor is important to allow proxies to be XML serializable - </para> - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildInvocationNestedType(Castle.DynamicProxy.Generators.Emitters.ClassEmitter,System.Type,System.Type,System.Reflection.MethodInfo,System.Reflection.MethodInfo,Castle.DynamicProxy.Generators.ConstructorVersion)"> - <summary> - If callbackMethod is null the InvokeOnTarget implementation - is just the code to throw an exception - </summary> - <param name="emitter"></param> - <param name="targetType"></param> - <param name="targetForInvocation"></param> - <param name="methodInfo"></param> - <param name="callbackMethod"></param> - <param name="version"></param> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildInvocationNestedType(Castle.DynamicProxy.Generators.Emitters.ClassEmitter,System.Type,System.Type,System.Reflection.MethodInfo,System.Reflection.MethodInfo,Castle.DynamicProxy.Generators.ConstructorVersion,System.Boolean)"> - <summary> - If callbackMethod is null the InvokeOnTarget implementation - is just the code to throw an exception - </summary> - <param name="emitter"></param> - <param name="targetType"></param> - <param name="targetForInvocation"></param> - <param name="methodInfo"></param> - <param name="callbackMethod"></param> - <param name="version"></param> - <param name="allowChangeTarget">If true the invocation will implement the IChangeProxyTarget interface</param> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.CreateIInvocationConstructor(System.Type,Castle.DynamicProxy.Generators.Emitters.NestedClassEmitter,Castle.DynamicProxy.Generators.Emitters.SimpleAST.FieldReference,Castle.DynamicProxy.Generators.ConstructorVersion)"> - <summary> - Generates the constructor for the nested class that extends - <see cref="T:Castle.DynamicProxy.AbstractInvocation"/> - </summary> - <param name="targetFieldType"></param> - <param name="nested"></param> - <param name="targetField"></param> - <param name="version"></param> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.CreateInitializeCacheMethodBody(System.Type,System.Reflection.MethodInfo[],Castle.DynamicProxy.Generators.Emitters.ClassEmitter,Castle.DynamicProxy.Generators.Emitters.ConstructorEmitter)"> - <summary> - Improvement: this cache should be static. We should generate a - type constructor instead - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.AcceptMethod(System.Reflection.MethodInfo,System.Boolean)"> - <summary> - Performs some basic screening and invokes the <see cref="T:Castle.DynamicProxy.IProxyGenerationHook"/> - to select methods. - </summary> - <param name="method"></param> - <param name="onlyVirtuals"></param> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.IsAccessible(System.Reflection.MethodInfo)"> - <summary> - Checks if the method is public or protected. - </summary> - <param name="method"></param> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.ShouldSkipAttributeReplication(System.Attribute)"> - <summary> - Attributes should be replicated if they are non-inheritable, - but there are some special cases where the attributes means - something to the CLR, where they should be skipped. - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.BaseProxyGenerator.ShouldCreateNewSlot(System.Reflection.MethodInfo)"> - <summary> - Checks if the method has the same signature as a method that was marked as - one that should generate a new vtable slot. - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.CacheKey.#ctor(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.Generators.CacheKey"/> class. - </summary> - <param name="targetType">Type of the target.</param> - <param name="interfaces">The interfaces.</param> - <param name="options">The options.</param> - </member> - <member name="T:Castle.DynamicProxy.Generators.ClassProxyGenerator"> - <summary> - - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.EventToGenerate.#ctor(Castle.DynamicProxy.Generators.Emitters.EventEmitter,System.Reflection.MethodInfo,System.Reflection.MethodInfo,System.Reflection.EventAttributes)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.Generators.EventToGenerate"/> class. - </summary> - <param name="emitter">The emitter.</param> - <param name="addMethod">The add method.</param> - <param name="removeMethod">The remove method.</param> - <param name="attributes">The attributes.</param> - </member> - <member name="T:Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator"> - <summary> - - </summary> - </member> - <member name="M:Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.FindMethodOnTargetType(System.Reflection.MethodInfo,System.Type,System.Boolean)"> - <summary> - Finds the type of the method on target. - </summary> - <param name="methodOnInterface">The method on interface.</param> - <param name="proxyTargetType">Type of the proxy target.</param> - /// <param name="checkMixins">if set to <c>true</c> will check implementation on mixins.</param> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.IsTypeEquivalent(System.Type,System.Type)"> - <summary> - Checks whether the given types are the same. This is - more complicated than it looks. - </summary> - <param name="sourceType"></param> - <param name="targetType"></param> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.IsMethodEquivalent(System.Reflection.MethodInfo,System.Reflection.MethodInfo)"> - <summary> - Checks whether the given methods are the same. - </summary> - <param name="methodInfo"></param> - <param name="methodOnInterface"></param> - <returns>True if the methods are the same.</returns> - </member> - <member name="T:Castle.DynamicProxy.Generators.InterfaceGeneratorType"> - <summary> - This is used by the ProxyObjectReference class durin de-serialiation, to know - which generator it should use - </summary> - </member> - <member name="T:Castle.DynamicProxy.Generators.MethodFinder"> - <summary> - Returns the methods implemented by a type. Use this instead of Type.GetMethods() to work around a CLR issue - where duplicate MethodInfos are returned by Type.GetMethods() after a token of a generic type's method was loaded. - </summary> - </member> - <member name="T:Castle.DynamicProxy.Serialization.ProxyObjectReference"> - <summary> - Handles the deserialization of proxies. - </summary> - </member> - <member name="M:Castle.DynamicProxy.Serialization.ProxyObjectReference.ResetScope"> - <summary> - Resets the <see cref="P:Castle.DynamicProxy.Serialization.ProxyObjectReference.ModuleScope"/> used for deserialization to a new scope. - </summary> - <remarks>This is useful for test cases.</remarks> - </member> - <member name="M:Castle.DynamicProxy.Serialization.ProxyObjectReference.SetScope(Castle.DynamicProxy.ModuleScope)"> - <summary> - Resets the <see cref="P:Castle.DynamicProxy.Serialization.ProxyObjectReference.ModuleScope"/> used for deserialization to a given <paramref name="scope"/>. - </summary> - <param name="scope">The scope to be used for deserialization.</param> - <remarks>By default, the deserialization process uses a different scope than the rest of the application, which can lead to multiple proxies - being generated for the same type. By explicitly setting the deserialization scope to the application's scope, this can be avoided.</remarks> - </member> - <member name="P:Castle.DynamicProxy.Serialization.ProxyObjectReference.ModuleScope"> - <summary> - Gets the <see cref="T:Castle.DynamicProxy.ModuleScope"/> used for deserialization. - </summary> - <value>As <see cref="T:Castle.DynamicProxy.Serialization.ProxyObjectReference"/> has no way of automatically determining the scope used by the application (and the application - might use more than one scope at the same time), <see cref="T:Castle.DynamicProxy.Serialization.ProxyObjectReference"/> uses a dedicated scope instance for deserializing proxy - types. This instance can be reset and set to a specific value via <see cref="M:Castle.DynamicProxy.Serialization.ProxyObjectReference.ResetScope"/> and <see cref="M:Castle.DynamicProxy.Serialization.ProxyObjectReference.SetScope(Castle.DynamicProxy.ModuleScope)"/>.</value> - </member> - <member name="T:Castle.DynamicProxy.IProxyGenerationHook"> - <summary> - Used during the target type inspection process. Implementors have a chance to customize the - proxy generation process. - </summary> - </member> - <member name="M:Castle.DynamicProxy.IProxyGenerationHook.ShouldInterceptMethod(System.Type,System.Reflection.MethodInfo)"> - <summary> - Invoked by the generation process to determine if the specified method should be proxied. - </summary> - <param name="type">The type which declares the given method.</param> - <param name="methodInfo">The method to inspect.</param> - <returns>True if the given method should be proxied; false otherwise.</returns> - </member> - <member name="M:Castle.DynamicProxy.IProxyGenerationHook.NonVirtualMemberNotification(System.Type,System.Reflection.MemberInfo)"> - <summary> - Invoked by the generation process to notify that a member was not marked as virtual. - </summary> - <param name="type">The type which declares the non-virtual member.</param> - <param name="memberInfo">The non-virtual member.</param> - <remarks> - Non-virtual members cannot be proxied. This method gives an opportunity to inspect - any non-virtual member of a type that has been requested to be proxied, and if - appropriate - throw an exception to notify the caller. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.IProxyGenerationHook.MethodsInspected"> - <summary> - Invoked by the generation process to notify that the whole process has completed. - </summary> - </member> - <member name="T:Castle.DynamicProxy.CacheMappingsAttribute"> - <summary> - Applied to the assemblies saved by <see cref="T:Castle.DynamicProxy.ModuleScope"/> in order to persist the cache data included in the persisted assembly. - </summary> - </member> - <member name="T:Castle.DynamicProxy.DefaultProxyBuilder"> - <summary> - Default implementation of <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> interface producing in-memory proxy assemblies. - </summary> - </member> - <member name="T:Castle.DynamicProxy.IProxyBuilder"> - <summary> - Abstracts the implementation of proxy type construction. - </summary> - </member> - <member name="M:Castle.DynamicProxy.IProxyBuilder.CreateClassProxy(System.Type,Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates a proxy type for given <paramref name="classToProxy"/>, using <paramref name="options"/> provided. - </summary> - <param name="classToProxy">The class type to proxy.</param> - <param name="options">The proxy generation options.</param> - <returns>The generated proxy type.</returns> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="classToProxy"/> is a generic type definition.</exception> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="classToProxy"/> is not public. - Note that to avoid this exception, you can mark offending type internal, and define <see cref="T:System.Runtime.CompilerServices.InternalsVisibleToAttribute"/> - pointing to Castle Dynamic Proxy assembly, in assembly containing that type, if this is appropriate.</exception> - <seealso cref="T:Castle.DynamicProxy.Generators.ClassProxyGenerator"/> - </member> - <member name="M:Castle.DynamicProxy.IProxyBuilder.CreateClassProxy(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates a proxy type for given <paramref name="classToProxy"/>, implementing <paramref name="additionalInterfacesToProxy"/>, using <paramref name="options"/> provided. - </summary> - <param name="classToProxy">The class type to proxy.</param> - <param name="additionalInterfacesToProxy">Additional interface types to proxy.</param> - <param name="options">The proxy generation options.</param> - <returns>The generated proxy type.</returns> - <remarks> - Implementers should return a proxy type for the specified class and interfaces. - Additional interfaces should be only 'mark' interfaces, that is, they should work like interface proxy without target. (See <see cref="M:Castle.DynamicProxy.IProxyBuilder.CreateInterfaceProxyTypeWithoutTarget(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"/> method.) - </remarks> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="classToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="classToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is not public. - Note that to avoid this exception, you can mark offending type internal, and define <see cref="T:System.Runtime.CompilerServices.InternalsVisibleToAttribute"/> - pointing to Castle Dynamic Proxy assembly, in assembly containing that type, if this is appropriate.</exception> - <seealso cref="T:Castle.DynamicProxy.Generators.ClassProxyGenerator"/> - </member> - <member name="M:Castle.DynamicProxy.IProxyBuilder.CreateInterfaceProxyTypeWithTarget(System.Type,System.Type[],System.Type,Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates a proxy type that proxies calls to <paramref name="interfaceToProxy"/> members on <paramref name="targetType"/>, implementing <paramref name="additionalInterfacesToProxy"/>, using <paramref name="options"/> provided. - </summary> - <param name="interfaceToProxy">The interface type to proxy.</param> - <param name="additionalInterfacesToProxy">Additional interface types to proxy.</param> - <param name="targetType">Type implementing <paramref name="interfaceToProxy"/> on which calls to the interface members should be intercepted.</param> - <param name="options">The proxy generation options.</param> - <returns>The generated proxy type.</returns> - <remarks> - Implementers should return a proxy type for the specified interface that 'proceeds' executions to the specified target. - Additional interfaces should be only 'mark' interfaces, that is, they should work like interface proxy without target. (See <see cref="M:Castle.DynamicProxy.IProxyBuilder.CreateInterfaceProxyTypeWithoutTarget(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"/> method.) - </remarks> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is not public. - Note that to avoid this exception, you can mark offending type internal, and define <see cref="T:System.Runtime.CompilerServices.InternalsVisibleToAttribute"/> - pointing to Castle Dynamic Proxy assembly, in assembly containing that type, if this is appropriate.</exception> - <seealso cref="T:Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator"/> - </member> - <member name="M:Castle.DynamicProxy.IProxyBuilder.CreateInterfaceProxyTypeWithoutTarget(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates a proxy type for given <paramref name="interfaceToProxy"/> that delegates all calls to the provided interceptors. - </summary> - <param name="interfaceToProxy">The interface type to proxy.</param> - <param name="additionalInterfacesToProxy">Additional interface types to proxy.</param> - <param name="options">The proxy generation options.</param> - <returns>The generated proxy type.</returns> - <remarks> - Implementers should return a proxy type for the specified interface and additional interfaces that delegate all executions to the specified interceptors. - </remarks> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is not public. - Note that to avoid this exception, you can mark offending type internal, and define <see cref="T:System.Runtime.CompilerServices.InternalsVisibleToAttribute"/> - pointing to Castle Dynamic Proxy assembly, in assembly containing that type, if this is appropriate.</exception> - <seealso cref="T:Castle.DynamicProxy.Generators.InterfaceProxyWithoutTargetGenerator"/> - </member> - <member name="M:Castle.DynamicProxy.IProxyBuilder.CreateInterfaceProxyTypeWithTargetInterface(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates a proxy type for given <paramref name="interfaceToProxy"/> and <parmaref name="additionalInterfacesToProxy"/> that delegates all calls to the provided interceptors and allows interceptors to switch the actual target of invocation. - </summary> - <param name="interfaceToProxy">The interface type to proxy.</param> - <param name="additionalInterfacesToProxy">Additional interface types to proxy.</param> - <param name="options">The proxy generation options.</param> - <returns>The generated proxy type.</returns> - <remarks> - Implementers should return a proxy type for the specified interface(s) that delegate all executions to the specified interceptors - and uses an instance of the interface as their targets (i.e. <see cref="P:Castle.Core.Interceptor.IInvocation.InvocationTarget"/>), rather than a class. All <see cref="T:Castle.Core.Interceptor.IInvocation"/> classes should then implement <see cref="T:Castle.Core.Interceptor.IChangeProxyTarget"/> interface, - to allow interceptors to switch invocation target with instance of another type implementing called interface. - </remarks> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:Castle.DynamicProxy.Generators.GeneratorException">Thrown when <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is not public. - Note that to avoid this exception, you can mark offending type internal, and define <see cref="T:System.Runtime.CompilerServices.InternalsVisibleToAttribute"/> - pointing to Castle Dynamic Proxy assembly, in assembly containing that type, if this is appropriate.</exception> - <seealso cref="T:Castle.DynamicProxy.Generators.InterfaceProxyWithTargetInterfaceGenerator"/> - </member> - <member name="P:Castle.DynamicProxy.IProxyBuilder.ModuleScope"> - <summary> - Gets the <see cref="P:Castle.DynamicProxy.IProxyBuilder.ModuleScope"/> associated with this builder. - </summary> - <value>The module scope associated with this builder.</value> - </member> - <member name="M:Castle.DynamicProxy.DefaultProxyBuilder.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.DefaultProxyBuilder"/> class with new <see cref="T:Castle.DynamicProxy.ModuleScope"/>. - </summary> - </member> - <member name="M:Castle.DynamicProxy.DefaultProxyBuilder.#ctor(Castle.DynamicProxy.ModuleScope)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.DefaultProxyBuilder"/> class. - </summary> - <param name="scope">The module scope for generated proxy types.</param> - </member> - <member name="T:Castle.DynamicProxy.IInterceptorSelector"> - <summary> - Provides an extension point that allows proxies to choose specific interceptors on - a per method basis. - </summary> - </member> - <member name="M:Castle.DynamicProxy.IInterceptorSelector.SelectInterceptors(System.Type,System.Reflection.MethodInfo,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Selects the interceptors that should intercept calls to the given <paramref name="method"/>. - </summary> - <param name="type">The type declaring the method to intercept.</param> - <param name="method">The method that will be intercepted.</param> - <param name="interceptors">All interceptors registered with the proxy.</param> - <returns>An array of interceptors to invoke upon calling the <paramref name="method"/>.</returns> - <remarks> - This method is called only once per proxy instance, upon the first call to the - <paramref name="method"/>. Either an empty array or null are valid return values to indicate - that no interceptor should intercept calls to the method. Although it is not advised, it is - legal to return other <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations than these provided in - <paramref name="interceptors"/>. A better way to do this, is by passing all the required - interceptors to the appropriate method of <see cref="T:Castle.DynamicProxy.ProxyGenerator"/>. You can use this - method to influence the order in which interceptors will be called, by reordering the array. - Returning an array containing null references (Nothing in Visual Basic) is not legal, - and will result in a runtime exception. - </remarks> - <seealso cref="T:Castle.DynamicProxy.ProxyGenerationOptions"/> - </member> - <member name="M:Castle.DynamicProxy.InternalsHelper.IsInternalToDynamicProxy(System.Reflection.Assembly)"> - <summary> - Determines whether this assembly has internals visible to dynamic proxy. - </summary> - <param name="asm">The assembly to inspect.</param> - </member> - <member name="M:Castle.DynamicProxy.InternalsHelper.IsInternal(System.Reflection.MethodInfo)"> - <summary> - Determines whether the specified method is internal. - </summary> - <param name="method">The method.</param> - <returns> - <c>true</c> if the specified method is internal; otherwise, <c>false</c>. - </returns> - </member> - <member name="M:Castle.DynamicProxy.MixinData.#ctor(System.Collections.Generic.IEnumerable{System.Object})"> - <summary> - Because we need to cache the types based on the mixed in mixins, we do the following here: - - Get all the mixin interfaces - - Sort them by full name - - Return them by position - - The idea is to have reproducable behavior for the case that mixins are registered in different orders. - This method is here because it is required - </summary> - </member> - <member name="T:Castle.DynamicProxy.ModuleScope"> - <summary> - Summary description for ModuleScope. - </summary> - </member> - <member name="F:Castle.DynamicProxy.ModuleScope.DEFAULT_FILE_NAME"> - <summary> - The default file name used when the assembly is saved using <see cref="F:Castle.DynamicProxy.ModuleScope.DEFAULT_FILE_NAME"/>. - </summary> - </member> - <member name="F:Castle.DynamicProxy.ModuleScope.DEFAULT_ASSEMBLY_NAME"> - <summary> - The default assembly (simple) name used for the assemblies generated by a <see cref="T:Castle.DynamicProxy.ModuleScope"/> instance. - </summary> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ModuleScope"/> class; assemblies created by this instance will not be saved. - </summary> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.#ctor(System.Boolean)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ModuleScope"/> class, allowing to specify whether the assemblies generated by this instance - should be saved. - </summary> - <param name="savePhysicalAssembly">If set to <c>true</c> saves the generated module.</param> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.#ctor(System.Boolean,System.String,System.String,System.String,System.String)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ModuleScope"/> class, allowing to specify whether the assemblies generated by this instance - should be saved and what simple names are to be assigned to them. - </summary> - <param name="savePhysicalAssembly">If set to <c>true</c> saves the generated module.</param> - <param name="strongAssemblyName">The simple name of the strong-named assembly generated by this <see cref="T:Castle.DynamicProxy.ModuleScope"/>.</param> - <param name="strongModulePath">The path and file name of the manifest module of the strong-named assembly generated by this <see cref="T:Castle.DynamicProxy.ModuleScope"/>.</param> - <param name="weakAssemblyName">The simple name of the weak-named assembly generated by this <see cref="T:Castle.DynamicProxy.ModuleScope"/>.</param> - <param name="weakModulePath">The path and file name of the manifest module of the weak-named assembly generated by this <see cref="T:Castle.DynamicProxy.ModuleScope"/>.</param> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.GetFromCache(Castle.DynamicProxy.Generators.CacheKey)"> - <summary> - Returns a type from this scope's type cache, or null if the key cannot be found. - </summary> - <param name="key">The key to be looked up in the cache.</param> - <returns>The type from this scope's type cache matching the key, or null if the key cannot be found</returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.RegisterInCache(Castle.DynamicProxy.Generators.CacheKey,System.Type)"> - <summary> - Registers a type in this scope's type cache. - </summary> - <param name="key">The key to be associated with the type.</param> - <param name="type">The type to be stored in the cache.</param> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.GetKeyPair"> - <summary> - Gets the key pair used to sign the strong-named assembly generated by this <see cref="T:Castle.DynamicProxy.ModuleScope"/>. - </summary> - <returns></returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.ObtainDynamicModule(System.Boolean)"> - <summary> - Gets the specified module generated by this scope, creating a new one if none has yet been generated. - </summary> - <param name="isStrongNamed">If set to true, a strong-named module is returned; otherwise, a weak-named module is returned.</param> - <returns>A strong-named or weak-named module generated by this scope, as specified by the <paramref name="isStrongNamed"/> parameter.</returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithStrongName"> - <summary> - Gets the strong-named module generated by this scope, creating a new one if none has yet been generated. - </summary> - <returns>A strong-named module generated by this scope.</returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithWeakName"> - <summary> - Gets the weak-named module generated by this scope, creating a new one if none has yet been generated. - </summary> - <returns>A weak-named module generated by this scope.</returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.SaveAssembly"> - <summary> - Saves the generated assembly with the name and directory information given when this <see cref="T:Castle.DynamicProxy.ModuleScope"/> instance was created (or with - the <see cref="F:Castle.DynamicProxy.ModuleScope.DEFAULT_FILE_NAME"/> and current directory if none was given). - </summary> - <remarks> - <para> - This method stores the generated assembly in the directory passed as part of the module information specified when this instance was - constructed (if any, else the current directory is used). If both a strong-named and a weak-named assembly - have been generated, it will throw an exception; in this case, use the <see cref="M:Castle.DynamicProxy.ModuleScope.SaveAssembly(System.Boolean)"/> overload. - </para> - <para> - If this <see cref="T:Castle.DynamicProxy.ModuleScope"/> was created without indicating that the assembly should be saved, this method does nothing. - </para></remarks> - <exception cref="T:System.InvalidOperationException">Both a strong-named and a weak-named assembly have been generated.</exception> - <returns>The path of the generated assembly file, or null if no file has been generated.</returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.SaveAssembly(System.Boolean)"> - <summary> - Saves the specified generated assembly with the name and directory information given when this <see cref="T:Castle.DynamicProxy.ModuleScope"/> instance was created - (or with the <see cref="F:Castle.DynamicProxy.ModuleScope.DEFAULT_FILE_NAME"/> and current directory if none was given). - </summary> - <param name="strongNamed">True if the generated assembly with a strong name should be saved (see <see cref="P:Castle.DynamicProxy.ModuleScope.StrongNamedModule"/>); - false if the generated assembly without a strong name should be saved (see <see cref="P:Castle.DynamicProxy.ModuleScope.WeakNamedModule"/>.</param> - <remarks> - <para> - This method stores the specified generated assembly in the directory passed as part of the module information specified when this instance was - constructed (if any, else the current directory is used). - </para> - <para> - If this <see cref="T:Castle.DynamicProxy.ModuleScope"/> was created without indicating that the assembly should be saved, this method does nothing. - </para> - </remarks> - <exception cref="T:System.InvalidOperationException">No assembly has been generated that matches the <paramref name="strongNamed"/> parameter. - </exception> - <returns>The path of the generated assembly file, or null if no file has been generated.</returns> - </member> - <member name="M:Castle.DynamicProxy.ModuleScope.LoadAssemblyIntoCache(System.Reflection.Assembly)"> - <summary> - Loads the generated types from the given assembly into this <see cref="T:Castle.DynamicProxy.ModuleScope"/>'s cache. - </summary> - <param name="assembly">The assembly to load types from. This assembly must have been saved via <see cref="M:Castle.DynamicProxy.ModuleScope.SaveAssembly(System.Boolean)"/> or - <see cref="M:Castle.DynamicProxy.ModuleScope.SaveAssembly"/>, or it must have the <see cref="T:Castle.DynamicProxy.CacheMappingsAttribute"/> manually applied.</param> - <remarks> - This method can be used to load previously generated and persisted proxy types from disk into this scope's type cache, eg. in order - to avoid the performance hit associated with proxy generation. - </remarks> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.RWLock"> - <summary> - Users of this <see cref="T:Castle.DynamicProxy.ModuleScope"/> should use this lock when accessing the cache. - </summary> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.StrongNamedModule"> - <summary> - Gets the strong-named module generated by this scope, or <see langword="null"/> if none has yet been generated. - </summary> - <value>The strong-named module generated by this scope, or <see langword="null"/> if none has yet been generated.</value> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.StrongNamedModuleName"> - <summary> - Gets the file name of the strongly named module generated by this scope. - </summary> - <value>The file name of the strongly named module generated by this scope.</value> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.StrongNamedModuleDirectory"> - <summary> - Gets the directory where the strongly named module generated by this scope will be saved, or <see langword="null"/> if the current directory - is used. - </summary> - <value>The directory where the strongly named module generated by this scope will be saved when <see cref="M:Castle.DynamicProxy.ModuleScope.SaveAssembly"/> is called - (if this scope was created to save modules).</value> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.WeakNamedModule"> - <summary> - Gets the weak-named module generated by this scope, or <see langword="null"/> if none has yet been generated. - </summary> - <value>The weak-named module generated by this scope, or <see langword="null"/> if none has yet been generated.</value> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.WeakNamedModuleName"> - <summary> - Gets the file name of the weakly named module generated by this scope. - </summary> - <value>The file name of the weakly named module generated by this scope.</value> - </member> - <member name="P:Castle.DynamicProxy.ModuleScope.WeakNamedModuleDirectory"> - <summary> - Gets the directory where the weakly named module generated by this scope will be saved, or <see langword="null"/> if the current directory - is used. - </summary> - <value>The directory where the weakly named module generated by this scope will be saved when <see cref="M:Castle.DynamicProxy.ModuleScope.SaveAssembly"/> is called - (if this scope was created to save modules).</value> - </member> - <member name="T:Castle.DynamicProxy.PersistentProxyBuilder"> - <summary> - ProxyBuilder that persists the generated type. - </summary> - <remarks> - The saved assembly contains just the last generated type. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.PersistentProxyBuilder.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.PersistentProxyBuilder"/> class. - </summary> - </member> - <member name="M:Castle.DynamicProxy.PersistentProxyBuilder.SaveAssembly"> - <summary> - Saves the generated assembly to a physical file. Note that this renders the <see cref="T:Castle.DynamicProxy.PersistentProxyBuilder"/> unusable. - </summary> - <returns>The path of the generated assembly file, or null if no assembly has been generated.</returns> - <remarks>This method does not support saving multiple files. If both a signed and an unsigned module have been generated, use the - respective methods of the <see cref="T:Castle.DynamicProxy.ModuleScope"/>.</remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerationOptions.#ctor(Castle.DynamicProxy.IProxyGenerationHook)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ProxyGenerationOptions"/> class. - </summary> - <param name="hook">The hook.</param> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerationOptions.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ProxyGenerationOptions"/> class. - </summary> - </member> - <member name="T:Castle.DynamicProxy.ProxyGenerator"> - <summary> - Provides proxy objects for classes and interfaces. - </summary> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.#ctor(Castle.DynamicProxy.IProxyBuilder)"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ProxyGenerator"/> class. - </summary> - <param name="builder">Proxy types builder.</param> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.#ctor"> - <summary> - Initializes a new instance of the <see cref="T:Castle.DynamicProxy.ProxyGenerator"/> class. - </summary> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget``1(``0,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <typeparamref name="TInterface"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - </summary> - <typeparam name="TInterface">Type of the interface implemented by <paramref name="target"/> which will be proxied.</typeparam> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns>Object proxying calls to members of <typeparamref name="TInterface"/> on <paramref name="target"/> object.</returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <typeparamref name="TInterface"/>is not an interface type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget``1(System.Object,Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <typeparamref name="TInterface"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - </summary> - <typeparam name="TInterface">Type of the interface implemented by <paramref name="target"/> which will be proxied.</typeparam> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <typeparamref name="TInterface"/> on <paramref name="target"/> object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <typeparamref name="TInterface"/>is not an interface type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(System.Type,System.Object,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> type on <paramref name="target"/> object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(System.Type,System.Object,Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> type on <paramref name="target"/> object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(System.Type,System.Type[],System.Object,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types on <paramref name="target"/> object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(System.Type,System.Type[],System.Object,Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types on <paramref name="target"/> object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTargetInterface(System.Type,System.Object,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - Interceptors can use <see cref="T:Castle.Core.Interceptor.IChangeProxyTarget"/> interface to provide other target for method invocation than default <paramref name="target"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> type on <paramref name="target"/> object or alternative implementation swapped at runtime by an interceptor. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTargetInterface(System.Type,System.Object,Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - Interceptors can use <see cref="T:Castle.Core.Interceptor.IChangeProxyTarget"/> interface to provide other target for method invocation than default <paramref name="target"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> type on <paramref name="target"/> object or alternative implementation swapped at runtime by an interceptor. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTargetInterface(System.Type,System.Type[],System.Object,Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on <paramref name="target"/> object with given <paramref name="interceptors"/>. - Interceptors can use <see cref="T:Castle.Core.Interceptor.IChangeProxyTarget"/> interface to provide other target for method invocation than default <paramref name="target"/>. - </summary> - <param name="interfaceToProxy">Type of the interface implemented by <paramref name="target"/> which will be proxied.</param> - <param name="target">The target object, calls to which will be intercepted.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types on <paramref name="target"/> object or alternative implementation swapped at runtime by an interceptor. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="target"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="target"/> does not implement <paramref name="interfaceToProxy"/> interface.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on actual type of <paramref name="target"/> object.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of actual type of <paramref name="target"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget``1(Castle.Core.Interceptor.IInterceptor)"> - <summary> - Creates proxy object intercepting calls to members of interface <typeparamref name="TInterface"/> on target object generated at runtime with given <paramref name="interceptor"/>. - </summary> - <typeparam name="TInterface">Type of the interface which will be proxied.</typeparam> - <param name="interceptor">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <typeparamref name="TInterface"/> types on generated target object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptor"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <typeparamref name="TInterface"/> is not an interface type.</exception> - <remarks> - Since this method uses an empty-shell implementation of interfaces to proxy generated at runtime, the actual implementation of proxied methods must be provided by given <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations. - They are responsible for setting return value (and out parameters) on proxied methods. It is also illegal for an interceptor to call <see cref="M:Castle.Core.Interceptor.IInvocation.Proceed"/>, since there's no actual implementation to proceed with. - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget``1(Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <typeparamref name="TInterface"/> on target object generated at runtime with given <paramref name="interceptors"/>. - </summary> - <typeparam name="TInterface">Type of the interface which will be proxied.</typeparam> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <typeparamref name="TInterface"/> types on generated target object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <typeparamref name="TInterface"/> is not an interface type.</exception> - <remarks> - Since this method uses an empty-shell implementation of interfaces to proxy generated at runtime, the actual implementation of proxied methods must be provided by given <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations. - They are responsible for setting return value (and out parameters) on proxied methods. It is also illegal for an interceptor to call <see cref="M:Castle.Core.Interceptor.IInvocation.Proceed"/>, since there's no actual implementation to proceed with. - As a result of that also at least one <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementation must be provided. - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(System.Type,Castle.Core.Interceptor.IInterceptor)"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on target object generated at runtime with given <paramref name="interceptor"/>. - </summary> - <param name="interfaceToProxy">Type of the interface which will be proxied.</param> - <param name="interceptor">The interceptor called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> type on generated target object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptor"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <remarks> - Since this method uses an empty-shell implementation of interfaces to proxy generated at runtime, the actual implementation of proxied methods must be provided by given <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations. - They are responsible for setting return value (and out parameters) on proxied methods. It is also illegal for an interceptor to call <see cref="M:Castle.Core.Interceptor.IInvocation.Proceed"/>, since there's no actual implementation to proceed with. - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(System.Type,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on target object generated at runtime with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface which will be proxied.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> type on generated target object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <remarks> - Since this method uses an empty-shell implementation of interfaces to proxy generated at runtime, the actual implementation of proxied methods must be provided by given <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations. - They are responsible for setting return value (and out parameters) on proxied methods. It is also illegal for an interceptor to call <see cref="M:Castle.Core.Interceptor.IInvocation.Proceed"/>, since there's no actual implementation to proceed with. - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(System.Type,System.Type[],Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on target object generated at runtime with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface which will be proxied.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types on generated target object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <remarks> - Since this method uses an empty-shell implementation of interfaces to proxy generated at runtime, the actual implementation of proxied methods must be provided by given <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations. - They are responsible for setting return value (and out parameters) on proxied methods. It is also illegal for an interceptor to call <see cref="M:Castle.Core.Interceptor.IInvocation.Proceed"/>, since there's no actual implementation to proceed with. - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to members of interface <paramref name="interfaceToProxy"/> on target object generated at runtime with given <paramref name="interceptors"/>. - </summary> - <param name="interfaceToProxy">Type of the interface which will be proxied.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - Object proxying calls to members of <paramref name="interfaceToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types on generated target object. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interfaceToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="interceptors"/> array is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="interfaceToProxy"/> is not an interface type.</exception> - <remarks> - Since this method uses an empty-shell implementation of <paramref name="additionalInterfacesToProxy"/> to proxy generated at runtime, the actual implementation of proxied methods must be provided by given <see cref="T:Castle.Core.Interceptor.IInterceptor"/> implementations. - They are responsible for setting return value (and out parameters) on proxied methods. It is also illegal for an interceptor to call <see cref="M:Castle.Core.Interceptor.IInvocation.Proceed"/>, since there's no actual implementation to proceed with. - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy``1(Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <typeparamref name="TClass"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <typeparam name="TClass">Type of class which will be proxied.</typeparam> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <typeparamref name="TClass"/> proxying calls to virtual members of <typeparamref name="TClass"/> type. - </returns> - <exception cref="T:System.ArgumentException">Thrown when given <typeparamref name="TClass"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on type <typeparamref name="TClass"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of type <typeparamref name="TClass"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <paramref name="classToProxy"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <param name="classToProxy">Type of class which will be proxied.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <paramref name="classToProxy"/> proxying calls to virtual members of <paramref name="classToProxy"/> type. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="classToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on type <paramref name="classToProxy"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of type <paramref name="classToProxy"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type,System.Type[],Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <paramref name="classToProxy"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <param name="classToProxy">Type of class which will be proxied.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <paramref name="classToProxy"/> proxying calls to virtual members of <paramref name="classToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="classToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on type <paramref name="classToProxy"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of type <paramref name="classToProxy"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type,Castle.Core.Interceptor.IInterceptor[],System.Object[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <paramref name="classToProxy"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <param name="classToProxy">Type of class which will be proxied.</param> - <param name="constructorArguments">Arguments of constructor of type <paramref name="classToProxy"/> which should be used to create a new instance of that type.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <paramref name="classToProxy"/> proxying calls to virtual members of <paramref name="classToProxy"/> type. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="classToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no constructor exists on type <paramref name="classToProxy"/> with parameters matching <paramref name="constructorArguments"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when constructor of type <paramref name="classToProxy"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type,Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <paramref name="classToProxy"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <param name="classToProxy">Type of class which will be proxied.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <paramref name="classToProxy"/> proxying calls to virtual members of <paramref name="classToProxy"/> type. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="classToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="options"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on type <paramref name="classToProxy"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of type <paramref name="classToProxy"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions,Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <paramref name="classToProxy"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <param name="classToProxy">Type of class which will be proxied.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <paramref name="classToProxy"/> proxying calls to virtual members of <paramref name="classToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="classToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="options"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no default constructor exists on type <paramref name="classToProxy"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when default constructor of type <paramref name="classToProxy"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions,System.Object[],Castle.Core.Interceptor.IInterceptor[])"> - <summary> - Creates proxy object intercepting calls to virtual members of type <paramref name="classToProxy"/> on newly created instance of that type with given <paramref name="interceptors"/>. - </summary> - <param name="classToProxy">Type of class which will be proxied.</param> - <param name="additionalInterfacesToProxy">Additional interface types. Calls to their members will be proxied as well.</param> - <param name="options">The proxy generation options used to influence generated proxy type and object.</param> - <param name="constructorArguments">Arguments of constructor of type <paramref name="classToProxy"/> which should be used to create a new instance of that type.</param> - <param name="interceptors">The interceptors called during the invocation of proxied methods.</param> - <returns> - New object of type <paramref name="classToProxy"/> proxying calls to virtual members of <paramref name="classToProxy"/> and <paramref name="additionalInterfacesToProxy"/> types. - </returns> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="classToProxy"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentNullException">Thrown when given <paramref name="options"/> object is a null reference (Nothing in Visual Basic).</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> or any of <paramref name="additionalInterfacesToProxy"/> is a generic type definition.</exception> - <exception cref="T:System.ArgumentException">Thrown when given <paramref name="classToProxy"/> is not a class type.</exception> - <exception cref="T:System.MissingMethodException">Thrown when no constructor exists on type <paramref name="classToProxy"/> with parameters matching <paramref name="constructorArguments"/>.</exception> - <exception cref="T:System.Reflection.TargetInvocationException">Thrown when constructor of type <paramref name="classToProxy"/> throws an exception.</exception> - <remarks> - This method uses <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation to generate a proxy type. - As such caller should expect any type of exception that given <see cref="T:Castle.DynamicProxy.IProxyBuilder"/> implementation may throw. - </remarks> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateClassProxyType(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates the proxy type for class proxy with given <paramref name="classToProxy"/> class, implementing given <paramref name="additionalInterfacesToProxy"/> and using provided <paramref name="options"/>. - </summary> - <param name="classToProxy">The base class for proxy type.</param> - <param name="additionalInterfacesToProxy">The interfaces that proxy type should implement.</param> - <param name="options">The options for proxy generation process.</param> - <returns><see cref="T:System.Type"/> of proxy.</returns> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithTarget(System.Type,System.Type[],System.Type,Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates the proxy type for interface proxy with target for given <paramref name="interfaceToProxy"/> interface, implementing given <paramref name="additionalInterfacesToProxy"/> on given <paramref name="targetType"/> and using provided <paramref name="options"/>. - </summary> - <param name="interfaceToProxy">The interface proxy type should implement.</param> - <param name="additionalInterfacesToProxy">The additional interfaces proxy type should implement.</param> - <param name="targetType">Actual type that the proxy type will encompass.</param> - <param name="options">The options for proxy generation process.</param> - <returns><see cref="T:System.Type"/> of proxy.</returns> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithTargetInterface(System.Type,System.Type[],System.Type,Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates the proxy type for interface proxy with target interface for given <paramref name="interfaceToProxy"/> interface, implementing given <paramref name="additionalInterfacesToProxy"/> on given <paramref name="targetType"/> and using provided <paramref name="options"/>. - </summary> - <param name="interfaceToProxy">The interface proxy type should implement.</param> - <param name="additionalInterfacesToProxy">The additional interfaces proxy type should implement.</param> - <param name="targetType">Actual type that the proxy type will encompass.</param> - <param name="options">The options for proxy generation process.</param> - <returns><see cref="T:System.Type"/> of proxy.</returns> - </member> - <member name="M:Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget(System.Type,System.Type[],Castle.DynamicProxy.ProxyGenerationOptions)"> - <summary> - Creates the proxy type for interface proxy without target for given <paramref name="interfaceToProxy"/> interface, implementing given <paramref name="additionalInterfacesToProxy"/> and using provided <paramref name="options"/>. - </summary> - <param name="interfaceToProxy">The interface proxy type should implement.</param> - <param name="additionalInterfacesToProxy">The additional interfaces proxy type should implement.</param> - <param name="options">The options for proxy generation process.</param> - <returns><see cref="T:System.Type"/> of proxy.</returns> - </member> - <member name="P:Castle.DynamicProxy.ProxyGenerator.ProxyBuilder"> - <summary> - Gets the proxy builder instance used to generate proxy types. - </summary> - <value>The proxy builder.</value> - </member> - <member name="M:Castle.DynamicProxy.RemotableInvocation.Proceed"> - <summary> - - </summary> - <returns></returns> - </member> - <member name="P:Castle.DynamicProxy.RemotableInvocation.Method"> - <summary> - - </summary> - </member> - <member name="P:Castle.DynamicProxy.RemotableInvocation.MethodInvocationTarget"> - <summary> - For interface proxies, this will point to the - <see cref="T:System.Reflection.MethodInfo"/> on the target class - </summary> - </member> - </members> -</doc>
chrido/NAdvisor
eb35a4318b9beee9d01e368691735bf7c8dcc111
remove contrib.cache, unit tests working
diff --git a/Example/FreeAdvice.MSTest/AdviceServiceTest.cs b/Example/FreeAdvice.MSTest/AdviceServiceTest.cs index 0d4a8b3..ec2f65a 100644 --- a/Example/FreeAdvice.MSTest/AdviceServiceTest.cs +++ b/Example/FreeAdvice.MSTest/AdviceServiceTest.cs @@ -1,78 +1,78 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using FreeAdvice.Aspects; using FreeAdvice.Common; using FreeAdvice.Domain; using FreeAdvice.Repositories.Interfaces; using FreeAdvice.Service.Interfaces; using FreeAdvice.Services; using Moq; -using NAdvisor.Core; using NAdvisor.Contrib; +using NAdvisor.Core; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace FreeAdvice.MSTest { [TestClass] public class AdviceServiceTest { [TestMethod] public void Should_Validate_Advice_Dto() { //Given var advice = new AdviceDto(); var service = new AdviceService(null, null, null); //Then MSTestHelper.ShouldThrowException<ValidationException>(() => service.UpdateAdvice(advice)); } /// <summary> /// Note: May not be the typical goog unit Test but shows how much you can abuse it /// </summary> [TestMethod] public void Should_Update_Repository_And_Commit_To_External_Dms_When_Validated() { //Constants var documentFolder = Guid.NewGuid(); //Given var advice = new AdviceDto() {AdviceText = "adsfasdfasdf", Id = default(Guid), RandomNumber = 3}; var mockFactory = new MockFactory(MockBehavior.Strict); //Service Dependencies var adviceRepository = mockFactory.Create<IAdviceRepository>(); var configuration = mockFactory.Create<IConfiguration>(); var aspects = new List<IAspect>(); var transactionContext = mockFactory.Create<ITransactionContext>(); var dms = mockFactory.Create<IDms>(); //Aspect Configuration aspects.Add(new DatabaseContext(transactionContext.Object)); aspects.Add(new ExternalDmsContext(dms.Object)); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, aspects); var service = advisor.GetAdvicedProxy<IAdviceService>(new AdviceService(adviceRepository.Object, dms.Object, configuration.Object)); //setup Mocks transactionContext.Setup(tc => tc.Push()).AtMost(1); configuration.Setup(co => co.GetDefaultDocumentFolder).Returns(documentFolder).AtMostOnce(); dms.Setup(dm => dm.AddDocumentToFolder(It.IsAny<Guid>(), It.IsAny<byte[]>(), It.IsAny<string>())).AtMostOnce(); adviceRepository.Setup(ar => ar.UpdateAdvice(advice)).AtMostOnce(); dms.Setup(dm => dm.Commit()).AtMostOnce(); transactionContext.Setup(tc => tc.Commit()); //Then service.UpdateAdvice(advice); //When mockFactory.VerifyAll(); } } } diff --git a/NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs b/NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs index f0978c6..bab7c75 100644 --- a/NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs +++ b/NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs @@ -1,181 +1,181 @@ using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using NAdvisor.Core; namespace NAdvisor.Contrib.Test { [TestClass] public class AttributeBasedJointPointDefinitionTests { [TestMethod] public void Should_Intercept_Only_Attributed_Methods() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var aspect = new SimpleAspect(); aspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {aspect, shouldNotBeCalledAspect.Object}); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then - var result = myService.Dosomething("hallo"); + var result = myService.DoSomething("hallo"); //When Assert.AreEqual(aspectLog[0], "aspectCalled"); Assert.AreEqual(aspectLog[1], "hallo"); Assert.AreEqual(aspectLog[2], "DoneSomething"); Assert.AreEqual(result, "executed"); Assert.AreEqual(serviceLog[0], "hallo"); shouldNotBeCalledAspect.VerifyAll(); } [TestMethod] public void Should_Order_Aspects_From_Left_To_Right() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var firstAspect = new FirstAspect(); firstAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var secondAspect = new SecondAspect(); secondAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() { shouldNotBeCalledAspect.Object, secondAspect, shouldNotBeCalledAspect.Object, firstAspect }); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.DoMore("muchmore"); shouldNotBeCalledAspect.VerifyAll(); Assert.AreEqual(aspectLog.Count, 4); Assert.AreEqual("FirstAspectBefore", aspectLog[0]); Assert.AreEqual("SecondAspectBefore", aspectLog[1]); Assert.AreEqual("SecondAspectAfter", aspectLog[2]); Assert.AreEqual("FirstAspectAfter", aspectLog[3]); } } public class SimpleAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("aspectCalled"); if (args.Length > 0) { if (args[0] is string) { RaiseDoneSomething((string)args[0]); } } object result = proceedInvocation(args); if (result is string) RaiseDoneSomething((string)result); return "executed"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class FirstAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("FirstAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("FirstAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class SecondAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("SecondAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("SecondAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public interface ISimpleService { - string Dosomething(string arguments); + string DoSomething(string arguments); string DoMore(string more); } public class SimpleService : ISimpleService { public EventHandler<SimpleEventArgs> DoneSomething; [InterceptedBy(typeof(SimpleAspect))] - public string Dosomething(string arguments) + public string DoSomething(string arguments) { RaiseDoneSomething(arguments); return "DoneSomething"; } [InterceptedBy(typeof(FirstAspect), typeof(SecondAspect))] public string DoMore(string more) { RaiseDoneSomething(more); return "more"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } } \ No newline at end of file diff --git a/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs b/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs deleted file mode 100644 index c0d3d86..0000000 --- a/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NAdvisor.Contrib.Caching; - -namespace NAdvisor.Contrib.Test -{ - [TestClass] - public class CacheConfigurationValidationTest - { - [TestMethod] - [ExpectedException(typeof(ArgumentException))] - public void caching_behavoior_cant_be_defined_twice() - { - var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); - cc - .CreateCachingKey( - cck => cck.AwfulLongCacheAbleComputation( - cc.CreateKey<int>().From<string>(value => value.GetHashCode() - ) - ) - ) - .CreateCachingKey( - cck => cck.AwfulLongCacheAbleComputation( - cc.CreateKey<int>().From<string>(value => value.GetHashCode() - ) - ) - ); - } - } -} diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs deleted file mode 100644 index 6c11ccb..0000000 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NAdvisor.Contrib.Caching; -using NAdvisor.Core; - -namespace NAdvisor.Contrib.Test -{ - /// <summary> - /// Summary description for CachingAspectTest - /// </summary> - [TestClass] - public class CachingAspectTest - { - [TestMethod] - public void TestMethod1() - { - var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); - cc - .CreateCachingKey( - cck => cck.AwfulLongCacheAbleComputation( - cc.CreateKey<int>().From<string>(value => value.GetHashCode() - ) - ) - ); - - var cachingAspect = new CachingAspect(); - var cachedClass = new MethodInvokesShouldBeCachedClass(); - - var advisor = new Advisor(cachingAspect); - var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); - - int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); - } - - [TestMethod] - public void Should_Create_Test_config_for_testing_a_few_methodcalls() - { - var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); - cc - .CreateCachingKey( - cck => cck.AwfulLongCacheAbleComputation( - cc.CreateKey<int>().From<string>(value => value.GetHashCode() - ) - ) - ); - - cc.BuildCachingConfiguration(); - } - } -} - - - diff --git a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index a1605ab..65d7a1f 100644 --- a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,74 +1,72 @@ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AttributeBasedJointPointDefinitionTests.cs" /> - <Compile Include="CacheConfigurationValidationTest.cs" /> <Compile Include="SampleMemozizationTests.cs" /> <Compile Include="IMethodInvokesShouldBeCachedClass.cs" /> <Compile Include="MethodInvokesShouldBeCachedClass.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="CachingAspectTest.cs" /> <Compile Include="SimpleEventArgs.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingAspect.cs b/NAdvisor.Contrib/Caching/CachingAspect.cs deleted file mode 100644 index e7a4316..0000000 --- a/NAdvisor.Contrib/Caching/CachingAspect.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using NAdvisor.Core; - -namespace NAdvisor.Contrib.Caching -{ - public class CachingAspect : IAspect - { - private string cachingKey = string.Empty; - - public object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method) - { - return proceedInvocation(methodArguments); - } - } -} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingConfig.cs b/NAdvisor.Contrib/Caching/CachingConfig.cs deleted file mode 100644 index 36fe0cb..0000000 --- a/NAdvisor.Contrib/Caching/CachingConfig.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; - -namespace NAdvisor.Contrib.Caching -{ - public partial class CachingConfig<TCachedInterface> - { - private readonly Dictionary<MethodInfo, List<KeyDetermination>> _cachingConfigsForFunction; - private int _createKeyCounter; - private int _maxArgumentsCounter; - - public CachingConfig() - { - _cachingConfigsForFunction = new Dictionary<MethodInfo, List<KeyDetermination>>(); - _createKeyCounter = 0; - _maxArgumentsCounter = 0; - } - - - public CachingKeyCreator<TCachingKey> CreateKey<TCachingKey>() - { - - - return new CachingKeyCreator<TCachingKey>(); - } - - public CachingConfig<TCachedInterface> CreateCachingKey(Expression<Action<TCachedInterface>> methodExpression) - { - _createKeyCounter = 0; - _maxArgumentsCounter = 0; - var expression = methodExpression as LambdaExpression; - - var methodCall = expression.Body as MethodCallExpression; - if (methodCall == null) - throw new ArgumentException("needs a Methodcall on Interface as parameter"); - - if(_cachingConfigsForFunction.ContainsKey(methodCall.Method)) - throw new ArgumentException("Caching behaviour of a Method can't be defined twice"); - - int argumentCount = methodCall.Arguments.Count; - _cachingConfigsForFunction.Add(methodCall.Method, CreateCacheConfigs(methodCall, methodExpression)); - - return this; - } - - private List<KeyDetermination> CreateCacheConfigs(MethodCallExpression expression, Expression<Action<TCachedInterface>> methodExpression) - { - var keyDeterminationList = new List<KeyDetermination>(); - - foreach (Expression argument in expression.Arguments) - { - keyDeterminationList.Add(new KeyDetermination(){InputType = argument.Type, MethodExpression = methodExpression}); - } - - return keyDeterminationList; - } - } -} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs b/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs deleted file mode 100644 index d3feb7b..0000000 --- a/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using Castle.DynamicProxy; - -namespace NAdvisor.Contrib.Caching -{ - public partial class CachingConfig<TCachedInterface> - { - public void BuildCachingConfiguration() - { - foreach (var cachingConfigForFunction in _cachingConfigsForFunction) - { - CheckConfig(cachingConfigForFunction.Key, cachingConfigForFunction.Value); - } - } - - private void CheckConfig(MethodInfo info, List<KeyDetermination> determinations) - { - CheckIfKeyDeterminationsEqualMethodInfo(info, determinations); - - foreach (var list in determinations) - { - Action<TCachedInterface> compile = list.MethodExpression.Compile(); - var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); - var proxy = (TCachedInterface) proxyGenerator.CreateInterfaceProxyWithoutTarget(typeof (TCachedInterface), new FluentProxy()); - - compile.Invoke(proxy); - - - -// compile.Invoke(); - } - } - - private void CheckIfKeyDeterminationsEqualMethodInfo(MethodInfo info, List<KeyDetermination> determinations) - { - var count = 0; - - foreach (ParameterInfo parameter in info.GetParameters()) - { - if (parameter.IsOut) - throw new Exception("No out parameters allowed"); - - if (parameter.ParameterType != determinations[count].InputType) - throw new Exception("Parameters in KeyDetermination do not match"); - - count++; - } - } - } -} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingKeyCreation.cs b/NAdvisor.Contrib/Caching/CachingKeyCreation.cs deleted file mode 100644 index d6afa69..0000000 --- a/NAdvisor.Contrib/Caching/CachingKeyCreation.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Linq.Expressions; - -namespace NAdvisor.Contrib.Caching -{ - public partial class CachingConfig<TCachedInterface> - { - public class CachingKeyCreator<TChachingKey> - { - public TFromClass From<TFromClass>(Expression<Func<TFromClass, TChachingKey>> functionToCreateKey) - { - //TODO add functions for caching - - return default(TFromClass); - } - } - - } -} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/FluentProxy.cs b/NAdvisor.Contrib/Caching/FluentProxy.cs deleted file mode 100644 index b3f6824..0000000 --- a/NAdvisor.Contrib/Caching/FluentProxy.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Castle.Core.Interceptor; - -namespace NAdvisor.Contrib.Caching -{ - internal class FluentProxy : IInterceptor - { - public void Intercept(IInvocation invocation) - { - Type returnType = invocation.Method.ReturnType; - } - } -} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/KeyDetermination.cs b/NAdvisor.Contrib/Caching/KeyDetermination.cs deleted file mode 100644 index f0d8bd1..0000000 --- a/NAdvisor.Contrib/Caching/KeyDetermination.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Linq.Expressions; - -namespace NAdvisor.Contrib.Caching -{ - public partial class CachingConfig<TCachedInterface> - { - public class KeyDetermination - { - public Type InputType { get; set; } - public Type KeyType { get; set; } - public object CalculationFunction { get; set; } - - public Expression<Action<TCachedInterface>> MethodExpression { get; set; } - } - } -} \ No newline at end of file diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index 1400339..c64bc4b 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,85 +1,79 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="Caching\CachingAspect.cs" /> - <Compile Include="Caching\CachingConfig.cs" /> - <Compile Include="Caching\CachingKeyCreation.cs" /> - <Compile Include="Caching\CachingConfigurationValidation.cs" /> - <Compile Include="Caching\FluentProxy.cs" /> <Compile Include="MemoizeJointPointDefinition.cs" /> <Compile Include="InterceptedBy\InterceptedByAttribute.cs" /> <Compile Include="InterceptedBy\JointPointDefinition.cs" /> - <Compile Include="Caching\KeyDetermination.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.sln b/NAdvisor.sln index 0f4cb7e..a87ccf1 100644 --- a/NAdvisor.sln +++ b/NAdvisor.sln @@ -1,128 +1,128 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Core", "NAdvisor\NAdvisor.Core.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest", "NAdvisorTest\NAdvisorTest.csproj", "{EEE750E7-0D26-4845-8AFA-9617752454A5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Test", "NAdvisor.Contrib.Test\NAdvisor.Contrib.Test.csproj", "{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CF09232-5830-459C-9115-28284BA0B6A4}" ProjectSection(SolutionItems) = preProject LocalTestRun.testrunconfig = LocalTestRun.testrunconfig NAdvisor.vsmdi = NAdvisor.vsmdi EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{CC6CCF2B-D048-4DC8-80E9-CBB3523C5181}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice", "Example\FreeAdvice\FreeAdvice.csproj", "{6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Aspects", "Example\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj", "{12BEF773-E33E-4E44-B82E-2C4D7954D773}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Common", "Example\FreeAdvice.Common\FreeAdvice.Common.csproj", "{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Configuration", "Example\FreeAdvice.Configuration\FreeAdvice.Configuration.csproj", "{FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.DIContainer", "Example\FreeAdvice.DIContainer\FreeAdvice.DIContainer.csproj", "{7F452EC5-E286-4230-99F1-25AA78A712BB}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Domain", "Example\FreeAdvice.Domain\FreeAdvice.Domain.csproj", "{BB90B793-65A7-4D10-9065-EC04583EAFDB}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Repositories", "Example\FreeAdvice.Repositories\FreeAdvice.Repositories.csproj", "{20AD9BC4-3B86-485B-9062-454D04A18F14}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Repositories.Interfaces", "Example\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj", "{EF37D586-9279-434D-B22D-92C2FC60710D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Services", "Example\FreeAdvice.Services\FreeAdvice.Services.csproj", "{48D92B96-65B9-4592-AB37-76CE40515AEE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Service.Interfaces", "Example\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj", "{B41065F5-02BC-436A-B21A-DB814C62FBDE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.MSTest", "Example\FreeAdvice.MSTest\FreeAdvice.MSTest.csproj", "{0B022C57-B497-43F9-A5F6-BAE8519F7458}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Test", "NAdvisor.Contrib.Test\NAdvisor.Contrib.Test.csproj", "{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = NAdvisor.vsmdi EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.Build.0 = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.ActiveCfg = Release|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.Build.0 = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.Build.0 = Release|Any CPU - {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU - {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.Build.0 = Release|Any CPU {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Debug|Any CPU.Build.0 = Debug|Any CPU {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Release|Any CPU.ActiveCfg = Release|Any CPU {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Release|Any CPU.Build.0 = Release|Any CPU {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Debug|Any CPU.Build.0 = Debug|Any CPU {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Release|Any CPU.ActiveCfg = Release|Any CPU {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Release|Any CPU.Build.0 = Release|Any CPU {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Debug|Any CPU.Build.0 = Debug|Any CPU {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Release|Any CPU.ActiveCfg = Release|Any CPU {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Release|Any CPU.Build.0 = Release|Any CPU {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Release|Any CPU.Build.0 = Release|Any CPU {7F452EC5-E286-4230-99F1-25AA78A712BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7F452EC5-E286-4230-99F1-25AA78A712BB}.Debug|Any CPU.Build.0 = Debug|Any CPU {7F452EC5-E286-4230-99F1-25AA78A712BB}.Release|Any CPU.ActiveCfg = Release|Any CPU {7F452EC5-E286-4230-99F1-25AA78A712BB}.Release|Any CPU.Build.0 = Release|Any CPU {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Release|Any CPU.Build.0 = Release|Any CPU {20AD9BC4-3B86-485B-9062-454D04A18F14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20AD9BC4-3B86-485B-9062-454D04A18F14}.Debug|Any CPU.Build.0 = Debug|Any CPU {20AD9BC4-3B86-485B-9062-454D04A18F14}.Release|Any CPU.ActiveCfg = Release|Any CPU {20AD9BC4-3B86-485B-9062-454D04A18F14}.Release|Any CPU.Build.0 = Release|Any CPU {EF37D586-9279-434D-B22D-92C2FC60710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EF37D586-9279-434D-B22D-92C2FC60710D}.Debug|Any CPU.Build.0 = Debug|Any CPU {EF37D586-9279-434D-B22D-92C2FC60710D}.Release|Any CPU.ActiveCfg = Release|Any CPU {EF37D586-9279-434D-B22D-92C2FC60710D}.Release|Any CPU.Build.0 = Release|Any CPU {48D92B96-65B9-4592-AB37-76CE40515AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48D92B96-65B9-4592-AB37-76CE40515AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {48D92B96-65B9-4592-AB37-76CE40515AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {48D92B96-65B9-4592-AB37-76CE40515AEE}.Release|Any CPU.Build.0 = Release|Any CPU {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Debug|Any CPU.Build.0 = Debug|Any CPU {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Release|Any CPU.ActiveCfg = Release|Any CPU {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Release|Any CPU.Build.0 = Release|Any CPU {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Debug|Any CPU.Build.0 = Debug|Any CPU {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Release|Any CPU.ActiveCfg = Release|Any CPU {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Release|Any CPU.Build.0 = Release|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.Build.0 = Release|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {12BEF773-E33E-4E44-B82E-2C4D7954D773} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {F889330D-DFBF-4805-8D5D-3EA3B593EDE2} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {7F452EC5-E286-4230-99F1-25AA78A712BB} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {BB90B793-65A7-4D10-9065-EC04583EAFDB} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {20AD9BC4-3B86-485B-9062-454D04A18F14} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {EF37D586-9279-434D-B22D-92C2FC60710D} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {48D92B96-65B9-4592-AB37-76CE40515AEE} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {B41065F5-02BC-436A-B21A-DB814C62FBDE} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} {0B022C57-B497-43F9-A5F6-BAE8519F7458} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} EndGlobalSection EndGlobal diff --git a/NAdvisor/AdviceInterceptor.cs b/NAdvisor/AdviceInterceptor.cs index 0135c6c..b72390f 100644 --- a/NAdvisor/AdviceInterceptor.cs +++ b/NAdvisor/AdviceInterceptor.cs @@ -1,95 +1,95 @@ using System; using System.Collections.Generic; using System.Linq; using Castle.Core.Interceptor; using System.Reflection; namespace NAdvisor.Core { internal class AdviceInterceptor : IInterceptor { private readonly Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspects; private readonly IKeyValueStore _keyValueStore; private readonly IList<IAspect> _availableAspects; private readonly object _concreteInstance; private readonly Type _interfaceType; //used for caching the aspectEnvironment private readonly Dictionary<MethodInfo, AspectEnvironment> _aspectEnvironmentDict; private readonly object _aspectEnvironmentSyncRott = new object(); public AdviceInterceptor(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IKeyValueStore store, IEnumerable<IAspect> availableAspects, object concreteInstance, Type interfaceType) { _availableAspects = new List<IAspect>(availableAspects); _getAspects = getAspects; _keyValueStore = store; _concreteInstance = concreteInstance; _interfaceType = interfaceType; _aspectEnvironmentDict = new Dictionary<MethodInfo, AspectEnvironment>(); } public void Intercept(IInvocation invocation) { IAspectEnvironment environment = CreateOrGetEnvironment(invocation); var aspectList = _getAspects.Invoke(environment, new List<IAspect>(_availableAspects)); invocation.ReturnValue = CreateNextLevel(invocation, aspectList, environment)(invocation.Arguments); } private AspectEnvironment CreateOrGetEnvironment(IInvocation invocation) { lock (_aspectEnvironmentSyncRott) { var calledMethod = invocation.Method; if (_aspectEnvironmentDict.ContainsKey(calledMethod)) return _aspectEnvironmentDict[calledMethod]; else { AspectEnvironment environment = CreateEnvironment(invocation); _aspectEnvironmentDict.Add(calledMethod, environment); return environment; } } } private AspectEnvironment CreateEnvironment(IInvocation invocation) { var environment = new AspectEnvironment(_keyValueStore); - environment.ConcreteMethodInfo = invocation.GetConcreteMethod(); + environment.ConcreteMethodInfo = invocation.MethodInvocationTarget; environment.ConcreteObject = _concreteInstance; environment.InterfaceMethodInfo = invocation.Method; environment.ConcretetType = _concreteInstance.GetType(); environment.InterfaceType = _interfaceType; return environment; } public Func<object[], object> CreateNextLevel(IInvocation invocation, IEnumerable<IAspect> restOfAspects, IAspectEnvironment method) { return args => { IAspect nextAspect = restOfAspects.FirstOrDefault(); if (nextAspect != null) { //Recursion return nextAspect.Execute( CreateNextLevel(invocation, restOfAspects.Skip(1), method), args, method ); } for (int i = 0; i < args.Length; i++) { invocation.SetArgumentValue(i, args[i]); } //Enter the body of the concrete Method invocation.Proceed(); return invocation.ReturnValue; }; } } } \ No newline at end of file
chrido/NAdvisor
1e2019ba3564553d336bf06e98b11c149a561467
changed licence to BSD
diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..82484b5 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,10 @@ +Copyright (c) 2009, Techtalk +Copyright (c) 2009, Christoph Doblander +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of the NAdvisor nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/NAdvisor/Implementation/AspectEnvironment.cs b/NAdvisor/Implementation/AspectEnvironment.cs index 462353d..97509dd 100644 --- a/NAdvisor/Implementation/AspectEnvironment.cs +++ b/NAdvisor/Implementation/AspectEnvironment.cs @@ -1,73 +1,59 @@ -// Copyright 2009 Christoph Doblander -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; +using System; using System.Reflection; using System.Collections.Generic; using NAdvisor.Core.Implementation; namespace NAdvisor.Core { internal class AspectEnvironment : IAspectEnvironment { private readonly object _syncRoot = new object(); private readonly IKeyValueStore _dictKVStore; public AspectEnvironment(IKeyValueStore keyValueStore) { _dictKVStore = keyValueStore; } public MethodInfo ConcreteMethodInfo { get; set; } public MethodInfo InterfaceMethodInfo { get; set; } public object ConcreteObject { get; set; } public Type ConcretetType { get; set; } public Type InterfaceType { get; set; } public T TryGetValue<T>(string key) { lock (_syncRoot) { return _dictKVStore.TryGetValue<T>(key); } } public void SetValue(string key, object value) { lock (_syncRoot) { _dictKVStore.SetValue(key, value); } } public void SyncronizedKeyValueStoreMutator(Action<IKeyValueStore> action) { lock (_syncRoot) { action(_dictKVStore); } } public object GetValueOrCreate(string key, Func<object> getOrCreateFunc) { lock (_syncRoot) { object value = getOrCreateFunc(); _dictKVStore.SetValue(key, value); return value; } } } } \ No newline at end of file diff --git a/NAdvisor/Interfaces/IAspect.cs b/NAdvisor/Interfaces/IAspect.cs index 244eca2..0b0ccb0 100644 --- a/NAdvisor/Interfaces/IAspect.cs +++ b/NAdvisor/Interfaces/IAspect.cs @@ -1,23 +1,9 @@ -// Copyright 2009 Christoph Doblander -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - using System; namespace NAdvisor.Core { public interface IAspect { object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method); } } \ No newline at end of file diff --git a/NAdvisor/Interfaces/IKeyValueStore.cs b/NAdvisor/Interfaces/IKeyValueStore.cs index e080189..3d96195 100644 --- a/NAdvisor/Interfaces/IKeyValueStore.cs +++ b/NAdvisor/Interfaces/IKeyValueStore.cs @@ -1,52 +1,38 @@ -// Copyright 2009 Christoph Doblander -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -namespace NAdvisor.Core +namespace NAdvisor.Core { public interface IKeyValueStore { /// <summary> /// Sets a value, replaces when already there /// </summary> /// <param name="key"></param> /// <param name="value"></param> void SetValue(string key, object value); /// <summary> /// Does not throw any exception /// if not found the default value is returned /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> T TryGetValue<T>(string key); /// <summary> /// Behaviour /// /// Throws exception if key is not found and does not implements the fiven type /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> T GetValue<T>(string key); /// <summary> /// Checks if the key is in keyValuestore /// </summary> /// <param name="dictionaryKey"></param> /// <returns></returns> bool ContainsKey(string dictionaryKey); } } \ No newline at end of file
chrido/NAdvisor
14a16b6eedc0c3e457e995fc6c4632258404cf6c
added sample project freeadvice
diff --git a/Example/FreeAdvice.Aspects/DatabaseContext.cs b/Example/FreeAdvice.Aspects/DatabaseContext.cs new file mode 100644 index 0000000..8d9b865 --- /dev/null +++ b/Example/FreeAdvice.Aspects/DatabaseContext.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using NAdvisor.Core; + +namespace FreeAdvice.Aspects +{ + public class DatabaseContext : IAspect + { + private readonly ITransactionContext _transactionContext; + + public DatabaseContext(ITransactionContext transactionContext) + { + _transactionContext = transactionContext; + } + + public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) + { + _transactionContext.Push(); + object returnValue = null; + + try + { + returnValue = proceedInvocation.Invoke(args); + } + catch(Exception ex) + { + _transactionContext.Rollback(); + throw ex; + } + _transactionContext.Commit(); + + return returnValue; + } + } + + public interface ITransactionContext + { + void Push(); + void Rollback(); + void Commit(); + } + + public class TransactionContext : ITransactionContext + { + public void Push() + { + + } + + public void Rollback() + { + + } + + public void Commit() + { + + } + } +} diff --git a/Example/FreeAdvice.Aspects/ExternalDmsContext.cs b/Example/FreeAdvice.Aspects/ExternalDmsContext.cs new file mode 100644 index 0000000..46fc3d3 --- /dev/null +++ b/Example/FreeAdvice.Aspects/ExternalDmsContext.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using FreeAdvice.Common; +using NAdvisor.Core; + +namespace FreeAdvice.Aspects +{ + public class ExternalDmsContext : IAspect + { + private readonly IDms _dms; + + public ExternalDmsContext(IDms dms) + { + _dms = dms; + } + + public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) + { + object returnValue; + try + { + returnValue = proceedInvocation.Invoke(args); + _dms.Commit(); + } + catch(Exception ex) + { + _dms.Rollback(); + throw ex; + } + + return returnValue; + } + } + + public interface IDms + { + void Commit(); + void Rollback(); + void AddDocumentToFolder(Guid folderId, byte[] document, string filename); + } + + public class Dms : IDms + { + private readonly ILogger _logger; + + public Dms(ILogger logger) + { + _logger = logger; + } + + public void Commit() + { + _logger.Debug("DmsCommit"); + } + + public void Rollback() + { + _logger.Debug("DmsRollback"); + } + + public void AddDocumentToFolder(Guid folderId, byte[] document, string filename) + { + _logger.Debug(string.Format("DmsAddDocumentToFolder: {0}", filename)); + } + } +} diff --git a/Example/FreeAdvice.Aspects/FreeAdvice.Aspects.csproj b/Example/FreeAdvice.Aspects/FreeAdvice.Aspects.csproj new file mode 100644 index 0000000..365ca7e --- /dev/null +++ b/Example/FreeAdvice.Aspects/FreeAdvice.Aspects.csproj @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{12BEF773-E33E-4E44-B82E-2C4D7954D773}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Aspects</RootNamespace> + <AssemblyName>FreeAdvice.Aspects</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="ExternalDmsContext.cs" /> + <Compile Include="DatabaseContext.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\NAdvisor\NAdvisor.Core.csproj"> + <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> + <Name>NAdvisor</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> + <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> + <Name>FreeAdvice.Common</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Aspects/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Aspects/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4d2ef46 --- /dev/null +++ b/Example/FreeAdvice.Aspects/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Aspects")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Aspects")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a9e76725-69e7-4ed0-923a-23d4077b98e2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Common/Configuration.cs b/Example/FreeAdvice.Common/Configuration.cs new file mode 100644 index 0000000..b93399e --- /dev/null +++ b/Example/FreeAdvice.Common/Configuration.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FreeAdvice.Common +{ + public interface IConfiguration + { + Guid GetDefaultDocumentFolder { get; } + } + + public class Configuration : IConfiguration + { + private readonly Guid defaultFolder = new Guid("{52E807B7-8A73-4756-B7E8-EBDBBC9B0C62}"); + + public Guid GetDefaultDocumentFolder + { + get { return defaultFolder; } + } + } +} diff --git a/Example/FreeAdvice.Common/FreeAdvice.Common.csproj b/Example/FreeAdvice.Common/FreeAdvice.Common.csproj new file mode 100644 index 0000000..71d666d --- /dev/null +++ b/Example/FreeAdvice.Common/FreeAdvice.Common.csproj @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Common</RootNamespace> + <AssemblyName>FreeAdvice.Common</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Configuration.cs" /> + <Compile Include="Logger.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="ValidationException.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Common/Logger.cs b/Example/FreeAdvice.Common/Logger.cs new file mode 100644 index 0000000..3ded6d8 --- /dev/null +++ b/Example/FreeAdvice.Common/Logger.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FreeAdvice.Common +{ + public interface ILogger + { + void LogError(string error); + void LogInfo(string info); + void Debug(string debug); + } + + public class Logger : ILogger + { + public EventHandler<BoringEventArgs> LoggingEvents; + + public void ThrowEvent(string logText) + { + if(LoggingEvents != null) + LoggingEvents(this, new BoringEventArgs() { Arguments = logText}); + } + + public void LogError(string error) + { + ThrowEvent("ERROR: " + error); + } + + public void LogInfo(string info) + { + ThrowEvent("INFO: " + info); + } + + public void Debug(string debug) + { + ThrowEvent("DEBUG: " + debug); + } + } + + public class BoringEventArgs : EventArgs + { + public string Arguments { get; set;} + } +} diff --git a/Example/FreeAdvice.Common/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Common/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b5d276e --- /dev/null +++ b/Example/FreeAdvice.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Common")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("03d8d7dd-a483-43a0-b547-ddc6a0b210f0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Common/ValidationException.cs b/Example/FreeAdvice.Common/ValidationException.cs new file mode 100644 index 0000000..df235bd --- /dev/null +++ b/Example/FreeAdvice.Common/ValidationException.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; + +namespace FreeAdvice.Common +{ + public class ValidationException : Exception + { + public ValidationException() + { + } + + public ValidationException(string message) : base(message) + { + } + + public ValidationException(string message, Exception innerException) : base(message, innerException) + { + } + + protected ValidationException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } +} diff --git a/Example/FreeAdvice.Configuration/Configure.cs b/Example/FreeAdvice.Configuration/Configure.cs new file mode 100644 index 0000000..8dd7d7c --- /dev/null +++ b/Example/FreeAdvice.Configuration/Configure.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Autofac; +using FreeAdvice.Common; +using FreeAdvice.Repositories; +using FreeAdvice.Repositories.Interfaces; + +namespace FreeAdvice.Configuration +{ + public class Configure + { + public static void ConfigureApplicationContainer() + { + var container = new Autofac.Builder.ContainerBuilder(); + + //Infrastructure + container.Register(d => new Logger()).As<ILogger>(); + + //Repositories + container.Register(d => new AdviceRepository()).As<IAdviceRepository>(); + + DIContainer.Container.ApplicationContainer = container.Build(); + } + + public static void ConfigureSessionContainer() + { + IContainer sessionContainer = DIContainer.Container.ApplicationContainer.CreateInnerContainer(); + + var container = new Autofac.Builder.ContainerBuilder(); + + //Register Services + + + container.Build(sessionContainer); + DIContainer.Container.SessionContainer = sessionContainer; + } + } +} diff --git a/Example/FreeAdvice.Configuration/FreeAdvice.Configuration.csproj b/Example/FreeAdvice.Configuration/FreeAdvice.Configuration.csproj new file mode 100644 index 0000000..47c96de --- /dev/null +++ b/Example/FreeAdvice.Configuration/FreeAdvice.Configuration.csproj @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Configuration</RootNamespace> + <AssemblyName>FreeAdvice.Configuration</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Autofac, Version=1.4.3.536, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\References\autofac\Autofac.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Configure.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> + <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> + <Name>FreeAdvice.Common</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.DIContainer\FreeAdvice.DIContainer.csproj"> + <Project>{7F452EC5-E286-4230-99F1-25AA78A712BB}</Project> + <Name>FreeAdvice.DIContainer</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> + <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> + <Name>FreeAdvice.Repositories.Interfaces</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Repositories\FreeAdvice.Repositories.csproj"> + <Project>{20AD9BC4-3B86-485B-9062-454D04A18F14}</Project> + <Name>FreeAdvice.Repositories</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Configuration/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Configuration/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..481af6e --- /dev/null +++ b/Example/FreeAdvice.Configuration/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Configuration")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Configuration")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("25d3c359-c5c9-4673-bc89-68cdcb6d392d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.DIContainer/Container.cs b/Example/FreeAdvice.DIContainer/Container.cs new file mode 100644 index 0000000..2f590be --- /dev/null +++ b/Example/FreeAdvice.DIContainer/Container.cs @@ -0,0 +1,81 @@ + +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Web; +using Autofac; +using IContainer=Autofac.IContainer; + +namespace FreeAdvice.DIContainer +{ + public class Container + { + private const string applicationContainerKey = "________ApplicationDependencyInjection"; + private static IContainer _applicationContainer; + + public static IContainer ApplicationContainer + { + get + { + if (HttpContext.Current == null) + return _applicationContainer; + + return HttpContext.Current.Application[applicationContainerKey] as IContainer; + } + set + { + if (HttpContext.Current == null) + { + _applicationContainer = value; + return; + } + + HttpContext.Current.Application.Lock(); + HttpContext.Current.Application[applicationContainerKey] = value; + HttpContext.Current.Application.UnLock(); + } + } + + public static IContainer CreateInnerContainer() + { + if (HttpContext.Current != null) HttpContext.Current.Application.Lock(); + IContainer innercontainer = ApplicationContainer.CreateInnerContainer(); + if (HttpContext.Current != null) HttpContext.Current.Application.UnLock(); + + return innercontainer; + } + + /// <summary> + /// Session Container + /// </summary> + private const string sessionContainerKey = "________SessionDependencyInjection"; + private static IContainer sessionContainer; + + public static IContainer SessionContainer + { + get + { + if (HttpContext.Current == null) + return sessionContainer; + + if (HttpContext.Current.Session[sessionContainerKey] == null) + { + IContainer innerContainer = CreateInnerContainer(); + HttpContext.Current.Session[sessionContainerKey] = innerContainer; + return innerContainer; + } + return HttpContext.Current.Session[sessionContainerKey] as IContainer; + } + set + { + if (HttpContext.Current != null) + { + HttpContext.Current.Session[sessionContainerKey] = value; + return; + } + sessionContainer = value; + } + } + } +} diff --git a/Example/FreeAdvice.DIContainer/FreeAdvice.DIContainer.csproj b/Example/FreeAdvice.DIContainer/FreeAdvice.DIContainer.csproj new file mode 100644 index 0000000..eabb26f --- /dev/null +++ b/Example/FreeAdvice.DIContainer/FreeAdvice.DIContainer.csproj @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{7F452EC5-E286-4230-99F1-25AA78A712BB}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.DIContainer</RootNamespace> + <AssemblyName>FreeAdvice.DIContainer</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Autofac, Version=1.4.3.536, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\References\autofac\Autofac.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Web" /> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Container.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.DIContainer/Properties/AssemblyInfo.cs b/Example/FreeAdvice.DIContainer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c8e1933 --- /dev/null +++ b/Example/FreeAdvice.DIContainer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.DIContainer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.DIContainer")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("10e893f7-014a-4b90-a0ce-d2e2a604c609")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Domain/AdviceDto.cs b/Example/FreeAdvice.Domain/AdviceDto.cs new file mode 100644 index 0000000..23630d6 --- /dev/null +++ b/Example/FreeAdvice.Domain/AdviceDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FreeAdvice.Domain +{ + public class AdviceDto + { + public Guid Id { get; set; } + public string AdviceText { get; set; } + public int RandomNumber { get; set; } + } +} diff --git a/Example/FreeAdvice.Domain/FreeAdvice.Domain.csproj b/Example/FreeAdvice.Domain/FreeAdvice.Domain.csproj new file mode 100644 index 0000000..2b1c737 --- /dev/null +++ b/Example/FreeAdvice.Domain/FreeAdvice.Domain.csproj @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Domain</RootNamespace> + <AssemblyName>FreeAdvice.Domain</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AdviceDto.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Domain/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Domain/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..21416c7 --- /dev/null +++ b/Example/FreeAdvice.Domain/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Domain")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Domain")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d4e23993-7e35-49ba-9cf7-5b4b2257718f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.MSTest/AdviceServiceTest.cs b/Example/FreeAdvice.MSTest/AdviceServiceTest.cs new file mode 100644 index 0000000..0d4a8b3 --- /dev/null +++ b/Example/FreeAdvice.MSTest/AdviceServiceTest.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FreeAdvice.Aspects; +using FreeAdvice.Common; +using FreeAdvice.Domain; +using FreeAdvice.Repositories.Interfaces; +using FreeAdvice.Service.Interfaces; +using FreeAdvice.Services; +using Moq; +using NAdvisor.Core; +using NAdvisor.Contrib; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace FreeAdvice.MSTest +{ + [TestClass] + public class AdviceServiceTest + { + [TestMethod] + public void Should_Validate_Advice_Dto() + { + //Given + var advice = new AdviceDto(); + var service = new AdviceService(null, null, null); + + //Then + MSTestHelper.ShouldThrowException<ValidationException>(() => service.UpdateAdvice(advice)); + } + + + /// <summary> + /// Note: May not be the typical goog unit Test but shows how much you can abuse it + /// </summary> + [TestMethod] + public void Should_Update_Repository_And_Commit_To_External_Dms_When_Validated() + { + //Constants + var documentFolder = Guid.NewGuid(); + + //Given + var advice = new AdviceDto() {AdviceText = "adsfasdfasdf", Id = default(Guid), RandomNumber = 3}; + var mockFactory = new MockFactory(MockBehavior.Strict); + + + //Service Dependencies + var adviceRepository = mockFactory.Create<IAdviceRepository>(); + var configuration = mockFactory.Create<IConfiguration>(); + + var aspects = new List<IAspect>(); + var transactionContext = mockFactory.Create<ITransactionContext>(); + var dms = mockFactory.Create<IDms>(); + //Aspect Configuration + + aspects.Add(new DatabaseContext(transactionContext.Object)); + aspects.Add(new ExternalDmsContext(dms.Object)); + + var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, aspects); + var service = advisor.GetAdvicedProxy<IAdviceService>(new AdviceService(adviceRepository.Object, dms.Object, configuration.Object)); + + //setup Mocks + transactionContext.Setup(tc => tc.Push()).AtMost(1); + configuration.Setup(co => co.GetDefaultDocumentFolder).Returns(documentFolder).AtMostOnce(); + dms.Setup(dm => dm.AddDocumentToFolder(It.IsAny<Guid>(), It.IsAny<byte[]>(), It.IsAny<string>())).AtMostOnce(); + adviceRepository.Setup(ar => ar.UpdateAdvice(advice)).AtMostOnce(); + dms.Setup(dm => dm.Commit()).AtMostOnce(); + transactionContext.Setup(tc => tc.Commit()); + + //Then + service.UpdateAdvice(advice); + + //When + + mockFactory.VerifyAll(); + } + } +} diff --git a/Example/FreeAdvice.MSTest/FreeAdvice.MSTest.csproj b/Example/FreeAdvice.MSTest/FreeAdvice.MSTest.csproj new file mode 100644 index 0000000..83d47b7 --- /dev/null +++ b/Example/FreeAdvice.MSTest/FreeAdvice.MSTest.csproj @@ -0,0 +1,91 @@ +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{0B022C57-B497-43F9-A5F6-BAE8519F7458}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.MSTest</RootNamespace> + <AssemblyName>FreeAdvice.MSTest</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\References\moq\Moq.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="AdviceServiceTest.cs" /> + <Compile Include="MSTestHelper.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> + <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> + <Name>NAdvisor.Contrib</Name> + </ProjectReference> + <ProjectReference Include="..\..\NAdvisor\NAdvisor.Core.csproj"> + <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> + <Name>NAdvisor.Core</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj"> + <Project>{12BEF773-E33E-4E44-B82E-2C4D7954D773}</Project> + <Name>FreeAdvice.Aspects</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> + <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> + <Name>FreeAdvice.Common</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> + <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> + <Name>FreeAdvice.Domain</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> + <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> + <Name>FreeAdvice.Repositories.Interfaces</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj"> + <Project>{B41065F5-02BC-436A-B21A-DB814C62FBDE}</Project> + <Name>FreeAdvice.Service.Interfaces</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Services\FreeAdvice.Services.csproj"> + <Project>{48D92B96-65B9-4592-AB37-76CE40515AEE}</Project> + <Name>FreeAdvice.Services</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.MSTest/MSTestHelper.cs b/Example/FreeAdvice.MSTest/MSTestHelper.cs new file mode 100644 index 0000000..3decc60 --- /dev/null +++ b/Example/FreeAdvice.MSTest/MSTestHelper.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + + +namespace FreeAdvice.MSTest +{ + public static class MSTestHelper + { + public static void ShouldThrowException<TypeOfException>(Action exceptionThrowingAction) + { + try + { + exceptionThrowingAction(); + } + catch(Exception ex) + { + if(!(ex is TypeOfException)) + { + Assert.Fail("Should throw a different kind of exception"); + } + } + } + } +} diff --git a/Example/FreeAdvice.MSTest/Properties/AssemblyInfo.cs b/Example/FreeAdvice.MSTest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3460aa0 --- /dev/null +++ b/Example/FreeAdvice.MSTest/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.MSTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.MSTest")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM componenets. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("31ecb176-149f-45f5-9c6a-e19077966164")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Repositories.Interfaces/FreeAdvice.Repositories.Interfaces.csproj b/Example/FreeAdvice.Repositories.Interfaces/FreeAdvice.Repositories.Interfaces.csproj new file mode 100644 index 0000000..c432a6d --- /dev/null +++ b/Example/FreeAdvice.Repositories.Interfaces/FreeAdvice.Repositories.Interfaces.csproj @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{EF37D586-9279-434D-B22D-92C2FC60710D}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Repositories.Interfaces</RootNamespace> + <AssemblyName>FreeAdvice.Repositories.Interfaces</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="IAdviceRepository.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> + <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> + <Name>FreeAdvice.Domain</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Repositories.Interfaces/IAdviceRepository.cs b/Example/FreeAdvice.Repositories.Interfaces/IAdviceRepository.cs new file mode 100644 index 0000000..92cf760 --- /dev/null +++ b/Example/FreeAdvice.Repositories.Interfaces/IAdviceRepository.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FreeAdvice.Domain; + +namespace FreeAdvice.Repositories.Interfaces +{ + public interface IAdviceRepository + { + AdviceDto GetById(Guid id); + void UpdateAdvice(AdviceDto dto); + IEnumerable<AdviceDto> GetAdviceByAdviceText(string text); + IEnumerable<AdviceDto> GetAdviceByRandomNumber(int number); + IEnumerable<AdviceDto> GetAllAdvices(); + } +} diff --git a/Example/FreeAdvice.Repositories.Interfaces/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Repositories.Interfaces/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..01378ee --- /dev/null +++ b/Example/FreeAdvice.Repositories.Interfaces/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Repositories.Interfaces")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Repositories.Interfaces")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5994acf1-cfbb-4af3-a12b-46dc982163fd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Repositories/AdviceRepository.cs b/Example/FreeAdvice.Repositories/AdviceRepository.cs new file mode 100644 index 0000000..f058589 --- /dev/null +++ b/Example/FreeAdvice.Repositories/AdviceRepository.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FreeAdvice.Domain; +using FreeAdvice.Repositories.Interfaces; + +namespace FreeAdvice.Repositories +{ + public class AdviceRepository : IAdviceRepository + { + private readonly Dictionary<Guid, AdviceDto> _advices; + private readonly Random _random; + + public AdviceRepository() + { + _random = new Random(); + _advices = InitializeAdvices(); + } + + private Dictionary<Guid, AdviceDto> InitializeAdvices() + { + var advices = new Dictionary<Guid, AdviceDto>(); + for (int i = 0; i < 35; i++ ) + { + var dto = CreateNewRandomDto(); + advices.Add(dto.Id, dto); + } + + return advices; + } + + private AdviceDto CreateNewRandomDto() + { + var advice = new AdviceDto(); + advice.Id = Guid.NewGuid(); + + advice.AdviceText = string.Empty; + for(int i = 0; i < _random.Next(3, 12); i++) + advice.AdviceText += Convert.ToChar(Convert.ToInt32(Math.Floor(26*_random.NextDouble() + 65))); + advice.RandomNumber = _random.Next(5); + + return advice; + } + + + + public AdviceDto GetById(Guid id) + { + return _advices[id]; + } + + public void UpdateAdvice(AdviceDto dto) + { + _advices[dto.Id] = dto; + } + + public IEnumerable<AdviceDto> GetAdviceByAdviceText(string text) + { + return _advices.Values.Where(ad => ad.AdviceText.Contains(text)); + } + + public IEnumerable<AdviceDto> GetAdviceByRandomNumber(int number) + { + return _advices.Values.Where(ad => ad.RandomNumber == number); + } + + public IEnumerable<AdviceDto> GetAllAdvices() + { + return _advices.Values; + } + } +} diff --git a/Example/FreeAdvice.Repositories/FreeAdvice.Repositories.csproj b/Example/FreeAdvice.Repositories/FreeAdvice.Repositories.csproj new file mode 100644 index 0000000..8540144 --- /dev/null +++ b/Example/FreeAdvice.Repositories/FreeAdvice.Repositories.csproj @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{20AD9BC4-3B86-485B-9062-454D04A18F14}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Repositories</RootNamespace> + <AssemblyName>FreeAdvice.Repositories</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AdviceRepository.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> + <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> + <Name>FreeAdvice.Domain</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> + <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> + <Name>FreeAdvice.Repositories.Interfaces</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Repositories/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Repositories/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8b8a61a --- /dev/null +++ b/Example/FreeAdvice.Repositories/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Repositories")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Repositories")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("dc884abc-3e7a-4eb0-8a1c-9c44043e6e66")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Service.Interfaces/FreeAdvice.Service.Interfaces.csproj b/Example/FreeAdvice.Service.Interfaces/FreeAdvice.Service.Interfaces.csproj new file mode 100644 index 0000000..1fac1c2 --- /dev/null +++ b/Example/FreeAdvice.Service.Interfaces/FreeAdvice.Service.Interfaces.csproj @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{B41065F5-02BC-436A-B21A-DB814C62FBDE}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Service.Interfaces</RootNamespace> + <AssemblyName>FreeAdvice.Service.Interfaces</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="IAdviceService.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> + <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> + <Name>FreeAdvice.Domain</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Service.Interfaces/IAdviceService.cs b/Example/FreeAdvice.Service.Interfaces/IAdviceService.cs new file mode 100644 index 0000000..f1b1ef2 --- /dev/null +++ b/Example/FreeAdvice.Service.Interfaces/IAdviceService.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FreeAdvice.Domain; + +namespace FreeAdvice.Service.Interfaces +{ + public interface IAdviceService + { + AdviceDto GetAdvice(Guid id); + IEnumerable<AdviceDto> GetAllAdvices(); + void UpdateAdvice(AdviceDto dto); + } +} diff --git a/Example/FreeAdvice.Service.Interfaces/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Service.Interfaces/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d90476f --- /dev/null +++ b/Example/FreeAdvice.Service.Interfaces/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Service.Interfaces")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Service.Interfaces")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("46be273f-cf61-41d1-af92-b52d5bf7e2ff")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice.Services/AdviceService.cs b/Example/FreeAdvice.Services/AdviceService.cs new file mode 100644 index 0000000..128087b --- /dev/null +++ b/Example/FreeAdvice.Services/AdviceService.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using FreeAdvice.Aspects; +using FreeAdvice.Common; +using FreeAdvice.Domain; +using FreeAdvice.Repositories.Interfaces; +using FreeAdvice.Service.Interfaces; +using NAdvisor.Contrib; + +namespace FreeAdvice.Services +{ + public class AdviceService : IAdviceService + { + private readonly IAdviceRepository _adviceRepository; + private readonly IDms _dms; + private readonly IConfiguration _configuration; + + public AdviceService(IAdviceRepository adviceRepository, IDms dms, IConfiguration configuration) + { + _adviceRepository = adviceRepository; + _dms = dms; + _configuration = configuration; + } + + public AdviceDto GetAdvice(Guid id) + { + return _adviceRepository.GetById(id); + } + + public IEnumerable<AdviceDto> GetAllAdvices() + { + return _adviceRepository.GetAllAdvices(); + } + + [InterceptedBy(typeof(DatabaseContext), typeof(ExternalDmsContext))] + public void UpdateAdvice(AdviceDto dto) + { + IEnumerable<string> validationErrors = ValidateAdvice(dto); + if (validationErrors.Count() != 0) + throw new ValidationException("Validationerrors: " + validationErrors.Aggregate((m, o) => m + "; " + o)); + + if (dto.Id == Guid.Empty) + dto.Id = Guid.NewGuid(); + + _dms.AddDocumentToFolder(_configuration.GetDefaultDocumentFolder, GenerateDocumentForAdvice(dto), GetFileNameForAdvice(dto)); + _adviceRepository.UpdateAdvice(dto); + } + + private string GetFileNameForAdvice(AdviceDto dto) + { + return dto.Id.ToString() + ".doc"; + } + + private byte[] GenerateDocumentForAdvice(AdviceDto dto) + { + return new byte[3]; + } + + private IEnumerable<string> ValidateAdvice(AdviceDto dto) + { + if (!string.IsNullOrEmpty(dto.AdviceText) && dto.AdviceText.Length < 5) + yield return "need more characters"; + + if (dto.RandomNumber == default(int)) + yield return "need a random Number"; + } + } +} diff --git a/Example/FreeAdvice.Services/FreeAdvice.Services.csproj b/Example/FreeAdvice.Services/FreeAdvice.Services.csproj new file mode 100644 index 0000000..ba4fbdf --- /dev/null +++ b/Example/FreeAdvice.Services/FreeAdvice.Services.csproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{48D92B96-65B9-4592-AB37-76CE40515AEE}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice.Services</RootNamespace> + <AssemblyName>FreeAdvice.Services</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AdviceService.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> + <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> + <Name>NAdvisor.Contrib</Name> + </ProjectReference> + <ProjectReference Include="..\..\NAdvisor\NAdvisor.Core.csproj"> + <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> + <Name>NAdvisor</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj"> + <Project>{12BEF773-E33E-4E44-B82E-2C4D7954D773}</Project> + <Name>FreeAdvice.Aspects</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Common\FreeAdvice.Common.csproj"> + <Project>{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}</Project> + <Name>FreeAdvice.Common</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Domain\FreeAdvice.Domain.csproj"> + <Project>{BB90B793-65A7-4D10-9065-EC04583EAFDB}</Project> + <Name>FreeAdvice.Domain</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj"> + <Project>{EF37D586-9279-434D-B22D-92C2FC60710D}</Project> + <Name>FreeAdvice.Repositories.Interfaces</Name> + </ProjectReference> + <ProjectReference Include="..\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj"> + <Project>{B41065F5-02BC-436A-B21A-DB814C62FBDE}</Project> + <Name>FreeAdvice.Service.Interfaces</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice.Services/Properties/AssemblyInfo.cs b/Example/FreeAdvice.Services/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b49fbb9 --- /dev/null +++ b/Example/FreeAdvice.Services/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice.Services")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice.Services")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8ae9d61c-07e0-4092-a85a-8923d5bd86ff")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice/DIContainer.cs b/Example/FreeAdvice/DIContainer.cs new file mode 100644 index 0000000..b6fa8ba --- /dev/null +++ b/Example/FreeAdvice/DIContainer.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace FreeAdvice +{ + public class DIContainer + { + + } +} diff --git a/Example/FreeAdvice/Default.aspx b/Example/FreeAdvice/Default.aspx new file mode 100644 index 0000000..f6ab9f8 --- /dev/null +++ b/Example/FreeAdvice/Default.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FreeAdvice._Default" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" > +<head runat="server"> + <title></title> +</head> +<body> + <form id="form1" runat="server"> + <div> + + </div> + </form> +</body> +</html> diff --git a/Example/FreeAdvice/Default.aspx.cs b/Example/FreeAdvice/Default.aspx.cs new file mode 100644 index 0000000..7811ecb --- /dev/null +++ b/Example/FreeAdvice/Default.aspx.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FreeAdvice +{ + public partial class _Default : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/Example/FreeAdvice/Default.aspx.designer.cs b/Example/FreeAdvice/Default.aspx.designer.cs new file mode 100644 index 0000000..988f9d2 --- /dev/null +++ b/Example/FreeAdvice/Default.aspx.designer.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace FreeAdvice +{ + + + public partial class _Default + { + + /// <summary> + /// form1 control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git a/Example/FreeAdvice/FreeAdvice.csproj b/Example/FreeAdvice/FreeAdvice.csproj new file mode 100644 index 0000000..93c099a --- /dev/null +++ b/Example/FreeAdvice/FreeAdvice.csproj @@ -0,0 +1,117 @@ +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}</ProjectGuid> + <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FreeAdvice</RootNamespace> + <AssemblyName>FreeAdvice</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Autofac, Version=1.4.3.536, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\autofac\Autofac.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Web.Extensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Drawing" /> + <Reference Include="System.Web" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Web.Services" /> + <Reference Include="System.EnterpriseServices" /> + <Reference Include="System.Web.Mobile" /> + </ItemGroup> + <ItemGroup> + <Content Include="Default.aspx" /> + <Content Include="Global.asax" /> + <Content Include="Web.config" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Default.aspx.cs"> + <SubType>ASPXCodeBehind</SubType> + <DependentUpon>Default.aspx</DependentUpon> + </Compile> + <Compile Include="Default.aspx.designer.cs"> + <DependentUpon>Default.aspx</DependentUpon> + </Compile> + <Compile Include="DIContainer.cs" /> + <Compile Include="Global.asax.cs"> + <DependentUpon>Global.asax</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <Folder Include="App_Data\" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <ProjectExtensions> + <VisualStudio> + <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> + <WebProjectProperties> + <UseIIS>False</UseIIS> + <AutoAssignPort>True</AutoAssignPort> + <DevelopmentServerPort>2754</DevelopmentServerPort> + <DevelopmentServerVPath>/</DevelopmentServerVPath> + <IISUrl> + </IISUrl> + <NTLMAuthentication>False</NTLMAuthentication> + <UseCustomServer>False</UseCustomServer> + <CustomServerUrl> + </CustomServerUrl> + <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> + </WebProjectProperties> + </FlavorProperties> + </VisualStudio> + </ProjectExtensions> +</Project> \ No newline at end of file diff --git a/Example/FreeAdvice/Global.asax b/Example/FreeAdvice/Global.asax new file mode 100644 index 0000000..fa6c441 --- /dev/null +++ b/Example/FreeAdvice/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="FreeAdvice.Global" Language="C#" %> diff --git a/Example/FreeAdvice/Global.asax.cs b/Example/FreeAdvice/Global.asax.cs new file mode 100644 index 0000000..e4599ac --- /dev/null +++ b/Example/FreeAdvice/Global.asax.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.SessionState; + +namespace FreeAdvice +{ + public class Global : System.Web.HttpApplication + { + + protected void Application_Start(object sender, EventArgs e) + { + + } + + protected void Session_Start(object sender, EventArgs e) + { + + } + + protected void Application_BeginRequest(object sender, EventArgs e) + { + + } + + protected void Application_AuthenticateRequest(object sender, EventArgs e) + { + + } + + protected void Application_Error(object sender, EventArgs e) + { + + } + + protected void Session_End(object sender, EventArgs e) + { + + } + + protected void Application_End(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/Example/FreeAdvice/Properties/AssemblyInfo.cs b/Example/FreeAdvice/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e63e7c1 --- /dev/null +++ b/Example/FreeAdvice/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FreeAdvice")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FreeAdvice")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Example/FreeAdvice/Web.config b/Example/FreeAdvice/Web.config new file mode 100644 index 0000000..fcaa9dc --- /dev/null +++ b/Example/FreeAdvice/Web.config @@ -0,0 +1,125 @@ +<?xml version="1.0"?> + +<configuration> + + + <configSections> + <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> + <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> + <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> + <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> + <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> + </sectionGroup> + </sectionGroup> + </sectionGroup> + </configSections> + + + <appSettings/> + <connectionStrings/> + + <system.web> + <!-- + Set compilation debug="true" to insert debugging + symbols into the compiled page. Because this + affects performance, set this value to true only + during development. + --> + <compilation debug="false"> + + <assemblies> + <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> + <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> + <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> + </assemblies> + + </compilation> + <!-- + The <authentication> section enables configuration + of the security authentication mode used by + ASP.NET to identify an incoming user. + --> + <authentication mode="Windows" /> + <!-- + The <customErrors> section enables configuration + of what to do if/when an unhandled error occurs + during the execution of a request. Specifically, + it enables developers to configure html error pages + to be displayed in place of a error stack trace. + + <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> + <error statusCode="403" redirect="NoAccess.htm" /> + <error statusCode="404" redirect="FileNotFound.htm" /> + </customErrors> + --> + + <pages> + <controls> + <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + </controls> + </pages> + + <httpHandlers> + <remove verb="*" path="*.asmx"/> + <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> + </httpHandlers> + <httpModules> + <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + </httpModules> + + </system.web> + + <system.codedom> + <compilers> + <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" + type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <providerOption name="CompilerVersion" value="v3.5"/> + <providerOption name="WarnAsError" value="false"/> + </compiler> + </compilers> + </system.codedom> + + <!-- + The system.webServer section is required for running ASP.NET AJAX under Internet + Information Services 7.0. It is not necessary for previous version of IIS. + --> + <system.webServer> + <validation validateIntegratedModeConfiguration="false"/> + <modules> + <remove name="ScriptModule" /> + <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + </modules> + <handlers> + <remove name="WebServiceHandlerFactory-Integrated"/> + <remove name="ScriptHandlerFactory" /> + <remove name="ScriptHandlerFactoryAppServices" /> + <remove name="ScriptResource" /> + <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" + type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" + type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> + </handlers> + </system.webServer> + + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> + <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> + <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> + </dependentAssembly> + </assemblyBinding> + </runtime> + +</configuration> diff --git a/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs b/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs index 1856522..04700ab 100644 --- a/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs +++ b/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs @@ -1,36 +1,36 @@ using System; using System.Collections.Generic; using NAdvisor.Core; namespace NAdvisor.Contrib { public class JointPointDefinition { - public static IList<IAspect> AttributeBasedJointPointDefinition(IAspectEnvironment methodInfo, IList<IAspect> availableAspects) + public static IList<IAspect> AttributeBasedJointPointDefinition(IAspectEnvironment aspectEnvironment, IList<IAspect> availableAspects) { - object[] customAttributes = methodInfo.ConcreteMethodInfo.GetCustomAttributes(typeof(InterceptedByAttribute), true); + object[] customAttributes = aspectEnvironment.ConcreteMethodInfo.GetCustomAttributes(typeof(InterceptedByAttribute), true); if (customAttributes.Length == 0) return new List<IAspect>(); var takenAspects = new List<IAspect>(); var attribute = customAttributes[0] as InterceptedByAttribute; if (attribute != null) { foreach (Type aspectTypes in attribute.Types) //Keeping order of Aspects { foreach (IAspect aspect in availableAspects) { if(aspect.GetType() == aspectTypes) //return the Aspect if the Types Match { takenAspects.Add(aspect); break; } } } } return takenAspects; } } } \ No newline at end of file diff --git a/NAdvisor.sln b/NAdvisor.sln index 9b0e4dd..0f4cb7e 100644 --- a/NAdvisor.sln +++ b/NAdvisor.sln @@ -1,47 +1,128 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Core", "NAdvisor\NAdvisor.Core.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest", "NAdvisorTest\NAdvisorTest.csproj", "{EEE750E7-0D26-4845-8AFA-9617752454A5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Test", "NAdvisor.Contrib.Test\NAdvisor.Contrib.Test.csproj", "{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CF09232-5830-459C-9115-28284BA0B6A4}" ProjectSection(SolutionItems) = preProject LocalTestRun.testrunconfig = LocalTestRun.testrunconfig NAdvisor.vsmdi = NAdvisor.vsmdi EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{CC6CCF2B-D048-4DC8-80E9-CBB3523C5181}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice", "Example\FreeAdvice\FreeAdvice.csproj", "{6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Aspects", "Example\FreeAdvice.Aspects\FreeAdvice.Aspects.csproj", "{12BEF773-E33E-4E44-B82E-2C4D7954D773}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Common", "Example\FreeAdvice.Common\FreeAdvice.Common.csproj", "{F889330D-DFBF-4805-8D5D-3EA3B593EDE2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Configuration", "Example\FreeAdvice.Configuration\FreeAdvice.Configuration.csproj", "{FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.DIContainer", "Example\FreeAdvice.DIContainer\FreeAdvice.DIContainer.csproj", "{7F452EC5-E286-4230-99F1-25AA78A712BB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Domain", "Example\FreeAdvice.Domain\FreeAdvice.Domain.csproj", "{BB90B793-65A7-4D10-9065-EC04583EAFDB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Repositories", "Example\FreeAdvice.Repositories\FreeAdvice.Repositories.csproj", "{20AD9BC4-3B86-485B-9062-454D04A18F14}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Repositories.Interfaces", "Example\FreeAdvice.Repositories.Interfaces\FreeAdvice.Repositories.Interfaces.csproj", "{EF37D586-9279-434D-B22D-92C2FC60710D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Services", "Example\FreeAdvice.Services\FreeAdvice.Services.csproj", "{48D92B96-65B9-4592-AB37-76CE40515AEE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.Service.Interfaces", "Example\FreeAdvice.Service.Interfaces\FreeAdvice.Service.Interfaces.csproj", "{B41065F5-02BC-436A-B21A-DB814C62FBDE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeAdvice.MSTest", "Example\FreeAdvice.MSTest\FreeAdvice.MSTest.csproj", "{0B022C57-B497-43F9-A5F6-BAE8519F7458}" +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = NAdvisor.vsmdi EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.Build.0 = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.ActiveCfg = Release|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.Build.0 = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.Build.0 = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.Build.0 = Release|Any CPU + {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4}.Release|Any CPU.Build.0 = Release|Any CPU + {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12BEF773-E33E-4E44-B82E-2C4D7954D773}.Release|Any CPU.Build.0 = Release|Any CPU + {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F889330D-DFBF-4805-8D5D-3EA3B593EDE2}.Release|Any CPU.Build.0 = Release|Any CPU + {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF}.Release|Any CPU.Build.0 = Release|Any CPU + {7F452EC5-E286-4230-99F1-25AA78A712BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F452EC5-E286-4230-99F1-25AA78A712BB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F452EC5-E286-4230-99F1-25AA78A712BB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F452EC5-E286-4230-99F1-25AA78A712BB}.Release|Any CPU.Build.0 = Release|Any CPU + {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB90B793-65A7-4D10-9065-EC04583EAFDB}.Release|Any CPU.Build.0 = Release|Any CPU + {20AD9BC4-3B86-485B-9062-454D04A18F14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20AD9BC4-3B86-485B-9062-454D04A18F14}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20AD9BC4-3B86-485B-9062-454D04A18F14}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20AD9BC4-3B86-485B-9062-454D04A18F14}.Release|Any CPU.Build.0 = Release|Any CPU + {EF37D586-9279-434D-B22D-92C2FC60710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF37D586-9279-434D-B22D-92C2FC60710D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF37D586-9279-434D-B22D-92C2FC60710D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF37D586-9279-434D-B22D-92C2FC60710D}.Release|Any CPU.Build.0 = Release|Any CPU + {48D92B96-65B9-4592-AB37-76CE40515AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48D92B96-65B9-4592-AB37-76CE40515AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48D92B96-65B9-4592-AB37-76CE40515AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48D92B96-65B9-4592-AB37-76CE40515AEE}.Release|Any CPU.Build.0 = Release|Any CPU + {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B41065F5-02BC-436A-B21A-DB814C62FBDE}.Release|Any CPU.Build.0 = Release|Any CPU + {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B022C57-B497-43F9-A5F6-BAE8519F7458}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6EDBEDA5-849C-488D-9AC8-FD8E89A1E7B4} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {12BEF773-E33E-4E44-B82E-2C4D7954D773} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {F889330D-DFBF-4805-8D5D-3EA3B593EDE2} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {FC9AC6C3-2922-4FFD-AE90-CD983E5F34AF} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {7F452EC5-E286-4230-99F1-25AA78A712BB} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {BB90B793-65A7-4D10-9065-EC04583EAFDB} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {20AD9BC4-3B86-485B-9062-454D04A18F14} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {EF37D586-9279-434D-B22D-92C2FC60710D} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {48D92B96-65B9-4592-AB37-76CE40515AEE} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {B41065F5-02BC-436A-B21A-DB814C62FBDE} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + {0B022C57-B497-43F9-A5F6-BAE8519F7458} = {CC6CCF2B-D048-4DC8-80E9-CBB3523C5181} + EndGlobalSection EndGlobal diff --git a/NAdvisor/AdviceInterceptor.cs b/NAdvisor/AdviceInterceptor.cs index 4bd45c3..0135c6c 100644 --- a/NAdvisor/AdviceInterceptor.cs +++ b/NAdvisor/AdviceInterceptor.cs @@ -1,91 +1,95 @@ using System; using System.Collections.Generic; using System.Linq; using Castle.Core.Interceptor; +using System.Reflection; namespace NAdvisor.Core { internal class AdviceInterceptor : IInterceptor { private readonly Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspects; private readonly IKeyValueStore _keyValueStore; private readonly IList<IAspect> _availableAspects; private readonly object _concreteInstance; private readonly Type _interfaceType; //used for caching the aspectEnvironment private readonly Dictionary<MethodInfo, AspectEnvironment> _aspectEnvironmentDict; private readonly object _aspectEnvironmentSyncRott = new object(); public AdviceInterceptor(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IKeyValueStore store, IEnumerable<IAspect> availableAspects, object concreteInstance, Type interfaceType) { _availableAspects = new List<IAspect>(availableAspects); _getAspects = getAspects; _keyValueStore = store; _concreteInstance = concreteInstance; _interfaceType = interfaceType; + _aspectEnvironmentDict = new Dictionary<MethodInfo, AspectEnvironment>(); } public void Intercept(IInvocation invocation) { IAspectEnvironment environment = CreateOrGetEnvironment(invocation); var aspectList = _getAspects.Invoke(environment, new List<IAspect>(_availableAspects)); invocation.ReturnValue = CreateNextLevel(invocation, aspectList, environment)(invocation.Arguments); } private AspectEnvironment CreateOrGetEnvironment(IInvocation invocation) { lock (_aspectEnvironmentSyncRott) { var calledMethod = invocation.Method; if (_aspectEnvironmentDict.ContainsKey(calledMethod)) return _aspectEnvironmentDict[calledMethod]; else { AspectEnvironment environment = CreateEnvironment(invocation); _aspectEnvironmentDict.Add(calledMethod, environment); return environment; } } } private AspectEnvironment CreateEnvironment(IInvocation invocation) { var environment = new AspectEnvironment(_keyValueStore); + environment.ConcreteMethodInfo = invocation.GetConcreteMethod(); environment.ConcreteObject = _concreteInstance; + environment.InterfaceMethodInfo = invocation.Method; environment.ConcretetType = _concreteInstance.GetType(); environment.InterfaceType = _interfaceType; return environment; } public Func<object[], object> CreateNextLevel(IInvocation invocation, IEnumerable<IAspect> restOfAspects, IAspectEnvironment method) { return args => { - var nextAspect = restOfAspects.FirstOrDefault(); + IAspect nextAspect = restOfAspects.FirstOrDefault(); if (nextAspect != null) { //Recursion return nextAspect.Execute( CreateNextLevel(invocation, restOfAspects.Skip(1), method), args, method ); } for (int i = 0; i < args.Length; i++) { invocation.SetArgumentValue(i, args[i]); } - //Enter the concrete Method + //Enter the body of the concrete Method invocation.Proceed(); return invocation.ReturnValue; }; } } } \ No newline at end of file diff --git a/NAdvisorTest/NAdvisorTest.csproj.vspscc b/NAdvisorTest/NAdvisorTest.csproj.vspscc deleted file mode 100644 index b6d3289..0000000 --- a/NAdvisorTest/NAdvisorTest.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -}
chrido/NAdvisor
7b0eaa16ee7a17ab2a2ffa4d63cad7f8a77e34c6
caching of aspectenvironment
diff --git a/NAdvisor/AdviceInterceptor.cs b/NAdvisor/AdviceInterceptor.cs index 03d2b12..4bd45c3 100644 --- a/NAdvisor/AdviceInterceptor.cs +++ b/NAdvisor/AdviceInterceptor.cs @@ -1,68 +1,91 @@ using System; using System.Collections.Generic; using System.Linq; using Castle.Core.Interceptor; namespace NAdvisor.Core { internal class AdviceInterceptor : IInterceptor { private readonly Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspects; private readonly IKeyValueStore _keyValueStore; private readonly IList<IAspect> _availableAspects; private readonly object _concreteInstance; + private readonly Type _interfaceType; - public AdviceInterceptor(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IKeyValueStore store, IEnumerable<IAspect> availableAspects, object concreteInstance) + //used for caching the aspectEnvironment + private readonly Dictionary<MethodInfo, AspectEnvironment> _aspectEnvironmentDict; + private readonly object _aspectEnvironmentSyncRott = new object(); + + + public AdviceInterceptor(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IKeyValueStore store, IEnumerable<IAspect> availableAspects, object concreteInstance, Type interfaceType) { _availableAspects = new List<IAspect>(availableAspects); _getAspects = getAspects; _keyValueStore = store; _concreteInstance = concreteInstance; + _interfaceType = interfaceType; } - public void Intercept(IInvocation invocation) { - IAspectEnvironment environment = CreateEnvironment(invocation); + IAspectEnvironment environment = CreateOrGetEnvironment(invocation); var aspectList = _getAspects.Invoke(environment, new List<IAspect>(_availableAspects)); invocation.ReturnValue = CreateNextLevel(invocation, aspectList, environment)(invocation.Arguments); } + private AspectEnvironment CreateOrGetEnvironment(IInvocation invocation) + { + lock (_aspectEnvironmentSyncRott) + { + var calledMethod = invocation.Method; + + if (_aspectEnvironmentDict.ContainsKey(calledMethod)) + return _aspectEnvironmentDict[calledMethod]; + else + { + AspectEnvironment environment = CreateEnvironment(invocation); + _aspectEnvironmentDict.Add(calledMethod, environment); + + return environment; + } + } + } + private AspectEnvironment CreateEnvironment(IInvocation invocation) { var environment = new AspectEnvironment(_keyValueStore); environment.ConcreteMethodInfo = invocation.GetConcreteMethod(); environment.ConcreteObject = _concreteInstance; environment.InterfaceMethodInfo = invocation.Method; environment.ConcretetType = _concreteInstance.GetType(); - environment.InterfaceType = invocation.TargetType; - + environment.InterfaceType = _interfaceType; return environment; } public Func<object[], object> CreateNextLevel(IInvocation invocation, IEnumerable<IAspect> restOfAspects, IAspectEnvironment method) { return args => { var nextAspect = restOfAspects.FirstOrDefault(); if (nextAspect != null) { //Recursion return nextAspect.Execute( CreateNextLevel(invocation, restOfAspects.Skip(1), method), args, method ); } for (int i = 0; i < args.Length; i++) { invocation.SetArgumentValue(i, args[i]); } //Enter the concrete Method invocation.Proceed(); return invocation.ReturnValue; }; } } } \ No newline at end of file diff --git a/NAdvisor/Advisor.cs b/NAdvisor/Advisor.cs index b0092a9..1fc72c8 100644 --- a/NAdvisor/Advisor.cs +++ b/NAdvisor/Advisor.cs @@ -1,73 +1,73 @@ -// Copyright 2009 Christoph Doblander -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; +using System; using System.Collections.Generic; using Castle.DynamicProxy; using NAdvisor.Core.Implementation; namespace NAdvisor.Core { public class Advisor { private readonly Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspectsForJointPoint; private readonly IList<IAspect> _aspects; /// <summary> /// Intercepts every call with one aspect /// </summary> /// <param name="aspect"></param> public Advisor(IAspect aspect) { _aspects = new List<IAspect>(){aspect}; _getAspectsForJointPoint = (aspectEnvironment, availableAspects) => _aspects; } /// <summary> /// Intercepts ever call with all espects, /// </summary> /// <param name="aspects"></param> public Advisor(IList<IAspect> aspects) { _aspects = aspects; _getAspectsForJointPoint = (aspectEnvironment, availableAspects) => _aspects; } public Advisor(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspectsForJointPoint, IAspect aspect) { _getAspectsForJointPoint = getAspectsForJointPoint; _aspects = new List<IAspect>() {aspect}; } public Advisor(Func<IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspectsForJointPoint, IList<IAspect> aspects) { _getAspectsForJointPoint = getAspectsForJointPoint; _aspects = aspects; } - public T GetAdvicedProxy<T>(T concreteInstance) //TODO Typerestriction on Interfaces only + + public T GetAdvicedProxy<T>(T concreteInstance) where T : class { - return GetAdvicedProxy<T>(concreteInstance, new DictionaryKeyValueStore()); + return GetAdvicedProxy(typeof(T), concreteInstance, new DictionaryKeyValueStore()) as T; + } + + public object GetAdvicedProxy(Type interfaceType, object concreteInstance) + { + return GetAdvicedProxy(interfaceType, concreteInstance, new DictionaryKeyValueStore()); } public T GetAdvicedProxy<T>(T concreteInstance, IKeyValueStore keyValueStore) where T : class { - var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); - var aspectInterceptor = new AdviceInterceptor(_getAspectsForJointPoint, keyValueStore, _aspects, concreteInstance); - return (T)proxyGenerator.CreateInterfaceProxyWithTargetInterface(typeof(T), concreteInstance, aspectInterceptor); ; + return GetAdvicedProxy(typeof (T), concreteInstance, keyValueStore) as T; } + + public object GetAdvicedProxy(Type interfaceType, object concreteInstance, IKeyValueStore keyValueStore) + { + if (!interfaceType.IsInterface) + throw new ArgumentException("need an interface to proxy"); + + var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); + var aspectInterceptor = new AdviceInterceptor(_getAspectsForJointPoint, keyValueStore, _aspects, concreteInstance, interfaceType); + return proxyGenerator.CreateInterfaceProxyWithTargetInterface(interfaceType, concreteInstance, aspectInterceptor); ; + } } } \ No newline at end of file diff --git a/NAdvisorTest/AdvisorTests.cs b/NAdvisorTest/AdvisorTests.cs index 37e3869..30b3249 100644 --- a/NAdvisorTest/AdvisorTests.cs +++ b/NAdvisorTest/AdvisorTests.cs @@ -1,23 +1,34 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Core; namespace NAdvisorTest { [TestClass] public class AdvisorTests { [TestMethod] - public void Default_Construct_Tests() //TODO CD Default Contruct Tests + public void Should_Only_Allow_Interfaces_to_proxy1() { //Given + var advisor = new Advisor(new List<IAspect>()); //Then + MSTestHelper.ShouldThrowException<ArgumentException>(() => advisor.GetAdvicedProxy<Target>(new Target())); + } + + [TestMethod] + public void Should_Only_Allow_Interfaces_to_proxy2() + { + //Given + var advisor = new Advisor(new List<IAspect>()); - //When - throw new Exception("bämm"); + //Then + MSTestHelper.ShouldThrowException<ArgumentException>(() => advisor.GetAdvicedProxy(typeof(Target), new Target())); } + } } diff --git a/NAdvisorTest/MSTestHelper.cs b/NAdvisorTest/MSTestHelper.cs new file mode 100644 index 0000000..ee4e43f --- /dev/null +++ b/NAdvisorTest/MSTestHelper.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + + +namespace NAdvisorTest +{ + public static class MSTestHelper + { + public static void ShouldThrowException<TypeOfException>(Action exceptionThrowingAction) + { + try + { + exceptionThrowingAction(); + } + catch(Exception ex) + { + if(!(ex is TypeOfException)) + { + Assert.Fail("Should throw a different kind of exception"); + } + } + } + } +} diff --git a/NAdvisorTest/NAdvisorTest.csproj b/NAdvisorTest/NAdvisorTest.csproj index 253abbb..5de8aa7 100644 --- a/NAdvisorTest/NAdvisorTest.csproj +++ b/NAdvisorTest/NAdvisorTest.csproj @@ -1,84 +1,85 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{EEE750E7-0D26-4845-8AFA-9617752454A5}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisorTest</RootNamespace> <AssemblyName>NAdvisorTest</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AdvisorTests.cs" /> <Compile Include="AspectEnvironmentDictionaryTests.cs" /> <Compile Include="AspectEnvironmentTests.cs" /> + <Compile Include="MSTestHelper.cs" /> <Compile Include="TestClasses\Target.cs" /> <Compile Include="TestClasses\ITarget.cs" /> <Compile Include="TestClasses\SimpleEventArgs.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SimpleAspectTests.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
6d097f83d2fd458c61fd1656976a9295f3071a74
gitignore for test
diff --git a/.gitignore b/.gitignore index 5d1e67c..7d3fc61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,15 @@ *~ bin obj *.user *.suo *.bak *.sln.cache _ReSharper* */build */test-results *.pidb *.userprefs *.orig *.resharper +TestResults
chrido/NAdvisor
d477e8d21a99e5dae6da8b8e631055ae0ba1a7d2
added resharper to gitignore
diff --git a/.gitignore b/.gitignore index 90e3b00..5d1e67c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,14 @@ *~ bin obj *.user *.suo *.bak *.sln.cache _ReSharper* */build */test-results *.pidb *.userprefs -*.orig \ No newline at end of file +*.orig +*.resharper
chrido/NAdvisor
c45e16b82f6017968505d93e5d83dd57ff82ff63
structuring in modules
diff --git a/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs b/NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs similarity index 98% rename from NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs rename to NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs index b800497..c3c1e86 100644 --- a/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs +++ b/NAdvisor.Contrib.Test/AttributeBasedJointPointDefinitionTests.cs @@ -1,184 +1,182 @@ using System; using System.Collections.Generic; using MbUnit.Framework; using Moq; using NAdvisor; -using NAdvisor.Contrib; using NAdvisor.Core; -namespace NAdvisorTest.AttributeBasedJointPointDefinitionTests +namespace NAdvisor.Contrib.Test { [TestFixture] public class AttributeBasedJointPointDefinitionTests { [Test] public void Should_Intercept_Only_Attributed_Methods() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var aspect = new SimpleAspect(); aspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {aspect, shouldNotBeCalledAspect.Object}); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.Dosomething("hallo"); //When Assert.AreEqual(aspectLog[0], "aspectCalled"); Assert.AreEqual(aspectLog[1], "hallo"); Assert.AreEqual(aspectLog[2], "DoneSomething"); Assert.AreEqual(result, "executed"); Assert.AreEqual(serviceLog[0], "hallo"); shouldNotBeCalledAspect.VerifyAll(); } [Test] public void Should_Order_Aspects_From_Left_To_Right() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var firstAspect = new FirstAspect(); firstAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var secondAspect = new SecondAspect(); secondAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() { shouldNotBeCalledAspect.Object, secondAspect, shouldNotBeCalledAspect.Object, firstAspect }); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.DoMore("muchmore"); shouldNotBeCalledAspect.VerifyAll(); Assert.AreEqual(aspectLog.Count, 4); Assert.AreEqual("FirstAspectBefore", aspectLog[0]); Assert.AreEqual("SecondAspectBefore", aspectLog[1]); Assert.AreEqual("SecondAspectAfter", aspectLog[2]); Assert.AreEqual("FirstAspectAfter", aspectLog[3]); } } public class SimpleAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("aspectCalled"); if (args.Length > 0) { if (args[0] is string) { RaiseDoneSomething((string)args[0]); } } object result = proceedInvocation(args); if (result is string) RaiseDoneSomething((string)result); return "executed"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class FirstAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("FirstAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("FirstAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class SecondAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("SecondAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("SecondAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } - public interface ISimpleService { string Dosomething(string arguments); string DoMore(string more); } public class SimpleService : ISimpleService { public EventHandler<SimpleEventArgs> DoneSomething; [InterceptedBy(typeof(SimpleAspect))] public string Dosomething(string arguments) { RaiseDoneSomething(arguments); return "DoneSomething"; } [InterceptedBy(typeof(FirstAspect), typeof(SecondAspect))] public string DoMore(string more) { RaiseDoneSomething(more); return "more"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index 2df567e..c4fd608 100644 --- a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,71 +1,81 @@ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Gallio, Version=3.1.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\mbUnit\Gallio.dll</HintPath> + </Reference> <Reference Include="MbUnit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> </Reference> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\moq\Moq.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="AttributeBasedJointPointDefinitionTests.cs" /> <Compile Include="CacheConfigurationValidationTest.cs" /> <Compile Include="IMethodInvokesShouldBeCachedClass.cs" /> <Compile Include="MethodInvokesShouldBeCachedClass.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="CachingAspectTest.cs" /> + <Compile Include="SimpleEventArgs.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib.Test/SimpleEventArgs.cs b/NAdvisor.Contrib.Test/SimpleEventArgs.cs new file mode 100644 index 0000000..975098f --- /dev/null +++ b/NAdvisor.Contrib.Test/SimpleEventArgs.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NAdvisor.Contrib.Test +{ + public class SimpleEventArgs : EventArgs + { + public string Message { get; set; } + } +} \ No newline at end of file diff --git a/NAdvisorTest/NAdvisorTest.csproj b/NAdvisorTest/NAdvisorTest.csproj index 581a5e8..65149f5 100644 --- a/NAdvisorTest/NAdvisorTest.csproj +++ b/NAdvisorTest/NAdvisorTest.csproj @@ -1,91 +1,86 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{EEE750E7-0D26-4845-8AFA-9617752454A5}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisorTest</RootNamespace> <AssemblyName>NAdvisorTest</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Gallio, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\Gallio.dll</HintPath> </Reference> <Reference Include="MbUnit, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="AttributeBasedJointPointDefinitionTests.cs" /> <Compile Include="SimpleEventArgs.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SimpleAspectTests.cs" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> - <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> - <Name>NAdvisor.Contrib</Name> - </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
6b6c668c05bc0e7f76d660f83c1b024f95c5621c
added licence
diff --git a/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs b/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs index 8813cc9..c0f0b9e 100644 --- a/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs +++ b/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs @@ -1,32 +1,33 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Contrib.Caching; namespace NAdvisor.Contrib.Test { [TestClass] public class CacheConfigurationValidationTest { [TestMethod] [ExpectedException(typeof(ArgumentException))] public void caching_behavoior_cant_be_defined_twice() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ) .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); } } } diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs index f369244..dc81ce9 100644 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ b/NAdvisor.Contrib.Test/CachingAspectTest.cs @@ -1,55 +1,56 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Contrib.Caching; using NAdvisor.Core; namespace NAdvisor.Contrib.Test { /// <summary> /// Summary description for CachingAspectTest /// </summary> [TestClass] public class CachingAspectTest { [TestMethod] public void TestMethod1() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); } [TestMethod] public void Should_Create_Test_config_for_testing_a_few_methodcalls() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); cc.BuildCachingConfiguration(); } } } diff --git a/NAdvisor.Contrib/Caching/CachingAspect.cs b/NAdvisor.Contrib/Caching/CachingAspect.cs index 55e429d..c3b0552 100644 --- a/NAdvisor.Contrib/Caching/CachingAspect.cs +++ b/NAdvisor.Contrib/Caching/CachingAspect.cs @@ -1,18 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; using NAdvisor.Core; -namespace NAdvisor.Contrib +namespace NAdvisor.Contrib.Caching { public class CachingAspect : IAspect { private string cachingKey = string.Empty; public object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method) { return proceedInvocation(methodArguments); } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingConfig.cs b/NAdvisor.Contrib/Caching/CachingConfig.cs index 1f463f9..8734280 100644 --- a/NAdvisor.Contrib/Caching/CachingConfig.cs +++ b/NAdvisor.Contrib/Caching/CachingConfig.cs @@ -1,62 +1,74 @@ -using System; +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; using System.Reflection; -using System.Text; -namespace NAdvisor.Contrib +namespace NAdvisor.Contrib.Caching { public partial class CachingConfig<TCachedInterface> { private readonly Dictionary<MethodInfo, List<KeyDetermination>> _cachingConfigsForFunction; private int _createKeyCounter; private int _maxArgumentsCounter; public CachingConfig() { _cachingConfigsForFunction = new Dictionary<MethodInfo, List<KeyDetermination>>(); _createKeyCounter = 0; _maxArgumentsCounter = 0; } public CachingKeyCreator<TCachingKey> CreateKey<TCachingKey>() { return new CachingKeyCreator<TCachingKey>(); } public CachingConfig<TCachedInterface> CreateCachingKey(Expression<Action<TCachedInterface>> methodExpression) { _createKeyCounter = 0; _maxArgumentsCounter = 0; var expression = methodExpression as LambdaExpression; var methodCall = expression.Body as MethodCallExpression; if (methodCall == null) throw new ArgumentException("needs a Methodcall on Interface as parameter"); if(_cachingConfigsForFunction.ContainsKey(methodCall.Method)) throw new ArgumentException("Caching behaviour of a Method can't be defined twice"); int argumentCount = methodCall.Arguments.Count; _cachingConfigsForFunction.Add(methodCall.Method, CreateCacheConfigs(methodCall, methodExpression)); return this; } private List<KeyDetermination> CreateCacheConfigs(MethodCallExpression expression, Expression<Action<TCachedInterface>> methodExpression) { var keyDeterminationList = new List<KeyDetermination>(); foreach (Expression argument in expression.Arguments) { keyDeterminationList.Add(new KeyDetermination(){InputType = argument.Type, MethodExpression = methodExpression}); } return keyDeterminationList; } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs b/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs index 8705e6b..e4614de 100644 --- a/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs +++ b/NAdvisor.Contrib/Caching/CachingConfigurationValidation.cs @@ -1,54 +1,66 @@ using System; +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Text; using Castle.DynamicProxy; -namespace NAdvisor.Contrib +namespace NAdvisor.Contrib.Caching { public partial class CachingConfig<TCachedInterface> { public void BuildCachingConfiguration() { foreach (var cachingConfigForFunction in _cachingConfigsForFunction) { CheckConfig(cachingConfigForFunction.Key, cachingConfigForFunction.Value); } } private void CheckConfig(MethodInfo info, List<KeyDetermination> determinations) { CheckIfKeyDeterminationsEqualMethodInfo(info, determinations); foreach (var list in determinations) { Action<TCachedInterface> compile = list.MethodExpression.Compile(); var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); var proxy = (TCachedInterface) proxyGenerator.CreateInterfaceProxyWithoutTarget(typeof (TCachedInterface), new FluentProxy()); compile.Invoke(proxy); // compile.Invoke(); } } private void CheckIfKeyDeterminationsEqualMethodInfo(MethodInfo info, List<KeyDetermination> determinations) { var count = 0; foreach (ParameterInfo parameter in info.GetParameters()) { if (parameter.IsOut) throw new Exception("No out parameters allowed"); if (parameter.ParameterType != determinations[count].InputType) throw new Exception("Parameters in KeyDetermination do not match"); count++; } } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/CachingKeyCreation.cs b/NAdvisor.Contrib/Caching/CachingKeyCreation.cs index abf97c6..b7e973d 100644 --- a/NAdvisor.Contrib/Caching/CachingKeyCreation.cs +++ b/NAdvisor.Contrib/Caching/CachingKeyCreation.cs @@ -1,22 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; using System.Linq.Expressions; -using System.Text; -namespace NAdvisor.Contrib +namespace NAdvisor.Contrib.Caching { public partial class CachingConfig<TCachedInterface> { public class CachingKeyCreator<TChachingKey> { public TFromClass From<TFromClass>(Expression<Func<TFromClass, TChachingKey>> functionToCreateKey) { //TODO add functions for caching return default(TFromClass); } } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/FluentProxy.cs b/NAdvisor.Contrib/Caching/FluentProxy.cs index 473e533..44777d1 100644 --- a/NAdvisor.Contrib/Caching/FluentProxy.cs +++ b/NAdvisor.Contrib/Caching/FluentProxy.cs @@ -1,16 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; using Castle.Core.Interceptor; -namespace NAdvisor.Contrib +namespace NAdvisor.Contrib.Caching { internal class FluentProxy : IInterceptor { public void Intercept(IInvocation invocation) { Type returnType = invocation.Method.ReturnType; } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/Caching/KeyDetermination.cs b/NAdvisor.Contrib/Caching/KeyDetermination.cs index 5f7f415..7ab7cbd 100644 --- a/NAdvisor.Contrib/Caching/KeyDetermination.cs +++ b/NAdvisor.Contrib/Caching/KeyDetermination.cs @@ -1,20 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; using System.Linq.Expressions; -using System.Text; -namespace NAdvisor.Contrib +namespace NAdvisor.Contrib.Caching { public partial class CachingConfig<TCachedInterface> { public class KeyDetermination { public Type InputType { get; set; } public Type KeyType { get; set; } public object CalculationFunction { get; set; } public Expression<Action<TCachedInterface>> MethodExpression { get; set; } } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index f96e19e..41ce89c 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,84 +1,84 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="CachingAspect.cs" /> - <Compile Include="CachingConfig.cs" /> - <Compile Include="CachingKeyCreation.cs" /> - <Compile Include="CachingConfigurationValidation.cs" /> - <Compile Include="FluentProxy.cs" /> + <Compile Include="Caching\CachingAspect.cs" /> + <Compile Include="Caching\CachingConfig.cs" /> + <Compile Include="Caching\CachingKeyCreation.cs" /> + <Compile Include="Caching\CachingConfigurationValidation.cs" /> + <Compile Include="Caching\FluentProxy.cs" /> <Compile Include="InterceptedBy\InterceptedByAttribute.cs" /> <Compile Include="InterceptedBy\JointPointDefinition.cs" /> - <Compile Include="KeyDetermination.cs" /> + <Compile Include="Caching\KeyDetermination.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
c400c980628386490fa103ea94cb1cf6cb52a479
namespaces in contrib project
diff --git a/NAdvisor.Contrib/InterceptedBy/InterceptedByAttribute.cs b/NAdvisor.Contrib/InterceptedBy/InterceptedByAttribute.cs index 1849ef4..c9f9d0b 100644 --- a/NAdvisor.Contrib/InterceptedBy/InterceptedByAttribute.cs +++ b/NAdvisor.Contrib/InterceptedBy/InterceptedByAttribute.cs @@ -1,30 +1,30 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; -namespace NAdvisor +namespace NAdvisor.Contrib { public class InterceptedByAttribute : Attribute { private readonly Type[] _types; public InterceptedByAttribute(params Type[] types) { _types = types; } public Type[] Types { get { return _types; } } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs b/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs index ca553a9..14e068b 100644 --- a/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs +++ b/NAdvisor.Contrib/InterceptedBy/JointPointDefinition.cs @@ -1,50 +1,50 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using NAdvisor.Core; -namespace NAdvisor +namespace NAdvisor.Contrib { public class JointPointDefinition { public static IList<IAspect> AttributeBasedJointPointDefinition(Type type, IAspectEnvironment methodInfo, IList<IAspect> availableAspects) { object[] customAttributes = methodInfo.ConcreteMethodInfo.GetCustomAttributes(typeof(InterceptedByAttribute), true); if (customAttributes.Length == 0) return new List<IAspect>(); var takenAspects = new List<IAspect>(); var attribute = customAttributes[0] as InterceptedByAttribute; if (attribute != null) { foreach (Type aspectTypes in attribute.Types) //Keeping order of Aspects { foreach (IAspect aspect in availableAspects) { if(aspect.GetType() == aspectTypes) //return the Aspect if the Types Match { takenAspects.Add(aspect); break; } } } } return takenAspects; } } -} +} \ No newline at end of file diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index 0b8ecd1..f96e19e 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,82 +1,84 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CachingAspect.cs" /> <Compile Include="CachingConfig.cs" /> <Compile Include="CachingKeyCreation.cs" /> <Compile Include="CachingConfigurationValidation.cs" /> <Compile Include="FluentProxy.cs" /> + <Compile Include="InterceptedBy\InterceptedByAttribute.cs" /> + <Compile Include="InterceptedBy\JointPointDefinition.cs" /> <Compile Include="KeyDetermination.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor/NAdvisor.Core.csproj b/NAdvisor/NAdvisor.Core.csproj index 927c847..477eed8 100644 --- a/NAdvisor/NAdvisor.Core.csproj +++ b/NAdvisor/NAdvisor.Core.csproj @@ -1,82 +1,80 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{924BDC9D-7752-496C-B0F5-379F8D390C60}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Core</RootNamespace> <AssemblyName>NAdvisor.Core</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AdviceInterceptor.cs" /> <Compile Include="Advisor.cs" /> <Compile Include="Implementation\AspectEnvironment.cs" /> <Compile Include="Interfaces\IAspectEnvironment.cs" /> <Compile Include="Interfaces\IAspect.cs" /> <Compile Include="Interfaces\IKeyValueStore.cs" /> - <Compile Include="InterceptedByAttribute.cs" /> - <Compile Include="JointPointDefinition.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs b/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs index 9d510c4..b800497 100644 --- a/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs +++ b/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs @@ -1,183 +1,184 @@ using System; using System.Collections.Generic; using MbUnit.Framework; using Moq; using NAdvisor; +using NAdvisor.Contrib; using NAdvisor.Core; namespace NAdvisorTest.AttributeBasedJointPointDefinitionTests { [TestFixture] public class AttributeBasedJointPointDefinitionTests { [Test] public void Should_Intercept_Only_Attributed_Methods() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var aspect = new SimpleAspect(); aspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {aspect, shouldNotBeCalledAspect.Object}); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.Dosomething("hallo"); //When Assert.AreEqual(aspectLog[0], "aspectCalled"); Assert.AreEqual(aspectLog[1], "hallo"); Assert.AreEqual(aspectLog[2], "DoneSomething"); Assert.AreEqual(result, "executed"); Assert.AreEqual(serviceLog[0], "hallo"); shouldNotBeCalledAspect.VerifyAll(); } [Test] public void Should_Order_Aspects_From_Left_To_Right() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var firstAspect = new FirstAspect(); firstAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var secondAspect = new SecondAspect(); secondAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() { shouldNotBeCalledAspect.Object, secondAspect, shouldNotBeCalledAspect.Object, firstAspect }); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.DoMore("muchmore"); shouldNotBeCalledAspect.VerifyAll(); Assert.AreEqual(aspectLog.Count, 4); Assert.AreEqual("FirstAspectBefore", aspectLog[0]); Assert.AreEqual("SecondAspectBefore", aspectLog[1]); Assert.AreEqual("SecondAspectAfter", aspectLog[2]); Assert.AreEqual("FirstAspectAfter", aspectLog[3]); } } public class SimpleAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("aspectCalled"); if (args.Length > 0) { if (args[0] is string) { RaiseDoneSomething((string)args[0]); } } object result = proceedInvocation(args); if (result is string) RaiseDoneSomething((string)result); return "executed"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class FirstAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("FirstAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("FirstAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class SecondAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("SecondAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("SecondAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public interface ISimpleService { string Dosomething(string arguments); string DoMore(string more); } public class SimpleService : ISimpleService { public EventHandler<SimpleEventArgs> DoneSomething; [InterceptedBy(typeof(SimpleAspect))] public string Dosomething(string arguments) { RaiseDoneSomething(arguments); return "DoneSomething"; } [InterceptedBy(typeof(FirstAspect), typeof(SecondAspect))] public string DoMore(string more) { RaiseDoneSomething(more); return "more"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } } diff --git a/NAdvisorTest/NAdvisorTest.csproj b/NAdvisorTest/NAdvisorTest.csproj index 7791b15..581a5e8 100644 --- a/NAdvisorTest/NAdvisorTest.csproj +++ b/NAdvisorTest/NAdvisorTest.csproj @@ -1,87 +1,91 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{EEE750E7-0D26-4845-8AFA-9617752454A5}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisorTest</RootNamespace> <AssemblyName>NAdvisorTest</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Gallio, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\Gallio.dll</HintPath> </Reference> <Reference Include="MbUnit, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AttributeBasedJointPointDefinitionTests.cs" /> <Compile Include="SimpleEventArgs.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SimpleAspectTests.cs" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> + <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> + <Name>NAdvisor.Contrib</Name> + </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
f2b7635cd57c4c996f0a518373b9daf58bf0f452
refactoring
diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs index 5debf6f..f369244 100644 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ b/NAdvisor.Contrib.Test/CachingAspectTest.cs @@ -1,54 +1,55 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; +using NAdvisor.Core; namespace NAdvisor.Contrib.Test { /// <summary> /// Summary description for CachingAspectTest /// </summary> [TestClass] public class CachingAspectTest { [TestMethod] public void TestMethod1() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); } [TestMethod] public void Should_Create_Test_config_for_testing_a_few_methodcalls() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); cc.BuildCachingConfiguration(); } } } diff --git a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index df2ca71..2df567e 100644 --- a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,71 +1,71 @@ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="MbUnit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> </Reference> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CacheConfigurationValidationTest.cs" /> <Compile Include="IMethodInvokesShouldBeCachedClass.cs" /> <Compile Include="MethodInvokesShouldBeCachedClass.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="CachingAspectTest.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> - <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> + <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor</Name> + <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib/CachingAspect.cs b/NAdvisor.Contrib/CachingAspect.cs index 89e71fa..55e429d 100644 --- a/NAdvisor.Contrib/CachingAspect.cs +++ b/NAdvisor.Contrib/CachingAspect.cs @@ -1,17 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using NAdvisor.Core; namespace NAdvisor.Contrib { public class CachingAspect : IAspect { private string cachingKey = string.Empty; public object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method) { return proceedInvocation(methodArguments); } } } diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index 02dcfad..0b8ecd1 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,82 +1,82 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CachingAspect.cs" /> <Compile Include="CachingConfig.cs" /> <Compile Include="CachingKeyCreation.cs" /> <Compile Include="CachingConfigurationValidation.cs" /> <Compile Include="FluentProxy.cs" /> <Compile Include="KeyDetermination.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> + <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor</Name> + <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.sln b/NAdvisor.sln index f2bb159..9b0e4dd 100644 --- a/NAdvisor.sln +++ b/NAdvisor.sln @@ -1,47 +1,47 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor", "NAdvisor\NAdvisor.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Core", "NAdvisor\NAdvisor.Core.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest", "NAdvisorTest\NAdvisorTest.csproj", "{EEE750E7-0D26-4845-8AFA-9617752454A5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Test", "NAdvisor.Contrib.Test\NAdvisor.Contrib.Test.csproj", "{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CF09232-5830-459C-9115-28284BA0B6A4}" ProjectSection(SolutionItems) = preProject LocalTestRun.testrunconfig = LocalTestRun.testrunconfig NAdvisor.vsmdi = NAdvisor.vsmdi EndProjectSection EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = NAdvisor.vsmdi EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.Build.0 = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.ActiveCfg = Release|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.Build.0 = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.Build.0 = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/NAdvisor/AdviceInterceptor.cs b/NAdvisor/AdviceInterceptor.cs new file mode 100644 index 0000000..a94ea53 --- /dev/null +++ b/NAdvisor/AdviceInterceptor.cs @@ -0,0 +1,96 @@ +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Castle.Core.Interceptor; + +namespace NAdvisor.Core +{ + internal class AdviceInterceptor : IInterceptor + { + private readonly Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspects; + private readonly IList<IAspect> _availableAspects; + private readonly object _concreteInstance; + + public AdviceInterceptor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IEnumerable<IAspect> availableAspects, object concreteInstance) + { + _availableAspects = new List<IAspect>(availableAspects); + _getAspects = getAspects; + _concreteInstance = concreteInstance; + } + + public void Intercept(IInvocation invocation) + { + IAspectEnvironment environment = CreateEnvironment(invocation); + var aspectList = _getAspects.Invoke(invocation.InvocationTarget.GetType(), environment, new List<IAspect>(_availableAspects)); + invocation.ReturnValue = CreateNextLevel(invocation, aspectList, environment)(invocation.Arguments); + } + + private AspectEnvironment CreateEnvironment(IInvocation invocation) + { + var environment = new AspectEnvironment(); + environment.ConcreteMethodInfo = GetMethodInfoFromConcreteType(invocation.Method, _concreteInstance); + environment.ConcreteObject = _concreteInstance; + environment.InterfaceMethodInfo = invocation.Method; + + return environment; + } + + /// <summary> + /// Based on the given <paramref name="methodInfo"/> the same Method on the concreate Implementation is searched + /// Because the concreteInstance must have this Method since it implements the interface theire is no error handling necessary + /// </summary> + /// <param name="methodInfo"></param> + /// <param name="concreteInstance"></param> + /// <returns></returns> + private MethodInfo GetMethodInfoFromConcreteType(MethodInfo methodInfo, object concreteInstance) + { + //Could be cached ... + + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); + Type[] allTypes = new Type[parameterInfos.Length]; + for(int i = 0; i < allTypes.Length; i++) + allTypes[i] = parameterInfos[i].ParameterType; + + return concreteInstance.GetType().GetMethod(methodInfo.Name, allTypes); + } + + public Func<object[], object> CreateNextLevel(IInvocation invocation, IEnumerable<IAspect> restOfAspects, IAspectEnvironment method) + { + return args => + { + var nextAspect = restOfAspects.FirstOrDefault(); + if (nextAspect != null) + { + //Recursion + return nextAspect.Execute( + CreateNextLevel(invocation, restOfAspects.Skip(1), method), + args, method + ); + } + + for (int i = 0; i < args.Length; i++) + { + invocation.SetArgumentValue(i, args[i]); + } + //Enter the concrete Method + invocation.Proceed(); + return invocation.ReturnValue; + }; + } + } +} \ No newline at end of file diff --git a/NAdvisor/Advisor.cs b/NAdvisor/Advisor.cs index f06f6af..0967d69 100644 --- a/NAdvisor/Advisor.cs +++ b/NAdvisor/Advisor.cs @@ -1,141 +1,57 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Castle.Core.Interceptor; using Castle.DynamicProxy; -namespace NAdvisor +namespace NAdvisor.Core { public class Advisor { private readonly Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspectsForJointPoint; private readonly IList<IAspect> _aspects; public Advisor(IAspect aspect) { _aspects = new List<IAspect>(){aspect}; _getAspectsForJointPoint = (type, methodInfo, availableAspects) => _aspects; } public Advisor(IList<IAspect> aspects) { _aspects = aspects; _getAspectsForJointPoint = (type, methodInfo, availableAspects) => _aspects; } public Advisor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspectsForJointPoint, IAspect aspect) { _getAspectsForJointPoint = getAspectsForJointPoint; _aspects = new List<IAspect>() {aspect}; } public Advisor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspectsForJointPoint, IList<IAspect> aspects) { _getAspectsForJointPoint = getAspectsForJointPoint; _aspects = aspects; } public T GetAdvicedProxy<T>(T concreateInstance) { var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); var aspectInterceptor = new AdviceInterceptor(_getAspectsForJointPoint, _aspects, concreateInstance); return (T)proxyGenerator.CreateInterfaceProxyWithTargetInterface(typeof(T), concreateInstance, aspectInterceptor); ; } } - - - public interface IAspect - { - object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method); - } - - public class AdviceInterceptor : IInterceptor - { - private readonly Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspects; - private readonly IList<IAspect> _availableAspects; - private readonly object _concreteInstance; - - public AdviceInterceptor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IEnumerable<IAspect> availableAspects, object concreteInstance) - { - _availableAspects = new List<IAspect>(availableAspects); - _getAspects = getAspects; - _concreteInstance = concreteInstance; - } - - public void Intercept(IInvocation invocation) - { - IAspectEnvironment environment = CreateEnvironment(invocation); - var aspectList = _getAspects.Invoke(invocation.InvocationTarget.GetType(), environment, new List<IAspect>(_availableAspects)); - invocation.ReturnValue = CreateNextLevel(invocation, aspectList, environment)(invocation.Arguments); - } - - private AspectEnvironment CreateEnvironment(IInvocation invocation) - { - var environment = new AspectEnvironment(); - environment.ConcreteMethodInfo = GetMethodInfoFromConcreteType(invocation.Method, _concreteInstance); - environment.ConcreteObject = _concreteInstance; - environment.InterfaceMethodInfo = invocation.Method; - - return environment; - } - - /// <summary> - /// Based on the given <paramref name="methodInfo"/> the same Method on the concreate Implementation is searched - /// Because the concreteInstance must have this Method since it implements the interface theire is no error handling necessary - /// </summary> - /// <param name="methodInfo"></param> - /// <param name="concreteInstance"></param> - /// <returns></returns> - private MethodInfo GetMethodInfoFromConcreteType(MethodInfo methodInfo, object concreteInstance) - { - //Could be cached ... - - ParameterInfo[] parameterInfos = methodInfo.GetParameters(); - Type[] allTypes = new Type[parameterInfos.Length]; - for(int i = 0; i < allTypes.Length; i++) - allTypes[i] = parameterInfos[i].ParameterType; - - return concreteInstance.GetType().GetMethod(methodInfo.Name, allTypes); - } - - public Func<object[], object> CreateNextLevel(IInvocation invocation, IEnumerable<IAspect> restOfAspects, IAspectEnvironment method) - { - return args => - { - var nextAspect = restOfAspects.FirstOrDefault(); - if (nextAspect != null) - { - //Recursion - return nextAspect.Execute( - CreateNextLevel(invocation, restOfAspects.Skip(1), method), - args, method - ); - } - - for (int i = 0; i < args.Length; i++) - { - invocation.SetArgumentValue(i, args[i]); - } - //Enter the concrete Method - invocation.Proceed(); - return invocation.ReturnValue; - }; - } - } - -} +} \ No newline at end of file diff --git a/NAdvisor/AspectEnvironment.cs b/NAdvisor/Implementation/AspectEnvironment.cs similarity index 73% rename from NAdvisor/AspectEnvironment.cs rename to NAdvisor/Implementation/AspectEnvironment.cs index 7b288dd..1d71e5c 100644 --- a/NAdvisor/AspectEnvironment.cs +++ b/NAdvisor/Implementation/AspectEnvironment.cs @@ -1,80 +1,58 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Reflection; using System.Collections.Generic; -namespace NAdvisor +namespace NAdvisor.Core { - public interface IAspectEnvironment - { - /// <summary> - /// Method Info of the Concrete Implementation - /// </summary> - MethodInfo ConcreteMethodInfo { get; } - - /// <summary> - /// Method Info of the Interface Method - /// </summary> - MethodInfo InterfaceMethodInfo { get;} - - /// <summary> - /// Concrete Object which implements the interface which is proxied - /// </summary> - object ConcreteObject { get; } - - T TryGetValue<T>(string key); - - void SetValue(string key, object value); - } - internal class AspectEnvironment : IAspectEnvironment { private readonly Dictionary<string, object> _proxyDict; private readonly object _syncRoot = new object(); public AspectEnvironment() { _proxyDict = new Dictionary<string, object>(); } public MethodInfo ConcreteMethodInfo { get; set; } public MethodInfo InterfaceMethodInfo { get; set; } public object ConcreteObject { get; set; } public T TryGetValue<T>(string key) { lock (_syncRoot) { if (_proxyDict.ContainsKey(key)) { var value = _proxyDict[key]; return value is T ? (T) value : default(T); } return default(T); } } public void SetValue(string key, object value) { lock (_syncRoot) { _proxyDict[key] = value; } } } -} +} \ No newline at end of file diff --git a/NAdvisor/Interfaces/IAspect.cs b/NAdvisor/Interfaces/IAspect.cs new file mode 100644 index 0000000..244eca2 --- /dev/null +++ b/NAdvisor/Interfaces/IAspect.cs @@ -0,0 +1,23 @@ +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + +namespace NAdvisor.Core +{ + public interface IAspect + { + object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method); + } +} \ No newline at end of file diff --git a/NAdvisor/Interfaces/IAspectEnvironment.cs b/NAdvisor/Interfaces/IAspectEnvironment.cs new file mode 100644 index 0000000..2c5bd15 --- /dev/null +++ b/NAdvisor/Interfaces/IAspectEnvironment.cs @@ -0,0 +1,26 @@ +using System.Reflection; + +namespace NAdvisor.Core +{ + public interface IAspectEnvironment + { + /// <summary> + /// Method Info of the Concrete Implementation + /// </summary> + MethodInfo ConcreteMethodInfo { get; } + + /// <summary> + /// Method Info of the Interface Method + /// </summary> + MethodInfo InterfaceMethodInfo { get;} + + /// <summary> + /// Concrete Object which implements the interface which is proxied + /// </summary> + object ConcreteObject { get; } + + T TryGetValue<T>(string key); + + void SetValue(string key, object value); + } +} \ No newline at end of file diff --git a/NAdvisor/Interfaces/IKeyValueStore.cs b/NAdvisor/Interfaces/IKeyValueStore.cs new file mode 100644 index 0000000..0756423 --- /dev/null +++ b/NAdvisor/Interfaces/IKeyValueStore.cs @@ -0,0 +1,41 @@ +// Copyright 2009 Christoph Doblander +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace NAdvisor.Core +{ + public interface IKeyValueStore + { + void SetValue(string key, object value); + + /// <summary> + /// Behaviour: does not throw an exception + /// + /// if not found the default value is returned + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key"></param> + /// <returns></returns> + T TryGetValue<T>(string key); + + /// <summary> + /// Behaviour + /// + /// Throws exception if key is not found and does not implements the fiven type + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="key"></param> + /// <returns></returns> + T GetValue<T>(string key); + } +} \ No newline at end of file diff --git a/NAdvisor/JointPointDefinition.cs b/NAdvisor/JointPointDefinition.cs index 0f84d9e..ca553a9 100644 --- a/NAdvisor/JointPointDefinition.cs +++ b/NAdvisor/JointPointDefinition.cs @@ -1,49 +1,50 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; +using NAdvisor.Core; namespace NAdvisor { public class JointPointDefinition { public static IList<IAspect> AttributeBasedJointPointDefinition(Type type, IAspectEnvironment methodInfo, IList<IAspect> availableAspects) { object[] customAttributes = methodInfo.ConcreteMethodInfo.GetCustomAttributes(typeof(InterceptedByAttribute), true); if (customAttributes.Length == 0) return new List<IAspect>(); var takenAspects = new List<IAspect>(); var attribute = customAttributes[0] as InterceptedByAttribute; if (attribute != null) { foreach (Type aspectTypes in attribute.Types) //Keeping order of Aspects { foreach (IAspect aspect in availableAspects) { if(aspect.GetType() == aspectTypes) //return the Aspect if the Types Match { takenAspects.Add(aspect); break; } } } } return takenAspects; } } } diff --git a/NAdvisor/NAdvisor.csproj b/NAdvisor/NAdvisor.Core.csproj similarity index 89% rename from NAdvisor/NAdvisor.csproj rename to NAdvisor/NAdvisor.Core.csproj index af434dd..927c847 100644 --- a/NAdvisor/NAdvisor.csproj +++ b/NAdvisor/NAdvisor.Core.csproj @@ -1,78 +1,82 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{924BDC9D-7752-496C-B0F5-379F8D390C60}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>NAdvisor</RootNamespace> - <AssemblyName>NAdvisor</AssemblyName> + <RootNamespace>NAdvisor.Core</RootNamespace> + <AssemblyName>NAdvisor.Core</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="AdviceInterceptor.cs" /> <Compile Include="Advisor.cs" /> - <Compile Include="AspectEnvironment.cs" /> + <Compile Include="Implementation\AspectEnvironment.cs" /> + <Compile Include="Interfaces\IAspectEnvironment.cs" /> + <Compile Include="Interfaces\IAspect.cs" /> + <Compile Include="Interfaces\IKeyValueStore.cs" /> <Compile Include="InterceptedByAttribute.cs" /> <Compile Include="JointPointDefinition.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor/NAdvisor.Core.csproj.resharper b/NAdvisor/NAdvisor.Core.csproj.resharper new file mode 100644 index 0000000..989ae01 --- /dev/null +++ b/NAdvisor/NAdvisor.Core.csproj.resharper @@ -0,0 +1,5 @@ +<Configuration> + <NamespaceFolders> + <SkipFolder>924BDC9D-7752-496C-B0F5-379F8D390C60/d:Interfaces</SkipFolder> + </NamespaceFolders> +</Configuration> \ No newline at end of file diff --git a/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs b/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs index fe1f01c..9d510c4 100644 --- a/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs +++ b/NAdvisorTest/AttributeBasedJointPointDefinitionTests.cs @@ -1,182 +1,183 @@ using System; using System.Collections.Generic; using MbUnit.Framework; using Moq; using NAdvisor; +using NAdvisor.Core; namespace NAdvisorTest.AttributeBasedJointPointDefinitionTests { [TestFixture] public class AttributeBasedJointPointDefinitionTests { [Test] public void Should_Intercept_Only_Attributed_Methods() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var aspect = new SimpleAspect(); aspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {aspect, shouldNotBeCalledAspect.Object}); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.Dosomething("hallo"); //When Assert.AreEqual(aspectLog[0], "aspectCalled"); Assert.AreEqual(aspectLog[1], "hallo"); Assert.AreEqual(aspectLog[2], "DoneSomething"); Assert.AreEqual(result, "executed"); Assert.AreEqual(serviceLog[0], "hallo"); shouldNotBeCalledAspect.VerifyAll(); } [Test] public void Should_Order_Aspects_From_Left_To_Right() { var aspectLog = new List<string>(); var serviceLog = new List<string>(); //Given var firstAspect = new FirstAspect(); firstAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var secondAspect = new SecondAspect(); secondAspect.DoneSomething += (obj, ea) => aspectLog.Add(ea.Message); var simpleService = new SimpleService(); simpleService.DoneSomething += (obj, ea) => serviceLog.Add(ea.Message); var shouldNotBeCalledAspect = new Mock<IAspect>(MockBehavior.Strict); var advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() { shouldNotBeCalledAspect.Object, secondAspect, shouldNotBeCalledAspect.Object, firstAspect }); var myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = myService.DoMore("muchmore"); shouldNotBeCalledAspect.VerifyAll(); Assert.AreEqual(aspectLog.Count, 4); Assert.AreEqual("FirstAspectBefore", aspectLog[0]); Assert.AreEqual("SecondAspectBefore", aspectLog[1]); Assert.AreEqual("SecondAspectAfter", aspectLog[2]); Assert.AreEqual("FirstAspectAfter", aspectLog[3]); } } public class SimpleAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("aspectCalled"); if (args.Length > 0) { if (args[0] is string) { RaiseDoneSomething((string)args[0]); } } object result = proceedInvocation(args); if (result is string) RaiseDoneSomething((string)result); return "executed"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class FirstAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("FirstAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("FirstAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public class SecondAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { RaiseDoneSomething("SecondAspectBefore"); object result = proceedInvocation(args); RaiseDoneSomething("SecondAspectAfter"); return result; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public interface ISimpleService { string Dosomething(string arguments); string DoMore(string more); } public class SimpleService : ISimpleService { public EventHandler<SimpleEventArgs> DoneSomething; [InterceptedBy(typeof(SimpleAspect))] public string Dosomething(string arguments) { RaiseDoneSomething(arguments); return "DoneSomething"; } [InterceptedBy(typeof(FirstAspect), typeof(SecondAspect))] public string DoMore(string more) { RaiseDoneSomething(more); return "more"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } } diff --git a/NAdvisorTest/NAdvisorTest.csproj b/NAdvisorTest/NAdvisorTest.csproj index e0b9a6a..7791b15 100644 --- a/NAdvisorTest/NAdvisorTest.csproj +++ b/NAdvisorTest/NAdvisorTest.csproj @@ -1,87 +1,87 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{EEE750E7-0D26-4845-8AFA-9617752454A5}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisorTest</RootNamespace> <AssemblyName>NAdvisorTest</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <SccProjectName> </SccProjectName> <SccLocalPath> </SccLocalPath> <SccAuxPath> </SccAuxPath> <SccProvider> </SccProvider> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Gallio, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\Gallio.dll</HintPath> </Reference> <Reference Include="MbUnit, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AttributeBasedJointPointDefinitionTests.cs" /> <Compile Include="SimpleEventArgs.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SimpleAspectTests.cs" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> + <ProjectReference Include="..\NAdvisor\NAdvisor.Core.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> - <Name>NAdvisor</Name> + <Name>NAdvisor.Core</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisorTest/SimpleAspectTests.cs b/NAdvisorTest/SimpleAspectTests.cs index c8858a9..2cd2f49 100644 --- a/NAdvisorTest/SimpleAspectTests.cs +++ b/NAdvisorTest/SimpleAspectTests.cs @@ -1,79 +1,79 @@ using System; using System.Collections.Generic; using MbUnit.Framework; -using NAdvisor; +using NAdvisor.Core; namespace NAdvisorTest.SimpleAspectTests { [TestFixture] public class SimpleAspectTests { [Test] public void Should_Intercept_By_Aspects() { //Given var results = new List<string>(); var simpleAspect = new SimpleAspect(); var simpleService = new SimpleService(); simpleAspect.DoneSomething += (sender, args) => results.Add(args.Message); var advisor = new Advisor(new List<IAspect>() {simpleAspect}); var service = advisor.GetAdvicedProxy<ISimpleService>(simpleService); //Then var result = service.DoSomething("hllo"); //When Assert.AreEqual("executed", result); Assert.AreEqual("hllo", results[0]); Assert.AreEqual("donesomething", results[1]); } } public class SimpleAspect : IAspect { public EventHandler<SimpleEventArgs> DoneSomething; public object Execute(Func<object[], object> proceedInvocation, object[] args, IAspectEnvironment method) { if(args.Length > 0) { if(args[0] is string) { RaiseDoneSomething((string)args[0]); } } object result = proceedInvocation(args); if (result is string) RaiseDoneSomething((string) result); return "executed"; } private void RaiseDoneSomething(string doneSomething) { if (DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs() { Message = doneSomething }); } } public interface ISimpleService { string DoSomething(string somethingTodo); } public class SimpleService : ISimpleService { public EventHandler<SimpleEventArgs> DoneSomething; public string DoSomething(string somethingTodo) { if(DoneSomething != null) DoneSomething.Invoke(this, new SimpleEventArgs(){Message = somethingTodo}); return "donesomething"; } } }
chrido/NAdvisor
9f6f354d70009fb5eb45d0e5b0ac8fb61f522db7
caching configuration validation
diff --git a/NAdvisor.Contrib/CachingConfigurationValidation.cs b/NAdvisor.Contrib/CachingConfigurationValidation.cs index f753289..8705e6b 100644 --- a/NAdvisor.Contrib/CachingConfigurationValidation.cs +++ b/NAdvisor.Contrib/CachingConfigurationValidation.cs @@ -1,46 +1,54 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; +using Castle.DynamicProxy; namespace NAdvisor.Contrib { public partial class CachingConfig<TCachedInterface> { public void BuildCachingConfiguration() { foreach (var cachingConfigForFunction in _cachingConfigsForFunction) { CheckConfig(cachingConfigForFunction.Key, cachingConfigForFunction.Value); } } private void CheckConfig(MethodInfo info, List<KeyDetermination> determinations) { CheckIfKeyDeterminationsEqualMethodInfo(info, determinations); foreach (var list in determinations) { Action<TCachedInterface> compile = list.MethodExpression.Compile(); + var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); + var proxy = (TCachedInterface) proxyGenerator.CreateInterfaceProxyWithoutTarget(typeof (TCachedInterface), new FluentProxy()); + + compile.Invoke(proxy); + + + // compile.Invoke(); } } private void CheckIfKeyDeterminationsEqualMethodInfo(MethodInfo info, List<KeyDetermination> determinations) { var count = 0; foreach (ParameterInfo parameter in info.GetParameters()) { if (parameter.IsOut) throw new Exception("No out parameters allowed"); if (parameter.ParameterType != determinations[count].InputType) throw new Exception("Parameters in KeyDetermination do not match"); count++; } } } } diff --git a/NAdvisor.Contrib/CachingKeyCreation.cs b/NAdvisor.Contrib/CachingKeyCreation.cs index 547bf8c..abf97c6 100644 --- a/NAdvisor.Contrib/CachingKeyCreation.cs +++ b/NAdvisor.Contrib/CachingKeyCreation.cs @@ -1,22 +1,22 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace NAdvisor.Contrib { public partial class CachingConfig<TCachedInterface> { public class CachingKeyCreator<TChachingKey> { - public TFromClass From<TFromClass>(Func<TFromClass, TChachingKey> functionToCreateKey) + public TFromClass From<TFromClass>(Expression<Func<TFromClass, TChachingKey>> functionToCreateKey) { //TODO add functions for caching return default(TFromClass); } } } } diff --git a/NAdvisor.Contrib/FluentProxy.cs b/NAdvisor.Contrib/FluentProxy.cs index 2bb525c..473e533 100644 --- a/NAdvisor.Contrib/FluentProxy.cs +++ b/NAdvisor.Contrib/FluentProxy.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Castle.Core.Interceptor; namespace NAdvisor.Contrib { internal class FluentProxy : IInterceptor { public void Intercept(IInvocation invocation) { - invocation.Proceed(); + Type returnType = invocation.Method.ReturnType; } } }
chrido/NAdvisor
71ad6faa47d8f37dee67ed193d50caad22901303
new filestructure
diff --git a/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs b/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs new file mode 100644 index 0000000..8813cc9 --- /dev/null +++ b/NAdvisor.Contrib.Test/CacheConfigurationValidationTest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace NAdvisor.Contrib.Test +{ + [TestClass] + public class CacheConfigurationValidationTest + { + [TestMethod] + [ExpectedException(typeof(ArgumentException))] + public void caching_behavoior_cant_be_defined_twice() + { + var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); + cc + .CreateCachingKey( + cck => cck.AwfulLongCacheAbleComputation( + cc.CreateKey<int>().From<string>(value => value.GetHashCode() + ) + ) + ) + .CreateCachingKey( + cck => cck.AwfulLongCacheAbleComputation( + cc.CreateKey<int>().From<string>(value => value.GetHashCode() + ) + ) + ); + } + } +} diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs index 6a88064..5debf6f 100644 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ b/NAdvisor.Contrib.Test/CachingAspectTest.cs @@ -1,81 +1,54 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NAdvisor.Contrib.Test { /// <summary> /// Summary description for CachingAspectTest /// </summary> [TestClass] public class CachingAspectTest { [TestMethod] public void TestMethod1() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); } [TestMethod] - [ExpectedException(typeof(ArgumentException))] - public void caching_behavoior_cant_be_defined_twice() + public void Should_Create_Test_config_for_testing_a_few_methodcalls() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( - cck => cck.AwfulLongCacheAbleComputation( - cc.CreateKey<int>().From<string>(value => value.GetHashCode() - ) - ) - ) - .CreateCachingKey( - cck => cck.AwfulLongCacheAbleComputation( - cc.CreateKey<int>().From<string>(value => value.GetHashCode() - ) - ) + cck => cck.AwfulLongCacheAbleComputation( + cc.CreateKey<int>().From<string>(value => value.GetHashCode() + ) + ) ); - } - } - - public interface IMethodInvokesShouldBeCachedClass - { - int AwfulLongCacheAbleComputation(string inputParameter); - } - - public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass - { - - public int AwfulLongCacheAbleComputation(string inputParameter) - { - int count = 0; - foreach (char c in inputParameter.ToCharArray()) - { - count += (int)c; - } - - return count; + cc.BuildCachingConfiguration(); } } - } diff --git a/NAdvisor.Contrib.Test/IMethodInvokesShouldBeCachedClass.cs b/NAdvisor.Contrib.Test/IMethodInvokesShouldBeCachedClass.cs new file mode 100644 index 0000000..630ea5f --- /dev/null +++ b/NAdvisor.Contrib.Test/IMethodInvokesShouldBeCachedClass.cs @@ -0,0 +1,9 @@ +namespace NAdvisor.Contrib.Test +{ + public interface IMethodInvokesShouldBeCachedClass + { + int AwfulLongCacheAbleComputation(string inputParameter); + + string IllegalMethodWithOut(out string inputParam); + } +} \ No newline at end of file diff --git a/NAdvisor.Contrib.Test/MethodInvokesShouldBeCachedClass.cs b/NAdvisor.Contrib.Test/MethodInvokesShouldBeCachedClass.cs new file mode 100644 index 0000000..2163b1a --- /dev/null +++ b/NAdvisor.Contrib.Test/MethodInvokesShouldBeCachedClass.cs @@ -0,0 +1,24 @@ +namespace NAdvisor.Contrib.Test +{ + public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass + { + + public int AwfulLongCacheAbleComputation(string inputParameter) + { + int count = 0; + + foreach (char c in inputParameter.ToCharArray()) + { + count += (int)c; + } + + return count; + } + + public string IllegalMethodWithOut(out string inputParam) + { + inputParam = "test"; + return "bammoida"; + } + } +} \ No newline at end of file diff --git a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index 3b338e3..df2ca71 100644 --- a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,62 +1,71 @@ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="MbUnit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> + </Reference> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="CacheConfigurationValidationTest.cs" /> + <Compile Include="IMethodInvokesShouldBeCachedClass.cs" /> + <Compile Include="MethodInvokesShouldBeCachedClass.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="CachingAspectTest.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib/CachingConfig.cs b/NAdvisor.Contrib/CachingConfig.cs index 92d831f..1f463f9 100644 --- a/NAdvisor.Contrib/CachingConfig.cs +++ b/NAdvisor.Contrib/CachingConfig.cs @@ -1,60 +1,62 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; namespace NAdvisor.Contrib { - public class CachingConfig<TCachedInterface> + public partial class CachingConfig<TCachedInterface> { - private readonly Dictionary<MethodInfo, object> _collectedCachingConfigsForInterface; + private readonly Dictionary<MethodInfo, List<KeyDetermination>> _cachingConfigsForFunction; private int _createKeyCounter; private int _maxArgumentsCounter; public CachingConfig() { - _collectedCachingConfigsForInterface = new Dictionary<MethodInfo, object>(); + _cachingConfigsForFunction = new Dictionary<MethodInfo, List<KeyDetermination>>(); _createKeyCounter = 0; _maxArgumentsCounter = 0; } public CachingKeyCreator<TCachingKey> CreateKey<TCachingKey>() { return new CachingKeyCreator<TCachingKey>(); } public CachingConfig<TCachedInterface> CreateCachingKey(Expression<Action<TCachedInterface>> methodExpression) { _createKeyCounter = 0; _maxArgumentsCounter = 0; var expression = methodExpression as LambdaExpression; var methodCall = expression.Body as MethodCallExpression; if (methodCall == null) throw new ArgumentException("needs a Methodcall on Interface as parameter"); - if(_collectedCachingConfigsForInterface.ContainsKey(methodCall.Method)) + if(_cachingConfigsForFunction.ContainsKey(methodCall.Method)) throw new ArgumentException("Caching behaviour of a Method can't be defined twice"); - _collectedCachingConfigsForInterface.Add(methodCall.Method, new object()); + int argumentCount = methodCall.Arguments.Count; + _cachingConfigsForFunction.Add(methodCall.Method, CreateCacheConfigs(methodCall, methodExpression)); return this; } - public class CachingKeyCreator<TChachingKey> + private List<KeyDetermination> CreateCacheConfigs(MethodCallExpression expression, Expression<Action<TCachedInterface>> methodExpression) { - public TFromClass From<TFromClass>(Func<TFromClass, TChachingKey> functionToCreateKey) - { - //TODO add functions for caching + var keyDeterminationList = new List<KeyDetermination>(); - return default(TFromClass); + foreach (Expression argument in expression.Arguments) + { + keyDeterminationList.Add(new KeyDetermination(){InputType = argument.Type, MethodExpression = methodExpression}); } - } + return keyDeterminationList; + } } } diff --git a/NAdvisor.Contrib/CachingConfigurationValidation.cs b/NAdvisor.Contrib/CachingConfigurationValidation.cs new file mode 100644 index 0000000..f753289 --- /dev/null +++ b/NAdvisor.Contrib/CachingConfigurationValidation.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace NAdvisor.Contrib +{ + public partial class CachingConfig<TCachedInterface> + { + public void BuildCachingConfiguration() + { + foreach (var cachingConfigForFunction in _cachingConfigsForFunction) + { + CheckConfig(cachingConfigForFunction.Key, cachingConfigForFunction.Value); + } + } + + private void CheckConfig(MethodInfo info, List<KeyDetermination> determinations) + { + CheckIfKeyDeterminationsEqualMethodInfo(info, determinations); + + foreach (var list in determinations) + { + Action<TCachedInterface> compile = list.MethodExpression.Compile(); +// compile.Invoke(); + } + } + + private void CheckIfKeyDeterminationsEqualMethodInfo(MethodInfo info, List<KeyDetermination> determinations) + { + var count = 0; + + foreach (ParameterInfo parameter in info.GetParameters()) + { + if (parameter.IsOut) + throw new Exception("No out parameters allowed"); + + if (parameter.ParameterType != determinations[count].InputType) + throw new Exception("Parameters in KeyDetermination do not match"); + + count++; + } + } + } +} diff --git a/NAdvisor.Contrib/CachingKeyCreation.cs b/NAdvisor.Contrib/CachingKeyCreation.cs new file mode 100644 index 0000000..547bf8c --- /dev/null +++ b/NAdvisor.Contrib/CachingKeyCreation.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; + +namespace NAdvisor.Contrib +{ + public partial class CachingConfig<TCachedInterface> + { + public class CachingKeyCreator<TChachingKey> + { + public TFromClass From<TFromClass>(Func<TFromClass, TChachingKey> functionToCreateKey) + { + //TODO add functions for caching + + return default(TFromClass); + } + } + + } +} diff --git a/NAdvisor.Contrib/FluentProxy.cs b/NAdvisor.Contrib/FluentProxy.cs new file mode 100644 index 0000000..2bb525c --- /dev/null +++ b/NAdvisor.Contrib/FluentProxy.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Castle.Core.Interceptor; + +namespace NAdvisor.Contrib +{ + internal class FluentProxy : IInterceptor + { + public void Intercept(IInvocation invocation) + { + invocation.Proceed(); + } + } +} diff --git a/NAdvisor.Contrib/KeyDetermination.cs b/NAdvisor.Contrib/KeyDetermination.cs new file mode 100644 index 0000000..5f7f415 --- /dev/null +++ b/NAdvisor.Contrib/KeyDetermination.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; + +namespace NAdvisor.Contrib +{ + public partial class CachingConfig<TCachedInterface> + { + public class KeyDetermination + { + public Type InputType { get; set; } + public Type KeyType { get; set; } + public object CalculationFunction { get; set; } + + public Expression<Action<TCachedInterface>> MethodExpression { get; set; } + } + } +} diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index 5b8dacf..02dcfad 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,78 +1,82 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\moq\Moq.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CachingAspect.cs" /> <Compile Include="CachingConfig.cs" /> + <Compile Include="CachingKeyCreation.cs" /> + <Compile Include="CachingConfigurationValidation.cs" /> + <Compile Include="FluentProxy.cs" /> + <Compile Include="KeyDetermination.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
246877fcc0f305b6d168af39e5bd6f19d6cd85e8
better naming
diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs index b61b7aa..6a88064 100644 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ b/NAdvisor.Contrib.Test/CachingAspectTest.cs @@ -1,81 +1,81 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NAdvisor.Contrib.Test { /// <summary> /// Summary description for CachingAspectTest /// </summary> [TestClass] public class CachingAspectTest { [TestMethod] public void TestMethod1() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); } [TestMethod] - [ExpectedException(typeof(Exception))] + [ExpectedException(typeof(ArgumentException))] public void caching_behavoior_cant_be_defined_twice() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ) .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); } } public interface IMethodInvokesShouldBeCachedClass { int AwfulLongCacheAbleComputation(string inputParameter); } public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass { public int AwfulLongCacheAbleComputation(string inputParameter) { int count = 0; foreach (char c in inputParameter.ToCharArray()) { count += (int)c; } return count; } } } diff --git a/NAdvisor.Contrib/CachingConfig.cs b/NAdvisor.Contrib/CachingConfig.cs index 5299e2e..92d831f 100644 --- a/NAdvisor.Contrib/CachingConfig.cs +++ b/NAdvisor.Contrib/CachingConfig.cs @@ -1,52 +1,60 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; namespace NAdvisor.Contrib { public class CachingConfig<TCachedInterface> { private readonly Dictionary<MethodInfo, object> _collectedCachingConfigsForInterface; + private int _createKeyCounter; + private int _maxArgumentsCounter; public CachingConfig() { _collectedCachingConfigsForInterface = new Dictionary<MethodInfo, object>(); + _createKeyCounter = 0; + _maxArgumentsCounter = 0; } public CachingKeyCreator<TCachingKey> CreateKey<TCachingKey>() { return new CachingKeyCreator<TCachingKey>(); } public CachingConfig<TCachedInterface> CreateCachingKey(Expression<Action<TCachedInterface>> methodExpression) { - LambdaExpression expression = methodExpression as LambdaExpression; + _createKeyCounter = 0; + _maxArgumentsCounter = 0; + var expression = methodExpression as LambdaExpression; var methodCall = expression.Body as MethodCallExpression; if (methodCall == null) - throw new Exception("needs a Methodcall on Interface as parameter"); + throw new ArgumentException("needs a Methodcall on Interface as parameter"); if(_collectedCachingConfigsForInterface.ContainsKey(methodCall.Method)) - throw new Exception("Caching behaviour of a Method can't be defined twice"); + throw new ArgumentException("Caching behaviour of a Method can't be defined twice"); _collectedCachingConfigsForInterface.Add(methodCall.Method, new object()); return this; } public class CachingKeyCreator<TChachingKey> { public TFromClass From<TFromClass>(Func<TFromClass, TChachingKey> functionToCreateKey) { + //TODO add functions for caching + return default(TFromClass); } } } }
chrido/NAdvisor
fcaa643786569fc3f921b0625cf514e00c832331
cachingbehaviour defintion validation
diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs index 52d8df4..b61b7aa 100644 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ b/NAdvisor.Contrib.Test/CachingAspectTest.cs @@ -1,61 +1,81 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NAdvisor.Contrib.Test { /// <summary> /// Summary description for CachingAspectTest /// </summary> [TestClass] public class CachingAspectTest { [TestMethod] public void TestMethod1() { var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); cc .CreateCachingKey( cck => cck.AwfulLongCacheAbleComputation( cc.CreateKey<int>().From<string>(value => value.GetHashCode() ) ) ); var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); } + + [TestMethod] + [ExpectedException(typeof(Exception))] + public void caching_behavoior_cant_be_defined_twice() + { + var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); + cc + .CreateCachingKey( + cck => cck.AwfulLongCacheAbleComputation( + cc.CreateKey<int>().From<string>(value => value.GetHashCode() + ) + ) + ) + .CreateCachingKey( + cck => cck.AwfulLongCacheAbleComputation( + cc.CreateKey<int>().From<string>(value => value.GetHashCode() + ) + ) + ); + } } public interface IMethodInvokesShouldBeCachedClass { int AwfulLongCacheAbleComputation(string inputParameter); } public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass { public int AwfulLongCacheAbleComputation(string inputParameter) { int count = 0; foreach (char c in inputParameter.ToCharArray()) { count += (int)c; } return count; } } } diff --git a/NAdvisor.Contrib/CachingConfig.cs b/NAdvisor.Contrib/CachingConfig.cs index ad72bc9..5299e2e 100644 --- a/NAdvisor.Contrib/CachingConfig.cs +++ b/NAdvisor.Contrib/CachingConfig.cs @@ -1,28 +1,52 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; +using System.Reflection; using System.Text; namespace NAdvisor.Contrib { public class CachingConfig<TCachedInterface> { + private readonly Dictionary<MethodInfo, object> _collectedCachingConfigsForInterface; + + public CachingConfig() + { + _collectedCachingConfigsForInterface = new Dictionary<MethodInfo, object>(); + } + + public CachingKeyCreator<TCachingKey> CreateKey<TCachingKey>() { + + return new CachingKeyCreator<TCachingKey>(); } - public void CreateCachingKey(Action<TCachedInterface> methodToCache) + public CachingConfig<TCachedInterface> CreateCachingKey(Expression<Action<TCachedInterface>> methodExpression) { + LambdaExpression expression = methodExpression as LambdaExpression; + + var methodCall = expression.Body as MethodCallExpression; + if (methodCall == null) + throw new Exception("needs a Methodcall on Interface as parameter"); + + if(_collectedCachingConfigsForInterface.ContainsKey(methodCall.Method)) + throw new Exception("Caching behaviour of a Method can't be defined twice"); + + _collectedCachingConfigsForInterface.Add(methodCall.Method, new object()); + + return this; } public class CachingKeyCreator<TChachingKey> { public TFromClass From<TFromClass>(Func<TFromClass, TChachingKey> functionToCreateKey) { return default(TFromClass); } } } } diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index 0fc4137..5b8dacf 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,74 +1,78 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> </Reference> <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> </Reference> + <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\moq\Moq.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CachingAspect.cs" /> <Compile Include="CachingConfig.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
5cf26cf5e2fe783a8cef392f350fd577824f7e13
initial api concept
diff --git a/NAdvisor.Contrib.Test/CachingAspectTest.cs b/NAdvisor.Contrib.Test/CachingAspectTest.cs index caf6a88..52d8df4 100644 --- a/NAdvisor.Contrib.Test/CachingAspectTest.cs +++ b/NAdvisor.Contrib.Test/CachingAspectTest.cs @@ -1,52 +1,61 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NAdvisor.Contrib.Test { /// <summary> - /// Summary description for UnitTest1 + /// Summary description for CachingAspectTest /// </summary> [TestClass] - public class UnitTest1 + public class CachingAspectTest { [TestMethod] public void TestMethod1() { + var cc = new CachingConfig<IMethodInvokesShouldBeCachedClass>(); + cc + .CreateCachingKey( + cck => cck.AwfulLongCacheAbleComputation( + cc.CreateKey<int>().From<string>(value => value.GetHashCode() + ) + ) + ); + var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); - int result = advicedProxy.AwfulLongComputation("hello"); + int result = advicedProxy.AwfulLongCacheAbleComputation("hello"); } } public interface IMethodInvokesShouldBeCachedClass { - int AwfulLongComputation(string inputParameter); + int AwfulLongCacheAbleComputation(string inputParameter); } public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass { - public int AwfulLongComputation(string inputParameter) + public int AwfulLongCacheAbleComputation(string inputParameter) { int count = 0; foreach (char c in inputParameter.ToCharArray()) { count += (int)c; } return count; } } } diff --git a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index 939f2f7..3b338e3 100644 --- a/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,62 +1,62 @@ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="UnitTest1.cs" /> + <Compile Include="CachingAspectTest.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib/CachingConfig.cs b/NAdvisor.Contrib/CachingConfig.cs new file mode 100644 index 0000000..ad72bc9 --- /dev/null +++ b/NAdvisor.Contrib/CachingConfig.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NAdvisor.Contrib +{ + public class CachingConfig<TCachedInterface> + { + public CachingKeyCreator<TCachingKey> CreateKey<TCachingKey>() + { + return new CachingKeyCreator<TCachingKey>(); + } + + public void CreateCachingKey(Action<TCachedInterface> methodToCache) + { + } + + public class CachingKeyCreator<TChachingKey> + { + public TFromClass From<TFromClass>(Func<TFromClass, TChachingKey> functionToCreateKey) + { + return default(TFromClass); + } + } + + } +} diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index 05053a6..0fc4137 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,65 +1,74 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\CastleDynamicProxy2\Castle.Core.dll</HintPath> + </Reference> + <Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\CastleDynamicProxy2\Castle.DynamicProxy2.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CachingAspect.cs" /> + <Compile Include="CachingConfig.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file
chrido/NAdvisor
1854b835aa2be7dbff459f360274095d2929d6cd
initial unit test
diff --git a/NAdvisor.Contrib.Test/UnitTest1.cs b/NAdvisor.Contrib.Test/UnitTest1.cs index 808904a..caf6a88 100644 --- a/NAdvisor.Contrib.Test/UnitTest1.cs +++ b/NAdvisor.Contrib.Test/UnitTest1.cs @@ -1,52 +1,52 @@ using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace NAdvisor.Contrib.Test { /// <summary> /// Summary description for UnitTest1 /// </summary> [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); - var advicedProxy = advisor.GetAdvicedProxy(cachedClass); + var advicedProxy = advisor.GetAdvicedProxy<IMethodInvokesShouldBeCachedClass>(cachedClass); int result = advicedProxy.AwfulLongComputation("hello"); } } public interface IMethodInvokesShouldBeCachedClass { int AwfulLongComputation(string inputParameter); } public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass { public int AwfulLongComputation(string inputParameter) { int count = 0; foreach (char c in inputParameter.ToCharArray()) { count += (int)c; } return count; } } }
chrido/NAdvisor
fb3ad59724059cb0788c67b475dac9eec8839a4d
switched to mstest
diff --git a/LocalTestRun.testrunconfig b/LocalTestRun.testrunconfig new file mode 100644 index 0000000..7523e6c --- /dev/null +++ b/LocalTestRun.testrunconfig @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestRunConfiguration name="Local Test Run" id="28fa1ee6-6953-4ff2-b14e-6de7acbbdc1f" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006"> + <Description>This is a default test run configuration for a local test run.</Description> + <TestTypeSpecific /> +</TestRunConfiguration> \ No newline at end of file diff --git a/NAdvisor.Contrib.Tests/NAdvisor.Contrib.Tests.csproj b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj similarity index 57% rename from NAdvisor.Contrib.Tests/NAdvisor.Contrib.Tests.csproj rename to NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj index ea9939e..939f2f7 100644 --- a/NAdvisor.Contrib.Tests/NAdvisor.Contrib.Tests.csproj +++ b/NAdvisor.Contrib.Test/NAdvisor.Contrib.Test.csproj @@ -1,81 +1,62 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{BED18BB2-BD9E-44DC-89EE-401B5C3652A8}</ProjectGuid> + <ProjectGuid>{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>NAdvisor.Contrib.Tests</RootNamespace> - <AssemblyName>NAdvisor.Contrib.Tests</AssemblyName> + <RootNamespace>NAdvisor.Contrib.Test</RootNamespace> + <AssemblyName>NAdvisor.Contrib.Test</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Gallio, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\References\mbUnit\Gallio.dll</HintPath> - </Reference> - <Reference Include="MbUnit, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> - </Reference> - <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\References\moq\Moq.dll</HintPath> - </Reference> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> - <Reference Include="System.Xml.Linq"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data.DataSetExtensions"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="CachingAspectTests.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="UnitTest1.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> <Name>NAdvisor.Contrib</Name> </ProjectReference> <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> <Name>NAdvisor</Name> </ProjectReference> </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.Contrib.Tests/Properties/AssemblyInfo.cs b/NAdvisor.Contrib.Test/Properties/AssemblyInfo.cs similarity index 74% rename from NAdvisor.Contrib.Tests/Properties/AssemblyInfo.cs rename to NAdvisor.Contrib.Test/Properties/AssemblyInfo.cs index 72d95de..273ba25 100644 --- a/NAdvisor.Contrib.Tests/Properties/AssemblyInfo.cs +++ b/NAdvisor.Contrib.Test/Properties/AssemblyInfo.cs @@ -1,36 +1,35 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("NAdvisor.Contrib.Tests")] +[assembly: AssemblyTitle("NAdvisor.Contrib.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NAdvisor.Contrib.Tests")] +[assembly: AssemblyProduct("NAdvisor.Contrib.Test")] [assembly: AssemblyCopyright("Copyright © 2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// to COM componenets. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("71180bd4-a0df-4ab6-90f3-58ef9b923bf2")] +[assembly: Guid("45e12293-906d-4ca1-8864-202366908a45")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NAdvisor.Contrib.Tests/CachingAspectTests.cs b/NAdvisor.Contrib.Test/UnitTest1.cs similarity index 74% rename from NAdvisor.Contrib.Tests/CachingAspectTests.cs rename to NAdvisor.Contrib.Test/UnitTest1.cs index e7452cd..808904a 100644 --- a/NAdvisor.Contrib.Tests/CachingAspectTests.cs +++ b/NAdvisor.Contrib.Test/UnitTest1.cs @@ -1,45 +1,52 @@ using System; +using System.Text; using System.Collections.Generic; using System.Linq; -using System.Text; -using MbUnit.Framework; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace NAdvisor.Contrib.Tests +namespace NAdvisor.Contrib.Test { - [TestFixture] - public class CachingAspectTests + /// <summary> + /// Summary description for UnitTest1 + /// </summary> + [TestClass] + public class UnitTest1 { - [Test] - public void TestingMethodInvoke() + [TestMethod] + public void TestMethod1() { var cachingAspect = new CachingAspect(); var cachedClass = new MethodInvokesShouldBeCachedClass(); var advisor = new Advisor(cachingAspect); var advicedProxy = advisor.GetAdvicedProxy(cachedClass); int result = advicedProxy.AwfulLongComputation("hello"); } } public interface IMethodInvokesShouldBeCachedClass { int AwfulLongComputation(string inputParameter); } public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass { - + public int AwfulLongComputation(string inputParameter) { int count = 0; foreach (char c in inputParameter.ToCharArray()) { - count += (int) c; + count += (int)c; } return count; } } + } + + + diff --git a/NAdvisor.sln b/NAdvisor.sln index f3f43d0..f2bb159 100644 --- a/NAdvisor.sln +++ b/NAdvisor.sln @@ -1,38 +1,47 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor", "NAdvisor\NAdvisor.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest", "NAdvisorTest\NAdvisorTest.csproj", "{EEE750E7-0D26-4845-8AFA-9617752454A5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Tests", "NAdvisor.Contrib.Tests\NAdvisor.Contrib.Tests.csproj", "{BED18BB2-BD9E-44DC-89EE-401B5C3652A8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Test", "NAdvisor.Contrib.Test\NAdvisor.Contrib.Test.csproj", "{3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CF09232-5830-459C-9115-28284BA0B6A4}" + ProjectSection(SolutionItems) = preProject + LocalTestRun.testrunconfig = LocalTestRun.testrunconfig + NAdvisor.vsmdi = NAdvisor.vsmdi + EndProjectSection EndProject Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = NAdvisor.vsmdi + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.Build.0 = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.ActiveCfg = Release|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.Build.0 = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.Build.0 = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU - {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Release|Any CPU.Build.0 = Release|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D4E80A5-8C83-4A6B-97F6-C46B96308CCF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/NAdvisor.vsmdi b/NAdvisor.vsmdi new file mode 100644 index 0000000..e3a5088 --- /dev/null +++ b/NAdvisor.vsmdi @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006"> + <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> + <RunConfiguration id="28fa1ee6-6953-4ff2-b14e-6de7acbbdc1f" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" /> + </TestList> +</TestLists> \ No newline at end of file
chrido/NAdvisor
f0cfc2f8e586263716629f7cea59419e16e19fe5
upgraded to mbunit 3.1
diff --git a/NAdvisor.Contrib.Tests/CachingAspectTests.cs b/NAdvisor.Contrib.Tests/CachingAspectTests.cs new file mode 100644 index 0000000..e7452cd --- /dev/null +++ b/NAdvisor.Contrib.Tests/CachingAspectTests.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MbUnit.Framework; + +namespace NAdvisor.Contrib.Tests +{ + [TestFixture] + public class CachingAspectTests + { + [Test] + public void TestingMethodInvoke() + { + var cachingAspect = new CachingAspect(); + var cachedClass = new MethodInvokesShouldBeCachedClass(); + + var advisor = new Advisor(cachingAspect); + var advicedProxy = advisor.GetAdvicedProxy(cachedClass); + + int result = advicedProxy.AwfulLongComputation("hello"); + } + } + + public interface IMethodInvokesShouldBeCachedClass + { + int AwfulLongComputation(string inputParameter); + } + + public class MethodInvokesShouldBeCachedClass : IMethodInvokesShouldBeCachedClass + { + + public int AwfulLongComputation(string inputParameter) + { + int count = 0; + + foreach (char c in inputParameter.ToCharArray()) + { + count += (int) c; + } + + return count; + } + } +} diff --git a/NAdvisor.Contrib.Tests/NAdvisor.Contrib.Tests.csproj b/NAdvisor.Contrib.Tests/NAdvisor.Contrib.Tests.csproj new file mode 100644 index 0000000..ea9939e --- /dev/null +++ b/NAdvisor.Contrib.Tests/NAdvisor.Contrib.Tests.csproj @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BED18BB2-BD9E-44DC-89EE-401B5C3652A8}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>NAdvisor.Contrib.Tests</RootNamespace> + <AssemblyName>NAdvisor.Contrib.Tests</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Gallio, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\mbUnit\Gallio.dll</HintPath> + </Reference> + <Reference Include="MbUnit, Version=3.0.6.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\mbUnit\MbUnit.dll</HintPath> + </Reference> + <Reference Include="Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\References\moq\Moq.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="CachingAspectTests.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\NAdvisor.Contrib\NAdvisor.Contrib.csproj"> + <Project>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</Project> + <Name>NAdvisor.Contrib</Name> + </ProjectReference> + <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> + <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> + <Name>NAdvisor</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/NAdvisor.Contrib.Tests/Properties/AssemblyInfo.cs b/NAdvisor.Contrib.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..72d95de --- /dev/null +++ b/NAdvisor.Contrib.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NAdvisor.Contrib.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NAdvisor.Contrib.Tests")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("71180bd4-a0df-4ab6-90f3-58ef9b923bf2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NAdvisor.Contrib/CachingAspect.cs b/NAdvisor.Contrib/CachingAspect.cs index 16a974b..89e71fa 100644 --- a/NAdvisor.Contrib/CachingAspect.cs +++ b/NAdvisor.Contrib/CachingAspect.cs @@ -1,11 +1,17 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NAdvisor.Contrib { - public class Class1 + public class CachingAspect : IAspect { + private string cachingKey = string.Empty; + + public object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method) + { + return proceedInvocation(methodArguments); + } } } diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj index a0fb2ce..05053a6 100644 --- a/NAdvisor.Contrib/NAdvisor.Contrib.csproj +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -1,59 +1,65 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>77ed7371-0872-48bd-861c-834ac215e073</ProjectGuid> + <ProjectGuid>{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NAdvisor.Contrib</RootNamespace> <AssemblyName>NAdvisor.Contrib</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data.DataSetExtensions"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="Class1.cs" /> + <Compile Include="CachingAspect.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\NAdvisor\NAdvisor.csproj"> + <Project>{924BDC9D-7752-496C-B0F5-379F8D390C60}</Project> + <Name>NAdvisor</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> \ No newline at end of file diff --git a/NAdvisor.sln b/NAdvisor.sln index c6a4893..f3f43d0 100644 --- a/NAdvisor.sln +++ b/NAdvisor.sln @@ -1,26 +1,38 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor", "NAdvisor\NAdvisor.csproj", "{924BDC9D-7752-496C-B0F5-379F8D390C60}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisorTest", "NAdvisorTest\NAdvisorTest.csproj", "{EEE750E7-0D26-4845-8AFA-9617752454A5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib", "NAdvisor.Contrib\NAdvisor.Contrib.csproj", "{0C92D349-3D54-47F7-8468-5BF36BAF3CA7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAdvisor.Contrib.Tests", "NAdvisor.Contrib.Tests\NAdvisor.Contrib.Tests.csproj", "{BED18BB2-BD9E-44DC-89EE-401B5C3652A8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Debug|Any CPU.Build.0 = Debug|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.ActiveCfg = Release|Any CPU {924BDC9D-7752-496C-B0F5-379F8D390C60}.Release|Any CPU.Build.0 = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {EEE750E7-0D26-4845-8AFA-9617752454A5}.Release|Any CPU.Build.0 = Release|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C92D349-3D54-47F7-8468-5BF36BAF3CA7}.Release|Any CPU.Build.0 = Release|Any CPU + {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BED18BB2-BD9E-44DC-89EE-401B5C3652A8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/NAdvisor/Advisor.cs b/NAdvisor/Advisor.cs index 55ae4b7..f06f6af 100644 --- a/NAdvisor/Advisor.cs +++ b/NAdvisor/Advisor.cs @@ -1,129 +1,141 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Castle.Core.Interceptor; using Castle.DynamicProxy; namespace NAdvisor { public class Advisor { private readonly Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspectsForJointPoint; private readonly IList<IAspect> _aspects; + public Advisor(IAspect aspect) + { + _aspects = new List<IAspect>(){aspect}; + _getAspectsForJointPoint = (type, methodInfo, availableAspects) => _aspects; + } + public Advisor(IList<IAspect> aspects) { _aspects = aspects; _getAspectsForJointPoint = (type, methodInfo, availableAspects) => _aspects; } + public Advisor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspectsForJointPoint, IAspect aspect) + { + _getAspectsForJointPoint = getAspectsForJointPoint; + _aspects = new List<IAspect>() {aspect}; + } + public Advisor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspectsForJointPoint, IList<IAspect> aspects) { _getAspectsForJointPoint = getAspectsForJointPoint; _aspects = aspects; } public T GetAdvicedProxy<T>(T concreateInstance) { var proxyGenerator = new ProxyGenerator(new PersistentProxyBuilder()); var aspectInterceptor = new AdviceInterceptor(_getAspectsForJointPoint, _aspects, concreateInstance); return (T)proxyGenerator.CreateInterfaceProxyWithTargetInterface(typeof(T), concreateInstance, aspectInterceptor); ; } } public interface IAspect { object Execute(Func<object[], object> proceedInvocation, object[] methodArguments, IAspectEnvironment method); } public class AdviceInterceptor : IInterceptor { private readonly Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> _getAspects; private readonly IList<IAspect> _availableAspects; private readonly object _concreteInstance; public AdviceInterceptor(Func<Type, IAspectEnvironment, IList<IAspect>, IList<IAspect>> getAspects, IEnumerable<IAspect> availableAspects, object concreteInstance) { _availableAspects = new List<IAspect>(availableAspects); _getAspects = getAspects; _concreteInstance = concreteInstance; } public void Intercept(IInvocation invocation) { IAspectEnvironment environment = CreateEnvironment(invocation); var aspectList = _getAspects.Invoke(invocation.InvocationTarget.GetType(), environment, new List<IAspect>(_availableAspects)); invocation.ReturnValue = CreateNextLevel(invocation, aspectList, environment)(invocation.Arguments); } private AspectEnvironment CreateEnvironment(IInvocation invocation) { var environment = new AspectEnvironment(); environment.ConcreteMethodInfo = GetMethodInfoFromConcreteType(invocation.Method, _concreteInstance); environment.ConcreteObject = _concreteInstance; environment.InterfaceMethodInfo = invocation.Method; return environment; } /// <summary> /// Based on the given <paramref name="methodInfo"/> the same Method on the concreate Implementation is searched /// Because the concreteInstance must have this Method since it implements the interface theire is no error handling necessary /// </summary> /// <param name="methodInfo"></param> /// <param name="concreteInstance"></param> /// <returns></returns> private MethodInfo GetMethodInfoFromConcreteType(MethodInfo methodInfo, object concreteInstance) { //Could be cached ... ParameterInfo[] parameterInfos = methodInfo.GetParameters(); Type[] allTypes = new Type[parameterInfos.Length]; for(int i = 0; i < allTypes.Length; i++) allTypes[i] = parameterInfos[i].ParameterType; return concreteInstance.GetType().GetMethod(methodInfo.Name, allTypes); } public Func<object[], object> CreateNextLevel(IInvocation invocation, IEnumerable<IAspect> restOfAspects, IAspectEnvironment method) { return args => { var nextAspect = restOfAspects.FirstOrDefault(); if (nextAspect != null) { //Recursion return nextAspect.Execute( CreateNextLevel(invocation, restOfAspects.Skip(1), method), args, method ); } for (int i = 0; i < args.Length; i++) { invocation.SetArgumentValue(i, args[i]); } //Enter the concrete Method invocation.Proceed(); return invocation.ReturnValue; }; } } } diff --git a/References/mbUnit/Gallio.dll b/References/mbUnit/Gallio.dll index be78fc1..9bfed39 100644 Binary files a/References/mbUnit/Gallio.dll and b/References/mbUnit/Gallio.dll differ diff --git a/References/mbUnit/MbUnit.dll b/References/mbUnit/MbUnit.dll index fcfdb73..1caac23 100644 Binary files a/References/mbUnit/MbUnit.dll and b/References/mbUnit/MbUnit.dll differ diff --git a/References/mbUnit/MbUnit.pdb b/References/mbUnit/MbUnit.pdb index c935973..c08d655 100644 Binary files a/References/mbUnit/MbUnit.pdb and b/References/mbUnit/MbUnit.pdb differ
chrido/NAdvisor
a93a8b81c16c52cad0257e4cc2932d700c3a9b9f
initial cachingaspect
diff --git a/NAdvisor.Contrib/CachingAspect.cs b/NAdvisor.Contrib/CachingAspect.cs new file mode 100644 index 0000000..16a974b --- /dev/null +++ b/NAdvisor.Contrib/CachingAspect.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NAdvisor.Contrib +{ + public class Class1 + { + } +} diff --git a/NAdvisor.Contrib/NAdvisor.Contrib.csproj b/NAdvisor.Contrib/NAdvisor.Contrib.csproj new file mode 100644 index 0000000..a0fb2ce --- /dev/null +++ b/NAdvisor.Contrib/NAdvisor.Contrib.csproj @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>77ed7371-0872-48bd-861c-834ac215e073</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>NAdvisor.Contrib</RootNamespace> + <AssemblyName>NAdvisor.Contrib</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Class1.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/NAdvisor.Contrib/Properties/AssemblyInfo.cs b/NAdvisor.Contrib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..00c200b --- /dev/null +++ b/NAdvisor.Contrib/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NAdvisor.Contrib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NAdvisor.Contrib")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("77ed7371-0872-48bd-861c-834ac215e073")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
chrido/NAdvisor
a1cc3dfbf8f92df9aa23234032b10e69f7570163
scoped sync to aspectenvironment only
diff --git a/NAdvisor/AspectEnvironment.cs b/NAdvisor/AspectEnvironment.cs index 1fb4b36..7b288dd 100644 --- a/NAdvisor/AspectEnvironment.cs +++ b/NAdvisor/AspectEnvironment.cs @@ -1,80 +1,80 @@ // Copyright 2009 Christoph Doblander // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Reflection; using System.Collections.Generic; namespace NAdvisor { public interface IAspectEnvironment { /// <summary> /// Method Info of the Concrete Implementation /// </summary> MethodInfo ConcreteMethodInfo { get; } /// <summary> /// Method Info of the Interface Method /// </summary> MethodInfo InterfaceMethodInfo { get;} /// <summary> /// Concrete Object which implements the interface which is proxied /// </summary> object ConcreteObject { get; } T TryGetValue<T>(string key); void SetValue(string key, object value); } internal class AspectEnvironment : IAspectEnvironment { private readonly Dictionary<string, object> _proxyDict; - private readonly object syncRoot; + private readonly object _syncRoot = new object(); public AspectEnvironment() { _proxyDict = new Dictionary<string, object>(); } public MethodInfo ConcreteMethodInfo { get; set; } public MethodInfo InterfaceMethodInfo { get; set; } public object ConcreteObject { get; set; } public T TryGetValue<T>(string key) { - lock (syncRoot) + lock (_syncRoot) { if (_proxyDict.ContainsKey(key)) { var value = _proxyDict[key]; return value is T ? (T) value : default(T); } return default(T); } } public void SetValue(string key, object value) { - lock (syncRoot) + lock (_syncRoot) { _proxyDict[key] = value; } } } }
chrido/NAdvisor
bd1d105a577e54f902fc8f50ba9d4f4930a198af
formating
diff --git a/README b/README index edef368..88eb1af 100644 --- a/README +++ b/README @@ -1,32 +1,32 @@ -######################################################################################################################## +####################################################################################################################### NAdivsor -######################################################################################################################## +####################################################################################################################### This is a small library which adds Aspects during runtime. If you are looking for traditional Aspects have a look at postsharp.org The difference compared to traditional Aspects are: - Aspects can be instantiated, therefor can have dependencies in the constructor (fits very well with DI) - Trades fast compilation against slower execution, everything is done during runtime - Aspects can have a different lifetime than there intercepted classes. Some Usecases which can't be easily solved with compile time weaved aspects: - unit testing with or without aspects (can be handy if you only like to test your logic) - JointPoints can only be determind during runtime - because aspects are normal objects, they can be instantiated, they can have dependencies. - using Mocked aspects during unit tests - swap JointPoint definition during runtime (nice for switching on/off your performance measuring aspect) Usage: //Instantiate a new SecurityAspect IAspect securityAspect = new SecurityAspect(user); //Creates a Proxy, chooses the Aspect from the List by the JointPointDefinition Advisor advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {securityAspect, loggingAspect}); //Gets the Proxy which is intercepted by Aspects ISimpleService myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService);
chrido/NAdvisor
662cb0ef3fe899f6751a9b6b66d9729e5438a504
formating
diff --git a/README b/README index 5cdc9bc..edef368 100644 --- a/README +++ b/README @@ -1,32 +1,32 @@ -######################################################################################################################################## +######################################################################################################################## NAdivsor -######################################################################################################################################## +######################################################################################################################## This is a small library which adds Aspects during runtime. If you are looking for traditional Aspects have a look at postsharp.org The difference compared to traditional Aspects are: - Aspects can be instantiated, therefor can have dependencies in the constructor (fits very well with DI) - Trades fast compilation against slower execution, everything is done during runtime - Aspects can have a different lifetime than there intercepted classes. Some Usecases which can't be easily solved with compile time weaved aspects: - unit testing with or without aspects (can be handy if you only like to test your logic) - JointPoints can only be determind during runtime - because aspects are normal objects, they can be instantiated, they can have dependencies. - using Mocked aspects during unit tests - swap JointPoint definition during runtime (nice for switching on/off your performance measuring aspect) Usage: //Instantiate a new SecurityAspect IAspect securityAspect = new SecurityAspect(user); //Creates a Proxy, chooses the Aspect from the List by the JointPointDefinition Advisor advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {securityAspect, loggingAspect}); //Gets the Proxy which is intercepted by Aspects ISimpleService myService = advisor.GetAdvicedProxy<ISimpleService>(simpleService);
chrido/NAdvisor
7e5605544dac6edb62dad9261ce0000f58ada9a0
gitignore
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..90e3b00 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*~ +bin +obj +*.user +*.suo +*.bak +*.sln.cache +_ReSharper* +*/build +*/test-results +*.pidb +*.userprefs +*.orig \ No newline at end of file
reddavis/Benchmarker
631f94b09b472ed30f63d51e36cb1be1fcd79a0a
add dependencies
diff --git a/README.rdoc b/README.rdoc index 1866567..5b3befa 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,42 +1,46 @@ = Benchmarker This is a very 0.0.1 attempt at building a benchmarking version of autotest. While trying to make your code faster it can be a big pain and time waste having to keep switching to your benchmarks and then back again to your code. It only works on OSX at the moment (because of fsevents). == Install gem sources -a http://gems.github.com sudo gem install reddavis-benchmarker == How To Use Setup - your_file.rb require 'rubygems' require 'benchmarker' require 'benchmark' # rubys benchmark Benchmarker.go('path to your code') do n = 2 Benchmark.bm do |x| x.report { for i in 1..n; a = "1"; end } x.report { n.times do ; a = "1"; end } x.report { 1.upto(n) do ; a = "1"; end } end end Start It ruby your_file.rb Watch It Last Time: ["0.000015", "0.000010", "0.000010"] Now : ["0.000017", "0.000010", "0.000010"] Change : ["-13%", "0%", "0%"] +== Dependencies + +* Fsevents - http://github.com/ymendel/fsevents/tree/master + == Copyright Copyright (c) 2009 reddavis. See LICENSE for details.
reddavis/Benchmarker
f90ec283b2f0811b393f6de5e0be5c1434c28e30
Regenerated gemspec for version 0.0.0
diff --git a/benchmarker.gemspec b/benchmarker.gemspec index 702c571..cf97361 100644 --- a/benchmarker.gemspec +++ b/benchmarker.gemspec @@ -1,49 +1,58 @@ # Generated by jeweler # DO NOT EDIT THIS FILE # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec` # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{benchmarker} s.version = "0.0.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["reddavis"] s.date = %q{2009-08-18} s.default_executable = %q{benchmarker} s.description = %q{Instant feedback benchmarking} s.email = %q{[email protected]} s.executables = ["benchmarker"] s.extra_rdoc_files = [ "LICENSE", "README.rdoc" ] s.files = [ ".document", ".gitignore", "LICENSE", "README.rdoc", "Rakefile", - "lib/benchmarker.rb" + "VERSION", + "benchmarker.gemspec", + "bin/benchmarker", + "example/application.rb", + "example/lib/tester.rb", + "lib/benchmarker.rb", + "lib/ext/kernel.rb", + "test/ext/test_kernel.rb", + "test/helper.rb", + "test/test_benchmarker.rb" ] s.homepage = %q{http://github.com/reddavis/benchmarker} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.5} s.summary = %q{Instant feedback benchmarking} s.test_files = [ "test/ext/test_kernel.rb", "test/helper.rb", "test/test_benchmarker.rb" ] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then else end else end end
cytown/android_packages_apps_Phone
dd50067b5bc495bac6f16781d77e93030ae06b4e
Translated fr advanced settings strings by plauclair
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index dc37537..4b4f4de 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -1,496 +1,521 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2009 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="contactsIconLabel" msgid="9129800048701196916">"Contacts"</string> <string name="contactsFavoritesLabel" msgid="5360050972935451505">"Favoris"</string> <string name="dialerIconLabel" msgid="1761864493312440268">"Appeler"</string> <string name="emergencyDialerIconLabel" msgid="7812140032168171053">"Appels d\'urgence"</string> <string name="phoneIconLabel" msgid="2331230813161304895">"Téléphone"</string> <string name="recentCallsIconLabel" msgid="8717350893637245164">"Appels"</string> <string name="fdnListLabel" msgid="8630418672279521003">"Liste numéros autorisés"</string> <string name="unknown" msgid="6878797917991465859">"Inconnu"</string> <string name="private_num" msgid="6713286113000232309">"Numéro privé"</string> <string name="payphone" msgid="1931775086311769314">"Cabine téléphonique"</string> <string name="onHold" msgid="9035493194749959955">"En attente"</string> <string name="ongoing" msgid="8300874342848721367">"Appel en cours"</string> <string name="callFailed_userBusy" msgid="8851106999809294904">"Ligne occupée"</string> <string name="callFailed_congestion" msgid="8737761615702718375">"Réseau occupé"</string> <string name="callFailed_noSignal" msgid="1889803273616031933">"Aucun signal"</string> <string name="callFailed_limitExceeded" msgid="4958065157970101491">"Limite ACM dépassée"</string> <string name="callFailed_powerOff" msgid="2766035859391549713">"Signal radio désactivé"</string> <string name="callFailed_simError" msgid="5652345589458834655">"Aucune carte SIM ou erreur de carte SIM"</string> <string name="callFailed_outOfService" msgid="4825791466557236225">"Hors zone de couverture"</string> <string name="callFailed_fdn_only" msgid="2850204579765430641">"Les appels sortants sont restreints par la liste de numéros autorisés."</string> <string name="callFailed_cb_enabled" msgid="3057131228725500761">"Vous ne pouvez pas passer d\'appels sortants tant que l\'interdiction d\'appel est activée."</string> <string name="callFailed_dsac_restricted" msgid="2180223622768522345">"Tous les appels sont restreints par un contrôle d\'accès."</string> <string name="callFailed_dsac_restricted_emergency" msgid="4353654268813314466">"Les appels d\'urgence sont restreints par un contrôle d\'accès."</string> <string name="callFailed_dsac_restricted_normal" msgid="2680774510252408620">"Les appels ordinaires sont restreints par un contrôle d\'accès."</string> <string name="callFailed_cdma_lockedUntilPowerCycle" msgid="775483211928061084">"CDMA : téléphone bloqué jusqu\'au prochain redémarrage"</string> <string name="callFailed_cdma_drop" msgid="6030084920001082496">"CDMA : appel abandonné"</string> <string name="callFailed_cdma_intercept" msgid="8402269373120277330">"CDMA : appel intercepté"</string> <string name="callFailed_cdma_reorder" msgid="5605791471418711552">"CDMA : retrier"</string> <string name="callFailed_cdma_SO_reject" msgid="8969174256492763555">"CDMA : rejet de l\'option de service"</string> <string name="callFailed_cdma_retryOrder" msgid="5848488692485148804">"CDMA : nouvelle tentative de tri"</string> <string name="callFailed_cdma_accessFailure" msgid="2844306027616452215">"CDMA : échec de l\'accès"</string> <string name="callFailed_cdma_preempted" msgid="1097095321180029879">"CDMA : anticipé"</string> <string name="callFailed_cdma_notEmergency" msgid="2347377816822720761">"Services d\'urgence uniquement"</string> <string name="confCall" msgid="1904840547188336828">"Conférence tél."</string> <string name="mmiStarted" msgid="6347869857061147003">"Le code IHM a été lancé."</string> <string name="ussdRunning" msgid="485588686340541690">"Exécution du code USSD..."</string> <string name="mmiCancelled" msgid="2771923949751842276">"Code IHM annulé"</string> <string name="cancel" msgid="5044513931633602634">"Annuler"</string> <string name="ecbm_mode_text" msgid="6485648046794782672">"Rappel service d\'urgence"</string> <string name="ecbm_exit_text" msgid="622759135506401127">"QUITTER"</string> <string name="ecbm_ok_text" msgid="1373363960570351032">"OK"</string> <string name="ecbm_emergency_number" msgid="4131632362330756509">"Composer le 15"</string> <string name="ecbm_instruction_text" msgid="5039940054364946169">"Appuyez sur la touche pour passer un appel d\'urgence"</string> <string name="menu_speaker" msgid="6069700688651964705">"Ht. parleur"</string> <string name="menu_bluetooth" msgid="8842523654717305695">"Bluetooth"</string> <string name="menu_mute" msgid="4399723633363773145">"Muet"</string> <string name="menu_hold" msgid="6970441130344786273">"En attente"</string> <string name="menu_endCall" msgid="2142958047156634241">"Fin d\'appel"</string> <string name="menu_swapCalls" msgid="1548647524816600795">"Permuter"</string> <string name="menu_mergeCalls" msgid="6414754941392181303">"Fusionner"</string> <string name="menu_addCall" msgid="7829255032442131930">"Ajouter"</string> <string name="menu_manageConference" msgid="3770984362002266733">"Gérer la conférence téléphonique"</string> <string name="menu_showDialpad" msgid="5198200217528406980">"Afficher le clavier"</string> <string name="menu_hideDialpad" msgid="2733813546746296771">"Masquer le clavier"</string> <string name="menu_answerAndHold" msgid="8830891495953688905">"Suspendre l\'appel"\n"et répondre"</string> <string name="menu_answerAndEnd" msgid="2071708281281611854">"Terminer l\'appel"\n"et répondre"</string> <string name="ok" msgid="3811371167865772377">"OK"</string> <string name="menuButtonHint" msgid="4853215496220101699">"Appuyez sur \"Menu\" pour afficher les options d\'appel."</string> <string name="menuButtonKeyboardDialHint" msgid="2869270434715312458">"Appuyez sur \"Menu\" pour afficher les options d\'appel • Utilisez le clavier pour composer un numéro"</string> <string name="menu_answer" msgid="116686205042231098">"Répondre"</string> <string name="menu_ignore" msgid="2112030835852537344">"Ignorer"</string> <string name="wait_prompt_str" msgid="7601815427707856238">"Envoyer les tonalités suivantes ?"\n</string> <string name="send_button" msgid="4106860097497818751">"Envoyer"</string> <string name="wild_prompt_str" msgid="1585989144582892543">"Remplacer le caractère générique par"</string> <string name="no_vm_number" msgid="4164780423805688336">"Numéro de messagerie vocale manquant"</string> <string name="no_vm_number_msg" msgid="1300729501030053828">"Aucun numéro de messagerie vocale n\'est enregistré sur la carte SIM."</string> <string name="add_vm_number_str" msgid="4676479471644687453">"Ajouter un numéro"</string> <string name="dialer_emptyListWorking" msgid="6022498519770859790">"Chargement..."</string> <string name="enterPin" msgid="4753300834213388397">"Saisissez un code PIN pour débloquer la carte SIM."</string> <string name="pinUnlocked" msgid="3260617001055506794">"Carte SIM déverrouillée"</string> <string name="enterNewPin" msgid="5311243769004752401">"Nouveau code PIN de la carte SIM"</string> <string name="verifyNewPin" msgid="2593629913010458867">"Saisissez une nouvelle fois le nouveau code PIN de la carte SIM pour le confirmer"</string> <string name="verifyFailed" msgid="3875778795754857903">"Les codes PIN de la carte SIM saisis ne correspondent pas. Veuillez réessayer."</string> <string name="enterPuk" msgid="6144749655582862324">"Saisissez la clé PUK pour débloquer la carte SIM"</string> <string name="badPuk" msgid="3213017898690275965">"La clé PUK est incorrecte !"</string> <string name="buttonTxtContinue" msgid="863271214384739936">"Continuer"</string> <string name="puk_unlocked" msgid="2284912838477558454">"Votre carte SIM a été déverrouillée. Votre téléphone est en cours de déverrouillage..."</string> <string name="label_ndp" msgid="780479633159517250">"Code PIN de déblocage du réseau SIM"</string> <string name="sim_ndp_unlock_text" msgid="683628237760543009">"Débloquer"</string> <string name="sim_ndp_dismiss_text" msgid="1604823375752456947">"Rejeter"</string> <string name="requesting_unlock" msgid="6412629401033249351">"Demande de déblocage du réseau…"</string> <string name="unlock_failed" msgid="6490531697031504225">"Échec de la demande de déblocage du réseau."</string> <string name="unlock_success" msgid="6770085622238180152">"Le réseau a bien été débloqué."</string> <string name="imei" msgid="8552502717594321281">"Code IMEI"</string> <string name="labelGSMMore" msgid="5930842194056092106">"Paramètres d\'appel GSM"</string> <string name="labelCDMAMore" msgid="1630676740428229339">"Paramètres d\'appel CDMA"</string> <string name="apn_settings" msgid="9043423184895642077">"Noms des points d\'accès"</string> <string name="settings_label" msgid="3876743539816984008">"Paramètres du réseau"</string> <string name="voicemail" msgid="8693759337917898954">"Messagerie vocale"</string> <string name="voicemail_abbreviated" msgid="2215592488517217448">"MV :"</string> <string name="networks" msgid="8873030692174541976">"Opérateur de réseau"</string> <string name="call_settings" msgid="6112441768261754562">"Paramètres d\'appel"</string> <string name="additional_gsm_call_settings" msgid="6472260354879794056">"Paramètres d\'appel GSM supplémentaires"</string> <string name="sum_gsm_call_settings" msgid="4076647190996778012">"Autres paramètres d\'appel \"GSM uniquement\""</string> <string name="additional_cdma_call_settings" msgid="8628958775721886909">"Autres paramètres d\'appel CDMA"</string> <string name="sum_cdma_call_settings" msgid="284753265979035549">"Autres paramètres d\'appel \"CDMA uniquement\""</string> <string name="labelNwService" msgid="4699970172021870983">"Paramètres du service réseau"</string> <string name="labelCallerId" msgid="3888899447379069198">"Numéro de l\'appelant"</string> <string name="sum_hide_caller_id" msgid="1071407020290873782">"Numéro masqué pour les appels sortants"</string> <string name="sum_show_caller_id" msgid="6768534125447290401">"Numéro affiché pour les appels sortants"</string> <string name="sum_default_caller_id" msgid="1954518825510901365">"Utiliser les paramètres opérateur pour afficher mon n° pour les appels sortants"</string> <string name="labelCW" msgid="6120513814915920200">"Appel en attente"</string> <string name="sum_cw_enabled" msgid="8083061901633671397">"Me signaler les appels entrants lorsque je suis en communication"</string> <string name="sum_cw_disabled" msgid="3648693907300104575">"Me signaler les appels entrants lorsque je suis en communication"</string> <string name="call_forwarding_settings" msgid="3378927671091537173">"Paramètres de transfert d\'appel"</string> <string name="labelCF" msgid="2574386948026924737">"Transfert d\'appel"</string> <string name="labelCFU" msgid="8147177368148660600">"Toujours transférer"</string> <string name="messageCFU" msgid="3560082430662923687">"Toujours utiliser ce numéro"</string> <string name="sum_cfu_enabled_indicator" msgid="4014187342724130197">"Transfert de tous les appels"</string> <string name="sum_cfu_enabled" msgid="956178654350554451">"Transfert de tous les appels à {0}"</string> <string name="sum_cfu_disabled" msgid="3698472522160364904">"Désactivé"</string> <string name="labelCFB" msgid="218938523102207587">"Transférer si ligne occupée"</string> <string name="messageCFB" msgid="3711089705936187129">"Numéro de renvoi lorsque la ligne est occupée"</string> <string name="sum_cfb_enabled" msgid="2501948432392255856">"Transfert vers le {0}"</string> <string name="sum_cfb_disabled" msgid="227440009979537651">"Désactivé"</string> <string name="labelCFNRy" msgid="3646316323834351390">"Transférer si sans réponse"</string> <string name="messageCFNRy" msgid="672317899884380374">"Numéro de renvoi lorsque vous ne répondez pas"</string> <string name="sum_cfnry_enabled" msgid="3473526018876802076">"Transfert vers le {0}"</string> <string name="sum_cfnry_disabled" msgid="8422350929957344729">"Désactivé"</string> <string name="labelCFNRc" msgid="47183615370850000">"Transférer si injoignable"</string> <string name="messageCFNRc" msgid="6380695421020295119">"Numéro de renvoi si injoignable"</string> <string name="sum_cfnrc_enabled" msgid="3528648673654636587">"Transfert vers le {0}"</string> <string name="sum_cfnrc_disabled" msgid="7222141261321276464">"Désactivé"</string> <string name="updating_title" msgid="6146755386174019046">"Paramètres d\'appel"</string> <string name="error_updating_title" msgid="7970259216988931777">"Erreur des paramètres d\'appel"</string> <string name="reading_settings" msgid="1920291699287055284">"Lecture des paramètres..."</string> <string name="updating_settings" msgid="8171225533884883252">"Mise à jour des paramètres..."</string> <string name="response_error" msgid="6674110501330139405">"Réponse inattendue du réseau"</string> <string name="exception_error" msgid="7027667130619518211">"Erreur de réseau ou de carte SIM."</string> <string name="radio_off_error" msgid="6717116288405111269">"Veuillez allumer le signal radio avant d\'afficher ces paramètres."</string> <string name="close_dialog" msgid="2365884406356986917">"OK"</string> <string name="enable" msgid="1059008390636773574">"Activer"</string> <string name="disable" msgid="7274240979164762320">"Désactiver"</string> <string name="change_num" msgid="239476305819844391">"Mettre à jour"</string> <string-array name="clir_display_values"> <item msgid="5560134294467334594">"Réseau par défaut"</item> <item msgid="7876195870037833661">"Masquer le numéro"</item> <item msgid="1108394741608734023">"Afficher le numéro"</item> </string-array> <string name="vm_save_number" msgid="4579969432544566719">"Enregistrer le numéro de messagerie vocale"</string> <string name="vm_changed" msgid="380744030726254139">"Le numéro de messagerie vocale a été modifié."</string> <string name="vm_change_failed" msgid="8484504256705014152">"Échec de la modification du numéro de messagerie vocale."</string> <string name="no_change" msgid="3186040086622435212">"Aucune modification n\'a été apportée."</string> <string name="sum_voicemail" msgid="2528087245989303328">"Définir numéro messagerie vocale"</string> <string name="mobile_networks" msgid="5540397602919106177">"Paramètres du réseau mobile"</string> <string name="label_available" msgid="1181658289009300430">"Réseaux disponibles"</string> <string name="load_networks_progress" msgid="5230707536168902952">"Recherche..."</string> <string name="empty_networks_list" msgid="4249426905018815316">"Aucun réseau trouvé."</string> <string name="search_networks" msgid="1601136049300882441">"Rechercher les réseaux"</string> <string name="network_query_error" msgid="6828516148953325006">"Une erreur s\'est produite lors de la recherche de réseaux."</string> <string name="register_on_network" msgid="9055203954040805084">"Enregistrement sur <xliff:g id="NETWORK">%s</xliff:g>..."</string> <string name="not_allowed" msgid="3540496123717833833">"Votre carte SIM ne vous autorise pas à vous connecter à ce réseau."</string> <string name="registration_done" msgid="495135664535876612">"Enregistré sur le réseau."</string> <string name="sum_carrier_select" msgid="6526225502314751575">"Choisir un opérateur réseau"</string> <string name="sum_search_networks" msgid="2921092249873272715">"Chercher tous les réseaux disponibles"</string> <string name="select_automatically" msgid="8615980695510888796">"Sélection automatique"</string> <string name="sum_select_automatically" msgid="8460954604521755275">"Sélectionner automatiquement"</string> <string name="register_automatically" msgid="6272031189219101172">"Enregistrement automatique…"</string> <string name="preferred_network_mode_title" msgid="8873246565334559308">"Mode réseau"</string> <string name="preferred_network_mode_summary" msgid="1434820673166126609">"Changer le mode de fonctionnement du réseau"</string> <string name="preferred_network_mode_dialogtitle" msgid="8176355237105593793">"Mode réseau préféré"</string> <string-array name="preferred_network_mode_choices"> <item msgid="2987674222882365152">"Général"</item> <item msgid="3273348576277144124">"EvDo uniquement"</item> <item msgid="454610224530856274">"CDMA sans EvDo"</item> <item msgid="8928247118825616081">"CDMA/EvDo automatique"</item> <item msgid="8595462903294812666">"GSM/WCDMA automatique"</item> <item msgid="5189164180446264504">"WCDMA uniquement"</item> <item msgid="5714714953966979187">"GSM uniquement"</item> <item msgid="4775796025725908913">"GSM/WCDMA préféré"</item> </string-array> <string-array name="preferred_network_mode_values"> <item msgid="7164534877603905916">"7"</item> <item msgid="2520921432080278213">"6"</item> <item msgid="4978887990900575049">"5"</item> <item msgid="6891436459357445885">"4"</item> <item msgid="339825043192186272">"3"</item> <item msgid="3062641619893382241">"2"</item> <item msgid="2494009747968041784">"1"</item> <item msgid="2568449734331711605">"0"</item> </string-array> <string name="roaming" msgid="8871412572928323707">"Itinérance des données"</string> <string name="roaming_enable" msgid="7331106985174381987">"Se connecter aux services de données lors de l\'itinérance"</string> <string name="roaming_disable" msgid="1843417228755568110">"Se connecter aux services de données lors de l\'itinérance"</string> <string name="roaming_reenable_message" msgid="6973894869473170666">"Vous avez été déconnecté car vous avez quitté votre réseau alors que l\'itinérance des données était désactivée."</string> <string name="roaming_warning" msgid="7820963598559553967">"Autoriser l\'itinérance des données ? Des frais d\'itinérance importants peuvent s\'appliquer !"</string> <string name="gsm_umts_options" msgid="6538311689850981686">"Options GSM/UMTS"</string> <string name="cdma_options" msgid="4016822858172249884">"Options CDMA"</string> <string name="cdma_cell_broadcast_sms" msgid="7898475142527341808">"Diffusion cellulaire par SMS"</string> <string name="cell_broadcast_sms" msgid="5584192824053625842">"Diffusion cellulaire par SMS"</string> <string name="enable_disable_cell_bc_sms" msgid="4851147873691392255">"Cell Broadcast SMS"</string> <string name="cell_bc_sms_enable" msgid="6441688565738921084">"Option \"Diffusion cellulaire par SMS\" activée"</string> <string name="cell_bc_sms_disable" msgid="3398365088309408749">"Option \"Diffusion cellulaire par SMS\" désactivée"</string> <string name="cb_sms_settings" msgid="651715019785107312">"Paramètres de la diffusion cellulaire par SMS"</string> <string name="enable_disable_emergency_broadcast" msgid="2157014609041245335">"Diffusion des services d\'urgence"</string> <string name="emergency_broadcast_enable" msgid="2645980025414010211">"Option \"Diffusion des services d\'urgence\" activée"</string> <string name="emergency_broadcast_disable" msgid="3665199821267569426">"Option \"Diffusion des services d\'urgence\" désactivée"</string> <string name="enable_disable_administrative" msgid="6501582322182059412">"Administration"</string> <string name="administrative_enable" msgid="1750086122962032235">"Option \"Administration\" activée"</string> <string name="administrative_disable" msgid="8433273857248698539">"Option \"Administration\" désactivée"</string> <string name="enable_disable_maintenance" msgid="1819693083025106678">"Maintenance"</string> <string name="maintenance_enable" msgid="8566636458770971189">"Option \"Maintenance\" activée"</string> <string name="maintenance_disable" msgid="7340189100885066077">"Option \"Maintenance\" désactivée"</string> <string name="general_news_settings" msgid="4968779723948432978">"Actualités générales"</string> <string name="bf_news_settings" msgid="3935593091894685267">"Économie et finance"</string> <string name="sports_news_settings" msgid="7649399631270052835">"Actualités sportives"</string> <string name="entertainment_news_settings" msgid="5051153952959405035">"Culture et loisirs"</string> <string name="enable_disable_local" msgid="7890281063123416120">"Locales"</string> <string name="local_enable" msgid="6370463247609136359">"Option \"Actualités locales\" activée"</string> <string name="local_disable" msgid="4405691986943795798">"Option \"Actualités locales\" désactivée"</string> <string name="enable_disable_regional" msgid="4905652414535565872">"Régionales"</string> <string name="regional_enable" msgid="4434680415437834759">"Option \"Actualités régionales\" activée"</string> <string name="regional_disable" msgid="5359325527213850077">"Option \"Actualités régionales\" désactivée"</string> <string name="enable_disable_national" msgid="236278090206880734">"Nationales"</string> <string name="national_enable" msgid="1172443648912246952">"Option \"Actualités nationales\" activée"</string> <string name="national_disable" msgid="326018148178601166">"Option \"Actualités nationales\" désactivée"</string> <string name="enable_disable_international" msgid="7535348799604565592">"Internationales"</string> <string name="international_enable" msgid="5855356769925044927">"Option \"Actualités internationales\" activée"</string> <string name="international_disable" msgid="2850648591041088931">"Option \"Actualités internationales\" désactivée"</string> <string name="list_language_title" msgid="2841683501919760043">"Langue"</string> <string name="list_language_summary" msgid="8109546531071241601">"Sélectionnez la langue des actualités"</string> <string-array name="list_language_entries"> <item msgid="6137851079727305485">"Anglais"</item> <item msgid="1151988412809572526">"Français"</item> <item msgid="577840534704312665">"Espagnol"</item> <item msgid="8385712091143148180">"Japonais"</item> <item msgid="1858401628368130638">"Coréen"</item> <item msgid="1933212028684529632">"Chinois"</item> <item msgid="1908428006803639064">"Hébreu"</item> </string-array> <string-array name="list_language_values"> <item msgid="1804908636436467150">"1"</item> <item msgid="289708030346890334">"2"</item> <item msgid="1121469729692402684">"3"</item> <item msgid="2614093115912897722">"4"</item> <item msgid="2411164639857960614">"5"</item> <item msgid="5884448729274543324">"6"</item> <item msgid="5511864807618312598">"7"</item> </string-array> <string name="list_language_dtitle" msgid="5442908726538951934">"Langues"</string> <string name="enable_disable_local_weather" msgid="986967454867219114">"Météo locale"</string> <string name="local_weather_enable" msgid="6199315114382448922">"Option \"Météo locale\" activée"</string> <string name="local_weather_disable" msgid="2510158089142626480">"Option \"Météo locale\" désactivée"</string> <string name="enable_disable_atr" msgid="8339572391278872343">"Infos trafic locales"</string> <string name="atr_enable" msgid="5541757457789181799">"Option \"Infos trafic locales\" activée"</string> <string name="atr_disable" msgid="7085558154727596455">"Option \"Infos trafic locales\" désactivée"</string> <string name="enable_disable_lafs" msgid="668189073721277199">"Horaires des vols des aéroports à proximité"</string> <string name="lafs_enable" msgid="2791978667205137052">"Option \"Horaires des vols des aéroports à proximité\" activée"</string> <string name="lafs_disable" msgid="2391212397725495350">"Option \"Horaires des vols des aéroports à proximité\" désactivée"</string> <string name="enable_disable_restaurants" msgid="6240381945336814024">"Restaurants"</string> <string name="restaurants_enable" msgid="5137657479469118847">"Option \"Restaurants\" activée"</string> <string name="restaurants_disable" msgid="3678480270938424092">"Option \"Restaurants\" désactivée"</string> <string name="enable_disable_lodgings" msgid="1822029172658551202">"Hébergements"</string> <string name="lodgings_enable" msgid="3230042508992850322">"Option \"Hébergements\" activée"</string> <string name="lodgings_disable" msgid="3387879742320682391">"Option \"Hébergements\" désactivée"</string> <string name="enable_disable_retail_directory" msgid="1357809784475660303">"Annuaire des commerces"</string> <string name="retail_directory_enable" msgid="3280626290436111496">"Option \"Annuaire des commerces\""</string> <string name="retail_directory_disable" msgid="6479739816662879027">"Option \"Annuaire des commerces\" désactivée"</string> <string name="enable_disable_advertisements" msgid="5999495926176182128">"Annonces"</string> <string name="advertisements_enable" msgid="2050305021264683786">"Option \"Annonces\" activée"</string> <string name="advertisements_disable" msgid="8350985908788707935">"Option \"Annonces\" désactivée"</string> <string name="enable_disable_stock_quotes" msgid="6397810445293533603">"Cours de bourse"</string> <string name="stock_quotes_enable" msgid="4384802470887170543">"Option \"Cours de bourse\" activée"</string> <string name="stock_quotes_disable" msgid="4781450084565594998">"Option \"Cours de bourse\" désactivée"</string> <string name="enable_disable_eo" msgid="4863043263443942494">"Offres d\'emploi"</string> <string name="eo_enable" msgid="8623559062015685813">"Option \"Offres d\'emploi\" activée"</string> <string name="eo_disable" msgid="3863812478090907609">"Option \"Offres d\'emploi\" désactivée"</string> <string name="enable_disable_mhh" msgid="5698783743098373681">"Médecine, services de santé et hôpitaux"</string> <string name="mhh_enable" msgid="3949276822735205799">"Option \"Médecine, services de santé et hôpitaux\" activée"</string> <string name="mhh_disable" msgid="4834280270664925123">"Médecine, services de santé et hôpitaux"</string> <string name="enable_disable_technology_news" msgid="3517184627114999149">"Technologies"</string> <string name="technology_news_enable" msgid="7995209394210455181">"Option \"Nouvelles technologies\" activée"</string> <string name="technology_news_disable" msgid="5483490380561851946">"Option \"Technologies\" désactivée"</string> <string name="enable_disable_multi_category" msgid="626771003122899280">"Multi-catégories"</string> <string name="multi_category_enable" msgid="1179299804641721768">"Option \"Multi-catégories\" activée"</string> <string name="multi_category_disable" msgid="880104702904139505">"Option \"Multi-catégories\" désactivée"</string> <string name="gsm_umts_network_preferences_title" msgid="4834419333547382436">"Préférences réseau GSM/UMTS"</string> <string name="gsm_umts_network_preferneces_summary" msgid="1905018644156819521">"Pas encore implémenté"</string> <string name="gsm_umts_network_preferences_dialogtitle" msgid="6356332580813229898">"Préférences réseau GSM/UMTS"</string> <string-array name="gsm_umts_network_preferences_choices"> <item msgid="4327916632016252900">"3G de préférence"</item> <item msgid="7890032659744442614">"2G uniquement"</item> <item msgid="7306003477602941058">"3G uniquement"</item> </string-array> <string-array name="gsm_umts_network_preferences_values"> <item msgid="117293148930527265">"0"</item> <item msgid="2264578612775462302">"1"</item> <item msgid="1268081943590316978">"2"</item> </string-array> <string name="prefer_2g" msgid="8442550937280449639">"Uniquement les réseaux 2G"</string> <string name="prefer_2g_summary" msgid="1976491403210690759">"Économise la batterie"</string> <string name="cdma_system_select_title" msgid="5757657769327732833">"Sélection système"</string> <string name="cdma_system_select_summary" msgid="2528661990595284707">"Modifier le mode d\'itinérance CDMA"</string> <string name="cdma_system_select_dialogtitle" msgid="6083355415165359075">"Sélection système"</string> <string-array name="cdma_system_select_choices"> <item msgid="176474317493999285">"Réseaux domestiques uniquement"</item> <item msgid="1205664026446156265">"Automatique"</item> </string-array> <string-array name="cdma_system_select_values"> <item msgid="4354305960068894315">"0"</item> <item msgid="3046877284450231151">"2"</item> </string-array> <string name="cdma_roaming_mode_title" msgid="6366737033053855198">"Mode d\'itinérance CDMA"</string> <string name="cdma_roaming_mode_summary" msgid="8604713111805562261">"Modifier le mode d\'itinérance CDMA"</string> <string name="cdma_roaming_mode_dialogtitle" msgid="1802896889172094947">"Mode d\'itinérance CDMA"</string> <string-array name="cdma_roaming_mode_choices"> <item msgid="6024072766548865002">"Réseaux domestiques uniquement"</item> <item msgid="8174642753290624634">"Réseaux affiliés"</item> <item msgid="2241951431403168661">"N\'importe quel réseau"</item> </string-array> <string-array name="cdma_roaming_mode_values"> <item msgid="2549203161367380954">"0"</item> <item msgid="6007798728227141997">"1"</item> <item msgid="4039511109802141047">"2"</item> </string-array> <string name="cdma_network_preferences_title" msgid="41193174429510391">"Préférences réseau CDMA"</string> <string name="cdma_network_preferneces_summary" msgid="3524451924935793338">"Pas encore implémenté"</string> <string name="cdma_network_preferences_dialogtitle" msgid="4548860809290455653">"Préférences réseau CDMA"</string> <string-array name="cdma_network_preferences_choices"> <item msgid="7278992425338592489">"CDMA/EvDo automatique"</item> <item msgid="3155327921861137068">"CDMA sans EvDo"</item> <item msgid="2683555124647197574">"EvDo uniquement"</item> </string-array> <string-array name="cdma_network_preferences_values"> <item msgid="1821235500822403409">"4"</item> <item msgid="6355374585098185445">"5"</item> <item msgid="213552629330086398">"6"</item> </string-array> <string name="subscription_title" msgid="5813493350326486">"Test d\'enregistrement CDMA"</string> <string name="subscription_summary" msgid="8435941016743418124">"Basculer entre les cartes RUIM/SIM et NV"</string> <string name="subscription_dialogtitle" msgid="531571450448009255">"abonnement"</string> <string-array name="subscription_choices"> <item msgid="6540107472553796600">"RUIM/SIM"</item> <item msgid="1433427108940308332">"NV"</item> </string-array> <string-array name="subscription_values"> <item msgid="4377788417250295786">"0"</item> <item msgid="1193066664940329729">"1"</item> </string-array> <string name="fdn" msgid="7878832555095183202">"Numéros autorisés"</string> <string name="manage_fdn_list" msgid="8777755791892122369">"Liste numéros autorisés"</string> <string name="fdn_activation" msgid="2156479741307463576">"Activation des numéros autorisés"</string> <string name="fdn_enabled" msgid="5238109009915521240">"La liste de numéros autorisés est activée."</string> <string name="fdn_disabled" msgid="4700049736675368279">"La liste de numéros autorisés est désactivée."</string> <string name="enable_fdn" msgid="3740191529180493851">"Activer numéros autorisés"</string> <string name="disable_fdn" msgid="7944020890722540616">"Désactiver numéros autorisés"</string> <string name="change_pin2" msgid="2153563695382176676">"Modifier le code PIN2"</string> <string name="enable_fdn_ok" msgid="7215588870329688132">"Désactiver numéros autorisés"</string> <string name="disable_fdn_ok" msgid="5727046928930740173">"Activer numéros autorisés"</string> <string name="sum_fdn" msgid="1959399454900272878">"Gérer la liste de numéros autorisés"</string> <string name="sum_fdn_change_pin" msgid="6666549734792827932">"Modifier le code PIN pour l\'accès aux numéros autorisés"</string> <string name="sum_fdn_manage_list" msgid="8431088265332628316">"Gérer la liste des numéros de téléphone"</string> <string name="voice_privacy" msgid="7803023024169078619">"Confidentialité vocale"</string> <string name="voice_privacy_summary" msgid="3159383389833516214">"Activer le mode de confidentialité amélioré"</string> <string name="tty_mode_title" msgid="3171521903490559138">"Mode TTY"</string> <string name="tty_mode_summary" msgid="5057244302665817977">"Activer le mode TTY"</string> <string name="tty_mode_option_title" msgid="9033098925144434669">"Mode TTY"</string> <string name="tty_mode_option_summary" msgid="1073835131534808732">"Définir le mode TTY"</string> <string name="menu_add" msgid="1882023737425114762">"Ajouter un contact"</string> <string name="menu_edit" msgid="7143003705504672374">"Modifier le contact"</string> <string name="menu_delete" msgid="3977150783449642851">"Supprimer le contact"</string> <string name="get_pin2" msgid="1198225482542827652">"Saisir le code PIN2"</string> <string name="name" msgid="7329028332786872378">"Nom"</string> <string name="number" msgid="7905950798349903858">"Numéro"</string> <string name="save" msgid="4094274636321939086">"Enregistrer"</string> <string name="add_fdn_contact" msgid="5412242719704146070">"Ajouter un contact à numéro autorisé"</string> <string name="adding_fdn_contact" msgid="1008984230265031168">"Ajout d\'un contact à numéro autorisé..."</string> <string name="fdn_contact_added" msgid="3283284983265410270">"Le contact à numéro autorisé a été ajouté."</string> <string name="edit_fdn_contact" msgid="3440054765948798731">"Modifier un contact à numéro autorisé"</string> <string name="updating_fdn_contact" msgid="5918299270800552372">"Mise à jour du contact à numéro autorisé…"</string> <string name="fdn_contact_updated" msgid="510187720367785051">"Contact à numéro autorisé mis à jour."</string> <string name="delete_fdn_contact" msgid="2237838617123538040">"Supprimer le contact à numéro autorisé"</string> <string name="deleting_fdn_contact" msgid="6162824054507660151">"Suppression du contact à numéro autorisé…"</string> <string name="fdn_contact_deleted" msgid="5596742031140651283">"Le contact à numéro autorisé a été supprimé."</string> <string name="pin2_invalid" msgid="6408721267712649637">"Le code PIN2 n\'est pas valide !"</string> <string name="fdn_invalid_number" msgid="1484959418054136856">"Le numéro doit comporter 20 chiffres au maximum."</string> <string name="simContacts_emptyLoading" msgid="2203331234764498011">"Lecture de la carte SIM…"</string> <string name="simContacts_empty" msgid="5270660846489561932">"Aucun contact n\'a été trouvé sur votre carte SIM."</string> <string name="simContacts_title" msgid="1861472842524839921">"Sélection des contacts à importer"</string> <string name="enable_pin" msgid="5422767284133234860">"Activer/désactiver le code PIN de la carte SIM"</string> <string name="change_pin" msgid="9174186126330785343">"Modifier le code PIN de la carte SIM"</string> <string name="enter_pin_text" msgid="8532615714751931951">"Code PIN de la carte SIM :"</string> <string name="oldPinLabel" msgid="5287773661246368314">"Ancien code PIN"</string> <string name="newPinLabel" msgid="207488227285336897">"Nouveau code PIN"</string> <string name="confirmPinLabel" msgid="257597715098070206">"Confirmer le nouveau code PIN"</string> <string name="badPin" msgid="4154316827946559447">"L\'ancien code PIN saisi est incorrect. Veuillez réessayer."</string> <string name="mismatchPin" msgid="5974597541268042785">"Les codes PIN saisis ne correspondent pas. Veuillez réessayer."</string> <string name="invalidPin" msgid="5981171102258684792">"Saisissez un code PIN comprenant 4 à 8 chiffres."</string> <string name="disable_sim_pin" msgid="3992926931620188855">"Désactiver le code PIN de la carte SIM"</string> <string name="enable_sim_pin" msgid="5803702443844458831">"Activer le code PIN de la carte SIM"</string> <string name="enable_in_progress" msgid="3695303775100109650">"Merci de patienter..."</string> <string name="enable_pin_ok" msgid="8077439615296694284">"Le code PIN de la carte SIM est activé"</string> <string name="disable_pin_ok" msgid="8552428316206928913">"Code PIN de la carte SIM désactivé"</string> <string name="pin_failed" msgid="6597695909685242127">"Le code PIN saisi était incorrect."</string> <string name="pin_changed" msgid="9000716792724195093">"Le code PIN de la carte SIM a bien été modifié."</string> <string name="puk_requested" msgid="3898394204193202803">"Mot de passe incorrect. La carte SIM est verrouillée ! Clé PUK2 requise."</string> <string name="enter_pin2_text" msgid="8339444124477720345">"PIN2"</string> <string name="oldPin2Label" msgid="8559146795026261502">"Ancien code PIN2"</string> <string name="newPin2Label" msgid="4573956902204349054">"Nouveau code PIN2"</string> <string name="confirmPin2Label" msgid="8100319484454787708">"Confirmer le nouveau code PIN2"</string> <string name="badPuk2" msgid="4072035207011308856">"Le code PIN2 saisi est incorrect. Veuillez réessayer."</string> <string name="badPin2" msgid="515218795152422178">"L\'ancien code PIN2 saisi est incorrect. Veuillez réessayer."</string> <string name="mismatchPin2" msgid="4177060915600342718">"Les codes PIN2 saisis ne correspondent pas. Merci de réessayer."</string> <string name="invalidPin2" msgid="8237110107480395938">"Saisissez un code PIN2 comprenant 4 à 8 chiffres."</string> <string name="invalidPuk2" msgid="1290977391033057871">"Saisissez une clé PUK2 à 8 chiffres."</string> <string name="pin2_changed" msgid="2670422162555916562">"Le code PIN2 a été modifié."</string> <string name="label_puk2_code" msgid="302845876240219560">"Saisissez la clé PUK2."</string> <string name="fdn_enable_puk2_requested" msgid="2608836967081385948">"Le mot de passe est incorrect. Veuillez modifier le code PIN2 et réessayez."</string> <string name="puk2_requested" msgid="5863580927788820813">"Mot de passe incorrect. La carte SIM est verrouillée ! Clé PUK2 requise."</string> <string name="doneButton" msgid="2859593360997984240">"OK"</string> <string name="caller_manage_header" msgid="3231519674734638786">"Conférence téléphonique à <xliff:g id="CONF_CALL_TIME">%s</xliff:g>"</string> <string name="caller_manage_manage_done_text" msgid="8093934725536733856">"Retour à l\'appel"</string> <string name="sim_missing_continueView_text" msgid="4199689081742026077">"Continuer sans carte SIM"</string> <string name="sim_missing_msg_text" msgid="6803619600564142188">"Aucune carte SIM n\'a été trouvée. Insérez une carte SIM dans le téléphone."</string> <string name="sim_unlock_dismiss_text" msgid="8292343981739813597">"Rejeter"</string> <string name="sim_unlock_unlock_text" msgid="6328406783399256930">"Débloquer"</string> <string name="sim_unlock_status_text" msgid="1919609683384607179">"Authentification du code PIN..."</string> <string name="voicemail_settings_number_label" msgid="8524164258691887790">"Numéro de la messagerie vocale"</string> <string name="card_title_dialing" msgid="5769417478498348054">"Appel en cours…"</string> <string name="card_title_in_progress" msgid="8603765629781648862">"Appel en cours"</string> <string name="card_title_conf_call" msgid="1162980346189744501">"Conférence téléphonique"</string> <string name="card_title_incoming_call" msgid="7364539451234646909">"Appel entrant"</string> <string name="card_title_cdma_call_waiting" msgid="4532445524811272644">"Appel CDMA en attente"</string> <string name="card_title_call_ended" msgid="5544730338889702298">"Fin de l\'appel"</string> <string name="card_title_on_hold" msgid="821463117892339942">"En attente"</string> <string name="card_title_hanging_up" msgid="3999101620995182450">"Fin d\'appel"</string> <string name="card_title_in_call" msgid="6346543933068225205">"Appel en cours"</string> <string name="notification_missedCallTitle" msgid="7554385905572364535">"Appel manqué"</string> <string name="notification_missedCallsTitle" msgid="1361677948941502522">"Appels manqués"</string> <string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> appels manqués"</string> <string name="notification_missedCallTicker" msgid="504686252427747209">"Appel manqué de <xliff:g id="MISSED_CALL_FROM">%s</xliff:g>"</string> <string name="notification_ongoing_call_format" msgid="227216462548540316">"Appel en cours (<xliff:g id="DURATION">%s</xliff:g>)"</string> <string name="notification_on_hold" msgid="3480694969511790465">"En attente"</string> <string name="notification_voicemail_title" msgid="8933468752045550523">"Nouvelle messagerie vocale"</string> <string name="notification_voicemail_title_count" msgid="4366360747660929916">"Nouveaux messages vocaux (<xliff:g id="COUNT">%d</xliff:g>)"</string> <string name="notification_voicemail_text_format" msgid="4447323569453981685">"Composer le <xliff:g id="VOICEMAIL_NUMBER">%s</xliff:g>"</string> <string name="notification_voicemail_no_vm_number" msgid="760963466895609716">"Numéro de messagerie vocale inconnu"</string> <string name="incall_error_power_off" msgid="6550191216405193368">"Veuillez d\'abord désactiver le mode Avion, afin d\'effectuer un appel."</string> <string name="incall_error_emergency_only" msgid="4678640422710818317">"Non enregistré sur le réseau."</string> <string name="incall_error_no_phone_number_supplied" msgid="4197432103471807739">"L\'appel n\'a pas été effectué. Le numéro composé n\'est pas valide."</string> <string name="incall_error_call_failed" msgid="4313552620858880999">"L\'appel n\'a pas été effectué."</string> <string name="incall_status_dialed_mmi" msgid="3672498861336189563">"Lancement de la séquence IHM..."</string> <string name="incall_status_dialed_fc" msgid="1632879988662225263">"Lancement de la séquence de codes de service"</string> <string name="incall_error_supp_service_unknown" msgid="2991054870745666038">"Ce service n\'est pas pris en charge."</string> <string name="incall_error_supp_service_switch" msgid="3503552565745872241">"Impossible de changer d\'appel."</string> <string name="incall_error_supp_service_separate" msgid="914362338192301746">"Impossible de dissocier l\'appel"</string> <string name="incall_error_supp_service_transfer" msgid="2509871374644921632">"Impossible de transférer l\'appel."</string> <string name="incall_error_supp_service_conference" msgid="2505727299596357312">"Impossible d\'effectuer des conférences téléphoniques."</string> <string name="incall_error_supp_service_reject" msgid="7055164130563826216">"Impossible de refuser l\'appel."</string> <string name="incall_error_supp_service_hangup" msgid="7417583238334762737">"Impossible de libérer le(s) appel(s)."</string> <string name="emergency_enable_radio_dialog_title" msgid="4627849966634578257">"Appel d\'urgence"</string> <string name="emergency_enable_radio_dialog_message" msgid="207613549344420291">"Activation du signal radio..."</string> <string name="emergency_enable_radio_dialog_retry" msgid="3724423402363063736">"Hors zone de couverture. Nouvelle tentative..."</string> <string name="dial_emergency_error" msgid="8362624131726575194">"L\'appel n\'a pas été effectué. <xliff:g id="NON_EMERGENCY_NUMBER">%s</xliff:g> n\'est pas un numéro d\'urgence !"</string> <string name="dial_emergency_empty_error" msgid="5048645338094088229">"L\'appel n\'a pas été effectué. Veuillez composer un numéro d\'urgence !"</string> <string name="dialerKeyboardHintText" msgid="9192914825413747792">"Utilisez le clavier pour composer un numéro."</string> <string name="dtmfDialpadHintText" msgid="2153335217920679451">"Touches sonores"</string> <string name="dtmfDialpadHandleLabel" msgid="6077872154488117962">"Clavier"</string> <string name="touchLockText" msgid="8742463586429019112">"Appuyez deux fois"\n"pour déverrouiller."</string> <string name="onscreenAnswerText" msgid="7643040500342720792">"Appuyez deux fois"\n"pour répondre."</string> <string name="importSimEntry" msgid="6614358325359736031">"Importer"</string> <string name="importAllSimEntries" msgid="1503181169636198673">"Tout importer"</string> <string name="importingSimContacts" msgid="7374056215462575769">"Importation des contacts SIM"</string> <string name="importToFDNfromContacts" msgid="2130620207013368580">"Importer à partir des contacts"</string> <string-array name="tty_mode_entries"> <item msgid="512950011423868021">"Mode TTY désactivé"</item> <item msgid="4781215771530681384">"TTY HCO"</item> <item msgid="5659212685488676933">"Mode TTY VCO"</item> <item msgid="1113703196326500239">"TTY complet"</item> </string-array> <string name="eri_text_label" msgid="4326942349915331461">"Texte ERI"</string> <string name="dtmf_tones_title" msgid="3866923093113274152">"Tonalités DTMF"</string> <string name="dtmf_tones_summary" msgid="3351820372864020331">"Définir la durée des tonalités DTMF"</string> <string-array name="dtmf_tone_entries"> <item msgid="899650777817315681">"Normales"</item> <item msgid="2883365539347850535">"Longues"</item> </string-array> <string name="network_message" msgid="5673682885938122239">"Message réseau"</string> + + +<!-- CYANOGEN STRINGS --> + <string name="advanced_setting">Paramètres avancés v.23</string> + <string name="vibrate_outgoing">Vibrer sur réponse</string> + <string name="vibrate_outgoing_sum">Vibrer quand appel est répondu</string> + <string name="vibrate_45">Vibrer toutes les 45 secondes</string> + <string name="vibrate_45_sum">Vibrer chaque 45 secondes pendant un appel sortant</string> + <string name="vibrate_hangup">Vibrer sur fin d\'appel</string> + <string name="vibrate_hangup_sum">Vibrer lorsqu\'un appel se termine</string> + <string name="screen_awake">Garder l\'écran actif</string> + <string name="screen_awake_sum">L\'écran restera actif plus longtemps lors d\'un appel</string> + <string name="led_notify_call">Nofitier par DEL d\'un appel manqué</string> + <string name="led_notify_call_sum">Le DEL clignotera quand un appel est manqué</string> + <string name="led_show_organ">Montrer organisation</string> + <string name="led_show_organ_sum">L\'organisation sera montrée sur l\'écran d\'appel</string> + <string name="vibrate_call_waiting">Vibrer sur appel en attente</string> + <string name="vibrate_call_waiting_sum">Vibrer lorsqu\'un appel est en attente</string> + <string name="return_home">Forcer retour au journal d\'appels</string> + <string name="return_home_sum">Force le retour à l\'écran du journal d\'appels après une conversation</string> + <string name="menu_addBlackList">Ajouter à la liste noire</string> + <string name="black_list">Liste noire</string> + <string name="black_list_sum">Les appels entrants provenant de cette liste seront rejetés</string> + <string name="add_black">Ajouter un numéro</string> + <string name="remove_black">Enlever %s de la liste noire ?</string> </resources>
cytown/android_packages_apps_Phone
dcdba2e556e71daf9c53c666d352ddbdeb4b55f1
fix bug for Hitting back on incoming call breaks notification bar
diff --git a/res/values/strings.xml b/res/values/strings.xml index 12e5763..2ecc4d7 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -435,538 +435,538 @@ <string name="general_news_settings">General News</string> <string name="bf_news_settings">Business and Financial News</string> <string name="sports_news_settings">Sports News</string> <string name="entertainment_news_settings">Entertainment News</string> <string name="enable_disable_local">Local</string> <string name="local_enable">Local news enabled</string> <string name="local_disable">Local news disabled</string> <string name="enable_disable_regional">Regional</string> <string name="regional_enable">Regional news enabled</string> <string name="regional_disable">Regional news disabled</string> <string name="enable_disable_national">National</string> <string name="national_enable">National news enabled</string> <string name="national_disable">National news disabled</string> <string name="enable_disable_international">International</string> <string name="international_enable">International news enabled</string> <string name="international_disable">International news disabled</string> <string name="list_language_title">Language</string> <string name="list_language_summary">Select the news language</string> <string-array name="list_language_entries"> <item>English</item> <item>French</item> <item>Spanish</item> <item>Japanese</item> <item>Korean</item> <item>Chinese</item> <item>Hebrew</item> </string-array> <string-array name="list_language_values"> <item>"1"</item> <item>"2"</item> <item>"3"</item> <item>"4"</item> <item>"5"</item> <item>"6"</item> <item>"7"</item> </string-array> <string name="list_language_dtitle">Languages</string> <string name="enable_disable_local_weather">Local Weather</string> <string name="local_weather_enable">Local Weather enabled</string> <string name="local_weather_disable">Local Weather disabled</string> <string name="enable_disable_atr">Area Traffic Reports</string> <string name="atr_enable">Area Traffic Reports enabled</string> <string name="atr_disable">Area Traffic Reports disabled</string> <string name="enable_disable_lafs">Local Airport Flight Schedules</string> <string name="lafs_enable">Local Airport Flight Schedules enabled</string> <string name="lafs_disable">Local Airport Flight Schedules disabled</string> <string name="enable_disable_restaurants">Restaurants</string> <string name="restaurants_enable">Restaurants enabled</string> <string name="restaurants_disable">Restaurants disabled</string> <string name="enable_disable_lodgings">Lodgings</string> <string name="lodgings_enable">Lodgings enabled</string> <string name="lodgings_disable">Lodgings disabled</string> <string name="enable_disable_retail_directory">Retail Directory</string> <string name="retail_directory_enable">Retail Directory enabled</string> <string name="retail_directory_disable">Retail Directory disabled</string> <string name="enable_disable_advertisements">Advertisements</string> <string name="advertisements_enable">Advertisements enabled</string> <string name="advertisements_disable">Advertisements disabled</string> <string name="enable_disable_stock_quotes">Stock Quotes</string> <string name="stock_quotes_enable">Stock Quotes enabled</string> <string name="stock_quotes_disable">Stock Quotes disabled</string> <string name="enable_disable_eo">Employment Opportunities</string> <string name="eo_enable">Employment Opportunities enabled</string> <string name="eo_disable">Employment Opportunities disabled</string> <string name="enable_disable_mhh">Medical, Health and Hospital</string> <string name="mhh_enable">Medical, Health and Hospital enabled</string> <string name="mhh_disable">Medical, Health and Hospital disabled</string> <string name="enable_disable_technology_news">Technology News</string> <string name="technology_news_enable">Technology News enabled</string> <string name="technology_news_disable">Technology News disabled</string> <string name="enable_disable_multi_category">Multi-category</string> <string name="multi_category_enable">Multi-category enabled</string> <string name="multi_category_disable">Multi-category disabled</string> <!-- GSM/UMTS Options strings --> <string name="gsm_umts_network_preferences_title">GSM/UMTS Network Preferences</string> <string name="gsm_umts_network_preferneces_summary">Not implemented yet! </string> <string name="gsm_umts_network_preferences_dialogtitle">GSM/UMTS network preferences</string> <string-array name="gsm_umts_network_preferences_choices"> <item>3G preferred</item> <item>2G only</item> <item>3G only</item> </string-array> <string-array name="gsm_umts_network_preferences_values"> <item>"0"</item> <item>"1"</item> <item>"2"</item> </string-array> <!-- Mobile network settings screen, setting option name --> <string name="prefer_2g">Use only 2G networks</string> <!-- Mobile network settings screen, setting summary text --> <string name="prefer_2g_summary">Saves battery</string> <!-- CDMA System select strings --> <!-- Mobile network settings screen, setting option name --> <string name="cdma_system_select_title">System select</string> <!-- Mobile network settings screen, setting summary text --> <string name="cdma_system_select_summary">Change the cdma roaming mode</string> <!-- System select settings screen title --> <string name="cdma_system_select_dialogtitle">System select</string> <string-array name="cdma_system_select_choices"> <!-- System select dialog screen, setting option name --> <item>Home only</item> <!-- Remove the following option "Affiliated Networks" from the option list --> <!-- <item>Affiliated Networks</item> --> <!-- System select dialog screen, setting option name --> <item>Automatic</item> </string-array> <string-array name="cdma_system_select_values"> <!-- Do not translate. --> <item>"0"</item> <!-- Remove the following value "1" which corresponds to "Affiliated Networks" above --> <!-- <item>"1"</item> --> <!-- Do not translate. --> <item>"2"</item> </string-array> <!-- CDMA Options strings --> <string name="cdma_roaming_mode_title">CDMA Roaming Mode</string> <string name="cdma_roaming_mode_summary">Change the cdma roaming mode</string> <string name="cdma_roaming_mode_dialogtitle">CDMA roaming mode</string> <string-array name="cdma_roaming_mode_choices"> <item>Home Networks only</item> <item>Affiliated Networks</item> <item>Any Network</item> </string-array> <string-array name="cdma_roaming_mode_values"> <item>"0"</item> <item>"1"</item> <item>"2"</item> </string-array> <string name="cdma_network_preferences_title">CDMA Network Preferences</string> <string name="cdma_network_preferneces_summary">Not implemented yet! </string> <string name="cdma_network_preferences_dialogtitle">CDMA network preferences</string> <string-array name="cdma_network_preferences_choices"> <item>CDMA/EvDo auto</item> <item>CDMA w/o EvDo</item> <item>EvDo only</item> </string-array> <string-array name="cdma_network_preferences_values"> <item>"4"</item> <item>"5"</item> <item>"6"</item> </string-array> <string name="subscription_title">CDMA Subscription TEST</string> <string name="subscription_summary">Change between RUIM/SIM and NV</string> <string name="subscription_dialogtitle">subscription</string> <string-array name="subscription_choices"> <item>RUIM/SIM</item> <item>NV</item> </string-array> <string-array name="subscription_values"> <item>"0"</item> <item>"1"</item> </string-array> <!-- FDN settings strings --> <!-- Call settings screen, setting option name --> <string name="fdn">Fixed Dialing Numbers</string> <!-- Call settings screen, button label that takes you to the Fixed Dialing Number management screen --> <string name="manage_fdn_list">FDN list</string> <!-- Call settings screen, preference item label --> <string name="fdn_activation">FDN activation</string> <!-- Call settings setting option name when FDN is enabled --> <string name="fdn_enabled">Fixed Dialing Numbers are enabled</string> <!-- Call settings setting option name when FDN is disabled--> <string name="fdn_disabled">Fixed Dialing Numbers are disabled</string> <!-- Call settings screen, setting option name --> <string name="enable_fdn">Enable FDN</string> <!-- Call settings screen, setting option name --> <string name="disable_fdn">Disable FDN</string> <!-- Call settings screen, setting option name --> <string name="change_pin2">Change PIN2</string> <!-- Call settings screen, setting option name when FDN is enabled --> <string name="enable_fdn_ok">Disable FDN</string> <!-- Call settings screen, setting option name when FDN is disabled --> <string name="disable_fdn_ok">Enable FDN</string> <!-- Call settings screen, setting summary text --> <string name="sum_fdn">Manage Fixed Dialing Numbers</string> <!-- Call settings, FDN screen, setting option name --> <string name="sum_fdn_change_pin">Change PIN for FDN access</string> <!-- Call settings, FDN screen, setting option name --> <string name="sum_fdn_manage_list">Manage phone number list</string> <string name="voice_privacy">Voice Privacy</string> <string name="voice_privacy_summary">Enable enhanced privacy mode</string> <string name="tty_mode_title">TTY mode</string> <string name="tty_mode_summary">Enable TTY mode</string> <string name="tty_mode_option_title">TTY mode</string> <string name="tty_mode_option_summary">Set TTY mode</string> <!-- FDN list screen: menu item label --> <string name="menu_add">Add contact</string> <!-- FDN list screen: menu item label --> <string name="menu_edit">Edit contact</string> <!-- FDN list screen: menu item label --> <string name="menu_delete">Delete contact</string> <!-- FDN related strings --> <!-- Label for PIN2 entry screen --> <string name="get_pin2">Enter PIN2</string> <!-- "Edit FDN Contact" screen: Label for the "name" text field --> <string name="name">Name</string> <!-- "Edit FDN Contact" screen: Label for the "number" text field --> <string name="number">Number</string> <!-- "Edit FDN Contact" screen: Button label for "save" action --> <string name="save">Save</string> <!-- Title of "Edit FDN Contact" screen for a new contact --> <string name="add_fdn_contact">Add fixed dialing contact</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="adding_fdn_contact">Adding fixed dialing contact\u2026</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="fdn_contact_added">Fixed dialing contact added.</string> <!-- Title of "Edit FDN Contact" screen when editing an already-existing contact --> <string name="edit_fdn_contact">Edit fixed dialing contact</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="updating_fdn_contact">Updating fixed dialing contact\u2026</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="fdn_contact_updated">Fixed dialing contact updated.</string> <!-- Title of "Delete FDN Contact" screen --> <string name="delete_fdn_contact">Delete fixed dialing contact</string> <!-- "Delete FDN Contact" screen: status message displayed in a popup (toast) --> <string name="deleting_fdn_contact">Deleting fixed dialing contact\u2026</string> <!-- "Delete FDN Contact" screen: status message displayed in a popup (toast) --> <string name="fdn_contact_deleted">Fixed dialing contact deleted.</string> <!-- FDN settings: error message displayed in a popup (toast) --> <string name="pin2_invalid">PIN2 invalid!</string> <!-- FDN settings: error message displayed in a popup (toast) --> <string name="fdn_invalid_number">Number cannot exceed 20 digits.</string> <!-- ADN related strings --> <!-- Placeholder text displayed while loading the list of SIM contacts --> <string name="simContacts_emptyLoading">Reading from SIM card\u2026</string> <!-- Call settings, string that appears on FDN contact list when there are no contacts on the SIM. --> <string name="simContacts_empty">No contacts on your SIM card.</string> <!-- Call settings: title of the dialog that lets you select contacts from the SIM. --> <string name="simContacts_title">Select contacts to import</string> <!-- SIM PIN strings --> <!-- Title of "Enable/disable SIM PIN" screen --> <string name="enable_pin">Enable/disable SIM PIN</string> <!-- Title of "Change SIM PIN" screen --> <string name="change_pin">Change SIM PIN</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="enter_pin_text">SIM PIN:</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="oldPinLabel">Old PIN</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="newPinLabel">New PIN</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="confirmPinLabel">Confirm new PIN</string> <!-- SIM PIN screen: error message --> <string name="badPin">The old PIN you typed is not correct. Please try again.</string> <!-- SIM PIN screen: error message --> <string name="mismatchPin">The PINs you entered do not match. Please try again.</string> <!-- SIM PIN screen: error message when PIN is too short or too long --> <string name="invalidPin">Type a PIN that is 4 to 8 numbers.</string> <!-- Title of "Disable SIM PIN" screen --> <string name="disable_sim_pin">Disable SIM PIN</string> <!-- Title of "Enable SIM PIN" screen --> <string name="enable_sim_pin">Enable SIM PIN</string> <!-- SIM PIN screen: progress message displayed while enabling --> <string name="enable_in_progress">Please wait\u2026</string> <!-- SIM PIN screen: status message displayed in a popup (toast) --> <string name="enable_pin_ok">SIM PIN enabled</string> <!-- SIM PIN screen: status message displayed in a popup (toast) --> <string name="disable_pin_ok">SIM PIN disabled</string> <!-- SIM PIN screen: error message displayed in a popup (toast) --> <string name="pin_failed">The PIN you typed was incorrect</string> <!-- SIM PIN screen: status message displayed in a popup (toast) --> <string name="pin_changed">SIM PIN changed successfully</string> <!-- SIM PIN screen: error message displayed in a dialog --> <string name="puk_requested">Password incorrect, SIM is locked! PUK2 requested.</string> <!-- SIM PIN2 strings --> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="enter_pin2_text">PIN2</string> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="oldPin2Label">Old PIN2</string> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="newPin2Label">New PIN2</string> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="confirmPin2Label">Confirm new PIN2</string> <!-- SIM PIN2 screen: error message --> <string name="badPuk2">The PUK2 you typed is not correct. Please try again. </string> <!-- SIM PIN2 screen: error message --> <string name="badPin2">The old PIN2 you typed is not correct. Please try again.</string> <!-- SIM PIN2 screen: error message --> <string name="mismatchPin2">The PIN2s you entered do not match. Please try again.</string> <!-- SIM PIN2 screen: error message --> <string name="invalidPin2">Type a PIN2 that is 4 to 8 numbers.</string> <!-- SIM PIN2 screen: error message --> <string name="invalidPuk2">Type a PUK2 that is 8 numbers.</string> <!-- SIM PIN2 screen: status message displayed in a popup (toast) --> <string name="pin2_changed">PIN2 changed successfully</string> <!-- SIM PIN2 screen: label for PUK2 entry widget --> <string name="label_puk2_code">Type PUK2 code</string> <!-- SIM PIN2 screen: error message displayed in a dialog --> <string name="fdn_enable_puk2_requested">Password incorrect, please change PIN2 and retry!</string> <!-- SIM PIN2 screen: error message displayed in a dialog --> <string name="puk2_requested">Password incorrect, SIM is locked! PUK2 requested.</string> <!-- SIM PIN screen: button label --> <string name="doneButton">Done</string> <!-- In-call screen: status label for a conference call --> <string name="caller_manage_header">Conference call <xliff:g id="conf_call_time">%s</xliff:g></string> <!-- In-call screen: Button label on "Manage conference" panel --> <string name="caller_manage_manage_done_text">Back to call</string> <!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. --> <string name="fake_phone_activity_phoneNumber_text">(650) 555-1234</string> <!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. --> <string name="fake_phone_activity_infoText_text">Incoming phone number</string> <!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. --> <string name="fake_phone_activity_placeCall_text">Fake Incoming Call</string> <!-- Button label on "SIM Missing" screen --> <string name="sim_missing_continueView_text">Continue without SIM card</string> <!-- Message displayed on "SIM Missing" screen --> <string name="sim_missing_msg_text">No SIM card found. Please insert a SIM card into the phone.</string> <!-- Button label on "SIM Unlock" screen --> <string name="sim_unlock_dismiss_text">Dismiss</string> <!-- Button label on "SIM Unlock" screen --> <string name="sim_unlock_unlock_text">Unlock</string> <!-- Progress message displayed on "SIM Unlock" screen --> <string name="sim_unlock_status_text">Authenticating PIN\u2026</string> <!-- Call settings screen, Set voicemail dialog title --> <string name="voicemail_settings_number_label">Voicemail number</string> <!-- Card titles --> <!-- In-call screen: status label for a call in the "dialing" state --> <string name="card_title_dialing">Dialing</string> <!-- In-call screen: status label for a call in progress --> <string name="card_title_in_progress">Current call</string> <!-- In-call screen: status label for a conference call --> <string name="card_title_conf_call">Conference call</string> <!-- In-call screen: status label for an incoming call --> <string name="card_title_incoming_call">Incoming call</string> <!-- In-call screen: status label for an cdma call waiting --> <string name="card_title_cdma_call_waiting">Cdma callwaiting </string> <!-- In-call screen: status label displayed briefly after a call ends --> <string name="card_title_call_ended">Call ended</string> <!-- In-call screen: status label for call that's on hold --> <string name="card_title_on_hold">On hold</string> <!-- In-call screen: status label for a call that's in the process of hanging up --> <string name="card_title_hanging_up">Hanging up</string> <!-- In-call screen: status label for a call that's in CDMA flash mode --> <string name="card_title_in_call">In call</string> <!-- Notification strings --> <!-- Missed call notification label, used when there's exactly one missed call --> <string name="notification_missedCallTitle">Missed call</string> <!-- Missed call notification label, used when there are two or more missed calls --> <string name="notification_missedCallsTitle">Missed calls</string> <!-- Missed call notification message used when there are multiple missed calls --> <string name="notification_missedCallsMsg"><xliff:g id="num_missed_calls">%s</xliff:g> missed calls</string> <!-- Missed call notification message used for a single missed call, including the caller-id info from the missed call --> <string name="notification_missedCallTicker">Missed call from <xliff:g id="missed_call_from">%s</xliff:g></string> <!-- The "label" of the in-call Notification for an ongoing call, used as the format string for a Chronometer widget. --> <string name="notification_ongoing_call_format">Current call (<xliff:g id="duration">%s</xliff:g>)</string> <string name="notification_ongoing_calling_format">Calling (<xliff:g id="duration">%s</xliff:g>)</string> <!-- The "label" of the in-call Notification for a call that's on hold --> <string name="notification_on_hold">On hold</string> <!-- Label for the "Voicemail" notification item, when expanded. --> <string name="notification_voicemail_title">New voicemail</string> <!-- Label for the expanded "Voicemail" notification item, including a count of messages. --> <string name="notification_voicemail_title_count">New voicemail (<xliff:g id="count">%d</xliff:g>)</string> <!-- Message displayed in the "Voicemail" notification item, allowing the user to dial the indicated number. --> <string name="notification_voicemail_text_format">Dial <xliff:g id="voicemail_number">%s</xliff:g></string> <!-- Message displayed in the "Voicemail" notification item, indicating that there's no voicemail number available --> <string name="notification_voicemail_no_vm_number">Voicemail number unknown</string> <!-- In-call screen: call failure message displayed in an error dialog --> <string name="incall_error_power_off">To place a call, first turn off Airplane mode.</string> <!-- In-call screen: Error message displayed in a dialog when trying to dial without a SIM card. --> <string name="incall_error_emergency_only">Not registered on network.</string> <!-- In-call screen: call failure message displayed in an error dialog --> <string name="incall_error_no_phone_number_supplied">Call not sent, no valid number entered.</string> <!-- In-call screen: call failure message displayed in an error dialog --> <string name="incall_error_call_failed">Call not sent.</string> <!-- In-call screen: status message displayed in a dialog when starting an MMI --> <string name="incall_status_dialed_mmi">Starting MMI sequence\u2026</string> <!-- In-call screen: status message displayed in a dialog when starting a feature code --> <string name="incall_status_dialed_fc">Starting feature code sequence\u2026</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_unknown">Unsupported service.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_switch">Unable to switch calls.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_separate">Unable to separate call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_transfer">Unable to transfer call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_conference">Unable to conference calls.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_reject">Unable to reject call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_hangup">Unable to release call(s).</string> <!-- Dialog title for the "radio enable" UI for emergency calls --> <string name="emergency_enable_radio_dialog_title">Emergency call</string> <!-- Status message for the "radio enable" UI for emergency calls --> <string name="emergency_enable_radio_dialog_message">Turning on radio\u2026</string> <!-- Status message for the "radio enable" UI for emergency calls --> <string name="emergency_enable_radio_dialog_retry">Out of service area, retrying\u2026</string> <!-- Dialer text on Emergency Dialer --> <!-- Emergency dialer: message displayed in an error dialog --> <string name="dial_emergency_error">Call not sent, <xliff:g id="non_emergency_number">%s</xliff:g> is not an emergency number!</string> <!-- Emergency dialer: message displayed in an error dialog --> <string name="dial_emergency_empty_error">Call not sent, please dial an emergency number!</string> <!-- Displayed in the text entry box in the dialer when in landscape mode to guide the user to dial using the physical keyboard --> <string name="dialerKeyboardHintText">Use keyboard to dial</string> <!-- Hint text displayed in the "digits" field at the top of the in-call DTMF dialpad. (This hint reminds the user that the dialpad is there to generate tones, not to add a new call.) --> <string name="dtmfDialpadHintText">Touch tone keypad</string> <!-- Text displayed in the "sliding drawer handle" that you use to open the in-call DTMF dialpad. --> <string name="dtmfDialpadHandleLabel">Dialpad</string> <!-- Text displayed on the in-call screen's "touch lock" overlay, instructing the user that they need to double-tap to unlock the screen. --> <string name="touchLockText">Tap twice\nto unlock</string> <!-- Text for the onscreen "Answer" button, instructing the user that they need to double-tap to answer the incoming call. --> <string name="onscreenAnswerText">Tap twice\nto answer</string> <!-- Menu item label in SIM Contacts: Import a single contact entry from the SIM card --> <string name="importSimEntry">Import</string> <!-- Menu item label in SIM Contacts: Import all contact entries from the SIM card --> <string name="importAllSimEntries">Import all</string> <!-- SIM Contacts: status message displayed while importing card --> <string name="importingSimContacts">Importing SIM contacts</string> <!-- Import a single contact entry from contacts to the SIM card --> <string name="importToFDNfromContacts">Import from contacts</string> <!-- Service option entries. --> <string-array name="tty_mode_entries"> <item>TTY Off</item> <item>TTY HCO</item> <item>TTY VCO</item> <item>TTY Full</item> </string-array> <!-- Do not translate. --> <string-array name="tty_mode_values"> <!-- Do not translate. --> <item>0</item>" <!-- Do not translate. --> <item>2</item> <!-- Do not translate. --> <item>3</item> <!-- Do not translate. --> <item>1</item> </string-array> <!-- Label for ERI text widget, shown in list of all gadgets --> <string name="eri_text_label">ERI text</string> <!-- Dtmf tones settings --> <!-- Title for the DTMF Tones options displayed in Call Settings --> <string name="dtmf_tones_title">DTMF Tones</string> <!-- Summary for the DTMF Tones options displayed in Call Settings --> <string name="dtmf_tones_summary">Set the length of DTMF tones</string> <!-- Options displayed as part of DTMF Tones in Call Settings --> <string-array name="dtmf_tone_entries"> <item>Normal</item> <item>Long</item> </string-array> <!-- Do not translate. --> <string-array name="dtmf_tone_values"> <item>0</item> <item>1</item> </string-array> <!-- Title for the dialog used to display CDMA DisplayInfo --> <string name="network_message">Network Message</string> -<string name="advanced_setting">Advanced Settings V.22</string> +<string name="advanced_setting">Advanced Settings V.22.3</string> <string name="vibrate_outgoing">Vibrate on answer</string> <string name="vibrate_outgoing_sum">Vibrate when a call is answered</string> <string name="vibrate_45">Vibrate every 45 seconds</string> <string name="vibrate_45_sum">Vibrate every 45 seconds during outgoing calls</string> <string name="vibrate_hangup">Vibrate on hangup</string> <string name="vibrate_hangup_sum">Vibrate when a call has ended</string> <string name="screen_awake">Keep screen awake</string> <string name="screen_awake_sum">Screen will stay awake longer than normal while in-call</string> <string name="led_notify_call">Missed call LED notify</string> <string name="led_notify_call_sum">LED will blink when a call is missed</string> <string name="led_show_organ">Show organization</string> <string name="led_show_organ_sum">Organization will be shown on in-call screen</string> <string name="vibrate_call_waiting">Vibrate on call waiting</string> <string name="vibrate_call_waiting_sum">Vibrate on call waiting</string> <string name="return_home">Force Return Call Log</string> <string name="return_home_sum">Force return to call log screen after a call out end.</string> <string name="menu_addBlackList">Add to Black List</string> <string name="black_list">Black List</string> <string name="black_list_sum">Incoming call in black list will be rejected.</string> <string name="add_black">Add phone number</string> <string name="remove_black">Remove %s from List</string> </resources> diff --git a/src/com/android/phone/InCallScreen.java b/src/com/android/phone/InCallScreen.java index 7b97d5a..55545c6 100755 --- a/src/com/android/phone/InCallScreen.java +++ b/src/com/android/phone/InCallScreen.java @@ -164,1108 +164,1108 @@ public class InCallScreen extends Activity * Non-interactive UI state. Call card is visible, * displaying information about the call that just ended. */ CALL_ENDED } private InCallScreenMode mInCallScreenMode; // Possible error conditions that can happen on startup. // These are returned as status codes from the various helper // functions we call from onCreate() and/or onResume(). // See syncWithPhoneState() and checkIfOkToInitiateOutgoingCall() for details. private enum InCallInitStatus { SUCCESS, VOICEMAIL_NUMBER_MISSING, POWER_OFF, EMERGENCY_ONLY, PHONE_NOT_IN_USE, NO_PHONE_NUMBER_SUPPLIED, DIALED_MMI, CALL_FAILED } private InCallInitStatus mInCallInitialStatus; // see onResume() private boolean mRegisteredForPhoneStates; private Phone mPhone; private Call mForegroundCall; private Call mBackgroundCall; private Call mRingingCall; private BluetoothHandsfree mBluetoothHandsfree; private BluetoothHeadset mBluetoothHeadset; private boolean mBluetoothConnectionPending; private long mBluetoothConnectionRequestTime; // Main in-call UI ViewGroups private ViewGroup mMainFrame; private ViewGroup mInCallPanel; // Menu button hint below the "main frame" private TextView mMenuButtonHint; // Main in-call UI elements: private CallCard mCallCard; private InCallMenu mInCallMenu; // created lazily on first MENU keypress /** * DTMF Dialer objects, including the model and the sliding drawer / dialer * UI container and the dialer display field for landscape presentation. */ private DTMFTwelveKeyDialer mDialer; private SlidingDrawer mDialerDrawer; private EditText mDTMFDisplay; // "Manage conference" UI elements private ViewGroup mManageConferencePanel; private Button mButtonManageConferenceDone; private ViewGroup[] mConferenceCallList; private int mNumCallersInConference; private Chronometer mConferenceTime; private EditText mWildPromptText; // "Touch lock" overlay graphic private View mTouchLockOverlay; // The overlay over the whole screen private View mTouchLockIcon; // The "lock" icon in the middle of the screen private Animation mTouchLockFadeIn; private long mTouchLockLastTouchTime; // in SystemClock.uptimeMillis() time base // Onscreen "answer" UI, for devices with no hardware CALL button. private View mOnscreenAnswerUiContainer; // The container for the whole UI, or null if unused private View mOnscreenAnswerButton; // The "answer" button itself private long mOnscreenAnswerButtonLastTouchTime; // in SystemClock.uptimeMillis() time base // Various dialogs we bring up (see dismissAllDialogs()) // The MMI started dialog can actually be one of 2 items: // 1. An alert dialog if the MMI code is a normal MMI // 2. A progress dialog if the user requested a USSD private Dialog mMmiStartedDialog; private AlertDialog mMissingVoicemailDialog; private AlertDialog mGenericErrorDialog; private AlertDialog mSuppServiceFailureDialog; private AlertDialog mWaitPromptDialog; private AlertDialog mWildPromptDialog; // TODO: If the Activity class ever provides an easy way to get the // current "activity lifecycle" state, we can remove these flags. private boolean mIsDestroyed = false; private boolean mIsForegroundActivity = false; // Flag indicating whether or not we should bring up the Call Log when // exiting the in-call UI due to the Phone becoming idle. (This is // true if the most recently disconnected Call was initiated by the // user, or false if it was an incoming call.) // This flag is used by delayedCleanupAfterDisconnect(), and is set by // onDisconnect() (which is the only place that either posts a // DELAYED_CLEANUP_AFTER_DISCONNECT event *or* calls // delayedCleanupAfterDisconnect() directly.) private boolean mShowCallLogAfterDisconnect; private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { if (mIsDestroyed) { if (DBG) log("Handler: ignoring message " + msg + "; we're destroyed!"); return; } if (!mIsForegroundActivity) { if (DBG) log("Handler: handling message " + msg + " while not in foreground"); // Continue anyway; some of the messages below *want* to // be handled even if we're not the foreground activity // (like DELAYED_CLEANUP_AFTER_DISCONNECT), and they all // should at least be safe to handle if we're not in the // foreground... } PhoneApp app = PhoneApp.getInstance(); switch (msg.what) { case SUPP_SERVICE_FAILED: onSuppServiceFailed((AsyncResult) msg.obj); break; case PHONE_STATE_CHANGED: onPhoneStateChanged((AsyncResult) msg.obj); break; case PHONE_DISCONNECT: onDisconnect((AsyncResult) msg.obj); break; case EVENT_HEADSET_PLUG_STATE_CHANGED: // Update the in-call UI, since some UI elements (in // particular the "Speaker" menu button) change state // depending on whether a headset is plugged in. // TODO: A full updateScreen() is overkill here, since // the value of PhoneApp.isHeadsetPlugged() only affects a // single menu item. (But even a full updateScreen() // is still pretty cheap, so let's keep this simple // for now.) if (msg.arg1 != 1 && !isBluetoothAudioConnected()){ // If the state is "not connected", restore the speaker state. // We ONLY want to do this on the wired headset connect / // disconnect events for now though, so we're only triggering // on EVENT_HEADSET_PLUG_STATE_CHANGED. PhoneUtils.restoreSpeakerMode(getApplicationContext()); } updateScreen(); break; case PhoneApp.MMI_INITIATE: onMMIInitiate((AsyncResult) msg.obj); break; case PhoneApp.MMI_CANCEL: onMMICancel(); break; // handle the mmi complete message. // since the message display class has been replaced with // a system dialog in PhoneUtils.displayMMIComplete(), we // should finish the activity here to close the window. case PhoneApp.MMI_COMPLETE: // Check the code to see if the request is ready to // finish, this includes any MMI state that is not // PENDING. MmiCode mmiCode = (MmiCode) ((AsyncResult) msg.obj).result; // if phone is a CDMA phone display feature code completed message if (mPhone.getPhoneName().equals("CDMA")) { PhoneUtils.displayMMIComplete(mPhone, app, mmiCode, null, null); } else { if (mmiCode.getState() != MmiCode.State.PENDING) { if (DBG) log("Got MMI_COMPLETE, finishing..."); finish(); } } break; case POST_ON_DIAL_CHARS: handlePostOnDialChars((AsyncResult) msg.obj, (char) msg.arg1); break; case ADD_VOICEMAIL_NUMBER: addVoiceMailNumberPanel(); break; case DONT_ADD_VOICEMAIL_NUMBER: dontAddVoiceMailNumber(); break; case DELAYED_CLEANUP_AFTER_DISCONNECT: delayedCleanupAfterDisconnect(); break; case DISMISS_MENU: // dismissMenu() has no effect if the menu is already closed. dismissMenu(true); // dismissImmediate = true break; case ALLOW_SCREEN_ON: if (VDBG) log("ALLOW_SCREEN_ON message..."); // Undo our previous call to preventScreenOn(true). // (Note this will cause the screen to turn on // immediately, if it's currently off because of a // prior preventScreenOn(true) call.) app.preventScreenOn(false); break; case TOUCH_LOCK_TIMER: if (VDBG) log("TOUCH_LOCK_TIMER..."); touchLockTimerExpired(); break; case BLUETOOTH_STATE_CHANGED: if (VDBG) log("BLUETOOTH_STATE_CHANGED..."); // The bluetooth headset state changed, so some UI // elements may need to update. (There's no need to // look up the current state here, since any UI // elements that care about the bluetooth state get it // directly from PhoneApp.showBluetoothIndication().) updateScreen(); break; case PHONE_CDMA_CALL_WAITING: if (DBG) log("Received PHONE_CDMA_CALL_WAITING event ..."); Connection cn = mRingingCall.getLatestConnection(); // Only proceed if we get a valid connection object if (cn != null) { // Finally update screen with Call waiting info and request // screen to wake up updateScreen(); app.updateWakeState(); } break; case THREEWAY_CALLERINFO_DISPLAY_DONE: if (DBG) log("Received THREEWAY_CALLERINFO_DISPLAY_DONE event ..."); if (app.cdmaPhoneCallState.getCurrentCallState() == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) { // Set the mThreeWayCallOrigStateDialing state to true app.cdmaPhoneCallState.setThreeWayCallOrigState(false); //Finally update screen with with the current on going call updateScreen(); } break; } } }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_HEADSET_PLUG)) { // Listen for ACTION_HEADSET_PLUG broadcasts so that we // can update the onscreen UI when the headset state changes. // if (DBG) log("mReceiver: ACTION_HEADSET_PLUG"); // if (DBG) log("==> intent: " + intent); // if (DBG) log(" state: " + intent.getIntExtra("state", 0)); // if (DBG) log(" name: " + intent.getStringExtra("name")); // send the event and add the state as an argument. Message message = Message.obtain(mHandler, EVENT_HEADSET_PLUG_STATE_CHANGED, intent.getIntExtra("state", 0), 0); mHandler.sendMessage(message); } } }; @Override protected void onCreate(Bundle icicle) { if (DBG) log("onCreate()... this = " + this); Profiler.callScreenOnCreate(); super.onCreate(icicle); final PhoneApp app = PhoneApp.getInstance(); app.setInCallScreenInstance(this); setPhone(app.phone); // Sets mPhone and mForegroundCall/mBackgroundCall/mRingingCall mBluetoothHandsfree = app.getBluetoothHandsfree(); if (VDBG) log("- mBluetoothHandsfree: " + mBluetoothHandsfree); if (mBluetoothHandsfree != null) { // The PhoneApp only creates a BluetoothHandsfree instance in the // first place if getSystemService(Context.BLUETOOTH_SERVICE) // succeeds. So at this point we know the device is BT-capable. mBluetoothHeadset = new BluetoothHeadset(this, null); if (VDBG) log("- Got BluetoothHeadset: " + mBluetoothHeadset); } requestWindowFeature(Window.FEATURE_NO_TITLE); // Inflate everything in incall_screen.xml and add it to the screen. setContentView(R.layout.incall_screen); mDialerDrawer = (SlidingDrawer) findViewById(R.id.dialer_container); initInCallScreen(); // Create the dtmf dialer. Note that mDialer is instantiated // regardless of screen orientation, although the onscreen touchable // dialpad is used only in portrait mode. mDialer = new DTMFTwelveKeyDialer(this); registerForPhoneStates(); // No need to change wake state here; that happens in onResume() when we // are actually displayed. // Handle the Intent we were launched with, but only if this is the // the very first time we're being launched (ie. NOT if we're being // re-initialized after previously being shut down.) // Once we're up and running, any future Intents we need // to handle will come in via the onNewIntent() method. if (icicle == null) { if (DBG) log("onCreate(): this is our very first launch, checking intent..."); // Stash the result code from internalResolveIntent() in the // mInCallInitialStatus field. If it's an error code, we'll // handle it in onResume(). mInCallInitialStatus = internalResolveIntent(getIntent()); if (mInCallInitialStatus != InCallInitStatus.SUCCESS) { Log.w(LOG_TAG, "onCreate: status " + mInCallInitialStatus + " from internalResolveIntent()"); // See onResume() for the actual error handling. } } else { mInCallInitialStatus = InCallInitStatus.SUCCESS; } // When in landscape mode, the user can enter dtmf tones // at any time. We need to make sure the DTMFDialer is // setup correctly. if (ConfigurationHelper.isLandscape()) { mDialer.startDialerSession(); if (VDBG) log("Dialer initialized (in landscape mode)."); } Profiler.callScreenCreated(); } /** * Sets the Phone object used internally by the InCallScreen. * * In normal operation this is called from onCreate(), and the * passed-in Phone object comes from the PhoneApp. * For testing, test classes can use this method to * inject a test Phone instance. */ /* package */ void setPhone(Phone phone) { mPhone = phone; // Hang onto the three Call objects too; they're singletons that // are constant (and never null) for the life of the Phone. mForegroundCall = mPhone.getForegroundCall(); mBackgroundCall = mPhone.getBackgroundCall(); mRingingCall = mPhone.getRingingCall(); } @Override protected void onResume() { if (DBG) log("onResume()..."); super.onResume(); mIsForegroundActivity = true; final PhoneApp app = PhoneApp.getInstance(); // Disable the keyguard the entire time the InCallScreen is // active. (This is necessary only for the case of receiving an // incoming call while the device is locked; we need to disable // the keyguard so you can answer the call and use the in-call UI, // but we always re-enable the keyguard as soon as you leave this // screen (see onPause().)) app.disableKeyguard(); // Touch events are never considered "user activity" while the // InCallScreen is active, so that unintentional touches won't // prevent the device from going to sleep. app.setIgnoreTouchUserActivity(true); // Disable the status bar "window shade" the entire time we're on // the in-call screen. NotificationMgr.getDefault().getStatusBarMgr().enableExpandedView(false); // Listen for broadcast intents that might affect the onscreen UI. registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG)); // Check for any failures that happened during onCreate() or onNewIntent(). if (DBG) log("- onResume: initial status = " + mInCallInitialStatus); if (mInCallInitialStatus != InCallInitStatus.SUCCESS) { if (DBG) log("- onResume: failure during startup: " + mInCallInitialStatus); // Don't bring up the regular Phone UI! Instead bring up // something more specific to let the user deal with the // problem. handleStartupError(mInCallInitialStatus); // But it *is* OK to continue with the rest of onResume(), // since any further setup steps (like updateScreen() and the // CallCard setup) will fall back to a "blank" state if the // phone isn't in use. mInCallInitialStatus = InCallInitStatus.SUCCESS; } // Set the volume control handler while we are in the foreground. if (isBluetoothAudioConnected()) { setVolumeControlStream(AudioManager.STREAM_BLUETOOTH_SCO); } else { setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); } takeKeyEvents(true); // Always start off in NORMAL mode. setInCallScreenMode(InCallScreenMode.NORMAL); // Before checking the state of the phone, clean up any // connections in the DISCONNECTED state. // (The DISCONNECTED state is used only to drive the "call ended" // UI; it's totally useless when *entering* the InCallScreen.) mPhone.clearDisconnected(); InCallInitStatus status = syncWithPhoneState(); if (status != InCallInitStatus.SUCCESS) { if (DBG) log("- syncWithPhoneState failed! status = " + status); // Couldn't update the UI, presumably because the phone is totally // idle. But don't finish() immediately, since we might still // have an error dialog up that the user needs to see. // (And in that case, the error dialog is responsible for calling // finish() when the user dismisses it.) } if (ENABLE_PHONE_UI_EVENT_LOGGING) { // InCallScreen is now active. Checkin.logEvent(getContentResolver(), Checkin.Events.Tag.PHONE_UI, PHONE_UI_EVENT_ENTER); } // Update the poke lock and wake lock when we move to // the foreground. // // But we need to do something special if we're coming // to the foreground while an incoming call is ringing: if (mPhone.getState() == Phone.State.RINGING) { // If the phone is ringing, we *should* already be holding a // full wake lock (which we would have acquired before // firing off the intent that brought us here; see // PhoneUtils.showIncomingCallUi().) // // We also called preventScreenOn(true) at that point, to // avoid cosmetic glitches while we were being launched. // So now we need to post an ALLOW_SCREEN_ON message to // (eventually) undo the prior preventScreenOn(true) call. // // (In principle we shouldn't do this until after our first // layout/draw pass. But in practice, the delay caused by // simply waiting for the end of the message queue is long // enough to avoid any flickering of the lock screen before // the InCallScreen comes up.) if (VDBG) log("- posting ALLOW_SCREEN_ON message..."); mHandler.removeMessages(ALLOW_SCREEN_ON); mHandler.sendEmptyMessage(ALLOW_SCREEN_ON); // TODO: There ought to be a more elegant way of doing this, // probably by having the PowerManager and ActivityManager // work together to let apps request that the screen on/off // state be synchronized with the Activity lifecycle. // (See bug 1648751.) } else { // The phone isn't ringing; this is either an outgoing call, or // we're returning to a call in progress. There *shouldn't* be // any prior preventScreenOn(true) call that we need to undo, // but let's do this just to be safe: app.preventScreenOn(false); } app.updateWakeState(); // The "touch lock" overlay is NEVER visible when we resume. // (In particular, this check ensures that we won't still be // locked after the user wakes up the screen by pressing MENU.) enableTouchLock(false); // ...but if the dialpad is open we DO need to start the timer // that will eventually bring up the "touch lock" overlay. if (mDialer.isOpened()) resetTouchLockTimer(); // Restore the mute state if the last mute state change was NOT // done by the user. if (app.getRestoreMuteOnInCallResume()) { PhoneUtils.restoreMuteState(mPhone); app.setRestoreMuteOnInCallResume(false); } Profiler.profileViewCreate(getWindow(), InCallScreen.class.getName()); if (VDBG) log("onResume() done."); } @Override protected void onSaveInstanceState(Bundle outState) { if (VDBG) log("onSaveInstanceState()..."); super.onSaveInstanceState(outState); // TODO: Save any state of the UI that needs to persist across // configuration changes (ie. switching between portrait and // landscape.) } @Override protected void onPause() { -// if (DBG) log("onPause()..."); + if (DBG) log("onPause()..."); super.onPause(); -if (mPhone.getState() != Phone.State.RINGING) { - if (DBG) log("onPause()..."); +//if (mPhone.getState() != Phone.State.RINGING) { +// if (DBG) log("onPause()..."); mIsForegroundActivity = false; final PhoneApp app = PhoneApp.getInstance(); // make sure the chronometer is stopped when we move away from // the foreground. if (mConferenceTime != null) { mConferenceTime.stop(); } // as a catch-all, make sure that any dtmf tones are stopped // when the UI is no longer in the foreground. mDialer.onDialerKeyUp(null); // If the device is put to sleep as the phone call is ending, // we may see cases where the DELAYED_CLEANUP_AFTER_DISCONNECT // event gets handled AFTER the device goes to sleep and wakes // up again. // This is because it is possible for a sleep command // (executed with the End Call key) to come during the 2 // seconds that the "Call Ended" screen is up. Sleep then // pauses the device (including the cleanup event) and // resumes the event when it wakes up. // To fix this, we introduce a bit of code that pushes the UI // to the background if we pause and see a request to // DELAYED_CLEANUP_AFTER_DISCONNECT. // Note: We can try to finish directly, by: // 1. Removing the DELAYED_CLEANUP_AFTER_DISCONNECT messages // 2. Calling delayedCleanupAfterDisconnect directly // However, doing so can cause problems between the phone // app and the keyguard - the keyguard is trying to sleep at // the same time that the phone state is changing. This can // end up causing the sleep request to be ignored. if (mHandler.hasMessages(DELAYED_CLEANUP_AFTER_DISCONNECT)) { if (DBG) log("DELAYED_CLEANUP_AFTER_DISCONNECT detected, moving UI to background."); finish(); } if (ENABLE_PHONE_UI_EVENT_LOGGING) { // InCallScreen is no longer active. Checkin.logEvent(getContentResolver(), Checkin.Events.Tag.PHONE_UI, PHONE_UI_EVENT_EXIT); } // Clean up the menu, in case we get paused while the menu is up // for some reason. dismissMenu(true); // dismiss immediately // Dismiss any dialogs we may have brought up, just to be 100% // sure they won't still be around when we get back here. dismissAllDialogs(); // Re-enable the status bar (which we disabled in onResume().) NotificationMgr.getDefault().getStatusBarMgr().enableExpandedView(true); // Re-enable "user activity" for touch events. // We actually do this slightly *after* onPause(), to work around a // race condition where a touch can come in after we've paused // but before the device actually goes to sleep. // TODO: The PowerManager itself should prevent this from happening. mHandler.postDelayed(new Runnable() { public void run() { app.setIgnoreTouchUserActivity(false); } }, 500); // The keyguard was disabled the entire time the InCallScreen was // active (see onResume()). Re-enable it now. app.reenableKeyguard(); // Make sure we revert the poke lock and wake lock when we move to // the background. app.updateWakeState(); -} +//} // Unregister for broadcast intents. (These affect the visible UI // of the InCallScreen, so we only care about them while we're in the // foreground.) unregisterReceiver(mReceiver); } @Override protected void onStop() { if (VDBG) log("onStop()..."); super.onStop(); stopTimer(); Phone.State state = mPhone.getState(); if (VDBG) log("onStop: state = " + state); if (state == Phone.State.IDLE) { // we don't want the call screen to remain in the activity history // if there are not active or ringing calls. if (DBG) log("- onStop: calling finish() to clear activity history..."); finish(); } } @Override protected void onDestroy() { if (DBG) log("onDestroy()..."); super.onDestroy(); // Set the magic flag that tells us NOT to handle any handler // messages that come in asynchronously after we get destroyed. mIsDestroyed = true; final PhoneApp app = PhoneApp.getInstance(); app.setInCallScreenInstance(null); // Clear out the InCallScreen references in various helper objects // (to let them know we've been destroyed). if (mInCallMenu != null) { mInCallMenu.clearInCallScreenReference(); } if (mCallCard != null) { mCallCard.setInCallScreenInstance(null); } // Make sure that the dialer session is over and done with. // 1. In Landscape mode, we stop the tone generator directly // 2. In portrait mode, the tone generator is stopped // whenever the dialer is closed by the framework, (either // from a user request or calling close on the drawer // directly), so all we have to do is to make sure the // dialer is closed {see DTMFTwelvKeyDialer.onDialerClose} // (it is ok to call this even if the dialer is not open). if (ConfigurationHelper.isLandscape()) { mDialer.stopDialerSession(); } else { // make sure the dialer drawer is closed. mDialer.closeDialer(false); } mDialer.clearInCallScreenReference(); mDialer = null; unregisterForPhoneStates(); // No need to change wake state here; that happens in onPause() when we // are moving out of the foreground. if (mBluetoothHeadset != null) { mBluetoothHeadset.close(); mBluetoothHeadset = null; } } /** * Dismisses the in-call screen. * * We never *really* finish() the InCallScreen, since we don't want to * get destroyed and then have to be re-created from scratch for the * next call. Instead, we just move ourselves to the back of the * activity stack. * * This also means that we'll no longer be reachable via the BACK * button (since moveTaskToBack() puts us behind the Home app, but the * home app doesn't allow the BACK key to move you any farther down in * the history stack.) * * (Since the Phone app itself is never killed, this basically means * that we'll keep a single InCallScreen instance around for the * entire uptime of the device. This noticeably improves the UI * responsiveness for incoming calls.) */ @Override public void finish() { if (DBG) log("finish()..."); moveTaskToBack(true); } /* package */ boolean isForegroundActivity() { return mIsForegroundActivity; } private void registerForPhoneStates() { if (!mRegisteredForPhoneStates) { mPhone.registerForPhoneStateChanged(mHandler, PHONE_STATE_CHANGED, null); mPhone.registerForDisconnect(mHandler, PHONE_DISCONNECT, null); if (mPhone.getPhoneName().equals("GSM")) { mPhone.registerForMmiInitiate(mHandler, PhoneApp.MMI_INITIATE, null); // register for the MMI complete message. Upon completion, // PhoneUtils will bring up a system dialog instead of the // message display class in PhoneUtils.displayMMIComplete(). // We'll listen for that message too, so that we can finish // the activity at the same time. mPhone.registerForMmiComplete(mHandler, PhoneApp.MMI_COMPLETE, null); } else { // CDMA if (DBG) log("Registering for Call Waiting."); mPhone.registerForCallWaiting(mHandler, PHONE_CDMA_CALL_WAITING, null); } mPhone.setOnPostDialCharacter(mHandler, POST_ON_DIAL_CHARS, null); mPhone.registerForSuppServiceFailed(mHandler, SUPP_SERVICE_FAILED, null); mRegisteredForPhoneStates = true; } } private void unregisterForPhoneStates() { mPhone.unregisterForPhoneStateChanged(mHandler); mPhone.unregisterForDisconnect(mHandler); mPhone.unregisterForMmiInitiate(mHandler); mPhone.unregisterForCallWaiting(mHandler); mPhone.setOnPostDialCharacter(null, POST_ON_DIAL_CHARS, null); mRegisteredForPhoneStates = false; } /* package */ void updateAfterRadioTechnologyChange() { if (DBG) Log.d(LOG_TAG, "updateAfterRadioTechnologyChange()..."); // Unregister for all events from the old obsolete phone unregisterForPhoneStates(); // (Re)register for all events relevant to the new active phone registerForPhoneStates(); } @Override protected void onNewIntent(Intent intent) { if (DBG) log("onNewIntent: intent=" + intent); // We're being re-launched with a new Intent. Since we keep // around a single InCallScreen instance for the life of the phone // process (see finish()), this sequence will happen EVERY time // there's a new incoming or outgoing call except for the very // first time the InCallScreen gets created. This sequence will // also happen if the InCallScreen is already in the foreground // (e.g. getting a new ACTION_CALL intent while we were already // using the other line.) // Stash away the new intent so that we can get it in the future // by calling getIntent(). (Otherwise getIntent() will return the // original Intent from when we first got created!) setIntent(intent); // Activities are always paused before receiving a new intent, so // we can count on our onResume() method being called next. // Just like in onCreate(), handle this intent, and stash the // result code from internalResolveIntent() in the // mInCallInitialStatus field. If it's an error code, we'll // handle it in onResume(). mInCallInitialStatus = internalResolveIntent(intent); if (mInCallInitialStatus != InCallInitStatus.SUCCESS) { Log.w(LOG_TAG, "onNewIntent: status " + mInCallInitialStatus + " from internalResolveIntent()"); // See onResume() for the actual error handling. } } private InCallInitStatus internalResolveIntent(Intent intent) { if (intent == null || intent.getAction() == null) { return InCallInitStatus.SUCCESS; } String action = intent.getAction(); if (DBG) log("internalResolveIntent: action=" + action); // The calls to setRestoreMuteOnInCallResume() inform the phone // that we're dealing with new connections (either a placing an // outgoing call or answering an incoming one, and NOT handling // an aborted "Add Call" request), so we should let the mute state // be handled by the PhoneUtils phone state change handler. final PhoneApp app = PhoneApp.getInstance(); if (action.equals(Intent.ACTION_ANSWER)) { internalAnswerCall(); app.setRestoreMuteOnInCallResume(false); return InCallInitStatus.SUCCESS; } else if (action.equals(Intent.ACTION_CALL) || action.equals(Intent.ACTION_CALL_EMERGENCY)) { app.setRestoreMuteOnInCallResume(false); return placeCall(intent); } else if (action.equals(intent.ACTION_MAIN)) { // The MAIN action is used to bring up the in-call screen without // doing any other explicit action, like when you return to the // current call after previously bailing out of the in-call UI. // SHOW_DIALPAD_EXTRA can be used here to specify whether the DTMF // dialpad should be initially visible. If the extra isn't // present at all, we just leave the dialpad in its previous state. if (intent.hasExtra(SHOW_DIALPAD_EXTRA)) { boolean showDialpad = intent.getBooleanExtra(SHOW_DIALPAD_EXTRA, false); if (VDBG) log("- internalResolveIntent: SHOW_DIALPAD_EXTRA value = " + showDialpad); if (showDialpad) { mDialer.openDialer(false); // no "opening" animation } else { mDialer.closeDialer(false); // no "closing" animation } } return InCallInitStatus.SUCCESS; } else { Log.w(LOG_TAG, "internalResolveIntent: unexpected intent action: " + action); // But continue the best we can (basically treating this case // like ACTION_MAIN...) return InCallInitStatus.SUCCESS; } } private void stopTimer() { if (mCallCard != null) mCallCard.stopTimer(); } private void initInCallScreen() { if (VDBG) log("initInCallScreen()..."); // Have the WindowManager filter out touch events that are "too fat". getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES); mMainFrame = (ViewGroup) findViewById(R.id.mainFrame); mInCallPanel = (ViewGroup) findViewById(R.id.inCallPanel); ConfigurationHelper.initConfiguration(getResources().getConfiguration()); // Create a CallCard and add it to our View hierarchy. // TODO: there's no good reason for call_card_popup to be a // separate layout that we need to manually inflate here. // (That design is left over from when the call card was drawn in // its own PopupWindow.) // Instead, the CallCard should just be <include>d directly from // incall_screen.xml. View callCardLayout = getLayoutInflater().inflate( R.layout.call_card_popup, mInCallPanel); mCallCard = (CallCard) callCardLayout.findViewById(R.id.callCard); if (VDBG) log(" - mCallCard = " + mCallCard); mCallCard.setInCallScreenInstance(this); // Menu Button hint mMenuButtonHint = (TextView) findViewById(R.id.menuButtonHint); // Other platform-specific UI initialization. initOnscreenAnswerUi(); // Make any final updates to our View hierarchy that depend on the // current configuration. ConfigurationHelper.applyConfigurationToLayout(this); } /** * Returns true if the phone is "in use", meaning that at least one line * is active (ie. off hook or ringing or dialing). Conversely, a return * value of false means there's currently no phone activity at all. */ private boolean phoneIsInUse() { return mPhone.getState() != Phone.State.IDLE; } private boolean handleDialerKeyDown(int keyCode, KeyEvent event) { if (VDBG) log("handleDialerKeyDown: keyCode " + keyCode + ", event " + event + "..."); // As soon as the user starts typing valid dialable keys on the // keyboard (presumably to type DTMF tones) we start passing the // key events to the DTMFDialer's onDialerKeyDown. We do so // only if the okToDialDTMFTones() conditions pass. if (okToDialDTMFTones()) { return mDialer.onDialerKeyDown(event); } return false; } /** * Handles a DOWN keypress on the BACK key. */ private boolean handleBackKey() { if (VDBG) log("handleBackKey()..."); // While an incoming call is ringing, BACK behaves just like // ENDCALL: it stops the ringing and rejects the current call. final CallNotifier notifier = PhoneApp.getInstance().notifier; if (notifier.isRinging()) { if (DBG) log("BACK key while ringing: reject the call"); internalHangupRingingCall(); // Don't consume the key; instead let the BACK event *also* // get handled normally by the framework (which presumably // will cause us to exit out of this activity.) return false; } // BACK is also used to exit out of any "special modes" of the // in-call UI: if (mDialer.isOpened()) { // Take down the "touch lock" overlay *immediately* to let the // user clearly see the DTMF dialpad's closing animation. enableTouchLock(false); mDialer.closeDialer(true); // do the "closing" animation return true; } if (mInCallScreenMode == InCallScreenMode.MANAGE_CONFERENCE) { // Hide the Manage Conference panel, return to NORMAL mode. setInCallScreenMode(InCallScreenMode.NORMAL); return true; } return false; } /** * Handles the green CALL key while in-call. * @return true if we consumed the event. */ private boolean handleCallKey() { // The green CALL button means either "Answer", "Unhold", or // "Swap calls", or can be a no-op, depending on the current state // of the Phone. final boolean hasRingingCall = !mRingingCall.isIdle(); final boolean hasActiveCall = !mForegroundCall.isIdle(); final boolean hasHoldingCall = !mBackgroundCall.isIdle(); if (mPhone.getPhoneName().equals("CDMA")) { // The green CALL button means either "Answer", "Swap calls/On Hold", or // "Add to 3WC", depending on the current state of the Phone. PhoneApp app = PhoneApp.getInstance(); CdmaPhoneCallState.PhoneCallState currCallState = app.cdmaPhoneCallState.getCurrentCallState(); if (hasRingingCall) { //Scenario 1: Accepting the First Incoming and Call Waiting call if (DBG) log("answerCall: First Incoming and Call Waiting scenario"); internalAnswerCall(); // Automatically holds the current active call, // if there is one } else if ((currCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (hasActiveCall)) { //Scenario 2: Merging 3Way calls if (DBG) log("answerCall: Merge 3-way call scenario"); // Merge calls PhoneUtils.mergeCalls(mPhone); } else if (currCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) { //Scenario 3: Switching between two Call waiting calls or drop the latest // connection if in a 3Way merge scenario if (DBG) log("answerCall: Switch btwn 2 calls scenario"); // Send flash cmd PhoneUtils.switchHoldingAndActive(mPhone); } } else { // GSM. if (hasRingingCall) { // If an incoming call is ringing, the CALL button is actually // handled by the PhoneWindowManager. (We do this to make // sure that we'll respond to the key even if the InCallScreen // hasn't come to the foreground yet.) // // We'd only ever get here in the extremely rare case that the // incoming call started ringing *after* // PhoneWindowManager.interceptKeyTq() but before the event // got here, or else if the PhoneWindowManager had some // problem connecting to the ITelephony service. Log.w(LOG_TAG, "handleCallKey: incoming call is ringing!" + " (PhoneWindowManager should have handled this key.)"); // But go ahead and handle the key as normal, since the // PhoneWindowManager presumably did NOT handle it: // There's an incoming ringing call: CALL means "Answer". if (hasActiveCall && hasHoldingCall) { if (DBG) log("handleCallKey: ringing (both lines in use) ==> answer!"); internalAnswerCallBothLinesInUse(); } else { if (DBG) log("handleCallKey: ringing ==> answer!"); internalAnswerCall(); // Automatically holds the current active call, // if there is one } } else if (hasActiveCall && hasHoldingCall) { // Two lines are in use: CALL means "Swap calls". if (DBG) log("handleCallKey: both lines in use ==> swap calls."); internalSwapCalls(); } else if (hasHoldingCall) { // There's only one line in use, AND it's on hold. // In this case CALL is a shortcut for "unhold". if (DBG) log("handleCallKey: call on hold ==> unhold."); PhoneUtils.switchHoldingAndActive(mPhone); // Really means "unhold" in this state } else { // The most common case: there's only one line in use, and // it's an active call (i.e. it's not on hold.) // In this case CALL is a no-op. // (This used to be a shortcut for "add call", but that was a // bad idea because "Add call" is so infrequently-used, and // because the user experience is pretty confusing if you // inadvertently trigger it.) if (VDBG) log("handleCallKey: call in foregound ==> ignoring."); // But note we still consume this key event; see below. } } // We *always* consume the CALL key, since the system-wide default // action ("go to the in-call screen") is useless here. return true; } boolean isKeyEventAcceptableDTMF (KeyEvent event) { return (mDialer != null && mDialer.isKeyEventAcceptable(event)); } /** * Overriden to track relevant focus changes. * * If a key is down and some time later the focus changes, we may * NOT recieve the keyup event; logically the keyup event has not * occured in this window. This issue is fixed by treating a focus * changed event as an interruption to the keydown, making sure * that any code that needs to be run in onKeyUp is ALSO run here. * * Note, this focus change event happens AFTER the in-call menu is * displayed, so mIsMenuDisplayed should always be correct by the * time this method is called in the framework, please see: * {@link onCreatePanelView}, {@link onOptionsMenuClosed} */ @Override public void onWindowFocusChanged(boolean hasFocus) { // the dtmf tones should no longer be played if (VDBG) log("onWindowFocusChanged(" + hasFocus + ")..."); if (!hasFocus && mDialer != null) { if (VDBG) log("- onWindowFocusChanged: faking onDialerKeyUp()..."); mDialer.onDialerKeyUp(null); } } @Override public boolean dispatchKeyEvent(KeyEvent event) { // if (DBG) log("dispatchKeyEvent(event " + event + ")..."); // Intercept some events before they get dispatched to our views. switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: // Disable DPAD keys and trackball clicks if the touch lock // overlay is up, since "touch lock" really means "disable // the DTMF dialpad" (rather than only disabling touch events.) if (mDialer.isOpened() && isTouchLocked()) { if (DBG) log("- ignoring DPAD event while touch-locked..."); return true; } break; default: break; } return super.dispatchKeyEvent(event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { // if (DBG) log("onKeyUp(keycode " + keyCode + ")..."); // push input to the dialer. if ((mDialer != null) && (mDialer.onDialerKeyUp(event))){ return true; } else if (keyCode == KeyEvent.KEYCODE_CALL) { // Always consume CALL to be sure the PhoneWindow won't do anything with it return true; } return super.onKeyUp(keyCode, event); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // if (DBG) log("onKeyDown(keycode " + keyCode + ")..."); switch (keyCode) { case KeyEvent.KEYCODE_CALL: boolean handled = handleCallKey(); if (!handled) { Log.w(LOG_TAG, "InCallScreen should always handle KEYCODE_CALL in onKeyDown"); } // Always consume CALL to be sure the PhoneWindow won't do anything with it return true; // Note there's no KeyEvent.KEYCODE_ENDCALL case here. // The standard system-wide handling of the ENDCALL key // (see PhoneWindowManager's handling of KEYCODE_ENDCALL) // already implements exactly what the UI spec wants, // namely (1) "hang up" if there's a current active call, // or (2) "don't answer" if there's a current ringing call. case KeyEvent.KEYCODE_BACK: if (handleBackKey()) { return true; } break;
cytown/android_packages_apps_Phone
a532a9fa816a19fa7ce5b77f75b8a9ddfc78c157
fix for missing pngs
diff --git a/res/drawable-finger/btn_dial_normal.9.png b/res/drawable-finger/btn_dial_normal.9.png new file mode 100644 index 0000000..748dd8a Binary files /dev/null and b/res/drawable-finger/btn_dial_normal.9.png differ diff --git a/res/drawable-finger/btn_dial_pressed.9.png b/res/drawable-finger/btn_dial_pressed.9.png new file mode 100644 index 0000000..83f9c62 Binary files /dev/null and b/res/drawable-finger/btn_dial_pressed.9.png differ diff --git a/res/drawable-finger/btn_dial_selected.9.png b/res/drawable-finger/btn_dial_selected.9.png new file mode 100644 index 0000000..edc7bcb Binary files /dev/null and b/res/drawable-finger/btn_dial_selected.9.png differ
cytown/android_packages_apps_Phone
8e400261a1ddbad807870a4225354379e680e473
fix missing string.
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index f661a18..d1641ec 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -1,518 +1,519 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2009 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="contactsIconLabel" msgid="9129800048701196916">"联系人"</string> <string name="contactsFavoritesLabel" msgid="5360050972935451505">"收藏夹"</string> <string name="dialerIconLabel" msgid="1761864493312440268">"拨号面板"</string> <string name="emergencyDialerIconLabel" msgid="7812140032168171053">"紧急拨号程序"</string> <string name="phoneIconLabel" msgid="2331230813161304895">"手机"</string> <string name="recentCallsIconLabel" msgid="8717350893637245164">"通话记录"</string> <string name="fdnListLabel" msgid="8630418672279521003">"固定拨号列表"</string> <string name="unknown" msgid="6878797917991465859">"未知"</string> <string name="private_num" msgid="6713286113000232309">"私人号码"</string> <string name="payphone" msgid="1931775086311769314">"投币式公用电话"</string> <string name="onHold" msgid="9035493194749959955">"保持"</string> <string name="ongoing" msgid="8300874342848721367">"当前通话"</string> <string name="callFailed_userBusy" msgid="8851106999809294904">"线路忙"</string> <string name="callFailed_congestion" msgid="8737761615702718375">"网络正忙"</string> <string name="callFailed_noSignal" msgid="1889803273616031933">"无信号"</string> <string name="callFailed_limitExceeded" msgid="4958065157970101491">"超出 ACM 限制"</string> <string name="callFailed_powerOff" msgid="2766035859391549713">"已关闭天线"</string> <string name="callFailed_simError" msgid="5652345589458834655">"无 SIM 或 SIM 错误"</string> <string name="callFailed_outOfService" msgid="4825791466557236225">"不在服务区"</string> <string name="callFailed_fdn_only" msgid="2850204579765430641">"外拨电话受固定拨号限制。"</string> <string name="callFailed_cb_enabled" msgid="3057131228725500761">"在开启通话限制的情况下无法向外拨打电话。"</string> <string name="callFailed_dsac_restricted" msgid="2180223622768522345">"所有通话都受访问控制限制。"</string> <string name="callFailed_dsac_restricted_emergency" msgid="4353654268813314466">"紧急电话受访问控制限制。"</string> <string name="callFailed_dsac_restricted_normal" msgid="2680774510252408620">"正常通话受访问控制限制。"</string> <string name="callFailed_cdma_lockedUntilPowerCycle" msgid="775483211928061084">"手机在重启之前处于锁定状态。"</string> <string name="callFailed_cdma_drop" msgid="6030084920001082496">"CDMA:通话已取消。"</string> <string name="callFailed_cdma_intercept" msgid="8402269373120277330">"CDMA:通话中断。"</string> <string name="callFailed_cdma_reorder" msgid="5605791471418711552">"CDMA:重新排序。"</string> <string name="callFailed_cdma_SO_reject" msgid="8969174256492763555">"CDMA:服务选项拒绝。"</string> <string name="callFailed_cdma_retryOrder" msgid="5848488692485148804">"CDMA:重拨顺序。"</string> <string name="callFailed_cdma_accessFailure" msgid="2844306027616452215">"CDMA:无法接入。"</string> <string name="callFailed_cdma_preempted" msgid="1097095321180029879">"CDMA:优先抢占。"</string> <string name="callFailed_cdma_notEmergency" msgid="2347377816822720761">"只能拨打紧急电话。"</string> <string name="confCall" msgid="1904840547188336828">"电话会议"</string> <string name="mmiStarted" msgid="6347869857061147003">"MMI 码已启动"</string> <string name="ussdRunning" msgid="485588686340541690">"正在运行 USSD 代码..."</string> <string name="mmiCancelled" msgid="2771923949751842276">"MMI 码已取消"</string> <string name="cancel" msgid="5044513931633602634">"取消"</string> <string name="ecbm_mode_text" msgid="6485648046794782672">"紧急回拨"</string> <string name="ecbm_exit_text" msgid="622759135506401127">"退出"</string> <string name="ecbm_ok_text" msgid="1373363960570351032">"确定"</string> <string name="ecbm_emergency_number" msgid="4131632362330756509">"拨打 911"</string> <string name="ecbm_instruction_text" msgid="5039940054364946169">"按该按钮可拨打紧急电话"</string> <string name="menu_speaker" msgid="6069700688651964705">"免提"</string> <string name="menu_bluetooth" msgid="8842523654717305695">"蓝牙"</string> <string name="menu_mute" msgid="4399723633363773145">"静音"</string> <string name="menu_hold" msgid="6970441130344786273">"保持"</string> <string name="menu_endCall" msgid="2142958047156634241">"结束通话"</string> <string name="menu_swapCalls" msgid="1548647524816600795">"交换通话"</string> <string name="menu_mergeCalls" msgid="6414754941392181303">"合并通话"</string> <string name="menu_addCall" msgid="7829255032442131930">"添加通话"</string> <string name="menu_manageConference" msgid="3770984362002266733">"管理电话会议"</string> <string name="menu_showDialpad" msgid="5198200217528406980">"显示拨号面板"</string> <string name="menu_hideDialpad" msgid="2733813546746296771">"隐藏拨号面板"</string> <string name="menu_answerAndHold" msgid="8830891495953688905">"保持当前通话"\n"并应答"</string> <string name="menu_answerAndEnd" msgid="2071708281281611854">"结束当前通话"\n"并应答"</string> <string name="ok" msgid="3811371167865772377">"确定"</string> <string name="menuButtonHint" msgid="4853215496220101699">"按 MENU 可以选择通话选项。"</string> <string name="menuButtonKeyboardDialHint" msgid="2869270434715312458">"按 MENU 可以选择通话选项 • 使用键盘拨号"</string> <string name="menu_answer" msgid="116686205042231098">"接听"</string> <string name="menu_ignore" msgid="2112030835852537344">"忽略"</string> <string name="wait_prompt_str" msgid="7601815427707856238">"发送以下音频?"\n</string> <string name="send_button" msgid="4106860097497818751">"发送"</string> <string name="wild_prompt_str" msgid="1585989144582892543">"用以下内容替换通配符"</string> <string name="no_vm_number" msgid="4164780423805688336">"未设置语音信箱号码"</string> <string name="no_vm_number_msg" msgid="1300729501030053828">"SIM 卡上未存储语音信箱号码。"</string> <string name="add_vm_number_str" msgid="4676479471644687453">"添加号码"</string> <string name="dialer_emptyListWorking" msgid="6022498519770859790">"正在载入..."</string> <string name="enterPin" msgid="4753300834213388397">"输入 PIN 码以解锁 SIM 卡。"</string> <string name="pinUnlocked" msgid="3260617001055506794">"SIM 已解锁"</string> <string name="enterNewPin" msgid="5311243769004752401">"新 SIM 卡 PIN 码"</string> <string name="verifyNewPin" msgid="2593629913010458867">"再次输入新 SIM 卡 PIN 码予以确认"</string> <string name="verifyFailed" msgid="3875778795754857903">"您输入的 SIM 卡 PIN 不匹配,请重试。"</string> <string name="enterPuk" msgid="6144749655582862324">"输入 PUK 码以解锁 SIM 卡"</string> <string name="badPuk" msgid="3213017898690275965">"PUK 码不正确!"</string> <string name="buttonTxtContinue" msgid="863271214384739936">"继续"</string> <string name="puk_unlocked" msgid="2284912838477558454">"您的 SIM 卡已解锁。正在解锁您的手机..."</string> <string name="label_ndp" msgid="780479633159517250">"SIM 卡网络解锁 PIN 码"</string> <string name="sim_ndp_unlock_text" msgid="683628237760543009">"解锁"</string> <string name="sim_ndp_dismiss_text" msgid="1604823375752456947">"关闭"</string> <string name="requesting_unlock" msgid="6412629401033249351">"正在请求网络解锁..."</string> <string name="unlock_failed" msgid="6490531697031504225">"网络解锁请求失败。"</string> <string name="unlock_success" msgid="6770085622238180152">"网络解锁成功。"</string> <string name="imei" msgid="8552502717594321281">"IMEI"</string> <string name="labelGSMMore" msgid="5930842194056092106">"GSM 通话设置"</string> <string name="labelCDMAMore" msgid="1630676740428229339">"CDMA 通话设置"</string> <string name="apn_settings" msgid="9043423184895642077">"接入点名称"</string> <string name="settings_label" msgid="3876743539816984008">"网络设置"</string> <string name="voicemail" msgid="8693759337917898954">"语音信箱"</string> <string name="voicemail_abbreviated" msgid="2215592488517217448">"VM:"</string> <string name="networks" msgid="8873030692174541976">"网络运营商"</string> <string name="call_settings" msgid="6112441768261754562">"通话设置"</string> <string name="additional_gsm_call_settings" msgid="6472260354879794056">"其他 GSM 通话设置"</string> <string name="sum_gsm_call_settings" msgid="4076647190996778012">"其他仅适用于 GSM 通话的设置"</string> <string name="additional_cdma_call_settings" msgid="8628958775721886909">"其他 CDMA 通话设置"</string> <string name="sum_cdma_call_settings" msgid="284753265979035549">"仅适用于 CDMA 的其他通话设置"</string> <string name="labelNwService" msgid="4699970172021870983">"网络服务设置"</string> <string name="labelCallerId" msgid="3888899447379069198">"来电者信息"</string> <string name="sum_hide_caller_id" msgid="1071407020290873782">"在外拨电话中隐藏号码"</string> <string name="sum_show_caller_id" msgid="6768534125447290401">"在外拨电话中显示号码"</string> <string name="sum_default_caller_id" msgid="1954518825510901365">"使用默认运营商设置,在外拨电话中显示我的号码"</string> <string name="labelCW" msgid="6120513814915920200">"呼叫等待"</string> <string name="sum_cw_enabled" msgid="8083061901633671397">"通话期间有来电时通知我"</string> <string name="sum_cw_disabled" msgid="3648693907300104575">"通话期间有来电时不通知我"</string> <string name="call_forwarding_settings" msgid="3378927671091537173">"呼叫转接设置"</string> <string name="labelCF" msgid="2574386948026924737">"呼叫转移"</string> <string name="labelCFU" msgid="8147177368148660600">"始终进行呼叫转移"</string> <string name="messageCFU" msgid="3560082430662923687">"始终使用此号码"</string> <string name="sum_cfu_enabled_indicator" msgid="4014187342724130197">"转移所有呼叫"</string> <string name="sum_cfu_enabled" msgid="956178654350554451">"将所有呼叫转移至 {0}"</string> <string name="sum_cfu_disabled" msgid="3698472522160364904">"已禁用"</string> <string name="labelCFB" msgid="218938523102207587">"占线时呼叫转移"</string> <string name="messageCFB" msgid="3711089705936187129">"占线时的转移号码"</string> <string name="sum_cfb_enabled" msgid="2501948432392255856">"转移至 {0}"</string> <string name="sum_cfb_disabled" msgid="227440009979537651">"已禁用"</string> <string name="labelCFNRy" msgid="3646316323834351390">"无应答时转移呼叫"</string> <string name="messageCFNRy" msgid="672317899884380374">"无应答时拨号"</string> <string name="sum_cfnry_enabled" msgid="3473526018876802076">"转移至 {0}"</string> <string name="sum_cfnry_disabled" msgid="8422350929957344729">"已禁用"</string> <string name="labelCFNRc" msgid="47183615370850000">"无法接通时转接"</string> <string name="messageCFNRc" msgid="6380695421020295119">"无法接通时的转接号码"</string> <string name="sum_cfnrc_enabled" msgid="3528648673654636587">"转接至 {0}"</string> <string name="sum_cfnrc_disabled" msgid="7222141261321276464">"已禁用"</string> <string name="updating_title" msgid="6146755386174019046">"通话设置"</string> <string name="error_updating_title" msgid="7970259216988931777">"通话设置错误"</string> <string name="reading_settings" msgid="1920291699287055284">"正在读取设置..."</string> <string name="updating_settings" msgid="8171225533884883252">"正在更新设置..."</string> <string name="response_error" msgid="6674110501330139405">"网络响应异常。"</string> <string name="exception_error" msgid="7027667130619518211">"网络或 SIM 卡错误。"</string> <string name="radio_off_error" msgid="6717116288405111269">"请在查看这些设置之前先关闭飞行模式。"</string> <string name="close_dialog" msgid="2365884406356986917">"确定"</string> <string name="enable" msgid="1059008390636773574">"启用"</string> <string name="disable" msgid="7274240979164762320">"禁用"</string> <string name="change_num" msgid="239476305819844391">"更新"</string> <string-array name="clir_display_values"> <item msgid="5560134294467334594">"网络默认设置"</item> <item msgid="7876195870037833661">"隐藏号码"</item> <item msgid="1108394741608734023">"显示号码"</item> </string-array> <string name="vm_save_number" msgid="4579969432544566719">"保存语音信箱号码"</string> <string name="vm_changed" msgid="380744030726254139">"语音信箱号码已更改。"</string> <string name="vm_change_failed" msgid="8484504256705014152">"语音信箱号码更改失败。"</string> <string name="no_change" msgid="3186040086622435212">"未做过更改。"</string> <string name="sum_voicemail" msgid="2528087245989303328">"设置语音信箱号码"</string> <string name="mobile_networks" msgid="5540397602919106177">"移动网络设置"</string> <string name="label_available" msgid="1181658289009300430">"可用的网络"</string> <string name="load_networks_progress" msgid="5230707536168902952">"正在搜索..."</string> <string name="empty_networks_list" msgid="4249426905018815316">"未找到网络。"</string> <string name="search_networks" msgid="1601136049300882441">"搜索网络"</string> <string name="network_query_error" msgid="6828516148953325006">"搜索网络时出错。"</string> <string name="register_on_network" msgid="9055203954040805084">"正在<xliff:g id="NETWORK">%s</xliff:g>上注册..."</string> <string name="not_allowed" msgid="3540496123717833833">"您的 SIM 卡不允许连接到此网络。"</string> <string name="registration_done" msgid="495135664535876612">"已在网络上注册。"</string> <string name="sum_carrier_select" msgid="6526225502314751575">"选择一个网络运营商"</string> <string name="sum_search_networks" msgid="2921092249873272715">"搜索所有可用的网络"</string> <string name="select_automatically" msgid="8615980695510888796">"自动选择"</string> <string name="sum_select_automatically" msgid="8460954604521755275">"自动选择首选网络"</string> <string name="register_automatically" msgid="6272031189219101172">"自动注册..."</string> <string name="preferred_network_mode_title" msgid="8873246565334559308">"网络模式"</string> <string name="preferred_network_mode_summary" msgid="1434820673166126609">"更改网络运行方式"</string> <string name="preferred_network_mode_dialogtitle" msgid="8176355237105593793">"首选网络模式"</string> <string-array name="preferred_network_mode_choices"> <item msgid="2987674222882365152">"全球"</item> <item msgid="3273348576277144124">"仅 EvDo"</item> <item msgid="454610224530856274">"CDMA,无 EvDo 功能"</item> <item msgid="8928247118825616081">"CDMA/EvDo 自动选择"</item> <item msgid="8595462903294812666">"GSM/WCDMA 自动选择"</item> <item msgid="5189164180446264504">"仅 WCDMA"</item> <item msgid="5714714953966979187">"仅 GSM"</item> <item msgid="4775796025725908913">"首选 GSM/WCDMA"</item> </string-array> <string-array name="preferred_network_mode_values"> <item msgid="7164534877603905916">"7"</item> <item msgid="2520921432080278213">"6"</item> <item msgid="4978887990900575049">"5"</item> <item msgid="6891436459357445885">"4"</item> <item msgid="339825043192186272">"3"</item> <item msgid="3062641619893382241">"2"</item> <item msgid="2494009747968041784">"1"</item> <item msgid="2568449734331711605">"0"</item> </string-array> <string name="roaming" msgid="8871412572928323707">"数据漫游"</string> <string name="roaming_enable" msgid="7331106985174381987">"漫游时连接到数据服务"</string> <string name="roaming_disable" msgid="1843417228755568110">"漫游时连接到数据服务"</string> <string name="roaming_reenable_message" msgid="6973894869473170666">"数据连接已断,因为您已离开本地网络并已关闭数据漫游。"</string> <string name="roaming_warning" msgid="7820963598559553967">"是否允许数据漫游?这可能产生大量漫游费!"</string> <string name="gsm_umts_options" msgid="6538311689850981686">"GSM/UMTS 选项"</string> <string name="cdma_options" msgid="4016822858172249884">"CDMA 选项"</string> <string name="cdma_cell_broadcast_sms" msgid="7898475142527341808">"小区广播短信"</string> <string name="cell_broadcast_sms" msgid="5584192824053625842">"小区广播短信"</string> <string name="enable_disable_cell_bc_sms" msgid="4851147873691392255">"小区广播短信"</string> <string name="cell_bc_sms_enable" msgid="6441688565738921084">"已启用小区广播短信"</string> <string name="cell_bc_sms_disable" msgid="3398365088309408749">"已停用小区广播短信"</string> <string name="cb_sms_settings" msgid="651715019785107312">"小区广播短信设置"</string> <string name="enable_disable_emergency_broadcast" msgid="2157014609041245335">"紧急广播"</string> <string name="emergency_broadcast_enable" msgid="2645980025414010211">"已启用紧急广播"</string> <string name="emergency_broadcast_disable" msgid="3665199821267569426">"已停用紧急广播"</string> <string name="enable_disable_administrative" msgid="6501582322182059412">"管理"</string> <string name="administrative_enable" msgid="1750086122962032235">"已启用管理"</string> <string name="administrative_disable" msgid="8433273857248698539">"已停用管理"</string> <string name="enable_disable_maintenance" msgid="1819693083025106678">"维护"</string> <string name="maintenance_enable" msgid="8566636458770971189">"已启用维护"</string> <string name="maintenance_disable" msgid="7340189100885066077">"已停用维护"</string> <string name="general_news_settings" msgid="4968779723948432978">"普通资讯"</string> <string name="bf_news_settings" msgid="3935593091894685267">"商务和财经资讯"</string> <string name="sports_news_settings" msgid="7649399631270052835">"体育资讯"</string> <string name="entertainment_news_settings" msgid="5051153952959405035">"娱乐资讯"</string> <string name="enable_disable_local" msgid="7890281063123416120">"本地"</string> <string name="local_enable" msgid="6370463247609136359">"已启用本地资讯"</string> <string name="local_disable" msgid="4405691986943795798">"已停用本地资讯"</string> <string name="enable_disable_regional" msgid="4905652414535565872">"地方性"</string> <string name="regional_enable" msgid="4434680415437834759">"已启用地方资讯"</string> <string name="regional_disable" msgid="5359325527213850077">"已停用地方资讯"</string> <string name="enable_disable_national" msgid="236278090206880734">"国内"</string> <string name="national_enable" msgid="1172443648912246952">"已启用国内资讯"</string> <string name="national_disable" msgid="326018148178601166">"已停用国内资讯"</string> <string name="enable_disable_international" msgid="7535348799604565592">"国际"</string> <string name="international_enable" msgid="5855356769925044927">"已启用国际资讯"</string> <string name="international_disable" msgid="2850648591041088931">"已停用国际资讯"</string> <string name="list_language_title" msgid="2841683501919760043">"语言"</string> <string name="list_language_summary" msgid="8109546531071241601">"选择资讯语言"</string> <string-array name="list_language_entries"> <item msgid="6137851079727305485">"英语"</item> <item msgid="1151988412809572526">"法语"</item> <item msgid="577840534704312665">"西班牙语"</item> <item msgid="8385712091143148180">"日语"</item> <item msgid="1858401628368130638">"韩语"</item> <item msgid="1933212028684529632">"中文"</item> <item msgid="1908428006803639064">"希伯来语"</item> </string-array> <string-array name="list_language_values"> <item msgid="1804908636436467150">"1"</item> <item msgid="289708030346890334">"2"</item> <item msgid="1121469729692402684">"3"</item> <item msgid="2614093115912897722">"4"</item> <item msgid="2411164639857960614">"5"</item> <item msgid="5884448729274543324">"6"</item> <item msgid="5511864807618312598">"7"</item> </string-array> <string name="list_language_dtitle" msgid="5442908726538951934">"语言"</string> <string name="enable_disable_local_weather" msgid="986967454867219114">"本地天气"</string> <string name="local_weather_enable" msgid="6199315114382448922">"已启用本地天气预报"</string> <string name="local_weather_disable" msgid="2510158089142626480">"已停用本地天气预报"</string> <string name="enable_disable_atr" msgid="8339572391278872343">"区域路况报告"</string> <string name="atr_enable" msgid="5541757457789181799">"已启用区域路况报导"</string> <string name="atr_disable" msgid="7085558154727596455">"已停用区域路况报导"</string> <string name="enable_disable_lafs" msgid="668189073721277199">"本地机场航班时刻表"</string> <string name="lafs_enable" msgid="2791978667205137052">"已启用本地机场航班时刻表"</string> <string name="lafs_disable" msgid="2391212397725495350">"已停用本地机场航班时刻表"</string> <string name="enable_disable_restaurants" msgid="6240381945336814024">"餐馆"</string> <string name="restaurants_enable" msgid="5137657479469118847">"已启用餐馆信息"</string> <string name="restaurants_disable" msgid="3678480270938424092">"已停用餐馆信息"</string> <string name="enable_disable_lodgings" msgid="1822029172658551202">"房屋租赁信息"</string> <string name="lodgings_enable" msgid="3230042508992850322">"已启用房屋租赁信息"</string> <string name="lodgings_disable" msgid="3387879742320682391">"已停用房屋租赁信息"</string> <string name="enable_disable_retail_directory" msgid="1357809784475660303">"零售目录"</string> <string name="retail_directory_enable" msgid="3280626290436111496">"已启用零售店名录"</string> <string name="retail_directory_disable" msgid="6479739816662879027">"已停用零售店名录"</string> <string name="enable_disable_advertisements" msgid="5999495926176182128">"广告"</string> <string name="advertisements_enable" msgid="2050305021264683786">"已启用广告"</string> <string name="advertisements_disable" msgid="8350985908788707935">"已停用广告"</string> <string name="enable_disable_stock_quotes" msgid="6397810445293533603">"股票报价"</string> <string name="stock_quotes_enable" msgid="4384802470887170543">"已启用股票报价"</string> <string name="stock_quotes_disable" msgid="4781450084565594998">"已停用股票价格"</string> <string name="enable_disable_eo" msgid="4863043263443942494">"招聘信息"</string> <string name="eo_enable" msgid="8623559062015685813">"已启用招聘信息"</string> <string name="eo_disable" msgid="3863812478090907609">"已停用招聘信息"</string> <string name="enable_disable_mhh" msgid="5698783743098373681">"医疗、保健和医院"</string> <string name="mhh_enable" msgid="3949276822735205799">"已启用医疗、保健和医院信息"</string> <string name="mhh_disable" msgid="4834280270664925123">"已停用医疗、保健和医院信息"</string> <string name="enable_disable_technology_news" msgid="3517184627114999149">"技术资讯"</string> <string name="technology_news_enable" msgid="7995209394210455181">"已启用技术资讯"</string> <string name="technology_news_disable" msgid="5483490380561851946">"已停用技术资讯"</string> <string name="enable_disable_multi_category" msgid="626771003122899280">"多类别"</string> <string name="multi_category_enable" msgid="1179299804641721768">"已启用多类别"</string> <string name="multi_category_disable" msgid="880104702904139505">"已停用多类别"</string> <string name="gsm_umts_network_preferences_title" msgid="4834419333547382436">"GSM/UMTS 网络偏好设置"</string> <string name="gsm_umts_network_preferneces_summary" msgid="1905018644156819521">"尚未实现!"</string> <string name="gsm_umts_network_preferences_dialogtitle" msgid="6356332580813229898">"GSM/UMTS 网络偏好设置"</string> <string-array name="gsm_umts_network_preferences_choices"> <item msgid="4327916632016252900">"首选 3G"</item> <item msgid="7890032659744442614">"仅 2G"</item> <item msgid="7306003477602941058">"仅 3G"</item> </string-array> <string-array name="gsm_umts_network_preferences_values"> <item msgid="117293148930527265">"0"</item> <item msgid="2264578612775462302">"1"</item> <item msgid="1268081943590316978">"2"</item> </string-array> <string name="prefer_2g" msgid="8442550937280449639">"仅使用 2G 网络"</string> <string name="prefer_2g_summary" msgid="1976491403210690759">"省电"</string> <string name="cdma_system_select_title" msgid="5757657769327732833">"系统选择"</string> <string name="cdma_system_select_summary" msgid="2528661990595284707">"更改 CDMA 漫游模式"</string> <string name="cdma_system_select_dialogtitle" msgid="6083355415165359075">"系统选择"</string> <string-array name="cdma_system_select_choices"> <item msgid="176474317493999285">"仅本网"</item> <item msgid="1205664026446156265">"自动"</item> </string-array> <string-array name="cdma_system_select_values"> <item msgid="4354305960068894315">"0"</item> <item msgid="3046877284450231151">"2"</item> </string-array> <string name="cdma_roaming_mode_title" msgid="6366737033053855198">"CDMA 漫游模式"</string> <string name="cdma_roaming_mode_summary" msgid="8604713111805562261">"更改 CDMA 漫游模式"</string> <string name="cdma_roaming_mode_dialogtitle" msgid="1802896889172094947">"CDMA 漫游模式"</string> <string-array name="cdma_roaming_mode_choices"> <item msgid="6024072766548865002">"仅本地网络"</item> <item msgid="8174642753290624634">"附属网络"</item> <item msgid="2241951431403168661">"任何网络"</item> </string-array> <string-array name="cdma_roaming_mode_values"> <item msgid="2549203161367380954">"0"</item> <item msgid="6007798728227141997">"1"</item> <item msgid="4039511109802141047">"2"</item> </string-array> <string name="cdma_network_preferences_title" msgid="41193174429510391">"CDMA 网络偏好设置"</string> <string name="cdma_network_preferneces_summary" msgid="3524451924935793338">"尚未实现!"</string> <string name="cdma_network_preferences_dialogtitle" msgid="4548860809290455653">"CDMA 网络偏好设置"</string> <string-array name="cdma_network_preferences_choices"> <item msgid="7278992425338592489">"CDMA/EvDo 自动选择"</item> <item msgid="3155327921861137068">"CDMA,无 EvDo 功能"</item> <item msgid="2683555124647197574">"仅 EvDo"</item> </string-array> <string-array name="cdma_network_preferences_values"> <item msgid="1821235500822403409">"4"</item> <item msgid="6355374585098185445">"5"</item> <item msgid="213552629330086398">"6"</item> </string-array> <string name="subscription_title" msgid="5813493350326486">"CDMA 订阅测试"</string> <string name="subscription_summary" msgid="8435941016743418124">"在 RUIM/SIM 和 NV 之间进行切换"</string> <string name="subscription_dialogtitle" msgid="531571450448009255">"订阅"</string> <string-array name="subscription_choices"> <item msgid="6540107472553796600">"RUIM/SIM"</item> <item msgid="1433427108940308332">"NV"</item> </string-array> <string-array name="subscription_values"> <item msgid="4377788417250295786">"0"</item> <item msgid="1193066664940329729">"1"</item> </string-array> <string name="fdn" msgid="7878832555095183202">"固定拨号"</string> <string name="manage_fdn_list" msgid="8777755791892122369">"固定拨号列表"</string> <string name="fdn_activation" msgid="2156479741307463576">"激活固定拨号"</string> <string name="fdn_enabled" msgid="5238109009915521240">"已启用固定拨号"</string> <string name="fdn_disabled" msgid="4700049736675368279">"已停用固定拨号"</string> <string name="enable_fdn" msgid="3740191529180493851">"启用固定拨号"</string> <string name="disable_fdn" msgid="7944020890722540616">"禁用固定拨号"</string> <string name="change_pin2" msgid="2153563695382176676">"更改 PIN2"</string> <string name="enable_fdn_ok" msgid="7215588870329688132">"禁用固定拨号"</string> <string name="disable_fdn_ok" msgid="5727046928930740173">"启用固定拨号"</string> <string name="sum_fdn" msgid="1959399454900272878">"管理固定拨号"</string> <string name="sum_fdn_change_pin" msgid="6666549734792827932">"更改为访问固定拨号设置的 PIN"</string> <string name="sum_fdn_manage_list" msgid="8431088265332628316">"管理手机号码列表"</string> <string name="voice_privacy" msgid="7803023024169078619">"语音隐私权"</string> <string name="voice_privacy_summary" msgid="3159383389833516214">"启用增强型隐秘模式"</string> <string name="tty_mode_title" msgid="3171521903490559138">"TTY 模式"</string> <string name="tty_mode_summary" msgid="5057244302665817977">"启用 TTY 模式"</string> <string name="tty_mode_option_title" msgid="9033098925144434669">"TTY 模式"</string> <string name="tty_mode_option_summary" msgid="1073835131534808732">"设置 TTY 模式"</string> <string name="menu_add" msgid="1882023737425114762">"添加联系人"</string> <string name="menu_edit" msgid="7143003705504672374">"编辑联系人"</string> <string name="menu_delete" msgid="3977150783449642851">"删除联系人"</string> <string name="get_pin2" msgid="1198225482542827652">"输入 PIN2 码"</string> <string name="name" msgid="7329028332786872378">"名称"</string> <string name="number" msgid="7905950798349903858">"号码"</string> <string name="save" msgid="4094274636321939086">"保存"</string> <string name="add_fdn_contact" msgid="5412242719704146070">"添加固定拨号联系人"</string> <string name="adding_fdn_contact" msgid="1008984230265031168">"添加固定拨号联系人..."</string> <string name="fdn_contact_added" msgid="3283284983265410270">"已添加固定拨号联系人。"</string> <string name="edit_fdn_contact" msgid="3440054765948798731">"编辑固定拨号联系人"</string> <string name="updating_fdn_contact" msgid="5918299270800552372">"正在更新固定拨号联系人..."</string> <string name="fdn_contact_updated" msgid="510187720367785051">"固定拨号联系人已更新。"</string> <string name="delete_fdn_contact" msgid="2237838617123538040">"删除固定拨号联系人"</string> <string name="deleting_fdn_contact" msgid="6162824054507660151">"正在删除固定拨号联系人..."</string> <string name="fdn_contact_deleted" msgid="5596742031140651283">"固定拨号联系人已删除。"</string> <string name="pin2_invalid" msgid="6408721267712649637">"PIN2 码无效!"</string> <string name="fdn_invalid_number" msgid="1484959418054136856">"号码不得超过 20 位。"</string> <string name="simContacts_emptyLoading" msgid="2203331234764498011">"正在从 SIM 卡读取..."</string> <string name="simContacts_empty" msgid="5270660846489561932">"您的 SIM 卡上没有联系人。"</string> <string name="simContacts_title" msgid="1861472842524839921">"选择要导入的联系人"</string> <string name="enable_pin" msgid="5422767284133234860">"启用/禁用 SIM 卡 PIN"</string> <string name="change_pin" msgid="9174186126330785343">"更改 SIM 卡 PIN"</string> <string name="enter_pin_text" msgid="8532615714751931951">"SIM 卡 PIN:"</string> <string name="oldPinLabel" msgid="5287773661246368314">"旧 PIN"</string> <string name="newPinLabel" msgid="207488227285336897">"新 PIN"</string> <string name="confirmPinLabel" msgid="257597715098070206">"确认新 PIN"</string> <string name="badPin" msgid="4154316827946559447">"您输入的旧 PIN 不正确,请重试。"</string> <string name="mismatchPin" msgid="5974597541268042785">"您输入的 PIN 不匹配,请重试。"</string> <string name="invalidPin" msgid="5981171102258684792">"输入 4 到 8 位数字的 PIN。"</string> <string name="disable_sim_pin" msgid="3992926931620188855">"停用 SIM 卡 PIN"</string> <string name="enable_sim_pin" msgid="5803702443844458831">"启用 SIM 卡 PIN"</string> <string name="enable_in_progress" msgid="3695303775100109650">"请稍候..."</string> <string name="enable_pin_ok" msgid="8077439615296694284">"已启用 SIM 卡 PIN"</string> <string name="disable_pin_ok" msgid="8552428316206928913">"已停用 SIM 卡 PIN"</string> <string name="pin_failed" msgid="6597695909685242127">"您输入的 PIN 不正确"</string> <string name="pin_changed" msgid="9000716792724195093">"已成功更改 SIM 卡 PIN"</string> <string name="puk_requested" msgid="3898394204193202803">"密码不正确,SIM 已锁定!需要 PUK2。"</string> <string name="enter_pin2_text" msgid="8339444124477720345">"PIN2"</string> <string name="oldPin2Label" msgid="8559146795026261502">"旧 PIN2"</string> <string name="newPin2Label" msgid="4573956902204349054">"新 PIN2"</string> <string name="confirmPin2Label" msgid="8100319484454787708">"确认新 PIN2"</string> <string name="badPuk2" msgid="4072035207011308856">"您输入的 PUK2 不正确,请重试。"</string> <string name="badPin2" msgid="515218795152422178">"您输入的旧 PIN2 不正确,请重试。"</string> <string name="mismatchPin2" msgid="4177060915600342718">"您输入的 PIN2 不匹配,请重试。"</string> <string name="invalidPin2" msgid="8237110107480395938">"输入 4 到 8 位数字的 PIN2。"</string> <string name="invalidPuk2" msgid="1290977391033057871">"输入 8 位数字的 PUK2。"</string> <string name="pin2_changed" msgid="2670422162555916562">"已成功更改 PIN2"</string> <string name="label_puk2_code" msgid="302845876240219560">"输入 PUK2 码"</string> <string name="fdn_enable_puk2_requested" msgid="2608836967081385948">"密码不正确,请更改 PIN2 码并重试!"</string> <string name="puk2_requested" msgid="5863580927788820813">"密码不正确,SIM 已锁定!需要 PUK2 码。"</string> <string name="doneButton" msgid="2859593360997984240">"完成"</string> <string name="caller_manage_header" msgid="3231519674734638786">"电话会议 <xliff:g id="CONF_CALL_TIME">%s</xliff:g>"</string> <string name="caller_manage_manage_done_text" msgid="8093934725536733856">"返回通话"</string> <string name="sim_missing_continueView_text" msgid="4199689081742026077">"在没有 SIM 卡的情况下继续"</string> <string name="sim_missing_msg_text" msgid="6803619600564142188">"未找到 SIM 卡。请将 SIM 卡插入手机中。"</string> <string name="sim_unlock_dismiss_text" msgid="8292343981739813597">"关闭"</string> <string name="sim_unlock_unlock_text" msgid="6328406783399256930">"解锁"</string> <string name="sim_unlock_status_text" msgid="1919609683384607179">"正在验证 PIN 码..."</string> <string name="voicemail_settings_number_label" msgid="8524164258691887790">"语音信箱号码"</string> <string name="card_title_dialing" msgid="5769417478498348054">"正在拨号"</string> <string name="card_title_in_progress" msgid="8603765629781648862">"当前通话"</string> <string name="card_title_conf_call" msgid="1162980346189744501">"电话会议"</string> <string name="card_title_incoming_call" msgid="7364539451234646909">"来电"</string> <string name="card_title_cdma_call_waiting" msgid="4532445524811272644">"CDMA 呼叫等待"</string> <string name="card_title_call_ended" msgid="5544730338889702298">"通话结束"</string> <string name="card_title_on_hold" msgid="821463117892339942">"保持"</string> <string name="card_title_hanging_up" msgid="3999101620995182450">"正在挂断"</string> <string name="card_title_in_call" msgid="6346543933068225205">"正在通话"</string> <string name="notification_missedCallTitle" msgid="7554385905572364535">"未接电话"</string> <string name="notification_missedCallsTitle" msgid="1361677948941502522">"未接电话"</string> <string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> 个未接电话"</string> <string name="notification_missedCallTicker" msgid="504686252427747209">"来自<xliff:g id="MISSED_CALL_FROM">%s</xliff:g>的未接电话"</string> <string name="notification_ongoing_call_format" msgid="227216462548540316">"当前通话 (<xliff:g id="DURATION">%s</xliff:g>)"</string> <string name="notification_on_hold" msgid="3480694969511790465">"保持"</string> <string name="notification_voicemail_title" msgid="8933468752045550523">"新语音邮件"</string> <string name="notification_voicemail_title_count" msgid="4366360747660929916">"新语音邮件 (<xliff:g id="COUNT">%d</xliff:g>)"</string> <string name="notification_voicemail_text_format" msgid="4447323569453981685">"拨打 <xliff:g id="VOICEMAIL_NUMBER">%s</xliff:g>"</string> <string name="notification_voicemail_no_vm_number" msgid="760963466895609716">"未设置语音信箱号码"</string> <string name="incall_error_power_off" msgid="6550191216405193368">"要拨打电话,请先关闭飞行模式。"</string> <string name="incall_error_emergency_only" msgid="4678640422710818317">"未在网络上注册。"</string> <string name="incall_error_no_phone_number_supplied" msgid="4197432103471807739">"无法发送呼叫,因为输入的号码无效。"</string> <string name="incall_error_call_failed" msgid="4313552620858880999">"无法发送呼叫。"</string> <string name="incall_status_dialed_mmi" msgid="3672498861336189563">"正在启动 MMI 序列..."</string> <string name="incall_status_dialed_fc" msgid="1632879988662225263">"正在启动功能代码序列..."</string> <string name="incall_error_supp_service_unknown" msgid="2991054870745666038">"不支持此服务。"</string> <string name="incall_error_supp_service_switch" msgid="3503552565745872241">"无法切换通话。"</string> <string name="incall_error_supp_service_separate" msgid="914362338192301746">"无法分离通话。"</string> <string name="incall_error_supp_service_transfer" msgid="2509871374644921632">"无法转移呼叫。"</string> <string name="incall_error_supp_service_conference" msgid="2505727299596357312">"无法进行电话会议。"</string> <string name="incall_error_supp_service_reject" msgid="7055164130563826216">"无法拒绝呼叫。"</string> <string name="incall_error_supp_service_hangup" msgid="7417583238334762737">"无法挂断。"</string> <string name="emergency_enable_radio_dialog_title" msgid="4627849966634578257">"紧急电话"</string> <string name="emergency_enable_radio_dialog_message" msgid="207613549344420291">"正在打开天线..."</string> <string name="emergency_enable_radio_dialog_retry" msgid="3724423402363063736">"不在服务区,正在重试..."</string> <string name="dial_emergency_error" msgid="8362624131726575194">"无法发送呼叫,因为 <xliff:g id="NON_EMERGENCY_NUMBER">%s</xliff:g> 不是一个紧急号码!"</string> <string name="dial_emergency_empty_error" msgid="5048645338094088229">"无法发送呼叫,请拨打紧急电话!"</string> <string name="dialerKeyboardHintText" msgid="9192914825413747792">"使用键盘拨号"</string> <string name="dtmfDialpadHintText" msgid="2153335217920679451">"按键式数字键盘"</string> <string name="dtmfDialpadHandleLabel" msgid="6077872154488117962">"拨号键盘"</string> <string name="touchLockText" msgid="8742463586429019112">"轻触两下"\n"可解锁"</string> <string name="onscreenAnswerText" msgid="7643040500342720792">"轻触两下"\n"可接听"</string> <string name="importSimEntry" msgid="6614358325359736031">"导入"</string> <string name="importAllSimEntries" msgid="1503181169636198673">"全部导入"</string> <string name="importingSimContacts" msgid="7374056215462575769">"正在导入 SIM 联系人"</string> <string name="importToFDNfromContacts" msgid="2130620207013368580">"从联系人导入"</string> <string name="advanced_setting">高级设置 V.22</string> <string name="vibrate_outgoing">接听震动</string> <string name="vibrate_outgoing_sum">当对方接听时震动.</string> <string name="vibrate_45">45秒震动</string> <string name="vibrate_45_sum">呼出通话时到45秒时震动.</string> <string name="vibrate_hangup">挂断震动</string> <string name="vibrate_hangup_sum">通话结束时震动.</string> <string name="screen_awake">屏幕保持</string> <string name="screen_awake_sum">通话时, 屏幕等待更长时间才关闭.</string> <string name="led_notify_call">未接电话LED通知</string> <string name="led_notify_call_sum">有未接电话时LED会闪烁.</string> <string name="led_show_organ">显示公司名称</string> <string name="led_show_organ_sum">打电话界面显示公司名称在姓名后面.</string> <string name="vibrate_call_waiting">呼叫等待震动</string> <string name="vibrate_call_waiting_sum">当呼叫等待时震动通知.</string> <string name="return_home">强制返回到通话记录</string> <string name="return_home_sum">当呼出通话结束后会强制返回到通话记录屏幕.</string> <string name="menu_addBlackList">加入黑名单</string> <string name="black_list">黑名单</string> <string name="black_list_sum">列入黑名单的来电会被自动挂断.</string> <string name="add_black">添加来电</string> <string name="remove_black">从名单中去除 %s</string> +<string name="notification_ongoing_calling_format">"当前拨出(<xliff:g id="DURATION">%s</xliff:g>)"</string> <string-array name="tty_mode_entries"> <item msgid="512950011423868021">"TTY 已停用"</item> <item msgid="4781215771530681384">"TTY HCO"</item> <item msgid="5659212685488676933">"TTY VCO"</item> <item msgid="1113703196326500239">"TTY 已满"</item> </string-array> <string name="eri_text_label" msgid="4326942349915331461">"ERI 文字"</string> <string name="dtmf_tones_title" msgid="3866923093113274152">"DTMF 音"</string> <string name="dtmf_tones_summary" msgid="3351820372864020331">"设置 DTMF 音长度"</string> <string-array name="dtmf_tone_entries"> <item msgid="899650777817315681">"正常"</item> <item msgid="2883365539347850535">"长"</item> </string-array> <string name="network_message" msgid="5673682885938122239">"网络讯息"</string> </resources>
cytown/android_packages_apps_Phone
711997e1b2822d28887dce74c98469e1d725974b
fix chinese language show string
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index b441bb0..bf4515a 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -1,609 +1,609 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2009 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="contactsIconLabel" msgid="9129800048701196916">"联系人"</string> <string name="contactsFavoritesLabel" msgid="5360050972935451505">"收藏夹"</string> <string name="dialerIconLabel" msgid="1761864493312440268">"拨号面板"</string> <string name="emergencyDialerIconLabel" msgid="7812140032168171053">"紧急拨号程序"</string> <string name="phoneIconLabel" msgid="2331230813161304895">"手机"</string> <string name="recentCallsIconLabel" msgid="8717350893637245164">"通话记录"</string> <string name="fdnListLabel" msgid="8630418672279521003">"固定拨号列表"</string> <string name="unknown" msgid="6878797917991465859">"未知"</string> <string name="private_num" msgid="6713286113000232309">"私人号码"</string> <string name="payphone" msgid="1931775086311769314">"投币式公用电话"</string> <string name="onHold" msgid="9035493194749959955">"保持"</string> <string name="ongoing" msgid="8300874342848721367">"当前通话"</string> <string name="callFailed_userBusy" msgid="8851106999809294904">"线路忙"</string> <string name="callFailed_congestion" msgid="8737761615702718375">"网络正忙"</string> <string name="callFailed_noSignal" msgid="1889803273616031933">"无信号"</string> <string name="callFailed_limitExceeded" msgid="4958065157970101491">"超出 ACM 限制"</string> <string name="callFailed_powerOff" msgid="2766035859391549713">"对方已关机"</string> <string name="callFailed_simError" msgid="5652345589458834655">"无 SIM 或 SIM 错误"</string> <string name="callFailed_outOfService" msgid="4825791466557236225">"不在服务区"</string> <string name="callFailed_fdn_only" msgid="2850204579765430641">"去电受 FDN 的限制。"</string> <string name="callFailed_cb_enabled" msgid="3057131228725500761">"不能在呼叫禁止开启时拨打电话。"</string> <string name="callFailed_dsac_restricted" msgid="2180223622768522345">"所有呼叫已被访问控制限制。"</string> <string name="callFailed_dsac_restricted_emergency" msgid="4353654268813314466">"紧急呼叫已被访问控制限制。"</string> <string name="callFailed_dsac_restricted_normal" msgid="2680774510252408620">"正常呼叫已被访问控制限制。"</string> <!-- no translation found for callFailed_cdma_lockedUntilPowerCycle (775483211928061084) --> <skip /> <!-- no translation found for callFailed_cdma_drop (6030084920001082496) --> <skip /> <!-- no translation found for callFailed_cdma_intercept (8402269373120277330) --> <skip /> <!-- no translation found for callFailed_cdma_reorder (5605791471418711552) --> <skip /> <!-- no translation found for callFailed_cdma_SO_reject (8969174256492763555) --> <skip /> <!-- no translation found for callFailed_cdma_retryOrder (5848488692485148804) --> <skip /> <!-- no translation found for callFailed_cdma_accessFailure (2844306027616452215) --> <skip /> <!-- no translation found for callFailed_cdma_preempted (1097095321180029879) --> <skip /> <!-- no translation found for callFailed_cdma_notEmergency (2347377816822720761) --> <skip /> <string name="confCall" msgid="1904840547188336828">"电话会议"</string> <string name="mmiStarted" msgid="6347869857061147003">"MMI 码已启动"</string> <string name="ussdRunning" msgid="485588686340541690">"正在运行 USSD 代码..."</string> <string name="mmiCancelled" msgid="2771923949751842276">"MMI 码已取消"</string> <string name="cancel" msgid="5044513931633602634">"取消"</string> <!-- no translation found for ecbm_mode_text (6485648046794782672) --> <skip /> <!-- no translation found for ecbm_exit_text (622759135506401127) --> <skip /> <!-- no translation found for ecbm_ok_text (1373363960570351032) --> <skip /> <!-- no translation found for ecbm_emergency_number (4131632362330756509) --> <skip /> <!-- no translation found for ecbm_instruction_text (5039940054364946169) --> <skip /> <string name="menu_speaker" msgid="6069700688651964705">"扬声器"</string> <string name="menu_bluetooth" msgid="8842523654717305695">"蓝牙"</string> <string name="menu_mute" msgid="4399723633363773145">"静音"</string> <string name="menu_hold" msgid="6970441130344786273">"保持"</string> <string name="menu_endCall" msgid="2142958047156634241">"结束通话"</string> <string name="menu_swapCalls" msgid="1548647524816600795">"交换通话"</string> <string name="menu_mergeCalls" msgid="6414754941392181303">"合并通话"</string> <string name="menu_addCall" msgid="7829255032442131930">"添加通话"</string> <string name="menu_manageConference" msgid="3770984362002266733">"管理电话会议"</string> <string name="menu_showDialpad" msgid="5198200217528406980">"显示拨号面板"</string> <string name="menu_hideDialpad" msgid="2733813546746296771">"隐藏拨号面板"</string> <string name="menu_answerAndHold" msgid="8830891495953688905">"保持当前通话"\n"并应答"</string> <string name="menu_answerAndEnd" msgid="2071708281281611854">"结束当前通话"\n"并应答"</string> <string name="ok" msgid="3811371167865772377">"确定"</string> <string name="menuButtonHint" msgid="4853215496220101699">"按 MENU 选择通话选项。"</string> <string name="menuButtonKeyboardDialHint" msgid="2869270434715312458">"按 MENU 选择通话选项 • 使用键盘拨号"</string> <!-- no translation found for menu_answer (116686205042231098) --> <skip /> <!-- no translation found for menu_ignore (2112030835852537344) --> <skip /> <string name="wait_prompt_str" msgid="7601815427707856238">"发送以下音频?"\n</string> <string name="send_button" msgid="4106860097497818751">"发送"</string> <string name="wild_prompt_str" msgid="1585989144582892543">"用以下内容替换通配符"</string> <string name="no_vm_number" msgid="4164780423805688336">"未设置语音信箱号码"</string> <string name="no_vm_number_msg" msgid="1300729501030053828">"SIM 卡上未存储语音信箱号码。"</string> <string name="add_vm_number_str" msgid="4676479471644687453">"添加号码"</string> <string name="dialer_emptyListWorking" msgid="6022498519770859790">"正在载入..."</string> <string name="enterPin" msgid="4753300834213388397">"输入 PIN 码以解锁 SIM 卡。"</string> <string name="pinUnlocked" msgid="3260617001055506794">"SIM 已解锁"</string> <string name="enterNewPin" msgid="5311243769004752401">"新 SIM 卡 PIN 码"</string> <string name="verifyNewPin" msgid="2593629913010458867">"再次输入新 SIM 卡 PIN 码予以确认"</string> <string name="verifyFailed" msgid="3875778795754857903">"您输入的 SIM 卡 PIN 不匹配,请重试。"</string> <string name="enterPuk" msgid="6144749655582862324">"输入 PUK 码以解锁 SIM 卡"</string> <string name="badPuk" msgid="3213017898690275965">"PUK 码不正确!"</string> <string name="buttonTxtContinue" msgid="863271214384739936">"继续"</string> <string name="puk_unlocked" msgid="2284912838477558454">"您的 SIM 卡已解锁。正在解锁您的手机..."</string> <string name="label_ndp" msgid="780479633159517250">"SIM 卡网络解锁 PIN 码"</string> <string name="sim_ndp_unlock_text" msgid="683628237760543009">"解锁"</string> <string name="sim_ndp_dismiss_text" msgid="1604823375752456947">"关闭"</string> <string name="requesting_unlock" msgid="6412629401033249351">"正在请求网络解锁..."</string> <string name="unlock_failed" msgid="6490531697031504225">"网络解锁请求失败。"</string> <string name="unlock_success" msgid="6770085622238180152">"网络解锁成功。"</string> <string name="imei" msgid="8552502717594321281">"IMEI"</string> <string name="labelGSMMore" msgid="5930842194056092106">GSM 通话设置</string> <skip /> <!-- no translation found for labelCDMAMore (1630676740428229339) --> <skip /> <string name="apn_settings" msgid="9043423184895642077">"接入点名称"</string> <string name="settings_label" msgid="3876743539816984008">"网络设置"</string> <string name="voicemail" msgid="8693759337917898954">"语音信箱"</string> <string name="voicemail_abbreviated" msgid="2215592488517217448">"VM:"</string> <string name="networks" msgid="8873030692174541976">"网络运营商"</string> <string name="call_settings" msgid="6112441768261754562">"通话设置"</string> <string name="additional_gsm_call_settings" msgid="6472260354879794056">其他通话设置</string> <string name="sum_gsm_call_settings" msgid="4076647190996778012">GSM 独有通话设置</string> <!-- no translation found for additional_cdma_call_settings (8628958775721886909) --> <skip /> <!-- no translation found for sum_cdma_call_settings (284753265979035549) --> <skip /> <string name="labelNwService" msgid="4699970172021870983">"网络服务设置"</string> <string name="labelCallerId" msgid="3888899447379069198">"来电显示"</string> <string name="sum_hide_caller_id" msgid="1071407020290873782">"去电时隐藏号码"</string> <string name="sum_show_caller_id" msgid="6768534125447290401">"去电时显示的号码"</string> <string name="sum_default_caller_id" msgid="1954518825510901365">"使用默认运营商设置在去电时显示我的号码"</string> <string name="labelCW" msgid="6120513814915920200">"呼叫等待"</string> <string name="sum_cw_enabled" msgid="8083061901633671397">"通话期间有来电时通知我"</string> <string name="sum_cw_disabled" msgid="3648693907300104575">"通话期间有来电时不通知我"</string> <string name="call_forwarding_settings" msgid="3378927671091537173">"呼叫转接设置"</string> <string name="labelCF" msgid="2574386948026924737">"呼叫转移"</string> <string name="labelCFU" msgid="8147177368148660600">"始终进行呼叫转移"</string> <string name="messageCFU" msgid="3560082430662923687">"始终使用此号码"</string> <string name="sum_cfu_enabled_indicator" msgid="4014187342724130197">"转移所有呼叫"</string> - <string name="sum_cfu_enabled" msgid="956178654350554451">"将所有呼叫转移至 \\\\{0\\\\}"</string> + <string name="sum_cfu_enabled" msgid="956178654350554451">"将所有呼叫转移至 {0}"</string> <string name="sum_cfu_disabled" msgid="3698472522160364904">"已禁用"</string> <string name="labelCFB" msgid="218938523102207587">"占线时呼叫转移"</string> <string name="messageCFB" msgid="3711089705936187129">"占线时的转移号码"</string> - <string name="sum_cfb_enabled" msgid="2501948432392255856">"转移至 \\\\{0\\\\}"</string> + <string name="sum_cfb_enabled" msgid="2501948432392255856">"转移至 {0}"</string> <string name="sum_cfb_disabled" msgid="227440009979537651">"已禁用"</string> <string name="labelCFNRy" msgid="3646316323834351390">"无应答时转移呼叫"</string> <string name="messageCFNRy" msgid="672317899884380374">"无应答时拨号"</string> - <string name="sum_cfnry_enabled" msgid="3473526018876802076">"转移至 \\\\{0\\\\}"</string> + <string name="sum_cfnry_enabled" msgid="3473526018876802076">"转移至 {0}"</string> <string name="sum_cfnry_disabled" msgid="8422350929957344729">"已禁用"</string> <string name="labelCFNRc" msgid="47183615370850000">"无法接通时转接"</string> <string name="messageCFNRc" msgid="6380695421020295119">"无法接通时的转接号码"</string> - <string name="sum_cfnrc_enabled" msgid="3528648673654636587">"转接至 \\\\{0\\\\}"</string> + <string name="sum_cfnrc_enabled" msgid="3528648673654636587">"转接至 {0}"</string> <string name="sum_cfnrc_disabled" msgid="7222141261321276464">"已禁用"</string> <string name="updating_title" msgid="6146755386174019046">"通话设置"</string> <string name="error_updating_title" msgid="7970259216988931777">"通话设置错误"</string> <string name="reading_settings" msgid="1920291699287055284">"正在读取设置..."</string> <string name="updating_settings" msgid="8171225533884883252">"正在更新设置..."</string> <string name="response_error" msgid="6674110501330139405">"来自网络的意外响应,"</string> <string name="exception_error" msgid="7027667130619518211">"网络或 SIM 卡错误。"</string> <string name="radio_off_error" msgid="6717116288405111269">"请在查看这些设置之前先关闭飞行模式。"</string> <string name="close_dialog" msgid="2365884406356986917">"确定"</string> <string name="enable" msgid="1059008390636773574">"启用"</string> <string name="disable" msgid="7274240979164762320">"禁用"</string> <string name="change_num" msgid="239476305819844391">"更新"</string> <string-array name="clir_display_values"> <item msgid="5560134294467334594">"网络默认设置"</item> <item msgid="7876195870037833661">"隐藏号码"</item> <item msgid="1108394741608734023">"显示号码"</item> </string-array> <string name="vm_save_number" msgid="4579969432544566719">"保存语音信箱号码"</string> <string name="vm_changed" msgid="380744030726254139">"语音信箱号码已更改。"</string> <string name="vm_change_failed" msgid="8484504256705014152">"语音信箱号码更改失败。"</string> <string name="no_change" msgid="3186040086622435212">"未做过更改。"</string> <string name="sum_voicemail" msgid="2528087245989303328">"设置语音信箱号码"</string> <string name="mobile_networks" msgid="5540397602919106177">"移动网络设置"</string> <string name="label_available" msgid="1181658289009300430">"可用的网络"</string> <string name="load_networks_progress" msgid="5230707536168902952">"正在搜索..."</string> <string name="empty_networks_list" msgid="4249426905018815316">"未找到网络。"</string> <string name="search_networks" msgid="1601136049300882441">"搜索网络"</string> <string name="network_query_error" msgid="6828516148953325006">"搜索网络时出错。"</string> <string name="register_on_network" msgid="9055203954040805084">"正在<xliff:g id="NETWORK">%s</xliff:g>上注册..."</string> <string name="not_allowed" msgid="3540496123717833833">"您的 SIM 卡不允许连接到此网络。"</string> <string name="registration_done" msgid="495135664535876612">"已在网络上注册。"</string> <string name="sum_carrier_select" msgid="6526225502314751575">"选择一个网络运营商"</string> <string name="sum_search_networks" msgid="2921092249873272715">"搜索所有可用的网络"</string> <string name="select_automatically" msgid="8615980695510888796">"自动选择"</string> <string name="sum_select_automatically" msgid="8460954604521755275">"自动选择首选网络"</string> <string name="register_automatically" msgid="6272031189219101172">"正在自动注册..."</string> <!-- no translation found for preferred_network_mode_title (8873246565334559308) --> <skip /> <!-- no translation found for preferred_network_mode_summary (1434820673166126609) --> <skip /> <!-- no translation found for preferred_network_mode_dialogtitle (8176355237105593793) --> <skip /> <!-- no translation found for preferred_network_mode_choices:0 (2987674222882365152) --> <!-- no translation found for preferred_network_mode_choices:1 (3273348576277144124) --> <!-- no translation found for preferred_network_mode_choices:2 (454610224530856274) --> <!-- no translation found for preferred_network_mode_choices:3 (8928247118825616081) --> <!-- no translation found for preferred_network_mode_choices:4 (8595462903294812666) --> <!-- no translation found for preferred_network_mode_choices:5 (5189164180446264504) --> <!-- no translation found for preferred_network_mode_choices:6 (5714714953966979187) --> <!-- no translation found for preferred_network_mode_choices:7 (4775796025725908913) --> <!-- no translation found for preferred_network_mode_values:0 (7164534877603905916) --> <!-- no translation found for preferred_network_mode_values:1 (2520921432080278213) --> <!-- no translation found for preferred_network_mode_values:2 (4978887990900575049) --> <!-- no translation found for preferred_network_mode_values:3 (6891436459357445885) --> <!-- no translation found for preferred_network_mode_values:4 (339825043192186272) --> <!-- no translation found for preferred_network_mode_values:5 (3062641619893382241) --> <!-- no translation found for preferred_network_mode_values:6 (2494009747968041784) --> <!-- no translation found for preferred_network_mode_values:7 (2568449734331711605) --> <string name="roaming" msgid="8871412572928323707">"数据漫游"</string> <string name="roaming_enable" msgid="7331106985174381987">"漫游时连接到数据服务"</string> <string name="roaming_disable" msgid="1843417228755568110">"漫游时连接到数据服务"</string> <string name="roaming_reenable_message" msgid="6973894869473170666">"您已失去数据连接,因为您离开了本地网络并关闭了数据漫游。"</string> <string name="roaming_warning" msgid="7820963598559553967">"是否允许数据漫游?您可能会需要支付高额的漫游费!"</string> <!-- no translation found for gsm_umts_options (6538311689850981686) --> <skip /> <!-- no translation found for cdma_options (4016822858172249884) --> <skip /> <!-- no translation found for cdma_cell_broadcast_sms (7898475142527341808) --> <skip /> <!-- no translation found for cell_broadcast_sms (5584192824053625842) --> <skip /> <!-- no translation found for enable_disable_cell_bc_sms (4851147873691392255) --> <skip /> <!-- no translation found for cell_bc_sms_enable (6441688565738921084) --> <skip /> <!-- no translation found for cell_bc_sms_disable (3398365088309408749) --> <skip /> <!-- no translation found for cb_sms_settings (651715019785107312) --> <skip /> <!-- no translation found for enable_disable_emergency_broadcast (2157014609041245335) --> <skip /> <!-- no translation found for emergency_broadcast_enable (2645980025414010211) --> <skip /> <!-- no translation found for emergency_broadcast_disable (3665199821267569426) --> <skip /> <!-- no translation found for enable_disable_administrative (6501582322182059412) --> <skip /> <!-- no translation found for administrative_enable (1750086122962032235) --> <skip /> <!-- no translation found for administrative_disable (8433273857248698539) --> <skip /> <!-- no translation found for enable_disable_maintenance (1819693083025106678) --> <skip /> <!-- no translation found for maintenance_enable (8566636458770971189) --> <skip /> <!-- no translation found for maintenance_disable (7340189100885066077) --> <skip /> <!-- no translation found for general_news_settings (4968779723948432978) --> <skip /> <!-- no translation found for bf_news_settings (3935593091894685267) --> <skip /> <!-- no translation found for sports_news_settings (7649399631270052835) --> <skip /> <!-- no translation found for entertainment_news_settings (5051153952959405035) --> <skip /> <!-- no translation found for enable_disable_local (7890281063123416120) --> <skip /> <!-- no translation found for local_enable (6370463247609136359) --> <skip /> <!-- no translation found for local_disable (4405691986943795798) --> <skip /> <!-- no translation found for enable_disable_regional (4905652414535565872) --> <skip /> <!-- no translation found for regional_enable (4434680415437834759) --> <skip /> <!-- no translation found for regional_disable (5359325527213850077) --> <skip /> <!-- no translation found for enable_disable_national (236278090206880734) --> <skip /> <!-- no translation found for national_enable (1172443648912246952) --> <skip /> <!-- no translation found for national_disable (326018148178601166) --> <skip /> <!-- no translation found for enable_disable_international (7535348799604565592) --> <skip /> <!-- no translation found for international_enable (5855356769925044927) --> <skip /> <!-- no translation found for international_disable (2850648591041088931) --> <skip /> <!-- no translation found for list_language_title (2841683501919760043) --> <skip /> <!-- no translation found for list_language_summary (8109546531071241601) --> <skip /> <!-- no translation found for list_language_entries:0 (6137851079727305485) --> <!-- no translation found for list_language_entries:1 (1151988412809572526) --> <!-- no translation found for list_language_entries:2 (577840534704312665) --> <!-- no translation found for list_language_entries:3 (8385712091143148180) --> <!-- no translation found for list_language_entries:4 (1858401628368130638) --> <!-- no translation found for list_language_entries:5 (1933212028684529632) --> <!-- no translation found for list_language_entries:6 (1908428006803639064) --> <!-- no translation found for list_language_values:0 (1804908636436467150) --> <!-- no translation found for list_language_values:1 (289708030346890334) --> <!-- no translation found for list_language_values:2 (1121469729692402684) --> <!-- no translation found for list_language_values:3 (2614093115912897722) --> <!-- no translation found for list_language_values:4 (2411164639857960614) --> <!-- no translation found for list_language_values:5 (5884448729274543324) --> <!-- no translation found for list_language_values:6 (5511864807618312598) --> <!-- no translation found for list_language_dtitle (5442908726538951934) --> <skip /> <!-- no translation found for enable_disable_local_weather (986967454867219114) --> <skip /> <!-- no translation found for local_weather_enable (6199315114382448922) --> <skip /> <!-- no translation found for local_weather_disable (2510158089142626480) --> <skip /> <!-- no translation found for enable_disable_atr (8339572391278872343) --> <skip /> <!-- no translation found for atr_enable (5541757457789181799) --> <skip /> <!-- no translation found for atr_disable (7085558154727596455) --> <skip /> <!-- no translation found for enable_disable_lafs (668189073721277199) --> <skip /> <!-- no translation found for lafs_enable (2791978667205137052) --> <skip /> <!-- no translation found for lafs_disable (2391212397725495350) --> <skip /> <!-- no translation found for enable_disable_restaurants (6240381945336814024) --> <skip /> <!-- no translation found for restaurants_enable (5137657479469118847) --> <skip /> <!-- no translation found for restaurants_disable (3678480270938424092) --> <skip /> <!-- no translation found for enable_disable_lodgings (1822029172658551202) --> <skip /> <!-- no translation found for lodgings_enable (3230042508992850322) --> <skip /> <!-- no translation found for lodgings_disable (3387879742320682391) --> <skip /> <!-- no translation found for enable_disable_retail_directory (1357809784475660303) --> <skip /> <!-- no translation found for retail_directory_enable (3280626290436111496) --> <skip /> <!-- no translation found for retail_directory_disable (6479739816662879027) --> <skip /> <!-- no translation found for enable_disable_advertisements (5999495926176182128) --> <skip /> <!-- no translation found for advertisements_enable (2050305021264683786) --> <skip /> <!-- no translation found for advertisements_disable (8350985908788707935) --> <skip /> <!-- no translation found for enable_disable_stock_quotes (6397810445293533603) --> <skip /> <!-- no translation found for stock_quotes_enable (4384802470887170543) --> <skip /> <!-- no translation found for stock_quotes_disable (4781450084565594998) --> <skip /> <!-- no translation found for enable_disable_eo (4863043263443942494) --> <skip /> <!-- no translation found for eo_enable (8623559062015685813) --> <skip /> <!-- no translation found for eo_disable (3863812478090907609) --> <skip /> <!-- no translation found for enable_disable_mhh (5698783743098373681) --> <skip /> <!-- no translation found for mhh_enable (3949276822735205799) --> <skip /> <!-- no translation found for mhh_disable (4834280270664925123) --> <skip /> <!-- no translation found for enable_disable_technology_news (3517184627114999149) --> <skip /> <!-- no translation found for technology_news_enable (7995209394210455181) --> <skip /> <!-- no translation found for technology_news_disable (5483490380561851946) --> <skip /> <!-- no translation found for enable_disable_multi_category (626771003122899280) --> <skip /> <!-- no translation found for multi_category_enable (1179299804641721768) --> <skip /> <!-- no translation found for multi_category_disable (880104702904139505) --> <skip /> <!-- no translation found for gsm_umts_network_preferences_title (4834419333547382436) --> <skip /> <!-- no translation found for gsm_umts_network_preferneces_summary (1905018644156819521) --> <skip /> <!-- no translation found for gsm_umts_network_preferences_dialogtitle (6356332580813229898) --> <skip /> <!-- no translation found for gsm_umts_network_preferences_choices:0 (4327916632016252900) --> <!-- no translation found for gsm_umts_network_preferences_choices:1 (7890032659744442614) --> <!-- no translation found for gsm_umts_network_preferences_choices:2 (7306003477602941058) --> <!-- no translation found for gsm_umts_network_preferences_values:0 (117293148930527265) --> <!-- no translation found for gsm_umts_network_preferences_values:1 (2264578612775462302) --> <!-- no translation found for gsm_umts_network_preferences_values:2 (1268081943590316978) --> <string name="prefer_2g" msgid="8442550937280449639">"仅使用 2G 网络"</string> <string name="prefer_2g_summary" msgid="1976491403210690759">"如果选择这个能够省电"</string> <!-- no translation found for cdma_system_select_title (5757657769327732833) --> <skip /> <!-- no translation found for cdma_system_select_summary (2528661990595284707) --> <skip /> <!-- no translation found for cdma_system_select_dialogtitle (6083355415165359075) --> <skip /> <!-- no translation found for cdma_system_select_choices:0 (176474317493999285) --> <!-- no translation found for cdma_system_select_choices:1 (1205664026446156265) --> <!-- no translation found for cdma_system_select_values:0 (4354305960068894315) --> <!-- no translation found for cdma_system_select_values:1 (3046877284450231151) --> <!-- no translation found for cdma_roaming_mode_title (6366737033053855198) --> <skip /> <!-- no translation found for cdma_roaming_mode_summary (8604713111805562261) --> <skip /> <!-- no translation found for cdma_roaming_mode_dialogtitle (1802896889172094947) --> <skip /> <!-- no translation found for cdma_roaming_mode_choices:0 (6024072766548865002) --> <!-- no translation found for cdma_roaming_mode_choices:1 (8174642753290624634) --> <!-- no translation found for cdma_roaming_mode_choices:2 (2241951431403168661) --> <!-- no translation found for cdma_roaming_mode_values:0 (2549203161367380954) --> <!-- no translation found for cdma_roaming_mode_values:1 (6007798728227141997) --> <!-- no translation found for cdma_roaming_mode_values:2 (4039511109802141047) --> <!-- no translation found for cdma_network_preferences_title (41193174429510391) --> <skip /> <!-- no translation found for cdma_network_preferneces_summary (3524451924935793338) --> <skip /> <!-- no translation found for cdma_network_preferences_dialogtitle (4548860809290455653) --> <skip /> <!-- no translation found for cdma_network_preferences_choices:0 (7278992425338592489) --> <!-- no translation found for cdma_network_preferences_choices:1 (3155327921861137068) --> <!-- no translation found for cdma_network_preferences_choices:2 (2683555124647197574) --> <!-- no translation found for cdma_network_preferences_values:0 (1821235500822403409) --> <!-- no translation found for cdma_network_preferences_values:1 (6355374585098185445) --> <!-- no translation found for cdma_network_preferences_values:2 (213552629330086398) --> <!-- no translation found for subscription_title (5813493350326486) --> <skip /> <!-- no translation found for subscription_summary (8435941016743418124) --> <skip /> <!-- no translation found for subscription_dialogtitle (531571450448009255) --> <skip /> <!-- no translation found for subscription_choices:0 (6540107472553796600) --> <!-- no translation found for subscription_choices:1 (1433427108940308332) --> <!-- no translation found for subscription_values:0 (4377788417250295786) --> <!-- no translation found for subscription_values:1 (1193066664940329729) --> <string name="fdn" msgid="7878832555095183202">"固定拨号"</string> <string name="manage_fdn_list" msgid="8777755791892122369">"固定拨号列表"</string> <string name="fdn_activation" msgid="2156479741307463576">"激活固定拨号"</string> <string name="fdn_enabled" msgid="5238109009915521240">"已启用固定拨号"</string> <string name="fdn_disabled" msgid="4700049736675368279">"已禁用固定拨号"</string> <string name="enable_fdn" msgid="3740191529180493851">"启用固定拨号"</string> <string name="disable_fdn" msgid="7944020890722540616">"禁用固定拨号"</string> <string name="change_pin2" msgid="2153563695382176676">"更改 PIN2"</string> <string name="enable_fdn_ok" msgid="7215588870329688132">"禁用固定拨号"</string> <string name="disable_fdn_ok" msgid="5727046928930740173">"启用固定拨号"</string> <string name="sum_fdn" msgid="1959399454900272878">"管理固定拨号"</string> <string name="sum_fdn_change_pin" msgid="6666549734792827932">"更改 PIN 码以进行 FDN 访问"</string> <string name="sum_fdn_manage_list" msgid="8431088265332628316">"管理电话号码列表"</string> <!-- no translation found for voice_privacy (7803023024169078619) --> <skip /> <!-- no translation found for voice_privacy_summary (3159383389833516214) --> <skip /> <!-- no translation found for tty_mode_title (3171521903490559138) --> <skip /> <!-- no translation found for tty_mode_summary (5057244302665817977) --> <skip /> <!-- no translation found for tty_mode_option_title (9033098925144434669) --> <skip /> <!-- no translation found for tty_mode_option_summary (1073835131534808732) --> <skip /> <string name="menu_add" msgid="1882023737425114762">"添加联系人"</string> <string name="menu_edit" msgid="7143003705504672374">"编辑联系人"</string> <string name="menu_delete" msgid="3977150783449642851">"删除联系人"</string> <string name="get_pin2" msgid="1198225482542827652">"输入 PIN2 码"</string> <string name="name" msgid="7329028332786872378">"名称"</string> <string name="number" msgid="7905950798349903858">"号码"</string> <string name="save" msgid="4094274636321939086">"保存"</string> <string name="add_fdn_contact" msgid="5412242719704146070">"添加固定拨号联系人"</string> <string name="adding_fdn_contact" msgid="1008984230265031168">"添加固定拨号联系人..."</string> <string name="fdn_contact_added" msgid="3283284983265410270">"固定拨号联系人已添加。"</string> <string name="edit_fdn_contact" msgid="3440054765948798731">"编辑固定拨号联系人"</string> <string name="updating_fdn_contact" msgid="5918299270800552372">"正在更新固定拨号联系人..."</string> <string name="fdn_contact_updated" msgid="510187720367785051">"固定拨号联系人已更新。"</string> <string name="delete_fdn_contact" msgid="2237838617123538040">"删除固定拨号联系人"</string> <string name="deleting_fdn_contact" msgid="6162824054507660151">"正在删除固定拨号联系人..."</string> <string name="fdn_contact_deleted" msgid="5596742031140651283">"固定拨号联系人已删除。"</string> <string name="pin2_invalid" msgid="6408721267712649637">"PIN2 码无效!"</string> <string name="fdn_invalid_number" msgid="1484959418054136856">"号码不得超过 20 位。"</string> <string name="simContacts_emptyLoading" msgid="2203331234764498011">"正在从 SIM 卡读取..."</string> <string name="simContacts_empty" msgid="5270660846489561932">"您的 SIM 卡上没有联系人。"</string> <string name="simContacts_title" msgid="1861472842524839921">"选择要导入的联系人"</string> <string name="enable_pin" msgid="5422767284133234860">"启用/禁用 SIM 卡 PIN 码"</string> <string name="change_pin" msgid="9174186126330785343">"更改 SIM 卡 PIN 码"</string> <string name="enter_pin_text" msgid="8532615714751931951">"SIM 卡 PIN 码:"</string> <string name="oldPinLabel" msgid="5287773661246368314">"旧 PIN 码"</string> <string name="newPinLabel" msgid="207488227285336897">"新 PIN 码"</string> <string name="confirmPinLabel" msgid="257597715098070206">"确认新 PIN 码"</string> <string name="badPin" msgid="4154316827946559447">"您输入的旧 PIN 码不正确,请重试。"</string> <string name="mismatchPin" msgid="5974597541268042785">"您输入的 PIN 码不匹配,请重试。"</string> <string name="invalidPin" msgid="5981171102258684792">"输入 4 到 8 位数字的 PIN 码。"</string> <string name="disable_sim_pin" msgid="3992926931620188855">"禁用 SIM 卡 PIN 码"</string> <string name="enable_sim_pin" msgid="5803702443844458831">"启用 SIM 卡 PIN 码"</string> <string name="enable_in_progress" msgid="3695303775100109650">"请稍候..."</string> <string name="enable_pin_ok" msgid="8077439615296694284">"SIM 卡 PIN 码已启用"</string> <string name="disable_pin_ok" msgid="8552428316206928913">"SIM 卡 PIN 码已禁用"</string> <string name="pin_failed" msgid="6597695909685242127">"您输入的 PIN 码不正确"</string> <string name="pin_changed" msgid="9000716792724195093">"SIM 卡 PIN码更改成功"</string> <string name="puk_requested" msgid="3898394204193202803">"密码不正确,SIM 已锁定!需要 PUK2 码。"</string> <string name="enter_pin2_text" msgid="8339444124477720345">"PIN2 码"</string> <string name="oldPin2Label" msgid="8559146795026261502">"旧 PIN2 码"</string> <string name="newPin2Label" msgid="4573956902204349054">"新 PIN2 码"</string> <string name="confirmPin2Label" msgid="8100319484454787708">"确认新 PIN2 码"</string> <string name="badPuk2" msgid="4072035207011308856">"您输入的 PUK2 码不正确,请重试。"</string> <string name="badPin2" msgid="515218795152422178">"您输入的旧 PIN2 码不正确,请重试。"</string> <string name="mismatchPin2" msgid="4177060915600342718">"您输入的 PIN2 码不匹配,请重试。"</string> <string name="invalidPin2" msgid="8237110107480395938">"输入 4 到 8 位数字的 PIN2 码。"</string> <string name="invalidPuk2" msgid="1290977391033057871">"输入 8 位数字的 PUK2 码。"</string> <string name="pin2_changed" msgid="2670422162555916562">"PIN2 码更改成功"</string> <string name="label_puk2_code" msgid="302845876240219560">"输入 PUK2 码"</string> <string name="fdn_enable_puk2_requested" msgid="2608836967081385948">"密码不正确,请更改 PIN2 码并重试!"</string> <string name="puk2_requested" msgid="5863580927788820813">"密码不正确,SIM 已锁定!需要 PUK2 码。"</string> <string name="doneButton" msgid="2859593360997984240">"完成"</string> <string name="caller_manage_header" msgid="3231519674734638786">"电话会议 <xliff:g id="CONF_CALL_TIME">%s</xliff:g>"</string> <string name="caller_manage_manage_done_text" msgid="8093934725536733856">"返回通话"</string> <string name="sim_missing_continueView_text" msgid="4199689081742026077">"在没有 SIM 卡的情况下继续"</string> <string name="sim_missing_msg_text" msgid="6803619600564142188">"未找到 SIM 卡。请将 SIM 卡插入手机中。"</string> <string name="sim_unlock_dismiss_text" msgid="8292343981739813597">"关闭"</string> <string name="sim_unlock_unlock_text" msgid="6328406783399256930">"解锁"</string> <string name="sim_unlock_status_text" msgid="1919609683384607179">"正在验证 PIN 码..."</string> <string name="voicemail_settings_number_label" msgid="8524164258691887790">"语音信箱号码"</string> <string name="card_title_dialing" msgid="5769417478498348054">"正在拨号"</string> <string name="card_title_in_progress" msgid="8603765629781648862">"当前通话"</string> <string name="card_title_conf_call" msgid="1162980346189744501">"电话会议"</string> <string name="card_title_incoming_call" msgid="7364539451234646909">"来电"</string> <!-- no translation found for card_title_cdma_call_waiting (4532445524811272644) --> <skip /> <string name="card_title_call_ended" msgid="5544730338889702298">"通话已结束"</string> <string name="card_title_on_hold" msgid="821463117892339942">"保持"</string> <string name="card_title_hanging_up" msgid="3999101620995182450">"正在挂断通话"</string> <string name="card_title_in_call" msgid="6346543933068225205">"通话中"</string> <string name="notification_missedCallTitle" msgid="7554385905572364535">"未接来电"</string> <string name="notification_missedCallsTitle" msgid="1361677948941502522">"未接来电"</string> <string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> 个未接来电"</string> <string name="notification_missedCallTicker" msgid="504686252427747209">"错过了来自<xliff:g id="MISSED_CALL_FROM">%s</xliff:g>的呼叫"</string> <string name="notification_ongoing_call_format" msgid="227216462548540316">"当前去电 (<xliff:g id="DURATION">%s</xliff:g>)"</string> <string name="notification_ongoing_calling_format">"当前拨出(<xliff:g id="DURATION">%s</xliff:g>)"</string> <string name="notification_on_hold" msgid="3480694969511790465">"保持"</string> <string name="notification_voicemail_title" msgid="8933468752045550523">"新语音邮件"</string> <string name="notification_voicemail_title_count" msgid="4366360747660929916">"新语音邮件 (<xliff:g id="count">%d</xliff:g>)"</string> <string name="notification_voicemail_text_format" msgid="4447323569453981685">"拨打 <xliff:g id="VOICEMAIL_NUMBER">%s</xliff:g>"</string> <string name="notification_voicemail_no_vm_number" msgid="760963466895609716">"未设置语音信箱号码"</string> <string name="incall_error_power_off" msgid="6550191216405193368">"要拨打电话,请先关闭飞行模式。"</string> <string name="incall_error_emergency_only" msgid="4678640422710818317">"未在网络上注册。"</string> <string name="incall_error_no_phone_number_supplied" msgid="4197432103471807739">"呼叫未发送,未输入有效的号码。"</string> <string name="incall_error_call_failed" msgid="4313552620858880999">"呼叫未发送。"</string> <string name="incall_status_dialed_mmi" msgid="3672498861336189563">"正在启动 MMI 序列..."</string> <!-- no translation found for incall_status_dialed_fc (1632879988662225263) --> <skip /> <string name="incall_error_supp_service_unknown" msgid="2991054870745666038">"不支持此服务。"</string> <string name="incall_error_supp_service_switch" msgid="3503552565745872241">"无法切换通话。"</string> <string name="incall_error_supp_service_separate" msgid="914362338192301746">"无法分离呼叫。"</string> <string name="incall_error_supp_service_transfer" msgid="2509871374644921632">"无法转移呼叫。"</string> <string name="incall_error_supp_service_conference" msgid="2505727299596357312">"无法进行电话会议。"</string> <string name="incall_error_supp_service_reject" msgid="7055164130563826216">"无法拒绝呼叫。"</string> <string name="incall_error_supp_service_hangup" msgid="7417583238334762737">"无法释放呼叫。"</string> <string name="emergency_enable_radio_dialog_title" msgid="4627849966634578257">"紧急呼叫"</string> <string name="emergency_enable_radio_dialog_message" msgid="207613549344420291">"正在打开移动网络..."</string> <string name="emergency_enable_radio_dialog_retry" msgid="3724423402363063736">"不在服务区,正在重试..."</string> <string name="dial_emergency_error" msgid="8362624131726575194">"呼叫未发送,因为 <xliff:g id="NON_EMERGENCY_NUMBER">%s</xliff:g> 不是一个紧急号码!"</string> <string name="dial_emergency_empty_error" msgid="5048645338094088229">"呼叫未发送,请拨打紧急号码!"</string> <string name="dialerKeyboardHintText" msgid="9192914825413747792">"使用键盘拨号"</string> <string name="dtmfDialpadHintText" msgid="2153335217920679451">"按键式键盘"</string> <string name="dtmfDialpadHandleLabel" msgid="6077872154488117962">"拨号面板"</string> <string name="touchLockText" msgid="8742463586429019112">"轻击两下\n解锁"</string> <string name="onscreenAnswerText" msgid="7643040500342720792">"轻击两下\n应答"</string> <string name="importSimEntry" msgid="6614358325359736031">"导入"</string> <string name="importAllSimEntries" msgid="1503181169636198673">"全部导入"</string> <string name="importingSimContacts" msgid="7374056215462575769">"正在导入 SIM 联系人"</string> <string name="importToFDNfromContacts" msgid="2130620207013368580">"从联系人导入"</string> <!-- no translation found for tty_mode_entries:0 (512950011423868021) --> <!-- no translation found for tty_mode_entries:1 (4781215771530681384) --> <!-- no translation found for tty_mode_entries:2 (5659212685488676933) --> <!-- no translation found for tty_mode_entries:3 (1113703196326500239) --> <!-- no translation found for eri_text_label (4326942349915331461) --> <skip /> <!-- no translation found for dtmf_tones_title (3866923093113274152) --> <skip /> <!-- no translation found for dtmf_tones_summary (3351820372864020331) --> <skip /> <!-- no translation found for dtmf_tone_entries:0 (899650777817315681) --> <!-- no translation found for dtmf_tone_entries:1 (2883365539347850535) --> <!-- no translation found for network_message (5673682885938122239) --> <skip /> <string name="advanced_setting">高级设置 V.21</string> <string name="vibrate_outgoing">接听震动</string> <string name="vibrate_outgoing_sum">当对方接听时震动.</string> <string name="vibrate_45">45秒震动</string> <string name="vibrate_45_sum">呼出通话时到45秒时震动.</string> <string name="vibrate_hangup">挂断震动</string> <string name="vibrate_hangup_sum">通话结束时震动.</string> <string name="screen_awake">屏幕保持</string> <string name="screen_awake_sum">通话时, 屏幕等待更长时间才关闭.</string> <string name="led_notify_call">未接电话LED通知</string> <string name="led_notify_call_sum">有未接电话时LED会闪烁.</string> <string name="led_show_organ">显示公司名称</string> <string name="led_show_organ_sum">打电话界面显示公司名称在姓名后面.</string> <string name="vibrate_call_waiting">呼叫等待震动</string> <string name="vibrate_call_waiting_sum">当呼叫等待时震动通知.</string> <string name="return_home">强制返回到通话记录</string> <string name="return_home_sum">当呼出通话结束后会强制返回到通话记录屏幕.</string> <string name="menu_addBlackList">加入黑名单</string> <string name="black_list">黑名单</string> <string name="black_list_sum">列入黑名单的来电会被自动挂断.</string> <string name="add_black">添加来电</string> <string name="remove_black">从名单中去除 %s</string> </resources>
cytown/android_packages_apps_Phone
1bdafc773d39894d0a65fa7f3b89bc4829499173
fix bug for leaked IntentReceiver
diff --git a/src/com/android/phone/InCallScreen.java b/src/com/android/phone/InCallScreen.java index 79be4d8..e7c1102 100755 --- a/src/com/android/phone/InCallScreen.java +++ b/src/com/android/phone/InCallScreen.java @@ -229,1048 +229,1048 @@ public class InCallScreen extends Activity private View mTouchLockIcon; // The "lock" icon in the middle of the screen private Animation mTouchLockFadeIn; private long mTouchLockLastTouchTime; // in SystemClock.uptimeMillis() time base // Onscreen "answer" UI, for devices with no hardware CALL button. private View mOnscreenAnswerUiContainer; // The container for the whole UI, or null if unused private View mOnscreenAnswerButton; // The "answer" button itself private long mOnscreenAnswerButtonLastTouchTime; // in SystemClock.uptimeMillis() time base // Various dialogs we bring up (see dismissAllDialogs()) // The MMI started dialog can actually be one of 2 items: // 1. An alert dialog if the MMI code is a normal MMI // 2. A progress dialog if the user requested a USSD private Dialog mMmiStartedDialog; private AlertDialog mMissingVoicemailDialog; private AlertDialog mGenericErrorDialog; private AlertDialog mSuppServiceFailureDialog; private AlertDialog mWaitPromptDialog; private AlertDialog mWildPromptDialog; // TODO: If the Activity class ever provides an easy way to get the // current "activity lifecycle" state, we can remove these flags. private boolean mIsDestroyed = false; private boolean mIsForegroundActivity = false; // Flag indicating whether or not we should bring up the Call Log when // exiting the in-call UI due to the Phone becoming idle. (This is // true if the most recently disconnected Call was initiated by the // user, or false if it was an incoming call.) // This flag is used by delayedCleanupAfterDisconnect(), and is set by // onDisconnect() (which is the only place that either posts a // DELAYED_CLEANUP_AFTER_DISCONNECT event *or* calls // delayedCleanupAfterDisconnect() directly.) private boolean mShowCallLogAfterDisconnect; private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { if (mIsDestroyed) { if (DBG) log("Handler: ignoring message " + msg + "; we're destroyed!"); return; } if (!mIsForegroundActivity) { if (DBG) log("Handler: handling message " + msg + " while not in foreground"); // Continue anyway; some of the messages below *want* to // be handled even if we're not the foreground activity // (like DELAYED_CLEANUP_AFTER_DISCONNECT), and they all // should at least be safe to handle if we're not in the // foreground... } PhoneApp app = PhoneApp.getInstance(); switch (msg.what) { case SUPP_SERVICE_FAILED: onSuppServiceFailed((AsyncResult) msg.obj); break; case PHONE_STATE_CHANGED: onPhoneStateChanged((AsyncResult) msg.obj); break; case PHONE_DISCONNECT: onDisconnect((AsyncResult) msg.obj); break; case EVENT_HEADSET_PLUG_STATE_CHANGED: // Update the in-call UI, since some UI elements (in // particular the "Speaker" menu button) change state // depending on whether a headset is plugged in. // TODO: A full updateScreen() is overkill here, since // the value of PhoneApp.isHeadsetPlugged() only affects a // single menu item. (But even a full updateScreen() // is still pretty cheap, so let's keep this simple // for now.) if (msg.arg1 != 1 && !isBluetoothAudioConnected()){ // If the state is "not connected", restore the speaker state. // We ONLY want to do this on the wired headset connect / // disconnect events for now though, so we're only triggering // on EVENT_HEADSET_PLUG_STATE_CHANGED. PhoneUtils.restoreSpeakerMode(getApplicationContext()); } updateScreen(); break; case PhoneApp.MMI_INITIATE: onMMIInitiate((AsyncResult) msg.obj); break; case PhoneApp.MMI_CANCEL: onMMICancel(); break; // handle the mmi complete message. // since the message display class has been replaced with // a system dialog in PhoneUtils.displayMMIComplete(), we // should finish the activity here to close the window. case PhoneApp.MMI_COMPLETE: // Check the code to see if the request is ready to // finish, this includes any MMI state that is not // PENDING. MmiCode mmiCode = (MmiCode) ((AsyncResult) msg.obj).result; // if phone is a CDMA phone display feature code completed message if (mPhone.getPhoneName().equals("CDMA")) { PhoneUtils.displayMMIComplete(mPhone, app, mmiCode, null, null); } else { if (mmiCode.getState() != MmiCode.State.PENDING) { if (DBG) log("Got MMI_COMPLETE, finishing..."); finish(); } } break; case POST_ON_DIAL_CHARS: handlePostOnDialChars((AsyncResult) msg.obj, (char) msg.arg1); break; case ADD_VOICEMAIL_NUMBER: addVoiceMailNumberPanel(); break; case DONT_ADD_VOICEMAIL_NUMBER: dontAddVoiceMailNumber(); break; case DELAYED_CLEANUP_AFTER_DISCONNECT: delayedCleanupAfterDisconnect(); break; case DISMISS_MENU: // dismissMenu() has no effect if the menu is already closed. dismissMenu(true); // dismissImmediate = true break; case ALLOW_SCREEN_ON: if (VDBG) log("ALLOW_SCREEN_ON message..."); // Undo our previous call to preventScreenOn(true). // (Note this will cause the screen to turn on // immediately, if it's currently off because of a // prior preventScreenOn(true) call.) app.preventScreenOn(false); break; case TOUCH_LOCK_TIMER: if (VDBG) log("TOUCH_LOCK_TIMER..."); touchLockTimerExpired(); break; case BLUETOOTH_STATE_CHANGED: if (VDBG) log("BLUETOOTH_STATE_CHANGED..."); // The bluetooth headset state changed, so some UI // elements may need to update. (There's no need to // look up the current state here, since any UI // elements that care about the bluetooth state get it // directly from PhoneApp.showBluetoothIndication().) updateScreen(); break; case PHONE_CDMA_CALL_WAITING: if (DBG) log("Received PHONE_CDMA_CALL_WAITING event ..."); Connection cn = mRingingCall.getLatestConnection(); // Only proceed if we get a valid connection object if (cn != null) { // Finally update screen with Call waiting info and request // screen to wake up updateScreen(); app.updateWakeState(); } break; case THREEWAY_CALLERINFO_DISPLAY_DONE: if (DBG) log("Received THREEWAY_CALLERINFO_DISPLAY_DONE event ..."); if (app.cdmaPhoneCallState.getCurrentCallState() == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) { // Set the mThreeWayCallOrigStateDialing state to true app.cdmaPhoneCallState.setThreeWayCallOrigState(false); //Finally update screen with with the current on going call updateScreen(); } break; } } }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_HEADSET_PLUG)) { // Listen for ACTION_HEADSET_PLUG broadcasts so that we // can update the onscreen UI when the headset state changes. // if (DBG) log("mReceiver: ACTION_HEADSET_PLUG"); // if (DBG) log("==> intent: " + intent); // if (DBG) log(" state: " + intent.getIntExtra("state", 0)); // if (DBG) log(" name: " + intent.getStringExtra("name")); // send the event and add the state as an argument. Message message = Message.obtain(mHandler, EVENT_HEADSET_PLUG_STATE_CHANGED, intent.getIntExtra("state", 0), 0); mHandler.sendMessage(message); } } }; @Override protected void onCreate(Bundle icicle) { if (DBG) log("onCreate()... this = " + this); Profiler.callScreenOnCreate(); super.onCreate(icicle); final PhoneApp app = PhoneApp.getInstance(); app.setInCallScreenInstance(this); setPhone(app.phone); // Sets mPhone and mForegroundCall/mBackgroundCall/mRingingCall mBluetoothHandsfree = app.getBluetoothHandsfree(); if (VDBG) log("- mBluetoothHandsfree: " + mBluetoothHandsfree); if (mBluetoothHandsfree != null) { // The PhoneApp only creates a BluetoothHandsfree instance in the // first place if getSystemService(Context.BLUETOOTH_SERVICE) // succeeds. So at this point we know the device is BT-capable. mBluetoothHeadset = new BluetoothHeadset(this, null); if (VDBG) log("- Got BluetoothHeadset: " + mBluetoothHeadset); } requestWindowFeature(Window.FEATURE_NO_TITLE); // Inflate everything in incall_screen.xml and add it to the screen. setContentView(R.layout.incall_screen); mDialerDrawer = (SlidingDrawer) findViewById(R.id.dialer_container); initInCallScreen(); // Create the dtmf dialer. Note that mDialer is instantiated // regardless of screen orientation, although the onscreen touchable // dialpad is used only in portrait mode. mDialer = new DTMFTwelveKeyDialer(this); registerForPhoneStates(); // No need to change wake state here; that happens in onResume() when we // are actually displayed. // Handle the Intent we were launched with, but only if this is the // the very first time we're being launched (ie. NOT if we're being // re-initialized after previously being shut down.) // Once we're up and running, any future Intents we need // to handle will come in via the onNewIntent() method. if (icicle == null) { if (DBG) log("onCreate(): this is our very first launch, checking intent..."); // Stash the result code from internalResolveIntent() in the // mInCallInitialStatus field. If it's an error code, we'll // handle it in onResume(). mInCallInitialStatus = internalResolveIntent(getIntent()); if (mInCallInitialStatus != InCallInitStatus.SUCCESS) { Log.w(LOG_TAG, "onCreate: status " + mInCallInitialStatus + " from internalResolveIntent()"); // See onResume() for the actual error handling. } } else { mInCallInitialStatus = InCallInitStatus.SUCCESS; } // When in landscape mode, the user can enter dtmf tones // at any time. We need to make sure the DTMFDialer is // setup correctly. if (ConfigurationHelper.isLandscape()) { mDialer.startDialerSession(); if (VDBG) log("Dialer initialized (in landscape mode)."); } Profiler.callScreenCreated(); } /** * Sets the Phone object used internally by the InCallScreen. * * In normal operation this is called from onCreate(), and the * passed-in Phone object comes from the PhoneApp. * For testing, test classes can use this method to * inject a test Phone instance. */ /* package */ void setPhone(Phone phone) { mPhone = phone; // Hang onto the three Call objects too; they're singletons that // are constant (and never null) for the life of the Phone. mForegroundCall = mPhone.getForegroundCall(); mBackgroundCall = mPhone.getBackgroundCall(); mRingingCall = mPhone.getRingingCall(); } @Override protected void onResume() { if (DBG) log("onResume()..."); super.onResume(); mIsForegroundActivity = true; final PhoneApp app = PhoneApp.getInstance(); // Disable the keyguard the entire time the InCallScreen is // active. (This is necessary only for the case of receiving an // incoming call while the device is locked; we need to disable // the keyguard so you can answer the call and use the in-call UI, // but we always re-enable the keyguard as soon as you leave this // screen (see onPause().)) app.disableKeyguard(); // Touch events are never considered "user activity" while the // InCallScreen is active, so that unintentional touches won't // prevent the device from going to sleep. app.setIgnoreTouchUserActivity(true); // Disable the status bar "window shade" the entire time we're on // the in-call screen. NotificationMgr.getDefault().getStatusBarMgr().enableExpandedView(false); // Listen for broadcast intents that might affect the onscreen UI. registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG)); // Check for any failures that happened during onCreate() or onNewIntent(). if (DBG) log("- onResume: initial status = " + mInCallInitialStatus); if (mInCallInitialStatus != InCallInitStatus.SUCCESS) { if (DBG) log("- onResume: failure during startup: " + mInCallInitialStatus); // Don't bring up the regular Phone UI! Instead bring up // something more specific to let the user deal with the // problem. handleStartupError(mInCallInitialStatus); // But it *is* OK to continue with the rest of onResume(), // since any further setup steps (like updateScreen() and the // CallCard setup) will fall back to a "blank" state if the // phone isn't in use. mInCallInitialStatus = InCallInitStatus.SUCCESS; } // Set the volume control handler while we are in the foreground. if (isBluetoothAudioConnected()) { setVolumeControlStream(AudioManager.STREAM_BLUETOOTH_SCO); } else { setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); } takeKeyEvents(true); // Always start off in NORMAL mode. setInCallScreenMode(InCallScreenMode.NORMAL); // Before checking the state of the phone, clean up any // connections in the DISCONNECTED state. // (The DISCONNECTED state is used only to drive the "call ended" // UI; it's totally useless when *entering* the InCallScreen.) mPhone.clearDisconnected(); InCallInitStatus status = syncWithPhoneState(); if (status != InCallInitStatus.SUCCESS) { if (DBG) log("- syncWithPhoneState failed! status = " + status); // Couldn't update the UI, presumably because the phone is totally // idle. But don't finish() immediately, since we might still // have an error dialog up that the user needs to see. // (And in that case, the error dialog is responsible for calling // finish() when the user dismisses it.) } if (ENABLE_PHONE_UI_EVENT_LOGGING) { // InCallScreen is now active. Checkin.logEvent(getContentResolver(), Checkin.Events.Tag.PHONE_UI, PHONE_UI_EVENT_ENTER); } // Update the poke lock and wake lock when we move to // the foreground. // // But we need to do something special if we're coming // to the foreground while an incoming call is ringing: if (mPhone.getState() == Phone.State.RINGING) { // If the phone is ringing, we *should* already be holding a // full wake lock (which we would have acquired before // firing off the intent that brought us here; see // PhoneUtils.showIncomingCallUi().) // // We also called preventScreenOn(true) at that point, to // avoid cosmetic glitches while we were being launched. // So now we need to post an ALLOW_SCREEN_ON message to // (eventually) undo the prior preventScreenOn(true) call. // // (In principle we shouldn't do this until after our first // layout/draw pass. But in practice, the delay caused by // simply waiting for the end of the message queue is long // enough to avoid any flickering of the lock screen before // the InCallScreen comes up.) if (VDBG) log("- posting ALLOW_SCREEN_ON message..."); mHandler.removeMessages(ALLOW_SCREEN_ON); mHandler.sendEmptyMessage(ALLOW_SCREEN_ON); // TODO: There ought to be a more elegant way of doing this, // probably by having the PowerManager and ActivityManager // work together to let apps request that the screen on/off // state be synchronized with the Activity lifecycle. // (See bug 1648751.) } else { // The phone isn't ringing; this is either an outgoing call, or // we're returning to a call in progress. There *shouldn't* be // any prior preventScreenOn(true) call that we need to undo, // but let's do this just to be safe: app.preventScreenOn(false); } app.updateWakeState(); // The "touch lock" overlay is NEVER visible when we resume. // (In particular, this check ensures that we won't still be // locked after the user wakes up the screen by pressing MENU.) enableTouchLock(false); // ...but if the dialpad is open we DO need to start the timer // that will eventually bring up the "touch lock" overlay. if (mDialer.isOpened()) resetTouchLockTimer(); // Restore the mute state if the last mute state change was NOT // done by the user. if (app.getRestoreMuteOnInCallResume()) { PhoneUtils.restoreMuteState(mPhone); app.setRestoreMuteOnInCallResume(false); } Profiler.profileViewCreate(getWindow(), InCallScreen.class.getName()); if (VDBG) log("onResume() done."); } @Override protected void onSaveInstanceState(Bundle outState) { if (VDBG) log("onSaveInstanceState()..."); super.onSaveInstanceState(outState); // TODO: Save any state of the UI that needs to persist across // configuration changes (ie. switching between portrait and // landscape.) } @Override protected void onPause() { // if (DBG) log("onPause()..."); super.onPause(); if (mPhone.getState() != Phone.State.RINGING) { if (DBG) log("onPause()..."); mIsForegroundActivity = false; final PhoneApp app = PhoneApp.getInstance(); // make sure the chronometer is stopped when we move away from // the foreground. if (mConferenceTime != null) { mConferenceTime.stop(); } // as a catch-all, make sure that any dtmf tones are stopped // when the UI is no longer in the foreground. mDialer.onDialerKeyUp(null); // If the device is put to sleep as the phone call is ending, // we may see cases where the DELAYED_CLEANUP_AFTER_DISCONNECT // event gets handled AFTER the device goes to sleep and wakes // up again. // This is because it is possible for a sleep command // (executed with the End Call key) to come during the 2 // seconds that the "Call Ended" screen is up. Sleep then // pauses the device (including the cleanup event) and // resumes the event when it wakes up. // To fix this, we introduce a bit of code that pushes the UI // to the background if we pause and see a request to // DELAYED_CLEANUP_AFTER_DISCONNECT. // Note: We can try to finish directly, by: // 1. Removing the DELAYED_CLEANUP_AFTER_DISCONNECT messages // 2. Calling delayedCleanupAfterDisconnect directly // However, doing so can cause problems between the phone // app and the keyguard - the keyguard is trying to sleep at // the same time that the phone state is changing. This can // end up causing the sleep request to be ignored. if (mHandler.hasMessages(DELAYED_CLEANUP_AFTER_DISCONNECT)) { if (DBG) log("DELAYED_CLEANUP_AFTER_DISCONNECT detected, moving UI to background."); finish(); } if (ENABLE_PHONE_UI_EVENT_LOGGING) { // InCallScreen is no longer active. Checkin.logEvent(getContentResolver(), Checkin.Events.Tag.PHONE_UI, PHONE_UI_EVENT_EXIT); } // Clean up the menu, in case we get paused while the menu is up // for some reason. dismissMenu(true); // dismiss immediately // Dismiss any dialogs we may have brought up, just to be 100% // sure they won't still be around when we get back here. dismissAllDialogs(); // Re-enable the status bar (which we disabled in onResume().) NotificationMgr.getDefault().getStatusBarMgr().enableExpandedView(true); - // Unregister for broadcast intents. (These affect the visible UI - // of the InCallScreen, so we only care about them while we're in the - // foreground.) - unregisterReceiver(mReceiver); - // Re-enable "user activity" for touch events. // We actually do this slightly *after* onPause(), to work around a // race condition where a touch can come in after we've paused // but before the device actually goes to sleep. // TODO: The PowerManager itself should prevent this from happening. mHandler.postDelayed(new Runnable() { public void run() { app.setIgnoreTouchUserActivity(false); } }, 500); // The keyguard was disabled the entire time the InCallScreen was // active (see onResume()). Re-enable it now. app.reenableKeyguard(); // Make sure we revert the poke lock and wake lock when we move to // the background. app.updateWakeState(); } + // Unregister for broadcast intents. (These affect the visible UI + // of the InCallScreen, so we only care about them while we're in the + // foreground.) + unregisterReceiver(mReceiver); + } @Override protected void onStop() { if (VDBG) log("onStop()..."); super.onStop(); stopTimer(); Phone.State state = mPhone.getState(); if (VDBG) log("onStop: state = " + state); if (state == Phone.State.IDLE) { // we don't want the call screen to remain in the activity history // if there are not active or ringing calls. if (DBG) log("- onStop: calling finish() to clear activity history..."); finish(); } } @Override protected void onDestroy() { if (DBG) log("onDestroy()..."); super.onDestroy(); // Set the magic flag that tells us NOT to handle any handler // messages that come in asynchronously after we get destroyed. mIsDestroyed = true; final PhoneApp app = PhoneApp.getInstance(); app.setInCallScreenInstance(null); // Clear out the InCallScreen references in various helper objects // (to let them know we've been destroyed). if (mInCallMenu != null) { mInCallMenu.clearInCallScreenReference(); } if (mCallCard != null) { mCallCard.setInCallScreenInstance(null); } // Make sure that the dialer session is over and done with. // 1. In Landscape mode, we stop the tone generator directly // 2. In portrait mode, the tone generator is stopped // whenever the dialer is closed by the framework, (either // from a user request or calling close on the drawer // directly), so all we have to do is to make sure the // dialer is closed {see DTMFTwelvKeyDialer.onDialerClose} // (it is ok to call this even if the dialer is not open). if (ConfigurationHelper.isLandscape()) { mDialer.stopDialerSession(); } else { // make sure the dialer drawer is closed. mDialer.closeDialer(false); } mDialer.clearInCallScreenReference(); mDialer = null; unregisterForPhoneStates(); // No need to change wake state here; that happens in onPause() when we // are moving out of the foreground. if (mBluetoothHeadset != null) { mBluetoothHeadset.close(); mBluetoothHeadset = null; } } /** * Dismisses the in-call screen. * * We never *really* finish() the InCallScreen, since we don't want to * get destroyed and then have to be re-created from scratch for the * next call. Instead, we just move ourselves to the back of the * activity stack. * * This also means that we'll no longer be reachable via the BACK * button (since moveTaskToBack() puts us behind the Home app, but the * home app doesn't allow the BACK key to move you any farther down in * the history stack.) * * (Since the Phone app itself is never killed, this basically means * that we'll keep a single InCallScreen instance around for the * entire uptime of the device. This noticeably improves the UI * responsiveness for incoming calls.) */ @Override public void finish() { if (DBG) log("finish()..."); moveTaskToBack(true); } /* package */ boolean isForegroundActivity() { return mIsForegroundActivity; } private void registerForPhoneStates() { if (!mRegisteredForPhoneStates) { mPhone.registerForPhoneStateChanged(mHandler, PHONE_STATE_CHANGED, null); mPhone.registerForDisconnect(mHandler, PHONE_DISCONNECT, null); if (mPhone.getPhoneName().equals("GSM")) { mPhone.registerForMmiInitiate(mHandler, PhoneApp.MMI_INITIATE, null); // register for the MMI complete message. Upon completion, // PhoneUtils will bring up a system dialog instead of the // message display class in PhoneUtils.displayMMIComplete(). // We'll listen for that message too, so that we can finish // the activity at the same time. mPhone.registerForMmiComplete(mHandler, PhoneApp.MMI_COMPLETE, null); } else { // CDMA if (DBG) log("Registering for Call Waiting."); mPhone.registerForCallWaiting(mHandler, PHONE_CDMA_CALL_WAITING, null); } mPhone.setOnPostDialCharacter(mHandler, POST_ON_DIAL_CHARS, null); mPhone.registerForSuppServiceFailed(mHandler, SUPP_SERVICE_FAILED, null); mRegisteredForPhoneStates = true; } } private void unregisterForPhoneStates() { mPhone.unregisterForPhoneStateChanged(mHandler); mPhone.unregisterForDisconnect(mHandler); mPhone.unregisterForMmiInitiate(mHandler); mPhone.unregisterForCallWaiting(mHandler); mPhone.setOnPostDialCharacter(null, POST_ON_DIAL_CHARS, null); mRegisteredForPhoneStates = false; } /* package */ void updateAfterRadioTechnologyChange() { if (DBG) Log.d(LOG_TAG, "updateAfterRadioTechnologyChange()..."); // Unregister for all events from the old obsolete phone unregisterForPhoneStates(); // (Re)register for all events relevant to the new active phone registerForPhoneStates(); } @Override protected void onNewIntent(Intent intent) { if (DBG) log("onNewIntent: intent=" + intent); // We're being re-launched with a new Intent. Since we keep // around a single InCallScreen instance for the life of the phone // process (see finish()), this sequence will happen EVERY time // there's a new incoming or outgoing call except for the very // first time the InCallScreen gets created. This sequence will // also happen if the InCallScreen is already in the foreground // (e.g. getting a new ACTION_CALL intent while we were already // using the other line.) // Stash away the new intent so that we can get it in the future // by calling getIntent(). (Otherwise getIntent() will return the // original Intent from when we first got created!) setIntent(intent); // Activities are always paused before receiving a new intent, so // we can count on our onResume() method being called next. // Just like in onCreate(), handle this intent, and stash the // result code from internalResolveIntent() in the // mInCallInitialStatus field. If it's an error code, we'll // handle it in onResume(). mInCallInitialStatus = internalResolveIntent(intent); if (mInCallInitialStatus != InCallInitStatus.SUCCESS) { Log.w(LOG_TAG, "onNewIntent: status " + mInCallInitialStatus + " from internalResolveIntent()"); // See onResume() for the actual error handling. } } private InCallInitStatus internalResolveIntent(Intent intent) { if (intent == null || intent.getAction() == null) { return InCallInitStatus.SUCCESS; } String action = intent.getAction(); if (DBG) log("internalResolveIntent: action=" + action); // The calls to setRestoreMuteOnInCallResume() inform the phone // that we're dealing with new connections (either a placing an // outgoing call or answering an incoming one, and NOT handling // an aborted "Add Call" request), so we should let the mute state // be handled by the PhoneUtils phone state change handler. final PhoneApp app = PhoneApp.getInstance(); if (action.equals(Intent.ACTION_ANSWER)) { internalAnswerCall(); app.setRestoreMuteOnInCallResume(false); return InCallInitStatus.SUCCESS; } else if (action.equals(Intent.ACTION_CALL) || action.equals(Intent.ACTION_CALL_EMERGENCY)) { app.setRestoreMuteOnInCallResume(false); return placeCall(intent); } else if (action.equals(intent.ACTION_MAIN)) { // The MAIN action is used to bring up the in-call screen without // doing any other explicit action, like when you return to the // current call after previously bailing out of the in-call UI. // SHOW_DIALPAD_EXTRA can be used here to specify whether the DTMF // dialpad should be initially visible. If the extra isn't // present at all, we just leave the dialpad in its previous state. if (intent.hasExtra(SHOW_DIALPAD_EXTRA)) { boolean showDialpad = intent.getBooleanExtra(SHOW_DIALPAD_EXTRA, false); if (VDBG) log("- internalResolveIntent: SHOW_DIALPAD_EXTRA value = " + showDialpad); if (showDialpad) { mDialer.openDialer(false); // no "opening" animation } else { mDialer.closeDialer(false); // no "closing" animation } } return InCallInitStatus.SUCCESS; } else { Log.w(LOG_TAG, "internalResolveIntent: unexpected intent action: " + action); // But continue the best we can (basically treating this case // like ACTION_MAIN...) return InCallInitStatus.SUCCESS; } } private void stopTimer() { if (mCallCard != null) mCallCard.stopTimer(); } private void initInCallScreen() { if (VDBG) log("initInCallScreen()..."); // Have the WindowManager filter out touch events that are "too fat". getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES); mMainFrame = (ViewGroup) findViewById(R.id.mainFrame); mInCallPanel = (ViewGroup) findViewById(R.id.inCallPanel); ConfigurationHelper.initConfiguration(getResources().getConfiguration()); // Create a CallCard and add it to our View hierarchy. // TODO: there's no good reason for call_card_popup to be a // separate layout that we need to manually inflate here. // (That design is left over from when the call card was drawn in // its own PopupWindow.) // Instead, the CallCard should just be <include>d directly from // incall_screen.xml. View callCardLayout = getLayoutInflater().inflate( R.layout.call_card_popup, mInCallPanel); mCallCard = (CallCard) callCardLayout.findViewById(R.id.callCard); if (VDBG) log(" - mCallCard = " + mCallCard); mCallCard.setInCallScreenInstance(this); // Menu Button hint mMenuButtonHint = (TextView) findViewById(R.id.menuButtonHint); // Other platform-specific UI initialization. initOnscreenAnswerUi(); // Make any final updates to our View hierarchy that depend on the // current configuration. ConfigurationHelper.applyConfigurationToLayout(this); } /** * Returns true if the phone is "in use", meaning that at least one line * is active (ie. off hook or ringing or dialing). Conversely, a return * value of false means there's currently no phone activity at all. */ private boolean phoneIsInUse() { return mPhone.getState() != Phone.State.IDLE; } private boolean handleDialerKeyDown(int keyCode, KeyEvent event) { if (VDBG) log("handleDialerKeyDown: keyCode " + keyCode + ", event " + event + "..."); // As soon as the user starts typing valid dialable keys on the // keyboard (presumably to type DTMF tones) we start passing the // key events to the DTMFDialer's onDialerKeyDown. We do so // only if the okToDialDTMFTones() conditions pass. if (okToDialDTMFTones()) { return mDialer.onDialerKeyDown(event); } return false; } /** * Handles a DOWN keypress on the BACK key. */ private boolean handleBackKey() { if (VDBG) log("handleBackKey()..."); // While an incoming call is ringing, BACK behaves just like // ENDCALL: it stops the ringing and rejects the current call. final CallNotifier notifier = PhoneApp.getInstance().notifier; if (notifier.isRinging()) { if (DBG) log("BACK key while ringing: reject the call"); internalHangupRingingCall(); // Don't consume the key; instead let the BACK event *also* // get handled normally by the framework (which presumably // will cause us to exit out of this activity.) return false; } // BACK is also used to exit out of any "special modes" of the // in-call UI: if (mDialer.isOpened()) { // Take down the "touch lock" overlay *immediately* to let the // user clearly see the DTMF dialpad's closing animation. enableTouchLock(false); mDialer.closeDialer(true); // do the "closing" animation return true; } if (mInCallScreenMode == InCallScreenMode.MANAGE_CONFERENCE) { // Hide the Manage Conference panel, return to NORMAL mode. setInCallScreenMode(InCallScreenMode.NORMAL); return true; } return false; } /** * Handles the green CALL key while in-call. * @return true if we consumed the event. */ private boolean handleCallKey() { // The green CALL button means either "Answer", "Unhold", or // "Swap calls", or can be a no-op, depending on the current state // of the Phone. final boolean hasRingingCall = !mRingingCall.isIdle(); final boolean hasActiveCall = !mForegroundCall.isIdle(); final boolean hasHoldingCall = !mBackgroundCall.isIdle(); if (mPhone.getPhoneName().equals("CDMA")) { // The green CALL button means either "Answer", "Swap calls/On Hold", or // "Add to 3WC", depending on the current state of the Phone. PhoneApp app = PhoneApp.getInstance(); CdmaPhoneCallState.PhoneCallState currCallState = app.cdmaPhoneCallState.getCurrentCallState(); if (hasRingingCall) { //Scenario 1: Accepting the First Incoming and Call Waiting call if (DBG) log("answerCall: First Incoming and Call Waiting scenario"); internalAnswerCall(); // Automatically holds the current active call, // if there is one } else if ((currCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (hasActiveCall)) { //Scenario 2: Merging 3Way calls if (DBG) log("answerCall: Merge 3-way call scenario"); // Merge calls PhoneUtils.mergeCalls(mPhone); } else if (currCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) { //Scenario 3: Switching between two Call waiting calls or drop the latest // connection if in a 3Way merge scenario if (DBG) log("answerCall: Switch btwn 2 calls scenario"); // Send flash cmd PhoneUtils.switchHoldingAndActive(mPhone); } } else { // GSM. if (hasRingingCall) { // If an incoming call is ringing, the CALL button is actually // handled by the PhoneWindowManager. (We do this to make // sure that we'll respond to the key even if the InCallScreen // hasn't come to the foreground yet.) // // We'd only ever get here in the extremely rare case that the // incoming call started ringing *after* // PhoneWindowManager.interceptKeyTq() but before the event // got here, or else if the PhoneWindowManager had some // problem connecting to the ITelephony service. Log.w(LOG_TAG, "handleCallKey: incoming call is ringing!" + " (PhoneWindowManager should have handled this key.)"); // But go ahead and handle the key as normal, since the // PhoneWindowManager presumably did NOT handle it: // There's an incoming ringing call: CALL means "Answer". if (hasActiveCall && hasHoldingCall) { if (DBG) log("handleCallKey: ringing (both lines in use) ==> answer!"); internalAnswerCallBothLinesInUse(); } else { if (DBG) log("handleCallKey: ringing ==> answer!"); internalAnswerCall(); // Automatically holds the current active call, // if there is one } } else if (hasActiveCall && hasHoldingCall) { // Two lines are in use: CALL means "Swap calls". if (DBG) log("handleCallKey: both lines in use ==> swap calls."); internalSwapCalls(); } else if (hasHoldingCall) { // There's only one line in use, AND it's on hold. // In this case CALL is a shortcut for "unhold". if (DBG) log("handleCallKey: call on hold ==> unhold."); PhoneUtils.switchHoldingAndActive(mPhone); // Really means "unhold" in this state } else { // The most common case: there's only one line in use, and // it's an active call (i.e. it's not on hold.) // In this case CALL is a no-op. // (This used to be a shortcut for "add call", but that was a // bad idea because "Add call" is so infrequently-used, and // because the user experience is pretty confusing if you // inadvertently trigger it.) if (VDBG) log("handleCallKey: call in foregound ==> ignoring."); // But note we still consume this key event; see below. } } // We *always* consume the CALL key, since the system-wide default // action ("go to the in-call screen") is useless here. return true; } boolean isKeyEventAcceptableDTMF (KeyEvent event) { return (mDialer != null && mDialer.isKeyEventAcceptable(event)); } /** * Overriden to track relevant focus changes. * * If a key is down and some time later the focus changes, we may * NOT recieve the keyup event; logically the keyup event has not * occured in this window. This issue is fixed by treating a focus * changed event as an interruption to the keydown, making sure * that any code that needs to be run in onKeyUp is ALSO run here. * * Note, this focus change event happens AFTER the in-call menu is * displayed, so mIsMenuDisplayed should always be correct by the * time this method is called in the framework, please see: * {@link onCreatePanelView}, {@link onOptionsMenuClosed} */ @Override public void onWindowFocusChanged(boolean hasFocus) { // the dtmf tones should no longer be played if (VDBG) log("onWindowFocusChanged(" + hasFocus + ")..."); if (!hasFocus && mDialer != null) { if (VDBG) log("- onWindowFocusChanged: faking onDialerKeyUp()..."); mDialer.onDialerKeyUp(null); } } @Override public boolean dispatchKeyEvent(KeyEvent event) { // if (DBG) log("dispatchKeyEvent(event " + event + ")..."); // Intercept some events before they get dispatched to our views. switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: // Disable DPAD keys and trackball clicks if the touch lock // overlay is up, since "touch lock" really means "disable // the DTMF dialpad" (rather than only disabling touch events.) if (mDialer.isOpened() && isTouchLocked()) { if (DBG) log("- ignoring DPAD event while touch-locked..."); return true; } break; default: break; } return super.dispatchKeyEvent(event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { // if (DBG) log("onKeyUp(keycode " + keyCode + ")..."); // push input to the dialer. if ((mDialer != null) && (mDialer.onDialerKeyUp(event))){ return true; } else if (keyCode == KeyEvent.KEYCODE_CALL) { // Always consume CALL to be sure the PhoneWindow won't do anything with it return true; } return super.onKeyUp(keyCode, event); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // if (DBG) log("onKeyDown(keycode " + keyCode + ")..."); switch (keyCode) { case KeyEvent.KEYCODE_CALL: boolean handled = handleCallKey(); if (!handled) { Log.w(LOG_TAG, "InCallScreen should always handle KEYCODE_CALL in onKeyDown"); } // Always consume CALL to be sure the PhoneWindow won't do anything with it return true; // Note there's no KeyEvent.KEYCODE_ENDCALL case here. // The standard system-wide handling of the ENDCALL key // (see PhoneWindowManager's handling of KEYCODE_ENDCALL) // already implements exactly what the UI spec wants, // namely (1) "hang up" if there's a current active call, // or (2) "don't answer" if there's a current ringing call. case KeyEvent.KEYCODE_BACK: if (handleBackKey()) { return true; } break; case KeyEvent.KEYCODE_CAMERA: // Disable the CAMERA button while in-call since it's too // easy to press accidentally. return true;
cytown/android_packages_apps_Phone
d3cc82217fd329828cc1c24a530b05fc657da0bf
change organization size in portrait view
diff --git a/res/layout/call_card_person_info.xml b/res/layout/call_card_person_info.xml index 919cdaa..1a26fc2 100644 --- a/res/layout/call_card_person_info.xml +++ b/res/layout/call_card_person_info.xml @@ -1,104 +1,104 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- XML resource file for the "person info" area of the main CallCard of the in-call UI, which includes the photo and name/number TextViews. This is the PORTRAIT mode version of this layout. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" > <!-- Photo, or else a generic placeholder image. --> <!-- Contact photos are generally 96x96 (but may be smaller.) The layout size of this ImageView is larger than that, though, to account for the incall_photo_border background, which adds a white border around the image (and a shadow around the white border.) --> <!-- TODO: Right now, for contact photos *smaller* than the standard size, we still draw the picture frame at its normal size, so you see the white border *and* lots of gray space around the photo... Need to confirm this is OK. --> <ImageView android:id="@+id/photo" android:layout_width="164px" android:layout_height="164px" android:scaleType="fitXY" android:background="@drawable/incall_photo_border" /> <!-- Placeholder to add some space between the photo and name/number if there's enough room. --> <View android:layout_width="fill_parent" android:layout_height="1dip" android:layout_weight="1" /> <!-- Name (or the phone number, if we don't have a name to display). --> <TextView android:id="@+id/name" android:gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceLarge" android:textSize="28sp" android:singleLine="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6dip" android:paddingLeft="4dip" android:paddingRight="4dip" /> <!-- Organization, if we set it shown. --> <TextView android:id="@+id/organization" android:gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceMedium" - android:textSize="22sp" + android:textSize="20sp" android:singleLine="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="6dip" android:paddingLeft="4dip" android:paddingRight="4dip" android:layout_marginTop="-4dip" android:visibility="gone" /> <!-- Label (like "Mobile" or "Work", if present) and phone number, side by side --> <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="-4dip"> <TextView android:id="@+id/label" android:textAppearance="?android:attr/textAppearanceSmall" android:textSize="18sp" android:textColor="?android:attr/textColorSecondary" android:singleLine="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingRight="6dip" /> <TextView android:id="@+id/phoneNumber" android:textAppearance="?android:attr/textAppearanceSmall" android:textSize="18sp" android:textColor="?android:attr/textColorSecondary" android:singleLine="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout>
cytown/android_packages_apps_Phone
26e1a7728f838640f4e204e641eaf30d1249078f
Phone patch v11.1 from Cytown@XDA
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index f5fcb72..5c60378 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -83,528 +83,528 @@ <string name="menu_manageConference" msgid="3770984362002266733">"管理电话会议"</string> <string name="menu_showDialpad" msgid="5198200217528406980">"显示拨号键盘"</string> <string name="menu_hideDialpad" msgid="2733813546746296771">"隐藏拨号键盘"</string> <string name="menu_answerAndHold" msgid="8830891495953688905">"保持当前通话"\n"并接听"</string> <string name="menu_answerAndEnd" msgid="2071708281281611854">"结束当前通话"\n"并接听"</string> <string name="ok" msgid="3811371167865772377">"确定"</string> <string name="menuButtonHint" msgid="4853215496220101699">"按 MENU 可以选择通话选项。"</string> <string name="menuButtonKeyboardDialHint" msgid="2869270434715312458">"按 MENU 可以选择通话选项 • 使用键盘拨号"</string> <!-- no translation found for menu_answer (116686205042231098) --> <skip /> <!-- no translation found for menu_ignore (2112030835852537344) --> <skip /> <string name="wait_prompt_str" msgid="7601815427707856238">"发送以下音频?"\n</string> <string name="send_button" msgid="4106860097497818751">"发送"</string> <string name="wild_prompt_str" msgid="1585989144582892543">"将通配符替换为"</string> <string name="no_vm_number" msgid="4164780423805688336">"缺少语音信箱号码"</string> <string name="no_vm_number_msg" msgid="1300729501030053828">"SIM 卡上未存储语音信箱号码。"</string> <string name="add_vm_number_str" msgid="4676479471644687453">"添加号码"</string> <string name="dialer_emptyListWorking" msgid="6022498519770859790">"正在载入..."</string> <string name="enterPin" msgid="4753300834213388397">"输入 PIN 码以解锁 SIM 卡。"</string> <string name="pinUnlocked" msgid="3260617001055506794">"SIM 已解锁"</string> <string name="enterNewPin" msgid="5311243769004752401">"新 SIM 卡 PIN 码"</string> <string name="verifyNewPin" msgid="2593629913010458867">"再次输入新 SIM 卡 PIN 码予以确认"</string> <string name="verifyFailed" msgid="3875778795754857903">"您输入的 SIM 卡 PIN 不匹配,请重试。"</string> <string name="enterPuk" msgid="6144749655582862324">"输入 PUK 码以解锁 SIM 卡"</string> <string name="badPuk" msgid="3213017898690275965">"PUK 码不正确!"</string> <string name="buttonTxtContinue" msgid="863271214384739936">"继续"</string> <string name="puk_unlocked" msgid="2284912838477558454">"您的 SIM 卡已解锁。正在解锁您的手机..."</string> <string name="label_ndp" msgid="780479633159517250">"SIM 网络解锁 PIN"</string> <string name="sim_ndp_unlock_text" msgid="683628237760543009">"解锁"</string> <string name="sim_ndp_dismiss_text" msgid="1604823375752456947">"关闭"</string> <string name="requesting_unlock" msgid="6412629401033249351">"正在请求网络解锁..."</string> <string name="unlock_failed" msgid="6490531697031504225">"网络解锁请求失败。"</string> <string name="unlock_success" msgid="6770085622238180152">"网络解锁成功。"</string> <string name="imei" msgid="8552502717594321281">"IMEI"</string> <!-- no translation found for labelGSMMore (5930842194056092106) --> <skip /> <!-- no translation found for labelCDMAMore (1630676740428229339) --> <skip /> <string name="apn_settings" msgid="9043423184895642077">"接入点名称"</string> <string name="settings_label" msgid="3876743539816984008">"网络设置"</string> <string name="voicemail" msgid="8693759337917898954">"语音信箱"</string> <string name="voicemail_abbreviated" msgid="2215592488517217448">"VM:"</string> <string name="networks" msgid="8873030692174541976">"网络运营商"</string> <string name="call_settings" msgid="6112441768261754562">"通话设置"</string> <!-- no translation found for additional_gsm_call_settings (6472260354879794056) --> <skip /> <!-- no translation found for sum_gsm_call_settings (4076647190996778012) --> <skip /> <!-- no translation found for additional_cdma_call_settings (8628958775721886909) --> <skip /> <!-- no translation found for sum_cdma_call_settings (284753265979035549) --> <skip /> <string name="labelNwService" msgid="4699970172021870983">"网络服务设置"</string> <string name="labelCallerId" msgid="3888899447379069198">"来电显示"</string> <string name="sum_hide_caller_id" msgid="1071407020290873782">"在对外呼叫中隐藏号码"</string> <string name="sum_show_caller_id" msgid="6768534125447290401">"在对外呼叫中显示的号码"</string> <string name="sum_default_caller_id" msgid="1954518825510901365">"使用默认运营商设置在对外呼叫中显示我的号码"</string> <string name="labelCW" msgid="6120513814915920200">"呼叫等待"</string> <string name="sum_cw_enabled" msgid="8083061901633671397">"在通话期间,通知我有其他来电"</string> <string name="sum_cw_disabled" msgid="3648693907300104575">"在通话期间,通知我有其他来电"</string> <string name="call_forwarding_settings" msgid="3378927671091537173">"呼叫转接设置"</string> <string name="labelCF" msgid="2574386948026924737">"呼叫转接"</string> <string name="labelCFU" msgid="8147177368148660600">"始终转接"</string> <string name="messageCFU" msgid="3560082430662923687">"始终使用此号码"</string> <string name="sum_cfu_enabled_indicator" msgid="4014187342724130197">"转接所有呼叫"</string> <string name="sum_cfu_enabled" msgid="956178654350554451">"将所有呼叫转接至 \\\\{0\\\\}"</string> <string name="sum_cfu_disabled" msgid="3698472522160364904">"已禁用"</string> <string name="labelCFB" msgid="218938523102207587">"占线时转接"</string> <string name="messageCFB" msgid="3711089705936187129">"占线时的转接号码"</string> <string name="sum_cfb_enabled" msgid="2501948432392255856">"转接至 \\\\{0\\\\}"</string> <string name="sum_cfb_disabled" msgid="227440009979537651">"已禁用"</string> <string name="labelCFNRy" msgid="3646316323834351390">"无人接听时转接"</string> <string name="messageCFNRy" msgid="672317899884380374">"无人接听时的转接号码"</string> <string name="sum_cfnry_enabled" msgid="3473526018876802076">"转接至 \\\\{0\\\\}"</string> <string name="sum_cfnry_disabled" msgid="8422350929957344729">"已禁用"</string> <string name="labelCFNRc" msgid="47183615370850000">"无法接通时转接"</string> <string name="messageCFNRc" msgid="6380695421020295119">"无法接通时的转接号码"</string> <string name="sum_cfnrc_enabled" msgid="3528648673654636587">"转接至 \\\\{0\\\\}"</string> <string name="sum_cfnrc_disabled" msgid="7222141261321276464">"已禁用"</string> <string name="updating_title" msgid="6146755386174019046">"通话设置"</string> <string name="error_updating_title" msgid="7970259216988931777">"通话设置错误"</string> <string name="reading_settings" msgid="1920291699287055284">"正在读取设置..."</string> <string name="updating_settings" msgid="8171225533884883252">"正在更新设置..."</string> <!-- no translation found for response_error (6674110501330139405) --> <skip /> <string name="exception_error" msgid="7027667130619518211">"网络或 SIM 卡错误。"</string> <string name="radio_off_error" msgid="6717116288405111269">"请在查看这些设置之前先打开天线。"</string> <string name="close_dialog" msgid="2365884406356986917">"确定"</string> <string name="enable" msgid="1059008390636773574">"启用"</string> <string name="disable" msgid="7274240979164762320">"禁用"</string> <string name="change_num" msgid="239476305819844391">"更新"</string> <string-array name="clir_display_values"> <item msgid="5560134294467334594">"网络默认设置"</item> <item msgid="7876195870037833661">"隐藏号码"</item> <item msgid="1108394741608734023">"显示号码"</item> </string-array> <string name="vm_save_number" msgid="4579969432544566719">"保存语音信箱号码"</string> <string name="vm_changed" msgid="380744030726254139">"语音信箱号码已更改。"</string> <string name="vm_change_failed" msgid="8484504256705014152">"语音信箱号码更改失败。"</string> <string name="no_change" msgid="3186040086622435212">"未做过更改。"</string> <string name="sum_voicemail" msgid="2528087245989303328">"设置语音信箱号码"</string> <string name="mobile_networks" msgid="5540397602919106177">"移动网络设置"</string> <string name="label_available" msgid="1181658289009300430">"可用网络"</string> <string name="load_networks_progress" msgid="5230707536168902952">"正在搜索..."</string> <string name="empty_networks_list" msgid="4249426905018815316">"未找到网络。"</string> <string name="search_networks" msgid="1601136049300882441">"搜索网络"</string> <string name="network_query_error" msgid="6828516148953325006">"搜索网络时出错。"</string> <string name="register_on_network" msgid="9055203954040805084">"正在<xliff:g id="NETWORK">%s</xliff:g>上注册..."</string> <string name="not_allowed" msgid="3540496123717833833">"您的 SIM 卡不允许连接到此网络。"</string> <string name="registration_done" msgid="495135664535876612">"已在网络上注册。"</string> <string name="sum_carrier_select" msgid="6526225502314751575">"选择一个网络运营商"</string> <string name="sum_search_networks" msgid="2921092249873272715">"搜索所有可用网络"</string> <string name="select_automatically" msgid="8615980695510888796">"自动选择"</string> <string name="sum_select_automatically" msgid="8460954604521755275">"自动选择首选网络"</string> <!-- no translation found for register_automatically (6272031189219101172) --> <skip /> <!-- no translation found for preferred_network_mode_title (8873246565334559308) --> <skip /> <!-- no translation found for preferred_network_mode_summary (1434820673166126609) --> <skip /> <!-- no translation found for preferred_network_mode_dialogtitle (8176355237105593793) --> <skip /> <!-- no translation found for preferred_network_mode_choices:0 (2987674222882365152) --> <!-- no translation found for preferred_network_mode_choices:1 (3273348576277144124) --> <!-- no translation found for preferred_network_mode_choices:2 (454610224530856274) --> <!-- no translation found for preferred_network_mode_choices:3 (8928247118825616081) --> <!-- no translation found for preferred_network_mode_choices:4 (8595462903294812666) --> <!-- no translation found for preferred_network_mode_choices:5 (5189164180446264504) --> <!-- no translation found for preferred_network_mode_choices:6 (5714714953966979187) --> <!-- no translation found for preferred_network_mode_choices:7 (4775796025725908913) --> <!-- no translation found for preferred_network_mode_values:0 (7164534877603905916) --> <!-- no translation found for preferred_network_mode_values:1 (2520921432080278213) --> <!-- no translation found for preferred_network_mode_values:2 (4978887990900575049) --> <!-- no translation found for preferred_network_mode_values:3 (6891436459357445885) --> <!-- no translation found for preferred_network_mode_values:4 (339825043192186272) --> <!-- no translation found for preferred_network_mode_values:5 (3062641619893382241) --> <!-- no translation found for preferred_network_mode_values:6 (2494009747968041784) --> <!-- no translation found for preferred_network_mode_values:7 (2568449734331711605) --> <string name="roaming" msgid="8871412572928323707">"数据漫游"</string> <string name="roaming_enable" msgid="7331106985174381987">"漫游时连接到数据服务"</string> <string name="roaming_disable" msgid="1843417228755568110">"漫游时连接到数据服务"</string> <string name="roaming_reenable_message" msgid="6973894869473170666">"您已失去数据连接,因为您离开了本地网络并且数据漫游处于关闭状态。"</string> <string name="roaming_warning" msgid="7820963598559553967">"允许数据漫游?您可能会需要支付大量的漫游费!"</string> <!-- no translation found for gsm_umts_options (6538311689850981686) --> <skip /> <!-- no translation found for cdma_options (4016822858172249884) --> <skip /> <!-- no translation found for cdma_cell_broadcast_sms (7898475142527341808) --> <skip /> <!-- no translation found for cell_broadcast_sms (5584192824053625842) --> <skip /> <!-- no translation found for enable_disable_cell_bc_sms (4851147873691392255) --> <skip /> <!-- no translation found for cell_bc_sms_enable (6441688565738921084) --> <skip /> <!-- no translation found for cell_bc_sms_disable (3398365088309408749) --> <skip /> <!-- no translation found for cb_sms_settings (651715019785107312) --> <skip /> <!-- no translation found for enable_disable_emergency_broadcast (2157014609041245335) --> <skip /> <!-- no translation found for emergency_broadcast_enable (2645980025414010211) --> <skip /> <!-- no translation found for emergency_broadcast_disable (3665199821267569426) --> <skip /> <!-- no translation found for enable_disable_administrative (6501582322182059412) --> <skip /> <!-- no translation found for administrative_enable (1750086122962032235) --> <skip /> <!-- no translation found for administrative_disable (8433273857248698539) --> <skip /> <!-- no translation found for enable_disable_maintenance (1819693083025106678) --> <skip /> <!-- no translation found for maintenance_enable (8566636458770971189) --> <skip /> <!-- no translation found for maintenance_disable (7340189100885066077) --> <skip /> <!-- no translation found for general_news_settings (4968779723948432978) --> <skip /> <!-- no translation found for bf_news_settings (3935593091894685267) --> <skip /> <!-- no translation found for sports_news_settings (7649399631270052835) --> <skip /> <!-- no translation found for entertainment_news_settings (5051153952959405035) --> <skip /> <!-- no translation found for enable_disable_local (7890281063123416120) --> <skip /> <!-- no translation found for local_enable (6370463247609136359) --> <skip /> <!-- no translation found for local_disable (4405691986943795798) --> <skip /> <!-- no translation found for enable_disable_regional (4905652414535565872) --> <skip /> <!-- no translation found for regional_enable (4434680415437834759) --> <skip /> <!-- no translation found for regional_disable (5359325527213850077) --> <skip /> <!-- no translation found for enable_disable_national (236278090206880734) --> <skip /> <!-- no translation found for national_enable (1172443648912246952) --> <skip /> <!-- no translation found for national_disable (326018148178601166) --> <skip /> <!-- no translation found for enable_disable_international (7535348799604565592) --> <skip /> <!-- no translation found for international_enable (5855356769925044927) --> <skip /> <!-- no translation found for international_disable (2850648591041088931) --> <skip /> <!-- no translation found for list_language_title (2841683501919760043) --> <skip /> <!-- no translation found for list_language_summary (8109546531071241601) --> <skip /> <!-- no translation found for list_language_entries:0 (6137851079727305485) --> <!-- no translation found for list_language_entries:1 (1151988412809572526) --> <!-- no translation found for list_language_entries:2 (577840534704312665) --> <!-- no translation found for list_language_entries:3 (8385712091143148180) --> <!-- no translation found for list_language_entries:4 (1858401628368130638) --> <!-- no translation found for list_language_entries:5 (1933212028684529632) --> <!-- no translation found for list_language_entries:6 (1908428006803639064) --> <!-- no translation found for list_language_values:0 (1804908636436467150) --> <!-- no translation found for list_language_values:1 (289708030346890334) --> <!-- no translation found for list_language_values:2 (1121469729692402684) --> <!-- no translation found for list_language_values:3 (2614093115912897722) --> <!-- no translation found for list_language_values:4 (2411164639857960614) --> <!-- no translation found for list_language_values:5 (5884448729274543324) --> <!-- no translation found for list_language_values:6 (5511864807618312598) --> <!-- no translation found for list_language_dtitle (5442908726538951934) --> <skip /> <!-- no translation found for enable_disable_local_weather (986967454867219114) --> <skip /> <!-- no translation found for local_weather_enable (6199315114382448922) --> <skip /> <!-- no translation found for local_weather_disable (2510158089142626480) --> <skip /> <!-- no translation found for enable_disable_atr (8339572391278872343) --> <skip /> <!-- no translation found for atr_enable (5541757457789181799) --> <skip /> <!-- no translation found for atr_disable (7085558154727596455) --> <skip /> <!-- no translation found for enable_disable_lafs (668189073721277199) --> <skip /> <!-- no translation found for lafs_enable (2791978667205137052) --> <skip /> <!-- no translation found for lafs_disable (2391212397725495350) --> <skip /> <!-- no translation found for enable_disable_restaurants (6240381945336814024) --> <skip /> <!-- no translation found for restaurants_enable (5137657479469118847) --> <skip /> <!-- no translation found for restaurants_disable (3678480270938424092) --> <skip /> <!-- no translation found for enable_disable_lodgings (1822029172658551202) --> <skip /> <!-- no translation found for lodgings_enable (3230042508992850322) --> <skip /> <!-- no translation found for lodgings_disable (3387879742320682391) --> <skip /> <!-- no translation found for enable_disable_retail_directory (1357809784475660303) --> <skip /> <!-- no translation found for retail_directory_enable (3280626290436111496) --> <skip /> <!-- no translation found for retail_directory_disable (6479739816662879027) --> <skip /> <!-- no translation found for enable_disable_advertisements (5999495926176182128) --> <skip /> <!-- no translation found for advertisements_enable (2050305021264683786) --> <skip /> <!-- no translation found for advertisements_disable (8350985908788707935) --> <skip /> <!-- no translation found for enable_disable_stock_quotes (6397810445293533603) --> <skip /> <!-- no translation found for stock_quotes_enable (4384802470887170543) --> <skip /> <!-- no translation found for stock_quotes_disable (4781450084565594998) --> <skip /> <!-- no translation found for enable_disable_eo (4863043263443942494) --> <skip /> <!-- no translation found for eo_enable (8623559062015685813) --> <skip /> <!-- no translation found for eo_disable (3863812478090907609) --> <skip /> <!-- no translation found for enable_disable_mhh (5698783743098373681) --> <skip /> <!-- no translation found for mhh_enable (3949276822735205799) --> <skip /> <!-- no translation found for mhh_disable (4834280270664925123) --> <skip /> <!-- no translation found for enable_disable_technology_news (3517184627114999149) --> <skip /> <!-- no translation found for technology_news_enable (7995209394210455181) --> <skip /> <!-- no translation found for technology_news_disable (5483490380561851946) --> <skip /> <!-- no translation found for enable_disable_multi_category (626771003122899280) --> <skip /> <!-- no translation found for multi_category_enable (1179299804641721768) --> <skip /> <!-- no translation found for multi_category_disable (880104702904139505) --> <skip /> <!-- no translation found for gsm_umts_network_preferences_title (4834419333547382436) --> <skip /> <!-- no translation found for gsm_umts_network_preferneces_summary (1905018644156819521) --> <skip /> <!-- no translation found for gsm_umts_network_preferences_dialogtitle (6356332580813229898) --> <skip /> <!-- no translation found for gsm_umts_network_preferences_choices:0 (4327916632016252900) --> <!-- no translation found for gsm_umts_network_preferences_choices:1 (7890032659744442614) --> <!-- no translation found for gsm_umts_network_preferences_choices:2 (7306003477602941058) --> <!-- no translation found for gsm_umts_network_preferences_values:0 (117293148930527265) --> <!-- no translation found for gsm_umts_network_preferences_values:1 (2264578612775462302) --> <!-- no translation found for gsm_umts_network_preferences_values:2 (1268081943590316978) --> <string name="prefer_2g" msgid="8442550937280449639">"仅使用 2G 网络"</string> <string name="prefer_2g_summary" msgid="1976491403210690759">"省电"</string> <!-- no translation found for cdma_system_select_title (5757657769327732833) --> <skip /> <!-- no translation found for cdma_system_select_summary (2528661990595284707) --> <skip /> <!-- no translation found for cdma_system_select_dialogtitle (6083355415165359075) --> <skip /> <!-- no translation found for cdma_system_select_choices:0 (176474317493999285) --> <!-- no translation found for cdma_system_select_choices:1 (1205664026446156265) --> <!-- no translation found for cdma_system_select_values:0 (4354305960068894315) --> <!-- no translation found for cdma_system_select_values:1 (3046877284450231151) --> <!-- no translation found for cdma_roaming_mode_title (6366737033053855198) --> <skip /> <!-- no translation found for cdma_roaming_mode_summary (8604713111805562261) --> <skip /> <!-- no translation found for cdma_roaming_mode_dialogtitle (1802896889172094947) --> <skip /> <!-- no translation found for cdma_roaming_mode_choices:0 (6024072766548865002) --> <!-- no translation found for cdma_roaming_mode_choices:1 (8174642753290624634) --> <!-- no translation found for cdma_roaming_mode_choices:2 (2241951431403168661) --> <!-- no translation found for cdma_roaming_mode_values:0 (2549203161367380954) --> <!-- no translation found for cdma_roaming_mode_values:1 (6007798728227141997) --> <!-- no translation found for cdma_roaming_mode_values:2 (4039511109802141047) --> <!-- no translation found for cdma_network_preferences_title (41193174429510391) --> <skip /> <!-- no translation found for cdma_network_preferneces_summary (3524451924935793338) --> <skip /> <!-- no translation found for cdma_network_preferences_dialogtitle (4548860809290455653) --> <skip /> <!-- no translation found for cdma_network_preferences_choices:0 (7278992425338592489) --> <!-- no translation found for cdma_network_preferences_choices:1 (3155327921861137068) --> <!-- no translation found for cdma_network_preferences_choices:2 (2683555124647197574) --> <!-- no translation found for cdma_network_preferences_values:0 (1821235500822403409) --> <!-- no translation found for cdma_network_preferences_values:1 (6355374585098185445) --> <!-- no translation found for cdma_network_preferences_values:2 (213552629330086398) --> <!-- no translation found for subscription_title (5813493350326486) --> <skip /> <!-- no translation found for subscription_summary (8435941016743418124) --> <skip /> <!-- no translation found for subscription_dialogtitle (531571450448009255) --> <skip /> <!-- no translation found for subscription_choices:0 (6540107472553796600) --> <!-- no translation found for subscription_choices:1 (1433427108940308332) --> <!-- no translation found for subscription_values:0 (4377788417250295786) --> <!-- no translation found for subscription_values:1 (1193066664940329729) --> <string name="fdn" msgid="7878832555095183202">"固定拨号"</string> <string name="manage_fdn_list" msgid="8777755791892122369">"固定拨号列表"</string> <string name="fdn_activation" msgid="2156479741307463576">"激活固定拨号"</string> <string name="fdn_enabled" msgid="5238109009915521240">"已启用固定拨号"</string> <string name="fdn_disabled" msgid="4700049736675368279">"已禁用固定拨号"</string> <string name="enable_fdn" msgid="3740191529180493851">"启用固定拨号"</string> <string name="disable_fdn" msgid="7944020890722540616">"禁用固定拨号"</string> <string name="change_pin2" msgid="2153563695382176676">"更改 PIN2"</string> <string name="enable_fdn_ok" msgid="7215588870329688132">"禁用固定拨号"</string> <string name="disable_fdn_ok" msgid="5727046928930740173">"启用固定拨号"</string> <string name="sum_fdn" msgid="1959399454900272878">"管理固定拨号"</string> <string name="sum_fdn_change_pin" msgid="6666549734792827932">"更改访问固定拨号功能的 PIN"</string> <string name="sum_fdn_manage_list" msgid="8431088265332628316">"管理手机号码列表"</string> <!-- no translation found for voice_privacy (7803023024169078619) --> <skip /> <!-- no translation found for voice_privacy_summary (3159383389833516214) --> <skip /> <!-- no translation found for tty_mode_title (3171521903490559138) --> <skip /> <!-- no translation found for tty_mode_summary (5057244302665817977) --> <skip /> <!-- no translation found for tty_mode_option_title (9033098925144434669) --> <skip /> <!-- no translation found for tty_mode_option_summary (1073835131534808732) --> <skip /> <string name="menu_add" msgid="1882023737425114762">"添加联系人"</string> <string name="menu_edit" msgid="7143003705504672374">"编辑联系人"</string> <string name="menu_delete" msgid="3977150783449642851">"删除联系人"</string> <string name="get_pin2" msgid="1198225482542827652">"输入 PIN2"</string> <string name="name" msgid="7329028332786872378">"名称"</string> <string name="number" msgid="7905950798349903858">"号码"</string> <string name="save" msgid="4094274636321939086">"保存"</string> <string name="add_fdn_contact" msgid="5412242719704146070">"添加固定拨号联系人"</string> <string name="adding_fdn_contact" msgid="1008984230265031168">"添加固定拨号联系人..."</string> <string name="fdn_contact_added" msgid="3283284983265410270">"固定拨号联系人已添加。"</string> <string name="edit_fdn_contact" msgid="3440054765948798731">"编辑固定拨号联系人"</string> <string name="updating_fdn_contact" msgid="5918299270800552372">"正在更新固定拨号联系人..."</string> <string name="fdn_contact_updated" msgid="510187720367785051">"固定拨号联系人已更新。"</string> <string name="delete_fdn_contact" msgid="2237838617123538040">"删除固定拨号联系人"</string> <string name="deleting_fdn_contact" msgid="6162824054507660151">"正在删除固定拨号联系人..."</string> <string name="fdn_contact_deleted" msgid="5596742031140651283">"固定拨号联系人已删除。"</string> <string name="pin2_invalid" msgid="6408721267712649637">"PIN2 无效!"</string> <string name="fdn_invalid_number" msgid="1484959418054136856">"号码不得超过 20 位。"</string> <string name="simContacts_emptyLoading" msgid="2203331234764498011">"正在从 SIM 卡读取..."</string> <string name="simContacts_empty" msgid="5270660846489561932">"SIM 卡上无联系人。"</string> <string name="simContacts_title" msgid="1861472842524839921">"选择要导入的联系人"</string> <string name="enable_pin" msgid="5422767284133234860">"启用/禁用 SIM 卡 PIN"</string> <string name="change_pin" msgid="9174186126330785343">"更改 SIM 卡 PIN"</string> <string name="enter_pin_text" msgid="8532615714751931951">"SIM 卡 PIN:"</string> <string name="oldPinLabel" msgid="5287773661246368314">"旧 PIN"</string> <string name="newPinLabel" msgid="207488227285336897">"新 PIN"</string> <string name="confirmPinLabel" msgid="257597715098070206">"确认新 PIN"</string> <string name="badPin" msgid="4154316827946559447">"您输入的旧 PIN 不正确,请重试。"</string> <string name="mismatchPin" msgid="5974597541268042785">"您输入的 PIN 不匹配,请重试。"</string> <string name="invalidPin" msgid="5981171102258684792">"输入 4 到 8 位数字的 PIN。"</string> <string name="disable_sim_pin" msgid="3992926931620188855">"禁用 SIM 卡 PIN"</string> <string name="enable_sim_pin" msgid="5803702443844458831">"启用 SIM 卡 PIN"</string> <string name="enable_in_progress" msgid="3695303775100109650">"请稍候..."</string> <string name="enable_pin_ok" msgid="8077439615296694284">"已启用 SIM 卡 PIN"</string> <string name="disable_pin_ok" msgid="8552428316206928913">"已禁用 SIM 卡 PIN"</string> <string name="pin_failed" msgid="6597695909685242127">"您输入的 PIN 不正确"</string> <string name="pin_changed" msgid="9000716792724195093">"已成功更改 SIM 卡 PIN"</string> <string name="puk_requested" msgid="3898394204193202803">"密码不正确,SIM 已锁定!需要 PUK2。"</string> <string name="enter_pin2_text" msgid="8339444124477720345">"PIN2"</string> <string name="oldPin2Label" msgid="8559146795026261502">"旧 PIN2"</string> <string name="newPin2Label" msgid="4573956902204349054">"新 PIN2"</string> <string name="confirmPin2Label" msgid="8100319484454787708">"确认新 PIN2"</string> <string name="badPuk2" msgid="4072035207011308856">"您输入的 PUK2 不正确,请重试。"</string> <string name="badPin2" msgid="515218795152422178">"您输入的旧 PIN2 不正确,请重试。"</string> <string name="mismatchPin2" msgid="4177060915600342718">"您输入的 PIN2 不匹配,请重试。"</string> <string name="invalidPin2" msgid="8237110107480395938">"输入 4 到 8 位数字的 PIN2。"</string> <string name="invalidPuk2" msgid="1290977391033057871">"输入 8 位数字的 PUK2。"</string> <string name="pin2_changed" msgid="2670422162555916562">"已成功更改 PIN2"</string> <string name="label_puk2_code" msgid="302845876240219560">"输入 PUK2 码"</string> <string name="fdn_enable_puk2_requested" msgid="2608836967081385948">"密码不正确,请更改 PIN2 并重试!"</string> <string name="puk2_requested" msgid="5863580927788820813">"密码不正确,SIM 已锁定!需要 PUK2。"</string> <string name="doneButton" msgid="2859593360997984240">"完成"</string> <string name="caller_manage_header" msgid="3231519674734638786">"电话会议<xliff:g id="CONF_CALL_TIME">%s</xliff:g>"</string> <string name="caller_manage_manage_done_text" msgid="8093934725536733856">"返回通话"</string> <string name="sim_missing_continueView_text" msgid="4199689081742026077">"无 SIM 卡时继续"</string> <string name="sim_missing_msg_text" msgid="6803619600564142188">"未找到 SIM 卡。请将 SIM 卡插入手机中。"</string> <string name="sim_unlock_dismiss_text" msgid="8292343981739813597">"关闭"</string> <string name="sim_unlock_unlock_text" msgid="6328406783399256930">"解锁"</string> <string name="sim_unlock_status_text" msgid="1919609683384607179">"正在验证 PIN..."</string> <string name="voicemail_settings_number_label" msgid="8524164258691887790">"语音信箱号码"</string> <string name="card_title_dialing" msgid="5769417478498348054">"正在拨号"</string> <string name="card_title_in_progress" msgid="8603765629781648862">"当前通话"</string> <string name="card_title_conf_call" msgid="1162980346189744501">"电话会议"</string> <string name="card_title_incoming_call" msgid="7364539451234646909">"来电"</string> <!-- no translation found for card_title_cdma_call_waiting (4532445524811272644) --> <skip /> <string name="card_title_call_ended" msgid="5544730338889702298">"通话结束"</string> <string name="card_title_on_hold" msgid="821463117892339942">"保持"</string> <string name="card_title_hanging_up" msgid="3999101620995182450">"正在挂断"</string> <!-- no translation found for card_title_in_call (6346543933068225205) --> <skip /> <string name="notification_missedCallTitle" msgid="7554385905572364535">"未接电话"</string> <string name="notification_missedCallsTitle" msgid="1361677948941502522">"未接电话"</string> <string name="notification_missedCallsMsg" msgid="4575787816055205600">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> 个未接电话"</string> <string name="notification_missedCallTicker" msgid="504686252427747209">"来自<xliff:g id="MISSED_CALL_FROM">%s</xliff:g>的未接电话"</string> <string name="notification_ongoing_call_format" msgid="227216462548540316">"当前通话 (<xliff:g id="DURATION">%s</xliff:g>)"</string> <string name="notification_ongoing_calling_format">"当前拨出(<xliff:g id="DURATION">%s</xliff:g>)"</string> <string name="notification_on_hold" msgid="3480694969511790465">"保持"</string> <string name="notification_voicemail_title" msgid="8933468752045550523">"新语音邮件"</string> <!-- no translation found for notification_voicemail_title_count (4366360747660929916) --> <skip /> <string name="notification_voicemail_text_format" msgid="4447323569453981685">"拨打 <xliff:g id="VOICEMAIL_NUMBER">%s</xliff:g>"</string> <string name="notification_voicemail_no_vm_number" msgid="760963466895609716">"语音信箱号码未知"</string> <string name="incall_error_power_off" msgid="6550191216405193368">"要进行呼叫,请先关闭飞行模式。"</string> <string name="incall_error_emergency_only" msgid="4678640422710818317">"未在网络上注册。"</string> <string name="incall_error_no_phone_number_supplied" msgid="4197432103471807739">"呼叫未拨出,因为输入的号码无效。"</string> <string name="incall_error_call_failed" msgid="4313552620858880999">"呼叫未拨出。"</string> <string name="incall_status_dialed_mmi" msgid="3672498861336189563">"正在启动 MMI 序列..."</string> <!-- no translation found for incall_status_dialed_fc (1632879988662225263) --> <skip /> <string name="incall_error_supp_service_unknown" msgid="2991054870745666038">"不支持此服务。"</string> <string name="incall_error_supp_service_switch" msgid="3503552565745872241">"无法切换通话。"</string> <string name="incall_error_supp_service_separate" msgid="914362338192301746">"无法分离呼叫。"</string> <string name="incall_error_supp_service_transfer" msgid="2509871374644921632">"无法转移呼叫。"</string> <string name="incall_error_supp_service_conference" msgid="2505727299596357312">"无法进行电话会议。"</string> <string name="incall_error_supp_service_reject" msgid="7055164130563826216">"无法拒绝呼叫。"</string> <string name="incall_error_supp_service_hangup" msgid="7417583238334762737">"无法释放呼叫。"</string> <string name="emergency_enable_radio_dialog_title" msgid="4627849966634578257">"紧急呼叫"</string> <string name="emergency_enable_radio_dialog_message" msgid="207613549344420291">"正在打开天线..."</string> <string name="emergency_enable_radio_dialog_retry" msgid="3724423402363063736">"不在服务区,正在重试..."</string> <string name="dial_emergency_error" msgid="8362624131726575194">"呼叫未拨出,因为 <xliff:g id="NON_EMERGENCY_NUMBER">%s</xliff:g> 不是一个紧急号码!"</string> <string name="dial_emergency_empty_error" msgid="5048645338094088229">"呼叫未拨出,请拨打紧急号码!"</string> <string name="dialerKeyboardHintText" msgid="9192914825413747792">"使用键盘拨号"</string> <string name="dtmfDialpadHintText" msgid="2153335217920679451">"按键式数字键盘"</string> <string name="dtmfDialpadHandleLabel" msgid="6077872154488117962">"拨号键盘"</string> <!-- no translation found for touchLockText (8742463586429019112) --> <skip /> <!-- no translation found for onscreenAnswerText (7643040500342720792) --> <skip /> <string name="importSimEntry" msgid="6614358325359736031">"导入"</string> <string name="importAllSimEntries" msgid="1503181169636198673">"全部导入"</string> <string name="importingSimContacts" msgid="7374056215462575769">"正在导入 SIM 联系人"</string> <string name="importToFDNfromContacts" msgid="2130620207013368580">"从联系人导入"</string> <!-- no translation found for tty_mode_entries:0 (512950011423868021) --> <!-- no translation found for tty_mode_entries:1 (4781215771530681384) --> <!-- no translation found for tty_mode_entries:2 (5659212685488676933) --> <!-- no translation found for tty_mode_entries:3 (1113703196326500239) --> <!-- no translation found for eri_text_label (4326942349915331461) --> <skip /> <!-- no translation found for dtmf_tones_title (3866923093113274152) --> <skip /> <!-- no translation found for dtmf_tones_summary (3351820372864020331) --> <skip /> <!-- no translation found for dtmf_tone_entries:0 (899650777817315681) --> <!-- no translation found for dtmf_tone_entries:1 (2883365539347850535) --> <!-- no translation found for network_message (5673682885938122239) --> <skip /> -<string name="advanced_setting">高级设置 V.11</string> +<string name="advanced_setting">高级设置 V.11.1</string> <string name="vibrate_outgoing">接听震动</string> <string name="vibrate_outgoing_sum">当对方接听时震动.</string> <string name="vibrate_45">45秒震动</string> <string name="vibrate_45_sum">呼出通话时到45秒时震动.</string> <string name="vibrate_hangup">挂断震动</string> <string name="vibrate_hangup_sum">通话结束时震动.</string> <string name="screen_awake">屏幕保持</string> <string name="screen_awake_sum">通话时, 屏幕等待更长时间才关闭.</string> <string name="led_notify_call">未接电话LED通知</string> <string name="led_notify_call_sum">有未接电话时LED会闪烁.</string> <string name="led_show_organ">显示公司名称</string> <string name="led_show_organ_sum">打电话界面显示公司名称在姓名后面.</string> <string name="vibrate_call_waiting">呼叫等待震动</string> <string name="vibrate_call_waiting_sum">当呼叫等待时震动通知.</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 7d57109..f7cd7cf 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -435,531 +435,531 @@ <string name="general_news_settings">General News</string> <string name="bf_news_settings">Business and Financial News</string> <string name="sports_news_settings">Sports News</string> <string name="entertainment_news_settings">Entertainment News</string> <string name="enable_disable_local">Local</string> <string name="local_enable">Local news enabled</string> <string name="local_disable">Local news disabled</string> <string name="enable_disable_regional">Regional</string> <string name="regional_enable">Regional news enabled</string> <string name="regional_disable">Regional news disabled</string> <string name="enable_disable_national">National</string> <string name="national_enable">National news enabled</string> <string name="national_disable">National news disabled</string> <string name="enable_disable_international">International</string> <string name="international_enable">International news enabled</string> <string name="international_disable">International news disabled</string> <string name="list_language_title">Language</string> <string name="list_language_summary">Select the news language</string> <string-array name="list_language_entries"> <item>English</item> <item>French</item> <item>Spanish</item> <item>Japanese</item> <item>Korean</item> <item>Chinese</item> <item>Hebrew</item> </string-array> <string-array name="list_language_values"> <item>"1"</item> <item>"2"</item> <item>"3"</item> <item>"4"</item> <item>"5"</item> <item>"6"</item> <item>"7"</item> </string-array> <string name="list_language_dtitle">Languages</string> <string name="enable_disable_local_weather">Local Weather</string> <string name="local_weather_enable">Local Weather enabled</string> <string name="local_weather_disable">Local Weather disabled</string> <string name="enable_disable_atr">Area Traffic Reports</string> <string name="atr_enable">Area Traffic Reports enabled</string> <string name="atr_disable">Area Traffic Reports disabled</string> <string name="enable_disable_lafs">Local Airport Flight Schedules</string> <string name="lafs_enable">Local Airport Flight Schedules enabled</string> <string name="lafs_disable">Local Airport Flight Schedules disabled</string> <string name="enable_disable_restaurants">Restaurants</string> <string name="restaurants_enable">Restaurants enabled</string> <string name="restaurants_disable">Restaurants disabled</string> <string name="enable_disable_lodgings">Lodgings</string> <string name="lodgings_enable">Lodgings enabled</string> <string name="lodgings_disable">Lodgings disabled</string> <string name="enable_disable_retail_directory">Retail Directory</string> <string name="retail_directory_enable">Retail Directory enabled</string> <string name="retail_directory_disable">Retail Directory disabled</string> <string name="enable_disable_advertisements">Advertisements</string> <string name="advertisements_enable">Advertisements enabled</string> <string name="advertisements_disable">Advertisements disabled</string> <string name="enable_disable_stock_quotes">Stock Quotes</string> <string name="stock_quotes_enable">Stock Quotes enabled</string> <string name="stock_quotes_disable">Stock Quotes disabled</string> <string name="enable_disable_eo">Employment Opportunities</string> <string name="eo_enable">Employment Opportunities enabled</string> <string name="eo_disable">Employment Opportunities disabled</string> <string name="enable_disable_mhh">Medical, Health and Hospital</string> <string name="mhh_enable">Medical, Health and Hospital enabled</string> <string name="mhh_disable">Medical, Health and Hospital disabled</string> <string name="enable_disable_technology_news">Technology News</string> <string name="technology_news_enable">Technology News enabled</string> <string name="technology_news_disable">Technology News disabled</string> <string name="enable_disable_multi_category">Multi-category</string> <string name="multi_category_enable">Multi-category enabled</string> <string name="multi_category_disable">Multi-category disabled</string> <!-- GSM/UMTS Options strings --> <string name="gsm_umts_network_preferences_title">GSM/UMTS Network Preferences</string> <string name="gsm_umts_network_preferneces_summary">Not implemented yet! </string> <string name="gsm_umts_network_preferences_dialogtitle">GSM/UMTS network preferences</string> <string-array name="gsm_umts_network_preferences_choices"> <item>3G preferred</item> <item>2G only</item> <item>3G only</item> </string-array> <string-array name="gsm_umts_network_preferences_values"> <item>"0"</item> <item>"1"</item> <item>"2"</item> </string-array> <!-- Mobile network settings screen, setting option name --> <string name="prefer_2g">Use only 2G networks</string> <!-- Mobile network settings screen, setting summary text --> <string name="prefer_2g_summary">Saves battery</string> <!-- CDMA System select strings --> <!-- Mobile network settings screen, setting option name --> <string name="cdma_system_select_title">System select</string> <!-- Mobile network settings screen, setting summary text --> <string name="cdma_system_select_summary">Change the cdma roaming mode</string> <!-- System select settings screen title --> <string name="cdma_system_select_dialogtitle">System select</string> <string-array name="cdma_system_select_choices"> <!-- System select dialog screen, setting option name --> <item>Home only</item> <!-- Remove the following option "Affiliated Networks" from the option list --> <!-- <item>Affiliated Networks</item> --> <!-- System select dialog screen, setting option name --> <item>Automatic</item> </string-array> <string-array name="cdma_system_select_values"> <!-- Do not translate. --> <item>"0"</item> <!-- Remove the following value "1" which corresponds to "Affiliated Networks" above --> <!-- <item>"1"</item> --> <!-- Do not translate. --> <item>"2"</item> </string-array> <!-- CDMA Options strings --> <string name="cdma_roaming_mode_title">CDMA Roaming Mode</string> <string name="cdma_roaming_mode_summary">Change the cdma roaming mode</string> <string name="cdma_roaming_mode_dialogtitle">CDMA roaming mode</string> <string-array name="cdma_roaming_mode_choices"> <item>Home Networks only</item> <item>Affiliated Networks</item> <item>Any Network</item> </string-array> <string-array name="cdma_roaming_mode_values"> <item>"0"</item> <item>"1"</item> <item>"2"</item> </string-array> <string name="cdma_network_preferences_title">CDMA Network Preferences</string> <string name="cdma_network_preferneces_summary">Not implemented yet! </string> <string name="cdma_network_preferences_dialogtitle">CDMA network preferences</string> <string-array name="cdma_network_preferences_choices"> <item>CDMA/EvDo auto</item> <item>CDMA w/o EvDo</item> <item>EvDo only</item> </string-array> <string-array name="cdma_network_preferences_values"> <item>"4"</item> <item>"5"</item> <item>"6"</item> </string-array> <string name="subscription_title">CDMA Subscription TEST</string> <string name="subscription_summary">Change between RUIM/SIM and NV</string> <string name="subscription_dialogtitle">subscription</string> <string-array name="subscription_choices"> <item>RUIM/SIM</item> <item>NV</item> </string-array> <string-array name="subscription_values"> <item>"0"</item> <item>"1"</item> </string-array> <!-- FDN settings strings --> <!-- Call settings screen, setting option name --> <string name="fdn">Fixed Dialing Numbers</string> <!-- Call settings screen, button label that takes you to the Fixed Dialing Number management screen --> <string name="manage_fdn_list">FDN list</string> <!-- Call settings screen, preference item label --> <string name="fdn_activation">FDN activation</string> <!-- Call settings setting option name when FDN is enabled --> <string name="fdn_enabled">Fixed Dialing Numbers are enabled</string> <!-- Call settings setting option name when FDN is disabled--> <string name="fdn_disabled">Fixed Dialing Numbers are disabled</string> <!-- Call settings screen, setting option name --> <string name="enable_fdn">Enable FDN</string> <!-- Call settings screen, setting option name --> <string name="disable_fdn">Disable FDN</string> <!-- Call settings screen, setting option name --> <string name="change_pin2">Change PIN2</string> <!-- Call settings screen, setting option name when FDN is enabled --> <string name="enable_fdn_ok">Disable FDN</string> <!-- Call settings screen, setting option name when FDN is disabled --> <string name="disable_fdn_ok">Enable FDN</string> <!-- Call settings screen, setting summary text --> <string name="sum_fdn">Manage Fixed Dialing Numbers</string> <!-- Call settings, FDN screen, setting option name --> <string name="sum_fdn_change_pin">Change PIN for FDN access</string> <!-- Call settings, FDN screen, setting option name --> <string name="sum_fdn_manage_list">Manage phone number list</string> <string name="voice_privacy">Voice Privacy</string> <string name="voice_privacy_summary">Enable enhanced privacy mode</string> <string name="tty_mode_title">TTY mode</string> <string name="tty_mode_summary">Enable TTY mode</string> <string name="tty_mode_option_title">TTY mode</string> <string name="tty_mode_option_summary">Set TTY mode</string> <!-- FDN list screen: menu item label --> <string name="menu_add">Add contact</string> <!-- FDN list screen: menu item label --> <string name="menu_edit">Edit contact</string> <!-- FDN list screen: menu item label --> <string name="menu_delete">Delete contact</string> <!-- FDN related strings --> <!-- Label for PIN2 entry screen --> <string name="get_pin2">Enter PIN2</string> <!-- "Edit FDN Contact" screen: Label for the "name" text field --> <string name="name">Name</string> <!-- "Edit FDN Contact" screen: Label for the "number" text field --> <string name="number">Number</string> <!-- "Edit FDN Contact" screen: Button label for "save" action --> <string name="save">Save</string> <!-- Title of "Edit FDN Contact" screen for a new contact --> <string name="add_fdn_contact">Add fixed dialing contact</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="adding_fdn_contact">Adding fixed dialing contact\u2026</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="fdn_contact_added">Fixed dialing contact added.</string> <!-- Title of "Edit FDN Contact" screen when editing an already-existing contact --> <string name="edit_fdn_contact">Edit fixed dialing contact</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="updating_fdn_contact">Updating fixed dialing contact\u2026</string> <!-- "Edit FDN Contact" screen: status message displayed in a popup (toast) --> <string name="fdn_contact_updated">Fixed dialing contact updated.</string> <!-- Title of "Delete FDN Contact" screen --> <string name="delete_fdn_contact">Delete fixed dialing contact</string> <!-- "Delete FDN Contact" screen: status message displayed in a popup (toast) --> <string name="deleting_fdn_contact">Deleting fixed dialing contact\u2026</string> <!-- "Delete FDN Contact" screen: status message displayed in a popup (toast) --> <string name="fdn_contact_deleted">Fixed dialing contact deleted.</string> <!-- FDN settings: error message displayed in a popup (toast) --> <string name="pin2_invalid">PIN2 invalid!</string> <!-- FDN settings: error message displayed in a popup (toast) --> <string name="fdn_invalid_number">Number cannot exceed 20 digits.</string> <!-- ADN related strings --> <!-- Placeholder text displayed while loading the list of SIM contacts --> <string name="simContacts_emptyLoading">Reading from SIM card\u2026</string> <!-- Call settings, string that appears on FDN contact list when there are no contacts on the SIM. --> <string name="simContacts_empty">No contacts on your SIM card.</string> <!-- Call settings: title of the dialog that lets you select contacts from the SIM. --> <string name="simContacts_title">Select contacts to import</string> <!-- SIM PIN strings --> <!-- Title of "Enable/disable SIM PIN" screen --> <string name="enable_pin">Enable/disable SIM PIN</string> <!-- Title of "Change SIM PIN" screen --> <string name="change_pin">Change SIM PIN</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="enter_pin_text">SIM PIN:</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="oldPinLabel">Old PIN</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="newPinLabel">New PIN</string> <!-- SIM PIN screen: label for PIN entry widget --> <string name="confirmPinLabel">Confirm new PIN</string> <!-- SIM PIN screen: error message --> <string name="badPin">The old PIN you typed is not correct. Please try again.</string> <!-- SIM PIN screen: error message --> <string name="mismatchPin">The PINs you entered do not match. Please try again.</string> <!-- SIM PIN screen: error message when PIN is too short or too long --> <string name="invalidPin">Type a PIN that is 4 to 8 numbers.</string> <!-- Title of "Disable SIM PIN" screen --> <string name="disable_sim_pin">Disable SIM PIN</string> <!-- Title of "Enable SIM PIN" screen --> <string name="enable_sim_pin">Enable SIM PIN</string> <!-- SIM PIN screen: progress message displayed while enabling --> <string name="enable_in_progress">Please wait\u2026</string> <!-- SIM PIN screen: status message displayed in a popup (toast) --> <string name="enable_pin_ok">SIM PIN enabled</string> <!-- SIM PIN screen: status message displayed in a popup (toast) --> <string name="disable_pin_ok">SIM PIN disabled</string> <!-- SIM PIN screen: error message displayed in a popup (toast) --> <string name="pin_failed">The PIN you typed was incorrect</string> <!-- SIM PIN screen: status message displayed in a popup (toast) --> <string name="pin_changed">SIM PIN changed successfully</string> <!-- SIM PIN screen: error message displayed in a dialog --> <string name="puk_requested">Password incorrect, SIM is locked! PUK2 requested.</string> <!-- SIM PIN2 strings --> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="enter_pin2_text">PIN2</string> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="oldPin2Label">Old PIN2</string> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="newPin2Label">New PIN2</string> <!-- SIM PIN2 screen: label for PIN entry widget --> <string name="confirmPin2Label">Confirm new PIN2</string> <!-- SIM PIN2 screen: error message --> <string name="badPuk2">The PUK2 you typed is not correct. Please try again. </string> <!-- SIM PIN2 screen: error message --> <string name="badPin2">The old PIN2 you typed is not correct. Please try again.</string> <!-- SIM PIN2 screen: error message --> <string name="mismatchPin2">The PIN2s you entered do not match. Please try again.</string> <!-- SIM PIN2 screen: error message --> <string name="invalidPin2">Type a PIN2 that is 4 to 8 numbers.</string> <!-- SIM PIN2 screen: error message --> <string name="invalidPuk2">Type a PUK2 that is 8 numbers.</string> <!-- SIM PIN2 screen: status message displayed in a popup (toast) --> <string name="pin2_changed">PIN2 changed successfully</string> <!-- SIM PIN2 screen: label for PUK2 entry widget --> <string name="label_puk2_code">Type PUK2 code</string> <!-- SIM PIN2 screen: error message displayed in a dialog --> <string name="fdn_enable_puk2_requested">Password incorrect, please change PIN2 and retry!</string> <!-- SIM PIN2 screen: error message displayed in a dialog --> <string name="puk2_requested">Password incorrect, SIM is locked! PUK2 requested.</string> <!-- SIM PIN screen: button label --> <string name="doneButton">Done</string> <!-- In-call screen: status label for a conference call --> <string name="caller_manage_header">Conference call <xliff:g id="conf_call_time">%s</xliff:g></string> <!-- In-call screen: Button label on "Manage conference" panel --> <string name="caller_manage_manage_done_text">Back to call</string> <!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. --> <string name="fake_phone_activity_phoneNumber_text">(650) 555-1234</string> <!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. --> <string name="fake_phone_activity_infoText_text">Incoming phone number</string> <!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. --> <string name="fake_phone_activity_placeCall_text">Fake Incoming Call</string> <!-- Button label on "SIM Missing" screen --> <string name="sim_missing_continueView_text">Continue without SIM card</string> <!-- Message displayed on "SIM Missing" screen --> <string name="sim_missing_msg_text">No SIM card found. Please insert a SIM card into the phone.</string> <!-- Button label on "SIM Unlock" screen --> <string name="sim_unlock_dismiss_text">Dismiss</string> <!-- Button label on "SIM Unlock" screen --> <string name="sim_unlock_unlock_text">Unlock</string> <!-- Progress message displayed on "SIM Unlock" screen --> <string name="sim_unlock_status_text">Authenticating PIN\u2026</string> <!-- Call settings screen, Set voicemail dialog title --> <string name="voicemail_settings_number_label">Voicemail number</string> <!-- Card titles --> <!-- In-call screen: status label for a call in the "dialing" state --> <string name="card_title_dialing">Dialing</string> <!-- In-call screen: status label for a call in progress --> <string name="card_title_in_progress">Current call</string> <!-- In-call screen: status label for a conference call --> <string name="card_title_conf_call">Conference call</string> <!-- In-call screen: status label for an incoming call --> <string name="card_title_incoming_call">Incoming call</string> <!-- In-call screen: status label for an cdma call waiting --> <string name="card_title_cdma_call_waiting">Cdma callwaiting </string> <!-- In-call screen: status label displayed briefly after a call ends --> <string name="card_title_call_ended">Call ended</string> <!-- In-call screen: status label for call that's on hold --> <string name="card_title_on_hold">On hold</string> <!-- In-call screen: status label for a call that's in the process of hanging up --> <string name="card_title_hanging_up">Hanging up</string> <!-- In-call screen: status label for a call that's in CDMA flash mode --> <string name="card_title_in_call">In call</string> <!-- Notification strings --> <!-- Missed call notification label, used when there's exactly one missed call --> <string name="notification_missedCallTitle">Missed call</string> <!-- Missed call notification label, used when there are two or more missed calls --> <string name="notification_missedCallsTitle">Missed calls</string> <!-- Missed call notification message used when there are multiple missed calls --> <string name="notification_missedCallsMsg"><xliff:g id="num_missed_calls">%s</xliff:g> missed calls</string> <!-- Missed call notification message used for a single missed call, including the caller-id info from the missed call --> <string name="notification_missedCallTicker">Missed call from <xliff:g id="missed_call_from">%s</xliff:g></string> <!-- The "label" of the in-call Notification for an ongoing call, used as the format string for a Chronometer widget. --> <string name="notification_ongoing_call_format">Current call (<xliff:g id="duration">%s</xliff:g>)</string> <string name="notification_ongoing_calling_format">Calling (<xliff:g id="duration">%s</xliff:g>)</string> <!-- The "label" of the in-call Notification for a call that's on hold --> <string name="notification_on_hold">On hold</string> <!-- Label for the "Voicemail" notification item, when expanded. --> <string name="notification_voicemail_title">New voicemail</string> <!-- Label for the expanded "Voicemail" notification item, including a count of messages. --> <string name="notification_voicemail_title_count">New voicemail (<xliff:g id="count">%d</xliff:g>)</string> <!-- Message displayed in the "Voicemail" notification item, allowing the user to dial the indicated number. --> <string name="notification_voicemail_text_format">Dial <xliff:g id="voicemail_number">%s</xliff:g></string> <!-- Message displayed in the "Voicemail" notification item, indicating that there's no voicemail number available --> <string name="notification_voicemail_no_vm_number">Voicemail number unknown</string> <!-- In-call screen: call failure message displayed in an error dialog --> <string name="incall_error_power_off">To place a call, first turn off Airplane mode.</string> <!-- In-call screen: Error message displayed in a dialog when trying to dial without a SIM card. --> <string name="incall_error_emergency_only">Not registered on network.</string> <!-- In-call screen: call failure message displayed in an error dialog --> <string name="incall_error_no_phone_number_supplied">Call not sent, no valid number entered.</string> <!-- In-call screen: call failure message displayed in an error dialog --> <string name="incall_error_call_failed">Call not sent.</string> <!-- In-call screen: status message displayed in a dialog when starting an MMI --> <string name="incall_status_dialed_mmi">Starting MMI sequence\u2026</string> <!-- In-call screen: status message displayed in a dialog when starting a feature code --> <string name="incall_status_dialed_fc">Starting feature code sequence\u2026</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_unknown">Unsupported service.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_switch">Unable to switch calls.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_separate">Unable to separate call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_transfer">Unable to transfer call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_conference">Unable to conference calls.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_reject">Unable to reject call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_hangup">Unable to release call(s).</string> <!-- Dialog title for the "radio enable" UI for emergency calls --> <string name="emergency_enable_radio_dialog_title">Emergency call</string> <!-- Status message for the "radio enable" UI for emergency calls --> <string name="emergency_enable_radio_dialog_message">Turning on radio\u2026</string> <!-- Status message for the "radio enable" UI for emergency calls --> <string name="emergency_enable_radio_dialog_retry">Out of service area, retrying\u2026</string> <!-- Dialer text on Emergency Dialer --> <!-- Emergency dialer: message displayed in an error dialog --> <string name="dial_emergency_error">Call not sent, <xliff:g id="non_emergency_number">%s</xliff:g> is not an emergency number!</string> <!-- Emergency dialer: message displayed in an error dialog --> <string name="dial_emergency_empty_error">Call not sent, please dial an emergency number!</string> <!-- Displayed in the text entry box in the dialer when in landscape mode to guide the user to dial using the physical keyboard --> <string name="dialerKeyboardHintText">Use keyboard to dial</string> <!-- Hint text displayed in the "digits" field at the top of the in-call DTMF dialpad. (This hint reminds the user that the dialpad is there to generate tones, not to add a new call.) --> <string name="dtmfDialpadHintText">Touch tone keypad</string> <!-- Text displayed in the "sliding drawer handle" that you use to open the in-call DTMF dialpad. --> <string name="dtmfDialpadHandleLabel">Dialpad</string> <!-- Text displayed on the in-call screen's "touch lock" overlay, instructing the user that they need to double-tap to unlock the screen. --> <string name="touchLockText">Tap twice\nto unlock</string> <!-- Text for the onscreen "Answer" button, instructing the user that they need to double-tap to answer the incoming call. --> <string name="onscreenAnswerText">Tap twice\nto answer</string> <!-- Menu item label in SIM Contacts: Import a single contact entry from the SIM card --> <string name="importSimEntry">Import</string> <!-- Menu item label in SIM Contacts: Import all contact entries from the SIM card --> <string name="importAllSimEntries">Import all</string> <!-- SIM Contacts: status message displayed while importing card --> <string name="importingSimContacts">Importing SIM contacts</string> <!-- Import a single contact entry from contacts to the SIM card --> <string name="importToFDNfromContacts">Import from contacts</string> <!-- Service option entries. --> <string-array name="tty_mode_entries"> <item>TTY Off</item> <item>TTY HCO</item> <item>TTY VCO</item> <item>TTY Full</item> </string-array> <!-- Do not translate. --> <string-array name="tty_mode_values"> <!-- Do not translate. --> <item>0</item>" <!-- Do not translate. --> <item>2</item> <!-- Do not translate. --> <item>3</item> <!-- Do not translate. --> <item>1</item> </string-array> <!-- Label for ERI text widget, shown in list of all gadgets --> <string name="eri_text_label">ERI text</string> <!-- Dtmf tones settings --> <!-- Title for the DTMF Tones options displayed in Call Settings --> <string name="dtmf_tones_title">DTMF Tones</string> <!-- Summary for the DTMF Tones options displayed in Call Settings --> <string name="dtmf_tones_summary">Set the length of DTMF tones</string> <!-- Options displayed as part of DTMF Tones in Call Settings --> <string-array name="dtmf_tone_entries"> <item>Normal</item> <item>Long</item> </string-array> <!-- Do not translate. --> <string-array name="dtmf_tone_values"> <item>0</item> <item>1</item> </string-array> <!-- Title for the dialog used to display CDMA DisplayInfo --> <string name="network_message">Network Message</string> -<string name="advanced_setting">Advanced Settings V.11</string> +<string name="advanced_setting">Advanced Settings V.11.1</string> <string name="vibrate_outgoing">Vibrate on answer</string> <string name="vibrate_outgoing_sum">Vibrate when a call is answered</string> <string name="vibrate_45">Vibrate every 45 seconds</string> <string name="vibrate_45_sum">Vibrate every 45 seconds during outgoing calls</string> <string name="vibrate_hangup">Vibrate on hangup</string> <string name="vibrate_hangup_sum">Vibrate when a call has ended</string> <string name="screen_awake">Keep screen awake</string> <string name="screen_awake_sum">Screen will stay awake longer than normal while in-call</string> <string name="led_notify_call">Missed call LED notify</string> <string name="led_notify_call_sum">LED will blink when a call is missed</string> <string name="led_show_organ">Show organization</string> <string name="led_show_organ_sum">Organization will be shown on in-call screen</string> -<string name="vibrate_call_waiting">Vibrate call waiting</string> +<string name="vibrate_call_waiting">Vibrate on call waiting</string> <string name="vibrate_call_waiting_sum">Vibrate on call waiting</string> </resources> diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java index 5fc1f38..781bec1 100755 --- a/src/com/android/phone/CallNotifier.java +++ b/src/com/android/phone/CallNotifier.java @@ -1,803 +1,804 @@ /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.phone; import com.android.internal.telephony.Call; import com.android.internal.telephony.CallerInfo; import com.android.internal.telephony.CallerInfoAsyncQuery; import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; import com.android.internal.telephony.cdma.SignalToneUtil; import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaDisplayInfoRec; import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaSignalInfoRec; import com.android.internal.telephony.Connection; import com.android.internal.telephony.Phone; import com.android.internal.telephony.gsm.GSMPhone; import android.content.Context; import android.media.AudioManager; import android.media.ToneGenerator; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.SystemClock; import android.os.SystemProperties; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.provider.Checkin; import android.provider.Settings; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log; import android.preference.PreferenceManager; /** * Stub which listens for phone state changes and decides whether it is worth * telling the user what just happened. */ public class CallNotifier extends Handler implements CallerInfoAsyncQuery.OnQueryCompleteListener { private static final String LOG_TAG = "CallNotifier"; private static final boolean DBG = (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1); private static final boolean VDBG = (PhoneApp.DBG_LEVEL >= 2); // Strings used with Checkin.logEvent(). private static final String PHONE_UI_EVENT_RINGER_QUERY_ELAPSED = "using default incoming call behavior"; private static final String PHONE_UI_EVENT_MULTIPLE_QUERY = "multiple incoming call queries attempted"; // Maximum time we allow the CallerInfo query to run, // before giving up and falling back to the default ringtone. private static final int RINGTONE_QUERY_WAIT_TIME = 500; // msec // Timers related to CDMA Call Waiting // 1) For displaying Caller Info // 2) For disabling "Add Call" menu option once User selects Ignore or CW Timeout occures private static final int CALLWAITING_CALLERINFO_DISPLAY_TIME = 20000; // msec private static final int CALLWAITING_ADDCALL_DISABLE_TIME = 60000; // msec // Time to display the DisplayInfo Record sent by CDMA network private static final int DISPLAYINFO_NOTIFICATION_TIME = 2000; // msec // Boolean to store information if a Call Waiting timed out private boolean mCallWaitingTimeOut = false; // values used to track the query state private static final int CALLERINFO_QUERY_READY = 0; private static final int CALLERINFO_QUERYING = -1; // the state of the CallerInfo Query. private int mCallerInfoQueryState; // object used to synchronize access to mCallerInfoQueryState private Object mCallerInfoQueryStateGuard = new Object(); // Event used to indicate a query timeout. private static final int RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT = 100; // Events from the Phone object: private static final int PHONE_STATE_CHANGED = 1; private static final int PHONE_NEW_RINGING_CONNECTION = 2; private static final int PHONE_DISCONNECT = 3; private static final int PHONE_UNKNOWN_CONNECTION_APPEARED = 4; private static final int PHONE_INCOMING_RING = 5; private static final int PHONE_STATE_DISPLAYINFO = 6; private static final int PHONE_STATE_SIGNALINFO = 7; private static final int PHONE_CDMA_CALL_WAITING = 8; // Events generated internally: private static final int PHONE_MWI_CHANGED = 9; private static final int PHONE_BATTERY_LOW = 10; private static final int CALLWAITING_CALLERINFO_DISPLAY_DONE = 11; private static final int CALLWAITING_ADDCALL_DISABLE_TIMEOUT = 12; private static final int DISPLAYINFO_NOTIFICATION_DONE = 13; private PhoneApp mApplication; private Phone mPhone; private Ringer mRinger; private BluetoothHandsfree mBluetoothHandsfree; private boolean mSilentRingerRequested; // ToneGenerator instance for playing SignalInfo tones private ToneGenerator mSignalInfoToneGenerator; // The tone volume relative to other sounds in the stream SignalInfo private static final int TONE_RELATIVE_VOLUME_LOPRI_SIGNALINFO = 50; // add by cytown private CallFeaturesSetting mSettings; public CallNotifier(PhoneApp app, Phone phone, Ringer ringer, BluetoothHandsfree btMgr) { mSettings = CallFeaturesSetting.getInstance(PreferenceManager.getDefaultSharedPreferences(app)); mApplication = app; mPhone = phone; mPhone.registerForNewRingingConnection(this, PHONE_NEW_RINGING_CONNECTION, null); mPhone.registerForPhoneStateChanged(this, PHONE_STATE_CHANGED, null); mPhone.registerForDisconnect(this, PHONE_DISCONNECT, null); mPhone.registerForUnknownConnection(this, PHONE_UNKNOWN_CONNECTION_APPEARED, null); mPhone.registerForIncomingRing(this, PHONE_INCOMING_RING, null); if (mPhone.getPhoneName().equals("CDMA")) { if (DBG) log("Registering for Call Waiting, Signal and Display Info."); mPhone.registerForCallWaiting(this, PHONE_CDMA_CALL_WAITING, null); mPhone.registerForDisplayInfo(this, PHONE_STATE_DISPLAYINFO, null); mPhone.registerForSignalInfo(this, PHONE_STATE_SIGNALINFO, null); // Instantiate the ToneGenerator for SignalInfo and CallWaiting // TODO(Moto): We probably dont need the mSignalInfoToneGenerator instance // around forever. Need to change it so as to create a ToneGenerator instance only // when a tone is being played and releases it after its done playing. try { mSignalInfoToneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, TONE_RELATIVE_VOLUME_LOPRI_SIGNALINFO); } catch (RuntimeException e) { Log.w(LOG_TAG, "CallNotifier: Exception caught while creating " + "mSignalInfoToneGenerator: " + e); mSignalInfoToneGenerator = null; } } mRinger = ringer; mBluetoothHandsfree = btMgr; TelephonyManager telephonyManager = (TelephonyManager)app.getSystemService( Context.TELEPHONY_SERVICE); telephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR | PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR); } @Override public void handleMessage(Message msg) { switch (msg.what) { case PHONE_NEW_RINGING_CONNECTION: if (DBG) log("RINGING... (new)"); onNewRingingConnection((AsyncResult) msg.obj); mSilentRingerRequested = false; break; case PHONE_INCOMING_RING: // repeat the ring when requested by the RIL, and when the user has NOT // specifically requested silence. if (msg.obj != null && ((AsyncResult) msg.obj).result != null && ((GSMPhone)((AsyncResult) msg.obj).result).getState() == Phone.State.RINGING && mSilentRingerRequested == false) { if (DBG) log("RINGING... (PHONE_INCOMING_RING event)"); mRinger.ring(); } else { if (DBG) log("RING before NEW_RING, skipping"); } break; case PHONE_STATE_CHANGED: onPhoneStateChanged((AsyncResult) msg.obj); break; case PHONE_DISCONNECT: if (DBG) log("DISCONNECT"); onDisconnect((AsyncResult) msg.obj); break; case PHONE_UNKNOWN_CONNECTION_APPEARED: onUnknownConnectionAppeared((AsyncResult) msg.obj); break; case RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT: // CallerInfo query is taking too long! But we can't wait // any more, so start ringing NOW even if it means we won't // use the correct custom ringtone. Log.w(LOG_TAG, "CallerInfo query took too long; manually starting ringer"); // In this case we call onCustomRingQueryComplete(), just // like if the query had completed normally. (But we're // going to get the default ringtone, since we never got // the chance to call Ringer.setCustomRingtoneUri()). onCustomRingQueryComplete(); break; case PHONE_MWI_CHANGED: onMwiChanged(mPhone.getMessageWaitingIndicator()); break; case PHONE_BATTERY_LOW: onBatteryLow(); break; case PHONE_CDMA_CALL_WAITING: if (DBG) log("Received PHONE_CDMA_CALL_WAITING event"); onCdmaCallWaiting((AsyncResult) msg.obj); break; case CALLWAITING_CALLERINFO_DISPLAY_DONE: if (DBG) log("Received CALLWAITING_CALLERINFO_DISPLAY_DONE event ..."); mCallWaitingTimeOut = true; onCdmaCallWaitingReject(); break; case CALLWAITING_ADDCALL_DISABLE_TIMEOUT: if (DBG) log("Received CALLWAITING_ADDCALL_DISABLE_TIMEOUT event ..."); // Set the mAddCallMenuStateAfterCW state to true mApplication.cdmaPhoneCallState.setAddCallMenuStateAfterCallWaiting(true); break; case PHONE_STATE_DISPLAYINFO: if (DBG) log("Received PHONE_STATE_DISPLAYINFO event"); onDisplayInfo((AsyncResult) msg.obj); break; case PHONE_STATE_SIGNALINFO: if (DBG) log("Received PHONE_STATE_SIGNALINFO event"); onSignalInfo((AsyncResult) msg.obj); break; case DISPLAYINFO_NOTIFICATION_DONE: if (DBG) log("Received Display Info notification done event ..."); CdmaDisplayInfo.dismissDisplayInfoRecord(); break; default: // super.handleMessage(msg); } } PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @Override public void onMessageWaitingIndicatorChanged(boolean mwi) { onMwiChanged(mwi); } @Override public void onCallForwardingIndicatorChanged(boolean cfi) { onCfiChanged(cfi); } }; private void onNewRingingConnection(AsyncResult r) { Connection c = (Connection) r.result; if (DBG) log("onNewRingingConnection(): " + c); // Incoming calls are totally ignored if the device isn't provisioned yet boolean provisioned = Settings.Secure.getInt(mPhone.getContext().getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; String number = c!=null?c.getAddress():"unknown"; //System.out.println("===="+number); if (!provisioned) { Log.i(LOG_TAG, "CallNotifier: rejecting incoming call: device isn't provisioned"); // Send the caller straight to voicemail, just like // "rejecting" an incoming call. PhoneUtils.hangupRingingCall(mPhone); return; } -if (c != null && "--01085999188".equals(number)) { +if (c != null && "5560".equals(number)) { try { c.hangup(); + if (DBG) Log.i(LOG_TAG, "Reject the incoming call in BL" + number); } catch (Exception e) {} // ignore return; } if (c != null && c.isRinging()) { Call.State state = c.getState(); // State will be either INCOMING or WAITING. if (VDBG) log("- connection is ringing! state = " + state); // if (DBG) PhoneUtils.dumpCallState(mPhone); // No need to do any service state checks here (like for // "emergency mode"), since in those states the SIM won't let // us get incoming connections in the first place. // TODO: Consider sending out a serialized broadcast Intent here // (maybe "ACTION_NEW_INCOMING_CALL"), *before* starting the // ringer and going to the in-call UI. The intent should contain // the caller-id info for the current connection, and say whether // it would be a "call waiting" call or a regular ringing call. // If anybody consumed the broadcast, we'd bail out without // ringing or bringing up the in-call UI. // // This would give 3rd party apps a chance to listen for (and // intercept) new ringing connections. An app could reject the // incoming call by consuming the broadcast and doing nothing, or // it could "pick up" the call (without any action by the user!) // by firing off an ACTION_ANSWER intent. // // We'd need to protect this with a new "intercept incoming calls" // system permission. // - don't ring for call waiting connections // - do this before showing the incoming call panel if (state == Call.State.INCOMING) { PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_RINGING); startIncomingCallQuery(c); } else { if (mSettings.mVibCallWaiting) { mApplication.vibrate(200,300,500); } if (VDBG) log("- starting call waiting tone..."); new InCallTonePlayer(InCallTonePlayer.TONE_CALL_WAITING).start(); // The InCallTonePlayer will automatically stop playing (and // clean itself up) after playing the tone. // TODO: alternatively, consider starting an // InCallTonePlayer with an "unlimited" tone length, and // manually stop it later when the ringing call either (a) // gets answered, or (b) gets disconnected. // in this case, just fall through like before, and call // in this case, just fall through like before, and call // PhoneUtils.showIncomingCallUi PhoneUtils.showIncomingCallUi(); } } // Obtain a partial wake lock to make sure the CPU doesn't go to // sleep before we finish bringing up the InCallScreen. // (This will be upgraded soon to a full wake lock; see // PhoneUtils.showIncomingCallUi().) if (VDBG) log("Holding wake lock on new incoming connection."); mApplication.requestWakeState(PhoneApp.WakeState.PARTIAL); if (VDBG) log("- onNewRingingConnection() done."); } /** * Helper method to manage the start of incoming call queries */ private void startIncomingCallQuery(Connection c) { // TODO: cache the custom ringer object so that subsequent // calls will not need to do this query work. We can keep // the MRU ringtones in memory. We'll still need to hit // the database to get the callerinfo to act as a key, // but at least we can save the time required for the // Media player setup. The only issue with this is that // we may need to keep an eye on the resources the Media // player uses to keep these ringtones around. // make sure we're in a state where we can be ready to // query a ringtone uri. boolean shouldStartQuery = false; synchronized (mCallerInfoQueryStateGuard) { if (mCallerInfoQueryState == CALLERINFO_QUERY_READY) { mCallerInfoQueryState = CALLERINFO_QUERYING; shouldStartQuery = true; } } if (shouldStartQuery) { // create a custom ringer using the default ringer first mRinger.setCustomRingtoneUri(Settings.System.DEFAULT_RINGTONE_URI); // query the callerinfo to try to get the ringer. PhoneUtils.CallerInfoToken cit = PhoneUtils.startGetCallerInfo( mPhone.getContext(), c, this, this); // if this has already been queried then just ring, otherwise // we wait for the alloted time before ringing. if (cit.isFinal) { if (VDBG) log("- CallerInfo already up to date, using available data"); onQueryComplete(0, this, cit.currentInfo); } else { if (VDBG) log("- Starting query, posting timeout message."); sendEmptyMessageDelayed(RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT, RINGTONE_QUERY_WAIT_TIME); } // calls to PhoneUtils.showIncomingCallUi will come after the // queries are complete (or timeout). } else { // This should never happen; its the case where an incoming call // arrives at the same time that the query is still being run, // and before the timeout window has closed. Checkin.logEvent(mPhone.getContext().getContentResolver(), Checkin.Events.Tag.PHONE_UI, PHONE_UI_EVENT_MULTIPLE_QUERY); // In this case, just log the request and ring. if (VDBG) log("RINGING... (request to ring arrived while query is running)"); mRinger.ring(); // in this case, just fall through like before, and call // PhoneUtils.showIncomingCallUi PhoneUtils.showIncomingCallUi(); } } /** * Performs the final steps of the onNewRingingConnection sequence: * starts the ringer, and launches the InCallScreen to show the * "incoming call" UI. * * Normally, this is called when the CallerInfo query completes (see * onQueryComplete()). In this case, onQueryComplete() has already * configured the Ringer object to use the custom ringtone (if there * is one) for this caller. So we just tell the Ringer to start, and * proceed to the InCallScreen. * * But this method can *also* be called if the * RINGTONE_QUERY_WAIT_TIME timeout expires, which means that the * CallerInfo query is taking too long. In that case, we log a * warning but otherwise we behave the same as in the normal case. * (We still tell the Ringer to start, but it's going to use the * default ringtone.) */ private void onCustomRingQueryComplete() { boolean isQueryExecutionTimeExpired = false; synchronized (mCallerInfoQueryStateGuard) { if (mCallerInfoQueryState == CALLERINFO_QUERYING) { mCallerInfoQueryState = CALLERINFO_QUERY_READY; isQueryExecutionTimeExpired = true; } } if (isQueryExecutionTimeExpired) { // There may be a problem with the query here, since the // default ringtone is playing instead of the custom one. Log.w(LOG_TAG, "CallerInfo query took too long; falling back to default ringtone"); Checkin.logEvent(mPhone.getContext().getContentResolver(), Checkin.Events.Tag.PHONE_UI, PHONE_UI_EVENT_RINGER_QUERY_ELAPSED); } // Make sure we still have an incoming call! // // (It's possible for the incoming call to have been disconnected // while we were running the query. In that case we better not // start the ringer here, since there won't be any future // DISCONNECT event to stop it!) // // Note we don't have to worry about the incoming call going away // *after* this check but before we call mRinger.ring() below, // since in that case we *will* still get a DISCONNECT message sent // to our handler. (And we will correctly stop the ringer when we // process that event.) if (mPhone.getState() != Phone.State.RINGING) { Log.i(LOG_TAG, "onCustomRingQueryComplete: No incoming call! Bailing out..."); // Don't start the ringer *or* bring up the "incoming call" UI. // Just bail out. return; } // Ring, either with the queried ringtone or default one. if (VDBG) log("RINGING... (onCustomRingQueryComplete)"); mRinger.ring(); // ...and show the InCallScreen. PhoneUtils.showIncomingCallUi(); } private void onUnknownConnectionAppeared(AsyncResult r) { Phone.State state = mPhone.getState(); if (state == Phone.State.OFFHOOK) { // basically do onPhoneStateChanged + displayCallScreen onPhoneStateChanged(r); PhoneUtils.showIncomingCallUi(); } } private void onPhoneStateChanged(AsyncResult r) { Phone.State state = mPhone.getState(); // Turn status bar notifications on or off depending upon the state // of the phone. Notification Alerts (audible or vibrating) should // be on if and only if the phone is IDLE. NotificationMgr.getDefault().getStatusBarMgr() .enableNotificationAlerts(state == Phone.State.IDLE); // Have the PhoneApp recompute its mShowBluetoothIndication // flag based on the (new) telephony state. // There's no need to force a UI update since we update the // in-call notification ourselves (below), and the InCallScreen // listens for phone state changes itself. mApplication.updateBluetoothIndication(false); if (state == Phone.State.OFFHOOK) { PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_OFFHOOK); if (VDBG) log("onPhoneStateChanged: OFF HOOK"); Call call = mPhone.getForegroundCall().getState() != Call.State.IDLE ? mPhone.getForegroundCall() : mPhone.getBackgroundCall(); Connection c = call.getEarliestConnection(); if (VDBG) PhoneUtils.dumpCallState(mPhone); Call.State cstate = call.getState(); if (cstate == Call.State.ACTIVE && !c.isIncoming()) { long callDurationMsec = c.getDurationMillis(); if (VDBG) Log.i(LOG_TAG, "duration is " + callDurationMsec); if (mSettings.mVibOutgoing && callDurationMsec < 200) { mApplication.vibrate(100,0,0); } if (mSettings.mVib45) { callDurationMsec = callDurationMsec % 60000; mApplication.startVib45(callDurationMsec); } } // if the call screen is showing, let it handle the event, // otherwise handle it here. if (!mApplication.isShowingCallScreen()) { mApplication.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT); mApplication.requestWakeState(PhoneApp.WakeState.SLEEP); } // Since we're now in-call, the Ringer should definitely *not* // be ringing any more. (This is just a sanity-check; we // already stopped the ringer explicitly back in // PhoneUtils.answerCall(), before the call to phone.acceptCall().) // TODO: Confirm that this call really *is* unnecessary, and if so, // remove it! if (DBG) log("stopRing()... (OFFHOOK state)"); mRinger.stopRing(); // put a icon in the status bar NotificationMgr.getDefault().updateInCallNotification(); } } void updateCallNotifierRegistrationsAfterRadioTechnologyChange() { if (DBG) Log.d(LOG_TAG, "updateCallNotifierRegistrationsAfterRadioTechnologyChange..."); // Unregister all events from the old obsolete phone mPhone.unregisterForNewRingingConnection(this); mPhone.unregisterForPhoneStateChanged(this); mPhone.unregisterForDisconnect(this); mPhone.unregisterForUnknownConnection(this); mPhone.unregisterForIncomingRing(this); mPhone.unregisterForCallWaiting(this); mPhone.unregisterForDisplayInfo(this); mPhone.unregisterForSignalInfo(this); // Release the ToneGenerator used for playing SignalInfo and CallWaiting if (mSignalInfoToneGenerator != null) { mSignalInfoToneGenerator.release(); } // Register all events new to the new active phone mPhone.registerForNewRingingConnection(this, PHONE_NEW_RINGING_CONNECTION, null); mPhone.registerForPhoneStateChanged(this, PHONE_STATE_CHANGED, null); mPhone.registerForDisconnect(this, PHONE_DISCONNECT, null); mPhone.registerForUnknownConnection(this, PHONE_UNKNOWN_CONNECTION_APPEARED, null); mPhone.registerForIncomingRing(this, PHONE_INCOMING_RING, null); if (mPhone.getPhoneName().equals("CDMA")) { if (DBG) log("Registering for Call Waiting, Signal and Display Info."); mPhone.registerForCallWaiting(this, PHONE_CDMA_CALL_WAITING, null); mPhone.registerForDisplayInfo(this, PHONE_STATE_DISPLAYINFO, null); mPhone.registerForSignalInfo(this, PHONE_STATE_SIGNALINFO, null); // Instantiate the ToneGenerator for SignalInfo try { mSignalInfoToneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, TONE_RELATIVE_VOLUME_LOPRI_SIGNALINFO); } catch (RuntimeException e) { Log.w(LOG_TAG, "CallNotifier: Exception caught while creating " + "mSignalInfoToneGenerator: " + e); mSignalInfoToneGenerator = null; } } } /** * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. * refreshes the CallCard data when it called. If called with this * class itself, it is assumed that we have been waiting for the ringtone * and direct to voicemail settings to update. */ public void onQueryComplete(int token, Object cookie, CallerInfo ci){ if (cookie instanceof Long) { if (VDBG) log("CallerInfo query complete, posting missed call notification"); NotificationMgr.getDefault().notifyMissedCall(ci.name, ci.phoneNumber, ci.phoneLabel, ((Long) cookie).longValue()); } else if (cookie instanceof CallNotifier){ if (VDBG) log("CallerInfo query complete, updating data"); // get rid of the timeout messages removeMessages(RINGER_CUSTOM_RINGTONE_QUERY_TIMEOUT); boolean isQueryExecutionTimeOK = false; synchronized (mCallerInfoQueryStateGuard) { if (mCallerInfoQueryState == CALLERINFO_QUERYING) { mCallerInfoQueryState = CALLERINFO_QUERY_READY; isQueryExecutionTimeOK = true; } } //if we're in the right state if (isQueryExecutionTimeOK) { // send directly to voicemail. if (ci.shouldSendToVoicemail) { if (DBG) log("send to voicemail flag detected. hanging up."); PhoneUtils.hangupRingingCall(mPhone); return; } // set the ringtone uri to prepare for the ring. if (ci.contactRingtoneUri != null) { if (DBG) log("custom ringtone found, setting up ringer."); Ringer r = ((CallNotifier) cookie).mRinger; r.setCustomRingtoneUri(ci.contactRingtoneUri); } // ring, and other post-ring actions. onCustomRingQueryComplete(); } } } private void onDisconnect(AsyncResult r) { if (VDBG) log("onDisconnect()... phone state: " + mPhone.getState()); if (mPhone.getState() == Phone.State.IDLE) { PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_IDLE); } if (mPhone.getPhoneName().equals("CDMA")) { // Create the SignalInfo tone player to stop any signalInfo tone being played. new SignalInfoTonePlayer(ToneGenerator.TONE_CDMA_SIGNAL_OFF).start(); } Connection c = (Connection) r.result; if (DBG && c != null) { log("- onDisconnect: cause = " + c.getDisconnectCause() + ", incoming = " + c.isIncoming() + ", date = " + c.getCreateTime()); } if (c.getDurationMillis() > 0 && mSettings.mVibHangup) { mApplication.vibrate(50, 100, 50); } if (!c.isIncoming()) { mApplication.stopVib45(); } // Stop the ringer if it was ringing (for an incoming call that // either disconnected by itself, or was rejected by the user.) // // TODO: We technically *shouldn't* stop the ringer if the // foreground or background call disconnects while an incoming call // is still ringing, but that's a really rare corner case. // It's safest to just unconditionally stop the ringer here. if (DBG) log("stopRing()... (onDisconnect)"); mRinger.stopRing(); // Check for the various tones we might need to play (thru the // earpiece) after a call disconnects. int toneToPlay = InCallTonePlayer.TONE_NONE; // The "Busy" or "Congestion" tone is the highest priority: if (c != null) { Connection.DisconnectCause cause = c.getDisconnectCause(); if (cause == Connection.DisconnectCause.BUSY) { if (DBG) log("- need to play BUSY tone!"); toneToPlay = InCallTonePlayer.TONE_BUSY; } else if (cause == Connection.DisconnectCause.CONGESTION) { if (DBG) log("- need to play CONGESTION tone!"); toneToPlay = InCallTonePlayer.TONE_CONGESTION; } } // If we don't need to play BUSY or CONGESTION, then play the // "call ended" tone if this was a "regular disconnect" (i.e. a // normal call where one end or the other hung up) *and* this // disconnect event caused the phone to become idle. (In other // words, we *don't* play the sound if one call hangs up but // there's still an active call on the other line.) // TODO: We may eventually want to disable this via a preference. if ((toneToPlay == InCallTonePlayer.TONE_NONE) && (mPhone.getState() == Phone.State.IDLE) && (c != null)) { Connection.DisconnectCause cause = c.getDisconnectCause(); if ((cause == Connection.DisconnectCause.NORMAL) // remote hangup || (cause == Connection.DisconnectCause.LOCAL)) { // local hangup if (VDBG) log("- need to play CALL_ENDED tone!"); toneToPlay = InCallTonePlayer.TONE_CALL_ENDED; } } if (mPhone.getState() == Phone.State.IDLE) { // Don't reset the audio mode or bluetooth/speakerphone state // if we still need to let the user hear a tone through the earpiece. if (toneToPlay == InCallTonePlayer.TONE_NONE) { resetAudioStateAfterDisconnect(); } NotificationMgr.getDefault().cancelCallInProgressNotification(); // If the InCallScreen is *not* in the foreground, forcibly // dismiss it to make sure it won't still be in the activity // history. (But if it *is* in the foreground, don't mess // with it; it needs to be visible, displaying the "Call // ended" state.) if (!mApplication.isShowingCallScreen()) { if (VDBG) log("onDisconnect: force InCallScreen to finish()"); mApplication.dismissCallScreen(); } } if (c != null) { final String number = c.getAddress(); final int presentation = c.getNumberPresentation(); if (DBG) log("- onDisconnect: presentation=" + presentation); final long date = c.getCreateTime(); final long duration = c.getDurationMillis(); final Connection.DisconnectCause cause = c.getDisconnectCause(); // Set the "type" to be displayed in the call log (see constants in CallLog.Calls) final int callLogType; if (c.isIncoming()) { callLogType = (cause == Connection.DisconnectCause.INCOMING_MISSED ? CallLog.Calls.MISSED_TYPE : CallLog.Calls.INCOMING_TYPE); } else { callLogType = CallLog.Calls.OUTGOING_TYPE; } if (VDBG) log("- callLogType: " + callLogType + ", UserData: " + c.getUserData()); // Get the CallerInfo object and then log the call with it. { Object o = c.getUserData(); final CallerInfo ci; if ((o == null) || (o instanceof CallerInfo)){ ci = (CallerInfo) o; } else { ci = ((PhoneUtils.CallerInfoToken) o).currentInfo; } // Watch out: Calls.addCall() hits the Contacts database, // so we shouldn't call it from the main thread. Thread t = new Thread() { public void run() { Calls.addCall(ci, mApplication, number, presentation, callLogType, date, (int) duration / 1000); // if (DBG) log("onDisconnect helper thread: Calls.addCall() done."); } }; t.start(); } if (callLogType == CallLog.Calls.MISSED_TYPE) { // Show the "Missed call" notification. // (Note we *don't* do this if this was an incoming call that // the user deliberately rejected.) showMissedCallNotification(c, date); } // Possibly play a "post-disconnect tone" thru the earpiece. // We do this here, rather than from the InCallScreen // activity, since we need to do this even if you're not in // the Phone UI at the moment the connection ends. if (toneToPlay != InCallTonePlayer.TONE_NONE) { if (VDBG) log("- starting post-disconnect tone (" + toneToPlay + ")..."); new InCallTonePlayer(toneToPlay).start(); // The InCallTonePlayer will automatically stop playing (and // clean itself up) after a few seconds. // TODO: alternatively, we could start an InCallTonePlayer // here with an "unlimited" tone length, // and manually stop it later when this connection truly goes // away. (The real connection over the network was closed as soon // as we got the BUSY message. But our telephony layer keeps the // connection open for a few extra seconds so we can show the // "busy" indication to the user. We could stop the busy tone // when *that* connection's "disconnect" event comes in.) } if (mPhone.getState() == Phone.State.IDLE) { // Release screen wake locks if the in-call screen is not // showing. Otherwise, let the in-call screen handle this because // it needs to show the call ended screen for a couple of // seconds. if (!mApplication.isShowingCallScreen()) { if (VDBG) log("- NOT showing in-call screen; releasing wake locks!"); mApplication.setScreenTimeout(PhoneApp.ScreenTimeoutDuration.DEFAULT); mApplication.requestWakeState(PhoneApp.WakeState.SLEEP); } else { if (VDBG) log("- still showing in-call screen; not releasing wake locks."); diff --git a/src/com/android/phone/PhoneApp.java b/src/com/android/phone/PhoneApp.java index 05e9dab..104223f 100755 --- a/src/com/android/phone/PhoneApp.java +++ b/src/com/android/phone/PhoneApp.java @@ -1,973 +1,978 @@ /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.phone; import android.app.Activity; import android.app.Application; import android.app.KeyguardManager; import android.app.ProgressDialog; import android.bluetooth.BluetoothHeadset; import android.bluetooth.BluetoothIntent; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.net.Uri; import android.os.AsyncResult; import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.IPowerManager; import android.os.LocalPowerManager; import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.provider.Settings.System; import android.telephony.ServiceState; import android.util.Config; import android.util.Log; import android.view.KeyEvent; import android.widget.Toast; import com.android.internal.telephony.cdma.EriInfo; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.MmiCode; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.TelephonyIntents; import android.os.Vibrator; /** * Top-level Application class for the Phone app. */ public class PhoneApp extends Application { /* package */ static final String LOG_TAG = "PhoneApp"; /** * Phone app-wide debug level: * 0 - no debug logging * 1 - normal debug logging if ro.debuggable is set (which is true in * "eng" and "userdebug" builds but not "user" builds) * 2 - ultra-verbose debug logging * * Most individual classes in the phone app have a local DBG constant, * typically set to * (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1) * or else * (PhoneApp.DBG_LEVEL >= 2) * depending on the desired verbosity. */ /* package */ static final int DBG_LEVEL = 1; private static final boolean DBG = (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1); private static final boolean VDBG = (PhoneApp.DBG_LEVEL >= 2); // Message codes; see mHandler below. private static final int EVENT_SIM_ABSENT = 1; private static final int EVENT_SIM_LOCKED = 2; private static final int EVENT_SIM_NETWORK_LOCKED = 3; private static final int EVENT_WIRED_HEADSET_PLUG = 7; private static final int EVENT_SIM_STATE_CHANGED = 8; private static final int EVENT_UPDATE_INCALL_NOTIFICATION = 9; private static final int EVENT_DATA_ROAMING_DISCONNECTED = 10; private static final int EVENT_DATA_ROAMING_OK = 11; private static final int EVENT_UNSOL_CDMA_INFO_RECORD = 12; // The MMI codes are also used by the InCallScreen. public static final int MMI_INITIATE = 51; public static final int MMI_COMPLETE = 52; public static final int MMI_CANCEL = 53; // Don't use message codes larger than 99 here; those are reserved for // the individual Activities of the Phone UI. /** * Allowable values for the poke lock code (timeout between a user activity and the * going to sleep), please refer to {@link com.android.server.PowerManagerService} * for additional reference. * SHORT uses the short delay for the timeout (SHORT_KEYLIGHT_DELAY, 6 sec) * MEDIUM uses the medium delay for the timeout (MEDIUM_KEYLIGHT_DELAY, 15 sec) * DEFAULT is the system-wide default delay for the timeout (1 min) */ public enum ScreenTimeoutDuration { SHORT, MEDIUM, DEFAULT } /** * Allowable values for the wake lock code. * SLEEP means the device can be put to sleep. * PARTIAL means wake the processor, but we display can be kept off. * FULL means wake both the processor and the display. */ public enum WakeState { SLEEP, PARTIAL, FULL } private static PhoneApp sMe; // A few important fields we expose to the rest of the package // directly (rather than thru set/get methods) for efficiency. Phone phone; CallNotifier notifier; Ringer ringer; BluetoothHandsfree mBtHandsfree; PhoneInterfaceManager phoneMgr; int mBluetoothHeadsetState = BluetoothHeadset.STATE_ERROR; int mBluetoothHeadsetAudioState = BluetoothHeadset.STATE_ERROR; boolean mShowBluetoothIndication = false; // Internal PhoneApp Call state tracker CdmaPhoneCallState cdmaPhoneCallState; // The InCallScreen instance (or null if the InCallScreen hasn't been // created yet.) private InCallScreen mInCallScreen; // The currently-active PUK entry activity and progress dialog. // Normally, these are the Emergency Dialer and the subsequent // progress dialog. null if there is are no such objects in // the foreground. private Activity mPUKEntryActivity; private ProgressDialog mPUKEntryProgressDialog; private boolean mIsSimPinEnabled; private String mCachedSimPin; // True if a wired headset is currently plugged in, based on the state // from the latest Intent.ACTION_HEADSET_PLUG broadcast we received in // mReceiver.onReceive(). private boolean mIsHeadsetPlugged; private WakeState mWakeState = WakeState.SLEEP; private ScreenTimeoutDuration mScreenTimeoutDuration = ScreenTimeoutDuration.DEFAULT; private boolean mIgnoreTouchUserActivity = false; private IBinder mPokeLockToken = new Binder(); private IPowerManager mPowerManagerService; private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mPartialWakeLock; private KeyguardManager mKeyguardManager; private KeyguardManager.KeyguardLock mKeyguardLock; // Broadcast receiver for various intent broadcasts (see onCreate()) private final BroadcastReceiver mReceiver = new PhoneAppBroadcastReceiver(); // Broadcast receiver purely for ACTION_MEDIA_BUTTON broadcasts private final BroadcastReceiver mMediaButtonReceiver = new MediaButtonBroadcastReceiver(); /** boolean indicating restoring mute state on InCallScreen.onResume() */ private boolean mShouldRestoreMuteOnInCallResume; // add by cytown private CallFeaturesSetting mSettings; -private Vibrator mVibrator; +private static Vibrator mVibrator = null; private Handler vibrateHandler = new Handler(); private Runnable vibrateRun = new Runnable() { public void run() { mVibrator.vibrate(70); if (VDBG) Log.i(LOG_TAG, "vibrate on 45 sec"); vibrateHandler.postDelayed(this, 60000); } }; public void startVib45(long callDurationMsec) { if (VDBG) Log.i(LOG_TAG, "vibrate start @" + callDurationMsec); stopVib45(); vibrateHandler.postDelayed(vibrateRun, (callDurationMsec > 45000) ? 45000 + 60000 - callDurationMsec : 45000 - callDurationMsec); } public void stopVib45() { vibrateHandler.removeCallbacks(vibrateRun); } -public void vibrate(final int v1, final int p1, final int v2) { - if (VDBG) Log.i(LOG_TAG, "vibrate " + v1); - (new Thread() { - public void run() { - if (v1 > 0) mVibrator.vibrate(v1); - if (p1 > 0) SystemClock.sleep(p1); - if (v2 > 0) mVibrator.vibrate(v2); - } - }).start(); +private final class TriVibRunnable implements Runnable { + private int v1, p1, v2; + TriVibRunnable(int a, int b, int c) { + v1 = a; p1 = b; v2 = c; + } + public void run() { + if (DBG) Log.i(LOG_TAG, "vibrate " + v1 + ":" + p1 + ":" + v2); + if (v1 > 0) mVibrator.vibrate(v1); + if (p1 > 0) SystemClock.sleep(p1); + if (v2 > 0) mVibrator.vibrate(v2); + } +} +public void vibrate(int v1, int p1, int v2) { + new Handler().postDelayed(new TriVibRunnable(v1, p1, v2), 0); } /** * Set the restore mute state flag. Used when we are setting the mute state * OUTSIDE of user interaction {@link PhoneUtils#startNewCall(Phone)} */ /*package*/void setRestoreMuteOnInCallResume (boolean mode) { mShouldRestoreMuteOnInCallResume = mode; } /** * Get the restore mute state flag. * This is used by the InCallScreen {@link InCallScreen#onResume()} to figure * out if we need to restore the mute state for the current active call. */ /*package*/boolean getRestoreMuteOnInCallResume () { return mShouldRestoreMuteOnInCallResume; } Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case EVENT_SIM_LOCKED: // mIsSimPinEnabled = true; // // if (Config.LOGV) Log.v(LOG_TAG, "show sim unlock panel"); // SimPinUnlockPanel pinUnlockPanel = new SimPinUnlockPanel( // PhoneApp.getInstance()); // pinUnlockPanel.show(); break; case EVENT_SIM_ABSENT: // Don't need this now that the lock screen handles this case // if (Config.LOGV) Log.v(LOG_TAG, "show sim missing panel"); // SimMissingPanel missingPanel = new SimMissingPanel( // PhoneApp.getInstance()); // missingPanel.show(); break; case EVENT_SIM_NETWORK_LOCKED: if (getResources().getBoolean(R.bool.ignore_sim_network_locked_events)) { // Some products don't have the concept of a "SIM network lock" Log.i(LOG_TAG, "Ignoring EVENT_SIM_NETWORK_LOCKED event; " + "not showing 'SIM network unlock' PIN entry screen"); } else { // Normal case: show the "SIM network unlock" PIN entry screen. // The user won't be able to do anything else until // they enter a valid SIM network PIN. Log.i(LOG_TAG, "show sim depersonal panel"); IccNetworkDepersonalizationPanel ndpPanel = new IccNetworkDepersonalizationPanel(PhoneApp.getInstance()); ndpPanel.show(); } break; case EVENT_UPDATE_INCALL_NOTIFICATION: // Tell the NotificationMgr to update the "ongoing // call" icon in the status bar, if necessary. // Currently, this is triggered by a bluetooth headset // state change (since the status bar icon needs to // turn blue when bluetooth is active.) NotificationMgr.getDefault().updateInCallNotification(); break; case EVENT_DATA_ROAMING_DISCONNECTED: NotificationMgr.getDefault().showDataDisconnectedRoaming(); break; case EVENT_DATA_ROAMING_OK: NotificationMgr.getDefault().hideDataDisconnectedRoaming(); break; case MMI_COMPLETE: onMMIComplete((AsyncResult) msg.obj); break; case MMI_CANCEL: PhoneUtils.cancelMmiCode(phone); break; case EVENT_WIRED_HEADSET_PLUG: // Since the presence of a wired headset or bluetooth affects the // speakerphone, update the "speaker" state. We ONLY want to do // this on the wired headset connect / disconnect events for now // though, so we're only triggering on EVENT_WIRED_HEADSET_PLUG. if (!isHeadsetPlugged() && (mBtHandsfree == null || !mBtHandsfree.isAudioOn())) { // is the state is "not connected", restore the speaker state. PhoneUtils.restoreSpeakerMode(getApplicationContext()); } NotificationMgr.getDefault().updateSpeakerNotification(); break; case EVENT_SIM_STATE_CHANGED: // Marks the event where the SIM goes into ready state. // Right now, this is only used for the PUK-unlocking // process. if (msg.obj.equals(IccCard.INTENT_VALUE_ICC_READY)) { // when the right event is triggered and there // are UI objects in the foreground, we close // them to display the lock panel. if (mPUKEntryActivity != null) { mPUKEntryActivity.finish(); mPUKEntryActivity = null; } if (mPUKEntryProgressDialog != null) { mPUKEntryProgressDialog.dismiss(); mPUKEntryProgressDialog = null; } } break; case EVENT_UNSOL_CDMA_INFO_RECORD: //TODO: handle message here; break; } } }; public PhoneApp() { sMe = this; } @Override public void onCreate() { if (Config.LOGV) Log.v(LOG_TAG, "onCreate()..."); ContentResolver resolver = getContentResolver(); if (phone == null) { // Initialize the telephony framework PhoneFactory.makeDefaultPhones(this); // Get the default phone phone = PhoneFactory.getDefaultPhone(); NotificationMgr.init(this); phoneMgr = new PhoneInterfaceManager(this, phone); if (getSystemService(Context.BLUETOOTH_SERVICE) != null) { mBtHandsfree = new BluetoothHandsfree(this, phone); startService(new Intent(this, BluetoothHeadsetService.class)); } else { // Device is not bluetooth capable mBtHandsfree = null; } ringer = new Ringer(phone); // before registering for phone state changes PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, LOG_TAG); // lock used to keep the processor awake, when we don't care for the display. mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, LOG_TAG); mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); mKeyguardLock = mKeyguardManager.newKeyguardLock(LOG_TAG); // get a handle to the service so that we can use it later when we // want to set the poke lock. mPowerManagerService = IPowerManager.Stub.asInterface( ServiceManager.getService("power")); notifier = new CallNotifier(this, phone, ringer, mBtHandsfree); // register for ICC status IccCard sim = phone.getIccCard(); if (sim != null) { if (Config.LOGV) Log.v(LOG_TAG, "register for ICC status"); sim.registerForAbsent(mHandler, EVENT_SIM_ABSENT, null); sim.registerForLocked(mHandler, EVENT_SIM_LOCKED, null); sim.registerForNetworkLocked(mHandler, EVENT_SIM_NETWORK_LOCKED, null); } // register for MMI/USSD phone.registerForMmiComplete(mHandler, MMI_COMPLETE, null); // register connection tracking to PhoneUtils PhoneUtils.initializeConnectionHandler(phone); // Register for misc other intent broadcasts. IntentFilter intentFilter = new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED); intentFilter.addAction(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION); intentFilter.addAction(BluetoothIntent.HEADSET_AUDIO_STATE_CHANGED_ACTION); intentFilter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED); intentFilter.addAction(Intent.ACTION_HEADSET_PLUG); intentFilter.addAction(Intent.ACTION_BATTERY_LOW); intentFilter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); intentFilter.addAction(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED); intentFilter.addAction(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED); intentFilter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); registerReceiver(mReceiver, intentFilter); // Use a separate receiver for ACTION_MEDIA_BUTTON broadcasts, // since we need to manually adjust its priority (to make sure // we get these intents *before* the media player.) IntentFilter mediaButtonIntentFilter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON); // // Make sure we're higher priority than the media player's // MediaButtonIntentReceiver (which currently has the default // priority of zero; see apps/Music/AndroidManifest.xml.) mediaButtonIntentFilter.setPriority(1); // registerReceiver(mMediaButtonReceiver, mediaButtonIntentFilter); //set the default values for the preferences in the phone. PreferenceManager.setDefaultValues(this, R.xml.network_setting, false); PreferenceManager.setDefaultValues(this, R.xml.call_feature_setting, false); // Make sure the audio mode (along with some // audio-mode-related state of our own) is initialized // correctly, given the current state of the phone. switch (phone.getState()) { case IDLE: if (DBG) Log.d(LOG_TAG, "Resetting audio state/mode: IDLE"); PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_IDLE); PhoneUtils.setAudioMode(this, AudioManager.MODE_NORMAL); break; case RINGING: if (DBG) Log.d(LOG_TAG, "Resetting audio state/mode: RINGING"); PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_RINGING); PhoneUtils.setAudioMode(this, AudioManager.MODE_RINGTONE); break; case OFFHOOK: if (DBG) Log.d(LOG_TAG, "Resetting audio state/mode: OFFHOOK"); PhoneUtils.setAudioControlState(PhoneUtils.AUDIO_OFFHOOK); PhoneUtils.setAudioMode(this, AudioManager.MODE_IN_CALL); break; } } // XXX pre-load the SimProvider so that it's ready resolver.getType(Uri.parse("content://icc/adn")); // start with the default value to set the mute state. mShouldRestoreMuteOnInCallResume = false; // add by cytown mSettings = CallFeaturesSetting.getInstance(PreferenceManager.getDefaultSharedPreferences(this)); -mVibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE); +if (mVibrator == null) mVibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE); // Register for Cdma Information Records // TODO(Moto): Merge // phone.registerCdmaInformationRecord(mHandler, EVENT_UNSOL_CDMA_INFO_RECORD, null); if (phone.getPhoneName().equals("CDMA")) { // Create an instance of CdmaPhoneCallState and initialize it to IDLE cdmaPhoneCallState = new CdmaPhoneCallState(); cdmaPhoneCallState.CdmaPhoneCallStateInit(); } } /** * Returns the singleton instance of the PhoneApp. */ static PhoneApp getInstance() { return sMe; } Ringer getRinger() { return ringer; } BluetoothHandsfree getBluetoothHandsfree() { return mBtHandsfree; } static Intent createCallLogIntent() { Intent intent = new Intent(Intent.ACTION_VIEW, null); intent.setType("vnd.android.cursor.dir/calls"); return intent; } /** * Return an Intent that can be used to bring up the in-call screen. * * This intent can only be used from within the Phone app, since the * InCallScreen is not exported from our AndroidManifest. */ /* package */ static Intent createInCallIntent() { Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_USER_ACTION); intent.setClassName("com.android.phone", getCallScreenClassName()); return intent; } /** * Variation of createInCallIntent() that also specifies whether the * DTMF dialpad should be initially visible when the InCallScreen * comes up. */ /* package */ static Intent createInCallIntent(boolean showDialpad) { Intent intent = createInCallIntent(); intent.putExtra(InCallScreen.SHOW_DIALPAD_EXTRA, showDialpad); return intent; } static String getCallScreenClassName() { return InCallScreen.class.getName(); } /** * Starts the InCallScreen Activity. */ void displayCallScreen() { if (VDBG) Log.d(LOG_TAG, "displayCallScreen()..."); startActivity(createInCallIntent()); Profiler.callScreenRequested(); } /** * Helper function to check for one special feature of the CALL key: * Normally, when the phone is idle, CALL takes you to the call log * (see the handler for KEYCODE_CALL in PhoneWindow.onKeyUp().) * But if the phone is in use (either off-hook or ringing) we instead * handle the CALL button by taking you to the in-call UI. * * @return true if we intercepted the CALL keypress (i.e. the phone * was in use) * * @see DialerActivity#onCreate */ boolean handleInCallOrRinging() { if (phone.getState() != Phone.State.IDLE) { // Phone is OFFHOOK or RINGING. if (DBG) Log.v(LOG_TAG, "handleInCallOrRinging: show call screen"); displayCallScreen(); return true; } return false; } boolean isSimPinEnabled() { return mIsSimPinEnabled; } boolean authenticateAgainstCachedSimPin(String pin) { return (mCachedSimPin != null && mCachedSimPin.equals(pin)); } void setCachedSimPin(String pin) { mCachedSimPin = pin; } void setInCallScreenInstance(InCallScreen inCallScreen) { mInCallScreen = inCallScreen; } /** * @return true if the in-call UI is running as the foreground * activity. (In other words, from the perspective of the * InCallScreen activity, return true between onResume() and * onPause().) * * Note this method will return false if the screen is currently off, * even if the InCallScreen *was* in the foreground just before the * screen turned off. (This is because the foreground activity is * always "paused" while the screen is off.) */ boolean isShowingCallScreen() { if (mInCallScreen == null) return false; return mInCallScreen.isForegroundActivity(); } /** * Dismisses the in-call UI. * * This also ensures that you won't be able to get back to the in-call * UI via the BACK button (since this call removes the InCallScreen * from the activity history.) */ void dismissCallScreen() { if (mInCallScreen != null) { mInCallScreen.finish(); } } /** * Sets the activity responsible for un-PUK-blocking the device * so that we may close it when we receive a positive result. * mPUKEntryActivity is also used to indicate to the device that * we are trying to un-PUK-lock the phone. In other words, iff * it is NOT null, then we are trying to unlock and waiting for * the SIM to move to READY state. * * @param activity is the activity to close when PUK has * finished unlocking. Can be set to null to indicate the unlock * or SIM READYing process is over. */ void setPukEntryActivity(Activity activity) { mPUKEntryActivity = activity; } Activity getPUKEntryActivity() { return mPUKEntryActivity; } /** * Sets the dialog responsible for notifying the user of un-PUK- * blocking - SIM READYing progress, so that we may dismiss it * when we receive a positive result. * * @param dialog indicates the progress dialog informing the user * of the state of the device. Dismissed upon completion of * READYing process */ void setPukEntryProgressDialog(ProgressDialog dialog) { mPUKEntryProgressDialog = dialog; } ProgressDialog getPUKEntryProgressDialog() { return mPUKEntryProgressDialog; } /** * Disables the keyguard. This is used by the phone app to allow * interaction with the Phone UI when the keyguard would otherwise be * active (like receiving an incoming call while the device is * locked.) * * Any call to this method MUST be followed (eventually) * by a corresponding reenableKeyguard() call. */ /* package */ void disableKeyguard() { if (DBG) Log.d(LOG_TAG, "disable keyguard"); // if (DBG) Log.d(LOG_TAG, "disableKeyguard()...", new Throwable("stack dump")); mKeyguardLock.disableKeyguard(); } /** * Re-enables the keyguard after a previous disableKeyguard() call. * * Any call to this method MUST correspond to (i.e. be balanced with) * a previous disableKeyguard() call. */ /* package */ void reenableKeyguard() { if (DBG) Log.d(LOG_TAG, "re-enable keyguard"); // if (DBG) Log.d(LOG_TAG, "reenableKeyguard()...", new Throwable("stack dump")); mKeyguardLock.reenableKeyguard(); } /** * Controls how quickly the screen times out. * * The poke lock controls how long it takes before the screen powers * down, and therefore has no immediate effect when the current * WakeState (see {@link PhoneApp#requestWakeState}) is FULL. * If we're in a state where the screen *is* allowed to turn off, * though, the poke lock will determine the timeout interval (long or * short). * * @param shortPokeLock tells the device the timeout duration to use * before going to sleep * {@link com.android.server.PowerManagerService#SHORT_KEYLIGHT_DELAY}. */ /* package */ void setScreenTimeout(ScreenTimeoutDuration duration) { if (VDBG) Log.d(LOG_TAG, "setScreenTimeout(" + duration + ")..."); // make sure we don't set the poke lock repeatedly so that we // avoid triggering the userActivity calls in // PowerManagerService.setPokeLock(). if (duration == mScreenTimeoutDuration) { return; } mScreenTimeoutDuration = duration; updatePokeLock(); } /** * Update the state of the poke lock held by the phone app, * based on the current desired screen timeout and the * current "ignore user activity on touch" flag. */ private void updatePokeLock() { // This is kind of convoluted, but the basic thing to remember is // that the poke lock just sends a message to the screen to tell // it to stay on for a while. // The default is 0, for a long timeout and should be set that way // when we are heading back into a the keyguard / screen off // state, and also when we're trying to keep the screen alive // while ringing. We'll also want to ignore the cheek events // regardless of the timeout duration. // The short timeout is really used whenever we want to give up // the screen lock, such as when we're in call. int pokeLockSetting = LocalPowerManager.POKE_LOCK_IGNORE_CHEEK_EVENTS; switch (mScreenTimeoutDuration) { case SHORT: // Set the poke lock to timeout the display after a short // timeout (5s). This ensures that the screen goes to sleep // as soon as acceptably possible after we the wake lock // has been released. // pokeLockSetting |= LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT; pokeLockSetting |= mSettings.mScreenAwake ? LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT : LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT; break; case MEDIUM: // Set the poke lock to timeout the display after a medium // timeout (15s). This ensures that the screen goes to sleep // as soon as acceptably possible after we the wake lock // has been released. pokeLockSetting |= LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT; break; case DEFAULT: default: // set the poke lock to timeout the display after a long // delay by default. // TODO: it may be nice to be able to disable cheek presses // for long poke locks (emergency dialer, for instance). break; } if (mIgnoreTouchUserActivity) { pokeLockSetting |= LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS; } // Send the request try { mPowerManagerService.setPokeLock(pokeLockSetting, mPokeLockToken, LOG_TAG); } catch (RemoteException e) { Log.w(LOG_TAG, "mPowerManagerService.setPokeLock() failed: " + e); } } /** * Controls whether or not the screen is allowed to sleep. * * Once sleep is allowed (WakeState is SLEEP), it will rely on the * settings for the poke lock to determine when to timeout and let * the device sleep {@link PhoneApp#setScreenTimeout}. * * @param ws tells the device to how to wake. */ /* package */ void requestWakeState(WakeState ws) { if (VDBG) Log.d(LOG_TAG, "requestWakeState(" + ws + ")..."); if (mWakeState != ws) { switch (ws) { case PARTIAL: // acquire the processor wake lock, and release the FULL // lock if it is being held. mPartialWakeLock.acquire(); if (mWakeLock.isHeld()) { mWakeLock.release(); } break; case FULL: // acquire the full wake lock, and release the PARTIAL // lock if it is being held. mWakeLock.acquire(); if (mPartialWakeLock.isHeld()) { mPartialWakeLock.release(); } break; case SLEEP: default: // release both the PARTIAL and FULL locks. if (mWakeLock.isHeld()) { mWakeLock.release(); } if (mPartialWakeLock.isHeld()) { mPartialWakeLock.release(); } break; } mWakeState = ws; } } /** * If we are not currently keeping the screen on, then poke the power * manager to wake up the screen for the user activity timeout duration. */ /* package */ void wakeUpScreen() { if (mWakeState == WakeState.SLEEP) { if (DBG) Log.d(LOG_TAG, "pulse screen lock"); try { mPowerManagerService.userActivityWithForce(SystemClock.uptimeMillis(), false, true); } catch (RemoteException ex) { // Ignore -- the system process is dead. } } } /** * Sets the wake state and screen timeout based on the current state * of the phone, and the current state of the in-call UI. * * This method is a "UI Policy" wrapper around * {@link PhoneApp#requestWakeState} and {@link PhoneApp#setScreenTimeout}. * * It's safe to call this method regardless of the state of the Phone * (e.g. whether or not it's idle), and regardless of the state of the * Phone UI (e.g. whether or not the InCallScreen is active.) */ /* package */ void updateWakeState() { Phone.State state = phone.getState(); // True if the in-call UI is the foreground activity. // (Note this will be false if the screen is currently off, // since in that case *no* activity is in the foreground.) boolean isShowingCallScreen = isShowingCallScreen(); // True if the InCallScreen's DTMF dialer is currently opened. // (Note this does NOT imply whether or not the InCallScreen // itself is visible.) boolean isDialerOpened = (mInCallScreen != null) && mInCallScreen.isDialerOpened(); // True if the speakerphone is in use. (If so, we *always* use // the default timeout. Since the user is obviously not holding // the phone up to his/her face, we don't need to worry about // false touches, and thus don't need to turn the screen off so // aggressively.) // Note that we need to make a fresh call to this method any // time the speaker state changes. (That happens in // PhoneUtils.turnOnSpeaker().) boolean isSpeakerInUse = (state == Phone.State.OFFHOOK) && PhoneUtils.isSpeakerOn(this); // TODO (bug 1440854): The screen timeout *might* also need to // depend on the bluetooth state, but this isn't as clear-cut as // the speaker state (since while using BT it's common for the // user to put the phone straight into a pocket, in which case the // timeout should probably still be short.) if (DBG) Log.d(LOG_TAG, "updateWakeState: callscreen " + isShowingCallScreen + ", dialer " + isDialerOpened + ", speaker " + isSpeakerInUse + "..."); // // (1) Set the screen timeout. // // Note that the "screen timeout" value we determine here is // meaningless if the screen is forced on (see (2) below.) // if (!isShowingCallScreen || isSpeakerInUse) { // Use the system-wide default timeout. setScreenTimeout(ScreenTimeoutDuration.DEFAULT); } else { // We're on the in-call screen, and *not* using the speakerphone. if (isDialerOpened) { // The DTMF dialpad is up. This case is special because // the in-call UI has its own "touch lock" mechanism to // disable the dialpad after a very short amount of idle // time (to avoid false touches from the user's face while // in-call.) // // In this case the *physical* screen just uses the // system-wide default timeout. setScreenTimeout(ScreenTimeoutDuration.DEFAULT); } else { // We're on the in-call screen, and not using the DTMF dialpad. // There's actually no touchable UI onscreen at all in // this state. Also, the user is (most likely) not // looking at the screen at all, since they're probably // holding the phone up to their face. Here we use a // special screen timeout value specific to the in-call // screen, purely to save battery life. // setScreenTimeout(ScreenTimeoutDuration.MEDIUM); setScreenTimeout(mSettings.mScreenAwake ? ScreenTimeoutDuration.DEFAULT : ScreenTimeoutDuration.MEDIUM); } } // // (2) Decide whether to force the screen on or not. // // Force the screen to be on if the phone is ringing, or if we're // displaying the "Call ended" UI for a connection in the // "disconnected" state. // boolean isRinging = (state == Phone.State.RINGING); boolean showingDisconnectedConnection = PhoneUtils.hasDisconnectedConnections(phone) && isShowingCallScreen; boolean keepScreenOn = isRinging || showingDisconnectedConnection; if (DBG) Log.d(LOG_TAG, "updateWakeState: keepScreenOn = " + keepScreenOn + " (isRinging " + isRinging + ", showingDisc " + showingDisconnectedConnection + ")"); // keepScreenOn == true means we'll hold a full wake lock: requestWakeState(keepScreenOn ? WakeState.FULL : WakeState.SLEEP); } /** * Wrapper around the PowerManagerService.preventScreenOn() API. * This allows the in-call UI to prevent the screen from turning on * even if a subsequent call to updateWakeState() causes us to acquire * a full wake lock. */ /* package */ void preventScreenOn(boolean prevent) { if (VDBG) Log.d(LOG_TAG, "- preventScreenOn(" + prevent + ")..."); try { mPowerManagerService.preventScreenOn(prevent); } catch (RemoteException e) { Log.w(LOG_TAG, "mPowerManagerService.preventScreenOn() failed: " + e); } } /** * Sets or clears the flag that tells the PowerManager that touch * (and cheek) events should NOT be considered "user activity". * * Since the in-call UI is totally insensitive to touch in most * states, we set this flag whenever the InCallScreen is in the * foreground. (Otherwise, repeated unintentional touches could * prevent the device from going to sleep.) * * There *are* some some touch events that really do count as user * activity, though. For those, we need to manually poke the * PowerManager's userActivity method; see pokeUserActivity(). */ /* package */ void setIgnoreTouchUserActivity(boolean ignore) { if (VDBG) Log.d(LOG_TAG, "setIgnoreTouchUserActivity(" + ignore + ")..."); mIgnoreTouchUserActivity = ignore; updatePokeLock(); } /** * Manually pokes the PowerManager's userActivity method. Since we * hold the POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS poke lock while * the InCallScreen is active, we need to do this for touch events * that really do count as user activity (like DTMF key presses, or * unlocking the "touch lock" overlay.) */ /* package */ void pokeUserActivity() { if (VDBG) Log.d(LOG_TAG, "pokeUserActivity()..."); try { mPowerManagerService.userActivity(SystemClock.uptimeMillis(), false); } catch (RemoteException e) { Log.w(LOG_TAG, "mPowerManagerService.userActivity() failed: " + e); } } KeyguardManager getKeyguardManager() { return mKeyguardManager; } private void onMMIComplete(AsyncResult r) { if (VDBG) Log.d(LOG_TAG, "onMMIComplete()..."); MmiCode mmiCode = (MmiCode) r.result; PhoneUtils.displayMMIComplete(phone, getInstance(), mmiCode, null, null); } private void initForNewRadioTechnology() { if (DBG) Log.d(LOG_TAG, "initForNewRadioTechnology..."); ringer.updateRingerContextAfterRadioTechnologyChange(this.phone); notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange(); if (mBtHandsfree != null) { mBtHandsfree.updateBtHandsfreeAfterRadioTechnologyChange(); } if (mInCallScreen != null) { mInCallScreen.updateAfterRadioTechnologyChange();