Project

General

Profile

« Previous | Next » 

Revision 1994

Added by darkviper about 11 years ago

+ /module/news/WbLink.php added Interface class to module news
! ../fck_wbmodules.php & ../wbmodules.htt modified link generation for news module

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
06 Nov-2013 Build 1994 Manuela v.d.Decken(DarkViper)
15
+ /module/news/WbLink.php  added Interface class to module news
16
! ../fck_wbmodules.php & ../wbmodules.htt modified link generation for news module
14 17
06 Nov-2013 Build 1993 Manuela v.d.Decken(DarkViper)
15 18
! /module/output_filter/filters/filterWbLink added extended format to [wblinkXX] - tag
16 19
+ /framework/WbLinkAbstract.php added abstract class/interface for filterWbLink
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1993');
54
if(!defined('REVISION')) define('REVISION', '1994');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/plugins/WBModules/wbmodules.htt
1
<!-- BEGIN main_block -->

2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

3
<html>

4
	<head>

5
		<title>WB Link - Insert Website Baker Link</title>

6
		<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}">

7
		<meta content="noindex, nofollow" name="robots">

8
		<script type="text/javascript" src="fckwbmodules.js"></script>

9
		<script type="text/javascript">

10
		<!--

11
			var oEditor			= window.parent.InnerDialogLoaded(); 

12
			var FCK				= oEditor.FCK; 

13
			var FCKLang			= oEditor.FCKLang ;

14
			var FCKConfig		= oEditor.FCKConfig ;

15
			//var FCKCMSCCMSModules	= oEditor.FCKCMSModules; 

16
			 
17
			// oLink: The actual selected link in the editor.

18
			var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;

19
			if ( oLink )

20
				FCK.Selection.SelectNode( oLink ) ;

21
	
22
			window.onload = function ()	{ 

23
				// First of all, translates the dialog box texts.

24
				oEditor.FCKLanguageManager.TranslatePage(document);

25
				
26
				LoadSelected();							//See function below 

27
				window.parent.SetOkButton( true );		//Show the "Ok" button. 

28
				
29
			} 

30
			 
31
			//If an anchor (A) object is currently selected, load the properties into the dialog 

32
			function LoadSelected()	{

33
				var sSelected;

34

  
35
				if ( oEditor.FCKBrowserInfo.IsGecko || oEditor.FCKBrowserInfo.IsSafari || oEditor.FCKBrowserInfo.IsChrome ) {

36
					sSelected = FCK.EditorWindow.getSelection();

37
				} else {

38
					sSelected = FCK.EditorDocument.selection.createRange().text;

39
				}

40

  
41
				if ( sSelected == "" ) {

42
					alert( FCKLang.WBModulesErrSelection );

43
					window.parent.Cancel();

44
				}

45

  
46
			}

47

  
48
			//Code that runs after the OK button is clicked 

49
			function Ok() {

50
				//Validate is option is selected

51
				var oTagLink = document.getElementById( 'chkTaglink' );				

52
				var oPageList = document.getElementById( 'cmbPages' ) ;

53
				if(oPageList.selectedIndex == -1) {

54
					alert( FCKLang.WBModulesErrPageSelect );

55
					return false;

56
				} else {

57
					var sPageId = oPageList[oPageList.selectedIndex].value;

58
					newsSel = document.getElementsByName( 'cmbNews' );	

59
					for (i = 0; i < newsSel.length; i++) {

60
						if(newsSel[i].selectedIndex !== -1) {

61
			  	  	var sPageId = newsSel[i][newsSel[i].selectedIndex].value;							

62
						}

63
					}

64
				}

65
				
66
				oLink = oEditor.FCK.CreateLink( sPageId ) ;

67
				// the following line was commented out as it creates an error message in some browser (e.g. IE)

68
				// even Firefox seems not to make use of the title so we remove this option for know (doc)

69
				oLink[0].setAttribute('title', document.getElementById( 'txtTitle' ).value ) ;

70
				oLink[0].setAttribute('class', document.getElementById( 'txtClass' ).value ) ;

71
			return true;

72

  
73
			} 

74

  
75
			
76
		//-->

77
		</script>

78
	</head>

79
			
80
	<body scroll="no" style="overflow:hidden;">

81
		 <table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0"> 

82
		 	<tr> 

83
				<td>

84
					<table width="100%">

85
						<tr>

86
							<td colspan="2"><span fckLang="WBModuleslblPageSelection">Select a WB Page to link to:</span>&nbsp;</td>

87
						</tr>

88
						<tr>

89
							<td colspan="2">

90
								<select id="cmbPages" style="WIDTH: 100%" size="8" name="cmbPages">

91
									<!-- BEGIN page_list_block -->

92
									<option value="{LINK}"{SELECTED}>{TITLE}</option>

93
									<!-- END page_list_block -->

94
								</select>

95
							</td>

96
						</tr>

97
						<!-- commented out as this option will not work in all browsers (doc)-->

98
						<tr>

99
							<td nowrap><span fckLang="WBModuleslblTitle">Title</span>&nbsp;</td>

100
							<td width="100%" style="align:right;"><input id="txtTitle" style="WIDTH: 98%" type="text" name="txtTitle"></td>

101
						</tr>

102
						<tr>

103
							<td nowrap><span fckLang="WBModuleslblClass">Class</span>&nbsp;</td>

104
							<td width="100%" style="align:right;"><input id="txtClass" style="WIDTH: 98%" type="text" name="txtClass"></td>

105
						</tr>

106
						<tr>

107
							<td valign="top" nowrap><span fckLang="WBModuleslblNews">Class</span>&nbsp;</td>

108
							<td><span id="noSelect" style="display: block;" fckLang="WBModuleslblNoNews"></span>

109
								<!-- BEGIN news_select_block -->

110
								<select class="newspage{PAGE_ID}" id="cmbNews" style="display: none;" size="6" name="cmbNews">

111
								<!-- <select id="cmbNews" style="WIDTH: 100%;" size="6" name="cmbNews">-->

112
									<!-- BEGIN news_list_block -->

113
									<option value="{LINK}"{SELECTED}>{TITLE}</option>

114
									<!-- END news_list_block -->

115
								</select>

116
								<!-- END news_select_block -->

117
							</td>

118
						</tr>

119
						
120
					</table>

121
				</td>

122
			</tr>

123
		</table>

124
		
125
		<script type="text/javascript">

126
			var oPageList = document.getElementById( 'cmbPages' ) ;		

127
			oPageList.onchange = function() {

128
				pageId = (this[this.selectedIndex].value).replace(/\[wblink(.*)\]/, "$1")

129
				newsSelects = document.getElementsByName( 'cmbNews' );	

130
				document.getElementById( 'noSelect' ).setAttribute('style','display: block;') ;

131
				for (i = 0; i < newsSelects.length; i++) {

132
					newsSelects[i].setAttribute('style','display: none') ;	

133
				  if (newsSelects[i].className == "newspage"+ pageId) {

134
				  	document.getElementById( 'noSelect' ).setAttribute('style','display: none;') ;

135
				  	newsSelects[i].setAttribute('style','display: block; width: 100%;') ;

136
				  }	

137
				}

138
			}

139
			var oPageList = document.getElementById( 'cmbPages' ) ;	

140
		</script>

141
	</body>

142
</html> 

1
<!-- BEGIN main_block -->
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
3
<html>
4
	<head>
5
		<title>WB Link - Insert Website Baker Link</title>
6
		<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}">
7
		<meta content="noindex, nofollow" name="robots">
8
		<script type="text/javascript" src="fckwbmodules.js"></script>
9
		<script type="text/javascript">
10
		<!--
11
			var oEditor			= window.parent.InnerDialogLoaded(); 
12
			var FCK				= oEditor.FCK; 
13
			var FCKLang			= oEditor.FCKLang ;
14
			var FCKConfig		= oEditor.FCKConfig ;
15
			//var FCKCMSCCMSModules	= oEditor.FCKCMSModules; 
16
			 
17
			// oLink: The actual selected link in the editor.
18
			var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ;
19
			if ( oLink )
20
				FCK.Selection.SelectNode( oLink ) ;
21
	
22
			window.onload = function ()	{ 
23
				// First of all, translates the dialog box texts.
24
				oEditor.FCKLanguageManager.TranslatePage(document);
25
				
26
				LoadSelected();							//See function below 
27
				window.parent.SetOkButton( true );		//Show the "Ok" button. 
28
				
29
			} 
30
			 
31
			//If an anchor (A) object is currently selected, load the properties into the dialog 
32
			function LoadSelected()	{
33
				var sSelected;
34

  
35
				if ( oEditor.FCKBrowserInfo.IsGecko || oEditor.FCKBrowserInfo.IsSafari || oEditor.FCKBrowserInfo.IsChrome ) {
36
					sSelected = FCK.EditorWindow.getSelection();
37
				} else {
38
					sSelected = FCK.EditorDocument.selection.createRange().text;
39
				}
40

  
41
				if ( sSelected == "" ) {
42
					alert( FCKLang.WBModulesErrSelection );
43
					window.parent.Cancel();
44
				}
45

  
46
			}
47

  
48
			//Code that runs after the OK button is clicked 
49
			function Ok() {
50
				//Validate is option is selected
51
				var oTagLink = document.getElementById( 'chkTaglink' );				
52
				var oPageList = document.getElementById( 'cmbPages' ) ;
53
				if(oPageList.selectedIndex == -1) {
54
					alert( FCKLang.WBModulesErrPageSelect );
55
					return false;
56
				} else {
57
					var sPageId = oPageList[oPageList.selectedIndex].value;
58
					newsSel = document.getElementsByName( 'cmbNews' );	
59
					for (i = 0; i < newsSel.length; i++) {
60
						if(newsSel[i].selectedIndex !== -1) {
61
			  	  	var sPageId = newsSel[i][newsSel[i].selectedIndex].value;							
62
						}
63
					}
64
				}
65
				
66
				oLink = oEditor.FCK.CreateLink( sPageId ) ;
67
				// the following line was commented out as it creates an error message in some browser (e.g. IE)
68
				// even Firefox seems not to make use of the title so we remove this option for know (doc)
69
				oLink[0].setAttribute('title', document.getElementById( 'txtTitle' ).value ) ;
70
				oLink[0].setAttribute('class', document.getElementById( 'txtClass' ).value ) ;
71
			return true;
72

  
73
			} 
74

  
75
			
76
		//-->
77
		</script>
78
	</head>
79
			
80
	<body scroll="no" style="overflow:hidden;">
81
		 <table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0"> 
82
		 	<tr> 
83
				<td>
84
					<table width="100%">
85
						<tr>
86
							<td colspan="2"><span fckLang="WBModuleslblPageSelection">Select a WB Page to link to:</span>&nbsp;</td>
87
						</tr>
88
						<tr>
89
							<td colspan="2">
90
								<select id="cmbPages" style="WIDTH: 100%" size="8" name="cmbPages">
91
									<!-- BEGIN page_list_block -->
92
									<option value="{LINK}"{SELECTED}>{TITLE}</option>
93
									<!-- END page_list_block -->
94
								</select>
95
							</td>
96
						</tr>
97
						<!-- commented out as this option will not work in all browsers (doc)-->
98
						<tr>
99
							<td nowrap><span fckLang="WBModuleslblTitle">Title</span>&nbsp;</td>
100
							<td width="100%" style="align:right;"><input id="txtTitle" style="WIDTH: 98%" type="text" name="txtTitle"></td>
101
						</tr>
102
						<tr>
103
							<td nowrap><span fckLang="WBModuleslblClass">Class</span>&nbsp;</td>
104
							<td width="100%" style="align:right;"><input id="txtClass" style="WIDTH: 98%" type="text" name="txtClass"></td>
105
						</tr>
106
						<tr>
107
							<td valign="top" nowrap><span fckLang="WBModuleslblNews">Class</span>&nbsp;</td>
108
							<td><span id="noSelect" style="display: block;" fckLang="WBModuleslblNoNews"></span>
109
								<!-- BEGIN news_select_block -->
110
								<select class="newspage{PAGE_ID}" id="cmbNews" style="display: none;" size="6" name="cmbNews">
111
								<!-- <select id="cmbNews" style="WIDTH: 100%;" size="6" name="cmbNews">-->
112
									<!-- BEGIN news_list_block -->
113
									<option value="{LINK}"{SELECTED}>{TITLE}</option>
114
									<!-- END news_list_block -->
115
								</select>
116
								<!-- END news_select_block -->
117
							</td>
118
						</tr>
119
						
120
					</table>
121
				</td>
122
			</tr>
123
		</table>
124
		
125
		<script type="text/javascript">
126
			var oPageList = document.getElementById( 'cmbPages' ) ;		
127
			oPageList.onchange = function() {
128
				pageId = (this[this.selectedIndex].value).replace(/\[wblink(\d+)[^\]]*\]/, "$1")
129
				newsSelects = document.getElementsByName( 'cmbNews' );	
130
				document.getElementById( 'noSelect' ).setAttribute('style','display: block;') ;
131
				for (i = 0; i < newsSelects.length; i++) {
132
					newsSelects[i].setAttribute('style','display: none') ;	
133
				  if (newsSelects[i].className == "newspage"+ pageId) {
134
				  	document.getElementById( 'noSelect' ).setAttribute('style','display: none;') ;
135
				  	newsSelects[i].setAttribute('style','display: block; width: 100%;') ;
136
				  }	
137
				}
138
			}
139
			var oPageList = document.getElementById( 'cmbPages' ) ;	
140
		</script>
141
	</body>
142
</html> 
143 143
<!-- END main_block -->
branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/plugins/WBModules/fck_wbmodules.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
// Include the config file
27
require('../../../../../../config.php');
28
// Create new admin object
29
require(WB_PATH.'/framework/class.admin.php');
30
$admin = new admin('Pages', 'pages_modify', false);
31

  
32
// Setup the template
33
$template = new Template(WB_PATH.'/modules/fckeditor/fckeditor/editor/plugins/WBModules');
34
$template->set_file('page', 'wbmodules.htt');
35
$template->set_block('page', 'main_block', 'main');
36

  
37
// Function to generate page list
38
function gen_page_list($parent) {
39
	global $template, $database, $admin;
40
	$get_pages = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' order by position");
41
	while($page = $get_pages->fetchRow()) {
42
		// method page_is_visible was introduced with WB 2.7
43
		if(method_exists($admin, 'page_is_visible') && !$admin->page_is_visible($page))
44
			continue;
45
		$title = stripslashes($page['menu_title']);
46
		// Add leading -'s so we can tell what level a page is at
47
		$leading_dashes = '';
48
		for($i = 0; $i < $page['level']; $i++) {
49
			$leading_dashes .= '- ';
50
		}
51
		$template->set_var('TITLE', $leading_dashes.' '.$title);
52
		$template->set_var('LINK', '[wblink'.$page['page_id'].']');
53
		/**
54
			Note: FCK uses the header defined in /fckeditor/fckeditor/editor/fckdialog.html
55
			Therefore the WB charset defined in the template: wbmodules.html will be overwritten
56
			Routine kept for now, maybe it is possible to define custom plugin charsets in a future FCK releases (doc)
57
		*/
58
		// work out the specified WB charset 
59
		if(defined('DEFAULT_CHARSET')) { 
60
			$template->set_var('CHARSET', DEFAULT_CHARSET);
61
		} else { 
62
			$template->set_var('CHARSET', 'utf-8');
63
		}
64
		$template->parse('page_list', 'page_list_block', true);
65
		gen_page_list($page['page_id']);
66
	}
67
}
68

  
69
// Get pages and put them into the pages list
70
$template->set_block('main_block', 'page_list_block', 'page_list');
71
$get_pages = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '0' order by position");
72
if($get_pages->numRows() > 0) {
73
	// Loop through pages
74
	while($page = $get_pages->fetchRow()) {
75
		// method page_is_visible was introduced with WB 2.7
76
		if(method_exists($admin, 'page_is_visible') && !$admin->page_is_visible($page))
77
			continue;
78
		$title = stripslashes($page['menu_title']);
79
		$template->set_var('TITLE', $title);
80
		$template->set_var('LINK', '[wblink'.$page['page_id'].']');
81
		$template->parse('page_list', 'page_list_block', true);
82
		gen_page_list($page['page_id']);
83
	}
84
} else {
85
	$template->set_var('TITLE', 'None found');
86
	$template->set_var('LINK', 'None found');
87
	$template->parse('page_list', 'page_list_block', false);
88
}
89

  
90
$newsSections = $database->query("SELECT * FROM ".TABLE_PREFIX."sections WHERE module = 'news'");
91
$newsPages = array();
92
$template->set_block('main_block', 'news_select_block', 'select_list');
93
$template->set_block('news_select_block', 'news_list_block', 'news_list');
94
while($section = $newsSections->fetchRow()){
95
	$news = $database->query("SELECT title, link FROM ".TABLE_PREFIX."mod_news_posts WHERE active=1 AND section_id = ".$section['section_id']);
96
	while($item = $news->fetchRow()) {
97
    $template->set_var('TITLE', $item['title']);
98
		$template->set_var('LINK', WB_URL.PAGES_DIRECTORY.$item['link'].PAGE_EXTENSION);
99
		$template->parse('news_list', 'news_list_block', true);
100
	}
101
	$template->set_var('PAGE_ID', $section['page_id']);
102
	$template->parse('select_list', 'news_select_block', true);
103
	$template->clear_var('news_list');
104
}
105

  
106

  
107
// Parse the template object
108
$template->parse('main', 'main_block', false);
109
$template->pparse('output', 'page');
110

  
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
// Include the config file
27
require('../../../../../../config.php');
28
// Create new admin object
29
require(WB_PATH.'/framework/class.admin.php');
30
$admin = new admin('Pages', 'pages_modify', false);
31

  
32
// Setup the template
33
$template = new Template(WB_PATH.'/modules/fckeditor/fckeditor/editor/plugins/WBModules');
34
$template->set_file('page', 'wbmodules.htt');
35
$template->set_block('page', 'main_block', 'main');
36

  
37
// Function to generate page list
38
function gen_page_list($parent) {
39
	global $template, $database, $admin;
40
	$get_pages = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' order by position");
41
	while($page = $get_pages->fetchRow()) {
42
		// method page_is_visible was introduced with WB 2.7
43
		if(method_exists($admin, 'page_is_visible') && !$admin->page_is_visible($page))
44
			continue;
45
		$title = stripslashes($page['menu_title']);
46
		// Add leading -'s so we can tell what level a page is at
47
		$leading_dashes = '';
48
		for($i = 0; $i < $page['level']; $i++) {
49
			$leading_dashes .= '- ';
50
		}
51
		$template->set_var('TITLE', $leading_dashes.' '.$title);
52
		$template->set_var('LINK', '[wblink'.$page['page_id'].']');
53
		/**
54
			Note: FCK uses the header defined in /fckeditor/fckeditor/editor/fckdialog.html
55
			Therefore the WB charset defined in the template: wbmodules.html will be overwritten
56
			Routine kept for now, maybe it is possible to define custom plugin charsets in a future FCK releases (doc)
57
		*/
58
		// work out the specified WB charset 
59
		if(defined('DEFAULT_CHARSET')) { 
60
			$template->set_var('CHARSET', DEFAULT_CHARSET);
61
		} else { 
62
			$template->set_var('CHARSET', 'utf-8');
63
		}
64
		$template->parse('page_list', 'page_list_block', true);
65
		gen_page_list($page['page_id']);
66
	}
67
}
68

  
69
// Get pages and put them into the pages list
70
$template->set_block('main_block', 'page_list_block', 'page_list');
71
$get_pages = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '0' order by position");
72
if($get_pages->numRows() > 0) {
73
	// Loop through pages
74
	while($page = $get_pages->fetchRow()) {
75
		// method page_is_visible was introduced with WB 2.7
76
		if(method_exists($admin, 'page_is_visible') && !$admin->page_is_visible($page))
77
			continue;
78
		$title = stripslashes($page['menu_title']);
79
		$template->set_var('TITLE', $title);
80
		$template->set_var('LINK', '[wblink'.$page['page_id'].']');
81
		$template->parse('page_list', 'page_list_block', true);
82
		gen_page_list($page['page_id']);
83
	}
84
} else {
85
	$template->set_var('TITLE', 'None found');
86
	$template->set_var('LINK', 'None found');
87
	$template->parse('page_list', 'page_list_block', false);
88
}
89

  
90
$template->set_block('main_block', 'news_select_block', 'select_list');
91
$template->set_block('news_select_block', 'news_list_block', 'news_list');
92
$sql = 'SELECT * '
93
     . 'FROM `'.TABLE_PREFIX.'sections` '
94
     . 'WHERE `module`=\'news\'';
95
$newsSections = $database->query($sql);
96
while($section = $newsSections->fetchRow()){
97
	$sql = 'SELECT `title`, `link`, `post_id`, `page_id` '
98
	     . 'FROM `'.TABLE_PREFIX.'mod_news_posts` '
99
	     . 'WHERE `active`=1 AND `section_id`='.$section['section_id'];
100
	$news = $database->query($sql);
101
	while($aItem = $news->fetchRow()) {
102
		$template->set_var('TITLE', $aItem['title']);
103
		$template->set_var('LINK', '[wblink'.$aItem['page_id'].'?addon=news&item='.$aItem['post_id'].']');
104
//		$template->set_var('LINK', WB_URL.PAGES_DIRECTORY.$item['link'].PAGE_EXTENSION);
105
		$template->parse('news_list', 'news_list_block', true);
106
	}
107
	$template->set_var('PAGE_ID', $section['page_id']);
108
	$template->parse('select_list', 'news_select_block', true);
109
	$template->clear_var('news_list');
110
}
111

  
112
// Parse the template object
113
$template->parse('main', 'main_block', false);
114
$template->pparse('output', 'page');
115

  
111 116
?>
branches/2.8.x/wb/modules/news/WbLink.php
1
<?php
2

  
3
/**
4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19

  
20
/**
21
 * WbLink.php
22
 *
23
 * @category     Addons
24
 * @package      Addons_News
25
 * @copyright    Manuela v.d.Decken <manuela@isteam.de>
26
 * @author       Manuela v.d.Decken <manuela@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      0.0.1
29
 * @revision     $Revision: $
30
 * @link         $HeadURL: $
31
 * @lastmodified $Date: $
32
 * @since        File available since 04.11.2013
33
 * @description  This class implements an interface for the wblink-outputfilter
34
 *
35
 * @inherited WbDatabase $oDb
36
 * @inherited WbAdaptor  $oReg
37
 *
38
 */
39

  
40
class m_news_WbLink extends WbLinkAbstract
41
{
42
/**
43
 * makeLinkFromTag
44
 * @param type $aReplacement
45
 * @return string
46
 * @description
47
 */
48
	public function makeLinkFromTag(array $aReplacement)
49
	{
50
	// set link on failure ('#' means, still stay on current page)
51
		$sRetval = '#';
52
	// search `link` from posts table and create absolute URL
53
		$sql = 'SELECT `link` '
54
			 . 'FROM `'.$this->oDb->TablePrefix.'mod_news_posts` '
55
			 . 'WHERE `post_id`='.$aReplacement['Args']['item'];
56
		if(($sLink = $this->oDb->get_one($sql)))
57
		{
58
			$sLink = trim(str_replace('\\', '/', $sLink), '/');
59
		// test if valid accessfile is available
60
			if(is_readable($this->oReg->AppPath.$this->oReg->PagesDir.$sLink.$this->oReg->PageExtension))
61
			{
62
				$sRetval = $this->oReg->AppUrl.$this->oReg->PagesDir.$sLink.$this->oReg->PageExtension;
63
			}
64
		}
65
		return $sRetval;
66
	}
67

  
68
//	public function generateLinkList(Template $oTpl)
69
//	{
70
//		;
71
//	}
72
} // end of class m_news_WbLink

Also available in: Unified diff