+INSERT INTO ImportScripts VALUES (DEFAULT, 'Links from CSV file [In-Link]', '', 'l', 'In-Link', '', 'CSV', '1');
+
+UPDATE CustomField
+SET ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 2 AND (DestParentId = 225 OR DestParentId = 38) ORDER BY DestParentId DESC, DestAbbr ASC</SQL>'
+WHERE FieldName = 'LinkState';
+
+UPDATE CustomField
+SET ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC</SQL>'
+WHERE FieldName = 'LinkCountry';
+
+# ===== v 5.0.0 =====
+INSERT INTO Counters VALUES (DEFAULT, 'linkhits_count', 'SELECT ROUND(SUM(Hits)) FROM <%PREFIX%>Link', NULL, NULL, '300', '0', '|Link|');
+UPDATE Category SET Template = '/in-link/designs/section' WHERE Template = 'inlink/index';
+UPDATE Category SET CachedTemplate = '/in-link/designs/section' WHERE CachedTemplate = 'inlink/index';
+
+UPDATE ConfigurationValues SET VariableValue = '/in-link/designs/section' WHERE VariableName = 'l_CategoryTemplate';
+UPDATE ConfigurationValues SET VariableValue = 'in-link/designs/detail' WHERE VariableName = 'l_ItemTemplate';
+
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:links.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:setting_folder.view', 11, 1, 1, 0);
+DELETE FROM Permissions WHERE Permission LIKE 'in-link:inlink_general.%';
+
+UPDATE Events SET Description = 'la_event_link.owner.modify' WHERE Description = 'la_event_link.modify.modify';
+UPDATE Events SET Description = 'la_event_link.owner.modify.pending' WHERE Description = 'la_event_link.modify.modify.pending';
+
+UPDATE Phrase SET Module = 'In-Link' WHERE ((Phrase LIKE '%Links%' OR Phrase LIKE '%Listing%') AND (Module = 'Core') AND Phrase NOT IN ('la_section_QuickLinks'));
+
+UPDATE Phrase SET Module = 'In-Link', PhraseType = 1 WHERE ( (Phrase LIKE '%Validation%' OR Phrase LIKE 'la_title_In-Link') AND (Module = 'Core') AND Phrase NOT IN ('la_ValidationEmail', 'la_prompt_validation'));
Property changes on: branches/5.0.x/in-link/install/upgrades.sql
+INSERT INTO ConfigurationAdmin VALUES ('Link_SortField', 'la_Text_Links', 'la_link_sortfield_prompt', 'select', '', 'Name=la_Link_Name,Description=la_Link_Description,Url=la_Link_URL,CreatedOn=la_opt_CreatedOn,Hits=la_Link_Hits,CachedRating=la_opt_Rating,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 4) AND (IsSystem = 0)</SQL>', 10.01, 1, 1);
+INSERT INTO ConfigurationAdmin VALUES ('Link_SortField2', 'la_Text_Links', 'la_link_sortfield2_prompt', 'select', '', 'Name=la_Link_Name,Description=la_Link_Description,Url=la_Link_URL,CreatedOn=la_Link_Date,Hits=la_Link_Hits,CachedRating=la_Link_Rating,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 4) AND (IsSystem = 0)</SQL>', 10.02, 1, 1);
+INSERT INTO CustomField VALUES (DEFAULT, 4, 'LinkState', 'lu_fld_LinkState', 0, 'la_section_BusinessLocation', 'la_fld_LinkState', 'select', '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 2 AND (DestParentId = 225 OR DestParentId = 38) ORDER BY DestParentId DESC, DestAbbr ASC</SQL>', '', 3, 1, 0, 0);
+INSERT INTO CustomField VALUES (DEFAULT, 4, 'LinkCountry', 'lu_fld_LinkCountry', 0, 'la_section_BusinessLocation', 'la_fld_LinkCountry', 'select', '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC</SQL>', '', 5, 1, 0, 0);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) as LinkCount FROM <%prefix%>Link WHERE Status=1', NULL, 'la_prompt_ActiveLinks', 0, 1);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS TotalLinks FROM <%prefix%>Link', NULL, 'la_prompt_TotalLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS ActiveLinks FROM <%prefix%>Link WHERE Status = 1', NULL, 'la_prompt_ActiveLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS PendingLinks FROM <%prefix%>Link WHERE Status = 2', NULL, 'la_prompt_PendingLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS DisabledLinks FROM <%prefix%>Link WHERE Status = 0', NULL, 'la_prompt_DisabledLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS NewLinks FROM <%prefix%>Link WHERE (NewItem = 1) OR ( (UNIX_TIMESTAMP() - CreatedOn) <= <%m:config name="Link_NewDays"%>*86400 AND (NewItem = 2) )', NULL, 'la_prompt_NewLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) FROM <%prefix%>Link WHERE EditorsPick = 1', NULL, 'la_prompt_EditorsPickLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS HotLinks FROM <%prefix%>Link WHERE (HotItem = 1) OR (Hits >= <%m:config name="Link_MaxHotNumber"%> AND (HotItem = 2) )', NULL, 'la_prompt_HotLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) AS PopularLinks FROM <%prefix%>Link WHERE (PopItem = 1) OR ( (CachedRating >= <%link:hit_count type="top"%>) AND <%link:hit_count type="top"%> AND (PopItem = 2) )', NULL, 'la_prompt_PopularLinks', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT <%m:post_format field="AVG(CachedRating)" type="currency" precision="2"%> FROM <%prefix%>Link WHERE CachedRating > 0', NULL, 'la_prompt_LinksAverageRating', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT MAX(Hits) AS MaxLinksHits FROM <%prefix%>Link', NULL, 'la_prompt_MaxLinksHits', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT MAX(CachedVotesQty) AS MaxLinksVotes FROM <%prefix%>Link', NULL, 'la_prompt_MaxLinksVotes', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT <%m:post_format field="MAX(CreatedOn)" type="date"%> FROM <%prefix%>Link', NULL, 'la_prompt_NewestLinkDate', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT <%m:post_format field="MAX(Modified)" type="date"%> FROM <%prefix%>Link', NULL, 'la_prompt_LastLinkUpdate', 0, 2);
+INSERT INTO StatItem VALUES (DEFAULT, 'In-Link', 'SELECT COUNT(*) FROM <%prefix%>ItemReview WHERE Module = \'<%modules:get_current%>\'', NULL, 'la_prompt_LinkReviews', 0, 2);
+
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 14, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.VIEW', 14, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.VIEW', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.ADD.PENDING', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.RATE', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.REVIEW', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.MODIFY', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.MODIFY.PENDING', 12, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.ADD', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.VIEW', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.RATE', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.REVIEW', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.MODIFY', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.MODIFY.PENDING', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.DELETE', 13, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.VIEW', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.ADD', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.DELETE', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'CATEGORY.MODIFY', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.ADD', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.VIEW', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.MODIFY', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.DELETE', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.RATE', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.REVIEW', 11, 1, 0, {LinkCatId});
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.ADD', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.VIEW', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.ADD.PENDING', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.MODIFY', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.DELETE', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.RATE', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.REVIEW', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.REVIEW.PENDING', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.MODIFY.PENDING', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.MODIFY', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.MODIFY.PENDING', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'LINK.OWNER.DELETE', 15, 0, 0, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:links.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:setting_folder.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_output.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_output.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_search.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_search.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_email.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_email.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_custom.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_custom.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_custom.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:configuration_custom.delete', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:duplicate_checker.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:duplicate_checker.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:duplicate_checker.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:duplicate_checker.delete', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:validation_list.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:validation_list.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:validation_list.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:paid_listings.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:paid_listings.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:paid_listings.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:paid_listings.delete', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:paid_listings.advanced:approve', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:paid_listings.advanced:decline', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:listing_types.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:listing_types.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:listing_types.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:listing_types.delete', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:link_validation.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:link_validation.advanced:continue', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:link_validation.advanced:restart', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:link_validation.advanced:validate', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-link:link_validation.advanced:reset', 11, 1, 1, 0);
+
+INSERT INTO ImportScripts VALUES (DEFAULT, 'Links from CSV file [In-Link]', '', 'l', 'In-Link', '', 'CSV', '1');
+ Grids['<inp2:m_param name="prefix"/>'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));