Skip to content

Commit

Permalink
Merge remote branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
illiphilli committed Mar 18, 2011
2 parents 9130aba + ff806d8 commit baa6faa
Show file tree
Hide file tree
Showing 19 changed files with 187 additions and 164 deletions.
3 changes: 2 additions & 1 deletion datatypes/container.php
Expand Up @@ -47,7 +47,8 @@ function update($values,$object,$loc) {

// Rank is only updateable from the order action
$object->rank = $values['rank'];
if (isset($values['rerank'])) $db->increment("container","rank",1,"external='".serialize($loc)."' AND rank >= " . $values['rank']);
// if (isset($values['rerank'])) $db->increment("container","rank",1,"external='".serialize($loc)."' AND rank >= " . $values['rank']);
if ((isset($values['rerank'])) && ($values['rerank'])) $db->increment("container","rank",1,"external='".serialize($loc)."' AND rank >= " . $values['rank']);
$object->internal = serialize($newInternal);
$object->external = serialize($loc);
}
Expand Down
2 changes: 1 addition & 1 deletion external/ckeditor/ckeditor.js

Large diffs are not rendered by default.

42 changes: 19 additions & 23 deletions framework/modules/migration/controllers/migrationController.php
Expand Up @@ -486,7 +486,6 @@ private function convert($iloc, $module, $hc=0) {
$loc->mod = "text";
$text->location_data = serialize($loc);
$text->body = $ti->text;

$text->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -515,7 +514,6 @@ private function convert($iloc, $module, $hc=0) {
$loc->mod = "text";
$text->location_data = serialize($loc);
$text->body = $ti->text;

$text->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -587,7 +585,6 @@ private function convert($iloc, $module, $hc=0) {
$lnk->poster = 1;
$lnk->editor = 1;
$lnk->location_data = serialize($loc);

$lnk->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -628,7 +625,6 @@ private function convert($iloc, $module, $hc=0) {
$lnk->poster = 1;
$lnk->editor = 1;
$lnk->location_data = serialize($loc);

$lnk->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -670,7 +666,6 @@ private function convert($iloc, $module, $hc=0) {
</p>
';
$text->body = $swfcode;

$text->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -709,10 +704,11 @@ private function convert($iloc, $module, $hc=0) {
$loc = expUnserialize($ni['location_data']);
$loc->mod = "news";
$news->location_data = serialize($loc);
$news->save();
// default is to create with current time
$news->created_at = $ni['posted'];
$news->edited_at = $ni['edited'];

$news->save();
$news->update();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
if (!empty($ni['file_id'])) {
Expand Down Expand Up @@ -748,24 +744,26 @@ private function convert($iloc, $module, $hc=0) {
foreach ($resourceitems as $ri) {
unset($ri['id']);
$filedownload = new filedownload($ri);
$filedownload->makeSefUrl();
// $filedownload->makeSefUrl();
$loc = expUnserialize($ri['location_data']);
$loc->mod = "filedownload";
$filedownload->title = $ri['name'];
$filedownload->body = $ri['description'];
$filedownload->downloads = $ri['num_downloads'];
$filedownload->location_data = serialize($loc);
$filedownload->created_at = $ri['posted'];
$filedownload->edited_at = $ri['edited'];

// $filedownload->created_at = $ri['posted'];
// $filedownload->edited_at = $ri['edited'];
$filedownload->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];

if (!empty($ri['file_id'])) {
$oldfile = $old_db->selectArray('file', 'id='.$ri['file_id']);
$file = new expFile($oldfile);
$filedownload->attachitem($file,'downloadable');
// default is to create with current time
$filedownload->created_at = $ri['posted'];
$filedownload->edited_at = $ri['edited'];
// $filedownload->update();
}
}
}
Expand Down Expand Up @@ -806,7 +804,6 @@ private function convert($iloc, $module, $hc=0) {
$photo->alt = $gi['alt'];
$photo->location_data = serialize($loc);
$photo->makeSefUrl();

$photo->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -849,7 +846,6 @@ private function convert($iloc, $module, $hc=0) {
$photo->makeSefUrl();
// $photo->created_at = $gi['posted'];
// $photo->edited_at = $gi['edited'];

$te = $photo->find('first',"location_data='".$photo->location_data."'");
if (empty($te)) {
$photo->save();
Expand Down Expand Up @@ -887,9 +883,8 @@ private function convert($iloc, $module, $hc=0) {
$headline->location_data = serialize($loc);
$headline->title = $hl->headline;
$headline->poster = 1;
$headline->created_at = time();
$headline->edited_at = time();

// $headline->created_at = time();
// $headline->edited_at = time();
$headline->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -934,10 +929,11 @@ private function convert($iloc, $module, $hc=0) {
$loc = expUnserialize($bi['location_data']);
$loc->mod = "blog";
$post->location_data = serialize($loc);
$post->save();
// default is to create with current time
$post->created_at = $bi['posted'];
$post->edited_at = $bi['edited'];

$post->save();
$post->update();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
if (!empty($bi['file_id'])) {
Expand Down Expand Up @@ -980,7 +976,6 @@ private function convert($iloc, $module, $hc=0) {
$faq->answer = $fqi['answer'];
$faq->rank = $fqi['rank'];
$faq->include_in_faq = 1;

$faq->save();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
Expand Down Expand Up @@ -1012,11 +1007,12 @@ private function convert($iloc, $module, $hc=0) {
$listing->location_data = serialize($loc);
$listing->featured = true;
$listing->poster = 1;
$listing->created_at = time();
$listing->edited_at = time();
$listing->body = "<p>".$li['summary']."</p>".$li['body'];

$listing->save();
// default is to create with current time
$listing->created_at = time();
$listing->edited_at = time();
$listing->update();
@$this->msg['migrated'][$iloc->mod]['count']++;
@$this->msg['migrated'][$iloc->mod]['name'] = $this->new_modules[$iloc->mod];
if (!empty($li['file_id'])) {
Expand Down
Expand Up @@ -49,7 +49,7 @@
{/foreach}
</tbody>
</table>
{control type="checkbox" name="wipe_pages" label="Erase all current pages then import?" value=1 checked=false}
{control type="checkbox" name="wipe_pages" label="Erase all current pages then try again?" value=1 checked=false}
{control type="buttongroup" submit="Migrate Pages" cancel="Cancel"}
{/form}
</div>
Expand Up @@ -19,9 +19,9 @@
<tr class="{cycle values="odd,even"}">
<td>
{if $key == $val.name}
<strong>{$val.count}</strong> record{if $val.count>1}s{/if} from <strong>{$key}</strong> have been migrated as is</strong>
<strong>{$val.count}</strong> record{if $val.count==1}s{/if} from <strong>{$key}</strong> {if $val.count==1}have{else}has{/if} been migrated as is</strong>
{else}
<strong>{$val.count}</strong> record{if $val.count>1}s{/if} from <strong>{$key}</strong> have been migrated to <strong>{$val.name}</strong>
<strong>{$val.count}</strong> record{if $val.count==1}s{/if} from <strong>{$key}</strong> {if $val.count==1}have{else}has{/if} been migrated to <strong>{$val.name}</strong>
{/if}
</td>
</tr>
Expand Down
3 changes: 2 additions & 1 deletion modules/containermodule/actions/delete.php
Expand Up @@ -31,7 +31,8 @@

if (exponent_permissions_check('delete_module',$loc) || exponent_permissions_check('delete_module',$cloc) || exponent_permissions_check('administrate',$iloc)) {

container::delete($container,(isset($_GET['rerank']) ? 1 : 0));
// container::delete($container,(isset($_GET['rerank']) ? 1 : 0));
container::delete($container,(isset($_GET['rerank']) ? $_GET['rerank'] : 0));
$db->delete('container','id='.$container->id);

exponent_sessions_clearAllUsersSessionCache('containermodule');
Expand Down
3 changes: 2 additions & 1 deletion modules/containermodule/actions/edit.php
Expand Up @@ -57,7 +57,8 @@
exponent_sessions_clearAllUsersSessionCache('containermodule');

$template = new template('containermodule','_form_edit',$loc);
$template->assign('rerank', (isset($_GET['rerank']) ? 1 : 0) );
// $template->assign('rerank', (isset($_GET['rerank']) ? 1 : 0) );
$template->assign('rerank', (isset($_GET['rerank']) ? $_GET['rerank'] : 0) );
$template->assign('container',$container);
$template->assign('locref',$locref);
$template->assign('is_edit', (isset($container->id) ? 1 : 0) );
Expand Down
17 changes: 16 additions & 1 deletion modules/containermodule/actions/order.php
Expand Up @@ -20,7 +20,22 @@
if (!defined('EXPONENT')) exit('');

if (exponent_permissions_check('order_modules',$loc)) {
$db->switchValues('container','rank',$_GET['a'],$_GET['b'],"external='".serialize($loc)."'");
// $db->switchValues('container','rank',$_GET['a'],$_GET['b'],"external='".serialize($loc)."'");
$object_a = $db->selectObject('container',"rank='".$_GET['a']."' AND external='".serialize($loc)."'");
$object_b = $db->selectObject('container',"rank='".$_GET['b']."' AND external='".serialize($loc)."'");

if ($object_a && $object_b) {
$db->switchValues('container','rank',$_GET['a'],$_GET['b'],"external='".serialize($loc)."'");
} else {
if ($object_a) {
$object_a->rank = $_GET['b'];
$db->updateObject($object_a,'container');
}
if ($object_b) {
$object_b->rank = $_GET['a'];
$db->updateObject($object_b,'container');
}
}
exponent_sessions_clearAllUsersSessionCache('containermodule');
exponent_flow_redirect();
} else {
Expand Down
95 changes: 42 additions & 53 deletions modules/containermodule/views/Default.tpl
@@ -1,5 +1,5 @@
{*
* Copyright (c) 2004-2006 OIC Group, Inc.
* Copyright (c) 2004-2011 OIC Group, Inc.
* Written and Designed by Phillip Ball (this file anyways :)
*
* This file is part of Exponent
Expand All @@ -14,8 +14,6 @@
*
*}



{permissions}
{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1 || $container->permissions.edit_module == 1 || $container->permissions.delete_module == 1)}
{css unique="container-chrome" link="`$smarty.const.PATH_RELATIVE`framework/modules/container/assets/css/admin-container.css"}
Expand All @@ -28,23 +26,20 @@
{/if}
{/permissions}



{permissions}
{if $hasParent == 0 && ($permissions.edit_module == 1 || $permissions.administrate == 1)}{** top level container module **}
<div class="container-chrome">
<a href="#" class="trigger" title="Container">Container</a>
<ul class="container-menu">
<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>
<li>{help text="Help with Containers"}</li>
</ul>
</div>
{/if}
{if $permissions.add_module == 1 && $hidebox == 0}
<a class="addmodule" href="{link action=edit rerank=1 rank=0}"><span class="addtext">{gettext str="Add Module"}</span></a>
{/if}

{if $hasParent == 0 && ($permissions.edit_module == 1 || $permissions.administrate == 1)}{** top level container module **}
<div class="container-chrome">
<a href="#" class="trigger" title="Container">Container</a>
<ul class="container-menu">
<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>
<li>{help text="Help with Containers"}</li>
</ul>
</div>
{/if}
{if $permissions.add_module == 1 && $hidebox == 0}
<a class="addmodule" href="{link action=edit rerank=1 rank=0}"><span class="addtext">{gettext str="Add Module"}</span></a>
{/if}
{/permissions}

{viewfile module=$singlemodule view=$singleview var=viewfile}
Expand All @@ -56,45 +51,39 @@
{else}
<a name="mod_{$container->id}"></a>
{permissions}
{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1)}
<div id="module{$container->id}" class="exp-container-module-wrapper">

{if $i == $containers|@count}
{assign var=last value=true}
{else}
{assign var=last value=false}
{/if}

<div class="container-chrome module-chrome">
<a href="#" class="trigger" title="{$container->info.module}">{$container->info.module}</a>
{getchromemenu module=$container rank=$i last=$last}
</div>

{/if}
{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1)}
<div id="module{$container->id}" class="exp-container-module-wrapper">
{if $i == $containers|@count}
{assign var=last value=true}
{else}
{assign var=last value=false}
{/if}
<div class="container-chrome module-chrome">
<a href="#" class="trigger" title="{$container->info.module}">{$container->info.module}</a>
{getchromemenu module=$container rank=$i rerank=$rerank last=$last}
</div>
{/if}
{/permissions}

{$container->output}

{permissions level=$smarty.const.UILEVEL_STRUCTURE}
{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1 || $container->permissions.edit_module == 1 || $container->permissions.delete_module == 1)}
</div>
{/if}
{/permissions}
{$container->output}

{permissions level=$smarty.const.UILEVEL_STRUCTURE}
{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1 || $container->permissions.edit_module == 1 || $container->permissions.delete_module == 1)}
</div>
{/if}
{/permissions}

{permissions level=$smarty.const.UILEVEL_STRUCTURE}
{if $permissions.add_module == 1 && $hidebox == 0}
<a class="addmodule" href="{link action=edit rerank=1 rank=$smarty.foreach.c.iteration}"><span class="addtext">{gettext str="Add Module"}</span></a>
{/if}
{/permissions}
{permissions level=$smarty.const.UILEVEL_STRUCTURE}
{if $permissions.add_module == 1 && $hidebox == 0}
<a class="addmodule" href="{link action=edit rerank=1 rank=$smarty.foreach.c.iteration}"><span class="addtext">{gettext str="Add Module"}</span></a>
{/if}
{/permissions}
{/if}
{/foreach}


{permissions level=$smarty.const.UILEVEL_PERMISSIONS}
{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1 || $container->permissions.edit_module == 1 || $container->permissions.delete_module == 1)}
<div style="clear:both"></div>
</div>
{/if}
{/permissions}

{if ($permissions.administrate == 1 || $permissions.edit_module == 1 || $permissions.delete_module == 1 || $permissions.add_module == 1 || $container->permissions.administrate == 1 || $container->permissions.edit_module == 1 || $container->permissions.delete_module == 1)}
<div style="clear:both"></div>
</div>
{/if}
{/permissions}

0 comments on commit baa6faa

Please sign in to comment.