[Phpcms-plugins-cvs] admin4phpCMS/modules/layout layout.tpl,NONE,1.1 class.module_layout.php,1.7,1.8
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-06-18 15:17:26
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28241/modules/layout Modified Files: class.module_layout.php layout.css layout.xml Added Files: layout.tpl Log Message: module filemanager and editor included Index: layout.xml =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/layout.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- layout.xml 5 Jun 2004 12:44:23 -0000 1.3 +++ layout.xml 18 Jun 2004 15:17:01 -0000 1.4 @@ -1,184 +1,243 @@ <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <!DOCTYPE layout SYSTEM "layout.dtd"> -<layout> +<layout name="standard"> - <empty> + <layout:insert name="empty"> <![CDATA[ - <content /> + <layout:replace name="content" /> ]]> - </empty> + </layout:insert> - <block> + <layout:insert name="block"> <![CDATA[ - <div id="<id />" class="<class />"> - <content /> + <div <layout:replace name="extra" default="" />> + <layout:replace name="content" /> </div> ]]> - </block> + </layout:insert> - <paragraph> + <layout:insert name="column_block"> <![CDATA[ - <p id="<id />" class="<class />"> - <content /> - </p> + <div <layout:replace name="extra" default="" />> + <layout:replace name="content" /> + <br style="clear:both;" /> + </div> ]]> - </paragraph> + </layout:insert> - <hr> + <layout:insert name="column"> <![CDATA[ - <hr id="<id />" class="<class />" /> + <div <layout:replace name="extra" default="" /> style="float:left;"> + <layout:replace name="content" /> + </div> + ]]> + </layout:insert> + + + <layout:insert name="inline"> + <![CDATA[ + <span <layout:replace name="extra" default="" />> + <layout:replace name="content" /> + </span> + ]]> + </layout:insert> + + + <layout:insert name="paragraph"> + <![CDATA[ + <p <layout:replace name="extra" default="" />><layout:replace name="content" /></p> + ]]> + </layout:insert> + + + <layout:insert name="hr"> + <![CDATA[ + <hr <layout:replace name="extra" default="" /> /> ]]> - </hr> + </layout:insert> - <headline> + <layout:insert name="headline"> <![CDATA[ - <h2 id="<id />" class="<class />"> - <content /> + <h2 <layout:replace name="extra" default="" />> + <layout:replace name="content" /> </h2> ]]> - </headline> + </layout:insert> - <image> + <layout:insert name="image"> <![CDATA[ - <img src="<src />" width="<width />" height="<height />" title="<title />" alt="<alt />"> + <img src="<layout:replace name="src" />" width="<layout:replace name="width" />" height="<layout:replace name="height" />" title="<layout:replace name="title" />" alt="<layout:replace name="alt" />" <layout:replace name="extra" default="" /> /> ]]> - </image> + </layout:insert> + <layout:insert name="link"> + <![CDATA[ + <a href="<layout:replace name="href" />" title="<layout:replace name="title" />"> + <layout:replace name="content" /> + </a> + ]]> + </layout:insert> - <form> + <layout:insert name="form"> <![CDATA[ - <form id="<id />" name="<name />" method="<method />" enctype="x-form/multipart"> - <content /> + <form action="<layout:replace name="action" default="" />" <layout:replace name="extra" default="" /> method="<layout:replace name="method" default="post" />" enctype="x-form/multipart"> + <layout:replace name="content" /> </form> ]]> - </form> + </layout:insert> - <form_input_hidden> + <layout:insert name="form_fieldset"> <![CDATA[ - <input type="hidden" name="<name />" id="<id />" value="<value />" /> + <fieldset> + <legend><layout:replace name="title" /></legend> + <layout:replace name="content" /> + </fieldset> ]]> - </form_input_hidden> + </layout:insert> - <form_input_text> + <layout:insert name="form_input_hidden"> + <![CDATA[ + <input type="hidden" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" /> /> + ]]> + </layout:insert> + + + <layout:insert name="form_input_text"> <![CDATA[ <label> <span> - <label /> + <layout:replace name="label" /> </span> - <input type="text" name="<name />" id="<id />" value="<value />" /> + <input type="text" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" /> /> </label> ]]> - </form_input_text> + </layout:insert> - <form_input_password> + <layout:insert name="form_input_password"> <![CDATA[ <label> <span> - <label /> + <layout:replace name="label" default="" /> </span> - <input type="password" name="<name />" id="<id />" value="<value />" /> + <input type="password" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" /> /> </label> ]]> - </form_input_password> + </layout:insert> - <form_radio> + <layout:insert name="form_radio"> <![CDATA[ - <label><input type="radio" name="<name />" id="<id />" value="<value />" /><label /></label> + <label><input type="radio" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" /> /><label /></label> ]]> - </form_radio> + </layout:insert> - <form_checkbox> + <layout:insert name="form_checkbox"> <![CDATA[ <label> <span> - <label /> + <layout:replace name="label" default="" /> </span> - <input type="checkbox" name="<name />" id="<id />" value="<value />" /> + <input type="checkbox" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" /> /> </label> ]]> - - </form_checkbox> + </layout:insert> - <form_textarea> + <layout:insert name="form_checkbox_simple"> + <![CDATA[ + <input type="checkbox" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" /> /> + ]]> + + </layout:insert> + + + <layout:insert name="form_textarea"> <![CDATA[ <label> <span> - <label /> + <layout:replace name="label" default="" /> </span> - <textarea name="<name />" id="<id />"> - <value /> - </textarea> + <textarea name="<layout:replace name="name" />" <layout:replace name="extra" default="" />><layout:replace name="value" /></textarea> </label> ]]> - - </form_textarea> + </layout:insert> - <form_button> + <layout:insert name="form_button"> <![CDATA[ - <button type="<type />" name="<name />" id="<id />" value="<value />"> - <text /> + <button type="<layout:replace name="type" />" name="<layout:replace name="name" />" value="<layout:replace name="value" />" <layout:replace name="extra" default="" />> + <layout:replace name="text" /> </button> ]]> - - </form_button> + </layout:insert> - <menu_main_entry> + <layout:insert name="menu_main_entry"> <![CDATA[ - <li class="<class />" id="<id />"> - <a href="?moduleid=<module />&<params />"> - <name /> + <li <layout:replace name="extra" default="" />> + <a href="?moduleid=<layout:replace name="module" />&<layout:replace name="params" />"> + <layout:replace name="name" /> </a> </li> ]]> - </menu_main_entry> + </layout:insert> - <ulist> + <layout:insert name="ulist"> <![CDATA[ - <ul id="<id />" class="<class />"> - <content /> + <ul <layout:replace name="extra" default="" />> + <layout:replace name="content" /> </ul> ]]> - </ulist> + </layout:insert> - <menu_sub_entry> + <layout:insert name="olist"> <![CDATA[ - <li class="<class />" id="<id />"> - <a href="?moduleid=<module />&action=<action />&<param />"> - <name /> + <ol <layout:replace name="extra" default="" />> + <layout:replace name="content" /> + </ol> + ]]> + </layout:insert> + + + <layout:insert name="menu_sub_entry"> + <![CDATA[ + <li <layout:replace name="extra" default="" />> + <a href="?moduleid=<layout:replace name="module" />&action=<layout:replace name="action" />&<layout:replace name="param" />"> + <layout:replace name="name" /> </a> </li> ]]> - </menu_sub_entry> + </layout:insert> - <list_entry> + <layout:insert name="list_entry"> <![CDATA[ - <li class="<class />"> - <content /> + <li <layout:replace name="extra" default="" />> + <layout:replace name="content" /> </li> ]]> - </list_entry> + </layout:insert> - <fm_file_entry> + <layout:insert name="filelist_entry"> <![CDATA[ - + <li <layout:replace name="extra" default="" />> + <layout:replace name="content" /> + <span class="filemtime" title="Last modified"><layout:replace name="filemtime" /></span> + <span class="filesize" title="Dateigröße"><layout:replace name="filesize" /></span> + <span class="chmod" title="Besitzer: <layout:replace name="uid" />\nGruppe: <layout:replace name="gid" />"><layout:replace name="chmod" /></span> + </li> ]]> - </fm_file_entry> - + </layout:insert> </layout> \ No newline at end of file --- NEW FILE: layout.tpl --- (This appears to be a binary file; contents omitted.) Index: class.module_layout.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/class.module_layout.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- class.module_layout.php 5 Jun 2004 12:44:23 -0000 1.7 +++ class.module_layout.php 18 Jun 2004 15:17:01 -0000 1.8 @@ -30,6 +30,9 @@ /* * $Log$ +* Revision 1.8 2004/06/18 15:17:01 mjahn +* module filemanager and editor included +* * Revision 1.7 2004/06/05 12:44:23 mjahn * separated layout-files * @@ -49,7 +52,7 @@ */ /** -* include the PEAR::XML_Tree-class for parsing the layout.xml-file +* 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 @@ -87,6 +90,8 @@ var $_ids = array (); /** + * + * * @var array saves the layout-data * @example /home/martin/devel/admin4phpCMS/modules/layout/layout.xml included example-file * @access private @@ -114,7 +119,7 @@ } /** - * adds an object to the elements-list + * Add an element to the elements-list * * <p>$actiondata must provide the following information * <ul> @@ -125,7 +130,6 @@ * @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'])) { @@ -137,6 +141,7 @@ 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']]; @@ -159,12 +164,12 @@ $output = join ('', file (dirname (__FILE__).'/layout.tpl')); // get all tags from the framework-layoutfile - $matches = preg_match_all ('°<phpcms-admin:([^(?/>)]*)\s/>°im', $output, $tags); + $matches = preg_match_all ('°<phpcms-admin:replace name="([^"]*)"\s*/>°im', $output, $tags); $tagnames = $tags[1]; $search = $tags[0]; $replace = array(); unset ($tags); - + // walk through the tag-array and generate the output for ($i = 0; $i < $matches; $i++) { $replace[$i] = ''; switch ($tagnames[$i]) { @@ -233,35 +238,11 @@ } } + // send output to browser echo str_replace ($search, $replace, $output); - //print_r($this->_elements); - } /** - * 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++) { - - // if entry does not exists jump over - if (!isset ($elements[$i])) { - continue; - } - - // check if sub-elements exist - $o .= $this->displayElement ($elements[$i]); - } - return $o; - } - - /** * Displays a single element * * $element['_type'] specifies, which template is used for displaying this element @@ -291,22 +272,44 @@ } // create the search- and replace-arrays - $replace = $search = array(); - foreach (array_keys ($element) as $id) { - if (substr ($id, 0, 1) == '_') { - continue; - } - $search[] = '<'.$id.' />'; - $replace[] = $element[$id]; + $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]]; + } } - - //print_r ($replace); return str_replace ($search, $replace, $this->_layout[$element['_type']]."\n"); } - - - + /** + * 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++) { + + // if entry does not exists jump over + if (!isset ($elements[$i])) { + continue; + } + + // check if sub-elements exist + $o .= $this->displayElement ($elements[$i]); + } + return $o; + } + /** * Parse the template-file * @@ -330,32 +333,24 @@ $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; } - $this->_layout[$this->_layoutdata->children[$i]->name] =& $this->_layoutdata->children[$i]->content; - } - } - - /** - * Save the templatedata into the xml-file - * - * @access private - **/ - function _saveLayoutFile () { - $layoutfile = dirname(__FILE__).'/layout.xml'; - - $fh = fopen ($layoutfile, 'wb'); - if ($fh === false) { - $actiondata = array ('errortext'=>'Layoutdatei konnte nicht geöffnet werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + if ($this->_layoutdata->children[$i]->name != 'layout:insert') { + continue; + } + + if (!isset($this->_layoutdata->children[$i]->attributes['name'])) { + continue; + } + + $this->_layout[$this->_layoutdata->children[$i]->attributes['name']] =& $this->_layoutdata->children[$i]->content; } - fwrite ($fh, $this->_layoutdata->get()); - fclose ($fh); + //print_r($this->_layout); } - } ?> \ No newline at end of file Index: layout.css =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/layout.css,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- layout.css 4 Jun 2004 11:11:58 -0000 1.1 +++ layout.css 18 Jun 2004 15:17:01 -0000 1.2 @@ -11,10 +11,13 @@ #content { margin-left:190px; padding:0; + background:#fff; } .content { padding:0.5em; + padding-top:2em; + overflow:auto; } #menu { @@ -27,6 +30,7 @@ padding:0; border-right:0.1em solid #000; border-bottom:0.1em solid #000; + background:#fff; } #menu ul { @@ -48,10 +52,6 @@ margin-left:1em; } -.content { - background:#fff; -} - label span { display:block; } @@ -63,10 +63,17 @@ #submenu { + background:#fff; + display:block; padding: 3px 0; -margin: 0; +margin: 0 0 1em 0; border-bottom: 1px solid #778; -font: bold 12px Verdana, sans-serif; +font: bold Verdana, sans-serif; +position:fixed; +top:0; +left:191px; +width:80%; + } #submenu li @@ -101,3 +108,89 @@ background: white; border-bottom: 1px solid white; } + +#filelist { + width:50em; +} + +#filelist li { + display:block; +} + +#filelist li, +#filelist li * { + font-family:monospace; +} + +#filelist li input, +#filelist li a, +#filelist li img, +#filelist li label, +#filelist li span { + float:left; + display:block; +} + +#filelist li .input { + margin-right:0.5em; +} + +#filelist li { + clear:left; +} + +li.line1 { + background-color:#fff; +} + +li.line2 { + background-color:#ddd; +} + +.filename { + width:15em; + padding-left:1em; +} + +.filemtime { + width:13em; +} + +.filesize { + width:6em; +} + +.chmod { + width:4em; +} + + +.giduid { + width:5em; +} + +#filelist .icon { + margin-right:0.5em; +} + +a img { + border:0; +} + +#filelist .header { + background-color:#f9e; +} + +#fileviewer { + font-family:monospace; + background:silver; + white-space:pre; + padding-right:1em; +} + +#fileviewer .linenumber { + background-color:#fff; + color:#00f; + padding-right:0.5em; + margin-right:0.5em; +} |