Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlaefer committed Feb 22, 2012
2 parents af7c146 + 817f35b commit 40c77a8
Show file tree
Hide file tree
Showing 28 changed files with 95 additions and 115 deletions.
27 changes: 27 additions & 0 deletions app/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,30 @@
Inflector::rules('singular', array( '/^(smil)ies$/i' => '\1ey' ));

include_once 'version.php';

/**
* Add additional buttons to editor
* @td document in namespace
*/
Configure::write('Saito.markItUp.nextCssId', 12);
Configure::write(
'Saito.markItUp.additionalButtons',
array(
'Gacker' => array(
// image in img/markitup/<button>.png
'button' => 'gacker',
// code inserted into text
'code' => ':gacker:',
// format replacement as image
'type' => 'image',
// replacement in output
'replacement' => 'gacker_large.png'
),
'Popcorn' => array(
'button' => 'popcorn', //.png
'code' => ':popcorn:',
'type' => 'image',
'replacement' => 'popcorn_large.png'
)
)
);
8 changes: 0 additions & 8 deletions app/controllers/smiley_codes_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ public function admin_index() {
$this->set('smileyCodes', $this->paginate());
}

public function admin_view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid smiley code', true));
$this->redirect(array('action' => 'index'));
}
$this->set('smileyCode', $this->SmileyCode->read(null, $id));
}

public function admin_add() {
if (!empty($this->data)) {
$this->SmileyCode->create();
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/smilies_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ class SmiliesController extends AppController {

public $name = 'Smilies';

public $paginate = array(
/*
* sets limit unrealisticly high so we should never reach the upper limit
* i.e. always show all entries on one page
*/
'limit' => 1000,
);

public function admin_index() {
$this->Smiley->recursive = 0;
$this->set('smilies', $this->paginate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@
.markItUp .markItUpButton13-19 a { background-image:url(../../../../../theme/macnemo/img/smilies/shouting.png); }
*/

/* gacker */
.markItUp .markItUpButton13 a { background: url(images/spr_toolbar.png) 0px -352px no-repeat; }
.markItUp .markItUpButton13 a:hover { background-position: -32px -352px; }

/* popcorn */
.markItUp .markItUpButton14 a { background: url(images/spr_toolbar.png) 0px -320px no-repeat; }
.markItUp .markItUpButton14 a:hover { background-position: -32px -320px; }


.markItUp .clean a {
background-image:url(images/clean.png);
}
Expand Down
16 changes: 12 additions & 4 deletions app/views/helpers/bbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,18 @@ public function _smilies($string, $options = array( )) {
}
endif;

$s['codes'][] = ':gacker:';
$s['replacements'][] = $this->Html->image('smilies/gacker_large.png');
$s['codes'][] = ':popcorn:';
$s['replacements'][] = $this->Html->image('smilies/popcorn_large.png');
$additionalButtons = Configure::read('Saito.markItUp.additionalButtons');
if (!empty($additionalButtons)):
foreach ( $additionalButtons as $additionalButtonTitle => $additionalButton):
// $s['codes'][] = ':gacker:';
$s['codes'][] = $additionalButton['code'];
// $s['replacements'][] = $this->Html->image('smilies/gacker_large.png');
if ( $additionalButton['type'] === 'image' ):
$additionalButton['replacement'] = $this->Html->image('markitup'.DS.$additionalButton['replacement']);
endif;
$s['replacements'][] = $additionalButton['replacement'];
endforeach;
endif;

// prevents parsing of certain areas
$string_array = preg_split("/
Expand Down
27 changes: 21 additions & 6 deletions app/views/helpers/entry_h.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@ public function generateMarkItUpEditorButtonSet($id) {
$separator = array( 'separator' => '---------------' );

/* build smilies for MarkItUp from the admin smilies settings */
$markitupCssId = Configure::read('Saito.markItUp.nextCssId');
$smilies = Configure::read('Saito.Smilies.smilies_all');
$smiliesMarkItUpPacked = array( );
$smileyCss = '';
$iconCss = '';
$i = 1;
foreach ( $smilies as $smiley ):
if ( isset($smiliesMarkItUpPacked[$smiley['icon']]) )
continue;
// prepare JS which is inserted into the markItUp config in the next stage
$smiliesMarkItUpPacked[$smiley['icon']] = array( 'name' => '' /*$smiley['title']*/, 'replaceWith' => $smiley['code'] );
// prepare CSS for each button so the smiley image is placed on it
$smileyCss .= ".markItUp .markItUpButton12-{$i} a { background-image:url({$this->webroot}/theme/{$this->theme}/img/smilies/{$smiley['icon']}); }";
$iconCss .= " .markItUp .markItUpButton{$markitupCssId}-{$i} a { background-image:url({$this->webroot}theme/{$this->theme}/img/smilies/{$smiley['icon']}); } ";
$i++;
endforeach;
$smileyCss = "<style type='text/css'>{$smileyCss}</style>";
$markitupCssId++;

/* setup the BBCode for markitup as php array */
$bbcodeSet = array(
Expand Down Expand Up @@ -90,10 +91,22 @@ function() {
),
$separator,
'Smilies' => array( 'name' => 'Smilies', 'dropMenu' => $smiliesMarkItUpPacked ),
'Gacker' => array( 'name' => 'Gacker', 'replaceWith' => ':gacker:' ),
'Popcorn' => array( 'name' => 'Popcorn', 'replaceWith' => ':popcorn:' ),
);

$additionalButtons = Configure::read('Saito.markItUp.additionalButtons');
if (!empty($additionalButtons)):
foreach ( $additionalButtons as $additionalButtonTitle => $additionalButton):
// 'Gacker' => array( 'name' => 'Gacker', 'replaceWith' => ':gacker:' ),
$bbcodeSet[$additionalButtonTitle] = array(
'name' => $additionalButtonTitle,
'replaceWith' => $additionalButton['code'],
);
$iconCss .= " .markItUp .markItUpButton{$markitupCssId} a { background-image: url({$this->webroot}theme/{$this->theme}/img/markitup/{$additionalButton['button']}.png); } ";
$iconCss .= " .markItUp .markItUpButton{$markitupCssId} a:hover { background-image: url({$this->webroot}theme/{$this->theme}/img/markitup/{$additionalButton['button']}_hover.png); } ";
$markitupCssId++;
endforeach;
endif;

$markitupSet = array( );

/* converting the BBCode PHP array into JS */
Expand All @@ -110,9 +123,11 @@ function() {
endif;
endforeach;

$iconCss = "<style type='text/css'>{$iconCss}</style>";

$out = 'markitupSettings = { "id":"' . $id . '", markupSet: [' . implode(",\n",
$markitupSet) . ']};';
$out = $this->Html->scriptBlock($out) . $smileyCss;
$out = $this->Html->scriptBlock($out) . $iconCss;

return $out;
}
Expand Down
3 changes: 2 additions & 1 deletion app/views/helpers/time_h.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ protected function _normal($timestamp) {
$time = strftime("%H:%M", $timestamp);
} elseif ($timestamp > ($this->today - 64800)) {
// yesterday but in the last 18 hours
$time = __('yesterday', true) . ' ' . $time = strftime("%H:%M", $timestamp);
$time = __('yesterday', true) . ' ' . strftime("%H:%M", $timestamp);
} else {
// yesterday and 18 hours and older
$time = strftime("%d.%m.%Y %H:%M", $timestamp);
}
$time = '<span title="'.strftime("%d.%m.%Y %T", $timestamp).'">' . $time . '</span>';
return $time;

}
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/admin.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
true), '/admin/categories/index'); ?>
</li>
<li class="<? if (stristr($this->here, 'smilies')) { echo 'active'; }; ?>">
<?php echo $html->link(__('Smiley',
<?php echo $html->link(__('Smilies',
true), '/admin/smilies/index'); ?>
</li>
</ul>
Expand All @@ -55,7 +55,7 @@
$emailMessage = $this->Session->flash('email');
if ( $flashMessage || $emailMessage ) :
?>
<div class="">
<div class="alert alert-info">
<?php echo $flashMessage; ?>
<?php echo $emailMessage; ?>
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/views/smiley_codes/admin_edit.ctp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?php $this->Html->addCrumb(__('Smilies', true), '/admin/smilies'); ?>
<?php $this->Html->addCrumb(__('Smiley Codes', true), '/admin/smiley_codes'); ?>
<?php $this->Html->addCrumb(__('Smiley Codes Edit', true), '/admin/smiley_codes/edit'); ?>
<div class="smileyCodes form">
<?php echo $this->Form->create('SmileyCode');?>
<fieldset>
Expand Down
25 changes: 3 additions & 22 deletions app/views/smiley_codes/admin_index.ctp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php $this->Html->addCrumb(__('Smilies', true), '/admin/smilies'); ?>
<?php $this->Html->addCrumb(__('Smiley Codes', true), '/admin/smiley_codes'); ?>
<div class="smileyCodes index">
<h2><?php __('Smiley Codes');?></h2>
<table cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-condensed">
Expand All @@ -22,32 +24,11 @@
</td>
<td><?php echo $smileyCode['SmileyCode']['code']; ?>&nbsp;</td>
<td class="actions">
<?php echo $this->Html->link(__('View', true), array('action' => 'view', $smileyCode['SmileyCode']['id']), array('class' => 'btn')); ?>
<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $smileyCode['SmileyCode']['id']), array('class' => 'btn')); ?>
<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $smileyCode['SmileyCode']['id']), array('class' => 'btn'), sprintf(__('Are you sure you want to delete # %s?', true), $smileyCode['SmileyCode']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?> </p>

<div class="paging">
<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $this->Paginator->numbers();?>
|
<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
</div>
</div>
<div class="actions">
<h3><?php __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('New Smiley Code', true), array('action' => 'add')); ?></li>
<li><?php echo $this->Html->link(__('List Smilies', true), array('controller' => 'smilies', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Smiley', true), array('controller' => 'smilies', 'action' => 'add')); ?> </li>
</ul>
</div>
<?php echo $this->Html->link(__('New Smiley Code', true), array('action' => 'add'), array('class' => 'btn')); ?>
31 changes: 0 additions & 31 deletions app/views/smiley_codes/admin_view.ctp

This file was deleted.

5 changes: 4 additions & 1 deletion app/views/smilies/admin_add.ctp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php $this->Html->addCrumb(__('Smilies', true), '/admin/smilies'); ?>
<?php $this->Html->addCrumb(__('Add Smiley', true), '#'); ?>
<div class="smilies form">
<?php echo $this->Form->create('Smiley');?>
<fieldset>
Expand All @@ -7,9 +9,10 @@
echo $this->Form->input('icon');
echo $this->Form->input('image');
echo $this->Form->input('title');
echo $this->Form->submit(__('Submit', true), array('class' => 'btn btn-primary'));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
<?php echo $this->Form->end();?>
</div>
<div class="actions">
<h3><?php __('Actions'); ?></h3>
Expand Down
16 changes: 5 additions & 11 deletions app/views/smilies/admin_edit.ctp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?php $this->Html->addCrumb(__('Smilies', true), '/admin/smilies'); ?>
<?php $this->Html->addCrumb(__('Edit Smiley',
true), '#'); ?>
<div class="smilies form">
<?php echo $this->Form->create('Smiley');?>
<fieldset>
Expand All @@ -8,17 +11,8 @@
echo $this->Form->input('icon');
echo $this->Form->input('image');
echo $this->Form->input('title');
echo $this->Form->submit(__('Submit', true), array('class' => 'btn btn-primary'));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
<div class="actions">
<h3><?php __('Actions'); ?></h3>
<ul>

<li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('Smiley.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('Smiley.id'))); ?></li>
<li><?php echo $this->Html->link(__('List Smilies', true), array('action' => 'index'));?></li>
<li><?php echo $this->Html->link(__('List Smiley Codes', true), array('controller' => 'smiley_codes', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Smiley Code', true), array('controller' => 'smiley_codes', 'action' => 'add')); ?> </li>
</ul>
<?php echo $this->Form->end();?>
</div>
8 changes: 3 additions & 5 deletions app/views/smilies/admin_index.ctp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?php $this->Html->addCrumb(__('Smilies', true), '/admin/smilies'); ?>
<div class="smilies index">
<h2><?php __('Smilies');?></h2>
<table cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-condensed">
Expand Down Expand Up @@ -31,8 +32,5 @@
<?php endforeach; ?>
</table>
</div>
<hr />
<?php echo $this->Html->link(__('New Smiley', true), array('action' => 'add'), array('class' => 'btn')); ?>
<hr />
<?php echo $this->Html->link(__('List Smiley Codes', true), array('controller' => 'smiley_codes', 'action' => 'index'), array('class'=>'btn')); ?>
<?php echo $this->Html->link(__('New Smiley Code', true), array('controller' => 'smiley_codes', 'action' => 'add'), array('class'=>'btn')); ?>
<?php echo $this->Html->link(__('New Smiley', true), array('action' => 'add'), array('class' => 'btn')); ?> &nbsp; | &nbsp;
<?php echo $this->Html->link(__('List Smiley Codes', true), array('controller' => 'smiley_codes', 'action' => 'index'), array('class'=>'btn')); ?>
Binary file added app/webroot/theme/default/img/markitup/gacker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/webroot/theme/macnemo/img/smilies/gacker.png
Binary file not shown.
20 changes: 5 additions & 15 deletions app/webroot/theme/macnemo/img/smilies/readme.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
# iXi #

gacker.png
popcorn.png

# MoreIchatSmileys #
# http://p.yusukekamiyamane.com/ #

Under [Creative Commons Attribution 3](http://creativecommons.org/licenses/by/3.0/) by [MoreIchatSmileys](http://ismileys.free.fr/)

blushing.png
cool.png
crying.png
embarrassed.png
evil.png
frown.png
gasp.png
grin.png
grinning-wink.png
innocent.png
kiss.png
lipsaresealed.png
moneymouth.png
oops.png
shouting.png
sleeping.png
smile.png
tongue.png
wink.png

# emoticons.gr #

by courtesy of <http://www.emoticons.gr/thumbnails-101.html>

blushing.png
grinning-wink.png
evil.png
sleeping.png

0 comments on commit 40c77a8

Please sign in to comment.