示例#1
0
文件: Man.php 项目: frdl/webfan
    protected function task_packages()
    {
        $divSerp = 'wd-frdl-webfan-pm-packages-main' . mt_rand(1000, 9999);
        $p = new \frdl\ApplicationComposer\Package();
        //	$packages = $p->all();
        $num = 25;
        $packages = $p->select(0, $num, array('vendor' => 'ASC', 'package' => 'ASC'));
        // sort($packages);
        $this->html .= '<div id="' . $divSerp . '">';
        foreach ($packages as $num => $package) {
            $this->html .= '<div class="data-box">';
            $this->html .= '<h2 class="webfan-blue" onclick="var p = this.getAttribute(\'data-package\'); 
                 	  	     	var e = explode(\'/\', p);
							   	$(frdl.wd()).pack(\'c\', e[0], e[1]);"
					  data-package="' . $package['vendor'] . '/' . $package['package'] . '" style="text-decoration:underline;">';
            $this->html .= $package['vendor'] . '/' . $package['package'];
            $this->html .= '</h2>';
            if (isset($package['description'])) {
                $this->html .= '<p>' . $package['description'] . '</p>';
            }
            if (isset($package['url'])) {
                $this->html .= '<p><a href="' . $package['url'] . '" style="text-decoration:underline;" target="_blank">' . $package['url'] . '</a></p>';
            }
            $this->html .= '</div>';
        }
        $this->html .= '</div>';
        $this->html .= '
		  <button onclick="var App = frdl.wd().Registry.Programs[\'frdl-webfan\'];
		  frdl.wd().wdFrdlWebfanHtmlPackagesOffset =  frdl.wd().wdFrdlWebfanHtmlPackagesOffset + ' . intval($num) . ';
		    Dom.g(\'' . $divSerp . '\').innerHTML += \'<img src=\' + base64_decode(\'Ig==\') + \'http://images.webfan.de/ajax-loader_2.gif\' + base64_decode(\'Ig==\') + \' alt=\' + base64_decode(\'Ig==\') + \'lade...\' + base64_decode(\'Ig==\') + \' style=\' + base64_decode(\'Ig==\') + \'border:none;\' + base64_decode(\'Ig==\') + \' class=\' + base64_decode(\'Ig==\') + \'img-ajax-loader\' + base64_decode(\'Ig==\') + \' />\';
	        frdl.wd().Registry.Programs[\'frdl-webfan\'].cmd(
	            \'frdl pm select --start=\' + frdl.wd().wdFrdlWebfanHtmlPackagesOffset + \' --limit=' . $num . ' -b\',  function(o){
	             	  $.each(o.packages, function(_k,i){
                 	  	     i.name = i.vendor + \'/\' + i.package;
                 	  	     var d = Dom.create(\'div\'), p, p2, h, a;
                 	  	     d.setAttribute(\'class\', \'data-box\');
                 	  	     h = Dom.create(\'h2\');
                 	  	     h.setAttribute(\'class\', \'webfan-blue\');
                 	  	     h.setAttribute(\'data-package\', i.name);
                 	  	     h.style.textDecoration=\'underline\';
                 	  	     Dom.addText(i.name, h);
                 	  	     h.onclick=function(ev){
                 	  	     	var p = this.getAttribute(\'data-package\'); 
                 	  	     	var e = explode(\'/\', p);
							   	$(App).pack(\'c\', e[0], e[1], true);
							 };
                 	  	     Dom.add(h,d);
                 	  	    
                 	  	     if(\'undefined\' !== typeof i.description){ 
                 	  	       p = Dom.create(\'p\');
                 	  	       Dom.addText(i.description, p);
                 	  	       Dom.add(p,d);
                 	  	     }
                 	  	     
                  	  	     if(\'undefined\' !== typeof i.url){
                 	  	       p2 = Dom.create(\'p\');
                 	  	       a =  Dom.create(\'a\');
                 	  	       a.setAttribute(\'href\', i.url);
                 	  	       a.style.textDecoration=\'underline\';
                 	  	       Dom.addText(i.url, a);
                 	  	       a.setAttribute(\'target\', \'_blank\');
                 	  	       Dom.add(a,p2);
                 	  	       Dom.add(p2,d);							 	
							 }
                	  	     
                 	  	     
                 	  	   
                 	  	     Dom.add(d, Dom.g(\'' . $divSerp . '\'));  
                 	  	}); 		            
              	     $(\'.img-ajax-loader\').hide();    	
	        }, true);	    
		  "><span>More</span>...</button>
		';
        $this->js .= " \n\t\tfrdl.wd().wdFrdlWebfanHtmlPackagesOffset = " . $num . ";\n\n\t\t";
    }
示例#2
0
文件: pm.php 项目: frdl/webfan
 public function find($o)
 {
     if (!isset($this->argtoks['arguments'][1]) || intval($this->argtoks['arguments'][1]['pos']) !== 2) {
         return $this->wrongArgumentCount();
     }
     $this->packagefullname = str_replace(array('"', "'"), array('', ''), $this->argtoks['arguments'][1]['cmd']);
     try {
         $this->F = new \frdl\ApplicationComposer\Repos\Fetch($o);
         $this->result->searchresults = $this->F->search($this->packagefullname);
         $this->result->searchresults = array_unique($this->result->searchresults);
     } catch (\Exception $e) {
         \webdof\wResponse::status(409);
         $this->result->out = $e->getMessage();
         return;
     }
     if (isset($this->argtoks['flags']['s']) && true === $this->aSess['isAdmin']) {
         $p = new \frdl\ApplicationComposer\Package(array(), \frdl\xGlobal\webfan::db()->settings(), $this->db);
         $p->db()->begin();
         foreach ($this->result->searchresults as $num => $s) {
             if (is_array($s)) {
                 foreach ($s as $num2 => $s2) {
                     $v = explode('/', $s2->name);
                     if (2 === count($v) && !$p->find($v[0], $v[1])) {
                         $p->vendor = $v[0];
                         $p->package = $v[1];
                         $p->url = $s2->url;
                         $p->description = $s2->description;
                         $p->time_last_fetch_info = time();
                         $p->create();
                     }
                 }
             } else {
                 $v = explode('/', $s->name);
                 if (2 === count($v) && !$p->find($v[0], $v[1])) {
                     $p->vendor = $v[0];
                     $p->package = $v[1];
                     $p->url = $s->url;
                     $p->description = $s->description;
                     $p->time_last_fetch_info = time();
                     $p->create();
                 }
             }
         }
         $p->db()->commit();
     }
     $this->result->out = 'OK';
 }