Giter Site home page Giter Site logo

p4a's Introduction

p4a's People

Contributors

agiardina avatar eddiejr avatar fballiano avatar prashantpawar avatar zukunft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

p4a's Issues

add a "copy record" button

Add a copy "copy record" button to the toolbar that:

  1. copies the actual record to an array
  2. create new record
  3. fills the mask with the pervious copy array and wait for the user to adjust / confirm the new record

This way users can save much time, when they have to enter several simular records

Composer PHP as autoloader, feature request

Would be interesting having Composer PHP as installer and 3rd parties libraries management? Using it, you could manage lazy autoloading of classes during development.

The point would be lifting the developer from instancing of object and concentrate him only on objects configuration and business logic.

I feel P4A extremely RAD and fast also not being well MVC but I felt losing time taking care of object creation. (Also IDE integration isn't well coupled, i mean PHPStorm 7.1)

javascript in custom Widgets and Ajax mode

Regarding https://sourceforge.net/projects/p4a/forums/forum/340765/topic/5905682

This could do with being fixed for three reasons:

1 - The custom widget may have it's own P4A ID attribute but if we can't reference that in javascript attached to the application's mask. If there's two widgets, they need different IDs and we can easily handle that if the javascript was in the getAsString() of the custom widget
2 - We can set up variables and constants as part of the widget object but we can't get at those from javascript written as part of the parent mask.
3 - To include the custom widget in your application, you need more configuration to set it up, you can't just drop the widget into your application directory, reference it in a build() function and then expect it to work straight away. You have to copy the widget and then insert the javascript manually. It's sort of OK if you wrote the widget yourself, know how it works and what's needed. It's not OK if you want to release the widget for others to download and use - there's lots of special instructions needed and maybe more support questions...

I'm happy to help debug this issue.

use field type select if a field has an foreign key

If a field is a reference to another table, the default parameters for this field should be a selection. This way for example these lines would not be needed any more in the mask code

    $this->fields->subtable_id
        ->setLabel("Please select")
        ->setType("select")
        ->setSource(P4A::singleton()->subtable)
        ->setSourceDescriptionField("description");

For the default description field probably the best is to use the first non key field in the subtable. Additional the default setting should be to include a NULL key with the description "not set".

How to see what your query looks like

When building a complex query with multiple addJoin(), setFields(), addOrder() etc. it can be difficult see what the actual query looks like when it's sent off to the database.

In ./p4a/objects/data_sources/db_source.php, I've added:

public function inspectQuery() {
return $this->_composeSelectQuery();
}

Which lets me see the SQL while debugging. I'd like to suggest it's added to the base code.

AJAX call doesn't finish

I've sync the P4A-3.8.5 version in one of my projects an now the "Loading" notification is working forever.

p4a loading

How can I repair it..?

Best regards,

Eddie

Add field type "timestamp" in db_source.php

To use the calendar popup also for fields with type 'timestamp', please add this line in "p4a/p4a/objects/data_sources/db_source.php" at 629:

        case 'timestamp':

So the lines should look like:

        case 'time':
            $this->fields->$name->setType('time');
            break;
        case 'timestamp':
        case 'datetime':
            $this->fields->$name->setType('datetime');
            break;
        case 'number':
            if (strlen($meta['SCALE']) == 0) $meta['SCALE'] = 0;

Thanks

*_seq number is not correct after a non p4a hast inserted a new record into a table

The "tablename_seq_id is not correct after a non p4a has inserted a record into a table of a MySQL database.
P4A creates a table with [tablename]_[PK_name]seq. After inserting a new record in [tablename] using a normal SQL statement and not using P4A the id in [tablename][PK_name]seq is not increased. If after that P4A tries to create a new record an SQL error appears. This problem can be solved manually by setting the AUTO_INCREMENT in the original table AND in the [tablename][PK_name]_seq table.
But I guess P4A should handle cases like this automatically. Maybe this can be done by modifying nextSequenceId in p4a_db.php so get's the real last ID of the table instead of using lastInsertId() in the exception handling. Maybe this can be solved also in the zend framwork.

How to add a js to specific mask

hello,
I need to add a jquery plugin for a specific mask in my app, how can i do that?
I try this first:

class MyApp extends P4A {
public function __construct(){
parent::__construct();
$this->addJavascript(P4A_APPLICATION_PATH. "assets/jquery.plugin.js");
}
......
}

Not working
So I try in my mask:

class MyMask extends P4A_Base_Mask{
public function __construct() {
parent::__construct();
$p4a = p4a::singleton();
$p4a->addJavascript(P4A_APPLICATION_PATH. "assets/jquery.plugin.js");
}
}

Thanks 👍

Mask's scalability

One of my Masks is now a big object defined by a file >600 lines because of UI and action methods.
Could you suggest any working example for slicing the big mask object in different chunks?
In my case there is a page with three tabs, I'd like to manage three different files, one for each tab.
I would declare click methods in a different file. To do so, should I use namespaces and use?

Another question is: how to load third parties, such as Zend Framework libraries, inside the mask object?

Accessibility (?)

Did P4A was born with accessibility in mind? How much accessible default template should be? Do you think Ajax should be disabled to be totally accessible?

I'm measuring my application's accessibility using http://validatore.it but I got back a few errors (25), I feel I can work on it, maybe I'll post some pull requests in the future.

NOTICE "Non-static" on startup

With php 5.4.4-14 I got the notice "Non-Static method Net_UserAgent_Detect::detect() should not be called ..." when starting an p4a application. I could remove this message with changing the line 105 in p4a / p4a / libraries / pear_net_useragent_detect.php to

public static function detect($in_userAgent = null, $in_detect = null)

So I would suggest add static to the function "detect".

Add a audit trail that can be shown online

The request is to add an audit trial to p4a applications. To log which user has changed which data and when. I suggest the save this information in a table like this

CREATE TABLE IF NOT EXISTS log_data (
table_name varchar(200) NOT NULL,
row_id int(11) NOT NULL,
field_name varchar(200) DEFAULT NULL,
log_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
user_id int(11) NOT NULL,
old_value text,
new_value text NOT NULL
)

This way the changes of each record can be shown on the masks. Displaying this information based on the standard SQL logging would take much more time I guess.

Would be nice if this could be a feature linked to p4a.

It looks to me that this can be done by adding this code at /p4a/objects/data_sources/db_source.php at function saveRow

        if (is_string($pks)) {
            $pk_value = $this->fields->$pks->getNewValue();
            while($field = $this->fields->nextItem()) {
                if ($field->getSchema() != $schema) continue;
                if ($field->getTable() != $table) continue;
                if ($field->getAliasOf()) {
                    $name = $field->getAliasOf();
                } else {
                    $name = $field->getName();
                }
                    if (isset($this->_tables_metadata[$table]['metadata'][$name]) and
                    !$field->isReadOnly() and
                    !array_key_exists($name, $this->_multivalue_fields)) {
                        $logNewValue = $field->getNewValue();
                        $logValue = $field->getValue();
                        if ($logNewValue <> $logValue) {
				if( isset( $_SESSION['log_user'] ) ) {
					$log_user = $_SESSION['log_user'];
				} else {
					$log_user = 0;
				}
				$db->adapter->query(" INSERT INTO log_data "
								 . "  (table_name, "
								 . "             row_id, "
								 . "             field_name, "
						                 . "             user_name, "
								 . "             old_value, "
								 . "             new_value) "
								 . " VALUES (?, ?, ?, ?, ?, ?)", 
								 array($table, 
									 $pk_value, 
									 $name, 
									 $log_user, 
									 $logValue, 
									 $logNewValue));
                        }
                }
            }
        }

and at "deleteRow" add

						if (isset($this->_tables_metadata[$table]['metadata'][$name]) and
						!$field->isReadOnly() and
						!array_key_exists($name, $this->_multivalue_fields)) {
                                                        if( isset( $_SESSION['log_user'] ) ) {
                                                                $log_user = $_SESSION['log_user'];
                                                        } else {
                                                                $log_user = 0;
                                                        }
							$logValue = $field->getValue();
							$db->adapter->query("INSERT INTO log_data(table_name, row_id, field_name, user_name, old_value, new_value) VALUES(?, ?, ?, ?, ?, 'deleted')", array($table, $pk_value, $name, $log_user, $logValue));

This implies that after the login the session var must be set. So each app using it must have the code line
$_SESSION['log_user'] = $username;
after the successful login.

Some weird error in CKEditor and Chrome

Hi,

I recently note that the CKEditor 4.2.2 it's failing when is used with Chrome

error ckeditor 4 2 2 revision f98db6d8

But if you press the browser's "back" button, the widget works.

ckeditor working after back button

But some widgets in the mask do an OnChange event to refresh the fields and the CKEditor dissapears again...

Eddie

Dependency Injection as feature request

This issue is more a feature request than an issue. Would be useful integrating the Dependency Injection design pattern for P4A 4.x development?

Would be great for lazy building of objects and referring directly to the object and not calling it as a string. Would be also useful for object's configuration management.

The multivalue fields are not refresing

Hi,

I'm using the multivalue fields to "configure" the same owner mask. So after calling the method saveRow(), the values of every mutlivalue field stills the original.

I've made a change to the db_source.php's code to resolve this issue. I guess is not the best solution, but works for me:

diff --git "a/C:\\Users\\Eddie\\AppData\\Local\\Temp\\TortoiseGit\\db_4C94.tmp\\db_source-703b206-left.php" "b/W:\\wa\\p4a-3.8.5\\p4a\\objects\\data_sources\\db_source.php"
index 1c03b40..b7fdf85 100644
--- "a/C:\\Users\\Eddie\\AppData\\Local\\Temp\\TortoiseGit\\db_4C94.tmp\\db_source-703b206-left.php"
+++ "b/W:\\wa\\p4a-3.8.5\\p4a\\objects\\data_sources\\db_source.php"
@@ -967,6 +967,9 @@ class P4A_DB_Source extends P4A_Data_Source
                foreach($row as $field=>$value){
                    $this->fields->$field->setValue($value);
                }
+               foreach ($this->_multivalue_fields as $fieldname=>$aField) {
+                   $this->fields->$fieldname->setValue($this->fields->$fieldname->getNewValue());
+               }
                $this->updateRowPosition();
            } else {
                $this->firstRow();

I hope this helps to anyone.

Cheers..!

Eddie Rodríguez

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.