News Bulletin
CPG 1.4x
DEMO (http://www.mysimtractor.com)This plugin will create an interface for you to write news bulletins for your gallery which can be viewed in a neat expandable/collapsable section. These notices can also be added to an RSS feed for your gallery. The plugin uses coppermine's built in JavaScript (same as in the config page) to operate the expandable/collapsable section.
Manual -
Installing the plugin -• Upload and install via the Plugin Manager .
• Specify where to show the news block in the Album List View section of the config section nu adding "/news".
• Add this below <head> in themes/"theme"/template.html
<link rel="alternate" type="application/rss+xml" title="News Bulletins" href="index.php?file=News_Bulletin/news_rss" />
Bulletins -• Click "News Manager" on the admin menu.
• Click "Create new bulletin."
• Enter the bulletins title in the first box.
• Enter the bulletin into the larger box, by default the bulletin can be viewed in the RSS feed and the News section.
• You can specify where to show the bulletin by clicking edit and choosing from the drop down list.
• You can delete bulletins at any time.
Viewing Bulletins – • The bulletins can be viewed in the RSS feed and the News section. (By default settings) .
Languages -
- English.
- Translations welcome.
New Version - V2
- This version address a minor bug fix which fixes the problem cause when expanding the news block when placed at the top of the gallery (found by will)
- Also i have attached a "low" version whic is suitable for mysql servers that dont support the number of chars in colomns that is supported in the normal version. This version also does not expand automatically hide the block on page load. (Lite Version)
- Upgraded manually by overwriting all the files except those in the include directory, lang directory,codebase.php and configuration.php
just_some_guy,
mysimtractor.com
Could a Dev Team Member please move this to the plugins section, thanks.
Quote from: just_some_guy on November 11, 2007, 06:08:27 PM
Could a Dev Team Member please move this to the plugins section, thanks.
We always do this for valid contributions - no need to explicitely ask for your thread to be moved, nor do you have to edit out this request once the thread has been moved.
Did as you suggested and moved your thread accordingly.
Ok, i will know that for the future. Thanks GauGau.
Great plugin but I got this error when installing:
mySQL error: Table 'newgallery2007.cpg1411_plugin_news' doesn't exist
It says in the plugin manager when uploaded the plugin that:
This plugin will create a table called cpg1411_plugin_news. Make sure this table does not already exist. ;)
I just deleted it all of my gallery and installed it again and it all works perfectly fine; the table is created. Im not sure what the problem is... can you be more specific.
The "This plugin will create a table called cpg1411_plugin_news. Make sure this table does not already exist." is normal.
I'll try that and see what happens, basically when I go to install is gives me:
There was an error while processing a database query
And in the debug it give me the error I posted in the last post.
It looks to me that its not creating the table in the database. ;)
I have attached another version to my first post, try this one as it might fix your problem.
Still get the same database error.
But now I get a different MySQL error:
mySQL error: Too big column length for column 'name' (max = 255). Use BLOB instead ???
Well how big a title are you entering? it is limited to 255 chars, if you want i bigger you will need to edit the table.
I'm not entering any title in, the plugin is supposed to add the table for me so it should enter the title as well surely ;D
@Will: you don't qualify as tester for a plugin in an early development stage. In other words: the plugin is not meant for you unless you post valid reports. If you have no idea to do this, then wait for others to test and evaluate this plugin first.
I'm not testing it, I want it installed on my gallery but having trouble installing, I use anycontent.php to show news about my site and just_some_guy shows it working on his gallery. Look at some early posts to see my point ;D
Anyway back to the subject: just_some_guy does it matter if my tables are named cpg1410 in the database as the error shows cpg1411_plugin_news, should it be cpg1410_plugin_news ???
During the install all the plugin does is create. You need to enter your news articles into the table using the form in your CPG, click "News Manager" and the click "Create new bulletin." then type away. The plugin does not enter in any info during install. The table will be called cpg1411_plugin_news.
There is no need to use the anycontent. The plugin behaves the same way as an anycontent.
Trust me, the plugin works fine.
You may be confused, GauGau was saying I was testing your plugin when actually I'm trying to install. Basically it won't install period. I've been using anycontent for a while and I'm glad you've made this plugin as I won't need to use anycontent anymore. So amid the confusion can it be possible if I give you u/p with admin rights to take a look for me so you can see the problem I'm getting. ;)
First, can we try and solve this problem without that option. Do you have a tool like PhPMyadmin? if so see if the table is created. Post the answer.
Thanks,
I do and that's my point it hasn't created the table. That's why I got this error first time round:
mySQL error: Table 'newgallery2007.cpg1411_plugin_news' doesn't exist
So is this error when you install or when you create a new bulletin?
When I install hence:
Great plugin but I got this error when installing:
mySQL error: Table 'newgallery2007.cpg1411_plugin_news' doesn't exist
It says in the plugin manager when uploaded the plugin that:
This plugin will create a table called cpg1411_plugin_news. Make sure this table does not already exist.
I have no idea why it is saying that, are you using the attached News_Bulletin_bugfix.zip? and can you attach the codebase.php file so i can see if there is an error.
Thanks,
When I used the first attached file it gave me:
There was an error while processing a database query
mySQL error: Table 'newgallery2007.cpg1411_plugin_news' doesn't exist
So I reported this and you attached the 2nd file, when I uploaded that and tried to install it, it gave me:
There was an error while processing a database query
mySQL error: Too big column length for column 'name' (max = 255). Use BLOB instead
Its given me the same database error but a different mySQL error for each.
I've attached the codebase file so you can take a look.
Maybe it something to do with your server, put this in a new file and then open the page. Then check to see if the table is created. Once the table is created you will be able to use the plugin.
$sql = 'CREATE TABLE `cpg1411_plugin_news` ('
. ' `id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
. ' `active` VARCHAR(10) NOT NULL, '
. ' `rss` VARCHAR(10) NOT NULL, '
. ' `date` DATE NOT NULL, '
. ' `value` LONGTEXT NOT NULL, '
. ' `name` VARCHAR(500) NOT NULL, '
. ' `title` VARCHAR(500) NOT NULL'
. ' )'
. ' ENGINE = myisam'
. ' COMMENT = \'Stores data for the News Bulletin plugin by just_some_guy.\';';
$result = cpg_db_query($sql);
I entered what you gave me to create the table and I got an error:
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '$sql = 'CREATE TABLE `cpg1411_plugin_news` ('
. ' `id`
Hmm, run this using a tool like phpmyadmin.
CREATE TABLE `cpg1411_plugin_news` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`active` VARCHAR( 10 ) NOT NULL ,
`rss` VARCHAR( 10 ) NOT NULL ,
`date` DATE NOT NULL ,
`value` LONGTEXT NOT NULL ,
`name` VARCHAR( 500 ) NOT NULL ,
`title` VARCHAR( 500 ) NOT NULL
) ENGINE = MYISAM COMMENT = '''Stores data for the News Bulletin plugin by just_some_guy.';
Thats what I'm using and I entered what you gave me this time and I get:
MySQL said:
#1074 - Too big column length for column 'name' (max = 255). Use BLOB instead ???
Ahh, must be a variation between the set up of your mysql and mine. Simple fix. run this code -
CREATE TABLE `cpg1411_plugin_news` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`active` VARCHAR( 10 ) NOT NULL ,
`rss` VARCHAR( 10 ) NOT NULL ,
`date` DATE NOT NULL ,
`value` LONGTEXT NOT NULL ,
`name` VARCHAR( 255 ) NOT NULL ,
`title` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM COMMENT = '''Stores data for the News Bulletin plugin by just_some_guy.';
Right the table has been created, I went back to installing the plugin (the 2nd attachment) it gives me the same error:
mySQL error: Too big column length for column 'name' (max = 255). Use BLOB instead ???
Thats because its running that code again (the one that does not work for you). I have attached a modded version which skips the step of creating a table as you have done it manually. Then you can use the plugin, let me know if it works.
Fantastic it worked. Thanks for the mod and thanks for all your help in making it work ;D
No problem, good to hear you got it working in the end.
EDIT: If you saw the last post I was wrong, when I place it before the categories it pushes the categories next to it when you click "news", everything is ok when you don't click "news" and if you place it at the bottom of the gallery, so basically if there is something after it, it messes up the gallery when clicked ;)
http://cdcoverhideout.com/gallery
Weird, i never noticed that as i have my news block at the bottom of the page. I will look into that and get back to you. Sorry,
Fixed, minor bug there, thanks for pointing that out.
To fix it.
Open /plugins/News_Bulletin/news.php
find
<table align="left" width="100%" cellspacing="1" cellpadding="0" class="maintable" id="section" border="0">
and replace with
<table id="section" class="maintable" border="0">
Thank you sorted, top man, 1 more thing please and this will be the last time lol.
Is there a way of making the news show by default and then members can click to make it disappear ;)
Yes, delete this from news.php -
<script type="text/javascript">
onload = hideall;
</script>
No problem,
Thank you, that makes it show but what about making it disappear if you choose to ;)
Sure,
Replace the contents of news.php with this -
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2007 Coppermine Dev Team
v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.
********************************************
Coppermine version: 1.4.13
$Source$
$Revision: 3837 $
$Author: gaugau $
$Date: 2007-08-16 18:56:06 +0200 (Do, 16 Aug 2007) $
**********************************************/
<<<EOT
<script type="text/javascript">
function expand2()
{
var Nodes = document.getElementsByTagName("table")
var max = Nodes.length
for(var i = 0;i < max;i++) {
var nodeObj = Nodes.item(i)
var str = nodeObj.id
if (str.match("section")) {
nodeObj.style.display = 'block';
}
}
}
</script>
<style>
text-align: left;
</style>
EOT;
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
echo <<< EOT
<tr>
<td class="tableh2" onclick="show_section('section')" >
<span style="cursor:pointer" ><img src="images/descending.gif" border="0" width="9" height="9" alt="" title="{$lang_admin_php['click_expand']}" /> <b>News</b></span><a/>
</td>
</tr>
<tr>
<td>
<table id="section" class="maintable" border="0">
EOT;
$sql ="SELECT * FROM cpg1411_plugin_news WHERE active=1 ORDER BY date DESC";
$result = cpg_db_query($sql);
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td align="left">';
echo "<strong><span style=\"text-decoration: underline\">";
echo $row["title"] , "<br />";
echo "</strong></span>";
echo '</td>';
echo '<td>';
echo $row["date"] , "<br />";
echo '</td>';
echo '<tr>';
echo '<td align="left">';
echo $row["value"] ,"<br />";
echo '</td>';
echo '</td>';
echo '<br/>';
echo '</tr>';
}
echo '</table>';
?>
just_some_guy,
EDIT - make sure you use this code ^^^^ will. I edited my post with a correction.
not working, also found a issue in IE, when you hover over the main section all the text is highlighted, looks fine in FF ???
Will, what I was trying to say: you lack the experience to be the first user to install this plugin and use it. If it doesn't work for you out of the box, then it is not meant for you. I haven't looked into this plugin, but if you can't answer the basic question (what happens when the plugin tries to create the table in the first place? Does the mysql user have create permissions?), then you just don't qualify for this plugin. Look at this thread and how cluttered it already is, even though the plugin is very young.
Will, check my site - http://www.mysimtractor.com and scroll to the bottom of the page. The news block is exactly how you wanted, isn't it? - its expanded when the page loads and when clicking the text "News" it collapses and vise -versa. That was using the code i posted a few posts ago. I use IE and cannot replicate this error.
Sorry, GauGau for the mess this is making to the board, i assure the plugin does work as you can see on my site.
New version released; this address a minor bug fix found by will. I have also released a version which loads with the news block open and in this version i have changed some of the values used when creating the table so that it can be used on mysql servers that have maximum char count lower than 500.
hello
ist there possible: the news use the comment system from the coppermine-gallery?
pls help.
I don't really understand what you mean. An interface for writing news articles is created by the plugin.
yes..but a comment system like a blog was nice.
the user than can write comment to the news.
Nice idea, i might look into that for the future.
Hi, I have one small problem.Could you please make a lite version of the box that comes into the index, so in won't be expandable, and it would contain only 5 news, but only title and date, without that part of the news.
Thanks again.
P.s:sry fot my bad english :(
I'll look into this and get back to you.
Ok thank you were much :).
oh and if someone could tell me what I have to write in the index.php it would be great ;D
thanks again :D
hello..
is that compatible with the stramm modpack ?
because I have a critical error, when I want install
Yes it is compatible, i have the modpack installed and working fine as you can see on my site.
Can you turn on debug mode and provide the proper error, thanks.
Quote from: .andrew on January 03, 2008, 05:14:19 PM
Hi, I have one small problem.Could you please make a lite version of the box that comes into the index, so in won't be expandable, and it would contain only 5 news, but only title and date, without that part of the news.
Thanks again.
P.s:sry fot my bad english :(
news.phpFind
$sql ="SELECT * FROM cpg1411_plugin_news WHERE active=1 ORDER BY date DESC";
Replace with
$sql ="SELECT * FROM cpg1411_plugin_news WHERE active=1 ORDER BY date DESC LIMIT 5";
Find
<tr>
<td align="left" class="tableh2" colspan="3" onclick="show_section('section')">
<span onclick="show_section('section')" style="cursor:pointer" align="left"><a href="javascript:expand();"><img src="images/descending.gif" border="0" width="9" height="9" alt="" title="{$lang_admin_php['click_expand']}" /> <b>News</b></span><a/>
</td>
Replace With
<tr>
<td align="left" class="tableh2" colspan="3"">
<span align="left"><b>News</b></span>
</td>
Find and Remove
<script type="text/javascript">
function expand()
{
var Nodes = document.getElementsByTagName("table")
var max = Nodes.length
for(var i = 0;i < max;i++) {
var nodeObj = Nodes.item(i)
var str = nodeObj.id
if (str.match("section")) {
nodeObj.style.display = 'block';
}
}
}
</script>
Find and Remove
<script type="text/javascript">
onload = hideall;
</script>
Find and Remove
echo '<tr>';
echo '<td align="left">';
echo $row["value"] ,"<br />";
echo '</td>';
echo '</td>';
echo '<br/>';
Hmm i installed this plugin and it does not appear anywhere, not sure whats wrong, probably something in my template.html? i have more custom stuff installed
In Album list view add /news.
hmmm im pretty sure i did add /news in that secion, ill check once again when i get home.
Thank you very much just_some_guy , I'll try that :D
Later edit:It works!! :oThank you very much :D :) ;D
just_some_guy, could you please make am V3 that will contain a news.php page where users can see all the news and comment them?But only if you have time, and you want to. Thanks :)
I have started work on a blog plugin/mod for coppermine, so watch this space. ;D
A blog is what I'm after. So thanks in advance for the work you're doing!
Jim
would it be possible to have the news items aligned on the left ?
As now I see them in the middle.
Also , how can I delete the hide function ? Already have it to show , but would like it to have it shown always
And last but not least , how can I post links to new photo categories ?
This will do mostly what you want http://forum.coppermine-gallery.net/index.php?topic=48219.msg237901#msg237901, The link feature does not exist at this time, sorry.
I tried all those things.
But I now found how to set it to align from the left.
I removed :
table id="section"
Is this oke ? or will this f*ck up the mad/script ?
Well the thing you removed is the item that will expand, so if you want the table to be static then that is probs ok.
EDIT- Infact, keep table and just remove id="section".
I tried that. but than the table is back in the middle of the page.
And I would like to have the table aligned to the left.
How can I do that ?
Add align="left" to the table tag.
I have translated this Plug-in into German. I add the file to this post.
(I do not use this plugin - therefore the translation may lack smoothness. If anyone has suggestions to do better with phrases please let me know).
Hello
@just_some_guy how is the timetable for your blog plugin? Is there possible in the next time, or must I wait a longer time.
(Sry for my english)
Hi,
is it possible to change to color of the news text?
Best regards
just_some_guy,
Do you have a latest & greatest version of your plugin available for download? I'm not much of a coder and I'm sure that if I tried to edit the code I'd end up really messing things up.
Thanks,
Bryan
IS there a way for the news to only show in the main page ? like anycontent ?
I made some changes to the plugin, because i need some breaks in the news.
find in new.php
echo ' <textarea id="value" name="value" cols="50" rows="10">';
replace with
echo ' <textarea tabindex="3" wrap="virtual" id="value" name="value" cols="50" rows="10" >';
find in news.php
echo $row["value"] ,"<br />";
replace with
echo '<pre style="font-family:Arial,sans-serif; font-size: 12px;">'. htmlspecialchars_decode($row["value"]).'</pre>';
find in edit.php
echo ' <textarea id="value" name="value" cols="50" rows="10">';
replace with
echo ' <textarea id="value" wrap="virtual" name="value" cols="50" rows="10">';
and if you need active links you need to write your new news with html chars like
<a href=""></a>
kind regards Volker