Exemplo n.º 1
0
        if ($tmp = $ctrl->get_model('./load', ['dir' => $dirfile, 'file' => substr($l, strlen($dirfile), strlen($l)), 'routes' => $routes])) {
            if (!isset($tmp['error'])) {
                array_push($list, $tmp);
                array_push($sess, $l);
            }
        }
    }
    $ctrl->inc->session->set($sess, 'ide', 'list');
    if (!$current_dir && $ctrl->inc->session->has('ide', 'dir')) {
        $current_dir = $ctrl->inc->session->get('ide', 'dir');
    }
    $ide_cfg = $ctrl->inc->user->get_cfg('ide');
    echo $ctrl->set_title("IDE")->add_js('./functions', ['dirs' => $model['dirs'], 'root' => $ctrl->data['root'], 'baseURL' => $ctrl->say_path() . '/', 'theme' => empty($ide_cfg['theme']) ? '' : $ide_cfg['theme'], 'font' => empty($ide_cfg['font']) ? '' : $ide_cfg['font'], 'font_size' => empty($ide_cfg['font_size']) ? '' : $ide_cfg['font_size']])->add_js(['menu' => $model['menu'], 'config' => $list, 'dirs' => $model['dirs'], 'root' => $ctrl->data['root'], 'url' => implode('/', $ctrl->params), 'current_dir' => $current_dir ? $current_dir : $model['default_dir']])->get_view() . $ctrl->get_less();
    $ctrl->obj->url = 'ide/editor';
} else {
    $dirs = new \bbn\ide\directories($ctrl->inc->options, $ctrl->get_routes());
    //$dir = array_shift($ctrl->arguments);
    $tab = array_pop($ctrl->arguments);
    $url = implode('/', $ctrl->arguments);
    // Case where it's a new file and we need to provide the tabNav info
    if (strpos($url, $ctrl->baseURL) === false) {
        if ($dir = $dirs->dir_from_url($url)) {
            $info = $dirs->dir($dir);
            $ctrl->obj = $dirs->load($url, $dir, $tab, $ctrl->inc->pref);
        }
    } else {
        $res = $dirs->load($url, $dir, $tab, $ctrl->inc->pref);
    }
    /*
    \bbn\x::hdump(
      $res,
Exemplo n.º 2
0
<?php

/** @var $model \bbn\mvc\model */
$d = new \bbn\ide\directories($model->inc->options);
if (empty($model->data)) {
    $r = $d->get();
} else {
    if (count($model->data) === 1 && !empty($model->data['id'])) {
        $r = $d->delete($model->data);
    } else {
        if (count($model->data) > 1 && empty($model->data['id'])) {
            $r = $d->add($model->data);
        } else {
            if (count($model->data) > 1 && !empty($model->data['id'])) {
                $r = $d->edit($model->data);
            }
        }
    }
}
return ['ret' => $r];
Exemplo n.º 3
0
<?php

if (isset($model->data['dir'], $model->data['routes'])) {
    // Initialize the directories object
    $dirs = new \bbn\ide\directories($model->inc->options, $model->data['routes']);
    $current = empty($model->data['path']) ? '' : $model->data['path'];
    if (!empty($current)) {
        $current .= '/';
    }
    // Get the relative directory item
    if ($dir = $dirs->dir($model->data['dir'])) {
        // Get the directory's root path
        $path = $dirs->get_root_path($model->data['dir']);
        //
        $file_check = ['viewables' => ['html', 'htm', 'php', 'php4', 'jinja2', 'php5', 'sql', 'mysql', 'js', 'py', 'txt', 'log', '', 'css', 'less', 'htaccess', 'htpasswd', 'svg', 'conf'], 'images' => ['jpg', 'jpeg', 'gif', 'png']];
        // Files' extensions excluded
        $excluded = ['svn', 'notes', 'git'];
        // Extensions for icons
        $ext_icons = ['css', 'less', 'html', 'js', 'py', 'php', 'sql', 'svg', 'json', 'txt', 'md'];
        // List of folders
        $folders = [];
        // List of files
        $files = [];
        // Check if the directory is a mvc
        if (!empty($dir['tabs'])) {
            // Get all files and all folders of each mvc's tabs (_ctrl tab excluded)
            foreach ($dir['tabs'] as $i => $t) {
                if ($i !== '_ctrl') {
                    // Set the real path
                    $real = $path . $t['path'] . (empty($model->data['path']) ? '' : $model->data['path']);
                    if (file_exists($real)) {
Exemplo n.º 4
0
<?php

if (isset($model->data['routes'])) {
    $dirs = new \bbn\ide\directories($model->inc->options, $model->data['routes']);
    $res = ['default_dir' => $model->inc->session->has('ide', 'dir') ? $model->inc->session->get('ide', 'dir') : 'BBN_APP_PATH/mvc/', 'dirs' => $dirs->dirs(), 'modes' => $dirs->modes(), 'menu' => [['text' => 'File', 'items' => [['text' => '<i class="fa fa-plus"></i>New', 'items' => [['text' => '<i class="fa fa-file-o"></i>File', 'function' => "appui.ide.newFile()"], ['text' => '<i class="fa fa-folder"></i>Directory', 'function' => "appui.ide.newDir()"]]], ['text' => '<i class="fa fa-save"></i>Save', 'function' => "appui.ide.save();"], ['text' => '<i class="fa fa-trash-o"></i>Delete'], ['text' => '<i class="fa fa-times-circle"></i>Close', 'function' => "appui.ide.tabstrip.tabNav('close');"], ['text' => '<i class="fa fa-times-circle-o"></i>Close all tabs', 'function' => "appui.ide.tabstrip.tabNav('closeAll');"]]], ['text' => 'Edit', 'items' => [['text' => '<i class="fa fa-search"></i>Find <small>CTRL+F</small>', 'function' => "appui.ide.search();"], ['text' => '<i class="fa fa-search-plus"></i>Find next <small>CTRL+G</small>', 'function' => "appui.ide.findNext();"], ['text' => '<i class="fa fa-search-minus"></i>Find previous <small>SHIFT+CTRL+G</small>', 'function' => "appui.ide.findPrev();"], ['text' => '<i class="fa fa-exchange"></i>Replace <small>SHIFT+CTRL+F</small>', 'function' => "appui.ide.replace();"], ['text' => '<i class="fa fa-retweet"></i>Replace All <small>SHIFT+CTRL+R</small>', 'function' => "appui.ide.replaceAll();"]]], ['text' => 'History', 'items' => [['text' => '<i class="fa fa-history"></i>Show', 'function' => 'appui.ide.history();'], ['text' => '<i class="fa fa-trash-o"></i>Clear', 'function' => 'appui.ide.historyClear();'], ['text' => '<i class="fa fa-trash"></i>Clear All', 'function' => 'appui.ide.historyClearAll();']]], ['text' => 'Doc.', 'items' => [['text' => '<i class="fa fa-binoculars"></i>Find'], ['text' => '<i class="fa fa-book"></i>Generate']]], ['text' => 'Pref.', 'items' => [['text' => '<i class="fa fa-cog"></i>Manage directories', 'function' => "appui.ide.cfgDirs();"], ['text' => '<i class="fa fa-language"></i>IDE style', 'function' => "appui.ide.cfgStyle();"]]]]];
    return $res;
}
Exemplo n.º 5
0
<?php

/** @var $ctrl \bbn\mvc\controller */
//$dir = array_shift($ctrl->arguments);
$url = implode('/', $ctrl->arguments);
$dirs = new \bbn\ide\directories($ctrl->inc->options, $ctrl->get_routes());
$dir = $dirs->dir_from_url($url);
\bbn\x::dump($dir);
\bbn\x::dump($dirs->get());
/*
// Case where it's a new file and we need to provide the tabNav info
if ( $ctrl->baseURL === $ctrl->data['root'].'editor/' ){
  $ctrl->obj->url = $ctrl->get_path().'/'.$url;
  $ctrl->combo(substr($url, strlen($dir)), [
    'root' => $ctrl->data['root'],
    'baseURL' => $ctrl->obj->url.'/',
    'file' => $url
  ]);
}
// Case where the tabnav is already loaded and we just provide the data
else{
  $dirs = new \bbn\ide\directories($ctrl->inc->options, $ctrl->get_routes());
  // Case where it's a new file and we need to provide the tabNav info
  if ( strpos($url, $ctrl->baseURL) === false ){
    if ( $dir = $dirs->dir_from_url($url) ){
      $info = $dirs->dir($dir);
      if ( empty($info['tabs']) ){

      }
      else{
        $tab = array_pop($ctrl->arguments);
Exemplo n.º 6
0
<?php

if (!empty($model->data['file']) && !empty($model->data['dir']) && isset($model->data['routes'])) {
    $dirs = new \bbn\ide\directories($model->inc->options, $model->data['routes']);
    if ($res = $dirs->load($model->data['file'], $model->data['dir'], isset($model->data['tab']) ? $model->data['tab'] : false, $model->inc->pref)) {
        return $res;
    }
    return ['error' => $dirs->get_last_error()];
}
Exemplo n.º 7
0
<?php

/** @var \bbn\mvc\model $model */
if (isset($model->data['path'])) {
    $dirs = new \bbn\ide\directories($model->inc->options);
    return $dirs->dir($model->data['path']);
}