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
1=== added directory 'app'
2=== renamed directory 'include/controllers' => 'app/controllers'
3=== renamed directory 'include/models' => 'app/models'
4=== renamed directory 'tasks' => 'app/tasks'
5=== renamed directory 'include/views' => 'app/views'
6=== modified file 'include/conf/libraries.inc'
7--- include/conf/libraries.inc 2009-07-30 00:18:12 +0000
8+++ include/conf/libraries.inc 2010-01-28 01:21:15 +0000
9@@ -29,6 +29,6 @@
10
11 //Se importan las librerías
12
13-# Libs::import( 'TestLib' );
14+Libs::import( 'Mailer' );
15
16 ?>
17
18=== modified file 'include/conf/paths.inc'
19--- include/conf/paths.inc 2009-11-06 01:05:59 +0000
20+++ include/conf/paths.inc 2010-01-28 01:21:15 +0000
21@@ -31,13 +31,13 @@
22
23 define( 'CONF', 'include/conf' );
24 define( 'LIB', 'include/lib' );
25-define( 'CONTROLLERS', 'include/controllers' );
26-define( 'MODELS', 'include/models' );
27-define( 'VIEW', 'include/views' );
28+define( 'CONTROLLERS', 'app/controllers' );
29+define( 'MODELS', 'app/models' );
30+define( 'VIEWS', 'app/views' );
31 define( 'JS', 'js' );
32 define( 'STYLES', 'styles' );
33 define( 'LOGS', 'logs' );
34-define( 'TASKS', 'tasks' );
35+define( 'TASKS', 'app/tasks' );
36 define( 'TPL', 'templates');
37 define( 'PAGES', 'templates/pages');
38
39
40=== modified file 'include/conf/registry.inc'
41--- include/conf/registry.inc 2009-11-05 22:53:17 +0000
42+++ include/conf/registry.inc 2010-01-28 01:21:15 +0000
43@@ -35,6 +35,8 @@
44 Registry::setConst( 'DEFAULT_VIEW', 'Core' );
45 Registry::setConst( 'DEFAULT_CONTROLLER', 'Core' );
46 Registry::setConst( 'DEFAULT_PAGE', 'standard' );
47+Registry::setConst( 'MESSAGE_PAGE', 'message' );
48+
49
50 // Controla el comportamiento del sistema en caso de que se pierda la conexión con la base de datos
51 // Si esta opción esta seleccionada como verdadera se muestra una página de error
52
53=== modified file 'include/lib/core/class.controller.php'
54--- include/lib/core/class.controller.php 2009-11-21 21:26:52 +0000
55+++ include/lib/core/class.controller.php 2010-01-28 01:21:15 +0000
56@@ -149,8 +149,16 @@
57
58 if( !( class_exists( $model ) && is_subclass_of( $model, 'Model' ) ) )
59 {
60- trigger_error( 'No existe el modelo '.$model , E_USER_NOTICE );
61- $model = Registry::get( 'DEFAULT_MODEL' ).'Model';
62+ if( file_exists( MODELS.'/class.'.strtolower($model).'.php' ) )
63+ {
64+ include_once MODELS.'/class.'.strtolower($model).'.php';
65+ }
66+
67+ if( !( class_exists( $model ) && is_subclass_of( $model, 'Model' ) ) )
68+ {
69+ trigger_error( 'No existe el modelo '.$model , E_USER_NOTICE );
70+ $model = Registry::get( 'DEFAULT_MODEL' ).'Model';
71+ }
72 }
73
74 if( !($this->model instanceof $model) )
75@@ -176,7 +184,16 @@
76
77 if( !( class_exists( $view ) && is_subclass_of( $view, 'View' ) ) )
78 {
79- $view = Registry::get( 'DEFAULT_VIEW' ).'View';
80+ if( file_exists( VIEWS.'/class.'.strtolower($view).'.php' ) )
81+ {
82+ include_once VIEWS.'/class.'.strtolower($view).'.php';
83+ }
84+
85+ if( !( class_exists( $view ) && is_subclass_of( $view, 'View' ) ) )
86+ {
87+ trigger_error( 'No existe la vista '.$view , E_USER_NOTICE );
88+ $view = Registry::get( 'DEFAULT_VIEW' ).'View';
89+ }
90 }
91
92 if( !($this->view instanceof $view) )
93@@ -213,6 +230,10 @@
94 $task = 'unexistent';
95 }
96
97+ $mdview = $this->getView();
98+ $_buffer = Buffer::getInstance();
99+ $_buffer->start( 'salida' );
100+
101 if( $task == '' )
102 {
103 $default_task = $this->default_task;
104@@ -222,6 +243,8 @@
105 {
106 $this->$task();
107 }
108+
109+ $_buffer->end();
110 }
111
112 //**********************************************************************************
113@@ -234,13 +257,6 @@
114 * @return void
115 */
116 abstract protected function display();
117-
118- /**
119- * Procesamiento de errores por defecto
120- * @abstract
121- * @return void
122- */
123- abstract protected function error();
124
125 /**
126 * Procesamiento de secciones no autorizadas
127@@ -248,10 +264,8 @@
128 */
129 protected function unauthorized()
130 {
131- // Agrega variable global con mensaje de sección no autorizada
132- Vars::set( 'Error_Message', 'No esta autorizado a ver esta sección' ); // @todo localizar contenido
133-
134- $this->error();
135+ $view = $this->getView();
136+ $view->message( 'No esta autorizado a ver esta sección' ); // @todo localizar contenido
137 }
138
139 /**
140@@ -260,10 +274,8 @@
141 */
142 protected function unexistent()
143 {
144- // Agrega variable global con mensaje de sección inexistente
145- Vars::set( 'Error_Message', 'La sección seleccionada no existe' ); // @todo localizar contenido
146-
147- $this->error();
148+ $view = $this->getView();
149+ $view->message( 'La sección seleccionada no existe' ); // @todo localizar contenido
150 }
151
152 /**
153@@ -272,8 +284,8 @@
154 */
155 protected function offline()
156 {
157- Vars::set( 'Error_Message', 'Imposible conectarse con la base de datos' ); // @todo localizar contenido
158- $this->error();
159+ $view = $this->getView();
160+ $view->message( 'Imposible conectarse con la base de datos' ); // @todo localizar contenido
161 }
162
163 /**
164
165=== modified file 'include/lib/core/class.corecontroller.php'
166--- include/lib/core/class.corecontroller.php 2009-11-20 20:26:24 +0000
167+++ include/lib/core/class.corecontroller.php 2010-01-28 01:21:15 +0000
168@@ -46,12 +46,7 @@
169
170 if( file_exists( TASKS.'/'.$name.'.php' ) )
171 {
172- $mdview = $this->getView();
173- $_buffer = Buffer::getInstance();
174-
175- $_buffer->start( 'salida' );
176 include TASKS.'/'.$name.'.php';
177- $_buffer->end();
178 }
179 else
180 {
181@@ -71,39 +66,10 @@
182 protected function display()
183 {
184 $_section = Registry::get( 'section' );
185-
186- $mdview = $this->getView();
187- $_buffer = Buffer::getInstance();
188- $_buffer->start( 'salida' );
189-
190 if( file_exists( TASKS.'/'.$_section.'.php' ) )
191 {
192 include TASKS.'/'.$_section.'.php';
193 }
194-
195- $_buffer->end();
196- }
197-
198- /**
199- * (non-PHPdoc)
200- * @see include/lib/core/Controller#error()
201- */
202- protected function error()
203- {
204- $view = $this->getView();
205- if( $view instanceof HTMLView )
206- {
207- $view->setPage( 'error' );
208- }
209- else
210- {
211- trigger_error( 'La vista utilizada no es heredada de HTMLView', E_USER_NOTICE );
212- }
213-
214- $buffer = Buffer::getInstance();
215-
216- $view->addVar( 'system_warning', $buffer->getContent( 'e_warning', false ) );
217- $view->addVar( 'system_notice', $buffer->getContent( 'e_notice', false ) );
218 }
219 }
220
221
222=== modified file 'include/lib/core/class.htmlview.php'
223--- include/lib/core/class.htmlview.php 2009-11-04 16:37:44 +0000
224+++ include/lib/core/class.htmlview.php 2010-01-28 01:21:15 +0000
225@@ -86,6 +86,14 @@
226 public function show()
227 {
228 $this->display();
229+ $buffer = Buffer::getInstance();
230+
231+ $message = $buffer->getContent( 'message' );
232+
233+ if( $message != '' )
234+ {
235+ $this->addVar( 'message', $message );
236+ }
237
238 $page = new Page( $this->page );
239 $page->setVars( $this->getVars() );
240@@ -97,7 +105,6 @@
241 $page->addTemplate( $name, $tpl );
242 }
243
244- $buffer = Buffer::getInstance();
245 $content = $buffer->getContent( 'salida' );
246
247 if( ErrorHandler::$has_errors )
248@@ -116,6 +123,17 @@
249
250 return $page->show();
251 }
252+
253+ /**
254+ * (non-PHPdoc)
255+ * @see include/lib/core/View#message()
256+ */
257+ public function message( $string )
258+ {
259+ $this->setPage( Registry::get( 'MESSAGE_PAGE' ));
260+ $buffer = Buffer::getInstance();
261+ $buffer->write( 'message', $string, true );
262+ }
263
264 /**
265 * Agrega una plantilla a la vista
266
267=== modified file 'include/lib/core/class.template.php'
268--- include/lib/core/class.template.php 2009-11-20 20:39:27 +0000
269+++ include/lib/core/class.template.php 2010-01-28 01:21:15 +0000
270@@ -250,7 +250,8 @@
271 public static function load( $template, $vars = array() )
272 {
273 $tpl = new self( $template );
274- $tpl->setVars( $vars );
275+ $vars_array = array_merge( Vars::getVars(), $vars );
276+ $tpl->setVars( $vars_array );
277 return $tpl->show();
278 }
279 }
280
281=== modified file 'include/lib/core/class.view.php'
282--- include/lib/core/class.view.php 2009-11-20 20:26:24 +0000
283+++ include/lib/core/class.view.php 2010-01-28 01:21:15 +0000
284@@ -87,7 +87,9 @@
285 */
286 public function getVars()
287 {
288- $vars = array_merge( Vars::getVars(), $this->vars );
289+ // Esta mezcla es redundante con la que sucede en Template
290+ // pero se deja así en caso de que la vista no este basada en plantillas
291+ $vars = array_merge( Vars::getVars(), $this->vars );
292 return $vars;
293 }
294
295@@ -102,6 +104,13 @@
296 */
297 abstract public function show();
298
299+ /**
300+ * Publica un mensaje
301+ * @param string $string
302+ * @return void
303+ */
304+ abstract public function message( $string );
305+
306 //**********************************************************************************
307 // Métodos privados
308 //**********************************************************************************
309
310=== modified file 'include/lib/core/functions.core.php'
311--- include/lib/core/functions.core.php 2009-11-20 20:39:27 +0000
312+++ include/lib/core/functions.core.php 2010-01-28 01:21:15 +0000
313@@ -85,6 +85,17 @@
314 }
315
316 /**
317+ * Guarda un mensaje para el usuario
318+ * @param string $string
319+ * @return void
320+ */
321+function md_message( $string )
322+{
323+ $buffer = Buffer::getInstance();
324+ $buffer->write( 'message', $string."\n" );
325+}
326+
327+/**
328 * Redirecciona la página a otra ubicación
329 * @param string $location
330 * @return void
331
332=== modified file 'index.php'
333--- index.php 2009-11-06 01:35:39 +0000
334+++ index.php 2010-01-28 01:21:15 +0000
335@@ -91,7 +91,7 @@
336
337 if( !($view instanceof View) )
338 {
339- $view_name = Registry::get('DEFAULT_VIEW');
340+ $view_name = Registry::get('DEFAULT_VIEW').'View';
341 $view = new $view_name();
342 }
343
344
345=== added file 'templates/pages/message.tpl'
346--- templates/pages/message.tpl 1970-01-01 00:00:00 +0000
347+++ templates/pages/message.tpl 2010-01-28 01:21:15 +0000
348@@ -0,0 +1,11 @@
349+<?xml version="1.0" encoding="UTF-8" ?>
350+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
351+<html xmlns="http://www.w3.org/1999/xhtml">
352+<head>
353+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
354+<title>[#:section_name] - [#:title]</title>
355+</head>
356+<body>
357+<p>[#:message]</p>
358+</body>
359+</html>
360
361=== added directory 'templates/tools'

Subscribers

People subscribed via source and target branches

to all changes: