X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2FBarrel.php;h=2379561b86733e1dd251d7171ea7d0bc6d1a3d3c;hb=fcc3110e8eee6ce903281d41f0e4b24e45f986dd;hp=cc41014e676df1eaa7ee2eaa87b7b1edc077091b;hpb=d2cf8e2c70cdbd10213a5c123c278a7257d8e210;p=diogenes.git diff --git a/include/Barrel.php b/include/Barrel.php index cc41014..2379561 100644 --- a/include/Barrel.php +++ b/include/Barrel.php @@ -164,12 +164,14 @@ class Diogenes_Barrel $homepage = mysql_insert_id(); $globals->db->query("update {$alias}_page set location='',title='Home',perms='public' where PID='$homepage'"); - /* create home page & copy CSS template */ + /* create home page */ $rcs = new $globals->rcs($caller,$alias,$_SESSION['session']->username,true); $rcs->newdir("",$homepage); $rcs->commit($homepage,$globals->htmlfile,""); - $rcs->commit($homepage,$globals->cssfile, - file_get_contents("{$globals->root}/{$globals->cssfile}") ); + + /* copy CSS template */ + $def_css = file_get_contents("{$globals->root}/styles/{$globals->barrel_style_sheet}.css"); + $rcs->commit($homepage,$globals->cssfile, $def_css); } @@ -271,7 +273,33 @@ class Diogenes_Barrel return $this->flags->hasFlag($flag); } - + + /** Create a page with the given path, and return its PID. + * + * @param $path + */ + function makePath($path, &$caller) + { + $pathbits = split("/", $path); + $curpath = ''; + $curpid = $this->getPID($curpath);; + foreach ($pathbits as $pathbit) + { + $newpath = ($curpath ? "$curpath/" : "") . $pathbit; + $newpid = $this->getPID($newpath); + if (!$newpid) + { + $tpage = new Diogenes_Barrel_Page($this, array('parent' => $curpid, 'location' => $pathbit)); + $tpage->toDb(0, $caller); + $newpid = $this->getPID($newpath); + } + $curpath = $newpath; + $curpid = $newpid; + } + return $curpid; + } + + /** Compile the directory tree */ function compileTree()