[drupal-devel] [feature] Multiple simple nodes

m3avrck drupal-devel at drupal.org
Tue Aug 30 14:55:53 UTC 2005


Issue status update for 
http://drupal.org/node/29794
Post a follow up: 
http://drupal.org/project/comments/add/29794

 Project:      Drupal
 Version:      cvs
 Component:    node system
 Category:     feature requests
 Priority:     normal
 Assigned to:  chx
 Reported by:  chx
 Updated by:   m3avrck
 Status:       patch (code needs review)

I've tried this module but having some problems. I've created a content
type but when I goto Create Content, I don't see this new type listed.
Also, on the content page, shouldn't this be listed in the drop downs
for "show content as..." since this is a new type as well?




m3avrck



Previous comments:
------------------------------------------------------------------------

Sat, 27 Aug 2005 11:34:39 +0000 : chx

Attachment: http://drupal.org/files/issues/simplenode.module (9.09 KB)

Instead of page, story etc let's have a module with which you can add
simple body only nodes. At least moshe and I frequently copy
story.module to have a new simple module. For example, event needs
this. For permissions it's great to have multiple node types. So I
downloaded a copy of content.module from CCK, pressed delete a lot,
copied hook_form from story and then rename the stuff to
simplenode.module. Then I reviewed the thing but it was really not
much, so credit goes to JonBob and jvandyk.


MySQL is:


CREATE TABLE node_type (
  type_name varchar(31) NOT NULL default '',
  label varchar(255) NOT NULL default '',
  description mediumtext NOT NULL,
  help mediumtext NOT NULL,
  PRIMARY KEY  (type_name)
) TYPE=MyISAM;




------------------------------------------------------------------------

Sat, 27 Aug 2005 11:44:09 +0000 : chx

Attachment: http://drupal.org/files/issues/simplenode_0.module (8.81 KB)

To save a couple hundred bytes of code and also a lot in DB I removed
hard caching of node types. It's surely needed for CCK, not for us.




------------------------------------------------------------------------

Sat, 27 Aug 2005 13:02:49 +0000 : kbahey

+1.


This is something needed a lot and will save a lot of code duplication,
and tricks like two stub event sumodules.


since CCK will not make it to 4.7, this is the way to go.




------------------------------------------------------------------------

Sat, 27 Aug 2005 15:03:24 +0000 : Cvbge

Please change the file name extension, as now it's hard to download.


Maybe we could make type_name longer? 64 or even 128 seems practical
(hell, it's VARCHAR, there should be no difference between 31 and 255).


I've skimmed sql part of module, you do INSERT INTO {node_type}
(type_name, label, description) VALUES ('%s', '%s', '%s'), what about
help column? It's NOT NULL, has no DEFAULT and you don't provide any
value for it.


The SELECT * FROM {node_type} nt WHERE 1 ORDER BY nt.type_name ASC
won't work in postgres, you need to change WHERE 1 to for example WHERE
1=1. Why do you need WHERE anyway?




------------------------------------------------------------------------

Sat, 27 Aug 2005 15:04:31 +0000 : Eaton

+1 I'm very much in favor of it. Already using it in a site I'm mocking
up.




------------------------------------------------------------------------

Sat, 27 Aug 2005 15:16:08 +0000 : chx

Attachment: http://drupal.org/files/issues/simplenode.module.txt (8.84 KB)




------------------------------------------------------------------------

Sat, 27 Aug 2005 15:21:14 +0000 : jvandyk

Cvbge, no need to make type_name longer. We just changed this [1] to go
from 8 to 32 chars.


Maybe you're thinking of the label field, which is already 255.


Please keep this as compatible as possible with CCK. Download CCK from
CVS, add a new content type and see how it works.
[1] http://drupal.org/node/27985




------------------------------------------------------------------------

Sat, 27 Aug 2005 15:39:18 +0000 : chx

Attachment: http://drupal.org/files/issues/simplenode.module_0.txt (8.85 KB)




------------------------------------------------------------------------

Sat, 27 Aug 2005 15:47:15 +0000 : Cvbge

@#6:
I was thinking about type_name (as posted in the first issue post). I
assume that it's displayed somewhere on the page. If it is shown to
normal user, one who browses the web page, it contains/can contain
informative content. As such, I think we should not limit the admin to
31 characters.
If it is not shown to users, then 31 characters is probably enough.




------------------------------------------------------------------------

Sat, 27 Aug 2005 16:04:01 +0000 : jvandyk

type_name is the internal name. It is used in urls like node/add/foo
where type_name is foo. The foo content type also has a friendly name
called label. Note the second column in the table. The label is used
when displaying to the user.




------------------------------------------------------------------------

Sun, 28 Aug 2005 21:48:26 +0000 : chx

Attachment: http://drupal.org/files/issues/content.module.txt (8.59 KB)

Upon Dries word, this module is called content. I have fiddled with
field names and such to be more in line with current node.module.




------------------------------------------------------------------------

Sun, 28 Aug 2005 21:50:55 +0000 : chx

Attachment: http://drupal.org/files/issues/content.module_0.txt (8.57 KB)

Also, Dries said that he'd like to see "create $type content" instad of
'create '. $type .' content'. Who am I disagree with easier to read and
shorter code?




------------------------------------------------------------------------

Sun, 28 Aug 2005 21:51:44 +0000 : kbahey

But isn't the name "content" going to be used by the CCK module?




------------------------------------------------------------------------

Sun, 28 Aug 2005 21:56:26 +0000 : chx

I think I told Dries that CCK is already called content....




------------------------------------------------------------------------

Mon, 29 Aug 2005 18:07:29 +0000 : m3avrck

Getting this error:


user error: Unknown column 'nt.type' in 'order clause'
query: SELECT * FROM node_type nt ORDER BY nt.type ASC 


Seems line 266 should be type_name and not type. Or is the SQL create
wrong?




------------------------------------------------------------------------

Mon, 29 Aug 2005 18:11:11 +0000 : m3avrck

Also getting this error which is related:


user error: Unknown column 'type' in 'field list'
query: INSERT INTO node_type (type, name, description, help) VALUES
('story_asdfad', 'new_story', '', '')


Line 185. What is the correct SQL create code? Or is the module code
wrong? Please clarify!




------------------------------------------------------------------------

Mon, 29 Aug 2005 18:13:17 +0000 : m3avrck

Also, the settings is a bit confusing because Drupal already has
Settings > Content-Types ... and now there is Content > Content-Types
... confusing as to what the difference is for each. Also, should the
settings for this module go under Settings or be part of the main
Administer menu?




------------------------------------------------------------------------

Mon, 29 Aug 2005 21:51:26 +0000 : chx

CREATE TABLE node_type (
  type varchar(31) NOT NULL default '',
  name varchar(255) NOT NULL default '',
  description mediumtext NOT NULL,
  help mediumtext NOT NULL,
  PRIMARY KEY (type_name)
) TYPE=MyISAM;


We can talk about the menu placement when it's in. That's something
that can tweaked after the freeze.




------------------------------------------------------------------------

Tue, 30 Aug 2005 14:39:27 +0000 : m3avrck

error in that SQL, should the primary key be (type,name) I'm assuming?


CREATE TABLE node_type (
  type varchar(31) NOT NULL default '',
  name varchar(255) NOT NULL default '',
  description mediumtext NOT NULL,
  help mediumtext NOT NULL,
  PRIMARY KEY (type,name)
) TYPE=MyISAM;







More information about the drupal-devel mailing list