Hi Babynus,
I'm working on the export functionality of Project'Or RIA and I had one proposition, one remark and one question.
PROPOSITION :
I made a dialog that pops up when you try to print/PDF/CSV on objectList.php.
This dialog proposes to choose the colomn you want to see in your print/PDF/CSV.
The idea comes from the lack of some infos when they are not in the model layout.
If you are interested, I can introduce it more to you with screenshot and .. text..
I was thinking of creating a XLSX export thingy too..
REMARK :
When exporting as a PDF, it seems that it does not take all the page width ... Columns are thin whereas when printing then the table takes all the page (sometimes more when it's to much ^^)
It is a bug ?
QUESTION :
I want to be able to export Notes as well as other column.. do you think it is possible with, for example, the jsonQuery.php ?
Have a good week end.
I made a dialog that pops up when you try to print/PDF/CSV on objectList.php.
This dialog proposes to choose the colomn you want to see in your print/PDF/CSV.
The idea comes from the lack of some infos when they are not in the model layout.
Good idea. 🙂
I don't thing it is a real lack for CSV, as every data is exported.
But this could be a good improvement, and to keep the as-is behavious, maybe an automatic "check all" could be good.
Just pay attention to access rights. For instance some profiles may not see work or cost...
If you are interested, I can introduce it more to you with screenshot and .. text..
Yes please :woohoo:
I was thinking of creating a XLSX export thingy too..
Another good improvement 😛
When exporting as a PDF, it seems that it does not take all the page width ... Columns are thin whereas when printing then the table takes all the page (sometimes more when it's to much ^^)
It is a bug ?
I don't really understand what you mean. :blush:
Possibly some unexpected behavious depending on screen resolution ? :S
if you have any example / print screen ... 😉
I want to be able to export Notes as well as other column.. do you think it is possible with, for example, the jsonQuery.php ?
Well, jsonQuery won't be an issue, but it will be to export as CSV or XSLS : and don't see how you'll export several notes in one only line 🙁
Nive week-end to you too B)
I made a dialog that pops up when you try to print/PDF/CSV on objectList.php.
This dialog proposes to choose the colomn you want to see in your print/PDF/CSV.
The idea comes from the lack of some infos when they are not in the model layout.Good idea.
I don't thing it is a real lack for CSV, as every data is exported.
But this could be a good improvement, and to keep the as-is behavious, maybe an automatic "check all" could be good.
Just pay attention to access rights. For instance some profiles may not see work or cost...
There is already a check all and uncheck all boxes 😉
And I made a new table to store previous checkboxes configuration as soon as my customized datas have a lot of possible column and the operator could be bored to check his own config..
Today, it stores the config for everyone per model, but it can easily be done per user too.
I did not at all work on accessright .. because my own datas do not have such problem. But I guess I could add it and check when checkboxes are build. I'll investigate.
If you are interested, I can introduce it more to you with screenshot and .. text..
Yes please
When you click on extract buttons, this pops ups : (here for status)

I think it speacks for itself (at least for french readers..)
I am thinking of adding th section information to organize the window a bit more..
If you try to extract more than 200 data this shows up :

I added this because I think that it is unrealistic to extract that much of data..
Of course, every texts are translated by il18n().
Print window is unchanged.
I was thinking of creating a XLSX export thingy too..
Another good improvement
Only thinking ^^
When exporting as a PDF, it seems that it does not take all the page width ... Columns are thin whereas when printing then the table takes all the page (sometimes more when it's to much ^^)
It is a bug ?I don't really understand what you mean.
Possibly some unexpected behavious depending on screen resolution ?
if you have any example / print screen ...
Two images to show my problem.
When I extract Status I have those two results : (with the same input layout)
With Print : 
With PDF : 
I don't really understand why the table does not takes all the page in the pdf extraction.. I would have if it was also in the print view.. but..
I want to be able to export Notes as well as other column.. do you think it is possible with, for example, the jsonQuery.php ?
Well, jsonQuery won't be an issue, but it will be to export as CSV or XSLS : and don't see how you'll export several notes in one only line
If I can print it in one column like a basical varchar I'll be happy ^^
My operators have some particular way of using notes so perhaps should I make my own notes.. like a new field...
Hi,
About PDF export :
I just tested on current version, export is correct in PDF.
I thing you changed some behavious in your version.
What is important to know about pdf Export, is that the library used (html2pdf) will not display correctly if you set width only on headers...
So you must specify the width of colomns on each line...
Moreover, for width in %, the total "must" be 100%. If less, it won't fulfill the page, if more, it won't fit in the page. This may be a real issue is your set columns selectable : you'll have to recalculate width to that total is 100% depending on selection :ohmy:
Annnh... And my happiness is gone..
I actually thought that the width parameter worked like print, and did not care too much about it ^^
So yes, when I create the export Layout, it has its own witdhs..
OK, I think I have a solution... 🙂
And problem solved 🙂
Very interresting these developments!! Congratulations.
Another point would be interresting: Add possibility of extracting data to import.
- Do not write the name (project, type, ...), but the IDs
- Set the first line in the correct import format
This will have the advantage of being able to do extractions, make the changes to the file and import effortlessly.
Thanks
Hi JCDe,
I think its already possible with the CSV exportation. Importation procedure will read the project, type... and associate it with the corresponding one line the database.
However, I did not try 🙂
And no ...
I'll place pictures to show: Following an export attached
In this file you see: The names of activities, projects and header line with spaces between the names
Attached is an import file
1) Note that the header line corresponds to BDD table (more space)
2) The names of projects, types are replaced by the corresponding IDs.
This requires the user after a export transfmormer by hand all names with the corresponding IDs with risk of this mistake.
In the ideal should be two assemblies to navigate (Cells with IDs and a comment on the cell with actual name)
Thanks
You should have tried (or read the fucking manual 👿 )
http://track.projectorria.org/manual/manual.php?page=107&tag=import
It works. :woohoo:
You can export data to csv, update file (just pay attention to date format if you do this with Excel), and re-import it.
Import procedure is done for this to work ! 😉
Hey Babynus, you didn't really tell me if you were interested in my export thingy.
I don't know if the code really meets your expectations, but well... why not
(And btw I did not implemented the accessright issue, but I dont need it to be ... and I dont really know how ^^)
(Ok, I'll investigate.. ! ^^)
Of course I am interested :woohoo:
Please send me your devs.
I'll try to fulfill devs about accessright and fiabilization, if it's not too buggy.
Thanks.
Allright.. there is a bunch of things :
In view/js/projectorDialog.js I added :
var ReportPrintType ='';
//open the dialog with checkboxes
function openReportPrint (Type) {
ReportPrintType =Type;
if (formChangeInProgress) {
showAlert(i18n('alertOngoingChange'));
return;
}
top.dijit.byId("dialogReportPrint").show();
}
//close the dialog with checkboxes
function closeReportPrint (obj,idUser) {
top.dijit.byId("dialogReportPrint").hide();
saveCheckboxReportPrint(obj,idUser);
}
//save current state of checkboxes
function saveCheckboxReportPrint(obj,idUser){
var val = dojo.byId('column0').value;
var toStore=obj+";"+idUser;
val = eval(val);
for(i=1; i<val+1;i++){
var checkbox=dojo.byId('column'+i);
if(checkbox) {
if(checkbox.checked) {
var field=checkbox.value.split(';');
toStore=toStore + ";" + field[4];
}
}
}
var xhr = getXMLHttpRequest();
var toSend = encodeURIComponent(toStore);
xhr.open("GET", "../tool/saveCheckboxes.php?toStore=" + toSend , true);
xhr.send(null);
}
//pretty sure you're familiar with this
function getXMLHttpRequest() {
var xhr = null;
if (window.XMLHttpRequest || window.ActiveXObject) {
if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
xhr = new XMLHttpRequest();
}
} else {
alert("Votre navigateur ne supporte pas l'objet XMLHTTPRequest...");
return null;
}
return xhr;
}
//computes witch so pdf export takes all page.
function egalizeWidth(width){
var SumWidth=0;
for (var i in width){
SumWidth = parseInt(SumWidth)+parseInt(width);
}
for (var i in width){
width=100*width/SumWidth;
}
return width;
}
var layoutPrint ='';
//Executes the report (shows the print/pdf/csv)
function executeReportPrint(obj,idUser) {
layoutPrint ='';
var verif=0;
var val = dojo.byId('column0').value;
val = eval(val);
var width = {};
for(i=1; i<val+1;i++){
var checkbox=dojo.byId('column'+i);
if(checkbox) {
if(checkbox.checked) {
var field=checkbox.value.split(';');
width[field[0]]=field[2];
}
}
}
width = egalizeWidth(width);
for(i=1; i<val+1;i++){
var checkbox=dojo.byId('column'+i);
if(checkbox) {
if(checkbox.checked) {
var field=checkbox.value.split(';');
layoutPrint+=''+field[1]+' ';
verif=1;
}
}
}
if(verif==1){
var grid = dijit.byId("objectGrid");
if(grid.rowCount > 200) {
actionYes=function() {
if(ReportPrintType=='print') {
showPrint("../tool/jsonQuery.php", 'list');
} else if(ReportPrintType=='csv') {
showPrint("../tool/jsonQuery.php", 'list', null, 'csv');
} else if(ReportPrintType=='pdf') {
showPrint("../tool/jsonQuery.php", 'list', null, 'pdf');
} else {
showPrint("../tool/jsonQuery.php", 'list');
}
closeReportPrint (obj,idUser);
};
actionNo=function() { closeReportPrint (obj,idUser); };
showQuestion("" + i18n('extracting') + " " + grid.rowCount + " " + i18n('lines')+".
" + i18n('longTraitment') + ".
" + i18n('wantToExtract'),actionYes,actionNo);
} else {
if(ReportPrintType=='print') {
showPrint("../tool/jsonQuery.php", 'list');
} else if(ReportPrintType=='csv') {
showPrint("../tool/jsonQuery.php", 'list', null, 'csv');
} else if(ReportPrintType=='pdf') {
showPrint("../tool/jsonQuery.php", 'list', null, 'pdf');
} else {
showPrint("../tool/jsonQuery.php", 'list');
}
closeReportPrint (obj,idUser);
}
} else {
showAlert(i18n('alertChooseOneAtLeast'));
}
}
//Check or uncheck all boxes
function checkReportPrint () {
var check = dojo.byId('checkUncheck').checked;
var val = dojo.byId('column0').value;
val = eval(val);
for(i=1; i<val+1;i++){
var checkbox=dijit.byId('column'+i);
if(checkbox) {
dijit.byId(checkbox).setValue(check);
}
}
}
In view/objectList.php :
<div id="dialogReportPrint" dojoType="dijit.Dialog" title=""
style=";margin-left: 0px;margin-top: 0px;">
| <button align="left" dojoType="dijit.form.Button" id="dialogePrintSubmit" onclick="executeReportPrint('','');"> | <button align="right" dojoType="dijit.form.Button" onclick="closeReportPrint('','');"> |
Created the file tool/saveCheckboxes.php:
/tool/jsonQuery.php');
header("Content-Type: text/plain"); // Utilisation d'un header pour spécifier le type de contenu de la page. Ici, il s'agit juste de texte brut (text/plain).
$toStore = (isset($_GET["toStore"])) ? $_GET["toStore"] : NULL;
$toStore=explode(";",$toStore);
if(count($toStore)>1){
$objClass = $toStore[0];
$idUser = $toStore[1];
unset($toStore[0]);
unset($toStore[1]);
if(count($toStore)==0) {
$toStore='';
} else {
$toStore=implode(";",$toStore);
}
$query='SELECT objclass FROM printcheckbox WHERE `objclass`="'.$objClass.'" AND idUser="'.$idUser.'";';
$result=Sql::query($query);
$line = Sql::fetchLine($result);
$checkboxDB=array();
while($line) {
$checkboxDB[]=$line;
$line = Sql::fetchLine($result);
}
if(count($checkboxDB)>0){
$query ="UPDATE printcheckbox set checkboxes='".$toStore."' WHERE objclass='".$objClass."' AND idUser='".$idUser."';";
} else {
$query ="INSERT INTO printcheckbox (`objclass`,`checkboxes`,`idUser`) VALUES('".$objClass."','".$toStore."','".$idUser."')";
}
$result=Sql::query($query);
}
?>
Created table :
CREATE TABLE `${prefix}printcheckbox` (
`id` int(12) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
`objclass` varchar(50) DEFAULT NULL,
`idUser` int(12) unsigned DEFAULT NULL,
`checkboxes` varchar(500) DEFAULt NULL,
`idle` int(1) unsigned DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
Since the last time, I added the fact that it stores checkboxes states for each user.
Note : my queries do not take $prefix into account.
Thanks !
I will have a look for integration in V3.5.0
You're welcome ^^
I hope it will meet your standards !
Hi LEVA,
I tried to test your code to try and include it in next version.
Here are my remarks :
- Some minor html tags incorrect closure in the objectList new div.
I fixed them. - Direct SQL in code is not good coding practice.
Must use some object.
This will make the use of $prefix transparent.
I'll try and translate your SQL into some object management, it should not be complex - You forgot to include some objectList change, to change button click behaviour.
I could manage to fix one. Others should be simple. - You also forgot to include some change in jsonQuery.php.
This is a major part of your code.
Could you please post you changes in jsonQuery.php so that I can include you code in next version ? - I guess some fields are missing in your list : for project and activities, all progress data are stored in a remote object PlanningElement (not easy to guess on your side).
I'll have a look to check how to retrieve them - Some fileds with attribute "noExport" must not be exported. Once again, it was not easy to guess
I hope I can finish to implement your coding in next version, because it is very good job.
Thnaks for your contribution.
I guess some fields are missing in your list : for project and activities, all progress data are stored in a remote object PlanningElement (not easy to guess on your side).
I'll have a look to check how to retrieve them
My mistake !
Your code correctly takes these fields into account !
Other issue that has to be fixed : some work and cost fields should not be exposed (not exported, nor displayed is selection list) depending on defined rights.
Hi LEVA,
Hope you'll see posts : it seems the email you provided is not rooted correctly.
