Index: trunk/admin/config/edit_template.php =================================================================== diff -u -r375 -r386 --- trunk/admin/config/edit_template.php (.../edit_template.php) (revision 375) +++ trunk/admin/config/edit_template.php (.../edit_template.php) (revision 386) @@ -12,6 +12,7 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## + if(!strlen($pathtoroot)) { $path=dirname(realpath(__FILE__)); @@ -87,16 +88,20 @@ require_once($pathtoroot.$admin."/listview/listview.php"); require_once($pathtoroot."kernel/include/tag-class.php"); + + $objTagList = new clsTagList(); -$objTagList->LoadGlobalTags(); +//$objTagList->LoadGlobalTags(); + $section = "in-portal:template_editor"; $ThemeId = GetVar('ThemeId'); $FileId = GetVar('FileId'); if(!GetVar('Action',true) || !is_object($f) ) $f = new clsThemeFile($FileId); + if($FileId) { $theme = new clsTheme( $f->Get("ThemeId") ); // create theme from file Index: trunk/kernel/admin/include/toolbar/template_editor.php =================================================================== diff -u -r375 -r386 --- trunk/kernel/admin/include/toolbar/template_editor.php (.../template_editor.php) (revision 375) +++ trunk/kernel/admin/include/toolbar/template_editor.php (.../template_editor.php) (revision 386) @@ -14,8 +14,59 @@ print " var TagArray = Array();\n"; print " var TagAttribs = Array();\n"; -foreach($objTagList->Items as $tag) + +// get taglist + tags attributes using 2 queries +$TablePrefix = GetTablePrefix(); +$db =& GetADODBConnection(); + +// get all tag attributes +$TagAttribs = array(); +$sql = 'SELECT * FROM '.$TablePrefix.'TagAttributes ORDER BY TagId, Name'; +$rs = $db->Execute($sql); + +while(!$rs->EOF) { + $rec =& $rs->fields; + $TagId = $rec['TagId']; + unset($rec['TagId']); + $TagAttribs[$TagId][] = $rec; + $rs->MoveNext(); +} + +// get taglist +$sql = 'SELECT * FROM '.$TablePrefix.'TagLibrary ORDER BY TagId'; +$rs =& $db->Execute($sql); +while(!$rs->EOF) +{ + $tag_rec =& $rs->fields; + // create main tag record + $Name = addslashes( $tag_rec['name'] ); + $Description = addslashes( $tag_rec['description'] ); + $Example = addslashes( $tag_rec['example'] ); + $Scope = $tag_rec['scope']; + $TagId = $tag_rec['TagId']; + echo ' var Tag = Array("'.$Name.'","'.$Description.'","'.$Example.'","'.$Scope.'");'."\n"; + echo ' TagArray['.$TagId.'] = Tag;'."\n"; + echo ' TagAttribs['.$TagId.'] = Array();'."\n"; + + // set tag attribs + if( isset($TagAttribs[$TagId]) ) + foreach($TagAttribs[$TagId] as $TagAttribute) + { + $Name = strtolower( addslashes( $TagAttribute['Name'] ) ); + $Type = strtolower( addslashes( $TagAttribute['AttrType'] ) ); + $Description = addslashes( $TagAttribute['Description'] ); + $Required = $TagAttribute['Required']; + $DefaultValue = addslashes( $TagAttribute['DefValue'] ); + print ' var Attr = Array("'.$Name.'","'.$Type.'","'.$Description.'","'.$Required.'","'.$DefaultValue.'");'."\n"; + print ' TagAttribs['.$TagId.'].push(Attr);'."\n"; + } + $rs->MoveNext(); +} + + +/*foreach($objTagList->Items as $tag) +{ $Name= addslashes($tag->Get("name")); $Description = addslashes($tag->Get("description")); $Example = addslashes($tag->Get("example")); @@ -34,7 +85,7 @@ print " var Attr = Array('$Name','$Type','$Description','$Required','$DefaultValue');\n"; print " TagAttribs[$TagId].push(Attr);\n"; } -} +} */ /* $ViewMenuJS = array(); Index: trunk/kernel/include/tag-class.php =================================================================== diff -u -r13 -r386 --- trunk/kernel/include/tag-class.php (.../tag-class.php) (revision 13) +++ trunk/kernel/include/tag-class.php (.../tag-class.php) (revision 386) @@ -377,6 +377,7 @@ { $this->Clear(); $this->Query_Item("SELECT * FROM ".$this->SourceTable); + for($i=0;$i<$this->NumItems();$i++) { $this->Items[$i]->LoadAttribs();