Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8316
Modified Files:
NEWS serendipity_admin_category.inc.php
serendipity_admin_image_selector.php
serendipity_config.inc.php serendipity_editor.js
serendipity_functions.inc.php
Log Message:
category icons
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- serendipity_config.inc.php 13 Apr 2004 10:31:44 -0000 1.68
+++ serendipity_config.inc.php 26 Apr 2004 10:33:20 -0000 1.69
@@ -1,7 +1,7 @@
<?php # $Id$
# Copyright (c) 2003-2004, Jannis Hermanns
# All rights reserved. See LICENSE file for licensing details
-
+require_once('validate.php');
if (!defined('S9Y_INCLUDE_PATH')) {
define('S9Y_INCLUDE_PATH', dirname(__FILE__) . '/');
}
@@ -15,7 +15,7 @@
include_once(S9Y_INCLUDE_PATH . 'compat.php');
ini_set('session.use_trans_sid', 0);
-$serendipity['version'] = '0.6.1-CVS';
+$serendipity['version'] = '0.6.2-CVS';
$serendipity['production'] = 1;
$serendipity['rewrite'] = 'none';
$serendipity['messagestack'] = array();
Index: serendipity_admin_image_selector.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_image_selector.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- serendipity_admin_image_selector.php 13 Apr 2004 11:58:57 -0000 1.20
+++ serendipity_admin_image_selector.php 26 Apr 2004 10:33:20 -0000 1.21
@@ -35,9 +35,9 @@
switch ($serendipity['GET']['step']) {
case '1':
$file = serendipity_fetchImageFromDatabase($serendipity['GET']['image']);
- $imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
- $imgName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['name'] .'.'. $file['extension'];
- $thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $imgName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['name'] .'.'. $file['extension'];
+ $thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
?>
<script type="text/javascript" language="JavaScript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_define.js.php"></script>
<script type="text/javascript" language="Javascript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_editor.js"></script>
@@ -50,6 +50,12 @@
<div>
<input type="hidden" name="imgName" value="<?php echo $imgName; ?>" />
<input type="hidden" name="thumbName" value="<?php echo $thumbName; ?>" />
+ <?php if (!empty($serendipity['GET']['htmltarget'])) { ?>
+ <input type="hidden" name="serendipity[htmltarget]" value="<?php echo htmlspecialchars($serendipity['GET']['htmltarget']); ?>" />
+ <?php } ?>
+ <?php if (!empty($serendipity['GET']['filename_only'])) { ?>
+ <input type="hidden" name="serendipity[filename_only]" value="<?php echo htmlspecialchars($serendipity['GET']['filename_only']); ?>" />
+ <?php } ?>
<b><?php echo IMAGE_SIZE; ?>:</b>
<br />
@@ -57,6 +63,7 @@
<input id="radio_link_yes" type="radio" name="serendipity[linkThumbnail]" value="yes" /><label for="radio_link_yes"><?php echo I_WANT_BIG_IMAGE; ?></label><br />
<br />
+ <?php if (empty($serendipity['GET']['filename_only']) || $serendipity['GET']['filename_only'] != 'true') { ?>
<b><?php echo IMAGE_ALIGNMENT; ?>:</b>
<br />
<input type="radio" name="serendipity[align]" value="" /> <img src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/img_align_top.png" vspace="5"><br />
@@ -75,6 +82,7 @@
<br />
<textarea id="serendipity_imagecomment" name="serendipity[imagecomment]" rows="5" cols="40"></textarea>
<br />
+ <?php } ?>
<input type="button" value="<?php echo BACK; ?>" onclick="history.go(-1);" />
<input type="button" value="<?php echo DONE; ?>" onclick="serendipity_imageSelector_done()" />
@@ -92,6 +100,15 @@
if (!is_numeric($serendipity['GET']['end'])) {
$serendipity['GET']['end'] = 16;
}
+
+ $add_url = '';
+ if (!empty($serendipity['GET']['htmltarget'])) {
+ $add_url .= '&serendipity[htmltarget]=' . $serendipity['GET']['htmltarget'];
+ }
+
+ if (!empty($serendipity['GET']['filename_only'])) {
+ $add_url .= '&serendipity[filename_only]=' . $serendipity['GET']['filename_only'];
+ }
?>
<b><?php echo SELECT_IMAGE; ?></b>
<br />
@@ -105,7 +122,7 @@
isset($serendipity['GET']['end']) ? $serendipity['GET']['end'] : 8,
4,
false,
- '?serendipity[step]=1'
+ '?serendipity[step]=1' . $add_url
);
}
?>
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- NEWS 26 Apr 2004 07:30:34 -0000 1.112
+++ NEWS 26 Apr 2004 10:33:20 -0000 1.113
@@ -3,6 +3,11 @@
Version 0.6.1 ()
------------------------------------------------------------------------
+ * Categories can now have a fixed image which is embedded for
+ every article. Can be styled via CSS (.serendipity_entryIcon).
+ Integrated with s9y image manager.
+ (Evan Nemerson, garvinhicking)
+
* Published entries from the future will only be displayed on the
frontend when not in the future. They will get automagically
displayed as soon as the publish time is effectively reached.
Index: serendipity_editor.js
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_editor.js,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- serendipity_editor.js 13 Apr 2004 11:58:57 -0000 1.8
+++ serendipity_editor.js 26 Apr 2004 10:33:20 -0000 1.9
@@ -122,6 +122,12 @@
area.focus();
}
+function serendipity_imageSelector_addToElement (str, el)
+{
+ document.getElementById(el).value = str;
+ document.getElementById(el).focus();
+}
+
function serendipity_imageSelector_addToBody (str)
{
document.forms['serendipityEntry']['serendipity[body]'].value += str;
@@ -141,6 +147,12 @@
img = f['imgName'].value;
}
+ if (f['serendipity[filename_only]'].value == 'true') {
+ self.opener.serendipity_imageSelector_addToElement(img, f['serendipity[htmltarget]'].value);
+ self.close();
+ return true;
+ }
+
if (document.getElementById('serendipity_imagecomment').value != '') {
styled = false;
} else {
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -d -r1.256 -r1.257
--- serendipity_functions.inc.php 26 Apr 2004 07:30:36 -0000 1.256
+++ serendipity_functions.inc.php 26 Apr 2004 10:33:20 -0000 1.257
@@ -629,7 +629,8 @@
a.email,
c.category_name,
- c.categoryid
+ c.categoryid,
+ c.category_icon
$body
FROM
({$serendipity['dbPrefix']}entries AS e
@@ -670,6 +671,7 @@
*,
c.category_name,
c.categoryid,
+ c.category_icon,
a.username,
a.email
FROM
@@ -881,6 +883,9 @@
<h4 class="serendipity_title"><a href="<?php echo $entryLink; ?>"><?php echo htmlspecialchars($entry['title']); ?></a></h4>
<div class="serendipity_entry">
+ <?php if ($entry['category_icon'] != '') {
+ echo '<a class="serendipity_entryIcon" href="' . $serendipity['serendipityHTTPPath'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'categories/' . $entry['categoryid'] . '_' . serendipity_makeFilename($entry['category_name']) . '"><img class="serendipity_entryIcon" alt="' . htmlspecialchars($entry['category_name']) . '" src="' . htmlspecialchars($entry['category_icon']) . '"/></a>';
+ } ?>
<span class="<?php echo $extended_css; ?>"><?php echo $entry['body']; ?></span>
<?php echo $html_extended; ?>
Index: serendipity_admin_category.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_category.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- serendipity_admin_category.inc.php 7 Apr 2004 12:42:42 -0000 1.10
+++ serendipity_admin_category.inc.php 26 Apr 2004 10:33:20 -0000 1.11
@@ -9,17 +9,18 @@
$cat_to_edit = (isset($_GET['serendipity']['cat']['catid']) ? (int)$_GET['serendipity']['cat']['catid'] : 0);
$msg = '';
-$admin_category = ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF ? "AND (authorid = 0 OR authorid = {$serendipity['authorid']})" : '');
+$admin_category = ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF ? "AND (authorid = 0 OR authorid = {$serendipity['authorid']})" : '');
if (isset($_POST['SAVE'])) {
$name = addslashes($_POST['serendipity']['cat']['name']);
$desc = addslashes($_POST['serendipity']['cat']['description']);
$authorid = (isset($_POST['serendipity']['cat']['all_authors']) && $_POST['serendipity']['cat']['all_authors'] == 'true') ? '0' : $serendipity['authorid'];
+ $icon = addslashes($_POST['serendipity']['cat']['icon']);
if ($cat_to_edit == 0) {
- $query = "INSERT INTO {$serendipity['dbPrefix']}category (category_name, category_description, authorid) values ('$name', '$desc', $authorid)";
+ $query = "INSERT INTO {$serendipity['dbPrefix']}category (category_name, category_description, authorid, category_icon) values ('$name', '$desc', $authorid, '$icon')";
} else {
- $query = "UPDATE {$serendipity['dbPrefix']}category SET category_name='$name', category_description='$desc', authorid=$authorid WHERE categoryid=$cat_to_edit $admin_category";
+ $query = "UPDATE {$serendipity['dbPrefix']}category SET category_name='$name', category_description='$desc', authorid=$authorid, category_icon='$icon' WHERE categoryid=$cat_to_edit $admin_category";
}
$r = serendipity_db_query($query);
@@ -59,19 +60,19 @@
$existing_cats_dropdown .= '<option value="' . $cat_data['categoryid'] . '">' . htmlspecialchars($cat_data['category_name']) . '</option>' . "\n";
}
}
-
+
$name = htmlspecialchars($cat_data['category_name']);
$desc = htmlspecialchars($cat_data['category_description']);
$edit_pre = '<a href="?serendipity[adminModule]=category&serendipity[cat][catid]=' . $cat_data['categoryid'] . '">';
$edit_post = '</a>';
-
+
if ($cat_data['authorid'] == '0') {
$desc .= ' (' . ALL_AUTHORS . ')';
} elseif ($cat_data['authorid'] != $serendipity['authorid']) {
$desc .= ' (' . $cat_data['username'] . ')';
$edit_pre = $edit_post = '';
}
-
+
$existing_cats_table .= <<<CAT
<tr>
<td>
@@ -115,6 +116,15 @@
</tr>
<tr>
+ <th><?php echo IMAGE; ?></th>
+ <td>
+ <script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script>
+ <input type="text" id="img_icon" name="serendipity[cat][icon]" value="<?php echo isset($this_cat['category_icon']) ? htmlspecialchars($this_cat['category_icon']) : ''; ?>" />
+ <input type="button" name="insImage" value="<?php echo IMAGE ; ?>" style="" onclick="window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=img_icon&serendipity[filename_only]=true', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');" />
+ </td>
+ </tr>
+
+ <tr>
<th><label for="all_authors"><?php echo ALL_AUTHORS; ?></label></th>
<td><input id="all_authors" type="checkbox" name="serendipity[cat][all_authors]" value="true" <?php echo (isset($this_cat['authorid']) && $this_cat['authorid'] == '0') ? 'checked="checked"' : ''; ?> /></td>
</tr>
|