2001-03-10 11:07:52 +00:00
< ? php
2000-10-10 10:52:19 +00:00
2001-06-10 13:53:44 +00:00
class BaseTheme {
2001-06-29 22:08:57 +00:00
function links ( $links , $delimiter = " | " ) {
return implode ( $delimiter , $links );
This a rather large commit that needs a lot of fine-tuning. If you
update, you'll break your site as you need switching from structure
to index.module: so this can be considered an intermediate commit.
If you upgrade, and you are welcome to, just create a collection
called "section" (for now) and assign your nodes some attributes
in the described format.
Feedback and bugreports are welcomed. Questions will be answered.
CHANGES:
- comment system:
+ when replying to a node (rather then to a comment), that
node is displayed above the reply form.
+ when replying to a comment (rather then to a node), that
comment is displayd above the reply form.
- removed structure.inc, removed structure.module.
- node.inc:
+ added 2 new node functions called 'node_attribute_edit()' and
'node_attribute_save()' used to 'hook in' any indexing system
including your home-brewed stuff if you'd want to. Currently,
index.module is the facto default index system.
See story.module for usage.
- book.module, story.module, poll.module, page.module, forum.module:
+ added preview functionality to administration section (via node
module).
+ removed all references to structure.inc (category, topic).
- moderate.module:
+ removed all references to structure.inc (category, topic).
- book.module, story.module, page.module, forum.module:
+ increased the sizes of some textareas.
- submit.php:
+ removed all references to structure.inc (category, topic).
- marvin.theme:
+ removed dead code: function story() was depricated.
- unconed.theme:
+ removed hardcoded references to drop.org.
- marvin.theme, unconed.theme, jeroen.theme, yaroon.theme, example.theme:
+ removed all references to structure.inc (category, topic).
TODO:
- file.module, trip_link.module:
+ update preview functionality:
see story.module for example.
+ remove references to 'cid' and 'tid', use 'attribute' instead:
see story.module for example.
- extend and build upon index.module as well as making it configurable
2001-06-10 15:01:20 +00:00
}
2001-07-14 12:12:41 +00:00
2001-07-14 13:36:38 +00:00
function image ( $name ) {
return " misc/ $name " ;
2001-07-14 12:12:41 +00:00
}
2001-08-11 14:54:39 +00:00
2001-07-25 08:31:53 +00:00
function comment_controls ( $threshold = 1 , $mode = 3 , $order = 1 ) {
global $REQUEST_URI , $user ;
$output .= " <DIV ALIGN= \" CENTER \" > \n " ;
$output .= " <FORM METHOD= \" post \" ACTION= \" $REQUEST_URI\ " > \n " ;
$output .= comment_mode (( $user -> id ? $user -> mode : $mode ));
$output .= comment_order (( $user -> id ? $user -> sort : $order ));
$output .= comment_threshold (( $user -> id ? $user -> threshold : $threshold ));
$output .= " <INPUT TYPE= \" submit \" NAME= \" op \" VALUE= \" " . t ( " Update settings " ) . " \" > \n " ;
$output .= " <INPUT TYPE= \" submit \" NAME= \" op \" VALUE= \" " . t ( " Add comment " ) . " \" > \n " ;
$output .= " </FORM> \n " ;
$output .= " </DIV> \n " ;
return $output ;
}
2001-06-10 13:53:44 +00:00
}
2001-02-18 15:14:56 +00:00
function theme_init () {
2001-01-21 19:41:11 +00:00
global $user , $themes ;
if ( $user -> theme && file_exists ( $themes [ $user -> theme ][ 0 ])) {
2001-01-26 13:38:46 +00:00
include_once $themes [ $user -> theme ][ 0 ];
2001-01-21 19:41:11 +00:00
}
else {
2001-05-06 17:19:58 +00:00
include_once $themes [ variable_get ( " theme_default " , key ( $themes ))][ 0 ];
2001-01-21 19:41:11 +00:00
}
return new Theme ();
}
2001-07-14 01:01:45 +00:00
function theme_account ( $region , $theme ) {
2001-05-05 13:57:29 +00:00
global $user ;
2001-01-26 13:38:46 +00:00
if ( $user -> id ) {
2000-12-30 11:58:14 +00:00
// Display account settings:
2001-07-07 11:14:25 +00:00
$content .= " <table><tr><td nowrap= \" nowrap \" > \n " ;
$content .= " <a href= \" account.php?op=edit&type=information \" > " . t ( " your information " ) . " </a><BR> \n " ;
$content .= " <a href= \" account.php?op=edit&type=settings \" > " . t ( " your settings " ) . " </a><BR> \n " ;
$content .= " <a href= \" account.php?op=edit&type=blocks \" > " . t ( " your blocks " ) . " </a><BR> \n " ;
$content .= " <a href= \" account.php?op=view&type=comments \" > " . t ( " your comments " ) . " </a><BR> \n " ;
2001-07-15 11:32:46 +00:00
$content .= " <a href= \" account.php?op=view&type=contributions \" > " . t ( " your submissions " ) . " </a><BR> \n " ;
2001-07-07 11:14:25 +00:00
$content .= " <a href= \" account.php?op=view&type=site \" > " . strtr ( t ( " your %a " ), array ( " %a " => variable_get ( " site_name " , " drupal " ))) . " </a><BR> \n " ;
$content .= " <p /> \n " ;
2001-01-06 11:39:43 +00:00
2001-06-29 22:08:57 +00:00
if ( user_access ( " access administration pages " )) {
2001-07-07 11:14:25 +00:00
$content .= " <a href= \" admin.php \" > " . strtr ( t ( " administer %a " ), array ( " %a " => variable_get ( " site_name " , " drupal " ))) . " </a><BR> \n " ;
$content .= " <p /> \n " ;
2001-01-06 11:39:43 +00:00
}
2001-05-05 13:57:29 +00:00
foreach ( module_list () as $name ) {
2001-06-29 22:08:57 +00:00
if ( module_hook ( $name , " link " )) {
$links = module_invoke ( $name , " link " , " menu " );
2001-07-07 11:14:25 +00:00
foreach ( $links as $link ) $content .= " $link <br /> \n " ;
2001-05-05 13:57:29 +00:00
}
2001-01-04 21:09:40 +00:00
}
2001-07-07 11:14:25 +00:00
if ( $link ) $content .= " <p /> \n " ;
2001-01-06 11:39:43 +00:00
2001-07-07 11:14:25 +00:00
$content .= " <a href= \" account.php?op=logout \" > " . t ( " logout " ) . " </a> \n " ;
$content .= " </td></tr></table> \n " ;
2000-12-23 23:25:28 +00:00
2001-08-11 14:54:39 +00:00
$theme -> box ( $user -> name , $content , $region );
2000-12-23 23:25:28 +00:00
}
else {
2001-07-07 11:14:25 +00:00
$output .= " <div align= \" center \" > \n " ;
$output .= " <form action= \" account.php?op=login \" method= \" post \" > \n " ;
$output .= " <b> " . t ( " Username " ) . " :</b><br /><input name= \" userid \" size= \" 15 \" ><p /> \n " ;
$output .= " <b> " . t ( " Password " ) . " :</b><br /><input name= \" passwd \" size= \" 15 \" TYPE= \" password \" ><br /> \n " ;
$output .= " <input type= \" submit \" value= \" " . t ( " Login " ) . " \" ><br /> \n " ;
if ( variable_get ( " account_register " , 1 )) $output .= " <a href= \" account.php \" > " . t ( " REGISTER " ) . " </a> \n " ;
$output .= " </form> \n " ;
$output .= " </div> \n " ;
2000-12-23 23:25:28 +00:00
2001-07-14 01:01:45 +00:00
$theme -> box ( t ( " Login " ), $output , $region );
2000-12-23 23:25:28 +00:00
}
}
2001-01-13 16:33:19 +00:00
function theme_blocks ( $region , $theme ) {
2001-03-25 10:57:01 +00:00
global $id , $PHP_SELF , $status , $user ;
2001-01-26 13:38:46 +00:00
2001-01-24 08:24:37 +00:00
switch ( strrchr ( $PHP_SELF , " / " )) {
2001-03-24 17:04:11 +00:00
case " /node.php " :
2001-03-08 21:00:28 +00:00
if ( $region != " left " ) {
2001-03-29 19:50:31 +00:00
if ( $user -> id ) $node = db_fetch_object ( db_query ( " SELECT * FROM node WHERE nid = ' $id ' " ));
2001-07-14 01:01:45 +00:00
if ( $node -> status == $status [ queued ]) theme_moderation_results ( $theme , $node , $region );
2001-03-08 21:00:28 +00:00
}
2000-12-23 23:25:28 +00:00
break ;
2001-01-24 08:24:37 +00:00
case " /index.php " :
2001-03-08 10:49:26 +00:00
if ( $user -> id ) $result = db_query ( " SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.user = ' $user->id ')) " . (( $region == " left " || $region == " right " ) ? ( $region == " left " ? " AND b.region = 0 " : " AND b.region = 1 " ) : " " ) . " ORDER BY weight " );
2001-02-27 20:58:51 +00:00
else $result = db_query ( " SELECT * FROM blocks WHERE status = 2 " . (( $region == " left " || $region == " right " ) ? ( $region == " left " ? " AND region = 0 " : " AND region = 1 " ) : " " ) . " ORDER BY weight " );
2000-12-29 11:00:56 +00:00
while ( $block = db_fetch_object ( $result )) {
2001-05-05 13:57:29 +00:00
$blocks = module_invoke ( $block -> module , " block " );
2001-07-14 01:01:45 +00:00
$theme -> box ( t ( $blocks [ $block -> offset ][ " subject " ]), $blocks [ $block -> offset ][ " content " ], $region );
2000-12-29 11:00:56 +00:00
}
break ;
2000-12-23 23:25:28 +00:00
}
}
2001-07-14 01:01:45 +00:00
function theme_moderation_results ( $theme , $node , $region ) {
2001-06-11 20:01:13 +00:00
foreach ( explode ( " , " , $node -> users ) as $vote ) {
2001-05-16 20:54:37 +00:00
if ( $vote ) {
2001-06-11 20:01:13 +00:00
$data = explode ( " = " , $vote );
2001-08-11 14:54:39 +00:00
$account = user_get ( $data [ 0 ]);
$output .= format_name ( $account -> name ) . " voted ' $data[1] '.<br /> " ;
2000-12-23 23:25:28 +00:00
}
}
2001-05-16 20:54:37 +00:00
2001-07-14 01:01:45 +00:00
$theme -> box ( t ( " Moderation results " ), ( $output ? $output : t ( " This node has not been moderated yet. " )), $region );
2000-12-23 23:25:28 +00:00
}
2000-11-07 08:58:36 +00:00
?>