Example #1
0
 public function __construct($repositoryPath)
 {
     $pathString = $repositoryPath;
     if (!StringUtils::startsWith($pathString, '/')) {
         throw new \Exception('Repository Path must be absolute');
     }
     if (!StringUtils::endsWith($pathString, '/')) {
         $pathString .= '/';
     }
     $this->repositoryPath = DirectoryPath::parse($pathString);
 }
Example #2
0
 /**
  * @param Request       $request
  * @param DirectoryPath $path
  *
  * @return Response
  */
 public function addFolderAction(Request $request, DirectoryPath $path)
 {
     $this->assertRole('ROLE_COMMITTER');
     $path = DirectoryPath::parse($path);
     $form = $this->createFormBuilder()->add('title', 'text', array('label' => 'Title', 'required' => true))->add('dirname', 'text', array('label' => 'Foldername', 'required' => true))->add('create', 'submit')->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted()) {
         if ($form->isValid()) {
             $title = $form->get('title')->getData();
             $dirname = $form->get('dirname')->getData();
             $subDirPath = $path->appendDirectory($dirname);
             $this->getWikiService()->createFolder($subDirPath);
             return $this->redirect($this->generateUrl('ddr_gitki_wiki_directory', array('path' => $subDirPath->toAbsoluteUrlString())));
         }
     }
     return $this->render('DdrGitkiBaseBundle:Wiki:directory.addFolder.html.twig', array('form' => $form->createView(), 'path' => $path));
 }
Example #3
0
 public function __construct($basePath, $currentDirectoryPath, $relativeDirectoryPath)
 {
     parent::__construct($basePath . $currentDirectoryPath . $relativeDirectoryPath);
     $this->absolutePath = DirectoryPath::parse($currentDirectoryPath . $relativeDirectoryPath);
     $this->relativePath = DirectoryPath::parse($relativeDirectoryPath);
 }