Skip to content

Commit

Permalink
Should fix problem with 'show' views NOT getting the module configura…
Browse files Browse the repository at this point in the history
…tion settings which prevented showing of attached files, etc..., also changes news module to use 'show' instead of 'showByTitle' since 'show' now works with passed titles [#616 state:resolved milestone:2.0.7]
  • Loading branch information
dleffler committed May 24, 2012
1 parent 6300909 commit 8f9a7bd
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 30 deletions.
6 changes: 5 additions & 1 deletion framework/core/controllers/expController.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public function tags() {
* default view for individual item
*/
function show() {
global $db;

expHistory::set('viewable', $this->params);
$modelname = $this->basemodel_name;

Expand All @@ -295,7 +297,9 @@ function show() {
}

$record = new $modelname($id);
assign_to_template(array('record'=>$record));
$config = expUnserialize($db->selectValue('expConfigs','config',"location_data='".$record->location_data."'"));

assign_to_template(array('record'=>$record,'config'=>$config));
}

/**
Expand Down
10 changes: 5 additions & 5 deletions framework/core/expFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,7 @@ function renderAction(array $parms=array()) {
}
}

// run the action
$controller->$action();

//register this controllers permissions to the view for in view perm checks
// register this controllers permissions to the view for in view perm checks
$template->register_permissions(array_keys($perms), $controller->loc);

// pass this controllers config off to the view
Expand All @@ -357,9 +354,12 @@ function renderAction(array $parms=array()) {
// globalizing $user inside all templates
$template->assign('user', $user);

//assign the controllers basemodel to the view
// assign the controllers basemodel to the view
$template->assign('modelname', $controller->basemodel_name);

// lastly, run the action which can also override the above assignments
$controller->$action();

if (empty($parms['no_output'])) {
$template->output();
} else {
Expand Down
15 changes: 5 additions & 10 deletions framework/core/subsystems/expRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,33 +316,28 @@ public function routePageRequest() {
//if section is empty, we'll look for the page overrides first and route to
//routeActionRequest with some hand wacked variables. If we can't find an override
//then we'll return false as usual
if (empty($section))
{
if (empty($section)) {
$sef_url = $this->url_parts[0];
//check for a category
$c = new storeCategory();
$cat = $c->findBy('sef_url', $sef_url);
if (empty($cat))
{
if (empty($cat)) {
//check for a product
$p = new product();
$prod = $p->findBy('sef_url', $sef_url);
if(!empty($prod))
{
if(!empty($prod)) {
//fake parts and route to action
$this->url_type = 'action';
$this->url_parts[0] = 'store'; //controller
$this->url_parts[1] = 'showByTitle'; //controller
$this->url_parts[2] = 'title'; //controller
$this->url_parts[2] = 'title'; //controller
$this->url_parts[3] = $sef_url; //controller
//eDebug($this->url_parts,true);
$this->params = $this->convertPartsToParams();
return $this->routeActionRequest();
}
//else fall through
}
else
{
} else {
//fake parts and route to action
$this->url_type = 'action';
$this->url_parts[0] = 'store'; //controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/**
* Date/Time Control w/ Popup Date Picker and time w/ am/pm combo
* text entry date and/or time w/ pop-up date selector
*
* @package Subsystems-Forms
* @subpackage Control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/**
* Date Time Control
* simple text entry date and/or time
*
* @package Subsystems-Forms
* @subpackage Control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/**
* YUI Date Picker Control
* standard calendar control w/o time
*
* @package Subsystems-Forms
* @subpackage Control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/**
* YUI Date/Time Control
* uses/combines yuicalendarcontrol & datetimecontrol
* uses/combines yuicalendarcontrol & datetimecontrol (w/o date)
*
* @package Subsystems-Forms
* @subpackage Control
Expand Down
8 changes: 5 additions & 3 deletions framework/modules/blog/controllers/blogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public function showall_by_author() {
}

public function show() {
global $template;
global $db, $template;

expHistory::set('viewable', $this->params);
$id = isset($this->params['title']) ? $this->params['title'] : $this->params['id'];
$blog = new blog($id);
Expand All @@ -156,8 +157,9 @@ public function show() {
// some of the links (tags in particular) require a source, we will
// populate the location data in the template now.
$loc = expUnserialize($blog->location_data);

assign_to_template(array('__loc'=>$loc,'record'=>$blog));
$config = expUnserialize($db->selectValue('expConfigs','config',"location_data='".$blog->location_data."'"));

assign_to_template(array('record'=>$blog,'__loc'=>$loc,'config'=>$config));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion framework/modules/help/controllers/helpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ public function show() {
}
}
$doc = $help->find('first', 'help_version_id='.$version_id.' AND sef_url="'.$this->params['title'].'"');
$config = expUnserialize($db->selectValue('expConfigs','config',"location_data='".$doc->location_data."'"));

assign_to_template(array('doc'=>$doc,"hv"=>$this->help_version));
assign_to_template(array('doc'=>$doc,"hv"=>$this->help_version,'config'=>$config));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion framework/modules/news/controllers/newsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function getRSSContent() {
foreach ($items as $key => $item) {
$rss_item = new FeedItem();
$rss_item->title = $item->title;
$rss_item->link = makeLink(array('controller'=>'news', 'action'=>'showByTitle', 'title'=>$item->sef_url));
$rss_item->link = makeLink(array('controller'=>'news', 'action'=>'show', 'title'=>$item->sef_url));
$rss_item->description = $item->body;
$rss_item->author = user::getUserById($item->poster)->firstname.' '.user::getUserById($item->poster)->lastname;
$rss_item->date = date('r',$item->publish_date);
Expand Down
2 changes: 1 addition & 1 deletion framework/modules/news/views/news/edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</div>
<div id="tab2">
{control type="yuidatetimecontrol" name="publish" label="Publish Date"|gettext edit_text="Publish Immediately" value=$record->publish}
{control type="yuidatetimecontrol" name="unpublish" label="Un-Publish Date"|gettext edit_text="Un-Publish Immediately" value=$record->unpublish}
{control type="yuidatetimecontrol" name="unpublish" label="Un-Publish Date"|gettext edit_text="Never Un-Publish" value=$record->unpublish}
</div>
{if $config.filedisplay}
<div id="tab3">
Expand Down
4 changes: 2 additions & 2 deletions framework/modules/news/views/news/showall.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{foreach from=$page->records item=item}
<div class="item">
<h2>
<a href="{if $item->isRss}{$item->rss_link}{else}{link action=showByTitle title=$item->sef_url}{/if}" title="{$item->body|summarize:"html":"para"}">
<a href="{if $item->isRss}{$item->rss_link}{else}{link action=show title=$item->sef_url}{/if}" title="{$item->body|summarize:"html":"para"}">
{$item->title}
</a>
</h2>
Expand Down Expand Up @@ -83,7 +83,7 @@
{if $config.filedisplay == "Downloadable Files"}
{filedisplayer view="`$config.filedisplay`" files=$item->expFile record=$item is_listing=1}
{/if}
<a class="readmore" href="{if $item->isRss}{$item->rss_link}{else}{link action=showByTitle title=$item->sef_url}{/if}">{"Read More"|gettext}</a>
<a class="readmore" href="{if $item->isRss}{$item->rss_link}{else}{link action=show title=$item->sef_url}{/if}">{"Read More"|gettext}</a>
</div>
{clear}
</div>
Expand Down
2 changes: 1 addition & 1 deletion framework/modules/news/views/news/showall_headlines.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{if $smarty.foreach.items.iteration<=$config.headcount || !$config.headcount}

<li>
<a class="link" href="{if $item->isRss}{$item->rss_link}{else}{link action=showByTitle title=$item->sef_url}{/if}" title="{$item->body|summarize:"html":"para"}">
<a class="link" href="{if $item->isRss}{$item->rss_link}{else}{link action=show title=$item->sef_url}{/if}" title="{$item->body|summarize:"html":"para"}">
{$item->title}
</a>

Expand Down
4 changes: 2 additions & 2 deletions framework/modules/news/views/news/showall_recent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{if $smarty.foreach.items.iteration<=$config.headcount || !$config.headcount}
<div class="item">
<h2>
<a href="{if $item->isRss}{$item->rss_link}{else}{link action=showByTitle title=$item->sef_url}{/if}" title="{$item->body|summarize:"html":"para"}">
<a href="{if $item->isRss}{$item->rss_link}{else}{link action=show title=$item->sef_url}{/if}" title="{$item->body|summarize:"html":"para"}">
{$item->title}
</a>
</h2>
Expand Down Expand Up @@ -83,7 +83,7 @@
{if $config.filedisplay == "Downloadable Files"}
{filedisplayer view="`$config.filedisplay`" files=$item->expFile record=$item is_listing=1}
{/if}
<a class="readmore" href="{if $item->isRss}{$item->rss_link}{else}{link action=showByTitle title=$item->sef_url}{/if}">{"Read More"|gettext}</a>
<a class="readmore" href="{if $item->isRss}{$item->rss_link}{else}{link action=show title=$item->sef_url}{/if}">{"Read More"|gettext}</a>
</div>
{clear}
</div>
Expand Down
5 changes: 3 additions & 2 deletions framework/modules/photoalbum/controllers/photosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ function show() {
$where = $where." AND rank=".$maxrank;
$prev = $db->selectValue($this->model_table,'sef_url',$where);
}

assign_to_template(array('record'=>$record,'imgnum'=>$record->rank,'imgtot'=>count($record->find('all',$this->aggregateWhereClause())),"next"=>$next,"previous"=>$prev));
$config = expUnserialize($db->selectValue('expConfigs','config',"location_data='".$record->location_data."'"));

assign_to_template(array('record'=>$record,'imgnum'=>$record->rank,'imgtot'=>count($record->find('all',$this->aggregateWhereClause())),"next"=>$next,"previous"=>$prev,'config'=>$config));
}

public function slideshow() {
Expand Down

0 comments on commit 8f9a7bd

Please sign in to comment.