[Phpslash-commit] CVS: phpslash-ft/class Block_i.class,1.17,1.18
Brought to you by:
joestewart,
nhruby
From: Joe S. <joe...@us...> - 2002-06-01 15:52:38
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv29745/phpslash-ft/class Modified Files: Block_i.class Log Message: Block_admin class Index: Block_i.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Block_i.class,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Block_i.class 20 Mar 2002 22:16:42 -0000 1.17 --- Block_i.class 1 Jun 2002 15:52:35 -0000 1.18 *************** *** 5,9 **** /* First let's bring in my parent class */ ! require($_PSL['classdir'] . '/Block.class'); /** --- 5,9 ---- /* First let's bring in my parent class */ ! // require($_PSL['classdir'] . '/Block.class'); /** *************** *** 15,19 **** */ class Block_i extends Block { ! /* Decare properties for class Block_i*/ var $psl, $templ, $debug, $argv_ary; --- 15,19 ---- */ class Block_i extends Block { ! /* Declare properties for class Block_i*/ var $psl, $templ, $debug, $argv_ary; *************** *** 60,300 **** } - - /** - * newBlock - Create a New Block - * - * Displays the form for entry of block info - * - * @access private - */ - function newBlock() { - - titlebar("100%", "Create a New Block"); - - $ary = $this->getTypes(); - $this->templ->set_block("newblock","block_type_row","block_type_rows"); - while ( list( $key, $val ) = each( $ary ) ) { - $this->templ->set_var(array( - 'BLOCK_TYPE_ID' => $key, - 'SELECTED' => "", - 'BLOCK_TYPE_NAME' => $val - )); - $this->templ->parse("block_type_rows","block_type_row",true); - } - - $this->templ->set_block("newblock","section_row","section_rows"); - $this->db->query("SELECT section_id, - section_name - FROM psl_section - ORDER BY section_name"); - while ($this->db->next_record()) { - $this->templ->set_var(array( - 'SECTION_ID' => $this->db->Record[section_id], - 'SELECTED' => "", - 'SECTION_NAME' => $this->db->Record[section_name] - )); - $this->templ->parse("section_rows","section_row",true); - } - $this->templ->set_block("newblock","each_option", "options"); - $blockcnt = $this->psl[block_optioncount]; - for ($i =1; $i <= $blockcnt; $i++) { - $this->templ->set_var(array( - 'OPTION_NAME' => "optionname[$i]", - 'OPTION_NAME_VAL' => "", - 'OPTION_VALUE' => "optionval[$i]", - 'OPTION_VALUE_VAL' => "" - )); - $this->templ->parse("options", "each_option", true); - } - - /* display a blank form */ - $this->templ->set_var(array( - 'ACTION_URL' => $this->psl['phpself'], - 'BLOCK_TITLE' => "", - 'LOCATION' => "", - 'SOURCE_URL' => "", - 'EXPIRE_LENGTH' => "", - 'CACHE_DATA' => "", - 'BLOCK_ID' => "", - 'ORDERNUM' => "" - )); - - $this->templ->parse('OUT',array("newblock")); - $this->templ->p('OUT'); - } - - /** - * editBlock - Update a New Block - * - * displays the form for block edits - * - * @param integer id - * @access private - */ - function editBlock($id) { - - titlebar("100%", "Update a Block"); - $this->getBlock($id); - - - /* - * Get the section_id's for this story into an array - */ - $q = "SELECT psl_section.section_id - FROM psl_section,psl_section_block_lut - WHERE psl_section_block_lut.block_id = '$id' - AND psl_section.section_id = psl_section_block_lut.section_id"; - $this->db->query($q); - $i = 0; - - while ($this->db->next_record()) { - $section_ary[$i] = $this->db->Record[section_id]; - $i++; - } - - $this->templ->set_block("editblock","block_type_row","block_type_rows"); - $this->templ->set_block("editblock","section_row","section_rows"); - $this->templ->set_block("editblock","each_option", "options"); - - $ary = $this->getTypes(); - while ( list( $key, $val ) = each( $ary ) ) { - $this->templ->set_var(array( - 'BLOCK_TYPE_ID' => $key, - 'SELECTED' => "", - 'BLOCK_TYPE_NAME' => $val - )); - if ($key == $this->block_info["type_id"]) { - $this->templ->set_var(array( - 'SELECTED' => "SELECTED" - )); - } - $this->templ->parse("block_type_rows","block_type_row",true); - } - - $this->db->query("SELECT section_id, - section_name - FROM psl_section - ORDER BY section_name"); - while ($this->db->next_record()) { - $this->templ->set_var(array( - 'SECTION_ID' => $this->db->Record['section_id'], - 'SECTION_NAME' => $this->db->Record['section_name'] - )); - - $this->templ->set_var(SELECTED,""); - for ($i = 0 ; $i < count($section_ary) ; $i++) { - if ($section_ary[$i] == $this->db->Record[section_id]) { - $this->templ->set_var(SELECTED,"SELECTED"); - } - } - - $this->templ->parse("section_rows","section_row",true); - } - $temparray=$this->block_info["block_options"]; - if (is_array($temparray)) { - reset($temparray); - } - $blockcnt = $this->psl['block_optioncount']; - $i = 1; - - if (is_array($temparray)) { - for ($i =1; $i <= count($temparray); $i++) { - $current=each($temparray); - if ($current) { - $this->templ->set_var(array( - 'OPTION_NAME' => "optionname[$i]", - 'OPTION_NAME_VAL' => $current[0], - 'OPTION_VALUE' => "optionval[$i]", - 'OPTION_VALUE_VAL' => $current[1] - )); - } - $this->templ->parse("options", "each_option", true); - } - if( (count($temparray) - $blockcnt) >= 0) { - $blockcnt = $i; // spit out one more; - } - } - - while ($i <= $blockcnt) { - $this->templ->set_var(array( - 'OPTION_NAME' => "optionname[$i]", - 'OPTION_NAME_VAL' => "", - 'OPTION_VALUE' => "optionval[$i]", - 'OPTION_VALUE_VAL' => "" - )); - $this->templ->parse("options", "each_option", true); - $i++; - } - - $this->templ->set_var(array( - 'ACTION_URL' => $this->psl['phpself'], - 'BLOCK_TITLE' => $this->block_info["title"], - 'LOCATION' => $this->block_info["location"], - 'SOURCE_URL' => $this->block_info["source_url"], - 'EXPIRE_LENGTH' => $this->block_info["expire_length"], - 'CACHE_DATA' => $this->block_info["cache_data"], - 'ORDERNUM' => $this->block_info["ordernum"], - 'BLOCK_ID' => $id - )); - - $this->templ->parse('OUT',array("editblock")); - $this->templ->p('OUT'); - $this->templ->set_var('OUT',""); - - } - - /** - * listBlock - list all blocks - * - * displays the complete list of blocks - * - * @access private - */ - function listBlock() { - - $query = "SELECT block.id, - title, - location, - source_url, - type.name AS type - FROM psl_block block, - psl_block_type type - WHERE type.id = block.type - ORDER BY title "; - $this->db->query($query); - - $this->templ->set_block("listblock", "row", "rows"); - $this->templ->set_block("listblock", "row2", "rows2"); - - while ($this->db->next_record()) { - - $block_id = $this->db->f("id"); - $modifyurl = $this->psl['adminurl'] ."/blockAdmin.php3?submit=edit&id=". $block_id; - $delurl = $this->psl['adminurl'] ."/blockAdmin.php3?submit=delete&id=". $block_id; - $viewurl = $this->psl['adminurl'] ."/blockAdmin.php3?submit=view&id=". $block_id; - - $this->templ->set_var(array( - 'MODIFYURL' => $modifyurl, - 'DELURL' => $delurl, - 'VIEWURL' => $viewurl, - 'TITLE' => $this->db->f("title"), - 'URL' => $this->db->f("location"), - 'SOURCE_URL' => $this->db->f("source_url"), - 'TYPE' => $this->db->f("type") - )); - if ($i%2 == 0) { - $this->templ->parse("rows","row","true"); - } else { - $this->templ->parse("rows","row2","true"); - } - $i++; - } - - titlebar("100%", "Update the Current Blocks"); - - $this->templ->parse('OUT', array("listblock")); - $this->templ->p('OUT'); - } - /** * getAllBlocksForIndex - wrapper to getBlocks --- 60,63 ---- *************** *** 398,479 **** } } - - /** - * listBlockTypes - display a list of all available block types - * - * displays the complete list of available block types - * Used only by admin - * - * @param string option - * @access public - */ - function listBlockTypes($option="", $name="") { - - $this->templ = new Template($this->psl['templatedir']); - $this->templ->debug = 0; - $this->templ->set_file(array( - listblocktypes => "blocktypeList.tpl" - )); - - titlebar("100%","Manage Block Types"); - - if( $option == "all") { - - $fulldirlist = dir($this->psl['classdir']); - $i=1; - while( $eachfile = $fulldirlist->read()) { - $each = $this->psl['classdir'] . "/" . $eachfile; - if( (is_file($each)) AND - ( preg_match('/Block_render_/i', $each)) ) { - - $eachtype = str_replace("Block_render_", "", $eachfile); - $eachtype = str_replace(".class", "", $eachtype); - $avail_ary[$eachtype] = $i; - $i++; - } - } - - $current_types = $this->getTypes(); - - $this->templ->set_block("listblocktypes", "removerow", "removerows"); - - while( list($key, $val) = each($current_types) ) { - $current_type = $val; - $this->templ->set_var(array( - REMOVENAME => $current_type, - REMOVEURL => $this->psl['phpself'] ."?option=delete". $this->psl['amp'] ."name=". $current_type - - )); - $this->templ->parse("removerows","removerow",true); - if( isset($avail_ary[$current_type])) { - unset($avail_ary[$current_type]); - - } - - } - $this->templ->set_block("listblocktypes","addrow","rows"); - while( list($key, $val) = each($avail_ary) ) { - - $this->templ->set_var(array( - 'ADDNAME' => $key, - 'ADDURL' => $this->psl[phpself] ."?option=add". $this->psl[amp] ."name=". $key - )); - $this->templ->parse("rows","addrow",true); - - } - - $this->templ->parse('OUT',array("listblocktypes")); - $this->templ->p('OUT'); - } elseif ($option == "add") { - $this->putType($name); - $this->listBlockTypes("all"); - } elseif ($option == "delete") { - $this->deleteType($name); - $this->listBlockTypes("all"); - } else { - echo "<A HREF=" . $this->psl['phpself'] . "?submit=display" . $this->psl['amp'] . "option=all>[Add or Remove Block Types]</A>"; - } - } - } /* End class Block_i */ --- 161,164 ---- |