Skip to content

Commit

Permalink
Reorganized Theme structure to add more flexibility for theme designe…
Browse files Browse the repository at this point in the history
…r. Now, designers can create designs in artisteer, and use the img and CSS directly in the theme (only need to replace img path in CSS).

Added a new theme CSS based on the new structure. 

A new file in each theme, theme_functions.php is neccessary. For those who are upgrading, and have tailored themes from before, just drop in the file from Silver theme to make it work.
  • Loading branch information
OleKEH committed Jan 25, 2011
1 parent d54165b commit aa533ac
Show file tree
Hide file tree
Showing 64 changed files with 4,550 additions and 236 deletions.
39 changes: 28 additions & 11 deletions prairie/checkdbconfig.php
Expand Up @@ -27,11 +27,10 @@
// tables. To run this manually (after upgrade) - run: http://<yourdomain>/checkdbconfig
// once to add new fields that needs to be added to the database.

/*
* -- -----------------------------------------------------
-- Table `prairie_user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `prairie_user` (


$userTable = new StructureUpdate ($db, "prairie_user");
$userTable->checkCreate("CREATE TABLE IF NOT EXISTS `prairie_user` (
`user_id` INT(11) NOT NULL AUTO_INCREMENT ,
`openid_name` VARCHAR(100) NOT NULL ,
`user_name` VARCHAR(255) NOT NULL ,
Expand All @@ -50,12 +49,8 @@
`user_timezone` VARCHAR(45) NULL ,
PRIMARY KEY (`user_id`) )
ENGINE = InnoDB
AUTO_INCREMENT = 4
DEFAULT CHARACTER SET = utf8;
DEFAULT CHARACTER SET = utf8;");

*/

$userTable = new StructureUpdate ($db, "prairie_user");
$userTable->addField('user_id', 'INT(11) NOT NULL AUTO_INCREMENT');
$userTable->addField('openid_name', 'VARCHAR(100) NOT NULL');
$userTable->addField('user_name', 'VARCHAR(255) NOT NULL');
Expand All @@ -73,7 +68,29 @@
$userTable->addField('user_language', 'VARCHAR(45) NULL');
$userTable->addField('user_timezone', 'VARCHAR(45) NULL');
$userTable->addField('user_bio', 'TEXT NULL');
$userTable->addField('user_birthdate', 'DATE NULL');
$userTable->addField('user_birthdate', 'DATE NOT NULL');
$userTable->syncTableDef();


$articletable = new StructureUpdate($db, "prairie_articles");
$articletable->checkCreate("CREATE TABLE IF NOT EXISTS `prairie_articles` (
`art_id` INT(11) NOT NULL AUTO_INCREMENT ,
`user_id` INT(11) NOT NULL ,
`art_Title` VARCHAR(100) NULL ,
`art_html` TEXT NOT NULL ,
`art_menutext` VARCHAR(45) NOT NULL ,
`art_order` INT NULL ,
PRIMARY KEY (`art_id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;");
$articletable->addField('art_id', 'INT(11) NOT NULL AUTO_INCREMENT');
$articletable->addField('user_id', 'INT(11) NOT NULL');
$articletable->addField('art_Title', 'VARCHAR(100) NULL');
$articletable->addField('art_html', 'TEXT NOT NULL');
$articletable->addField('art_menutext', 'VARCHAR(45) NOT NULL');
$articletable->addField('art_order', 'INT NULL');
$articletable->syncTableDef();



?>
8 changes: 3 additions & 5 deletions prairie/editor.php 100755 → 100644
Expand Up @@ -83,8 +83,8 @@
$html = trim($_POST['html']);
$html = parseHTML($html, $core_config['security']['allowable_html_tags']);

$css = trim($_POST['css']);
$css = parseCSS($css);
// $css = trim($_POST['css']);
// $css = parseCSS($css);

$query = "
SELECT user_id
Expand All @@ -99,7 +99,7 @@

$rec['user_id'] = $_SESSION['user_id'];
$rec['webspace_html'] = $html;
$rec['webspace_css'] = $css;
// $rec['webspace_css'] = $css;

$table = $db->prefix . '_webspace';

Expand All @@ -110,11 +110,9 @@
UPDATE " . $db->prefix . "_webspace
SET
webspace_html=" . $db->qstr($html) . ",
webspace_css=" . $db->qstr($css) . "
WHERE
user_id=" . $_SESSION['user_id']
;

$db->Execute($query);
}

Expand Down
22 changes: 22 additions & 0 deletions prairie/inc/functions.inc.php
Expand Up @@ -96,6 +96,15 @@ function form_($action="", $method="POST", $style="") {
return $html;
}

function p_($body, $id="") {
if ($id) $idtx=' id="'.$id.'"'; else $idtx="";
return "<p$idtx>$body</p>";
}

function note_($body) {
return '<p class="note">'.$body.'</p>';
}

function checkbox_($name, $defval="") {
// '<input name="xxid" type="checkbox" id="xxid" value="1" checked>'
$html='<input name="'.$name.'" type="checkbox" id="'.$name.'" value="1"';
Expand All @@ -104,6 +113,19 @@ function checkbox_($name, $defval="") {
return $html;
}

function labelinput_($name, $label, $value="", $pid="", $iid="") {
if ($iid) $ixid = $iid; else $ixid = "id_".$name;
$html=p_("<label for=".'"'.$ixid.'">'.$label."</label>
<input type=".'"text" name="'.$name.'" id="'.$ixid.'" value="'.$value.'" />', $pid);
return $html;
}

function labeltextarea_($name, $label, $value="") {
$html=p_("<label for=".'id_'.$name.'">'.$label."</label>
<textarea name=".'"'.$name.'" id="id_'.$name.'">'.$value.'</textarea>');
return $html;
}

function input_($name, $defval="", $type="text", $size=45, $maxlength=0, $style=""){
$html='<input';
if ($style)$html.=' class="'.$style.'"';
Expand Down
3 changes: 3 additions & 0 deletions prairie/index.php 100755 → 100644
Expand Up @@ -118,6 +118,7 @@

define("WEBSPACE_OPENID", $webspace['openid_name']);
define("WEBSPACE_USERID", $webspace['user_id']);
define("WEBSPACE_USERNAME", $webspace['user_name']);

if (!empty($webspace['webspace_title'])) {
$tpl->set('webspace_title', $webspace['webspace_title']);
Expand Down Expand Up @@ -186,6 +187,8 @@

define("SCRIPT_THEME_PATH", "theme/" . SCRIPT_THEME_NAME . "/");

require_once (SCRIPT_THEME_PATH . "theme_functions.php");

// OBTAIN SCRIPT NAME --------------------------------------------------
if (isset($uri_routing[0]) && is_readable(SCRIPT_TEMPLATE_PATH . $uri_routing[0] . '.tpl.php')) {
define("SCRIPT_NAME", $uri_routing[0]);
Expand Down
80 changes: 51 additions & 29 deletions prairie/install/install.sql 100755 → 100644
Expand Up @@ -4,6 +4,7 @@
-- Copyright (C) 2003-2008 Barnraiser
-- http:--www.barnraiser.org/
-- info@barnraiser.org
-- changes to extend the model done by Ole Kristian Ek Hornnes, www.nett-tech.com
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
Expand All @@ -18,14 +19,12 @@
-- You should have received a copy of the GNU General Public License
-- along with this program; see the file COPYING.txt. If not, see
-- <http:--www.gnu.org/licenses/>
--
-- NETT TECH:
-- Updated the user table for new columns user_nic..user_bio to store
-- neccessary data for the SREG extention. 19.01.2011
-------------------------------------------------------------------------


-- Table structure for table `prairie_session`
-- -----------------------------------------------------
-- Table `prairie_session`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `prairie_session` (
`assoc_handle` varchar(200) NOT NULL default '',
`assoc_type` varchar(200) default NULL,
Expand All @@ -38,7 +37,9 @@ CREATE TABLE IF NOT EXISTS `prairie_session` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-- Table structure for table `prairie_trust`
-- -----------------------------------------------------
-- Table `prairie_trust`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `prairie_trust` (
`trust_id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
Expand All @@ -49,31 +50,37 @@ CREATE TABLE IF NOT EXISTS `prairie_trust` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-- Table structure for table `prairie_user`
CREATE TABLE IF NOT EXISTS `prairie_user` (
`user_id` int(11) NOT NULL auto_increment,
`openid_name` varchar(100) NOT NULL,
`user_name` varchar(255) NOT NULL,
`user_password` varchar(255) NOT NULL,
`user_email` varchar(255) NOT NULL,
`user_location` varchar(255) NOT NULL,
`user_dob` date NOT NULL,
`user_registration_key` varchar(100) default NULL,
`user_live` int(1) NOT NULL default '0',
`user_create_datetime` datetime NOT NULL,
`user_nick` VARCHAR(45) NULL DEFAULT NULL,
`user_gender` VARCHAR(10) NULL DEFAULT NULL,
`user_postcode` VARCHAR(45) NULL DEFAULT NULL,
`user_country` VARCHAR(45) NULL DEFAULT NULL,
`user_language` VARCHAR(45) NULL DEFAULT NULL,
`user_timezone` VARCHAR(45) NULL DEFAULT NULL,
`user_bio` text NOT NULL,
`user_birthdate` date NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `prairie_user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `prairie_user` (
`user_id` INT(11) NOT NULL AUTO_INCREMENT ,
`openid_name` VARCHAR(100) NOT NULL ,
`user_name` VARCHAR(255) NOT NULL ,
`user_password` VARCHAR(255) NOT NULL ,
`user_email` VARCHAR(255) NOT NULL ,
`user_location` VARCHAR(255) NOT NULL ,
`user_dob` DATE NOT NULL ,
`user_registration_key` VARCHAR(100) NULL DEFAULT NULL ,
`user_live` INT(1) NOT NULL DEFAULT '0' ,
`user_create_datetime` DATETIME NOT NULL ,
`user_nick` VARCHAR(45) NULL DEFAULT NULL ,
`user_gender` VARCHAR(10) NULL DEFAULT NULL ,
`user_postcode` VARCHAR(45) NULL DEFAULT NULL ,
`user_country` VARCHAR(45) NULL DEFAULT NULL ,
`user_language` VARCHAR(45) NULL DEFAULT NULL ,
`user_timezone` VARCHAR(45) NULL DEFAULT NULL ,
`user_bio` TEXT NULL DEFAULT NULL ,
`user_birthdate` DATE NOT NULL ,
PRIMARY KEY (`user_id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;



-- Table structure for table `prairie_webspace`
-- -----------------------------------------------------
-- Table `prairie_webspace`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `prairie_webspace` (
`user_id` int(11) NOT NULL,
`webspace_title` varchar(100) default NULL,
Expand All @@ -82,4 +89,19 @@ CREATE TABLE IF NOT EXISTS `prairie_webspace` (
`webspace_theme` varchar(50) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- -----------------------------------------------------
-- Table `prairie_articles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `prairie_articles` (
`art_id` INT NOT NULL AUTO_INCREMENT ,
`user_id` INT NOT NULL ,
`art_Title` VARCHAR(100) NULL ,
`art_html` TEXT NOT NULL ,
`art_menutext` VARCHAR(45) NOT NULL ,
`art_order` INT NULL ,
PRIMARY KEY (`art_id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;


-- ENDS
2 changes: 1 addition & 1 deletion prairie/install/installer.tpl.php
Expand Up @@ -94,7 +94,7 @@
<?php }?>


<form method="POST">
<form method="post">

<?php
if (!isset($display)) {
Expand Down
4 changes: 2 additions & 2 deletions prairie/template/editor.tpl.php 100755 → 100644
Expand Up @@ -116,12 +116,12 @@ function selectTheme(theme) {
</script>

</p>
<!-- Remove the css field due to end-user usability. The CSS are handled by the tiny_mce
<p>
<label for="id_css"><?php echo _("CSS");?></label>
<textarea id="id_css" name="css"><?php if (isset($webspace['webspace_css'])) echo $webspace['webspace_css']; ?></textarea>
</p>

-->
<p class="buttons">
<input type="submit" name="save_markup" value="<?php echo _("save");?>" />
</p>
Expand Down

0 comments on commit aa533ac

Please sign in to comment.