[phpwebapp-commits] CVS: web_app/boxes/fileView viewUnknown.php,1.4,1.5 viewPHP.php,1.3,1.4 viewImag
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2004-07-22 16:25:52
|
Update of /cvsroot/phpwebapp/web_app/boxes/fileView In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9224/boxes/fileView Modified Files: viewUnknown.php viewPHP.php viewImage.php fileView.php Log Message: reformated and modified the copyleft notice Index: viewUnknown.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/boxes/fileView/viewUnknown.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** viewUnknown.php 25 Aug 2003 13:18:33 -0000 1.4 --- viewUnknown.php 22 Jul 2004 16:25:39 -0000 1.5 *************** *** 1,4 **** <?php ! /* This file is part of phpWebApp. */ /** --- 1,23 ---- <?php ! /* ! This file is part of phpWebApp, which is a framework for building web ! application based on relational databases. ! ! Copyright 2001,2002,2003,2004 Dashamir Hoxha, das...@us... ! ! phpWebApp is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2 of the License, or (at your ! option) any later version. ! ! phpWebApp is distributed in the hope that it will be useful, but ! WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with phpWebApp; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /** *************** *** 9,18 **** { function onRender() ! { ! $file_path = WebApp::getSVar("fileView->file"); ! $url_path = WebApp::to_url($file_path); ! WebApp::addVar("url", $url_path); ! WebApp::addVar("fileName", basename($file_path)); ! } } ?> \ No newline at end of file --- 28,37 ---- { function onRender() ! { ! $file_path = WebApp::getSVar("fileView->file"); ! $url_path = WebApp::to_url($file_path); ! WebApp::addVar("url", $url_path); ! WebApp::addVar("fileName", basename($file_path)); ! } } ?> \ No newline at end of file Index: viewPHP.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/boxes/fileView/viewPHP.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** viewPHP.php 25 Aug 2003 13:18:33 -0000 1.3 --- viewPHP.php 22 Jul 2004 16:25:39 -0000 1.4 *************** *** 1,4 **** <?php ! /* This file is part of phpWebApp. */ /** --- 1,23 ---- <?php ! /* ! This file is part of phpWebApp, which is a framework for building web ! application based on relational databases. ! ! Copyright 2001,2002,2003,2004 Dashamir Hoxha, das...@us... ! ! phpWebApp is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2 of the License, or (at your ! option) any later version. ! ! phpWebApp is distributed in the hope that it will be useful, but ! WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with phpWebApp; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /** *************** *** 9,16 **** { function onRender() ! { ! $file_name = WebApp::getSVar("fileView->file"); ! show_source($file_name); ! } } ?> --- 28,35 ---- { function onRender() ! { ! $file_name = WebApp::getSVar("fileView->file"); ! show_source($file_name); ! } } ?> Index: viewImage.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/boxes/fileView/viewImage.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** viewImage.php 25 Aug 2003 13:18:33 -0000 1.4 --- viewImage.php 22 Jul 2004 16:25:39 -0000 1.5 *************** *** 1,4 **** <?php ! /* This file is part of phpWebApp. */ /** --- 1,23 ---- <?php ! /* ! This file is part of phpWebApp, which is a framework for building web ! application based on relational databases. ! ! Copyright 2001,2002,2003,2004 Dashamir Hoxha, das...@us... ! ! phpWebApp is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2 of the License, or (at your ! option) any later version. ! ! phpWebApp is distributed in the hope that it will be useful, but ! WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with phpWebApp; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /** *************** *** 9,17 **** { function onRender() ! { ! $file_path = WebApp::getSVar("fileView->file"); ! $img_url = WebApp::to_url($file_path); ! WebApp::addVar("image_src", $img_url); ! } } ?> --- 28,36 ---- { function onRender() ! { ! $file_path = WebApp::getSVar("fileView->file"); ! $img_url = WebApp::to_url($file_path); ! WebApp::addVar("image_src", $img_url); ! } } ?> Index: fileView.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/boxes/fileView/fileView.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fileView.php 25 Aug 2003 13:18:33 -0000 1.5 --- fileView.php 22 Jul 2004 16:25:39 -0000 1.6 *************** *** 1,21 **** <?php /* ! Copyright 2001,2002,2003 Dashamir Hoxha, das...@us... ! This file is part of phpWebApp. ! phpWebApp is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! phpWebApp is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with phpWebApp; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ --- 1,22 ---- <?php /* ! This file is part of phpWebApp, which is a framework for building web ! application based on relational databases. ! Copyright 2001,2002,2003,2004 Dashamir Hoxha, das...@us... ! phpWebApp is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2 of the License, or (at your ! option) any later version. ! phpWebApp is distributed in the hope that it will be useful, but ! WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with phpWebApp; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ *************** *** 28,134 **** { function init() ! { ! $curr_path = dirname(__FILE__); ! $this->addSVar("file", $curr_path."/sample_file.html"); ! } function onParse() ! { ! $file_name = $this->getSVar("file"); ! $file_type = $this->get_file_type($file_name); ! $template = $this->get_template($file_type); ! //set the template that will be used to display the file ! WebApp::addVar("template", $template); ! } /** Returns the type of the given file. */ function get_file_type($file_name) ! { ! ereg("(\.[^.]*)$", $file_name, $regs); ! $ext = $regs[1]; ! switch ($ext) ! { ! case ".html": ! case ".htm": ! $file_type = "HTML"; ! break; ! case ".gif": ! case ".jpg": ! case ".png": ! $file_type = "IMG"; ! break; ! case ".txt": ! $file_type = "TXT"; ! break; ! case ".php": ! case ".php3": ! case ".php4": ! $file_type = "PHP"; ! break; ! case ".js": ! $file_type = "JS"; ! break; ! case ".css": ! $file_type = "CSS"; ! break; ! default: ! $file_type = "UNKNOWN"; ! break; ! } ! return $file_type; ! } /** Returns the template that will be used to display * a file of the given type */ function get_template($file_type) ! { ! global $session; ! $path = WebApp::getVar("./"); ! switch ($file_type) ! { ! case "PHP": ! //PHP is always displayed as code ! $template = $path."viewPHP.html"; ! break; ! case "IMG": ! //Images are always displayed in preview mode ! $template = $path."viewImage.html"; ! break; ! case "JS": ! case "CSS": ! case "TXT": ! //Text is always displayed in code view mode ! $file_name = $this->getSVar("file"); ! WebApp::setSVar("codeViewer->codeFile", $file_name); ! $template = CODEVIEWER_PATH."codeViewer.html"; ! break; ! case "HTML": ! //Html is displayed either in code view ! //or in preview mode, depending on 'codeView' variable ! $codeView = WebApp::getSVar("panel->codeView"); ! if ($codeView=="true") ! { ! $file_name = $this->getSVar("file"); ! WebApp::setSVar("codeViewer->codeFile", $file_name); ! $template = CODEVIEWER_PATH."codeViewer.html"; ! } ! else ! { ! $template = $path."viewHtml.html"; ! } ! break; ! default: ! case "UNKNOWN": ! $template = $path."viewUnknown.html"; ! break; ! } ! return $template; ! } } ?> --- 29,135 ---- { function init() ! { ! $curr_path = dirname(__FILE__); ! $this->addSVar("file", $curr_path."/sample_file.html"); ! } function onParse() ! { ! $file_name = $this->getSVar("file"); ! $file_type = $this->get_file_type($file_name); ! $template = $this->get_template($file_type); ! //set the template that will be used to display the file ! WebApp::addVar("template", $template); ! } /** Returns the type of the given file. */ function get_file_type($file_name) ! { ! ereg("(\.[^.]*)$", $file_name, $regs); ! $ext = $regs[1]; ! switch ($ext) ! { ! case ".html": ! case ".htm": ! $file_type = "HTML"; ! break; ! case ".gif": ! case ".jpg": ! case ".png": ! $file_type = "IMG"; ! break; ! case ".txt": ! $file_type = "TXT"; ! break; ! case ".php": ! case ".php3": ! case ".php4": ! $file_type = "PHP"; ! break; ! case ".js": ! $file_type = "JS"; ! break; ! case ".css": ! $file_type = "CSS"; ! break; ! default: ! $file_type = "UNKNOWN"; ! break; ! } ! return $file_type; ! } /** Returns the template that will be used to display * a file of the given type */ function get_template($file_type) ! { ! global $session; ! $path = WebApp::getVar("./"); ! switch ($file_type) ! { ! case "PHP": ! //PHP is always displayed as code ! $template = $path."viewPHP.html"; ! break; ! case "IMG": ! //Images are always displayed in preview mode ! $template = $path."viewImage.html"; ! break; ! case "JS": ! case "CSS": ! case "TXT": ! //Text is always displayed in code view mode ! $file_name = $this->getSVar("file"); ! WebApp::setSVar("codeViewer->codeFile", $file_name); ! $template = CODEVIEWER_PATH."codeViewer.html"; ! break; ! case "HTML": ! //Html is displayed either in code view ! //or in preview mode, depending on 'codeView' variable ! $codeView = WebApp::getSVar("panel->codeView"); ! if ($codeView=="true") ! { ! $file_name = $this->getSVar("file"); ! WebApp::setSVar("codeViewer->codeFile", $file_name); ! $template = CODEVIEWER_PATH."codeViewer.html"; ! } ! else ! { ! $template = $path."viewHtml.html"; ! } ! break; ! default: ! case "UNKNOWN": ! $template = $path."viewUnknown.html"; ! break; ! } ! return $template; ! } } ?> |