View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Exportation Print/PDF/CSV + Notes - Page 2 - ProjeQtOr
 
 

Exportation Print/PDF/CSV + Notes

More
15 Jul 2013 16:16 #7 by LEVA
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 :)

Please Log in or Create an account to join the conversation.

More
15 Jul 2013 17:34 #8 by JCDe
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
Attachments:

Please Log in or Create an account to join the conversation.

More
15 Jul 2013 18:35 #9 by babynus
You should have tried (or read the fucking manual :evil: )
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 ! ;)

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
06 Aug 2013 15:12 #10 by LEVA
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.. ! ^^)

Please Log in or Create an account to join the conversation.

More
06 Aug 2013 16:43 #11 by babynus
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.

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
06 Aug 2013 17:05 - 06 Aug 2013 17:06 #12 by LEVA
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[i]);
}

for (var i in width){
  width[i]=100*width[i]/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+='<th field="'+field[0]+'" formatter="'+field[3]+'" width="'+width[field[0]]+'%">'+field[1]+'</th> ';
                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("<b>" + i18n('extracting') + " " + grid.rowCount + " " + i18n('lines')+".</b><br>" + i18n('longTraitment') + ".<br>" + 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="<?php echo i18n("dialogReportPrint");?>"
     style=";margin-left: 0px;margin-top: 0px;">
    <table style="width:100%;">
            
    <?php 
        $idUser = $_SESSION['user']->id;
        
        $query='SELECT checkboxes FROM printcheckbox WHERE `objclass`="'.$objectClass.'" 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){
            $checkboxDB=$checkboxDB[0]['checkboxes'];
            $checkboxDB=explode(";",$checkboxDB);
        }

    
        $htmlresult="<br>";
        $htmlresult.="<b>".i18n("chooseColumnPrint").' :</b><br><br>';
        $htmlresult.='<tr>';
        $htmlresult.='<form id="dialogPrintForm" name="dialogPrintForm">';

        
        $FieldsArray=$obj->getFieldsArray();
        
        

        foreach($FieldsArray as $key => $val) {
            $FieldsArray[$key]=$obj->getColCaption($val);
            if (substr($val,0,5)=='_col_') {
                if (strlen($val)>8) {
                        $section=substr($val,9);
                        $FieldsArray[$key]=i18n('section' . ucfirst($section));
                        
                }
            }
            if(substr($FieldsArray[$key],0,1)=="["){
                unset($FieldsArray[$key]);
                continue;
            }
        }
        $countFields=count($FieldsArray);
        $htmlresult.='<input type="hidden" dojoType="dijit.form.TextBox" id="column0" name="column0" value="'.$countFields.'">';
        $index=1;
        $last_key = end($FieldsArray);
        foreach($FieldsArray as $key => $val){
            if(substr($key,0,5)=="_col_"){
                if($val!=$last_key) {
                    $htmlresult.='<b>'.$val.'</b><br>';
                }
            } else if(substr($key,0,5)=="input"){
            }else {
                $checked='';
                foreach($checkboxDB as $valchecked){
                    if($valchecked==$key){
                        $checked='checked';
                    }
                }
                $dataType = $obj->getDataType($key);
                $dataLength = $obj->getDataLength($key);
                $width=5;
                $formatter='';
                if ($key=='id') { // id
                        $formatter="numericFormatter"; 
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else if ($key=='password') { // PassWord
                        // nothing
                } else if ($dataType=='date' and $val!=null and $val != '') { // Date
                        $formatter="dateFormatter";
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else if ($dataType=='datetime' and $val!=null and $val != '') { // Date and Time
                        $formatter="dateFormatter";
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else if ($dataType=='time' and $val!=null and $val != '') { // Time
                        $formatter="dateFormatter";
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else if ($key=='color' and $dataLength == 7 ) { // color
                        $formatter="colorFormatter";
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else if ($dataType=='int' and $dataLength==1) { // boolean
                        $formatter="booleanFormatter";
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else  if ($dataLength > 100) { // Text Area (must reproduce BR, spaces, ...
                        $width=20;
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                } else if (substr($key,0,2)=='id' and $dataType=='int' and strlen($key)>2 and substr($key,2,1)==strtoupper(substr($key,2,1)) ) { // Idxxx
                        if(substr($key,2,strlen($key))=='Status') {
                            $formatter="colorNameFormatter";
                            $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.'colorName'.substr($key,2,strlen($key)).';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                        } else if(substr($key,2,strlen($key))=='Profile') {
                            $formatter="translateFormatter";
                            $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.'name'.substr($key,2,strlen($key)).';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                        } else {
                            $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.'name'.substr($key,2,strlen($key)).';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                        }
                } else {
                        $htmlresult.='<input type="checkbox" dojoType="dijit.form.CheckBox" id="column'.$index.'" name="column'.$index.'" value="'.$key.';'.$val.';'.$width.';'.$formatter.';'.$key.'" '.$checked.'>'.$val.'<br>';
                }



                $index++;
            }
            
        }
         $htmlresult.="<br>";
         $htmlresult.='<input  type="checkbox" dojoType="dijit.form.CheckBox" id="checkUncheck" name="checkUncheck" value="Check" onclick="checkReportPrint();" '.$checked.'><b>'.i18n("checkUncheckAll").'</b><br><br>';
         
        echo $htmlresult; 
        


        
    ?>         

                <tr>
                    <td>
                    <button align="left" dojoType="dijit.form.Button" id="dialogePrintSubmit" onclick="executeReportPrint('<?php echo $objectClass;?>','<?php echo $idUser;?>');">
                        <?php echo i18n("buttonOK");?>
                    </button>
                    </td><td>
                    <button align="right"  dojoType="dijit.form.Button" onclick="closeReportPrint('<?php echo $objectClass;?>','<?php echo $idUser;?>');">
                        <?php echo i18n("buttonCancel");?>
                    </button>
                    <td>
                </tr>

            </form>
        
        
        </tr>
    </table>
</div>

Created the file tool/saveCheckboxes.php:
<?php
/** ===========================================================================
 * This script stores checkboxes' states
 */

    require_once "../tool/projector.php";
    scriptLog('   ->/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.
Last edit: 06 Aug 2013 17:06 by LEVA.

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.081 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.