ALTER TABLE wcf1_user ADD socialID int(10) UNSIGNED NOT NULL DEFAULT '0';

DROP TABLE IF EXISTS wcf1_buddyloo;
CREATE TABLE wcf1_buddyloo (
  userID int(10) unsigned NOT NULL,
  whiteUserID int(10) unsigned NOT NULL,
  PRIMARY KEY (userID,whiteUserID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_buddyloo_invitation;
CREATE TABLE wcf1_buddyloo_invitation (
  userID int(10) unsigned NOT NULL,
  email varchar(255) NOT NULL,
  PRIMARY KEY (userID,email)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_buddyloo_social;
CREATE TABLE wcf1_buddyloo_social (
  socialID int(10) unsigned NOT NULL auto_increment,
  socialTitle varchar(80) NOT NULL,
  socialAccess tinyint(1) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (socialID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_buddyloo_gadget;
CREATE TABLE wcf1_buddyloo_gadget (
  gadgetID int(10) unsigned NOT NULL auto_increment,
  gadgetTitle varchar(80) NOT NULL,
  gadgetCode MEDIUMTEXT NOT NULL,
  gadgetImage BLOB NULL DEFAULT NULL,
  gadgetDescription TEXT NOT NULL,
  PRIMARY KEY (gadgetID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_buddyloo_gadget_to_social;
CREATE TABLE wcf1_buddyloo_gadget_to_social (
  boxID int(10) unsigned NOT NULL auto_increment,
  socialID int(10) unsigned NOT NULL,
  gadgetID int(10) unsigned NOT NULL,
  icolumn tinyint(1) unsigned NOT NULL,
  irow tinyint(1) unsigned NOT NULL,
  visible tinyint(1) unsigned NOT NULL DEFAULT 1,
  PRIMARY KEY (boxID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_buddyloo_user_to_social;
CREATE TABLE wcf1_buddyloo_user_to_social (
  userID int(10) unsigned NOT NULL,
  socialID int(10) unsigned NOT NULL,
  icolumn tinyint(1) unsigned NOT NULL,
  PRIMARY KEY (userID,socialID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; 	

DROP TABLE IF EXISTS wcf1_buddyloo_gadget_variables;
CREATE TABLE wcf1_buddyloo_gadget_variables (
  variableID int(10) unsigned NOT NULL auto_increment,
  gadgetID int(10) unsigned NOT NULL,
  variableName varchar(64) NOT NULL,
  variableType ENUM('text','textarea','radio','checkbox','select','multiselect') NOT NULL,
  variableDefault varchar(255) NOT NULL,
  PRIMARY KEY (variableID),
  UNIQUE(gadgetID, variableName)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_buddyloo_gadget_variables_value;
CREATE TABLE wcf1_buddyloo_gadget_variables_value (
  variableID int(10) unsigned NOT NULL,
  boxID int(10) unsigned NOT NULL,
  userID int(10) unsigned NOT NULL,
  variableValue varchar(255) NOT NULL,
  PRIMARY KEY (variableID, boxID, userID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `wcf1_buddyloo_gadget` (`gadgetID`, `gadgetTitle`, `gadgetCode`, `gadgetImage`, `gadgetDescription`) VALUES
(1, 'Members gadget', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228678532311" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''HEIGHT''] = ''348'';\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderMembersGadget(\r\n { id: ''div-1228678532311'',\r\n   site: ''08725200924522186419''},\r\n  skin);\r\n</script>\r\n', NULL, 'The Members gadget allows visitors to join your site, sign in and out, see pictures of other site members, see pictures of their friends, explore other members'' profiles, invite other people to join your site.'),
(2, 'Sign In gadget', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228678744328" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\nskin[''ALIGNMENT''] = ''right'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderSignInGadget(\r\n { id: ''div-1228678744328'',\r\n   site: ''{$siteID}''},\r\n  skin);\r\n</script>\r\n', NULL, 'The Sign In gadget allows visitors to join your site, sign in and out, and invite people to become members. It doesn''t have all the features of the Members gadget, but it can fit neatly in to a small space.'),
(3, '''User'' Wall gadget', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228680667275" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\nskin[''DEFAULT_COMMENT_TEXT''] = ''{$DEFAULT_COMMENT_TEXT}'';\r\nskin[''HEADER_TEXT''] = ''{$HEADER_TEXT}'';\r\nskin[''POSTS_PER_PAGE''] = ''5'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderWallGadget(\r\n { id: ''div-1228680667275'',\r\n   site: ''{$siteID}'',\r\n   ''view-params'':{"scope":"ID","features":"video,comment","docId":"{$userID}"}\r\n},\r\n  skin);\r\n</script>\r\n', NULL, 'Allows viewers to post comments, or links to videos on your site.'),
(4, 'Review/Rate gadget', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228678871007" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\nskin[''DEFAULT_COMMENT_TEXT''] = ''- add your review here -'';\r\nskin[''HEADER_TEXT''] = ''Ratings'';\r\nskin[''POSTS_PER_PAGE''] = ''5'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderReviewGadget(\r\n { id: ''div-1228678871007'',\r\n   site: ''{$siteID}'',\r\n   ''view-params'':{"disableMinMax":"false","scope":"ID","docId":"{$userID}","startMaximized":"true"}\r\n},\r\n  skin);\r\n</script>\r\n', NULL, 'Allows viewers to rate a page, or a section of a page. Viewers can use this to rate videos, articles, books, photos, songs, or anything else you can imagine. You can put multiple Review/Rate gadgets on one page, one for each item you want viewers to review.'),
(5, 'OpenSocial Demo', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228678942573" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderOpenSocialGadget(\r\n { id: ''div-1228678942573'',\r\n   url:''http://www.google.com/friendconnect/gadgets/sample.xml'',\r\n   site: ''{$siteID}''},\r\n  skin);\r\n</script>\r\n', NULL, 'This is a sample OpenSocial application that demonstrates the basic concepts that an OpenSocial developer can use in their application.'),
(6, 'LameGame demo', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228678995231" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderOpenSocialGadget(\r\n { id: ''div-1228678995231'',\r\n   url:''http://www.google.com/friendconnect/gadgets/lamegame.xml'',\r\n   site: ''{$siteID}''},\r\n  skin);\r\n</script>\r\n', NULL, 'Here is a silly game (lame) where visitors simply click as often as they can to increase their score vs. their friends and other members.'),
(7, 'Custom Gadget', '<!-- Include the Google Friend Connect javascript library. -->\r\n<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>\r\n\r\n<!-- Define the div tag where the gadget will be inserted. -->\r\n<div id="div-1228679272840" style="width:100%;border:1px solid #cccccc;"></div>\r\n<!-- Render the gadget into a div. -->\r\n<script type="text/javascript">\r\nvar skin = {};\r\nskin[''BORDER_COLOR''] = ''#cccccc'';\r\nskin[''ENDCAP_BG_COLOR''] = ''#e0ecff'';\r\nskin[''ENDCAP_TEXT_COLOR''] = ''#333333'';\r\nskin[''ENDCAP_LINK_COLOR''] = ''#0000cc'';\r\nskin[''ALTERNATE_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_BG_COLOR''] = ''#ffffff'';\r\nskin[''CONTENT_LINK_COLOR''] = ''#0000cc'';\r\nskin[''CONTENT_TEXT_COLOR''] = ''#333333'';\r\nskin[''CONTENT_SECONDARY_LINK_COLOR''] = ''#7777cc'';\r\nskin[''CONTENT_SECONDARY_TEXT_COLOR''] = ''#666666'';\r\nskin[''CONTENT_HEADLINE_COLOR''] = ''#333333'';\r\ngoogle.friendconnect.container.setParentUrl(''/'' /* location of rpc_relay.html and canvas.html */);\r\ngoogle.friendconnect.container.renderOpenSocialGadget(\r\n { id: ''div-1228679272840'',\r\n   url:''{$GADGET_URL}'',\r\n   site: ''{$siteID}''},\r\n  skin);\r\n</script>\r\n', NULL, 'Use this to generate the code snippet that you need to add a custom OpenSocial gadget to your site.');


INSERT INTO `wcf1_buddyloo_gadget_variables` (`variableID`, `gadgetID`, `variableName`, `variableType`, `variableDefault`) VALUES
(1, 3, 'DEFAULT_COMMENT_TEXT', 'text', '- add your comment here -'),
(2, 3, 'HEADER_TEXT', 'text', 'Comments'),
(3, 7, 'GADGET_URL', 'text', '');
