CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Generic CCS component for PDF/Word/Excel export.

Print topic Send  topic

Author Message
bytestream

Posts: 8
Posted: 10/28/2009, 2:03 PM

Being (very) new to CCS, and like many other users, I had to fiddle quite a bit around the framework's mechanics to (partially) understand how, what, when and where.

Spending hours between the forums and testing published code, I realized that no proposed solution was universal. Instead, the overall mindset was "keep your layout as simple as possible", or "create an export page", and a plethora of other suboptimal tricks.

Since I am porting a reasonably heavy web app to CCS, I needed a simple but robust solution. Generating additional export pages was out of question, everything had to work straight out of a regular report page, and I did not consider acceptable to limit the complexity of the report layouts in order to satisfy export constraints.

Therefore I developped a solution which I believe tackle the problem at its core: the buffer filled with the web page to display: $main_block.

When an export condition is detected, the correct headers are set, and the $main_block undergoes a sequence of transformations as follows:

1. The current encoding is detected by scanning the contents of $main_block.
2. $main_block is then converted to a known universal encoding (utf-8).
3. Using regex'es, $main_block is then stripped of all style, script code, embedded objects and invisible text. Line breaks are added when required to prevent joining words during further tag removals occurring at stage 4.
4. $main_block is stripped of all remaining regular HTML tags, except for customizable exceptions.
5. HTML entities are converted to their applicable characters.
6. Finally, $main_block is converted back to its original encoding.

Cleaning the buffer and leaving only the tags I require is now simple, a typical function call for Word or Excel looks like:

$main_block=clean_tpl($main_block,"<p><table><tr><td><th><label><caption>");

And for Pdf (with TCPDF):

$pdf->writeHTML(clean_tpl($main_block,"<p><table><tr><td><th><label><caption>"), true, 0, true, 0);

As you may see, the function takes only 2 arguments: the buffer, and a string containing the tags I want to leave untouched. This provides for unlimited flexibility while still giving the choice to strip down the HTML code up to bare text if required.

Now the idea would be to design a third-party CCS component integrating all these 3 export options in one go, accessible through their respective icons a bit like the Navigator. However, I have very little time for this and would like to know if any CCS guru would like to collaborate to develop this component, which, if reasonably priced, could probably interest several CCS developpers.
View profile  Send private message
Edd


Posts: 547
Posted: 10/28/2009, 7:06 PM

If your database is MSSQL then you should automatically go to MS Reporting Services (most hosting companies now provide this a a minimal cost $5 / month) and you build real reports for Word / Excel and PDFs.

I use CCS for reporting in small sites but MS Reporting Services blows it out of the water.

Depends how serious you are on reporting and analysis.

My 2 cents.

Cheers
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
javadev
Posted: 10/28/2009, 7:06 PM

As a matter of interest (and off-topic), why are you porting this to
CCS? What was it developed in before? Why do you consider CCS 'better'
than the other development tool?

bytestream wrote:

>
> Since I am porting a reasonably heavy web app to CCS,
bytestream

Posts: 8
Posted: 10/29/2009, 1:14 AM

Quote Edd:
If your database is MSSQL then you should automatically go to MS Reporting Services (most hosting companies now provide this a a minimal cost $5 / month) and you build real reports for Word / Excel and PDFs.

I use CCS for reporting in small sites but MS Reporting Services blows it out of the water.

Depends how serious you are on reporting and analysis.

My 2 cents.

Cheers

I tend to avoid MS-based products, specially at a time governments have either asked their apparatus to migrate to open source (India, Brazil for ex.), or prohibited entire sections of their administration to use MS products (Russia).

Besides, half the DB world market belongs to Oracle, MS controls something like less than 14%, and is the only DB maker which has seen his market share decrease in 2008 IIRC.

But regardless of these considerations, business intelligence starts first with a brain, second with intimate knowledge of the set of data you are analyzing, and in that sense, any tool which does not impose artificial limits on what you are trying to do will get the job done. IMHO, an excellent product is QLR Manager (http://www.qlrmanager.com/) supporting Oracle, Postgres, MySQL and MSSQL.

View profile  Send private message
bytestream

Posts: 8
Posted: 10/29/2009, 1:38 AM

Quote javadev:
As a matter of interest (and off-topic), why are you porting this to
CCS? What was it developed in before? Why do you consider CCS 'better'
than the other development tool?

bytestream wrote:

>
> Since I am porting a reasonably heavy web app to CCS,

I never said that I consider CCS better than other environments ;) The best environment is the one you feel good with provided it supports the features you need.

In this case, it's the third major version of a web app managing a network of partnering agencies, and the workload doesn't come from the amount of records, but from the fact that the business model is structurally highly volatile over time, with about 50% of these agencies operating each under a specific contract defining their accounting model, price structure for products & services, the range of products and services they are entitled to provide, etc... Just to give an example, the dynamic authentificacion system requires over 1400 records in order to manage userlevels and tables with the related create/delete/update/read/search/export permissions.

The two first versions were written with PHP/Ajax and MySQL. But since Sun (owning MySQL AB) has been now bought by Oracle, I don't have any confidence in MySQL, and as far as I know, most MySQL core developers have now left that project. Therefore the new app has been migrated to Postgres.

You may see that in this particular case, CCS was a natural choice in order to capitalize parts of the former code (PHP/Ajax), supports Postgres, and it's RAD approach allows me to swiftly modify the app when my client requires a feature to be changed or added.
View profile  Send private message
datadoit
Posted: 10/29/2009, 3:58 AM

Good job! Any extension to enhance the product and it's survivability
is a good thing.
javadev
Posted: 10/29/2009, 5:41 AM

Thanks for the info. Interesting point you make about MySQL... we're
considering moving to Postgres as well but sticking with MySQL for the
immediate future. Was the migration straightforward? One thing we
notcied about MySQL was the more regular updates since Oracle took over
Sun, but they've killed off version 6...

bytestream wrote:
>
Quote javadev:
> As a matter of interest (and off-topic), why are you porting this to
> CCS? What was it developed in before? Why do you consider CCS 'better'
> than the other development tool?
>
> bytestream wrote:
>
>> Since I am porting a reasonably heavy web app to CCS,
>
>
> I never said that I consider CCS better than other environments ;) The best
> environment is the one you feel good with provided it supports the features you
> need.
>
> In this case, it's the third major version of a web app managing a network of
> partnering agencies, and the workload doesn't come from the amount of records,
> but from the fact that the business model is structurally highly volatile over
> time, with about 50% of these agencies operating each under a specific contract
> defining their accounting model, price structure for products & services, the
> range of products and services they are entitled to provide, etc... Just to give
> an example, the dynamic authentificacion system requires over 1400 records in
> order to manage userlevels and tables with the related
> create/delete/update/read/search/export permissions.
>
> The two first versions were written with PHP/Ajax and MySQL. But since Sun
> (owning MySQL AB) has been now bought by Oracle, I don't have any confidence in
> MySQL, and as far as I know, most MySQL core developers have now left that
> project. Therefore the new app has been migrated to Postgres.
>
> You may see that in this particular case, CCS was a natural choice in order to
> capitalize parts of the former code (PHP/Ajax), supports Postgres, and it's RAD
> approach allows me to swiftly modify the app when my client requires a feature
> to be changed or added.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
test

Posts: 2
Posted: 10/29/2009, 6:29 AM

Hello everyone. I am really stuck with this and I do not know anything about codecharge. Please help me out of this. The issue is I have a php file which i load as a template file.
$tpl = new Template($app_path);
$tpl->load_file(hello.php, "template");
hello.php as the following include: include("menu.php")
But when i do this the php script in hello.php wont get executed. How can I enable that php script. Thank you in advance. I am sorry for posting this wrong place
View profile  Send private message
datadoit
Posted: 10/29/2009, 1:32 PM

Sorry folks... you guys are on a different planet. The Oracle/Sun
acquisition is far from finalized. Many more steps to go yet. Looking
at 2Q10 at the earliest.

Additionally, MySQL will not be going anywhere anytime soon. It'll fit
in nicely with the Oracle db product line. If anything, it'll likely be
greatly improved upon.
damian

Posts: 838
Posted: 10/29/2009, 6:09 PM

Quote test:
Hello everyone. I am really stuck with this and I do not know anything about codecharge. Please help me out of this. The issue is I have a php file which i load as a template file.
$tpl = new Template($app_path);
$tpl->load_file(hello.php, "template");
hello.php as the following include: include("menu.php")
But when i do this the php script in hello.php wont get executed. How can I enable that php script. Thank you in advance. I am sorry for posting this wrong place

you arent sorry about posting in someone elses thread - if you were you wouldnt have done it.
someone will or wont reply to your original request - posting here will only annoy fellow users
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
javadev
Posted: 10/30/2009, 6:40 AM

Well that would be great :)

datadoit wrote:
> Sorry folks... you guys are on a different planet. The Oracle/Sun
> acquisition is far from finalized. Many more steps to go yet. Looking
> at 2Q10 at the earliest.
>
> Additionally, MySQL will not be going anywhere anytime soon. It'll fit
> in nicely with the Oracle db product line. If anything, it'll likely be
> greatly improved upon.
bytebeam

Posts: 6
Posted: 10/31/2009, 2:35 AM

Quote datadoit:
Sorry folks... you guys are on a different planet. The Oracle/Sun
acquisition is far from finalized. Many more steps to go yet. Looking
at 2Q10 at the earliest.

Additionally, MySQL will not be going anywhere anytime soon. It'll fit
in nicely with the Oracle db product line. If anything, it'll likely be
greatly improved upon.

With all due respect, I disagree. The main author and co-founder of MySQL knows probably more about this than anybody else, and that's what he's saying on the matter. First his initial reaction after the merger announcement in April 2009:

http://monty-says.blogspot.com/2009/04/to-be-free-or-not-to-be-free.html

Then this came in a few days ago:

http://news.cnet.com/8301-13578_3-10379870-38.html

And finally lets not forget that Monthy is now leading a MySQL fork, Maria DB:

http://askmonty.org/wiki/index.php/MariaDB

Draw your own conclusions...
View profile  Send private message
bytebeam

Posts: 6
Posted: 10/31/2009, 2:55 AM

Quote javadev:
Was the migration straightforward?

Generically it's not critical. Two things I didn't like:

- Despite the fact that Postgres boolean fields interpret correctly several types of boolean semantics when INSERTING or UPDATING, a SELECT returns by default the character values 'f' or 't'. In PHP, if your code isn't specifically tailored to cope with this case, you end up with your supposed bool var always checking as true.

A simple fix is to use smallest int available with 0's and 1's (smallint or in2), but you waste 15 bits.

- Bit fields present an inefficient memory footprint. You can declare bit fields of any length, but Postgres will require 1 byte for any group of 1-8 bits, + additional 5-8 bytes per bit field.

This means that if you do not need big bit fields, you are better off using regular int fields (like int2 for 16bits or int4 for 32 bits) and resort to bitwise operators.

View profile  Send private message
hector

Posts: 16
Posted: 11/02/2009, 4:04 AM

Quote bytestream:
Now the idea would be to design a third-party CCS component integrating all these 3 export options in one go, accessible through their respective icons a bit like the Navigator. However, I have very little time for this and would like to know if any CCS guru would like to collaborate to develop this component, which, if reasonably priced, could probably interest several CCS developpers.

Hello Bytestream,

I understand that your idea is to find a programmer that makes a CCS widget to automatize the Export Building, like Record Builder, Report Builder etc. It could be offer to the CCS comunity at a reasonable price.

A reasonable price would be based in the size of the potential market. The potential market are the active CodeCharge customers plus the natural growth. It is not the same calculate the price for a product that is, let say, 150 hours effort among 10 customers than among 10.000.

The question is what is the size of the potential market?

I think that CodeCharge needs more marketing. I did a kind of investigation about PHP RADs in LinkedIN and PHPCoders dont know CodeCharge. Maybe YesSoftware should have a more active OpenSource strategy.

By the way, You mentioned clean_tpl in your code. is it a function that you build? I use TCPDF and I am incorporating HTMLPurifier to cleanup HTML.



View profile  Send private message
bytestream

Posts: 8
Posted: 11/02/2009, 10:07 AM

Quote hector:

Hello Bytestream,

I understand that your idea is to find a programmer that makes a CCS widget to automatize the Export Building, like Record Builder, Report Builder etc. It could be offer to the CCS comunity at a reasonable price.

A reasonable price would be based in the size of the potential market. The potential market are the active CodeCharge customers plus the natural growth. It is not the same calculate the price for a product that is, let say, 150 hours effort among 10 customers than among 10.000.

The question is what is the size of the potential market?

I think that CodeCharge needs more marketing. I did a kind of investigation about PHP RADs in LinkedIN and PHPCoders dont know CodeCharge. Maybe YesSoftware should have a more active OpenSource strategy.

By the way, You mentioned clean_tpl in your code. is it a function that you build? I use TCPDF and I am incorporating HTMLPurifier to cleanup HTML.


Well, the market projection concerning potential buyers is of course a significant issue, and to be honest, I was hoping to get an approximate feeling by looking where this thread goes.

clean_tpl($main_block,$allowed_html_tags) is effectively a function I wrote, whose description is included in the first post. The difference is that while HTMLPurifier is meant to "sanitize" html pages, clean_tpl instead allows full control of what you want to strip out of that HTML page since you can choose as argument the tags you want to leave untouched.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.