Skip to content
Browse files

Embedding and RPC started.

  • Loading branch information...
1 parent e4b0339 commit e675eae76961ba82cc8011b5a258533de60827b2 @Artazor Artazor committed May 23, 2012
Showing with 41 additions and 5 deletions.
  1. +4 −1 asset/js/js.class.php
  2. +4 −0 common/application/view.js
  3. +1 −0 controller/controller.class.php
  4. +6 −2 itself.php
  5. +14 −0 object/embed_view.php
  6. +12 −2 oxygen.class.php
View
5 asset/js/js.class.php
@@ -8,7 +8,10 @@ class Oxygen_Asset_JS extends Oxygen_Asset {
, templateName="{2}";
$(templateClass).each(function(){
var $this = $(this);
- {3}
+ if(typeof(this.oxygenized) === "undefined"){
+ {3}
+ this.oxygenized = true;
+ }
});
})';
public function __construct() {
View
4 common/application/view.js
@@ -5,6 +5,10 @@ var $document = $(document)
, $footer = $('div.oxy-footer')
;
+$.oxygenRpc = function(component,method,data,cb) {
+
+}
+
function updateLayout() {
var clientHeight = $document.height()-$header.height()-$footer.height();
$content.height(clientHeight);
View
1 controller/controller.class.php
@@ -119,6 +119,7 @@ public function handleGet() {
}
public function post() {
+ return htmlResponse(array($this,'put_embed_view'));
$location = $this->go();
return redirectResponse($location);
}
View
8 itself.php
@@ -12,11 +12,15 @@
define('OXYGEN_XML_RESPONSE',4);
define('OXYGEN_REDIRECT_RESPONSE',5);
- function o($tag = 'div') {
+ function o($tag = 'div', $data=false) {
+ if(is_array($tag)) {
+ $data = $tag;
+ $tag = 'div';
+ }
if($tag{0}=='/'){
Oxygen::close();
} else {
- Oxygen::open($tag);
+ Oxygen::open($tag, $data);
}
}
View
14 object/embed_view.php
@@ -0,0 +1,14 @@
+<?
+ try {
+ $body = $this->get_view();
+ $less = $assets->less->compile();
+ $js = $assets->js->compile();
+ } catch (Exception $ex) {
+ $body = $this->scope->__wrapException($ex)->get_view();
+ }
+ $head = json_encode($this->get_stylesheets() . $this->get_javascripts());
+?>
+<script>
+$('head').append(<?=$head?>);
+</script>
+<?=$body?>
View
14 oxygen.class.php
@@ -12,10 +12,20 @@ public static function pop() {
return self::$stack[--self::$sp];
}
- public static function open($tag = 'div'){
+ public static function open($tag = 'div', $data = false){
+ if(is_array($tag)) {
+ $data = $tag;
+ $tag = 'div';
+ }
$call = self::$stack[self::$sp-1];
$call->stack[$call->sp++] = $tag;
- echo '<' . $tag . ' class="' . self::getCssClass() . '">';
+ echo '<' . $tag . ' class="' . self::getCssClass() . '"';
+ if(is_array($data)) {
+ foreach ($data as $key => $value) {
+ echo ' data-' . $key . '="' . htmlspecialchars(json_encode($value)) . '"';
+ }
+ }
+ echo '>';
}
public static function cssClassFor($class, $name) {

0 comments on commit e675eae

Please sign in to comment.
Something went wrong with that request. Please try again.