sync
authorBlastytheBlue <blastofmn@gmail.com>
Tue, 23 Dec 2014 09:58:57 +0000 (17:58 +0800)
committerBlastytheBlue <blastofmn@gmail.com>
Tue, 23 Dec 2014 09:58:57 +0000 (17:58 +0800)
Pman/Reddit/DataObjects/Reddit_livefeed.php
Pman/Reddit/DataObjects/Reddit_livefeed_embed.php
Reddit.php
Reddit/ImportEmbed.php
Reddit/Reddit.Index.bjs
Reddit/Reddit.Index.js
Reddit/templates/Reddit.Index.html

index 2dcf2bb..fa0481a 100644 (file)
@@ -179,5 +179,12 @@ data =>
         
     }
    */    
-     
+    function embedsArray()
+    {
+        $f = DB_DataObject::factory('reddit_livefeed_embed');
+        $f->feed_id = $this->id;
+        $f->orderBy('seqid ASC');
+        
+        return $f->fetchAll();
+    }
 }
index bb9d4d7..7044112 100644 (file)
@@ -24,7 +24,7 @@ class Pman_Reddit_DataObjects_Reddit_livefeed_embed extends DB_DataObject
     
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
-    /*function convertClean(){;
+    function convertClean(){;
         require_once 'Net/URL.php';
         $data = $this->frame_body;
         libxml_use_internal_errors (true);
@@ -41,15 +41,16 @@ class Pman_Reddit_DataObjects_Reddit_livefeed_embed extends DB_DataObject
         foreach($xpath->query('//img') as $im){
             $url = parse_url($im->getAttribute("src"));
             $file = '/assets/'. $url["host"] . $url["path"];
-            if($url->query){
-                $file += "--" . md5($url->query);
+            if(array_key_exists("query",$url)){
+                $file .= "--" . md5($url["query"]);
             }
+            echo $file . "\n";
             $im->setAttribute("src",$file);
         }
         
         $this->frame_body_clean = $doc->saveHTML();
         $this->update();
-    }*/
+    }
     function createAssets(){
         require_once 'Net/URL.php';
         echo $this->url;
@@ -175,8 +176,7 @@ class Pman_Reddit_DataObjects_Reddit_livefeed_embed extends DB_DataObject
             
             if($ext){
                 $file .= "." . $ext;
-            }
-            
+            };
             //echo "\n\nFile: " .$file . "\nSrc: " . $src . "\nExts:" . print_r($exts) . "\nMeta: " . print_r($info);
             
             fclose($f);
@@ -192,8 +192,11 @@ class Pman_Reddit_DataObjects_Reddit_livefeed_embed extends DB_DataObject
                 mkdir($dir,0775,true);
             }
             file_put_contents($file,$img);
+            $im->setAttribute("src",$file)
             break;
         }
+        $this->frame_body_clean = $doc->saveHTML();
+        $this->update();
     }
     function convertHTML(){
         //var_dump($url);
index 6628c68..e9cea55 100644 (file)
@@ -30,9 +30,9 @@ class  Reddit  extends Pman
         $f->orderBy('created_dt ASC');
         $f->find();
         $this->feed=array();
-        while ($f->fetch())
+        while ($f->fetch()) {
             $c = clone($f);
-            $c->embed_ar = $c->embedsArray();
+            $c->embeds_ar = $c->embedsArray();
             $this->feed[] = $c;
         }
         
index 3096beb..e604e18 100644 (file)
@@ -31,8 +31,8 @@ class Reddit_ImportEmbed extends Pman {
         while ($dd->fetch()) {
             //$dd->fetchEmbed();
             //$dd->convertHTML();
-            $dd->createAssets();
-            //$dd->convertClean();
+            //$dd->createAssets();
+            $dd->convertClean();
         }
         
         exit;
index 3cdc426..69d21c0 100644 (file)
@@ -2,7 +2,7 @@
     "name" : "Reddit.Index",
     "parent" : "",
     "title" : "",
-    "path" : "/home/alan/gitlive/web.Reddit/Reddit/Reddit.Index.bjs",
+    "path" : "/home/julian/gitlive/web.Reddit/Reddit/Reddit.Index.bjs",
     "permname" : "",
     "modOrder" : "001",
     "items" : [
                                                     "String tag" : "p",
                                                     "xtype" : "Element",
                                                     "$ xns" : "Roo.bootstrap",
-                                                    "String html" : "\n<!-- {feed:r} -->\n<style>\n.feed-body-html a { display:none }\n</style>\n\n<div flexy:foreach=\"feed,f\">\n\n<!-- <h3>10am</h3> -->\n<hr />\n\n\n\n<div class=\"feed-body-html\"> {f.body_html:h} </div>\n\n<div flexy:foreach=\"f.embeds,e\">\n\n</div>\n<p> the image associated with it goes here </p>\n<p><a href=\"#\">{e.original url}</a> </p>\n\n\n<p> <small><B>{f.created_local_dt}</B></small> | <a href=\"#\">/reddit/{f.author}</a> |  <a href=\"#\">Download as PDF</a> </p>\n</div>"
+                                                    "String html" : "\n<!-- {feed:r} -->\n<style>\n.feed-body-html a { display:none }\n</style>\n\n<div flexy:foreach=\"feed,f\">\n\n<!-- <h3>10am</h3> -->\n<hr />\n\n<div class=\"feed-body-html\"> {f.body_html:h} </div>\n<div flexy:foreach=\"f.embeds_ar,e\">\n<iframe style=\"{e.frame_style}\" src=\"Embed/{e.id}\" height=\"{e.frame_height}\" width=\"{e.frame_width}\"></iframe>\n</div>\n<p> the image associated with it goes here </p>\n<p><a href=\"#\">{e.original url}</a> </p>\n\n\n<p> <small><B>{f.created_local_dt}</B></small> | <a href=\"#\">/reddit/{f.author}</a> |  <a href=\"#\">Download as PDF</a> </p>\n</div>"
                                                 }
                                             ]
                                         }
index d9fc912..78ab392 100644 (file)
@@ -179,7 +179,7 @@ Reddit.Index = new Roo.XComponent({
                                                     tag : 'p',
                                                     xtype : 'Element',
                                                     xns : Roo.bootstrap,
-                                                    html : '\n<!-- {feed:r} -->\n<style>\n.feed-body-html a { display:none }\n</style>\n\n<div flexy:foreach=\"feed,f\">\n\n<!-- <h3>10am</h3> -->\n<hr />\n\n\n\n<div class=\"feed-body-html\"> {f.body_html:h} </div>\n\n<div flexy:foreach=\"f.embeds,e\">\n\n</div>\n<p> the image associated with it goes here </p>\n<p><a href=\"#\">{e.original url}</a> </p>\n\n\n<p> <small><B>{f.created_local_dt}</B></small> | <a href=\"#\">/reddit/{f.author}</a> |  <a href=\"#\">Download as PDF</a> </p>\n</div>'
+                                                    html : '\n<!-- {feed:r} -->\n<style>\n.feed-body-html a { display:none }\n</style>\n\n<div flexy:foreach=\"feed,f\">\n\n<!-- <h3>10am</h3> -->\n<hr />\n\n<div class=\"feed-body-html\"> {f.body_html:h} </div>\n<div flexy:foreach=\"f.embeds_ar,e\">\n<iframe style=\"{e.frame_style}\" src=\"Embed/{e.id}\" height=\"{e.frame_height}\" width=\"{e.frame_width}\"></iframe>\n</div>\n<p> the image associated with it goes here </p>\n<p><a href=\"#\">{e.original url}</a> </p>\n\n\n<p> <small><B>{f.created_local_dt}</B></small> | <a href=\"#\">/reddit/{f.author}</a> |  <a href=\"#\">Download as PDF</a> </p>\n</div>'
                                                 }
                                             ]
 
index de5a669..a053e73 100644 (file)
@@ -17,7 +17,7 @@
     <DIV class="collapse navbar-collapse" xbuilderid="roo-gen6">
       <UL class="nav navbar-nav navbar-right" xbuilderid="roo-gen7" style="margin-right: 20px;" xtype="Roo.bootstrap.NavGroup"></UL>
     </DIV>
-    <DIV class="x-dlg-mask" xbuilderid="roo-gen5" style="width: 715px; height: 138px; display: none;"></DIV>
+    <DIV class="x-dlg-mask" xbuilderid="roo-gen5" style="width: 503px; height: 138px; display: none;"></DIV>
   </HEADER>
   <DIV class="container" xbuilderid="roo-gen8" style="margin-top: 100px;" xtype="Roo.bootstrap.Container">
     <OL class=" breadcrumb" xbuilderid="roo-gen9" xtype="Roo.bootstrap.Container">
             <HR></HR>
 
 
-
-
             <DIV class="feed-body-html"> {f.body_html:h} </DIV>
 
+            <DIV flexy:foreach="f.embeds_ar,e">
 
-            <DIV flexy:foreach="f.embeds,e">
+              <IFRAME style="{e.frame_style}" src="Embed/{e.id}" height="{e.frame_height}" width="{e.frame_width}"></IFRAME>
 
-</DIV>
+            </DIV>
 
             <P> the image associated with it goes here </P>
 
@@ -82,7 +81,7 @@
 
             <P> 
               <SMALL>
-                <B>{f.creaded_local_dt}</B>
+                <B>{f.created_local_dt}</B>
               </SMALL> | 
               <A href="#">/reddit/{f.author}</A> |  
               <A href="#">Download as PDF</A>