[Phpcms-plugins-cvs] admin4phpCMS/modules/layout .cvsignore,NONE,1.1 layout.css,1.7,1.8 class.module
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2005-04-07 14:09:52
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15012/modules/layout Modified Files: layout.css class.module_layout.php gui.js Added Files: .cvsignore Removed Files: layout.xml gui.css layout.dtd Log Message: Commit as backup during development --- NEW FILE: .cvsignore --- smarty --- gui.css DELETED --- Index: class.module_layout.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/class.module_layout.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- class.module_layout.php 7 Dec 2004 06:34:46 -0000 1.13 +++ class.module_layout.php 7 Apr 2005 14:09:04 -0000 1.14 @@ -30,6 +30,9 @@ /* * $Log$ +* Revision 1.14 2005/04/07 14:09:04 mjahn +* Commit as backup during development +* * Revision 1.13 2004/12/07 06:34:46 mjahn * prepration of first Alpha-Preview * @@ -67,14 +70,12 @@ * test */ -/** -* Include the PEAR::XML_Tree-class for parsing the layout.xml-file -* -* There is a little bug in the Node.php in this package. It replaces the entities '<', '>', '"' and '''. -* With this the output is not interpretable for clients -**/ -include_once (PATH_TO_PEAR.'XML/Tree.php'); -include_once (PATH_TO_PEAR.'XML/DTD/XmlValidator.php'); +if (!defined ('SMARTY_DIR')) { + /** + * define the path to the directory where the smarty files lays + */ + define ('SMARTY_DIR', dirname (__FILE__).'/smarty/'); +} /** * Layout-class @@ -96,55 +97,23 @@ class module_layout extends module { /** - * @var array saves the object-hierarchie of the layout-elements - * @access private - **/ - var $_elements = array (); - - /** - * @var array saves references to the layout-elements as quick-links - * @access private - **/ - var $_ids = array (); - - /** - * - * - * @var array saves the layout-data - * @example /home/martin/devel/admin4phpCMS/modules/layout/layout.xml included example-file - * @access private - **/ - var $_layout = array (); - - /** * Initializing * * Registers the needed and provided events and actions **/ function init () { - $this->_registerEvent ('LAYOUT_ADD_ELEMENT', 'doLayoutAddElement'); - $this->_registerEvent ('LAYOUT_ADD_TEMPLATE', 'doLayoutAddTemplate'); - $this->_registerEvent ('DISPLAY_PARSE_MENU_MAIN', 'doParseMenuMain'); - $this->_registerEvent ('DISPLAY_PARSE_STATUSBAR', 'doParseStatusbar'); - $this->_registerEvent ('DISPLAY_PARSE_MENU_SUB', 'doParseMenuSub'); - $this->_registerEvent ('DISPLAY_PARSE_ERROR', 'doParseError'); - $this->_registerEvent ('DISPLAY_PARSE_CONTENT', 'doParseContent'); + $this->_registerEvent ('GET_MENU', 'doGetMenu'); + $this->_registerEvent ('GET_STATUS', 'doGetStatus'); + $this->_registerEvent ('GET_DATA', 'doGetData'); + $this->_registerEvent ('GET_LANGUAGE', 'doGetLanguage'); $this->_registerAction ('doParseParam', 'parseParam'); - $this->_registerAction ('doLayoutAddElement', 'addElement'); - $this->_registerAction ('doLayoutAddTemplate', 'addTemplate'); $this->_registerAction ('doDisplay', 'displayLayout'); - - $this->_elements[0] = array ('_type'=>'document', 'id'=>'root'); - - - // parse the layoutfile for the elements - $this->_readLayoutFiles (dirname (__FILE__).'/layout.xml'); } function parseParam (&$actiondata) { $this->paramname = 'showvalue'; - $this->showtags = array ('mainmenu'=>'MENU_MAIN', 'statusbar'=>'STATUSBAR', 'submenu'=>'MENU_SUB', 'error'=>'ERROR', 'content'=>'CONTENT'); + $this->showtags = array ('menu'=>'MENU', 'status'=>'STATUS', 'data'=>'DATA'); if (!isset ($_GET [$this->paramname])) { $this->views = false; @@ -157,72 +126,6 @@ unset ($_GET [$this->paramname]); } - /** - * Add an element to the elements-list - * - * <p>$actiondata must provide the following information - * <ul> - * <li><b>type</b> type of the element in the file {@link /home/martin/devel/admin4phpCMS/modules/layout/layout.xml Example of the layoutfile})</li> - * <li><b>id</b> unique id of the element</li> - * </ul> - * - * @param array $actionhandler data of the element to insert - **/ - function addElement (&$actiondata) { - // get a reference to the parental element - $parent =& $this->_elements[0]; - if (isset ($actiondata['_root'])) { - $parent =& $this->_ids[$actiondata['_root']]; - } - - $id = ''; - if (!isset ($actiondata['_id'])) { - $actiondata ['_success'] = false; -// echo '1';print_r ($actiondata); - return false; - } - - if (isset ($this->_ids [$actiondata ['_id']])) { - $actiondata ['_success'] = false; -// echo '2';print_r ($actiondata); - return false; - } - - $this->_ids[$actiondata['_id']] = $actiondata; - //echo '<p>ADD_ELEMENT '.$actiondata ['_id'].'</p>'."\n"; - - if (isset ($parent['_sub'])) { - $parent['_sub'][] =& $this->_ids[$actiondata['_id']]; - } else { - $parent['_sub'][0] =& $this->_ids[$actiondata['_id']]; - } - $actiondata ['_success'] = true; - return true; - } - - function addTemplate (&$actiondata) { - // check if the file does exist - if (!file_exists ($actiondata ['filename'])) { - $actiondata ['_success'] = false; - return false; - } - - // check if the file does conform with the DTD -/* $DTD = new XmlValidator (); - if (!DTD->isValid (dirname (__FILE__).'/layout.dtd', $actiondata ['filename'])) { - $actiondata ['_success'] = false; - return false; - } - unset ($DTD); -*/ - // parse the file - // merge the parsed filedata with the layout-tree - $this->_readLayoutfiles ($actiondata ['filename']); - - $actiondata ['_success'] = true; - - return true; - } /** * Generate output for the framework @@ -231,153 +134,60 @@ **/ function displayLayout (&$actiondata) { - $actiondata2 = array (); - - // set tags that has to be replaced in the layout - foreach ($this->showtags as $tag=>$event) { - // set the container-element - $actiondata1 = array ('_type'=>'empty', '_id'=>$tag); - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); - - // get the content for the tag - $actiondata1 = array ('_root'=>$tag); - $this->_callEvent ('DISPLAY_PARSE_'.$event, $actiondata1); - - if (isset ($this->_ids[$tag]['_sub'])) { - $actiondata2 [$tag] = $this->displayElement ($this->_ids [$tag]); - } - } - - if ($this->views !== false) { - if ($this->views == 'mainmenu') { - echo '<ul>'."\n"; + include_once (SMARTY_DIR.'/Smarty.class.php'); + $smarty =& new Smarty; + $smarty->template_dir = dirname (__FILE__).'/templates/'; + $smarty->compile_dir = INDEX_PATH.'/temp/templates_c/'; + $smarty->cache_dir = INDEX_PATH.'/temp/cache/'; + $smarty->caching = false; + $smarty->cache_lifetime = 10; + + $actiondata1 = array ('tag'=>'lang', 'lang' => array ()); + $this->_callEvent ('GET_LANGUAGE', $actiondata1); + $lang = array (); + if (is_array ($actiondata1 ['lang'])) { + if (isset ($actiondata1 ['lang'] ['en'])) { + $lang = $actiondata1 ['lang'] ['en']; + unset ($actiondata1 ['lang'] ['en']); } - echo $this->displayElement ($this->_ids[$this->views]); - if ($this->views == 'mainmenu') { - echo '</ul>'."\n"; + foreach ($actiondata1 ['lang'] as $lang=>$data) { + if (!isset ($actiondata1 ['lang'] [$lang]) || !is_array ($actiondata1 ['lang'] [$lang])) { + $lang = array_merge ($lang, $actiondata1 ['lang'] [$lang]); + } } - } else { - // send output to browser - $actiondata2 ['_type'] = 'layout'; - $actiondata2 ['_id'] = 'admin4phpcms'; - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata2); - echo $this->displayElement ($this->_ids['admin4phpcms']); - } - } - - /** - * Displays a single element - * - * $element['_type'] specifies, which template is used for displaying this element - * - * @param array $element array with all the attributes for the element - **/ - function displayElement (&$element) { - - // check if there is a layout-template for the type of this element - if (!isset ($element['_type']) || !isset ($this->_layout[$element['_type']])) { - //echo '<p>Undefined layout type: '.$element['_type'].'</p>'."\n"; - return ''; - } - //echo '<p>Defined layout type: '.$element['_type'].'</p>'."\n"; - - if (!isset($element['content'])) { - $element['content'] = ''; - } - - if (isset ($element['_sub']) && is_array ($element['_sub'])) { - - // get the content of the sub-elements - $content = $this->displayGroup ($element['_sub']); - - // merge the sub-element-content with the params of the element - if (!isset ($element['content']) || $element['content'] == '') { - $element['content'] = $content; - } - } - - // create the search- and replace-arrays - $matches = preg_match_all ('°<layout:replace\sname="([^"]*)"\s(?:default="([^"]*)"\s)*\s*/>°im', $this->_layout[$element['_type']], $erg); - $search = $erg[0]; - $tags = $erg[1]; - $defaults = $erg[2]; - $replace = array(); - for ($i = 0; $i < $matches; $i++) { - if (!isset ($element[$tags[$i]])) { - $replace [$i] = $defaults[$i]; - } else { - $replace[$i] = $element[$tags[$i]]; - } } - return str_replace ($search, $replace, $this->_layout[$element['_type']]."\n"); - } + $smarty->assign ('lang', $lang); - /** - * Displays an array of elements - * - * This function walks recursively through the element-structure and parses the output of any element. - * - * @param array $elements array with the element-arrays - **/ - function displayGroup (&$elements) { - $o = ''; - $num = count ($elements); - for ($i = 0; $i < $num; $i++) { + // set tags that has to be replaced in the layout + foreach ($this->showtags as $tag=>$event) { - // if entry does not exists jump over - if (!isset ($elements[$i])) { + if ($this->views !== false && $this->views != $tag) { continue; } - - // check if sub-elements exist - $o .= $this->displayElement ($elements[$i]); - } - return $o; - } - - function _setTags () { - $this->_defaultTags = array (); - } - - /** - * Parse the template-file - * - * @access private - **/ - function _readLayoutFiles ($layoutfile) { - - if (!isset($layoutfile)) { - $actiondata1 = array ('errortext'=>'Layoutdatei layout.xml konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata1); - return false; - } - - if (!file_exists ($layoutfile)) { - $actiondata1 = array ('errortext'=>'Layoutdatei layout.xml konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata1); - return false; + // get the content for the tag + $actiondata1 = array ('tag'=>$tag, $tag => array ()); + $this->_callEvent ('GET_'.strtoupper ($event), $actiondata1); + ${$tag} = $actiondata1 [$tag]; } - $XML =& new XML_Tree ($layoutfile); - $this->_layoutdata =& $XML->getTreeFromFile (); - $num = count ($this->_layoutdata->children); - //print_r($this->_layoutdata); - for ($i = 0; $i < $num; $i++) { - if (!isset($this->_layoutdata->children[$i]->name)) { - continue; - } - - if ($this->_layoutdata->children[$i]->name != 'layout:insert') { - continue; - } + $smarty->assign ('MODULE_PATH', MODULE_PATH); + $smarty->assign ('INDEX_PATH', INDEX_PATH); + $smarty->assign ('INDEX_WEB', dirname (INDEX_FILE)); + $smarty->assign ('ADMIN4PHPCMS_VERSION', ADMIN4PHPCMS_VERSION); + $smarty->assign ('DEBUG', DEBUG); + $smarty->assign ('INDEX_FILE', INDEX_FILE); - if (!isset($this->_layoutdata->children[$i]->attributes['name'])) { - continue; + if ($this->views !== false) { + // show only one view + $smarty->assign ($this->views, ${$this->views}); + $smarty->display ('framework.'.$this->views.'.tpl'); + } else { + // send output to browser + foreach ($this->showtags as $tag=>$event) { + $smarty->assign ($tag, ${$tag}); } - - $this->_layout[$this->_layoutdata->children[$i]->attributes['name']] =& XML_Tree_Node::decodeXmlEntities($this->_layoutdata->children[$i]->content); + $smarty->display ('framework.tpl'); } - //print_r($this->_layout); } } --- layout.xml DELETED --- Index: gui.js =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/gui.js,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gui.js 25 Aug 2004 21:16:44 -0000 1.2 +++ gui.js 7 Apr 2005 14:09:04 -0000 1.3 @@ -38,6 +38,26 @@ tabs.push (id); } -window.onload = function onloadHide () { - displayTab (tabs [0]); +if (tabs.length > 0) { + window.onload = function onloadHide () { + displayTab (tabs [0]); + } +} + +function hideArea (id) { + if (!document.getElementById (id)) { + return false; + } + + document.getElementById (id).className = 'hidden'; + return true; +} + +function showArea (id) { + if (!document.getElementById (id)) { + return false; + } + + document.getElementById (id).className = ''; + return true; } \ No newline at end of file --- layout.dtd DELETED --- Index: layout.css =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/layout.css,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- layout.css 7 Dec 2004 06:34:46 -0000 1.7 +++ layout.css 7 Apr 2005 14:09:04 -0000 1.8 @@ -1,16 +1,18 @@ +* { + padding:0; + border:0; + margin:0; +} + html, body { width:100%; font-size:100.01%; - padding:0; - border:0; - margin:0; background:#fff; } #content { - margin-left:192px; - padding:0; + margin-left:210px; background:#fff; } @@ -20,16 +22,16 @@ } #menu { - position:fixed; + position:absolute; top:0; left:0; height:100%; width:170px; - margin:0; padding:0 10px; border-right:2px outset #eee; border-bottom:2px outset #eee; - background:#eee; + background:#f0f0f0; + font-size:0.9em; } #menu img { @@ -38,20 +40,19 @@ #menu p { padding:0.2em; - border:1px inset #029544; + border:1px outset #999; color:#333; + margin:0.3em 0; } #menu p a { - color:#029544; + color:#00f; } #menu ul { list-style-type:none; - padding:0.3em; - margin:0; - border:0; - border:1px inset #029544; + border:1px outset #999; + margin:0.3em 0; } #menu ul li { @@ -59,362 +60,244 @@ margin:0; } +#menu li a { + border-bottom:1px solid #444; +} + +#menu li a.last { + border-bottom:0; +} + +#menu ul li a.current, #menu ul li a { padding:0.2em 0.5em; - margin:0.2em 0; display:block; text-decoration:none; - color:#029544; - background:#eee; - border:1px outset #029544; -} - - - -#menu ul li.active a, -#menu ul li a:hover { - background:#fff; - border:1px inset #029544; + color:#00f; } #menu ul li ul { - margin-left:1em; + margin:0 0 0 1em; + border:0; + border:0; + border-bottom:1px solid #444; } #menu ul li ul li { - margin-left:1em; -} - -label span { - display:block; + margin-left:0; + padding:0; } -textarea { - width:95%; - height:10em; -} +#menu ul li a.current, +#menu ul li a:hover { + background:#fff; + color:#f00; +} - #submenu { - background:#eee; +label span { display:block; - padding: 3px 0; - margin: 0 0 1em 0; - border-bottom: 1px solid #029544; - font: bold Verdana, sans-serif; - position:fixed; - top:0; - left:192px; - width:99%; -} - -#submenu li { - list-style: none; - margin: 0; - display: inline; -} - -#submenu li a { - padding: 3px 0.5em; - margin-left: 3px; - border: 1px solid #029544; - font-weight:bold; - border-bottom: none; - background: #ddd; - text-decoration: none; -} - -#submenu li a:link { - color: #029544; -} - -#submenu li a:visited { - color: #029544; -} - -#submenu li a:hover { - color: #029544; - font-weight:bold; - background: #fff; - border-color: #029544; -} - -#submenu li#current a { - background: white; - border-bottom: 1px solid white; -} - -#filelist { - list-style-type:none; - padding:0; - margin:0.1em 0; } -#filelist li, -#filelist li * { - font-family:monospace; -} - -#filelist li input, -#filelist li a, -#filelist li img { - float:left; -} -#filelist a.filename { - float:none; - text-decoration:none; - color:#029544; +.hidden { + display:none; } -#filelist li .filemtime, -#filelist li .filesize, -#filelist li .chmod { - float:right; +legend { + background:#029544; + display:block; + color:#fff; + padding:0.2em 0.5em; } -#filelist li .input { - margin-right:0.5em; +fieldset { + background:#f0f0f0; + max-width:60em; } -#filelist li { - max-width:50em; +.content .label, +.content label { clear:left; - padding-right:0.3em; -} - -li.line1 { - background-color:#fff; + display:block; + padding:0.5%; + border-top:0.2em solid #fff; } -li.line2 { - background-color:#eee; +.content .label span, +.content label span { + width:64%; + float:left; + } -.filename { - padding-left:1em; - line-height:16px; +.content input, +.content textarea, +.content select { + width:34%; + margin:0; } -.filemtime { - width:13em; -} -.filesize { - width:5em; - text-align:right; +.content select.horizontal { + width:10em; } -.chmod { - width:7em; - text-align:right; +.content input, +.content textarea, +.content select, +.content fieldset { + border:1px solid #663; + padding:0.2em; } -a img { +.content label.horizontal input, +.content input[type=checkbox], +.content input[type=radio], +.content input[type=image] { + width:auto; border:0; } -#filelist li.header, -#filelist li.footer { - border:1px outset #029544; - color:#029544; - background:#ddd; - margin:0.1em 0; -} - -#filelist li.header *, -#filelist li.footer * { - color:#029544; -} - -#filelist li.header { - padding-top:0.2em; -} - -#filelist li.footer { - padding-top:0.1em; - padding-bottom:0,1em; -} - - -.iconbar { - width:50em; - text-align:left; - margin:0.1em 0; - padding:0; +.content label.switch { + width:49%; + float:left; + clear:none; } -.iconbar a, -.iconbar input[type=submit], -.iconbar button[type=submit] { - background:none; - border:1px outset #029544; - padding:0.1em 0.5em; - margin:0; - color:#029544; - text-decoration:none; +.content .label label.horizontal { + display:block; + float:left; + width:6em; + clear:none; + border:0; } -.iconbar a { - line-height:16px; -} -#fileviewer { - font-family:monospace; - background:silver; - padding-right:1em; - width:50em; +.content label.horizontal { + display:inline; + width:49%; } -#fileviewer .linenumber { - float:left; - background-color:#fff; - color:#029544; - padding-right:0.5em; - width:3em; - text-align:right; +.content label.horizontal span { + width:4em; } -#fileviewer br { - clear:left; +.content .label.hover, +.content .label:hover, +.content label.hover, +.content label:hover { + background:#029544; + color:#fff; } - -#cacheview li { +/** Liste ohne Symbole **/ +ul.none { list-style-type:none; - margin-left:0em; - padding-left:0; } -#cacheview ul { - margin-left:1.5em; - padding-left:0; +/** horizontale Listen **/ +ul.horizontal { + margin:0; + padding:0; } -#cacheview li { - background:#ddd; - font-weight:normal; +ul.horizontal li { + display: inline; + list-style: none; + padding:0; + margin-left:0; } -#cacheview li.subdir { - background:#fff; +ul.trenner li { + padding:0 0.15em 0 0.5em; } -#cacheview li.subdir { - font-weight:bold; +ul.trenner li + li { + border-left:1px solid; } -#cacheview span.gzip { - color:#0f0; - font-weight:bold; +ul.trenner li.hidden + li { + border-left:0px solid; } -#cacheview span.statisch { - color:#f80; - font-weight:bold; +.info{ + position:relative; /*this is the key*/ + z-index:24; + cursor:help; } -#cacheview span.dynamisch { - color:#f00; - font-weight:bold; +.info.hover, +.info:hover { + z-index:25; } -#fm-options { - width:50em; - margin-left:1em; +.info span{ + display: none } -em { +.info.hover span, +.info:hover span { + display:block; + position:absolute; + top:2em; + left:2em; + width:20em; + border:0.2em ridge #000; + background-color:#f0f0f0; color:#029544; - font-style:normal; + padding:0.2em; + text-align: left; } -#fm-options { - font-family:monospace; - padding:0; - margin:1em 0; - max-width:50em; +.info b { + color:#000; } -p, -h2 { - font-family:sans-serif; +ul li { + margin-left:1em; } -.tabbed li a { - background:#eee; +table { + border-collapse:collapse; + max-width:60em; } -.tabbed li a.current { - border-top-style:outset; - border-left-style:outset; - border-right-style:outset; - border-color:#029544; - border-bottom-color:#ddd; +tfoot, +thead { background:#029544; - color:#eee; } -.tabbox { - border-style:outset; - background:#eee; +tfoot td, +thead th { + color:#fff; + font-weight:normal; + text-align:left; } - -legend { - border:1px solid #029544; - padding:0.1em; - padding: 0 0.5em; - font-family:sans-serif; - color:#eee; - background:#029544; +.line1 { + background:#f0f0f0; } -fieldset { - border:1px inset #029544; +.line2 { background:#fff; - margin:0.5em 0; - border-style:dashed; - padding:0.3em; -} - -label { - display:block; - width:35em; - clear:both; -} - -label select, -label input { - float:right; -} - - -label.horizontal { - display:inline; } -label.horizontal input { - float:none; -} - -li, -li * { - vertical-align:middle; +th, +td { + padding:0.2em; } -#taglist { - list-item-type:none; +tbody .line3, +tbody tr.hover, +tbody tr:hover { + background:#f00; } -#taglist dt { +dl.horizontal dt, +dl.horizontal dd { + float:left; padding:0.2em; - color:#029544; - border-top:1px solid; } -#taglist dd { - padding:0 0.2em; - margin-left:3em; -} - -.iframe { - overflow:auto; +dl.horizontal dt { + clear:left; + width:20em; } \ No newline at end of file |