Merge lp:~ajavier-lopez/moondragon/bugs-2.0 into lp:moondragon/rising

Proposed by Andrés Javier López
Status: Merged
Approved by: Andrés Javier López
Approved revision: not available
Merge reported by: Andrés Javier López
Merged at revision: not available
Proposed branch: lp:~ajavier-lopez/moondragon/bugs-2.0
Merge into: lp:moondragon/rising
Diff against target: 361 lines (+93/-63)
11 files modified
include/conf/libraries.inc (+1/-1)
include/conf/paths.inc (+4/-4)
include/conf/registry.inc (+2/-0)
include/lib/core/class.controller.php (+32/-20)
include/lib/core/class.corecontroller.php (+0/-34)
include/lib/core/class.htmlview.php (+19/-1)
include/lib/core/class.template.php (+2/-1)
include/lib/core/class.view.php (+10/-1)
include/lib/core/functions.core.php (+11/-0)
index.php (+1/-1)
templates/pages/message.tpl (+11/-0)
To merge this branch: bzr merge lp:~ajavier-lopez/moondragon/bugs-2.0
Reviewer Review Type Date Requested Status
Andrés Javier López Approve
Review via email: mp+18174@code.launchpad.net

Commit message

solucionando bugs de la version

To post a comment you must log in.
Revision history for this message
Andrés Javier López (ajavier-lopez) wrote :

importar los arreglos de bugs a la rama principal

Revision history for this message
Andrés Javier López (ajavier-lopez) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'app'
=== renamed directory 'include/controllers' => 'app/controllers'
=== renamed directory 'include/models' => 'app/models'
=== renamed directory 'tasks' => 'app/tasks'
=== renamed directory 'include/views' => 'app/views'
=== modified file 'include/conf/libraries.inc'
--- include/conf/libraries.inc 2009-07-30 00:18:12 +0000
+++ include/conf/libraries.inc 2010-01-28 01:21:15 +0000
@@ -29,6 +29,6 @@
29 29
30//Se importan las librerías30//Se importan las librerías
3131
32# Libs::import( 'TestLib' );32Libs::import( 'Mailer' );
33 33
34?>34?>
3535
=== modified file 'include/conf/paths.inc'
--- include/conf/paths.inc 2009-11-06 01:05:59 +0000
+++ include/conf/paths.inc 2010-01-28 01:21:15 +0000
@@ -31,13 +31,13 @@
3131
32define( 'CONF', 'include/conf' );32define( 'CONF', 'include/conf' );
33define( 'LIB', 'include/lib' );33define( 'LIB', 'include/lib' );
34define( 'CONTROLLERS', 'include/controllers' );34define( 'CONTROLLERS', 'app/controllers' );
35define( 'MODELS', 'include/models' );35define( 'MODELS', 'app/models' );
36define( 'VIEW', 'include/views' );36define( 'VIEWS', 'app/views' );
37define( 'JS', 'js' );37define( 'JS', 'js' );
38define( 'STYLES', 'styles' );38define( 'STYLES', 'styles' );
39define( 'LOGS', 'logs' );39define( 'LOGS', 'logs' );
40define( 'TASKS', 'tasks' );40define( 'TASKS', 'app/tasks' );
41define( 'TPL', 'templates');41define( 'TPL', 'templates');
42define( 'PAGES', 'templates/pages');42define( 'PAGES', 'templates/pages');
43 43
4444
=== modified file 'include/conf/registry.inc'
--- include/conf/registry.inc 2009-11-05 22:53:17 +0000
+++ include/conf/registry.inc 2010-01-28 01:21:15 +0000
@@ -35,6 +35,8 @@
35Registry::setConst( 'DEFAULT_VIEW', 'Core' );35Registry::setConst( 'DEFAULT_VIEW', 'Core' );
36Registry::setConst( 'DEFAULT_CONTROLLER', 'Core' );36Registry::setConst( 'DEFAULT_CONTROLLER', 'Core' );
37Registry::setConst( 'DEFAULT_PAGE', 'standard' );37Registry::setConst( 'DEFAULT_PAGE', 'standard' );
38Registry::setConst( 'MESSAGE_PAGE', 'message' );
39
3840
39// Controla el comportamiento del sistema en caso de que se pierda la conexión con la base de datos41// Controla el comportamiento del sistema en caso de que se pierda la conexión con la base de datos
40// Si esta opción esta seleccionada como verdadera se muestra una página de error42// Si esta opción esta seleccionada como verdadera se muestra una página de error
4143
=== modified file 'include/lib/core/class.controller.php'
--- include/lib/core/class.controller.php 2009-11-21 21:26:52 +0000
+++ include/lib/core/class.controller.php 2010-01-28 01:21:15 +0000
@@ -149,8 +149,16 @@
149 149
150 if( !( class_exists( $model ) && is_subclass_of( $model, 'Model' ) ) )150 if( !( class_exists( $model ) && is_subclass_of( $model, 'Model' ) ) )
151 {151 {
152 trigger_error( 'No existe el modelo '.$model , E_USER_NOTICE );152 if( file_exists( MODELS.'/class.'.strtolower($model).'.php' ) )
153 $model = Registry::get( 'DEFAULT_MODEL' ).'Model';153 {
154 include_once MODELS.'/class.'.strtolower($model).'.php';
155 }
156
157 if( !( class_exists( $model ) && is_subclass_of( $model, 'Model' ) ) )
158 {
159 trigger_error( 'No existe el modelo '.$model , E_USER_NOTICE );
160 $model = Registry::get( 'DEFAULT_MODEL' ).'Model';
161 }
154 }162 }
155 163
156 if( !($this->model instanceof $model) )164 if( !($this->model instanceof $model) )
@@ -176,7 +184,16 @@
176 184
177 if( !( class_exists( $view ) && is_subclass_of( $view, 'View' ) ) )185 if( !( class_exists( $view ) && is_subclass_of( $view, 'View' ) ) )
178 {186 {
179 $view = Registry::get( 'DEFAULT_VIEW' ).'View';187 if( file_exists( VIEWS.'/class.'.strtolower($view).'.php' ) )
188 {
189 include_once VIEWS.'/class.'.strtolower($view).'.php';
190 }
191
192 if( !( class_exists( $view ) && is_subclass_of( $view, 'View' ) ) )
193 {
194 trigger_error( 'No existe la vista '.$view , E_USER_NOTICE );
195 $view = Registry::get( 'DEFAULT_VIEW' ).'View';
196 }
180 }197 }
181 198
182 if( !($this->view instanceof $view) )199 if( !($this->view instanceof $view) )
@@ -213,6 +230,10 @@
213 $task = 'unexistent';230 $task = 'unexistent';
214 }231 }
215 232
233 $mdview = $this->getView();
234 $_buffer = Buffer::getInstance();
235 $_buffer->start( 'salida' );
236
216 if( $task == '' )237 if( $task == '' )
217 {238 {
218 $default_task = $this->default_task;239 $default_task = $this->default_task;
@@ -222,6 +243,8 @@
222 {243 {
223 $this->$task();244 $this->$task();
224 }245 }
246
247 $_buffer->end();
225 }248 }
226249
227 //**********************************************************************************250 //**********************************************************************************
@@ -234,13 +257,6 @@
234 * @return void257 * @return void
235 */258 */
236 abstract protected function display();259 abstract protected function display();
237
238 /**
239 * Procesamiento de errores por defecto
240 * @abstract
241 * @return void
242 */
243 abstract protected function error();
244 260
245 /**261 /**
246 * Procesamiento de secciones no autorizadas262 * Procesamiento de secciones no autorizadas
@@ -248,10 +264,8 @@
248 */264 */
249 protected function unauthorized()265 protected function unauthorized()
250 {266 {
251 // Agrega variable global con mensaje de sección no autorizada267 $view = $this->getView();
252 Vars::set( 'Error_Message', 'No esta autorizado a ver esta sección' ); // @todo localizar contenido268 $view->message( 'No esta autorizado a ver esta sección' ); // @todo localizar contenido
253
254 $this->error();
255 }269 }
256 270
257 /**271 /**
@@ -260,10 +274,8 @@
260 */274 */
261 protected function unexistent()275 protected function unexistent()
262 {276 {
263 // Agrega variable global con mensaje de sección inexistente277 $view = $this->getView();
264 Vars::set( 'Error_Message', 'La sección seleccionada no existe' ); // @todo localizar contenido278 $view->message( 'La sección seleccionada no existe' ); // @todo localizar contenido
265
266 $this->error();
267 }279 }
268 280
269 /**281 /**
@@ -272,8 +284,8 @@
272 */284 */
273 protected function offline()285 protected function offline()
274 {286 {
275 Vars::set( 'Error_Message', 'Imposible conectarse con la base de datos' ); // @todo localizar contenido 287 $view = $this->getView();
276 $this->error();288 $view->message( 'Imposible conectarse con la base de datos' ); // @todo localizar contenido
277 }289 }
278290
279 /**291 /**
280292
=== modified file 'include/lib/core/class.corecontroller.php'
--- include/lib/core/class.corecontroller.php 2009-11-20 20:26:24 +0000
+++ include/lib/core/class.corecontroller.php 2010-01-28 01:21:15 +0000
@@ -46,12 +46,7 @@
46 46
47 if( file_exists( TASKS.'/'.$name.'.php' ) )47 if( file_exists( TASKS.'/'.$name.'.php' ) )
48 {48 {
49 $mdview = $this->getView();
50 $_buffer = Buffer::getInstance();
51
52 $_buffer->start( 'salida' );
53 include TASKS.'/'.$name.'.php';49 include TASKS.'/'.$name.'.php';
54 $_buffer->end();
55 }50 }
56 else51 else
57 {52 {
@@ -71,39 +66,10 @@
71 protected function display()66 protected function display()
72 {67 {
73 $_section = Registry::get( 'section' );68 $_section = Registry::get( 'section' );
74
75 $mdview = $this->getView();
76 $_buffer = Buffer::getInstance();
77 $_buffer->start( 'salida' );
78
79 if( file_exists( TASKS.'/'.$_section.'.php' ) )69 if( file_exists( TASKS.'/'.$_section.'.php' ) )
80 {70 {
81 include TASKS.'/'.$_section.'.php';71 include TASKS.'/'.$_section.'.php';
82 }72 }
83
84 $_buffer->end();
85 }
86
87 /**
88 * (non-PHPdoc)
89 * @see include/lib/core/Controller#error()
90 */
91 protected function error()
92 {
93 $view = $this->getView();
94 if( $view instanceof HTMLView )
95 {
96 $view->setPage( 'error' );
97 }
98 else
99 {
100 trigger_error( 'La vista utilizada no es heredada de HTMLView', E_USER_NOTICE );
101 }
102
103 $buffer = Buffer::getInstance();
104
105 $view->addVar( 'system_warning', $buffer->getContent( 'e_warning', false ) );
106 $view->addVar( 'system_notice', $buffer->getContent( 'e_notice', false ) );
107 }73 }
108}74}
109 75
11076
=== modified file 'include/lib/core/class.htmlview.php'
--- include/lib/core/class.htmlview.php 2009-11-04 16:37:44 +0000
+++ include/lib/core/class.htmlview.php 2010-01-28 01:21:15 +0000
@@ -86,6 +86,14 @@
86 public function show()86 public function show()
87 {87 {
88 $this->display();88 $this->display();
89 $buffer = Buffer::getInstance();
90
91 $message = $buffer->getContent( 'message' );
92
93 if( $message != '' )
94 {
95 $this->addVar( 'message', $message );
96 }
89 97
90 $page = new Page( $this->page );98 $page = new Page( $this->page );
91 $page->setVars( $this->getVars() );99 $page->setVars( $this->getVars() );
@@ -97,7 +105,6 @@
97 $page->addTemplate( $name, $tpl );105 $page->addTemplate( $name, $tpl );
98 }106 }
99 107
100 $buffer = Buffer::getInstance();
101 $content = $buffer->getContent( 'salida' );108 $content = $buffer->getContent( 'salida' );
102 109
103 if( ErrorHandler::$has_errors )110 if( ErrorHandler::$has_errors )
@@ -116,6 +123,17 @@
116 123
117 return $page->show();124 return $page->show();
118 }125 }
126
127 /**
128 * (non-PHPdoc)
129 * @see include/lib/core/View#message()
130 */
131 public function message( $string )
132 {
133 $this->setPage( Registry::get( 'MESSAGE_PAGE' ));
134 $buffer = Buffer::getInstance();
135 $buffer->write( 'message', $string, true );
136 }
119 137
120 /**138 /**
121 * Agrega una plantilla a la vista139 * Agrega una plantilla a la vista
122140
=== modified file 'include/lib/core/class.template.php'
--- include/lib/core/class.template.php 2009-11-20 20:39:27 +0000
+++ include/lib/core/class.template.php 2010-01-28 01:21:15 +0000
@@ -250,7 +250,8 @@
250 public static function load( $template, $vars = array() )250 public static function load( $template, $vars = array() )
251 {251 {
252 $tpl = new self( $template );252 $tpl = new self( $template );
253 $tpl->setVars( $vars );253 $vars_array = array_merge( Vars::getVars(), $vars );
254 $tpl->setVars( $vars_array );
254 return $tpl->show();255 return $tpl->show();
255 }256 }
256}257}
257258
=== modified file 'include/lib/core/class.view.php'
--- include/lib/core/class.view.php 2009-11-20 20:26:24 +0000
+++ include/lib/core/class.view.php 2010-01-28 01:21:15 +0000
@@ -87,7 +87,9 @@
87 */ 87 */
88 public function getVars()88 public function getVars()
89 {89 {
90 $vars = array_merge( Vars::getVars(), $this->vars );90 // Esta mezcla es redundante con la que sucede en Template
91 // pero se deja así en caso de que la vista no este basada en plantillas
92 $vars = array_merge( Vars::getVars(), $this->vars );
91 return $vars;93 return $vars;
92 }94 }
93 95
@@ -102,6 +104,13 @@
102 */104 */
103 abstract public function show();105 abstract public function show();
104 106
107 /**
108 * Publica un mensaje
109 * @param string $string
110 * @return void
111 */
112 abstract public function message( $string );
113
105 //**********************************************************************************114 //**********************************************************************************
106 // Métodos privados 115 // Métodos privados
107 //**********************************************************************************116 //**********************************************************************************
108117
=== modified file 'include/lib/core/functions.core.php'
--- include/lib/core/functions.core.php 2009-11-20 20:39:27 +0000
+++ include/lib/core/functions.core.php 2010-01-28 01:21:15 +0000
@@ -85,6 +85,17 @@
85}85}
8686
87/**87/**
88 * Guarda un mensaje para el usuario
89 * @param string $string
90 * @return void
91 */
92function md_message( $string )
93{
94 $buffer = Buffer::getInstance();
95 $buffer->write( 'message', $string."\n" );
96}
97
98/**
88 * Redirecciona la página a otra ubicación99 * Redirecciona la página a otra ubicación
89 * @param string $location100 * @param string $location
90 * @return void101 * @return void
91102
=== modified file 'index.php'
--- index.php 2009-11-06 01:35:39 +0000
+++ index.php 2010-01-28 01:21:15 +0000
@@ -91,7 +91,7 @@
9191
92if( !($view instanceof View) )92if( !($view instanceof View) )
93{93{
94 $view_name = Registry::get('DEFAULT_VIEW');94 $view_name = Registry::get('DEFAULT_VIEW').'View';
95 $view = new $view_name();95 $view = new $view_name();
96}96}
9797
9898
=== added file 'templates/pages/message.tpl'
--- templates/pages/message.tpl 1970-01-01 00:00:00 +0000
+++ templates/pages/message.tpl 2010-01-28 01:21:15 +0000
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6<title>[#:section_name] - [#:title]</title>
7</head>
8<body>
9<p>[#:message]</p>
10</body>
11</html>
012
=== added directory 'templates/tools'

Subscribers

People subscribed via source and target branches

to all changes: