コード例 #1
0
 public function componentLeftmenu()
 {
     $this->show_article_options = (bool) ($this->article instanceof TBGWikiArticle);
     $this->links_target_id = TBGContext::isProjectContext() ? TBGContext::getCurrentProject()->getID() : 0;
     $this->links = TBGPublish::getModule()->getMenuItems($this->links_target_id);
     $this->user_drafts = TBGPublish::getModule()->getUserDrafts();
 }
コード例 #2
0
 public function do_execute()
 {
     $this->cliEcho("Importing articles ... \n", 'white', 'bold');
     TBGEvent::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated'));
     $overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes');
     TBGPublish::getModule()->loadFixturesArticles(TBGContext::getScope()->getID(), $overwrite);
 }
コード例 #3
0
					<?php 
include_template('main/textarea', array('area_name' => 'article_content', 'target_type' => 'article', 'target_id' => $article->getID(), 'area_id' => 'article_content', 'syntax' => $article->getContentSyntax(), 'markuppable' => !($article->getContentSyntax(true) == TBGSettings::SYNTAX_PT), 'width' => '100%', 'value' => htmlspecialchars($article->getContent())));
?>
				</div>
				<div id="change_reason_container" class="fullpage_backdrop" style="display: none;">
					<div class="backdrop_box large">
						<div class="backdrop_detail_header"><?php 
echo __('Saving article');
?>
</div>
						<div class="backdrop_detail_content">
							<label for="change_reason" style="margin-left: 5px; clear: both;"><?php 
echo __('Change reason');
?>
								<?php 
if (TBGPublish::getModule()->getSetting('require_change_reason') == 0) {
    ?>
									&nbsp;&nbsp;<span class="faded_out" style="font-weight: normal; font-size: 0.9em;"><?php 
    echo __('Optional');
    ?>
</span>
								<?php 
}
?>
							</label><br>
							<div style="margin: 5px 15px 5px 5px;">
								<input type="text" name="change_reason" id="change_reason" maxlength="255" value="<?php 
if (isset($change_reason)) {
    echo $change_reason;
}
?>
コード例 #4
0
<?php

$article_name = isset($article_name) ? $article_name : '';
if (!TBGContext::isProjectContext() || TBGContext::isProjectContext() && mb_strtolower($article_name) != mb_strtolower(TBGContext::getCurrentProject()->getKey() . ':mainpage')) {
    if (TBGContext::isProjectContext()) {
        $tbg_response->addBreadcrumb(TBGPublish::getModule()->getMenuTitle(), make_url('publish_article', array('article_name' => TBGContext::getCurrentProject()->getKey() . ':MainPage')), tbg_get_breadcrumblinks('project_summary', TBGContext::getCurrentProject()));
    } else {
        $tbg_response->addBreadcrumb(TBGPublish::getModule()->getMenuTitle(), make_url('publish_article', array('article_name' => 'MainPage')), tbg_get_breadcrumblinks('main_links'));
    }
    $items = explode(':', $article_name);
    $bcpath = array_shift($items);
    if (mb_strtolower($bcpath) == 'category') {
        $tbg_response->addBreadcrumb(__('Categories'));
        if (TBGContext::isProjectContext()) {
            $bcpath .= ":" . array_shift($items);
        }
    } elseif (!TBGContext::isProjectContext() && mb_strtolower($bcpath) != 'mainpage') {
        $tbg_response->addBreadcrumb($bcpath, make_url('publish_article', array('article_name' => $bcpath)));
    }
    foreach ($items as $bc_name) {
        $bcpath .= ":" . $bc_name;
        $tbg_response->addBreadcrumb($bc_name, make_url('publish_article', array('article_name' => $bcpath)));
    }
} else {
    $tbg_response->addBreadcrumb(TBGPublish::getModule()->getMenuTitle(), make_url('publish_article', array('article_name' => TBGContext::getCurrentProject()->getKey() . ':MainPage')), tbg_get_breadcrumblinks('project_summary', TBGContext::getCurrentProject()));
}
コード例 #5
0
ファイル: publish.inc.php プロジェクト: oparoz/thebuggenie
function get_spaced_name($camelcased)
{
    return TBGPublish::getModule()->getSpacedName($camelcased);
}
コード例 #6
0
ファイル: actions.class.php プロジェクト: oparoz/thebuggenie
 /**
  * Show an article
  *
  * @param TBGRequest $request
  */
 public function runEditArticle(TBGRequest $request)
 {
     if (!$this->article->canEdit()) {
         TBGContext::setMessage('publish_article_error', TBGContext::getI18n()->__('You do not have permission to edit this article'));
         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $this->article_name)));
     }
     $this->article_route = $this->article->getID() ? 'publish_article_edit' : 'publish_article_new';
     $this->article_route_params = $this->article->getID() ? array('article_name' => $this->article_name) : array();
     if ($request->isPost()) {
         $this->preview = (bool) $request['preview'];
         $this->change_reason = $request['change_reason'];
         try {
             $this->article->setArticleType($request['article_type']);
             $this->article->setName($request['new_article_name']);
             $this->article->setParentArticle(TBGArticlesTable::getTable()->getArticleByName($request['parent_article_name']));
             $this->article->setManualName($request['manual_name']);
             if ($this->article->getArticleType() == TBGWikiArticle::TYPE_MANUAL && !$this->article->getName()) {
                 $article_name_prefix = $this->article->getParentArticle() instanceof TBGWikiArticle ? $this->article->getParentArticle()->getName() . ':' : $request['parent_article_name'];
                 $this->article->setName(str_replace(' ', '', $article_name_prefix . $this->article->getManualName()));
             }
             $this->article->setContentSyntax($request['article_content_syntax']);
             $this->article->setContent($request->getRawParameter('article_content'));
             if (!$this->article->getName() || trim($this->article->getName()) == '' || !preg_match('/[\\w:]+/i', $this->article->getName())) {
                 throw new Exception(TBGContext::getI18n()->__('You need to specify a valid article name'));
             }
             if ($request['article_type'] == TBGWikiArticle::TYPE_MANUAL && (!$this->article->getManualName() || trim($this->article->getManualName()) == '' || !preg_match('/[\\w:]+/i', $this->article->getManualName()))) {
                 throw new Exception(TBGContext::getI18n()->__('You need to specify a valid article name'));
             }
             if (TBGPublish::getModule()->getSetting('require_change_reason') == 1 && (!$this->change_reason || trim($this->change_reason) == '')) {
                 throw new Exception(TBGContext::getI18n()->__('You have to provide a reason for the changes'));
             }
             if ($this->article->getLastUpdatedDate() != $request['last_modified']) {
                 throw new Exception(TBGContext::getI18n()->__('The file has been modified since you last opened it'));
             }
             if (($article = TBGWikiArticle::getByName($request['new_new_article_name'])) && $article instanceof TBGWikiArticle && $article->getID() != $request['article_id']) {
                 throw new Exception(TBGContext::getI18n()->__('An article with that name already exists. Please choose a different article name'));
             }
             if (!$this->preview) {
                 $this->article->doSave(array(), $request['change_reason']);
                 TBGContext::setMessage('publish_article_message', TBGContext::getI18n()->__('The article was saved'));
                 $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $this->article->getName())));
             }
         } catch (Exception $e) {
             $this->error = $e->getMessage();
         }
     }
 }