10/15/2007 7:12:15 AM v1.3472 - Line 10: Incorrect syntax near 'GO' Continue or restart VDM - This error was queued for analysis, we apologize. -------------- -- WebSites -- -------------- --if ( select [Value] from ::fn_listextendedpr 0001:002326B0 axView.txView.ExecuteSql line 8185 0001:0018FEAC axPopup.txPopup.DoOnClick line 1065 base: 00A61000 -------------- -- WebSites -- -------------- --if ( select [Value] from ::fn_listextendedproperty( 'Version', default, default, default, default, default, default ) ) > '1.0' begin -- NEW v1.1 file formats if exists ( select * from sysobjects where [Name] = 'HTML_Template' AND [Type] = 'FN' ) drop function dbo.HTML_Template GO if exists ( select * from sysobjects where [Name] = 'WebSites_Insert' AND [Type] = 'TR' ) drop trigger WebSites_Insert GO create trigger WebSites_Insert on WebSites for insert as if ( select Count( ID ) from Inserted ) > 0 begin -- update main page next update WebSites set Template_Name = 'VDM_Word_Content', Default_Template_Name = 'VDM_Word_Content', Local_Path = 'HTML\' + dbo.SubstFileName( I.Title ) + '\', Photo2Name = 'HTML\' + dbo.SubstFileName( I.Title ) + '\Index_Content.htm', Photo2 = 'Under Construction' + Char( 13 ) + Char( 10 ), Destination_URL = 'index.htm', FTP_URL = 'ediaccess.com', FTP_Username = dbo.SubstFileName( I.Title ), FTP_Password = dbo.SubstFileName( I.Title ) + '.vdm' from Inserted I join WebSites S on S.[ID] = I.[ID] where S.Destination_URL is Null ------------------------------------------------------------- -- Force the Business Rules in the Update triggers to fire -- ------------------------------------------------------------- update WebSites set Date_Modified = I.Date_Modified from Inserted I join WebSites W on W.[ID] = I.[ID] end GO if exists ( select * from sysobjects where [Name] = 'WebSites_Update' AND [Type] = 'TR' ) drop trigger WebSites_Update GO create trigger WebSites_Update on WebSites for update as if ( select Count( ID ) from Inserted ) > 0 begin update WebSites set Template_ID = T.[ID] from Inserted I join WebSites W on W.[ID] = I.[ID] join Deleted D on D.[ID] = I.[ID] join WebPages T on T.Title = I.Template_Name where I.Template_Name <> isNull( D.Template_Name, '' ) OR I.Date_Modified is Null -- Null indicates a call from the Insert trigger update WebSites set Default_Template_ID = T.[ID] from Inserted I join WebSites W on W.[ID] = I.[ID] join Deleted D on D.[ID] = I.[ID] join WebPages T on T.Title = I.Default_Template_Name where I.Default_Template_Name <> isNull( D.Default_Template_Name, '' ) OR I.Date_Modified is Null -- Null indicates a call from the Insert trigger update WebSites set Destination_URL = dbo.TrimNonAscii( W.Destination_URL ), Local_Path = 'HTML\' + dbo.SubstFileName( I.Title ) + '\' from Inserted I join WebSites W on W.[ID] = I.[ID] update WebSites set Destination_Path = dbo.InternetPath( W.Destination_URL ) from Inserted I join WebSites W on W.[ID] = I.[ID] ------------------------------------------------------------------------------------------------------------------ -- Update the Date_Modified last since when it is Null it is used to detect Inserted records in Update triggers -- ------------------------------------------------------------------------------------------------------------------ update WebSites set Date_Modified = GetDate(), WorkStation = App_Name(), UserName = System_User from Inserted I join WebSites S on S.[ID] = I.[ID] end GO -- end --else begin -- if exists ( select * from sysobjects where [Name] = 'HTML_Template' AND [Type] = 'FN' ) drop function dbo.HTML_Template -- GO -- if exists ( select * from sysobjects where [Name] = 'WebSites_Insert' AND [Type] = 'TR' ) drop trigger WebSites_Insert -- GO -- create trigger WebSites_Insert on WebSites for insert as -- if ( select Count( ID ) from Inserted ) > 0 begin -- -- add a few template first -- insert WebPages ( WebSite_ID, [Title], Use_as_Template, Photo1Name, Photo1 ) -- select I.[ID], 'VDM_Word_Content', 1, 'HTML\Templates\' + dbo.SubstFileName( I.[Name] ) + '\VDM_Word_Content.htm', -- '' + Char( 13 ) + Char( 10) + -- '@@VDM_Name'+ Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + '' + Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '
@@VDM_Name

@@VDM_Menu @@Photo2
' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) -- from Inserted I -- where I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Use_as_Template, Photo1Name, Photo1 ) -- select I.[ID], 'VDM_Image_Content', 1, 'HTML\Templates\' + dbo.SubstFileName( I.[Name] ) + '\VDM_Image_Content.htm', -- '' + Char( 13 ) + Char( 10) + -- '@@VDM_Name'+ Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '
@@VDM_Name

@@VDM_Menu 
' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) -- from Inserted I -- where I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Use_as_Template, Photo1Name, Photo1 ) -- select I.[ID], 'VDM_Media_Content', 1, 'HTML\Templates\' + dbo.SubstFileName( I.[Name] ) + '\VDM_Media_Content.htm', -- '' + Char( 13 ) + Char( 10) + -- '@@VDM_Name'+ Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- ''+ Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '
@@VDM_Name

@@VDM_Menu ' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- ' ' + Char( 13 ) + Char( 10) + -- '
' + Char( 13 ) + Char( 10) + -- '
No Video?' + Char( 13 ) + Char( 10) + -- 'Download the TechSmith Screen Capture Codec.
' + Char( 13 ) + Char( 10) + -- '
' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) + -- '' + Char( 13 ) + Char( 10) -- from Inserted I -- where I.Destination_URL is Null -- -- update main page next -- update WebSites set Template_Name = 'VDM_Word_Content', Default_Template_Name = 'VDM_Word_Content', -- Local_Path = 'HTML\' + dbo.SubstFileName( I.[Name] ) + '\', -- Photo2Name = 'HTML\' + dbo.SubstFileName( I.[Name] ) + '\Index_Content.htm', -- Photo2 = 'Under Construction' + Char( 13 ) + Char( 10 ), -- Destination_URL = 'index.htm', FTP_Home_Address = 'ediaccess.com', -- FTP_Username = dbo.SubstFileName( I.[Name] ), FTP_Password = dbo.SubstFileName( I.[Name] ) + '.vdm' -- from Inserted I join WebSites S on S.[ID] = I.[ID] where S.Destination_URL is Null -- -- Content Websites -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL ) -- select I.[ID], 'Content', 'Contenu', 'Content.htm' -- from Inserted I where I.[Type] = 'Content' AND I.Destination_URL is Null -- -- Products -- insert WebPages ( WebSite_ID, [Title], Title2, Menu_Page ) -- select I.[ID], 'Products', 'Produits', 1 -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Group A', 'Groupe A', 'GroupA.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Products' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Group B', 'Groupe B', 'GroupB.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Products' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Group C', 'Groupe C', 'GroupC.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Products' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- -- Services -- insert WebPages ( WebSite_ID, [Title], Title2, Menu_Page ) -- select I.[ID], 'Services', 'Services', 1 -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Service A', 'Service A', 'ServiceA.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Services' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Service B', 'Service B', 'ServiceB.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Services' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- -- Support -- insert WebPages ( WebSite_ID, [Title], Title2, Menu_Page ) -- select I.[ID], 'Support', 'Support', 1 -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Help - FAQ', 'Aide - Questions', 'Help.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Support' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Videos', 'Videos', 'Videos.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Support' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Downloads', 'Telechargement', 'Downloads.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = 'Support' ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- -- Home Links -- insert WebPages ( WebSite_ID, [Title], Title2, Menu_Page ) -- select I.[ID], I.[Name], I.[Name], 1 -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'Contact us', 'Ecrivez Nous', 'mailto:info@clearware.net', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = I.[Name] ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID ) -- select I.[ID], 'About us', 'A Propos de Nous', 'About.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = I.[Name] ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- insert WebPages ( WebSite_ID, [Title], Title2, Destination_URL, WebPage_ID) -- select I.[ID], 'Site Map', 'Contenu', 'SiteMap.htm', -- ( select [ID] from WebPages where WebSite_ID = I.[ID] AND [Title] = I.[Name] ) -- from Inserted I where I.[Type] = 'Menu' AND I.Destination_URL is Null -- ------------------------------------------------------------- -- -- Force the Business Rules in the Update triggers to fire -- -- ------------------------------------------------------------- -- update WebSites set Date_Modified = I.Date_Modified from Inserted I join WebSites W on W.[ID] = I.[ID] -- end -- GO -- if exists ( select * from sysobjects where [Name] = 'WebSites_Update' AND [Type] = 'TR' ) drop trigger WebSites_Update -- GO -- create trigger WebSites_Update on WebSites for update as -- if ( select Count( ID ) from Inserted ) > 0 begin -- update WebSites set Template_ID = T.[ID] -- from Inserted I join WebSites W on W.[ID] = I.[ID] -- join Deleted D on D.[ID] = I.[ID] -- join WebPages T on T.Title = I.Template_Name -- where I.Template_Name <> isNull( D.Template_Name, '' ) OR I.Date_Modified is Null -- Null indicates a call from the Insert trigger -- update WebSites set Default_Template_ID = T.[ID] -- from Inserted I join WebSites W on W.[ID] = I.[ID] -- join Deleted D on D.[ID] = I.[ID] -- join WebPages T on T.Title = I.Default_Template_Name -- where I.Default_Template_Name <> isNull( D.Default_Template_Name, '' ) OR I.Date_Modified is Null -- Null indicates a call from the Insert trigger -- update WebSites set Destination_URL = dbo.TrimNonAscii( W.Destination_URL ), -- Local_Path = 'HTML\' + dbo.SubstFileName( I.[Name] ) + '\' -- from Inserted I join WebSites W on W.[ID] = I.[ID] -- update WebSites set Destination_Path = dbo.InternetPath( W.Destination_URL ) -- from Inserted I join WebSites W on W.[ID] = I.[ID] -- update WebSites set Photo2Name = S.Local_Path + Replace( S.Destination_Path, '/', '\' ) + Replace( dbo.InternetName( S.Destination_URL ), '.htm', '_Content.htm' ) -- from Inserted I join WebSites S on S.[ID] = I.[ID] where CharIndex( '.HTM', isNull( S.Photo2Name, '' ) ) > 0 -- update WebSites set Photo2Name = S.Local_Path + dbo.FileName( S.Photo2Name ) -- from Inserted I join WebSites S on S.[ID] = I.[ID] where CharIndex( '.HTM', isNull( S.Photo2Name, '' ) ) = 0 AND -- CharIndex( Upper( Cast( S.Local_Path as varchar( 1000 ) ) ), Upper( isNull( Cast( S.Photo2Name as varchar( 1000 ) ), '' ) ) ) = 0 -- ------------------------------------------------------------------------------------------------------------------ -- -- Update the Date_Modified last since when it is Null it is used to detect Inserted records in Update triggers -- -- ------------------------------------------------------------------------------------------------------------------ -- update WebSites set Date_Modified = GetDate(), WorkStation = App_Name(), UserName = System_User -- from Inserted I join WebSites S on S.[ID] = I.[ID] -- end -- GO --end -- OLD v1.0 file format -------------- -- WebPages -- -------------- --if ( select [Value] from ::fn_listextendedproperty( 'Version', default, default, default, default, default, default ) ) > '1.0' begin -- NEW v1.1 file formats if exists ( select * from sysobjects where [Name] = 'WebPages_Insert' AND [Type] = 'TR' ) drop trigger WebPages_Insert GO create trigger WebPages_Insert on WebPages for insert as if ( select Count( ID ) from Inserted ) > 0 begin ---------------------- --fix grandchildren -- ---------------------- update WebPages set WebSite_ID = ( select W.WebSite_ID from WebPages W where W.[ID] = P.WebPage_ID ) from Inserted I join WebPages P on P.[ID] = I.[ID] where isNull( I.WebSite_ID, 0 ) = 0 ------------------------------------------------------------- -- Force the Business Rules in the Update triggers to fire -- ------------------------------------------------------------- update WebPages set Date_Modified = I.Date_Modified from Inserted I join WebPages W on W.[ID] = I.[ID] end GO if exists ( select * from sysobjects where [Name] = 'WebPages_Delete' AND [Type] = 'TR' ) drop trigger WebPages_Delete GO if exists ( select * from sysobjects where [Name] = 'WebPages_Update' AND [Type] = 'TR' ) drop trigger WebPages_Update GO create trigger WebPages_Update on WebPages for update as if ( select Count( ID ) from Inserted ) > 0 begin update WebPages set WebPage_ID = ( select top 1 P.ID from WebPages P where P.Destination_URL = W.Parent_URL order by P.ID desc ) from Inserted I join WebPages W on W.[ID] = I.[ID] where W.WebPage_ID is Null update WebPages set Template_ID = ( select top 1 [ID] from WebPages where Title = I.Template_Name AND WebSite_ID = I.WebSite_ID order by ID desc ) from Inserted I join WebPages W on W.[ID] = I.[ID] where Update( Template_Name ) OR I.Date_Modified is Null -- Null indicates a call from the Insert trigger ------------------ -- set defaults -- ------------------ update WebPages set [Sequence] = ( select Max( isNull( [Sequence], 0 ) ) + 1 from WebPages where WebSite_ID = I.WebSite_ID OR WebPage_ID = I.WebPage_ID ) from Inserted I join WebPages P on P.[ID] = I.[ID] where isNull( I.[Sequence], 0 ) = 0 update WebPages set Destination_URL = dbo.ValidURL( I.Title ) + '.htm' from Inserted I join WebPages P on P.[ID] = I.[ID] where isNull( P.Destination_URL, '' ) = '' AND isNull( P.Use_as_Template, 0 ) = 0 update WebPages set Destination_URL = dbo.TrimNonAscii( P.Destination_URL ) from Inserted I join WebSites P on P.[ID] = I.[ID] update WebPages set Destination_Path = dbo.InternetPath( P.Destination_URL ) from Inserted I join WebPages P on P.[ID] = I.[ID] update WebPages set Local_Path = S.Local_Path from Inserted I join WebPages P on P.[ID] = I.[ID] join WebSites S on S.[ID] = P.WebSite_ID update WebPages set Photo2 = 'Under Construction' + Char( 13 ) + Char( 10 ), Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + SubString( dbo.InternetName( P.Destination_URL ) + '.', 1, CharIndex( '.', dbo.InternetName( P.Destination_URL ) + '.' ) - 1 ) + '_content.htm' from Inserted I join WebPages P on P.[ID] = I.[ID] where P.Photo2 is NULL AND isNull( P.Use_as_Template, 0 ) = 0 ------------------------------------------------------------------ -- Force Templates and Content in their proper folder structure -- ------------------------------------------------------------------ -- update WebPages set Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + Replace( dbo.FileName( P.Photo2Name ), '.htm', '_Content.htm' ) update WebPages set Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + Replace( dbo.InternetName( P.Destination_URL ), '.htm', '_Content.htm' ) -- update WebPages set Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + SubString( dbo.InternetName( P.Destination_URL ) + '.', 1, -- CharIndex( '.', dbo.InternetName( P.Destination_URL ) + '.' ) - 1 ) + '_content.htm' from Inserted I join WebPages P on P.[ID] = I.[ID] where P.Use_as_Template = 0 update WebPages set Photo1Name = 'HTML\Templates\' + dbo.SubstFileName( S.Title ) + '\' + dbo.FileName( P.Photo1Name ) from Inserted I join WebPages P on P.[ID] = I.[ID] join WebSites S on S.[ID] = I.WebSite_ID where P.Use_as_Template = 1 ------------------------------------------------------------------------------------------------------------------ -- Update the Date_Modified last since when it is Null it is used to detect Inserted records in Update triggers -- ------------------------------------------------------------------------------------------------------------------ update WebPages set Date_Modified = GetDate(), WorkStation = App_Name(), UserName = System_User from Inserted I join WebPages P on P.[ID] = I.[ID] end GO -- end --else begin -- OLD v1.0 file format -- if exists ( select * from sysobjects where [Name] = 'WebPages_Insert' AND [Type] = 'TR' ) drop trigger WebPages_Insert -- GO -- create trigger WebPages_Insert on WebPages for insert as -- if ( select Count( ID ) from Inserted ) > 0 begin -- ---------------------- -- --fix grandchildren -- -- ---------------------- -- update WebPages set WebSite_ID = ( select W.WebSite_ID from WebPages W where W.[ID] = P.WebPage_ID ) -- from Inserted I join WebPages P on P.[ID] = I.[ID] where isNull( I.WebSite_ID, 0 ) = 0 -- ------------------------------------------------------------- -- -- Force the Business Rules in the Update triggers to fire -- -- ------------------------------------------------------------- -- update WebPages set Date_Modified = I.Date_Modified from Inserted I join WebPages W on W.[ID] = I.[ID] -- end -- GO -- -- if exists ( select * from sysobjects where [Name] = 'WebPages_Delete' AND [Type] = 'TR' ) drop trigger WebPages_Delete -- GO -- -- if exists ( select * from sysobjects where [Name] = 'WebPages_Update' AND [Type] = 'TR' ) drop trigger WebPages_Update -- GO -- create trigger WebPages_Update on WebPages for update as -- if ( select Count( ID ) from Inserted ) > 0 begin -- update WebPages set WebPage_ID = ( select top 1 P.ID from WebPages P where P.Destination_URL = W.Parent_URL order by P.ID desc ) -- from Inserted I join WebPages W on W.[ID] = I.[ID] -- where W.WebPage_ID is Null -- update WebPages set Template_ID = ( select top 1 [ID] from WebPages where Title = I.Template_Name AND WebSite_ID = I.WebSite_ID order by ID desc ) -- from Inserted I join WebPages W on W.[ID] = I.[ID] -- where Update( Template_Name ) OR I.Date_Modified is Null -- Null indicates a call from the Insert trigger -- ------------------ -- -- set defaults -- -- ------------------ -- update WebPages set [Sequence] = ( select Max( isNull( [Sequence], 0 ) ) + 1 from WebPages -- where WebSite_ID = I.WebSite_ID OR WebPage_ID = I.WebPage_ID ) -- from Inserted I join WebPages P on P.[ID] = I.[ID] where isNull( I.[Sequence], 0 ) = 0 -- update WebPages set Destination_URL = dbo.ValidURL( I.Title ) + '.htm' -- from Inserted I join WebPages P on P.[ID] = I.[ID] -- where isNull( P.Destination_URL, '' ) = '' AND isNull( P.Menu_Page, 0 ) = 0 AND isNull( P.Use_as_Template, 0 ) = 0 -- update WebPages set Destination_URL = dbo.TrimNonAscii( P.Destination_URL ) -- from Inserted I join WebSites P on P.[ID] = I.[ID] -- update WebPages set Destination_Path = dbo.InternetPath( P.Destination_URL ) -- from Inserted I join WebPages P on P.[ID] = I.[ID] -- update WebPages set Local_Path = S.Local_Path -- from Inserted I join WebPages P on P.[ID] = I.[ID] -- join WebSites S on S.[ID] = P.WebSite_ID -- update WebPages set Photo2 = 'Under Construction' + Char( 13 ) + Char( 10 ), -- Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + -- SubString( dbo.InternetName( P.Destination_URL ) + '.', 1, -- CharIndex( '.', dbo.InternetName( P.Destination_URL ) + '.' ) - 1 ) + '_content.htm' -- from Inserted I join WebPages P on P.[ID] = I.[ID] -- where P.Photo2 is NULL AND isNull( P.Menu_Page, 0 ) = 0 AND isNull( P.Use_as_Template, 0 ) = 0 -- ------------------------------------------------------------------ -- -- Force Templates and Content in their proper folder structure -- -- ------------------------------------------------------------------ -- -- update WebPages set Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + Replace( dbo.FileName( P.Photo2Name ), '.htm', '_Content.htm' ) -- -- update WebPages set Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + SubString( dbo.InternetName( P.Destination_URL ) + '.', 1, -- -- CharIndex( '.', dbo.InternetName( P.Destination_URL ) + '.' ) - 1 ) + '_content.htm' -- update WebPages set Photo2Name = P.Local_Path + Replace( P.Destination_Path, '/', '\' ) + Replace( dbo.InternetName( P.Destination_URL ), '.htm', '_Content.htm' ) -- from Inserted I join WebPages P on P.[ID] = I.[ID] where P.Use_as_Template = 0 AND CharIndex( '.HTM', isNull( P.Photo2Name, '' ) ) > 0 -- update WebPages set Photo2Name = P.Local_Path + dbo.FileName( P.Photo2Name ) -- from Inserted I join WebPages P on P.[ID] = I.[ID] where P.Use_as_Template = 0 AND CharIndex( '.HTM', isNull( P.Photo2Name, '' ) ) = 0 AND -- CharIndex( Upper( Cast( P.Local_Path as varchar( 1000 ) ) ), Upper( isNull( Cast( P.Photo2Name as varchar( 1000 ) ), '' ) ) ) = 0 -- update WebPages set Photo1Name = 'HTML\Templates\' + dbo.SubstFileName( S.[Name] ) + '\' + dbo.FileName( P.Photo1Name ) -- from Inserted I join WebPages P on P.[ID] = I.[ID] -- join WebSites S on S.[ID] = I.WebSite_ID where P.Use_as_Template = 1 AND CharIndex( '.HTM', isNull( P.Photo2Name, '' ) ) > 0 -- ------------------------------------------------------------------------------------------------------------------ -- -- Update the Date_Modified last since when it is Null it is used to detect Inserted records in Update triggers -- -- ------------------------------------------------------------------------------------------------------------------ -- update WebPages set Date_Modified = GetDate(), WorkStation = App_Name(), UserName = System_User -- from Inserted I join WebPages P on P.[ID] = I.[ID] -- end -- GO --end -- OLD v1.0 file format ------------- -- Catalog -- ------------- if exists ( select * from sysobjects where [Name] = 'Catalog_Update' AND [Type] = 'TR' ) drop trigger Catalog_Update