Skip to content

Commit

Permalink
Fixes some container issues, nested container display anomaly, and a …
Browse files Browse the repository at this point in the history
…problem where nested containers wouldn't seem to update a change in their view, also fixes a bad call to $this in old school modules (since they don't instantiate) [#629 state:resolved responsible:dleffler milestone:2.1.1]
  • Loading branch information
dleffler committed Dec 12, 2012
1 parent 822e251 commit c39b13b
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 56 deletions.
4 changes: 2 additions & 2 deletions framework/core/subsystems/expSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ public static function clearCurrentUserSessionCache($modules = null) {
foreach ($modules as $mod){
if (isset($_SESSION[SYS_SESSION_KEY]['cache'][$mod])) unset($_SESSION[SYS_SESSION_KEY]['cache'][$mod]);
}
}else{
} else {
if (isset($_SESSION[SYS_SESSION_KEY]['cache'][$modules])) unset($_SESSION[SYS_SESSION_KEY]['cache'][$modules]);
}
}else{
} else {
if (isset($_SESSION[SYS_SESSION_KEY]['cache'])) unset($_SESSION[SYS_SESSION_KEY]['cache']);
}
}
Expand Down
2 changes: 1 addition & 1 deletion framework/modules-1/calendarmodule/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/** @define "BASE" "../../.." */

class calendarmodule {
function name() { return $this->displayname(); }
function name() { return self::displayname(); }
static function displayname() { return 'Calendar (Deprecated)'; }
static function author() { return 'OIC Group, Inc'; }
static function description() { return 'Allows posting of content to a calendar.'; }
Expand Down
2 changes: 1 addition & 1 deletion framework/modules-1/containermodule/actions/save.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
$container = container::update($_POST,$container,$loc);

if (isset($container->id)) {
$db->updateObject($container,"container");
$ret = $db->updateObject($container,"container");
} else {
$db->insertObject($container,"container");
}
Expand Down
12 changes: 5 additions & 7 deletions framework/modules-1/containermodule/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class containermodule {
function name() {
return $this->displayname();
return self::displayname();
}

static function displayname() {
Expand Down Expand Up @@ -97,10 +97,10 @@ static function show($view, $loc = null, $title = '') {
$container = null;
$container_key = serialize($loc);
$cache = expSession::getCacheValue('containermodule');
if (!isset($this) || !isset($this->_hasParent) || $this->_hasParent == 0) {
// if (!isset($this) || !isset($this->_hasParent) || $this->_hasParent == 0) {
// Top level container.
if (!isset($cache['top'][$container_key])) {
$container = $db->selectObject('container', "external='" . serialize(null) . "' AND internal='" . $container_key . "'");
$container = $db->selectObject('container', "internal='" . $container_key . "'");
//if container isn't here already, then create it.
if ($container == null) {
$container = new stdClass();
Expand All @@ -117,7 +117,7 @@ static function show($view, $loc = null, $title = '') {
}
if (!defined('PREVIEW_READONLY') || defined('SELECTOR')) $view = empty($container->view) ? $view : $container->view;
// $title = $container->title;
}
// } else flash('error','container $this is set');
$container->scope = empty($module_scope[$loc->src]["containermodule"]->scope) ? '' : $module_scope[$loc->src]["containermodule"]->scope;

$template = new template('containermodule', $view, $loc, $cache);
Expand Down Expand Up @@ -156,12 +156,10 @@ static function show($view, $loc = null, $title = '') {
ob_start();
$mod->_hasParent = 1;
if ($iscontroller) {
// renderAction(array('controller'=>$location->mod, 'action'=>$containers[$i]->action, 'src'=>$location->src, 'view'=>$containers[$i]->view, 'moduletitle'=>$containers[$i]->title));
renderAction(array('controller' => expModules::getControllerName($location->mod), 'action' => $containers[$i]->action, 'src' => $location->src, 'view' => $containers[$i]->view, 'moduletitle' => $containers[$i]->title));
} else {
$mod->show($containers[$i]->view, $location, $containers[$i]->title);
}

$containers[$i]->output = trim(ob_get_contents());
ob_end_clean();

Expand Down Expand Up @@ -211,7 +209,7 @@ static function show($view, $loc = null, $title = '') {

$template->assign('user', $user);
$template->assign('containers', $containers);
$template->assign('hasParent', (isset($this) && isset($this->_hasParent) ? 1 : 0));
// $template->assign('hasParent', (isset($this) && isset($this->_hasParent) ? 1 : 0));
$template->register_permissions(
array('manage', 'create', 'edit', 'delete', 'configure'),
$loc
Expand Down
86 changes: 44 additions & 42 deletions framework/modules-1/containermodule/views/Default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@
*}

{permissions}
{if ($permissions.manage == 1 || $permissions.edit == 1 || $permissions.delete == 1 || $permissions.create == 1 || $permissions.configure == 1
|| $container->permissions.manage == 1 || $container->permissions.edit == 1 || $container->permissions.delete == 1 || $container->permissions.configure == 1)}
{$mainNeedsClosing=1}

{css unique="container-chrome" link=$smarty.const.PATH_RELATIVE|cat:'framework/modules/container/assets/css/admin-container.css'}
{if $top->external == 'N;'}
{if ($permissions.manage == 1 || $permissions.edit == 1 || $permissions.delete == 1 || $permissions.create == 1 || $permissions.configure == 1
|| $container->permissions.manage == 1 || $container->permissions.edit == 1 || $container->permissions.delete == 1 || $container->permissions.configure == 1)}
{$mainNeedsClosing=1}

{/css}
{script yui3mods="1" unique="container-chrome" src="`$smarty.const.JS_RELATIVE`exp-container.js"}
{css unique="container-chrome" link=$smarty.const.PATH_RELATIVE|cat:'framework/modules/container/assets/css/admin-container.css'}

{/script}
<div id="cont{$top->id}" class="exp-container-module-wrapper"{if $hasParent != 0} style="border: 1px dashed darkgray; padding: 1em;"{/if}>
{/if}
{*if $hasParent == 0 && ($permissions.edit || $permissions.create || $permissions.delete || $permissions.order_module || $permissions.manage)*}
{if $hasParent == 0 && ($permissions.configure == 1 || $container->permissions.configure == 1)}
{** top level container module **}
<div class="container-chrome">
<a href="#" class="trigger" title="Container">{'Container'|gettext} ({if $top->scope == 'top-sectional'}{'Top'|gettext}{else}{$top->scope|gettext}{/if})</a>
<ul class="container-menu">
{if $user->isAdmin()}
<li><a href="{link _common=1 action=userperms}" class="user">{"User Permissions"|gettext}</a></li>
<li><a href="{link _common=1 action=groupperms}" class="group">{"Group Permissions"|gettext}</a></li>
{/if}
{capture name=rerank}{ddrerank module="container" where="external='`$containers[0]->external`'" label="Modules"|gettext}{/capture}
{if $smarty.capture.rerank != ""}<li>{$smarty.capture.rerank}</li>{/if}
{if $smarty.const.HELP_ACTIVE}<li>{help text="Help with Containers"|gettext}</li>{/if}
</ul>
</div>
{/if}
{/css}
{script yui3mods="1" unique="container-chrome" src="`$smarty.const.JS_RELATIVE`exp-container.js"}

{/script}
<div id="cont{$top->id}" class="exp-container-module-wrapper"{if $container->hasParent != 0} style="border: 1px dashed darkgray; padding: 1em;"{/if}>
{/if}
{*if $hasParent == 0 && ($permissions.edit || $permissions.create || $permissions.delete || $permissions.order_module || $permissions.manage)*}
{if $container->hasParent == 0 && ($permissions.configure == 1 || $container->permissions.configure == 1)}
{** top level container module **}
<div class="container-chrome">
<a href="#" class="trigger" title="Container">{'Container'|gettext} ({if $top->scope == 'top-sectional'}{'Top'|gettext}{else}{$top->scope|gettext}{/if})</a>
<ul class="container-menu">
{if $user->isAdmin()}
<li><a href="{link _common=1 action=userperms}" class="user">{"User Permissions"|gettext}</a></li>
<li><a href="{link _common=1 action=groupperms}" class="group">{"Group Permissions"|gettext}</a></li>
{/if}
{capture name=rerank}{ddrerank module="container" where="external='`$containers[0]->external`'" label="Modules"|gettext}{/capture}
{if $smarty.capture.rerank != ""}<li>{$smarty.capture.rerank}</li>{/if}
{if $smarty.const.HELP_ACTIVE}<li>{help text="Help with Containers"|gettext}</li>{/if}
</ul>
</div>
{/if}
{/if}
{if $permissions.create == 1 && empty($hidebox)}
<a class="addmodule" href="{link action=edit rerank=1 rank=0}"><span class="addtext">{"Add Module"|gettext}</span></a>
{/if}
Expand All @@ -68,23 +70,23 @@
{/script}

<div id="module{$container->id}" class="exp-container-module-wrapper">
{if $i == $containers|@count}
{$last=true}
{else}
{$last=false}
{/if}
<div class="container-chrome module-chrome">
<a href="#" class="trigger" title="{$container->info.module|gettext}">{$container->info.module|gettext}</a>
{nocache}{getchromemenu module=$container rank=$i rerank=$rerank last=$last}{/nocache}
</div>
{/if}
{/permissions}

{$container->output}
{if $i == $containers|@count}
{$last=true}
{else}
{$last=false}
{/if}
<div class="container-chrome module-chrome">
<a href="#" class="trigger" title="{$container->info.module|gettext}">{$container->info.module|gettext}</a>
{nocache}{getchromemenu module=$container rank=$i rerank=$rerank last=$last}{/nocache}
</div>
{/if}
{/permissions}

{permissions}
{if ($permissions.manage == 1 || $permissions.edit == 1 || $permissions.delete == 1 || $permissions.create == 1 || $permissions.configure == 1
|| $container->permissions.manage == 1 || $container->permissions.edit == 1 || $container->permissions.delete == 1 || $container->permissions.configure == 1)}
{$container->output}

{permissions}
{if ($permissions.manage == 1 || $permissions.edit == 1 || $permissions.delete == 1 || $permissions.create == 1 || $permissions.configure == 1
|| $container->permissions.manage == 1 || $container->permissions.edit == 1 || $container->permissions.delete == 1 || $container->permissions.configure == 1)}
</div>
{/if}
{/permissions}
Expand Down
2 changes: 1 addition & 1 deletion framework/modules-1/containermodule/views/_container.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div id="module{$container->id}" class="exp-container-module-wrapper">
<div class="container-chrome module-chrome">
<a href="#" class="trigger" title="{$container->info.module|gettext}">{$container->info.module|gettext}</a>
{nocache}{getchromemenu module=$container rank=$i rerank=$rerank last=$last}{/nocache}
{nocache}{getchromemenu module=$container rank=$i rerank=$rerank last=$last}{/nocache}
</div>
{/if}
{/permissions}
Expand Down
2 changes: 1 addition & 1 deletion framework/modules-1/formmodule/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/** @define "BASE" "../../.." */

class formmodule {
function name() { return $this->displayname(); }
function name() { return self::displayname(); }
static function displayname() { return gt('Form'); } //for forwards compat with new modules
static function description() { return gt('Allows the creation of forms that can be emailed and/or stored in the database.'); }
static function author() { return 'OIC Group, Inc'; }
Expand Down
2 changes: 1 addition & 1 deletion framework/modules-1/navigationmodule/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/** @define "BASE" "../../.." */

class navigationmodule {
function name() { return $this->displayname(); }
function name() { return self::displayname(); }
static function displayname() { return 'Navigator (Deprecated)'; }
static function author() { return 'OIC Group, Inc'; }
static function description() { return 'Allows users to navigate through pages on the site, and allows Administrators to manage the site page structure / hierarchy.'; }
Expand Down

0 comments on commit c39b13b

Please sign in to comment.