4711e7586cf14ca3437aa0658f7c2bb6d1640369

Author: gwoo

Date: 2009-12-15 20:57:25 -0800

intial merge of some cake 1.3-alpha compatibility changes along with some other fixes

diff --cc controllers/commits_controller.php index 108b469,ec2be6e..04cb460 --- a/controllers/commits_controller.php +++ b/controllers/commits_controller.php @@@ -99,24 -58,9 +92,14 @@@ class CommitsController extends AppCont $this->set(compact('commits', 'branches', 'args', 'current')); } + /** + * undocumented function + * + * @return void + */ function history() { $args = func_get_args(); - if ($this->Project->Repo->type == 'git') { - if (empty($args)) { - $this->Project->Repo->branch('master', true); - } else { - array_shift($args); - } - } - $Source = ClassRegistry::init('Source'); - list($args, $path, $current) = $Source->initialize($this->Project->Repo, $args); $this->paginate = array_merge(array('path' => $path, 'branch' => $args[1]), $this->paginate); $commits = $this->paginate($this->Project->Repo); diff --cc controllers/source_controller.php index 85e637f,c8b23cf..339c206 --- a/controllers/source_controller.php +++ b/controllers/source_controller.php @@@ -76,15 -73,15 +76,15 @@@ class SourceController extends AppContr list($args, $path, $current) = $this->Source->initialize($this->Project->Repo, $args); $data = $this->Source->read($path); -- -- $this->set('title_for_layout', $current); ++ $title = $current; ++ if (!empty($args)) { -- $this->set('title_for_layout', join('/', $args) . '/' . $current); ++ $title = join('/', $args) . '/' . $current); } -- ++ $this->set('title_for_layout', $title); ++ $branch = $this->Project->Repo->branch; $this->set(compact('data', 'path', 'args', 'current', 'branch')); -- $this->render('index'); } diff --cc controllers/tickets_controller.php index 4fb8818,ea2bce8..0dd9c2d --- a/controllers/tickets_controller.php +++ b/controllers/tickets_controller.php @@@ -13,54 -16,23 +13,48 @@@ */ class TicketsController extends AppController { + /** + * undocumented variable + * + * @var string + */ var $name = 'Tickets'; + /** + * undocumented variable + * + * @var string + */ var $helpers = array('Time'); + /** + * undocumented variable + * + * @var string + */ var $paginate = array('order' => array('Ticket.number' => 'desc')); + /** + * undocumented variable + * + * @var string + */ var $components = array( 'Gpr' => array( - 'keys' => array('type', 'priority'), + 'keys' => array('status', 'type', 'priority'), 'connect' => array('status', 'page', 'user', 'type', 'priority'), 'actions' => array('index') ) ); + /** + * undocumented function + * + * @return void + */ function index() { - $conditions = array( - 'Ticket.project_id' => $this->Project->id, - ); - $conditions = array_merge($conditions, (array)$this->postConditions($this->data, '=', 'AND', true)); -- $this->set('title_for_layout', 'Tickets/Status/'); - ++ $title = 'Tickets/Status/'; $current = $status = $type = $user = null; - $isDefault = empty($this->passedArgs); if ($isDefault) { @@@ -82,7 -60,7 +82,7 @@@ $user = $this->passedArgs['user']; $current = $this->passedArgs['user']; $conditions['Owner.username'] = $this->passedArgs['user']; -- $this->set('title_for_layout', 'Tickets/User/'); ++ $title = 'Tickets/User/'; } if (!empty($this->passedArgs['type']) && $this->passedArgs['type'] != 'all') { @@@ -96,13 -75,13 +97,15 @@@ )); } */ - $this->pageTitle .= Inflector::humanize($current); - $this->viewVars['title_for_layout'] .= Inflector::humanize($current); ++ $title .= Inflector::humanize($current); $this->Ticket->recursive = 0; $tickets = $this->paginate('Ticket', $conditions); $this->Session->write('Ticket.back', '/' . $this->params['url']['url']); ++ ++ $this->set('title_for_layout', $title); $this->set(compact('current', 'status', 'type', 'user', 'tickets')); $this->_ticketInfo(false); } diff --cc plugins/repo/models/repo.php index 8bb8b76,1bbd392..e213c63 --- a/plugins/repo/models/repo.php +++ b/plugins/repo/models/repo.php @@@ -392,4 -386,4 +392,6 @@@ class Repo extends Overloadable function _credentials() { return null; } - } + } ++ ++?> diff --cc tests/cases/models/project.test.php index d4f8dfc,1f0350c..874f88b --- a/tests/cases/models/project.test.php +++ b/tests/cases/models/project.test.php @@@ -698,4 -692,4 +698,5 @@@ class ProjectTestCase extends CakeTestC @unlink($path . 'permissions.ini'); } } -?> ++ +?> diff --cc vendors/shells/git_shell.php index 567c6a0,58cc6d4..2c9fd95 --- a/vendors/shells/git_shell.php +++ b/vendors/shells/git_shell.php @@@ -88,11 -81,70 +88,11 @@@ class GitShellShell extends Shell return $result; } -/** - * undocumented function - * - * @return void - * - **/ - function sync() { - $project = $this->args[0]; - $fork = @$this->args[1]; - - $this->args[] = 'git_shell'; - //CakeLog::write(LOG_INFO, $this->args); - - if ($this->Project->initialize(compact('project', 'fork')) === false || $this->Project->current['url'] !== $project) { - $this->err('Invalid Project'); - return false; - } - - if ($this->Project->Repo->type !== 'git') { - $this->err('Invalid Repo. Check that you supplied the correct project'); - return false; - } - - $this->out('This may take a while...'); - $this->out('First we start by getting all the previous revisions.'); - - $data = array_reverse($this->Project->Repo->find('all')); - - if (!empty($data)) { - - $this->out('Now we can sync up the timeline.'); - - $this->Commit->deleteAll(array('Commit.project_id' => $this->Project->id)); - - $results = false; - foreach ($data as $revision) { - - if (!empty($revision['Repo']['revision'])) { - - $revision['Repo']['project_id'] = $this->Project->id; - $this->Commit->create($revision['Repo']); - if ($this->Commit->save()) { - $this->out("Commit: {$revision['Repo']['revision']} synced."); - $results = true; - } - sleep(1); - } - } - } - - if (!empty($results)) { - $this->out('Sync complete'); - exit(); - } - $this->err('Nothing was synced'); - return false; - - } -/** - * undocumented function - * - * @return void - * - **/ + /** + * undocumented function + * + * @return void + */ function _welcome() {} - } + } diff --cc vendors/shells/svn_shell.php index de27bdd,81e4f1c..b1d1437 --- a/vendors/shells/svn_shell.php +++ b/vendors/shells/svn_shell.php @@@ -52,11 -50,63 +52,11 @@@ class SvnShellShell extends Shell passthru("svnserve -t -r {$path}repo --tunnel-user " . $this->params['user'], $result); return $result; } -/** - * undocumented function - * - * @return void - * - **/ - function sync() { - $project = $this->args[0]; - $fork = @$this->args[1]; - - if ($this->Project->initialize(compact('project', 'fork')) === false || $this->Project->current['url'] !== $project) { - $this->err('Invalid Project'); - return false; - } - - if ($this->Project->Repo->type !== 'svn') { - $this->err('Invalid Repo. Check that you supplied the correct project'); - return false; - } - $this->out('This may take a while...'); - $this->out('First we start by getting all the previous revisions.'); - - $data = array_reverse($this->Project->Repo->find()); - - if (!empty($data)) { - - $this->out('Now we can sync up the timeline.'); - - $this->Commit->deleteAll(array('Commit.project_id' => $this->Project->id)); - - $results = false; - foreach ($data as $revision) { - - $revision['Repo']['project_id'] = $this->Project->id; - - $this->Commit->create($revision['Repo']); - if ($this->Commit->save()) { - $this->out("Commit: {$revision['Repo']['revision']} synced."); - $results = true; - } - sleep(1); - } - } - - if (!empty($results)) { - $this->out('Sync complete'); - exit(); - } - $this->err('Nothing was synced'); - return false; - } -/** - * undocumented function - * - * @return void - * - **/ + /** + * undocumented function + * + * @return void + */ function _welcome() {} - } + } diff --cc views/helpers/chaw.php index d8bb429,5f226fb..9b16026 --- a/views/helpers/chaw.php +++ b/views/helpers/chaw.php @@@ -216,15 -207,16 +216,18 @@@ class ChawHelper extends AppHelper $base = str_replace("//", "/", $this->base . '/' . $fork . $params['project'] . '/'); return $base; } -/** - * Display breadcrumbs for using data from Wiki - * - * @param string $path the wiki path - * @param string $slug the wiki page name - * @return string - */ + + /** + * Display breadcrumbs for using data from Wiki + * + * @param string $path the wiki path + * @param string $slug the wiki page name ++ * @param array $options + * @return string + */ - function breadcrumbs($path, $slug = null) { + function breadcrumbs($path, $slug = null, $options = array()) { + $defaults = array('separator' => ' > ', 'ending' => ' . '); + $options += $defaults; $out = array(); $parts = array_filter(explode('/', $path)); @@@ -244,21 -236,22 +247,23 @@@ if ($slug) { $out[] = $slug; - $parts[] = $slug; + if ($path == '/') { + $parts[] = $slug; + } $parts['action'] = 'index'; $parts['ext'] = 'rss'; - $rss = ' . ' . $this->rss($path, $parts); + $rss = $options['ending'] . $this->rss($path, $parts); } - return join(' > ', $out) . $rss; + return join($options['separator'], $out) . $rss; } -/** - * Displays feed-icon.png and links to $url - * - * @param string $title - * @param array $url - * @return string - */ + + /** + * Displays feed-icon.png and links to $url + * + * @param string $title + * @param array $url + * @return string + */ function rss($title, $url) { return $this->Html->link( $this->Html->image('feed-icon.png', array(