--
-- Host: localhost    Database: odev
-- ------------------------------------------------------


--
-- Table structure for table `opl_portalLayout`
--

CREATE TABLE `opl_portalLayout` (
  `tid` int(10) unsigned NOT NULL default '0',
  `cid` int(10) unsigned NOT NULL auto_increment,
  `colPos` tinyint(3) unsigned NOT NULL default '1',
  `rowPos` tinyint(3) unsigned NOT NULL default '1',
  `cWidth` smallint(4) default NULL,
  `cHeight` smallint(4) default NULL,
  UNIQUE KEY `cid` (`cid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `opl_portalLayout`
--

INSERT INTO `opl_portalLayout` VALUES (1,1,1,1,737,NULL),(1,2,2,1,NULL,NULL);

--
-- Table structure for table `opl_portalTheme`
--

CREATE TABLE `opl_portalTheme` (
  `tid` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `css` varchar(255) default NULL,
  UNIQUE KEY `tid` (`tid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `opl_portalTheme`
--

INSERT INTO `opl_portalTheme` VALUES (1,'basic','blueTheme');

--
-- Table structure for table `opl_portlet`
--

CREATE TABLE `opl_portlet` (
  `pid` int(10) unsigned NOT NULL auto_increment,
  `cid` int(10) unsigned NOT NULL,
  `ordinal` tinyint(3) default NULL,
  `type` enum('aboutUs','rss','search','libraryHours','newItemList','newsEvents','image','webLinks','pathfinders','weather') default NULL,
  UNIQUE KEY `pid` (`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `opl_portlet`
--

INSERT INTO `opl_portlet` VALUES (1,1,1,'aboutUs'),(2,2,2,'libraryHours'),(5,1,2,'newItemList');


INSERT INTO opl_portlet(pid,cid,ordinal,type) select 6,1,3,'pathfinders' from pf_record having count(*)>0;
INSERT INTO opl_portlet(pid,cid,ordinal,type) select 4,2,1,'webLinks' from opl_webLinks having count(*)>0;
INSERT INTO opl_portlet(pid,cid,ordinal,type) select 3,1,1,'newsEvents' from opl_newsEvents having count(*)>0;




--
-- Table structure for table `opl_portletProp`
--

CREATE TABLE `opl_portletProp` (
  `pid` int(10) unsigned NOT NULL,
  `var` varchar(255) default NULL,
  `val` text,
  UNIQUE KEY `propId` (`pid`,`var`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `opl_portletProp`
--

INSERT INTO `opl_portletProp` VALUES 
(4,'fieldsShow','title,url,grade,subject'),
(4,'nItemShow','3'),
(5,'showBookCover','true'),
(5,'fieldsShow','title,author'),
(5,'nItemShow','9'),
(3,'fieldsShow','title'),
(3,'nItemShow','3');


insert into opl_portletProp set pid=1,var='content', val='<table><tr align="center"><td><img src="/bin/util/loadfile?fileType=image;fileName=logo;" alt="Library Logo"></td><td valign="middle"><div style="font-size: 18pt; padding: 20px 20px 12px;">SCHOOLNAME</div><div style="font-size: 14pt; white-space: nowrap;">SLOGAN</div></td></tr></table>';
update opl_portletProp set val=replace(val,'SCHOOLNAME',(select val from opl_preference where var='link1_name')) where pid=1;
update opl_portletProp set val=replace(val,'SLOGAN',(select val from opl_preference where var='slogan')) where pid=1;



UPDATE opl_preference set gOrder=gOrder+1 where gid=5 && gOrder>1;
INSERT into opl_preference 
set var='defaultSearchResultSort',
    val='31',
    valShow='Publication date',
    opt='Integer',
    varType='select',
    description='Default search result sort field',
    gid=5,
    gOrder=2;

insert into opl_prefFormParam(var,listOrder,name,val) values
    ('defaultSearchResultSort',0,'Publication date','31'),
    ('defaultSearchResultSort',1,'Title','4'),
    ('defaultSearchResultSort',2,'Author','1003'),
    ('defaultSearchResultSort',3,'Callnumber','5001'),
    ('defaultSearchResultSort',4,'Location','8008'),
    ('defaultSearchResultSort',5,'Relevance','0');
    





