I am dissappointed, I can't set format of text (PHP code, Full HTML, Filtered HTML, Texxy!, etc...) in teaser area. Format also isn't the same as was set in body area.
Have anyone idea what to do with this?

Another bug I have found is that area Teaser is not cloning by Clone module (node_clone-5.x-1.0-beta).

Comments

anantagati’s picture

Category: bug » feature
fxdxi’s picture

Assigned: fxdxi » Unassigned
toma’s picture

Assigned: Unassigned » toma
Category: feature » bug
Priority: Normal » Critical

its important to add image and html code restrict to users...

moonray’s picture

Status: Active » Needs review
StatusFileSize
new11.61 KB

Attached patch is against the DRUPAL-5 branch, and adds the following features:

- input format selector
- revisions
- diff module integration

lazly’s picture

Tested with:
- revisions
- diff module integration

Works good, thanks!

fxdxi’s picture

It does not work. Be Carefull!! The patch destoryed all previous teasers! and still does not work. (Off course, after patching the module I updated database.)

Now it shows those errors:

user warning: 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 'teaser_format = 1 WHERE vid = 1057' at line 1 query: UPDATE nodeteaser SET teaser = 'H E R E I S T H E C O N T E N T O F T E A S E R B L O C K' teaser_format = 1 WHERE vid = 1057 in /var/www/DRUPAL_PREFIX/includes/database.mysqli.inc on line 151.

The core is Drupal 5.5.

moonray’s picture

Were there any errors reported when updating the database?
It seems, from your error, that the update did not succeed. Try running /update.php, and
1) run the database upgrade script
2) click to expand Select versions
3) find nodeteaser module
4) set the drop-down box under it to 2
5) hit update

I hope that helps.

moonray’s picture

BTW, your teasers should all still be in the database. They're just not being picked up because it's looking for a particular revision (which it can't find). Your data is NOT LOST.

fxdxi’s picture

The error after upgdating databse:
user warning: Duplicate entry '0' for key 1 query: ALTER TABLE nodeteaser DROP INDEX nid, ADD PRIMARY KEY vid (vid) in /var/www/web/includes/database.mysqli.inc on line 151.

The following queries were executed

nodeteaser module

Update #2

* ALTER TABLE {nodeteaser} ADD vid int(10) NOT NULL DEFAULT '0' AFTER nid
* ALTER TABLE {nodeteaser} ADD teaser_format int(4) NOT NULL DEFAULT '0' AFTER teaser
* Failed: ALTER TABLE {nodeteaser} DROP INDEX nid, ADD PRIMARY KEY vid (vid)
* UPDATE {nodeteaser}, {node} SET {nodeteaser}.vid = {node}.vid, {nodeteaser}.teaser_format = 1 WHERE {nodeteaser}.nid = {node}.nid

fxdxi’s picture

When I do the missing step manualy later in phpMyAdmin:
ALTER TABLE `nodeteaser` DROP INDEX `nid`, ADD PRIMARY KEY (`vid`) ;
it works. Because now (after the last step of UPDATE) the columm "vid" has unique values, not "0" as default for all lines.

Unhapilly, I must say that it still does not work.
The previous teasers are still not shown and when I try to write some new this error appear:

user warning: 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 'teaser_format = 1 WHERE vid = 576' at line 1 query: UPDATE nodeteaser SET teaser = 'HERE IS TEASER' teaser_format = 1 WHERE vid = 576 in /var/www/web/includes/database.mysqli.inc on line 151.

anantagati’s picture

StatusFileSize
new11.71 KB

Attached changed patch.

      db_query("UPDATE {nodeteaser} SET teaser = '%s' teaser_format = %d WHERE vid = %d", $node->nodeteaser, $node->nodeteaser_format, $node->vid);

changed to:

      db_query("UPDATE {nodeteaser} SET teaser = '%s', teaser_format = %d WHERE vid = %d", $node->nodeteaser, $node->nodeteaser_format, $node->vid);

Now it save teasers after node edit.

anantagati’s picture

Status: Needs review » Needs work

I can confirm warning during update on website where nodes have already some saved teasers.

user warning: Duplicate entry '0' for key 1 query: ALTER TABLE nodeteaser DROP INDEX nid, ADD PRIMARY KEY vid (vid) in /drupal_path/includes/database.mysqli.inc on line 151.
fxdxi’s picture

Still it does not work. For both of "Input format" forms (Body & Teaser) on edit page I can choose only one option.

anantagati’s picture

Status: Needs work » Needs review
StatusFileSize
new11.72 KB

Choosing of input format should work now.

anantagati’s picture

StatusFileSize
new11.71 KB

I moved
$ret[] = update_sql("UPDATE {nodeteaser}, {node} SET {nodeteaser}.vid = {node}.vid, {nodeteaser}.teaser_format = 1 WHERE {nodeteaser}.nid = {node}.nid");
before
$ret[] = update_sql("ALTER TABLE {nodeteaser} DROP INDEX nid, ADD PRIMARY KEY vid (vid)");

So vid should be defined and warning when adding primary key should not be there.

anantagati’s picture

StatusFileSize
new11.39 KB

Added FALSE as third paramether to calling of check_markup().

$node->teaser = check_markup($node->nodeteaser, $node->nodeteaser_format, FALSE);

Without that users whose don't have permission to use format used for specific teaser will see 'n/a' instead of teaser text.

fxdxi’s picture

still does not work.

patch < nodeteaser_format_0.patch
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urp new\nodeteaser.install orig\nodeteaser.install
|--- new\nodeteaser.install Mon Dec 24 15:45:11 2007
|+++ orig\nodeteaser.install Mon Dec 24 15:48:56 2007
--------------------------
File to patch:

anantagati’s picture

StatusFileSize
new11.71 KB

Oh sorry, I swapped changed and original directory for patch. Now it should be ok.

fxdxi’s picture

Thanks. But the directory is not the main problem.

patch < nodeteaser.patch
(Stripping trailing CRs from patch.)
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urp orig\nodeteaser.install new\nodeteaser.install
|--- orig\nodeteaser.install Mon Dec 24 15:48:56 2007
|+++ new\nodeteaser.install Mon Dec 24 15:45:11 2007
--------------------------
File to patch: nodeteaser.install
patching file nodeteaser.install
(Stripping trailing CRs from patch.)
can't find file to patch at input line 85
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urp orig\nodeteaser.module new\nodeteaser.module
|--- orig\nodeteaser.module Mon Dec 24 15:48:56 2007
|+++ new\nodeteaser.module Mon Dec 24 15:48:35 2007
--------------------------
File to patch: nodeteaser.module
patching file nodeteaser.module
Hunk #1 FAILED at 23.
Hunk #2 FAILED at 34.
Hunk #3 FAILED at 104.
Hunk #4 FAILED at 160.
Hunk #5 FAILED at 215.

5 out of 5 hunks FAILED -- saving rejects to file nodeteaser.module.rej

justin3’s picture

another option is to apply the same filter to all teasers, but sorted by role

without needing any of the patches...
add a few lines to nodeteaser.module, at line 120 ~ delete one line (replaced by 3rd line below)

<?php
	if ($nt->teaser != '') {
// add these three lines- everyone gets filter X, else anon gets default filter
		if ($node->uid != 0) $filter = 4;
		else $filter = 1;
		$node->teaser = check_markup($nt->teaser, $filter, FALSE);
// done
		$node->nodeteaser = TRUE;
?>

where $filter = the filter id, goto input formats and look at the 'configure' urls .../admin/settings/filters/?