Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Continued building out the journal component
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchisari authored and The Appleseed Project committed Nov 27, 2010
1 parent 6453d78 commit c623363
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 10 deletions.
57 changes: 53 additions & 4 deletions components/journal/controllers/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function Display ( $pView = null, $pData = array ( ) ) {
$this->View->Find ( '.permalink-link', 0 )->innertext = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/journal/' . $this->Model->Get ( 'Identifier' );
$this->View->Find ( '.body', 0 )->innertext = $this->GetSys ( 'Render' )->Format ( $this->Model->Get ( 'Body' ) );

$this->View->Find ( '.edit', 0 )->href = '/profile/' . $this->_Focus->Username . '/journal/edit/' . $this->Model->Get ( 'Identifier' );

$this->View->Display();

return ( true );
Expand All @@ -59,14 +61,55 @@ public function Add ( $pView = null, $pData = array ( ) ) {

$this->View = $this->GetView ( 'edit' );

$this->_Prep();
$this->_PrepAdd();

$this->View->Display();

return ( true );
}

public function Edit ( $pView = null, $pData = array ( ) ) {

$this->_Focus = $this->Talk ( 'User', 'Focus' );
$this->_Current = $this->Talk ( 'User', 'Current' );

$Identifier = $this->GetSys ( 'Request' )->Get ( 'Identifier' );

$this->View = $this->GetView ( 'edit' );

$this->Model = $this->GetModel ();

$this->Model->Load ( $this->_Focus->Id, $Identifier );

$this->_PrepEdit();

$this->View->Display();

return ( true );
}

private function _Prep ( ) {
private function _PrepAdd ( ) {

$this->View->Find ( '.journal', 0 )->action = "/profile/" . $this->_Focus->Username . '/journal/save/';

$privacyData = array ( 'start' => $start, 'step' => $step, 'total' => $total, 'link' => $link );
$privacyControls = $this->View->Find ('.privacy');

foreach ( $privacyControls as $c => $control ) {
$control->innertext = $this->GetSys ( 'Components' )->Buffer ( 'privacy', $pageData );
}

$Contexts = $this->View->Find ( '[name=Context]' );
foreach ( $Contexts as $c => $context ) {
$context->value = $this->Get ( 'Context' );
}

$this->View->Find ( '.remove', 0 )->outertext= "";

return ( true );
}

private function _PrepEdit ( ) {

$this->View->Find ( '.journal', 0 )->action = "/profile/" . $this->_Focus->Username . '/journal/save/';

Expand All @@ -82,6 +125,9 @@ private function _Prep ( ) {
$context->value = $this->Get ( 'Context' );
}

$this->View->Find ( '[name=Title]', 0 )->value = $this->Model->Get ( 'Title' );
$this->View->Find ( '[name=Body]', 0 )->innertext = $this->Model->Get ( 'Body' );

return ( true );
}

Expand All @@ -96,9 +142,12 @@ public function Save ( ) {
$Title = $this->GetSys ( 'Request' )->Get ( 'Title' );
$Identifier = $this->GetSys ( 'Request' )->Get ( 'Identifier' );

$this->Model->Store ( $this->_Focus->Id, $Identifier, $Title, $Body );
$Identifier = $this->Model->Store ( $this->_Focus->Id, $Identifier, $Title, $Body );

return ( true );
$location = '/profile/' . $this->_Focus->Username . '/journal/' . $this->Model->Get ( 'Identifier' );

header ( 'Location: ' . $location );
exit;
}

}
3 changes: 2 additions & 1 deletion components/journal/languages/en-US/journal.lang
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ TEXTILE_MARKUP_INFORMATION="Use <a href='http://en.wikipedia.org/wiki/Textile_(m

NO_PREVIEW_YET="No preview is available. Enter text to see a live preview of your journal entry."

PERMALINK="Permalink: "

PERMALINK="Permalink: "
REMOVE="Delete"
2 changes: 1 addition & 1 deletion components/journal/models/journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function Load ( $pUserId, $pEntry ) {

$criteria = array ( 'Owner_FK' => $pUserId, array ( 'Identifier' => $pEntry, '||Title' => $url ) );

$this->Retrieve ( $criteria );
$this->Retrieve ( $criteria, 'Created DESC' );

if ( $this->Get ( 'Total' ) == 0 ) return ( false );

Expand Down
2 changes: 1 addition & 1 deletion components/journal/views/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<form method="post" class="journal" name="journal">
<input type="hidden" name="Context" value="">
<button type="submit" class="remove" name="Task" value="Remove" />Remove</button>
<a class="remove">Remove</a>
<fieldset>
<legend class="add-edit" >Add Journal Entry</legend>
Expand Down
2 changes: 2 additions & 0 deletions components/journal/views/entry.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script type="text/javascript" src="/components/journal/assets/javascript/edit.js"></script>

<section id="profile-journal-entry">
<a class="edit">Edit</a>
<!-- <a class="rss">RSS</a> -->
<h1 class="title"></h1>
<h2 class="url"></h2>
<abbr class="stamp"></abbr>
Expand Down
59 changes: 59 additions & 0 deletions components/privacy/assets/javascript/privacy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
jLoader.Initialize( "appleseed" );

jLoader.Appleseed = function ( ) { }

jLoader.Appleseed.Checkbox = function ( ) { }

jLoader.Appleseed.Checkbox.OnClick = function ( pElement, pParent ) {

element = $(pElement);
parent = element.parent();
container = parent.parent().parent();

if ( !container.hasClass ( 'privacy' ) ) return ( false );

if ( parent.hasClass ( 'everybody' ) ) {
if ( !pElement.checked ) pElement.checked = true;

if (pElement.checked ) {
container.find ( '.friends input' ).attr ( 'checked', false );
container.find ( '.circle input' ).attr ( 'checked', false );
container.find ( '.nobody input' ).attr ( 'checked', false );
}
} else if ( parent.hasClass ( 'friends' ) ) {
if ( !pElement.checked ) pElement.checked = true;

if (pElement.checked ) {
container.find ( '.everybody input').attr ( 'checked', false );
container.find ( '.circle input').attr ( 'checked', false );
container.find ( '.nobody input').attr ( 'checked', false );
}
} else if ( parent.hasClass ( 'circle' ) ) {
if (pElement.checked ) {
container.find ( '.everybody input').attr ( 'checked', false );
container.find ( '.friends input').attr ( 'checked', false );
container.find ( '.nobody input').attr ( 'checked', false );
}
} else if ( parent.hasClass ( 'nobody' ) ) {
if ( !pElement.checked ) pElement.checked = true;

if (pElement.checked ) {
container.find ( '.everybody input').attr ( 'checked', false );
container.find ( '.friends input').attr ( 'checked', false );
container.find ( '.circle input').attr ( 'checked', false );
}
}

elements = container.find ( ".privacy-list .item" );

checked = false;
for ( e = 0; e < elements.length; e++ ) {
if ( $(':checkbox', elements[e] ).attr('checked' ) ) checked = true;
}

if ( !checked ) {
container.find ( '.nobody input').attr ( 'checked', true );
}

return ( true );
}
2 changes: 2 additions & 0 deletions components/privacy/views/privacy.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<script type="text/javascript" src="/components/privacy/assets/javascript/privacy.js"></script>

<h2 class="privacy-message">Who can see this?</h2>
<ul class="privacy-list">
<li class="item everybody"><input name="Privacy[everybody]" type="checkbox"><label for="privacy[]">Everybody Has Access</label></li>
Expand Down
2 changes: 1 addition & 1 deletion foundations/default/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ routes[profile/(.*)/news]="profile/news.php?Username=$1"
routes[profile/(.*)/journal/]="profile/journal/entries.php?Username=$1"
routes[profile/(.*)/journal/rss]="profile/journal/rss.php?Username=$1"
routes[profile/(.*)/journal/add]="profile/journal/entry.php?Username=$1&Task=Add"
routes[profile/(.*)/journal/edit/(.*)]="profile/journal/entry.php?Username=$1&Task=Edit"
routes[profile/(.*)/journal/edit/(.*)]="profile/journal/entry.php?Username=$1&Identifier=$2&Task=Edit"
routes[profile/(.*)/journal/(\d+)]="profile/journal/entries.php?Username=$1&Page=$2"
routes[profile/(.*)/journal/(.*)]="profile/journal/entry.php?Username=$1&Entry=$2"

Expand Down
2 changes: 1 addition & 1 deletion legacy/themes/default/objects/common/title.aobj
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@

</head>

<body onload = "Initialize();" id="www-website-com">
<body onload = "Initialize();" id="appleseed">
15 changes: 14 additions & 1 deletion themes/default/style/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,22 @@
#profile-journal-edit .preview a { margin:0; padding:0; background:none; }
#profile-journal-edit form .journal-markup-info { margin:10px 10px 10px 128px; padding:10px; }

#profile-journal-edit .privacy { margin:0 0 10px 0; }
#profile-journal-edit .remove { font-size:80%; float:right; padding:1px 5px; -moz-border-radius:5px; -webkit-border-radius:5px; -moz-box-shadow:0px 0px 2px rgba(0,0,0,0.4); -webkit-box-shadow:0px 0px 2px rgba(0,0,0,0.4); color:rgba(0,0,0,0.9); text-shadow:1px 1px 0px rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,0.5); background:-webkit-gradient(linear,0% 0%,0% 100%,from(rgba(255,255,255,1)),to(rgba(185,185,185,1))); background:-moz-linear-gradient(top,rgba(255,255,255,1),rgba(185,185,185,1)); }
#profile-journal-edit .remove:hover { text-decoration:none; }


/* Journal Entry */
#profile-journal-entry .body img { max-width:700px; }
#profile-journal-entry .permalink { color:#8a8a8a; font-style:italic; }
#profile-journal-entry .body a { margin:0; padding:0; background:none; }
#profile-journal-entry .permalink { margin-top:5px; color:#8a8a8a; font-style:italic; }
#profile-journal-entry .permalink a { color:#8a8a8a; background:none; padding:0; }
#profile-journal-entry .edit { font-size:80%; float:right; padding:1px 5px; -moz-border-radius:5px; -webkit-border-radius:5px; -moz-box-shadow:0px 0px 2px rgba(0,0,0,0.4); -webkit-box-shadow:0px 0px 2px rgba(0,0,0,0.4); color:rgba(0,0,0,0.9); text-shadow:1px 1px 0px rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,0.5); background:-webkit-gradient(linear,0% 0%,0% 100%,from(rgba(255,255,255,1)),to(rgba(185,185,185,1))); background:-moz-linear-gradient(top,rgba(255,255,255,1),rgba(185,185,185,1)); }

/* Journal Entries */

#profile-journal-entries .rss { font-size:80%; float:right; padding:1px 5px; -moz-border-radius:5px; -webkit-border-radius:5px; -moz-box-shadow:0px 0px 2px rgba(0,0,0,0.4); -webkit-box-shadow:0px 0px 2px rgba(0,0,0,0.4); color:rgba(0,0,0,0.9); text-shadow:1px 1px 0px rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,0.5); background:-webkit-gradient(linear,0% 0%,0% 100%,from(rgba(255,255,255,1)),to(rgba(185,185,185,1))); background:-moz-linear-gradient(top,rgba(255,255,255,1),rgba(185,185,185,1)); }
#profile-journal-entries .rss:hover { text-decoration:none; }

#newsfeed-menu { clear:both; }
#newsfeed-menu li { list-style-type:none; padding:3px; padding-left:20px; }
Expand Down

0 comments on commit c623363

Please sign in to comment.