Project

General

Profile

« Previous | Next » 

Revision 2014

Added by darkviper almost 11 years ago

+ added new Interface usable to connect from WYSIWYG-Editor to all Modules with subitems like news or topics

View differences:

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

  
14
04 Nov-2013 Build 2014 Manuela v.d.Decken(DarkViper)
15
+ added new Interface usable to connect from WYSIWYG-Editor to all Modules with subitems like news or topics
14 16
04 Nov-2013 Build 2013 Manuela v.d.Decken(DarkViper)
15 17
# admin/groups some logical errors fixed
16 18
03 Nov-2013 Build 2012 Manuela v.d.Decken(DarkViper)
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', '2013');
54
if(!defined('REVISION')) define('REVISION', '2014');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/WbLinkAbstract.php
45 45
	}
46 46

  
47 47
	abstract public function makeLinkFromTag(array $aReplacement);
48
//	abstract public function generateLinkList(Template $oTpl);
48
	abstract public function &generateOptionsList();
49 49

  
50
/**
51
 *
52
 * @param string $sAddonName
53
 * @param string $sAddonTableName
54
 * @param string $sPageIdName
55
 * @param string $sSectionIdName
56
 * @param string $sItemIdName
57
 * @param string $sDateTimeName
58
 * @param string $sTitleName
59
 * @param string $sActivatedName
60
 * @return array by reference
61
 */
62
	final protected function &_executeListGeneration(
63
	                                                  $sAddonName      = 'news',
64
	                                                  $sAddonTableName = 'mod_news_posts',
65
	                                                  $sPageIdName     = 'page_id',
66
	                                                  $sSectionIdName  = 'section_id',
67
	                                                  $sItemIdName     = 'post_id',
68
	                                                  $sDateTimeName   = 'created_when',
69
	                                                  $sTitleName      = 'title',
70
	                                                  $sActivatedName  = 'active'
71
	                                                )
72
	{
73
		$aAddonItems = array();
74
		//generate news lists
75
		$sql = 'SELECT `p`.`'.$sItemIdName.'` `ItemId`, `p`.`'.$sPageIdName.'` `PageId`, '
76
		     .        '`s`.`section_id` `SectionId`, `p`.`'.$sTitleName.'` `Title` '
77
		     . 'FROM `'.$this->oDb->TablePrefix.'sections` `s` '
78
			 . 'LEFT JOIN `'.$this->oDb->TablePrefix.$sAddonTableName.'` `p` ON `s`.`section_id`= `p`.`'.$sSectionIdName.'` '
79
			 . 'WHERE `p`.`'.$sActivatedName.'`>0 AND `s`.`module`=\''.$sAddonName.'\' '
80
			 . 'ORDER BY `s`.`page_id`, `s`.`section_id`, `p`.`'.$sDateTimeName.'` DESC';
81
		if (( $oRes = $this->oDb->doQuery($sql))) {
82
			$iCurrentPage    = 0;
83
			$iCurrentSection = 0;
84
			$iSectionCounter = 0;
85
			while ($aItem = $oRes->fetchRow(MYSQL_ASSOC)) {
86
				if ($iCurrentPage != $aItem['PageId']) {
87
					$iCurrentPage = $aItem['PageId'];
88
					$aAddonItems[$iCurrentPage.'P'] = array();
89
				}
90
				if ($iCurrentSection != $aItem['SectionId']) {
91
					$iCurrentSection = $aItem['SectionId'];
92
					$aAddonItems[$iCurrentPage.'P'][] = array();
93
					$iSectionCounter = sizeof($aAddonItems[$iCurrentPage.'P'])-1;
94
				}
95
				$aAddonItems[$iCurrentPage.'P'][$iSectionCounter][] = array(
96
				    'wblink' => '[wblink'.$aItem['PageId'].'?addon='.$sAddonName.'&item='.$aItem['ItemId'].']',
97
				    'title'  => preg_replace("/\r?\n/", "\\n", $this->oDb->escapeString($aItem['Title']))
98
				);
99
			}
100
		}
101
		return $aAddonItems;
102
	}
50 103

  
104

  
51 105
} // end of class WbLinkAbstract
branches/2.8.x/wb/modules/output_filter/filters/filterWbLink.php
67 67
							if($oWbLink instanceof WbLinkAbstract)
68 68
							{
69 69
							// create real link from replacement data
70
								$aReplaceList[$sKey] = $oWbLink->makeLinkFromTag($aReplacement);
70
								$aReplaceList[$sKey] = $oWbLink->makeLinkFromTag($aReplacement['Args']);
71 71
							}
72 72
						}
73 73
					}
branches/2.8.x/wb/modules/news/WbLink.php
52 52
	// search `link` from posts table and create absolute URL
53 53
		$sql = 'SELECT `link` '
54 54
			 . 'FROM `'.$this->oDb->TablePrefix.'mod_news_posts` '
55
			 . 'WHERE `post_id`='.$aReplacement['Args']['item'];
55
			 . 'WHERE `post_id`='.$aReplacement['item'];
56 56
		if(($sLink = $this->oDb->get_one($sql)))
57 57
		{
58 58
			$sLink = trim(str_replace('\\', '/', $sLink), '/');
......
64 64
		}
65 65
		return $sRetval;
66 66
	}
67

  
68
//	public function generateLinkList(Template $oTpl)
69
//	{
70
//		;
71
//	}
67
/**
68
 * generateOptionsList
69
 * @param  string $sObjectName name of the array to create (default: 'AddonItemsSelectBox')
70
 * @return &array complete definition of a SelectBox
71
 * @description Bild a mulitdimensional Array with complete Option definitions for use in a Select Box
72
 */
73
	public function &generateOptionsList()
74
	{
75
		$aAddonItems =& $this->_executeListGeneration(
76
	                                           'news',
77
	                                           'mod_news_posts',
78
	                                           'page_id',
79
	                                           'section_id',
80
	                                           'post_id',
81
	                                           'created_when',
82
	                                           'title',
83
	                                           'active'
84
	                                          );
85
		return $aAddonItems;
86
	}
72 87
} // end of class m_news_WbLink

Also available in: Unified diff